3636import org .apache .camel .test .spring .CamelSpringTestSupport ;
3737import org .apache .commons .io .FileUtils ;
3838import org .junit .After ;
39- import org .junit .Before ;
4039import org .junit .Test ;
4140import org .springframework .context .support .AbstractApplicationContext ;
4241import org .springframework .context .support .ClassPathXmlApplicationContext ;
4342
44- import edu .unc .lib .boxc .services .camel .images .AddDerivativeProcessor ;
45-
4643public class ImageEnhancementsRouterTest extends CamelSpringTestSupport {
4744 private static final String EVENT_NS = "http://fedora.info/definitions/v4/event#" ;
4845 private static final String EVENT_TYPE = "org.fcrepo.jms.eventType" ;
@@ -423,6 +420,7 @@ public void testAccessCopyRouteForceFileExists() throws Exception {
423420 public void testAccessCopyRejection () throws Exception {
424421 createContext (accessCopyRoute );
425422
423+ when (addAccessCopyProcessor .needsRun (any ())).thenReturn (true );
426424 getMockEndpoint ("mock:process.enhancement.imageAccessCopy" ).expectedMessageCount (0 );
427425
428426 Map <String , Object > headers = createEvent (fileID , eventTypes , "false" );
@@ -438,6 +436,7 @@ public void testAccessCopyRejection() throws Exception {
438436 public void testAccessCopyDisallowedImageType () throws Exception {
439437 createContext (accessCopyRoute );
440438
439+ when (addAccessCopyProcessor .needsRun (any ())).thenReturn (true );
441440 getMockEndpoint ("mock:exec:/bin/sh" ).expectedMessageCount (0 );
442441
443442 Map <String , Object > headers = createEvent (fileID , eventTypes , "false" );
@@ -449,6 +448,23 @@ public void testAccessCopyDisallowedImageType() throws Exception {
449448 assertMockEndpointsSatisfied ();
450449 }
451450
451+ @ Test
452+ public void testAccessCopyIconFile () throws Exception {
453+ createContext (accessCopyRoute );
454+
455+ when (addAccessCopyProcessor .needsRun (any ())).thenReturn (true );
456+ getMockEndpoint ("mock:exec:/bin/sh" ).expectedMessageCount (0 );
457+
458+ Map <String , Object > headers = createEvent (fileID , eventTypes , "false" );
459+ headers .put (CdrBinaryMimeType , "image/x-icon" );
460+
461+ template .sendBodyAndHeaders ("" , headers );
462+
463+ verify (addAccessCopyProcessor ).needsRun (any (Exchange .class ));
464+ verify (addAccessCopyProcessor , never ()).process (any (Exchange .class ));
465+ assertMockEndpointsSatisfied ();
466+ }
467+
452468 private void createContext (String routeName ) throws Exception {
453469 context .getRouteDefinition (routeName ).adviceWith (context , new AdviceWithRouteBuilder () {
454470 @ Override
0 commit comments