@Test public void testMetadataUpdaterBinary() throws Exception { context .getRouteDefinition("FcrepoSerializationBinaryUpdater") .adviceWith( context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip("*"); } }); context.start(); getMockEndpoint("mock:direct:binary_file").expectedMessageCount(1); getMockEndpoint("mock:direct:binary_file").expectedHeaderReceived(Exchange.FILE_NAME, "foo"); // send a file! final String body = IOUtils.toString(ObjectHelper.loadResourceAsStream("binary.rdf"), "UTF-8"); final Map<String, Object> headers = ImmutableMap.of(BASE_URL, baseURL, IDENTIFIER, "foo"); template.sendBodyAndHeaders(body, headers); assertMockEndpointsSatisfied(); }
@Test public void testTraversal() throws Exception { getMockEndpoint("mock:direct:recipients").expectedMessageCount(1); getMockEndpoint("mock:" + reindexingStream).expectedMessageCount(7); getMockEndpoint("mock:" + reindexingStream) .expectedHeaderValuesReceivedInAnyOrder( FCREPO_IDENTIFIER, "/foo/a", "/foo/b", "/foo/c", "/foo/d", "/foo/e", "/foo/f", "/foo/g"); context .getRouteDefinition("FcrepoReindexingTraverse") .adviceWith( context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:traverse"); mockEndpointsAndSkip("fcrepo:*"); mockEndpointsAndSkip(reindexingStream + "*"); mockEndpointsAndSkip("direct:recipients"); } }); context.start(); template.sendBodyAndHeader( "direct:traverse", ObjectHelper.loadResourceAsStream("indexable.rdf"), FCREPO_BASE_URL, "http://localhost:8080/fcrepo4/rest"); assertMockEndpointsSatisfied(); }