Skip to content

Commit

Permalink
Fallback to properties locations test
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Aug 27, 2014
1 parent 5386f74 commit 1bba05b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import org.apache.camel.component.properties.PropertiesComponent;

import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Typed;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Properties;

@Named("properties")
@Typed(PropertiesComponent.class)
class CdiPropertiesComponent extends PropertiesComponent {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public static Archive<?> deployment() {

@Test
@InSequence(1)
public void startCamelContext(CamelContext camelContext) throws Exception {
camelContext.start();
public void startCamelContext(CamelContext context) throws Exception {
context.start();
}

@Test
Expand All @@ -75,7 +75,7 @@ public void sendMessageToInboundConsumer() throws InterruptedException {

@Test
@InSequence(3)
public void stopCamelContext(CamelContext camelContext) throws Exception {
camelContext.stop();
public void stopCamelContext(CamelContext context) throws Exception {
context.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.component.properties.PropertiesComponent;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
Expand Down Expand Up @@ -70,15 +71,17 @@ private static Properties configuration() {

@Test
@InSequence(1)
public void startCamelContext(CamelContext camelContext) throws Exception {
camelContext.start();
public void startCamelContext(CamelContext context) throws Exception {
context.getComponent("properties", PropertiesComponent.class).setLocation("classpath:placeholder.properties");
context.start();
}

@Test
@InSequence(2)
public void sendMessageToInboundConsumer() throws InterruptedException {
outbound.expectedMessageCount(1);
outbound.expectedBodiesReceived("test");
outbound.expectedHeaderReceived("header", "message from file");

inbound.sendBody("test");

Expand All @@ -87,7 +90,7 @@ public void sendMessageToInboundConsumer() throws InterruptedException {

@Test
@InSequence(3)
public void stopCamelContext(CamelContext camelContext) throws Exception {
camelContext.stop();
public void stopCamelContext(CamelContext context) throws Exception {
context.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public static Archive<?> deployment() {

@Test
@InSequence(1)
public void startCamelContext(CamelContext camelContext) throws Exception {
camelContext.start();
public void startCamelContext(CamelContext context) throws Exception {
context.start();
}

@Test
Expand All @@ -76,7 +76,7 @@ public void sendMessageToInboundConsumer() throws InterruptedException {

@Test
@InSequence(3)
public void stopCamelContext(CamelContext camelContext) throws Exception {
camelContext.stop();
public void stopCamelContext(CamelContext context) throws Exception {
context.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ public class PropertyEndpointRoute extends RouteBuilder {

@Override
public void configure() {
from("direct:{{from}}").to("{{to}}");
from("direct:{{from}}").setHeader("header", simple("properties:header.message")).to("{{to}}");
}
}
1 change: 1 addition & 0 deletions src/test/resources/placeholder.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
header.message=message from file

0 comments on commit 1bba05b

Please sign in to comment.