Loading src/test/java/it/inaf/oats/vospace/JobServiceTest.java +43 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,12 @@ public class JobServiceTest { @Mock private MoveService moveService; @Mock private CopyService copyService; @Mock private FileServiceClient fileServiceClient; @InjectMocks private JobService jobService; Loading Loading @@ -217,6 +223,43 @@ public class JobServiceTest { assertEquals(ExecutionPhase.COMPLETED, phases.get(2)); } @Test public void testStartJobCopyNode() { Transfer copyNode = new Transfer(); copyNode.setDirection("vos://example.com!vospace/myfile"); copyNode.setKeepBytes(true); JobSummary job = new JobSummary(); setJobInfo(job, copyNode); when(uriService.getTransfer(any())).thenReturn(copyNode); List<ExecutionPhase> phases = new ArrayList<>(); doAnswer(invocation -> { JobSummary j = invocation.getArgument(0); phases.add(j.getPhase()); 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 { Thread.sleep(500); } 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(); transfer.setTarget("vos://example.com!vospace/myfile"); Loading src/main/java/it/inaf/oats/vospace/JobService.java +1 −1 File changed.Contains only whitespace changes. Show changes Loading
src/test/java/it/inaf/oats/vospace/JobServiceTest.java +43 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,12 @@ public class JobServiceTest { @Mock private MoveService moveService; @Mock private CopyService copyService; @Mock private FileServiceClient fileServiceClient; @InjectMocks private JobService jobService; Loading Loading @@ -217,6 +223,43 @@ public class JobServiceTest { assertEquals(ExecutionPhase.COMPLETED, phases.get(2)); } @Test public void testStartJobCopyNode() { Transfer copyNode = new Transfer(); copyNode.setDirection("vos://example.com!vospace/myfile"); copyNode.setKeepBytes(true); JobSummary job = new JobSummary(); setJobInfo(job, copyNode); when(uriService.getTransfer(any())).thenReturn(copyNode); List<ExecutionPhase> phases = new ArrayList<>(); doAnswer(invocation -> { JobSummary j = invocation.getArgument(0); phases.add(j.getPhase()); 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 { Thread.sleep(500); } 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(); transfer.setTarget("vos://example.com!vospace/myfile"); Loading
src/main/java/it/inaf/oats/vospace/JobService.java +1 −1 File changed.Contains only whitespace changes. Show changes