Skip to content

Commit

Permalink
BXC-4710 working on destroy derivatives router test
Browse files Browse the repository at this point in the history
  • Loading branch information
sharonluong committed Sep 30, 2024
1 parent 6f14a54 commit ec590ab
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ public class DestroyDerivativesRouter extends RouteBuilder {
@BeanInject(value = "destroyedMsgProcessor")
private DestroyedMsgProcessor destroyedMsgProcessor;

@BeanInject(value = "destroyCollectionSrcImgProcessor")
private DestroyDerivativesProcessor destroyCollectionSrcImgProcessor;

@BeanInject(value = "destroySmallThumbnailProcessor")
private DestroyDerivativesProcessor destroySmallThumbnailProcessor;

@BeanInject(value = "destroyLargeThumbnailProcessor")
private DestroyDerivativesProcessor destroyLargeThumbnailProcessor;

@BeanInject(value = "destroyAccessCopyProcessor")
private DestroyDerivativesProcessor destroyAccessCopyProcessor;

Expand Down Expand Up @@ -75,44 +66,20 @@ public void configure() throws Exception {
.routeId("CdrDestroyImage")
.startupOrder(202)
.log(LoggingLevel.DEBUG, log, "Destroying derivative thumbnails")
.bean(destroySmallThumbnailProcessor)
.bean(destroyLargeThumbnailProcessor)
.choice()
.when(simple("${headers['" + CdrObjectType + "']} == '" + Cdr.FileObject.getURI() + "'"))
.to("direct:image.access.destroy")
.when(simple("${headers['CollectionThumb']} != null"))
.to("direct:image.collection.destroy")
.to("direct:image.access.destroy")
.end();

from("direct:image.access.destroy")
.routeId("CdrDestroyAccessCopy")
.startupOrder(201)
.log(LoggingLevel.DEBUG, log, "Destroying access copy")
.bean(destroyAccessCopyProcessor);

from("direct:image.collection.destroy")
.routeId("CdrDestroyCollectionUpload")
.startupOrder(200)
.log(LoggingLevel.DEBUG, log, "Destroying collection image upload")
.bean(destroyCollectionSrcImgProcessor);
}

public void setDestroyedMsgProcessor(DestroyedMsgProcessor destroyedMsgProcessor) {
this.destroyedMsgProcessor = destroyedMsgProcessor;
}

public void setDestroyCollectionSrcImgProcessor(DestroyDerivativesProcessor destroyCollectionSrcImgProcessor) {
this.destroyCollectionSrcImgProcessor = destroyCollectionSrcImgProcessor;
}

public void setDestroySmallThumbnailProcessor(DestroyDerivativesProcessor destroySmallThumbnailProcessor) {
this.destroySmallThumbnailProcessor = destroySmallThumbnailProcessor;
}

public void setDestroyLargeThumbnailProcessor(DestroyDerivativesProcessor destroyLargeThumbnailProcessor) {
this.destroyLargeThumbnailProcessor = destroyLargeThumbnailProcessor;
}

public void setDestroyAccessCopyProcessor(DestroyDerivativesProcessor destroyAccessCopyProcessor) {
this.destroyAccessCopyProcessor = destroyAccessCopyProcessor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ public class DestroyDerivativesRouterIT extends CamelSpringTestSupport {

private DestroyedMsgProcessor destroyedMsgProcessor;

private DestroyDerivativesProcessor destroyCollectionSrcImgProcessor;

private DestroyDerivativesProcessor destroySmallThumbnailProcessor;

private DestroyDerivativesProcessor destroyLargeThumbnailProcessor;

private DestroyDerivativesProcessor destroyAccessCopyProcessor;

private DestroyDerivativesProcessor destroyFulltextProcessor;
Expand Down Expand Up @@ -145,9 +139,6 @@ public void init() {
indexingMessageSender = applicationContext.getBean(IndexingMessageSender.class);
binaryDestroyedMessageSender = applicationContext.getBean("binaryDestroyedMessageSender", MessageSender.class);
destroyedMsgProcessor = applicationContext.getBean(DestroyedMsgProcessor.class);
destroyCollectionSrcImgProcessor = applicationContext.getBean("destroyCollectionSrcImgProcessor", DestroyDerivativesProcessor.class);
destroySmallThumbnailProcessor = applicationContext.getBean("destroySmallThumbnailProcessor", DestroyDerivativesProcessor.class);
destroyLargeThumbnailProcessor = applicationContext.getBean("destroyLargeThumbnailProcessor", DestroyDerivativesProcessor.class);
destroyAccessCopyProcessor = applicationContext.getBean("destroyAccessCopyProcessor", DestroyDerivativesProcessor.class);
destroyFulltextProcessor = applicationContext.getBean("destroyFulltextProcessor", DestroyDerivativesProcessor.class);

Expand Down Expand Up @@ -195,9 +186,6 @@ public void destroyImageTest() throws Exception {
initializeDestroyJob(Collections.singletonList(fileObj.getPid()));
destroyJob.run();

verify(destroySmallThumbnailProcessor).process(any(Exchange.class));
verify(destroyLargeThumbnailProcessor).process(any(Exchange.class));
verify(destroyCollectionSrcImgProcessor, never()).process(any(Exchange.class));
verify(destroyAccessCopyProcessor).process(any(Exchange.class));
verify(destroyFulltextProcessor, never()).process(any(Exchange.class));
}
Expand All @@ -222,9 +210,6 @@ public void destroyCollectionImageTest() throws Exception {

destroyJob.run();

verify(destroySmallThumbnailProcessor).process(any(Exchange.class));
verify(destroyLargeThumbnailProcessor).process(any(Exchange.class));
verify(destroyCollectionSrcImgProcessor).process(any(Exchange.class));
verify(destroyAccessCopyProcessor, never()).process(any(Exchange.class));
verify(destroyFulltextProcessor, never()).process(any(Exchange.class));
}
Expand All @@ -240,9 +225,6 @@ public void destroyCollectionNoImageTest() throws Exception {
initializeDestroyJob(Collections.singletonList(collectionWithImg.getPid()));
destroyJob.run();

verify(destroySmallThumbnailProcessor, never()).process(any(Exchange.class));
verify(destroyLargeThumbnailProcessor, never()).process(any(Exchange.class));
verify(destroyCollectionSrcImgProcessor, never()).process(any(Exchange.class));
verify(destroyAccessCopyProcessor, never()).process(any(Exchange.class));
verify(destroyFulltextProcessor, never()).process(any(Exchange.class));
}
Expand All @@ -260,9 +242,6 @@ public void destroyTextTest() throws Exception {
initializeDestroyJob(Collections.singletonList(fileObj.getPid()));
destroyJob.run();

verify(destroySmallThumbnailProcessor, never()).process(any(Exchange.class));
verify(destroyLargeThumbnailProcessor, never()).process(any(Exchange.class));
verify(destroyCollectionSrcImgProcessor, never()).process(any(Exchange.class));
verify(destroyAccessCopyProcessor, never()).process(any(Exchange.class));
verify(destroyFulltextProcessor).process(any(Exchange.class));
}
Expand All @@ -279,9 +258,6 @@ public void invalidTypeTest() throws Exception {
initializeDestroyJob(Collections.singletonList(fileObj.getPid()));
destroyJob.run();

verify(destroySmallThumbnailProcessor, never()).process(any(Exchange.class));
verify(destroyLargeThumbnailProcessor, never()).process(any(Exchange.class));
verify(destroyCollectionSrcImgProcessor, never()).process(any(Exchange.class));
verify(destroyAccessCopyProcessor, never()).process(any(Exchange.class));
verify(destroyFulltextProcessor, never()).process(any(Exchange.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@
<constructor-arg value="${sourceImages.dir}" />
</bean>

<bean id="destroyCollectionSrcImgProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="edu.unc.lib.boxc.services.camel.destroyDerivatives.DestroyDerivativesProcessor" />
</bean>

<bean id="destroySmallThumbnailProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="edu.unc.lib.boxc.services.camel.destroyDerivatives.DestroyDerivativesProcessor" />
</bean>

<bean id="destroyLargeThumbnailProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="edu.unc.lib.boxc.services.camel.destroyDerivatives.DestroyDerivativesProcessor" />
</bean>

<bean id="destroyAccessCopyProcessor" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg type="java.lang.Class" value="edu.unc.lib.boxc.services.camel.destroyDerivatives.DestroyDerivativesProcessor" />
</bean>
Expand Down

0 comments on commit ec590ab

Please sign in to comment.