Skip to content

Commit

Permalink
Replace CamelBlueprintTestSupport with plain old CamelTestSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
acoburn authored and Andrew Woods committed Oct 19, 2015
1 parent 6478b5b commit cb7a67d
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 77 deletions.
128 changes: 111 additions & 17 deletions fcrepo-indexing-solr/pom.xml
Expand Up @@ -16,6 +16,7 @@
<description>Camel-based indexing service for Solr</description>

<properties>
<fcrepo-transform.version>4.4.1-SNAPSHOT</fcrepo-transform.version>
</properties>

<dependencies>
Expand All @@ -28,7 +29,7 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
</dependency>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
Expand Down Expand Up @@ -72,9 +73,113 @@
<!-- Testing & Camel Plugin -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-blueprint</artifactId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
<version>${camel.version}</version>
</dependency>


<dependency>
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-servlet</artifactId>
<version>${grizzly.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>


<!--fcrepo testing -->
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-kernel-api</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-kernel-modeshape</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-jms</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-http-api</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-configs</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo.transform</groupId>
<artifactId>fcrepo-transform</artifactId>
<version>${fcrepo-transform.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-auth-common</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-http-commons</artifactId>
<version>${fcrepo.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>


<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.jayway.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down Expand Up @@ -102,7 +207,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
Expand Down Expand Up @@ -135,6 +240,7 @@
<portName>fcrepo.dynamic.test.port</portName>
<portName>fcrepo.dynamic.jms.port</portName>
<portName>fcrepo.dynamic.stomp.port</portName>
<portName>jetty.dynamic.test.port</portName>
<portName>jetty.dynamic.stop.port</portName>
</portNames>
</configuration>
Expand Down Expand Up @@ -211,7 +317,7 @@
</goals>
<configuration>
<httpConnector>
<port>${fcrepo.dynamic.test.port}</port>
<port>${jetty.dynamic.test.port}</port>
</httpConnector>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
Expand All @@ -220,10 +326,6 @@
<war>${project.build.directory}/solr.war</war>
<contextPath>/solr</contextPath>
</contextHandler>
<contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
<war>${project.build.directory}/fcrepo.war</war>
<contextPath>/fcrepo</contextPath>
</contextHandler>
</contextHandlers>
</configuration>
</execution>
Expand Down Expand Up @@ -252,14 +354,6 @@
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-webapp</artifactId>
<version>${fcrepo.version}</version>
<type>war</type>
<outputDirectory>${project.build.directory}</outputDirectory>
<destFileName>fcrepo.war</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.apache.solr</groupId>
<artifactId>solr</artifactId>
Expand Down
Expand Up @@ -27,8 +27,9 @@
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.AdviceWithRouteBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
import org.apache.camel.util.ObjectHelper;
import org.apache.commons.io.IOUtils;
import org.fcrepo.camel.JmsHeaders;
Expand All @@ -41,7 +42,7 @@
* @author Aaron Coburn
* @since 2015-04-10
*/
public class RouteTest extends CamelBlueprintTestSupport {
public class RouteTest extends CamelTestSupport {

@EndpointInject(uri = "mock:result")
protected MockEndpoint resultEndpoint;
Expand All @@ -50,6 +51,7 @@ public class RouteTest extends CamelBlueprintTestSupport {
protected ProducerTemplate template;

private static final String baseURL = "http://localhost/rest";
private static final String solrURL = "localhost:8983/solr/collection1";
private static final String fileID = "/file1";
private static final long timestamp = 1428360320168L;
private static final String eventDate = "2015-04-06T22:45:20Z";
Expand All @@ -63,13 +65,8 @@ public boolean isUseAdviceWith() {
}

@Override
public boolean isUseRouteBuilder() {
return false;
}

@Override
protected String getBlueprintDescriptor() {
return "/OSGI-INF/blueprint/blueprint.xml";
protected RouteBuilder createRouteBuilder() {
return new SolrRouter();
}

@Override
Expand All @@ -79,6 +76,13 @@ protected Properties useOverridePropertiesWithPropertiesComponent() {
props.put("audit.container", auditContainer);
props.put("input.stream", "seda:foo");
props.put("reindex.stream", "seda:bar");
props.put("error.maxRedeliveries", "10");
props.put("indexing.predicate", "true");
props.put("fcrepo.baseUrl", baseURL);
props.put("fcrepo.defaultTransform", "default");
props.put("solr.baseUrl", solrURL);
props.put("solr.commitWithin", "100");
props.put("solr.reindex.stream", "seda:reindex");
return props;
}

Expand Down Expand Up @@ -254,10 +258,10 @@ public void configure() throws Exception {
});
context.start();

getMockEndpoint("mock:http4:localhost:8983/solr/collection1/update").expectedMessageCount(1);
getMockEndpoint("mock:http4:localhost:8983/solr/collection1/update")
getMockEndpoint("mock:http4:" + solrURL + "/update").expectedMessageCount(1);
getMockEndpoint("mock:http4:" + solrURL + "/update")
.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
getMockEndpoint("mock:http4:localhost:8983/solr/collection1/update").expectedBodiesReceived(body);
getMockEndpoint("mock:http4:" + solrURL + "/update").expectedBodiesReceived(body);

template.sendBodyAndHeaders("direct:update.solr", body,
createEvent(fileID, eventTypes, eventProps));
Expand All @@ -280,10 +284,10 @@ public void configure() throws Exception {
});
context.start();

getMockEndpoint("mock:http4:localhost:8983/solr/collection1/update").expectedMessageCount(1);
getMockEndpoint("mock:http4:localhost:8983/solr/collection1/update")
getMockEndpoint("mock:http4:" + solrURL + "/update").expectedMessageCount(1);
getMockEndpoint("mock:http4:" + solrURL + "/update")
.expectedHeaderReceived(Exchange.CONTENT_TYPE, "application/json");
getMockEndpoint("mock:http4:localhost:8983/solr/collection1/update")
getMockEndpoint("mock:http4:" + solrURL + "/update")
.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");

template.sendBodyAndHeaders("direct:delete.solr", "",
Expand Down

0 comments on commit cb7a67d

Please sign in to comment.