Skip to content

Commit

Permalink
Adding check to suppress events about internal audit nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Apr 27, 2015
1 parent ae8d4c2 commit 5fe0ddd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Expand Up @@ -3,3 +3,4 @@ jms.fcrepoEndpoint=${fcrepo.jms.endpoint:topic:fedora}
jms.brokerUrl=failover:(tcp://${fcrepo.jms.host:localhost}:${fcrepo.dynamic.jms.port:61616})?startupMaxReconnectAttempts=1&initialReconnectDelay=1
triplestore.baseUrl=${fcrepo.audit.triplestore.baseUrl:localhost:3030/test/update}
event.baseUri=${fcrepo.audit.baseUri:http://example.com/event}
audit.container=${fcrepo.audit.container:/audit}
Expand Up @@ -15,6 +15,7 @@
*/
package org.fcrepo.camel.audit.triplestore;

import static org.apache.camel.builder.PredicateBuilder.not;

import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;
Expand Down Expand Up @@ -43,7 +44,9 @@ public void configure() throws Exception {
*/
from("activemq:{{jms.fcrepoEndpoint}}")
.routeId("AuditFcrepoRouter")
.to("direct:event");
.choice()
.when(not(header("org.fcrepo.jms.identifier").startsWith("{{audit.container}}")))
.to("direct:event");

from("direct:event")
.routeId("AuditEventRouter")
Expand Down
Expand Up @@ -16,6 +16,7 @@
<cm:property name="triplestore.baseUrl" value="localhost:3030/test/update"/>
<!-- Base URI to be used in contructing the URI for the JMS event -->
<cm:property name="event.baseUri" value="http://example.com/event"/>
<cm:property name="audit.container" value="/audit"/>
</cm:default-properties>
</cm:property-placeholder>

Expand Down
Expand Up @@ -51,6 +51,7 @@ public class RouteTest extends CamelBlueprintTestSupport {
private static final String baseURL = "http://localhost/rest";
private static final String nodeID = "/foo";
private static final String fileID = "/file1";
private static final String auditID = "/audit/1234";
private static final long timestamp = 1428360320168L;
private static final String eventDate = "2015-04-06T22:45:20Z";
private static final String userID = "bypassAdmin";
Expand Down Expand Up @@ -87,6 +88,7 @@ public void configure() throws Exception {
final String eventTypes = REPOSITORY + "NODE_REMOVED";
final String eventProps = REPOSITORY + "hasContent";
template.sendBodyAndHeaders("", createEvent(fileID, eventTypes, eventProps));
template.sendBodyAndHeaders("", createEvent(auditID, eventTypes, eventProps));

assertMockEndpointsSatisfied();
final String body = (String)resultEndpoint.assertExchangeReceived(0).getIn().getBody();
Expand Down

0 comments on commit 5fe0ddd

Please sign in to comment.