36
36
import org .apache .camel .test .spring .CamelSpringTestSupport ;
37
37
import org .apache .commons .io .FileUtils ;
38
38
import org .junit .After ;
39
- import org .junit .Before ;
40
39
import org .junit .Test ;
41
40
import org .springframework .context .support .AbstractApplicationContext ;
42
41
import org .springframework .context .support .ClassPathXmlApplicationContext ;
43
42
44
- import edu .unc .lib .boxc .services .camel .images .AddDerivativeProcessor ;
45
-
46
43
public class ImageEnhancementsRouterTest extends CamelSpringTestSupport {
47
44
private static final String EVENT_NS = "http://fedora.info/definitions/v4/event#" ;
48
45
private static final String EVENT_TYPE = "org.fcrepo.jms.eventType" ;
@@ -423,6 +420,7 @@ public void testAccessCopyRouteForceFileExists() throws Exception {
423
420
public void testAccessCopyRejection () throws Exception {
424
421
createContext (accessCopyRoute );
425
422
423
+ when (addAccessCopyProcessor .needsRun (any ())).thenReturn (true );
426
424
getMockEndpoint ("mock:process.enhancement.imageAccessCopy" ).expectedMessageCount (0 );
427
425
428
426
Map <String , Object > headers = createEvent (fileID , eventTypes , "false" );
@@ -438,6 +436,7 @@ public void testAccessCopyRejection() throws Exception {
438
436
public void testAccessCopyDisallowedImageType () throws Exception {
439
437
createContext (accessCopyRoute );
440
438
439
+ when (addAccessCopyProcessor .needsRun (any ())).thenReturn (true );
441
440
getMockEndpoint ("mock:exec:/bin/sh" ).expectedMessageCount (0 );
442
441
443
442
Map <String , Object > headers = createEvent (fileID , eventTypes , "false" );
@@ -449,6 +448,23 @@ public void testAccessCopyDisallowedImageType() throws Exception {
449
448
assertMockEndpointsSatisfied ();
450
449
}
451
450
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
+
452
468
private void createContext (String routeName ) throws Exception {
453
469
context .getRouteDefinition (routeName ).adviceWith (context , new AdviceWithRouteBuilder () {
454
470
@ Override
0 commit comments