Commit e302b098 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added test on JobService

parent 5d8899dc
Pipeline #2209 passed with stages
in 2 minutes and 21 seconds
......@@ -203,7 +203,7 @@ public class JobService {
List<String> sourceAndDestination = copyService.processCopyNodes(transfer, jobId, user);
// Call file service and command copy
fileServiceClient.startFileCopyJob(sourceAndDestination.get(0), sourceAndDestination.get(1), jobId, user);
fileServiceClient.startFileCopyJob(sourceAndDestination.get(0), sourceAndDestination.get(1), jobId, user);
} catch (Exception e) {
// We decided not to purge metadata in case of failure
// just release busy nodes setting job_id = null
......@@ -55,6 +55,12 @@ public class JobServiceTest {
private MoveService moveService;
private CopyService copyService;
private FileServiceClient fileServiceClient;
private JobService jobService;
......@@ -217,6 +223,43 @@ public class JobServiceTest {
assertEquals(ExecutionPhase.COMPLETED, phases.get(2));
public void testStartJobCopyNode() {
Transfer copyNode = new Transfer();
JobSummary job = new JobSummary();
setJobInfo(job, copyNode);
List<ExecutionPhase> phases = new ArrayList<>();
doAnswer(invocation -> {
JobSummary j = invocation.getArgument(0);
return null;
}).when(jobDAO).updateJob(any(), any());
when(copyService.processCopyNodes(any(), any(), any())).thenReturn(List.of("source", "dest"));
jobService.setJobPhase(job, "RUN");
verify(fileServiceClient, timeout(1000).times(1)).startFileCopyJob(eq("source"), eq("dest"), any(), any());
verify(jobDAO, timeout(1000).times(3)).updateJob(any(), any());
try {
} catch (InterruptedException ex) {
assertEquals(ExecutionPhase.EXECUTING, phases.get(0));
assertEquals(ExecutionPhase.EXECUTING, phases.get(1));
assertEquals(ExecutionPhase.EXECUTING, phases.get(2));
private Transfer getPullFromVoSpaceHttpTransfer() {
Transfer transfer = new Transfer();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment