You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/08/20 09:34:54 UTC
svn commit: r1374927 - in /camel/branches/camel-2.10.x: ./
components/camel-test/src/main/java/org/apache/camel/test/
components/camel-test/src/main/java/org/apache/camel/test/junit4/
components/camel-testng/src/main/java/org/apache/camel/testng/ tests...
Author: davsclaus
Date: Mon Aug 20 07:34:53 2012
New Revision: 1374927
URL: http://svn.apache.org/viewvc?rev=1374927&view=rev
Log:
CAMEL-5508: Improved Camel Test, to ensure properties component is always pre setup which its logic would already do if certain features is enabled. This ensures that when using advice with always works regardless when the camel context is being started (before or after advice).
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
camel/branches/camel-2.10.x/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java
camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1374926
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java?rev=1374927&r1=1374926&r2=1374927&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java (original)
+++ camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java Mon Aug 20 07:34:53 2012
@@ -36,6 +36,7 @@ import org.apache.camel.ProducerTemplate
import org.apache.camel.Service;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
import org.apache.camel.impl.BreakpointSupport;
import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
import org.apache.camel.impl.DefaultCamelContext;
@@ -167,6 +168,9 @@ public abstract class CamelTestSupport e
context.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(pattern));
}
+ // configure properties component (mandatory for testing)
+ context.getComponent("properties", PropertiesComponent.class);
+
postProcessTest();
if (isUseRouteBuilder()) {
Modified: camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java?rev=1374927&r1=1374926&r2=1374927&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java (original)
+++ camel/branches/camel-2.10.x/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java Mon Aug 20 07:34:53 2012
@@ -277,15 +277,14 @@ public abstract class CamelTestSupport e
context.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(pattern, true));
}
- // configure properties component
+ // configure properties component (mandatory for testing)
+ PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
Properties extra = useOverridePropertiesWithPropertiesComponent();
if (extra != null && !extra.isEmpty()) {
- PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setOverrideProperties(extra);
}
Boolean ignore = ignoreMissingLocationWithPropertiesComponent();
if (ignore != null) {
- PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
pc.setIgnoreMissingLocation(ignore);
}
Modified: camel/branches/camel-2.10.x/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java?rev=1374927&r1=1374926&r2=1374927&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java (original)
+++ camel/branches/camel-2.10.x/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java Mon Aug 20 07:34:53 2012
@@ -36,6 +36,7 @@ import org.apache.camel.ProducerTemplate
import org.apache.camel.Service;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.properties.PropertiesComponent;
import org.apache.camel.impl.BreakpointSupport;
import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
import org.apache.camel.impl.DefaultCamelContext;
@@ -279,6 +280,9 @@ public abstract class CamelTestSupport e
context.addRegisterEndpointCallback(new InterceptSendToMockEndpointStrategy(pattern, true));
}
+ // configure properties component (mandatory for testing)
+ context.getComponent("properties", PropertiesComponent.class);
+
postProcessTest();
if (isUseRouteBuilder()) {
Modified: camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java?rev=1374927&r1=1374926&r2=1374927&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java (original)
+++ camel/branches/camel-2.10.x/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java Mon Aug 20 07:34:53 2012
@@ -51,14 +51,13 @@ public class JMSTransactionIsTransactedR
@Test
public void testTransactionSuccess() throws Exception {
- context.start();
-
context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
onException(AssertionError.class).to("log:error", "mock:error");
}
});
+ context.start();
// there should be no assertion errors
MockEndpoint error = getMockEndpoint("mock:error");