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 2010/09/21 16:17:10 UTC
svn commit: r999428 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/impl/
camel-core/src/main/java/org/apache/camel/model/
camel-core/src/main/java/org/apache/camel/util/
camel-core/src/test/java/org/apache/camel/impl/ components/camel-cor...
Author: davsclaus
Date: Tue Sep 21 14:17:09 2010
New Revision: 999428
URL: http://svn.apache.org/viewvc?rev=999428&view=rev
Log:
CAMEL-3141: Fixed <route> attributes not support Camel properties placeholders.
Added:
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java
- copied, changed from r999286, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml (contents, props changed)
- copied, changed from r999286, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelContextAutoStartupTestFalse.xml
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupTrueTest.xml
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/route.properties
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ActiveMQUuidGeneratorTest.java
camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Tue Sep 21 14:17:09 2010
@@ -1526,7 +1526,7 @@ public class DefaultCamelContext extends
// this method will log the routes being started
safelyStartRouteServices(true, true, true, false, addingRoutes, routeService);
// start route services if it was configured to auto startup and we are not adding routes
- boolean autoStartup = routeService.getRouteDefinition().isAutoStartup();
+ boolean autoStartup = routeService.getRouteDefinition().isAutoStartup(this);
if (!addingRoutes || autoStartup) {
// start the route since auto start is enabled or we are starting a route (not adding new routes)
routeService.start();
@@ -1708,7 +1708,7 @@ public class DefaultCamelContext extends
RouteService routeService = entry.getValue().getRouteService();
// if we are starting camel, then skip routes which are configured to not be auto started
- boolean autoStartup = routeService.getRouteDefinition().isAutoStartup();
+ boolean autoStartup = routeService.getRouteDefinition().isAutoStartup(this);
if (addingRoute && !autoStartup) {
LOG.info("Cannot start route " + routeService.getId() + " as its configured with autoStartup=false");
continue;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java Tue Sep 21 14:17:09 2010
@@ -62,11 +62,11 @@ public class RouteDefinition extends Pro
private List<FromDefinition> inputs = new ArrayList<FromDefinition>();
private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
private String group;
- private Boolean streamCache;
- private Boolean trace;
- private Boolean handleFault;
- private Long delayer;
- private Boolean autoStartup = Boolean.TRUE;
+ private String streamCache;
+ private String trace;
+ private String handleFault;
+ private String delayer;
+ private String autoStartup = "true";
private Integer startupOrder;
private RoutePolicy routePolicy;
private String routePolicyRef;
@@ -310,7 +310,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition noStreamCaching() {
- setStreamCache(Boolean.FALSE);
+ setStreamCache("false");
StreamCaching.noStreamCaching(getInterceptStrategies());
return this;
}
@@ -321,7 +321,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition streamCaching() {
- setStreamCache(Boolean.TRUE);
+ setStreamCache("true");
StreamCaching cache = StreamCaching.getStreamCaching(getInterceptStrategies());
if (cache == null) {
cache = new StreamCaching();
@@ -337,7 +337,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition noTracing() {
- setTrace(false);
+ setTrace("false");
return this;
}
@@ -347,7 +347,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition tracing() {
- setTrace(true);
+ setTrace("true");
return this;
}
@@ -357,7 +357,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition noHandleFault() {
- setHandleFault(false);
+ setHandleFault("false");
return this;
}
@@ -367,7 +367,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition handleFault() {
- setHandleFault(true);
+ setHandleFault("true");
return this;
}
@@ -377,7 +377,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition noDelayer() {
- setDelayer(0L);
+ setDelayer("0");
return this;
}
@@ -388,7 +388,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition delayer(long delay) {
- setDelayer(delay);
+ setDelayer("" + delay);
return this;
}
@@ -409,7 +409,7 @@ public class RouteDefinition extends Pro
* @return the builder
*/
public RouteDefinition noAutoStartup() {
- setAutoStartup(Boolean.FALSE);
+ setAutoStartup("false");
return this;
}
@@ -513,48 +513,53 @@ public class RouteDefinition extends Pro
this.group = group;
}
- public Boolean isStreamCache() {
+ public String getStreamCache() {
return streamCache;
}
@XmlAttribute
- public void setStreamCache(Boolean streamCache) {
+ public void setStreamCache(String streamCache) {
this.streamCache = streamCache;
}
- public Boolean isTrace() {
+ public String getTrace() {
return trace;
}
@XmlAttribute
- public void setTrace(Boolean trace) {
+ public void setTrace(String trace) {
this.trace = trace;
}
- public Boolean isHandleFault() {
+ public String getHandleFault() {
return handleFault;
}
@XmlAttribute
- public void setHandleFault(Boolean handleFault) {
+ public void setHandleFault(String handleFault) {
this.handleFault = handleFault;
}
- public Long getDelayer() {
+ public String getDelayer() {
return delayer;
}
@XmlAttribute
- public void setDelayer(Long delayer) {
+ public void setDelayer(String delayer) {
this.delayer = delayer;
}
- public Boolean isAutoStartup() {
+ public String getAutoStartup() {
return autoStartup;
}
+ public boolean isAutoStartup(CamelContext camelContext) throws Exception {
+ Boolean isAutoStartup = CamelContextHelper.parseBoolean(camelContext, getAutoStartup());
+ return isAutoStartup != null && isAutoStartup;
+ }
+
@XmlAttribute
- public void setAutoStartup(Boolean autoStartup) {
+ public void setAutoStartup(String autoStartup) {
this.autoStartup = autoStartup;
}
@@ -635,53 +640,62 @@ public class RouteDefinition extends Pro
// configure tracing
if (trace != null) {
- routeContext.setTracing(isTrace());
- if (isTrace()) {
- if (log.isDebugEnabled()) {
- log.debug("Tracing is enabled on route: " + this);
+ Boolean isTrace = CamelContextHelper.parseBoolean(camelContext, getTrace());
+ if (isTrace != null) {
+ routeContext.setTracing(isTrace);
+ if (isTrace) {
+ if (log.isDebugEnabled()) {
+ log.debug("Tracing is enabled on route: " + this);
+ }
+ // tracing is added in the DefaultChannel so we can enable it on the fly
}
- // tracing is added in the DefaultChannel so we can enable it on the fly
}
}
// configure stream caching
if (streamCache != null) {
- routeContext.setStreamCaching(isStreamCache());
- if (isStreamCache()) {
- if (log.isDebugEnabled()) {
- log.debug("StreamCaching is enabled on route: " + this);
- }
- // only add a new stream cache if not already a global configured on camel context
- if (StreamCaching.getStreamCaching(camelContext) == null) {
- addInterceptStrategy(new StreamCaching());
+ Boolean isStreamCache = CamelContextHelper.parseBoolean(camelContext, getStreamCache());
+ if (isStreamCache != null) {
+ routeContext.setStreamCaching(isStreamCache);
+ if (isStreamCache) {
+ if (log.isDebugEnabled()) {
+ log.debug("StreamCaching is enabled on route: " + this);
+ }
+ // only add a new stream cache if not already a global configured on camel context
+ if (StreamCaching.getStreamCaching(camelContext) == null) {
+ addInterceptStrategy(new StreamCaching());
+ }
}
}
}
// configure handle fault
if (handleFault != null) {
- routeContext.setHandleFault(isHandleFault());
- if (isHandleFault()) {
- if (log.isDebugEnabled()) {
- log.debug("HandleFault is enabled on route: " + this);
- }
- // only add a new handle fault if not already a global configured on camel context
- if (HandleFault.getHandleFault(camelContext) == null) {
- addInterceptStrategy(new HandleFault());
+ Boolean isHandleFault = CamelContextHelper.parseBoolean(camelContext, getHandleFault());
+ if (isHandleFault != null) {
+ routeContext.setHandleFault(isHandleFault);
+ if (isHandleFault) {
+ if (log.isDebugEnabled()) {
+ log.debug("HandleFault is enabled on route: " + this);
+ }
+ // only add a new handle fault if not already a global configured on camel context
+ if (HandleFault.getHandleFault(camelContext) == null) {
+ addInterceptStrategy(new HandleFault());
+ }
}
}
}
// configure delayer
if (delayer != null) {
- routeContext.setDelayer(getDelayer());
- if (getDelayer() != null) {
- long millis = getDelayer();
- if (millis > 0) {
+ Long delayer = CamelContextHelper.parseLong(camelContext, getDelayer());
+ if (delayer != null) {
+ routeContext.setDelayer(delayer);
+ if (delayer > 0) {
if (log.isDebugEnabled()) {
- log.debug("Delayer is enabled with: " + millis + " ms. on route: " + this);
+ log.debug("Delayer is enabled with: " + delayer + " ms. on route: " + this);
}
- addInterceptStrategy(new Delayer(millis));
+ addInterceptStrategy(new Delayer(delayer));
} else {
if (log.isDebugEnabled()) {
log.debug("Delayer is disabled on route: " + this);
@@ -705,11 +719,12 @@ public class RouteDefinition extends Pro
}
// configure auto startup
- if (autoStartup != null) {
+ Boolean isAutoStartup = CamelContextHelper.parseBoolean(camelContext, getAutoStartup());
+ if (isAutoStartup != null) {
if (log.isDebugEnabled()) {
- log.debug("Using AutoStartup " + isAutoStartup() + " on route: " + this);
+ log.debug("Using AutoStartup " + isAutoStartup + " on route: " + this);
}
- routeContext.setAutoStartup(isAutoStartup());
+ routeContext.setAutoStartup(isAutoStartup);
}
// configure shutdown
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java Tue Sep 21 14:17:09 2010
@@ -19,9 +19,9 @@ package org.apache.camel.model;
import java.util.List;
/**
- * Helper for {@link org.apache.camel.model.RouteDefinition}
+ * Helper for {@link RouteDefinition}
* <p/>
- * Utility methods to help preparing {@link org.apache.camel.model.RouteDefinition} before they are added to
+ * Utility methods to help preparing {@link RouteDefinition} before they are added to
* {@link org.apache.camel.CamelContext}.
*
* @version $Revision$
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelContextHelper.java Tue Sep 21 14:17:09 2010
@@ -179,4 +179,93 @@ public final class CamelContextHelper {
return 1000;
}
+ /**
+ * Parses the given text and handling property placeholders as well
+ *
+ * @param camelContext the camel context
+ * @param text the text
+ * @return the parsed text, or <tt>null</tt> if the text was <tt>null</tt>
+ * @throws Exception is thrown if illegal argument
+ */
+ public static String parseText(CamelContext camelContext, String text) throws Exception {
+ // ensure we support property placeholders
+ return camelContext.resolvePropertyPlaceholders(text);
+ }
+
+ /**
+ * Parses the given text and converts it to an Integer and handling property placeholders as well
+ *
+ * @param camelContext the camel context
+ * @param text the text
+ * @return the integer vale, or <tt>null</tt> if the text was <tt>null</tt>
+ * @throws Exception is thrown if illegal argument or type conversion not possible
+ */
+ public static Integer parseInteger(CamelContext camelContext, String text) throws Exception {
+ // ensure we support property placeholders
+ String s = camelContext.resolvePropertyPlaceholders(text);
+ if (s != null) {
+ try {
+ return camelContext.getTypeConverter().mandatoryConvertTo(Integer.class, s);
+ } catch (NumberFormatException e) {
+ if (s.equals(text)) {
+ throw new IllegalArgumentException("Error parsing [" + s + "] as an Integer.", e);
+ } else {
+ throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as an Integer.", e);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Parses the given text and converts it to an Long and handling property placeholders as well
+ *
+ * @param camelContext the camel context
+ * @param text the text
+ * @return the long vale, or <tt>null</tt> if the text was <tt>null</tt>
+ * @throws Exception is thrown if illegal argument or type conversion not possible
+ */
+ public static Long parseLong(CamelContext camelContext, String text) throws Exception {
+ // ensure we support property placeholders
+ String s = camelContext.resolvePropertyPlaceholders(text);
+ if (s != null) {
+ try {
+ return camelContext.getTypeConverter().mandatoryConvertTo(Long.class, s);
+ } catch (NumberFormatException e) {
+ if (s.equals(text)) {
+ throw new IllegalArgumentException("Error parsing [" + s + "] as a Long.", e);
+ } else {
+ throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as a Long.", e);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Parses the given text and converts it to an Boolean and handling property placeholders as well
+ *
+ * @param camelContext the camel context
+ * @param text the text
+ * @return the boolean vale, or <tt>null</tt> if the text was <tt>null</tt>
+ * @throws Exception is thrown if illegal argument or type conversion not possible
+ */
+ public static Boolean parseBoolean(CamelContext camelContext, String text) throws Exception {
+ // ensure we support property placeholders
+ String s = camelContext.resolvePropertyPlaceholders(text);
+ if (s != null) {
+ s = s.trim().toLowerCase();
+ if (s.equals("true") || s.equals("false")) {
+ return camelContext.getTypeConverter().mandatoryConvertTo(Boolean.class, s);
+ } else {
+ if (s.equals(text)) {
+ throw new IllegalArgumentException("Error parsing [" + s + "] as a Boolean.");
+ } else {
+ throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as a Boolean.");
+ }
+ }
+ }
+ return null;
+ }
+
}
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ActiveMQUuidGeneratorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ActiveMQUuidGeneratorTest.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ActiveMQUuidGeneratorTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/ActiveMQUuidGeneratorTest.java Tue Sep 21 14:17:09 2010
@@ -25,7 +25,7 @@ import org.apache.commons.logging.LogFac
public class ActiveMQUuidGeneratorTest extends TestCase {
private static final Log LOG = LogFactory.getLog(ActiveMQUuidGeneratorTest.class);
- private static final String PATTERN = "^ID-.*/\\d{4,5}-\\d{13}/\\d{1}-\\d{1}$";
+ private static final String PATTERN = "^ID-.*/\\d{4,5}-\\d{13}/\\d{1}-\\d{1,10}$";
public void testGenerateUUID() {
ActiveMQUuidGenerator uuidGenerator = new ActiveMQUuidGenerator();
Modified: camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java (original)
+++ camel/trunk/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java Tue Sep 21 14:17:09 2010
@@ -453,14 +453,14 @@ public abstract class AbstractCamelConte
} else if (camelJMXAgent != null) {
LOG.info("JMXAgent enabled: " + camelJMXAgent);
DefaultManagementAgent agent = new DefaultManagementAgent(getContext());
- agent.setConnectorPort(parseInteger(camelJMXAgent.getConnectorPort()));
- agent.setCreateConnector(parseBoolean(camelJMXAgent.getCreateConnector()));
- agent.setMBeanObjectDomainName(parseText(camelJMXAgent.getMbeanObjectDomainName()));
- agent.setMBeanServerDefaultDomain(parseText(camelJMXAgent.getMbeanServerDefaultDomain()));
- agent.setRegistryPort(parseInteger(camelJMXAgent.getRegistryPort()));
- agent.setServiceUrlPath(parseText(camelJMXAgent.getServiceUrlPath()));
- agent.setUsePlatformMBeanServer(parseBoolean(camelJMXAgent.getUsePlatformMBeanServer()));
- agent.setOnlyRegisterProcessorWithCustomId(parseBoolean(camelJMXAgent.getOnlyRegisterProcessorWithCustomId()));
+ agent.setConnectorPort(CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getConnectorPort()));
+ agent.setCreateConnector(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getCreateConnector()));
+ agent.setMBeanObjectDomainName(CamelContextHelper.parseText(getContext(), camelJMXAgent.getMbeanObjectDomainName()));
+ agent.setMBeanServerDefaultDomain(CamelContextHelper.parseText(getContext(), camelJMXAgent.getMbeanServerDefaultDomain()));
+ agent.setRegistryPort(CamelContextHelper.parseInteger(getContext(), camelJMXAgent.getRegistryPort()));
+ agent.setServiceUrlPath(CamelContextHelper.parseText(getContext(), camelJMXAgent.getServiceUrlPath()));
+ agent.setUsePlatformMBeanServer(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getUsePlatformMBeanServer()));
+ agent.setOnlyRegisterProcessorWithCustomId(CamelContextHelper.parseBoolean(getContext(), camelJMXAgent.getOnlyRegisterProcessorWithCustomId()));
ManagementStrategy managementStrategy = new ManagedManagementStrategy(agent);
getContext().setManagementStrategy(managementStrategy);
@@ -524,63 +524,6 @@ public abstract class AbstractCamelConte
getContext().stop();
}
- private String parseText(String text) throws Exception {
- // ensure we support property placeholders
- return getContext().resolvePropertyPlaceholders(text);
- }
-
- private Integer parseInteger(String text) throws Exception {
- // ensure we support property placeholders
- String s = getContext().resolvePropertyPlaceholders(text);
- if (s != null) {
- try {
- return new Integer(s);
- } catch (NumberFormatException e) {
- if (s.equals(text)) {
- throw new IllegalArgumentException("Error parsing [" + s + "] as an Integer.", e);
- } else {
- throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as an Integer.", e);
- }
- }
- }
- return null;
- }
-
- private Long parseLong(String text) throws Exception {
- // ensure we support property placeholders
- String s = getContext().resolvePropertyPlaceholders(text);
- if (s != null) {
- try {
- return new Long(s);
- } catch (NumberFormatException e) {
- if (s.equals(text)) {
- throw new IllegalArgumentException("Error parsing [" + s + "] as a Long.", e);
- } else {
- throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as a Long.", e);
- }
- }
- }
- return null;
- }
-
- private Boolean parseBoolean(String text) throws Exception {
- // ensure we support property placeholders
- String s = getContext().resolvePropertyPlaceholders(text);
- if (s != null) {
- s = s.trim().toLowerCase();
- if (s.equals("true") || s.equals("false")) {
- return new Boolean(s);
- } else {
- if (s.equals(text)) {
- throw new IllegalArgumentException("Error parsing [" + s + "] as a Boolean.");
- } else {
- throw new IllegalArgumentException("Error parsing [" + s + "] from property " + text + " as a Boolean.");
- }
- }
- }
- return null;
- }
-
// Properties
// -------------------------------------------------------------------------
public T getContext() {
@@ -654,22 +597,22 @@ public abstract class AbstractCamelConte
*/
protected void initCamelContext(T ctx) throws Exception {
if (getStreamCache() != null) {
- ctx.setStreamCaching(parseBoolean(getStreamCache()));
+ ctx.setStreamCaching(CamelContextHelper.parseBoolean(getContext(), getStreamCache()));
}
if (getTrace() != null) {
- ctx.setTracing(parseBoolean(getTrace()));
+ ctx.setTracing(CamelContextHelper.parseBoolean(getContext(), getTrace()));
}
if (getDelayer() != null) {
- ctx.setDelayer(parseLong(getDelayer()));
+ ctx.setDelayer(CamelContextHelper.parseLong(getContext(), getDelayer()));
}
if (getHandleFault() != null) {
- ctx.setHandleFault(parseBoolean(getHandleFault()));
+ ctx.setHandleFault(CamelContextHelper.parseBoolean(getContext(), getHandleFault()));
}
if (getErrorHandlerRef() != null) {
ctx.setErrorHandlerBuilder(new ErrorHandlerBuilderRef(getErrorHandlerRef()));
}
if (getAutoStartup() != null) {
- ctx.setAutoStartup(parseBoolean(getAutoStartup()));
+ ctx.setAutoStartup(CamelContextHelper.parseBoolean(getContext(), getAutoStartup()));
}
if (getShutdownRoute() != null) {
ctx.setShutdownRoute(getShutdownRoute());
Modified: camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java (original)
+++ camel/trunk/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java Tue Sep 21 14:17:09 2010
@@ -292,9 +292,6 @@ public class JpaConsumer extends Schedul
// Remove package name of the entity to be conform with JPA 1.0 spec
return QueryBuilder.query("select x from " + entityType.getSimpleName() + " x");
}
-
-
-
}
}
}
Copied: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java (from r999286, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java?p2=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java&p1=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java&r1=999286&r2=999428&rev=999428&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelContextAutoStartupTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/config/RouteAutoStartupPropertiesTest.java Tue Sep 21 14:17:09 2010
@@ -26,27 +26,20 @@ import org.springframework.context.suppo
/**
* @version $Revision$
*/
-public class CamelContextAutoStartupTest extends TestCase {
+public class RouteAutoStartupPropertiesTest extends TestCase {
private AbstractXmlApplicationContext ac;
public void testAutoStartupFalse() throws Exception {
- ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/CamelContextAutoStartupTestFalse.xml");
+ ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml");
// must type cast to work with Spring 2.5.x
SpringCamelContext camel = (SpringCamelContext) ac.getBeansOfType(SpringCamelContext.class).values().iterator().next();
- assertNotNull(camel.getName());
- assertEquals(true, camel.isStarted());
- assertEquals(Boolean.FALSE, camel.isAutoStartup());
- assertEquals(1, camel.getRoutes().size());
assertEquals(false, camel.getRouteStatus("foo").isStarted());
// now starting route manually
camel.startRoute("foo");
-
- assertEquals(Boolean.FALSE, camel.isAutoStartup());
- assertEquals(1, camel.getRoutes().size());
assertEquals(true, camel.getRouteStatus("foo").isStarted());
// and now we can send a message to the route and see that it works
@@ -62,16 +55,14 @@ public class CamelContextAutoStartupTest
}
public void testAutoStartupTrue() throws Exception {
- ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/CamelContextAutoStartupTestTrue.xml");
+ ac = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/RouteAutoStartupTrueTest.xml");
// must type cast to work with Spring 2.5.x
SpringCamelContext camel = (SpringCamelContext) ac.getBeansOfType(SpringCamelContext.class).values().iterator().next();
- assertNotNull(camel.getName());
- assertEquals(true, camel.isStarted());
- assertEquals(Boolean.TRUE, camel.isAutoStartup());
- assertEquals(1, camel.getRoutes().size());
- // send a message to the route and see that it works
+ assertEquals(true, camel.getRouteStatus("bar").isStarted());
+
+ // and now we can send a message to the route and see that it works
MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
mock.expectedMessageCount(1);
Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java?rev=999428&r1=999427&r2=999428&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/scan/DefaultPackageScanClassResolverTest.java Tue Sep 21 14:17:09 2010
@@ -41,7 +41,7 @@ public class DefaultPackageScanClassReso
}
public void testAccepableSchema() {
- assertTrue("We should not accept the test by default!", resolver.isAcceptableScheme("test://test"));
+ assertFalse("We should not accept the test by default!", resolver.isAcceptableScheme("test://test"));
resolver.setAcceptableSchemes("test:;test2:");
assertTrue("We should accept the test:!", resolver.isAcceptableScheme("test://test"));
assertTrue("We should accept the test2:!", resolver.isAcceptableScheme("test2://test"));
Copied: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml (from r999286, camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelContextAutoStartupTestFalse.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml?p2=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml&p1=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelContextAutoStartupTestFalse.xml&r1=999286&r2=999428&rev=999428&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelContextAutoStartupTestFalse.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml Tue Sep 21 14:17:09 2010
@@ -22,8 +22,9 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
- <camelContext xmlns="http://camel.apache.org/schema/spring" autoStartup="false">
- <route id="foo">
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <propertyPlaceholder location="classpath:org/apache/camel/spring/config/route.properties" id="properties"/>
+ <route id="foo" autoStartup="{{cool.foo.startup}}">
<from uri="direct:start"/>
<to uri="mock:result"/>
</route>
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupFalseTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupTrueTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupTrueTest.xml?rev=999428&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupTrueTest.xml (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/RouteAutoStartupTrueTest.xml Tue Sep 21 14:17:09 2010
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <propertyPlaceholder location="classpath:org/apache/camel/spring/config/route.properties" id="properties"/>
+ <route id="bar" autoStartup="{{cool.bar.startup}}">
+ <from uri="direct:start"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+</beans>
Added: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/route.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/route.properties?rev=999428&view=auto
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/route.properties (added)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/config/route.properties Tue Sep 21 14:17:09 2010
@@ -0,0 +1,19 @@
+## ------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ------------------------------------------------------------------------
+
+cool.foo.startup=false
+cool.bar.startup=true