diff --git a/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageEnhancementsRouterTest.java b/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageEnhancementsRouterTest.java index 446565cac2..9c8571f617 100644 --- a/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageEnhancementsRouterTest.java +++ b/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/ImageEnhancementsRouterTest.java @@ -1,7 +1,6 @@ package edu.unc.lib.boxc.services.camel.images; import org.apache.camel.BeanInject; -import org.apache.camel.CamelExecutionException; import org.apache.camel.EndpointInject; import org.apache.camel.Exchange; import org.apache.camel.Produce; @@ -34,8 +33,6 @@ import static org.fcrepo.camel.FcrepoHeaders.FCREPO_DATE_TIME; import static org.fcrepo.camel.FcrepoHeaders.FCREPO_EVENT_TYPE; import static org.fcrepo.camel.FcrepoHeaders.FCREPO_URI; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -89,7 +86,7 @@ public void testAccessCopyRouteNoForceNoFileExists() throws Exception { createContext(accessCopyRoute); var jp2Endpoint = getMockEndpoint("mock:bean:jp2Processor"); - jp2Endpoint.expectedMessageCount(1); + jp2Endpoint.expectedMessageCount(0); Map headers = createEvent(fileID, eventTypes, "false"); @@ -101,37 +98,13 @@ public void testAccessCopyRouteNoForceNoFileExists() throws Exception { jp2Endpoint.assertIsSatisfied(); } - @Test - public void testAccessCopyRouteScriptFails() throws Exception { - when(addAccessCopyProcessor.needsRun(any())).thenReturn(true); - createContext(accessCopyRoute); - - var jp2Endpoint = getMockEndpoint("mock:bean:jp2Processor"); - jp2Endpoint.expectedMessageCount(1); - jp2Endpoint.whenAnyExchangeReceived(exchange -> { - throw new IllegalStateException("Failing run of exec"); - }); - - Map headers = createEvent(fileID, eventTypes, "false"); - try { - template.sendBodyAndHeaders("", headers); - fail("Exception expected to be thrown"); - } catch (CamelExecutionException e) { - assertTrue(e.getCause() instanceof IllegalStateException); - } - - verify(addAccessCopyProcessor, never()).process(any(Exchange.class)); - verify(addAccessCopyProcessor).cleanupTempFile(any(Exchange.class)); - jp2Endpoint.assertIsSatisfied(); - } - @Test public void testAccessCopyRouteForceNoFileExists() throws Exception { when(addAccessCopyProcessor.needsRun(any())).thenReturn(true); createContext(accessCopyRoute); var jp2Endpoint = getMockEndpoint("mock:bean:jp2Processor"); - jp2Endpoint.expectedMessageCount(1); + jp2Endpoint.expectedMessageCount(0); Map headers = createEvent(fileID, eventTypes, "true"); @@ -173,7 +146,7 @@ public void testAccessCopyRouteForceFileExists() throws Exception { createContext(accessCopyRoute); var jp2Endpoint = getMockEndpoint("mock:bean:jp2Processor"); - jp2Endpoint.expectedMessageCount(1); + jp2Endpoint.expectedMessageCount(0); Map headers = createEvent(fileID, eventTypes, "true"); @@ -206,7 +179,6 @@ public void testAccessCopyDisallowedImageType() throws Exception { createContext(accessCopyRoute); when(addAccessCopyProcessor.needsRun(any())).thenReturn(true); - //when(jp2Processor.process(Exchange.class);) var jp2Endpoint = getMockEndpoint("mock:bean:jp2Processor"); jp2Endpoint.expectedMessageCount(0); diff --git a/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/Jp2ProcessorTest.java b/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/Jp2ProcessorTest.java index 75d91d629b..8baf7e7ab3 100644 --- a/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/Jp2ProcessorTest.java +++ b/services-camel-app/src/test/java/edu/unc/lib/boxc/services/camel/images/Jp2ProcessorTest.java @@ -70,8 +70,8 @@ public void testJp2Processor() throws Exception { processor.process(exchange); mockedStatic.verify(() -> CLIMain.main(new String[]{"jp24u", "kdu_compress", - "-f", "\"de/75/d8/11/de75d811-9e0f-4b1f-8631-2060ab3580cc\"", "-o", "\"" + derivTmpPath + "\"", - "-sf", "\"image/tiff\""})); + "-f", "de/75/d8/11/de75d811-9e0f-4b1f-8631-2060ab3580cc", "-o", derivTmpPath, + "-sf", "image/tiff"})); } } @@ -81,8 +81,8 @@ public void testNoFileInput() throws Exception { mockedStatic.when(() -> CLIMain.main(new String[]{anyString()})).thenThrow(IllegalArgumentException.class); processor.process(exchange); - mockedStatic.verify(() -> CLIMain.main(new String[]{"jp24u", "kdu_compress", "-f", "\"null\"", - "-o", "\"" + derivTmpPath + "\"", "-sf", "\"image/tiff\""})); + mockedStatic.verify(() -> CLIMain.main(new String[]{"jp24u", "kdu_compress", "-f", null, + "-o", derivTmpPath, "-sf", "image/tiff"})); } } }