[maven-release-plugin] copy for tag camel-2.9.1
git-svn-id: https://svn.apache.org/repos/asf/camel/tags/camel-2.9.1@1295649 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 41c6cfc..75b6cf6 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
@@ -73,18 +73,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-avro</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-bam</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-beanio</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
</dependency>
<dependency>
@@ -105,10 +97,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-cdi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-cometd</artifactId>
</dependency>
<dependency>
@@ -177,10 +165,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-gson</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-hawtdb</artifactId>
</dependency>
<dependency>
@@ -312,10 +296,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-mongodb</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-msv</artifactId>
<!--Avoid the WARNING message -->
<exclusions>
@@ -455,10 +435,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-ssh</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-stax</artifactId>
</dependency>
<dependency>
@@ -479,30 +455,14 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-blueprint</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-testng</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-twitter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-velocity</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-websocket</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-xmlbeans</artifactId>
</dependency>
<dependency>
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 35ca0fe..88ada37 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -38,15 +38,12 @@
<include>org.apache.camel:camel-apns</include>
<include>org.apache.camel:camel-atom</include>
<include>org.apache.camel:camel-aws</include>
- <include>org.apache.camel:camel-avro</include>
<include>org.apache.camel:camel-bam</include>
- <include>org.apache.camel:camel-beanio</include>
<include>org.apache.camel:camel-bean-validator</include>
<include>org.apache.camel:camel-bindy</include>
<include>org.apache.camel:camel-blueprint</include>
<include>org.apache.camel:camel-cache</include>
<include>org.apache.camel:camel-castor</include>
- <include>org.apache.camel:camel-cdi</include>
<include>org.apache.camel:camel-core</include>
<include>org.apache.camel:camel-core-osgi</include>
<include>org.apache.camel:camel-cometd</include>
@@ -67,7 +64,6 @@
<include>org.apache.camel:camel-gae</include>
<include>org.apache.camel:camel-groovy</include>
<include>org.apache.camel:camel-guice</include>
- <include>org.apache.camel:camel-gson</include>
<include>org.apache.camel:camel-hl7</include>
<include>org.apache.camel:camel-hawtdb</include>
<include>org.apache.camel:camel-hazelcast</include>
@@ -99,7 +95,6 @@
<include>org.apache.camel:camel-mail</include>
<include>org.apache.camel:camel-mina</include>
<include>org.apache.camel:camel-mina2</include>
- <include>org.apache.camel:camel-mongodb</include>
<include>org.apache.camel:camel-msv</include>
<include>org.apache.camel:camel-mvel</include>
<include>org.apache.camel:camel-mybatis</include>
@@ -132,19 +127,14 @@
<include>org.apache.camel:camel-spring-security</include>
<include>org.apache.camel:camel-spring-ws</include>
<include>org.apache.camel:camel-sql</include>
- <include>org.apache.camel:camel-ssh</include>
<include>org.apache.camel:camel-stax</include>
<include>org.apache.camel:camel-stream</include>
<include>org.apache.camel:camel-stringtemplate</include>
<include>org.apache.camel:camel-syslog</include>
- <include>org.apache.camel:camel-tagsoup</include>
<include>org.apache.camel:camel-test</include>
- <include>org.apache.camel:camel-test-blueprint</include>
- <include>org.apache.camel:camel-test-spring</include>
<include>org.apache.camel:camel-testng</include>
- <include>org.apache.camel:camel-twitter</include>
+ <include>org.apache.camel:camel-tagsoup</include>
<include>org.apache.camel:camel-velocity</include>
- <include>org.apache.camel:camel-websocket</include>
<include>org.apache.camel:camel-xmlbeans</include>
<include>org.apache.camel:camel-xmlsecurity</include>
<include>org.apache.camel:camel-xmpp</include>
diff --git a/buildingtools/pom.xml b/buildingtools/pom.xml
index 3184eaa..0b7f70a 100644
--- a/buildingtools/pom.xml
+++ b/buildingtools/pom.xml
@@ -23,11 +23,11 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-buildtools</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<name>Apache :: Camel Buildtools</name>
<description>The build tools for the Camel project</description>
<packaging>jar</packaging>
diff --git a/camel-core/pom.xml b/camel-core/pom.xml
index 5d4d6fb..1e7c94c 100755
--- a/camel-core/pom.xml
+++ b/camel-core/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/camel-core/src/main/java/org/apache/camel/CamelContext.java b/camel-core/src/main/java/org/apache/camel/CamelContext.java
index 24511a4..cd6149f 100644
--- a/camel-core/src/main/java/org/apache/camel/CamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -41,7 +41,6 @@
import org.apache.camel.spi.Language;
import org.apache.camel.spi.LifecycleStrategy;
import org.apache.camel.spi.ManagementMBeanAssembler;
-import org.apache.camel.spi.ManagementNameStrategy;
import org.apache.camel.spi.ManagementStrategy;
import org.apache.camel.spi.NodeIdFactory;
import org.apache.camel.spi.PackageScanClassResolver;
@@ -100,20 +99,6 @@
void setNameStrategy(CamelContextNameStrategy nameStrategy);
/**
- * Gets the current management name strategy
- *
- * @return management name strategy
- */
- ManagementNameStrategy getManagementNameStrategy();
-
- /**
- * Sets a custom management name strategy
- *
- * @param nameStrategy name strategy
- */
- void setManagementNameStrategy(ManagementNameStrategy nameStrategy);
-
- /**
* Gets the name this {@link CamelContext} was registered in JMX.
* <p/>
* The reason that a {@link CamelContext} can have a different name in JMX is the fact to remedy for name clash
@@ -125,6 +110,13 @@
String getManagementName();
/**
+ * Sets the name this {@link CamelContext} was registered in JMX.
+ *
+ * @param name the actual name used when registering this {@link CamelContext} in JMX
+ */
+ void setManagementName(String name);
+
+ /**
* Gets the version of the this context.
*
* @return the version
@@ -1040,18 +1032,14 @@
* Whether or not type converters should be loaded lazy
*
* @return <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
- * @deprecated this option is no longer supported, will be removed in a future Camel release.
*/
- @Deprecated
Boolean isLazyLoadTypeConverters();
/**
* Sets whether type converters should be loaded lazy
*
* @param lazyLoadTypeConverters <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
- * @deprecated this option is no longer supported, will be removed in a future Camel release.
*/
- @Deprecated
void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters);
/**
diff --git a/camel-core/src/main/java/org/apache/camel/ErrorHandlerFactory.java b/camel-core/src/main/java/org/apache/camel/ErrorHandlerFactory.java
index 472c92e..60935e9 100644
--- a/camel-core/src/main/java/org/apache/camel/ErrorHandlerFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/ErrorHandlerFactory.java
@@ -18,13 +18,10 @@
import org.apache.camel.spi.RouteContext;
-/**
- * Factory for creating {@link org.apache.camel.processor.ErrorHandler}s.
- */
public interface ErrorHandlerFactory {
/**
- * Creates the error handler
+ * Creates the error handler interceptor
*
* @param routeContext the route context
* @param processor the outer processor
diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java
index 22e4af4..16384cf 100644
--- a/camel-core/src/main/java/org/apache/camel/Exchange.java
+++ b/camel-core/src/main/java/org/apache/camel/Exchange.java
@@ -137,7 +137,6 @@
String HTTP_SERVLET_RESPONSE = "CamelHttpServletResponse";
String INTERCEPTED_ENDPOINT = "CamelInterceptedEndpoint";
- String INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED = "CamelInterceptSendToEndpointWhenMatched";
String LANGUAGE_SCRIPT = "CamelLanguageScript";
String LOG_DEBUG_BODY_MAX_CHARS = "CamelLogDebugBodyMaxChars";
diff --git a/camel-core/src/main/java/org/apache/camel/Rejectable.java b/camel-core/src/main/java/org/apache/camel/Rejectable.java
deleted file mode 100644
index bddbe6c..0000000
--- a/camel-core/src/main/java/org/apache/camel/Rejectable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel;
-
-/**
- * Reject executing or processing some task.
- */
-public interface Rejectable {
-
- /**
- * The task was rejected.
- */
- void reject();
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/ThreadPoolRejectedPolicy.java b/camel-core/src/main/java/org/apache/camel/ThreadPoolRejectedPolicy.java
index 09db531..dbd427d 100644
--- a/camel-core/src/main/java/org/apache/camel/ThreadPoolRejectedPolicy.java
+++ b/camel-core/src/main/java/org/apache/camel/ThreadPoolRejectedPolicy.java
@@ -29,6 +29,8 @@
* a new task.
* <p/>
* Camel will by default use <tt>CallerRuns</tt>.
+ *
+ * @version
*/
@XmlType
@XmlEnum(String.class)
@@ -38,58 +40,13 @@
public RejectedExecutionHandler asRejectedExecutionHandler() {
if (this == Abort) {
- return new RejectedExecutionHandler() {
- @Override
- public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- if (r instanceof Rejectable) {
- ((Rejectable) r).reject();
- }
- }
-
- @Override
- public String toString() {
- return "Abort";
- }
- };
+ return new ThreadPoolExecutor.AbortPolicy();
} else if (this == CallerRuns) {
- return new ThreadPoolExecutor.CallerRunsPolicy() {
- @Override
- public String toString() {
- return "CallerRuns";
- }
- };
+ return new ThreadPoolExecutor.CallerRunsPolicy();
} else if (this == DiscardOldest) {
- return new RejectedExecutionHandler() {
- @Override
- public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- if (!executor.isShutdown()) {
- Runnable rejected = executor.getQueue().poll();
- if (rejected instanceof Rejectable) {
- ((Rejectable) rejected).reject();
- }
- executor.execute(r);
- }
- }
-
- @Override
- public String toString() {
- return "DiscardOldest";
- }
- };
+ return new ThreadPoolExecutor.DiscardOldestPolicy();
} else if (this == Discard) {
- return new RejectedExecutionHandler() {
- @Override
- public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
- if (r instanceof Rejectable) {
- ((Rejectable) r).reject();
- }
- }
-
- @Override
- public String toString() {
- return "Discard";
- }
- };
+ return new ThreadPoolExecutor.DiscardPolicy();
}
throw new IllegalArgumentException("Unknown ThreadPoolRejectedPolicy: " + this);
}
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
index df5be49..42f46dc 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java
@@ -111,9 +111,6 @@
@ManagedOperation(description = "Adds or updates existing routes from XML")
void addOrUpdateRoutesFromXml(String xml) throws Exception;
- @ManagedOperation(description = "Dumps the routes stats as XML")
- String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
-
/**
* Creates the endpoint by the given uri
*
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedPerformanceCounterMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedPerformanceCounterMBean.java
index 67a7667..6c33a34 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedPerformanceCounterMBean.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedPerformanceCounterMBean.java
@@ -83,7 +83,4 @@
@ManagedAttribute(description = "Statistics enabled")
void setStatisticsEnabled(boolean statisticsEnabled);
- @ManagedOperation(description = "Dumps the statistics as XML")
- String dumpStatsAsXml(boolean fullStats);
-
}
\ No newline at end of file
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
index a6a634a..d58ab4d 100644
--- a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java
@@ -92,7 +92,4 @@
@ManagedOperation(description = "Updates the route from XML")
void updateRouteFromXml(String xml) throws Exception;
- @ManagedOperation(description = "Dumps the routes stats as XML")
- String dumpRouteStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception;
-
}
\ No newline at end of file
diff --git a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithBuilder.java
index e86f411..9cf224c 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithBuilder.java
@@ -23,7 +23,7 @@
/**
* A builder when using the <a href="http://camel.apache.org/advicewith.html">advice with</a> feature.
*/
-public class AdviceWithBuilder<T extends ProcessorDefinition<?>> {
+public class AdviceWithBuilder<T extends ProcessorDefinition> {
private final AdviceWithRouteBuilder builder;
private final String id;
@@ -106,7 +106,7 @@
*
* @return the builder to build the nodes.
*/
- public ProcessorDefinition<?> replace() {
+ public ProcessorDefinition replace() {
RouteDefinition route = builder.getOriginalRoute();
PipelineDefinition answer = new PipelineDefinition();
if (id != null) {
@@ -138,7 +138,7 @@
*
* @return the builder to build the nodes.
*/
- public ProcessorDefinition<?> before() {
+ public ProcessorDefinition before() {
RouteDefinition route = builder.getOriginalRoute();
PipelineDefinition answer = new PipelineDefinition();
if (id != null) {
@@ -156,7 +156,7 @@
*
* @return the builder to build the nodes.
*/
- public ProcessorDefinition<?> after() {
+ public ProcessorDefinition after() {
RouteDefinition route = builder.getOriginalRoute();
PipelineDefinition answer = new PipelineDefinition();
if (id != null) {
diff --git a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
index 28bdc94..adb8dfa 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
@@ -117,7 +117,7 @@
* @return the builder
* @see org.apache.camel.util.EndpointHelper#matchPattern(String, String)
*/
- public <T extends ProcessorDefinition<?>> AdviceWithBuilder<T> weaveById(String pattern) {
+ public <T extends ProcessorDefinition> AdviceWithBuilder weaveById(String pattern) {
ObjectHelper.notNull(originalRoute, "originalRoute", this);
return new AdviceWithBuilder<T>(this, pattern, null, null);
}
@@ -131,7 +131,7 @@
* @return the builder
* @see org.apache.camel.util.EndpointHelper#matchPattern(String, String)
*/
- public <T extends ProcessorDefinition<?>> AdviceWithBuilder<T> weaveByToString(String pattern) {
+ public <T extends ProcessorDefinition> AdviceWithBuilder weaveByToString(String pattern) {
ObjectHelper.notNull(originalRoute, "originalRoute", this);
return new AdviceWithBuilder<T>(this, null, pattern, null);
}
@@ -142,7 +142,7 @@
* @param type the processor type
* @return the builder
*/
- public <T extends ProcessorDefinition<?>> AdviceWithBuilder<T> weaveByType(Class<T> type) {
+ public <T extends ProcessorDefinition> AdviceWithBuilder weaveByType(Class<T> type) {
ObjectHelper.notNull(originalRoute, "originalRoute", this);
return new AdviceWithBuilder<T>(this, null, null, type);
}
@@ -152,7 +152,7 @@
*
* @return the builder
*/
- public <T extends ProcessorDefinition<?>> ProcessorDefinition<?> weaveAddFirst() {
+ public <T extends ProcessorDefinition> ProcessorDefinition weaveAddFirst() {
ObjectHelper.notNull(originalRoute, "originalRoute", this);
return new AdviceWithBuilder<T>(this, "*", null, null).selectFirst().before();
}
@@ -162,7 +162,7 @@
*
* @return the builder
*/
- public <T extends ProcessorDefinition<?>> ProcessorDefinition<?> weaveAddLast() {
+ public <T extends ProcessorDefinition> ProcessorDefinition weaveAddLast() {
ObjectHelper.notNull(originalRoute, "originalRoute", this);
return new AdviceWithBuilder<T>(this, "*", null, null).selectLast().after();
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
index 723d97c..44c64ac 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
@@ -47,7 +47,7 @@
String getId();
- boolean match(ProcessorDefinition<?> processor);
+ boolean match(ProcessorDefinition processor);
}
/**
@@ -65,7 +65,7 @@
return id;
}
- public boolean match(ProcessorDefinition<?> processor) {
+ public boolean match(ProcessorDefinition processor) {
return EndpointHelper.matchPattern(processor.getId(), id);
}
}
@@ -85,7 +85,7 @@
return toString;
}
- public boolean match(ProcessorDefinition<?> processor) {
+ public boolean match(ProcessorDefinition processor) {
return EndpointHelper.matchPattern(processor.toString(), toString);
}
}
@@ -105,41 +105,42 @@
return type.getSimpleName();
}
- public boolean match(ProcessorDefinition<?> processor) {
+ public boolean match(ProcessorDefinition processor) {
return type.isAssignableFrom(processor.getClass());
}
}
- public static AdviceWithTask replaceByToString(final RouteDefinition route, final String toString, final ProcessorDefinition<?> replace,
+ public static AdviceWithTask replaceByToString(final RouteDefinition route, final String toString, final ProcessorDefinition replace,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByToString(toString);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doReplace(route, new MatchByToString(toString), replace, it);
}
- public static AdviceWithTask replaceById(final RouteDefinition route, final String id, final ProcessorDefinition<?> replace,
+ public static AdviceWithTask replaceById(final RouteDefinition route, final String id, final ProcessorDefinition replace,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchById(id);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doReplace(route, matchBy, replace, it);
}
- public static AdviceWithTask replaceByType(final RouteDefinition route, final Class<?> type, final ProcessorDefinition<?> replace,
+ public static AdviceWithTask replaceByType(final RouteDefinition route, final Class type, final ProcessorDefinition replace,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByType(type);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doReplace(route, matchBy, replace, it);
}
- private static AdviceWithTask doReplace(final RouteDefinition route, final MatchBy matchBy, final ProcessorDefinition<?> replace,
- final Iterator<ProcessorDefinition<?>> it) {
+ @SuppressWarnings("unchecked")
+ private static AdviceWithTask doReplace(final RouteDefinition route, final MatchBy matchBy, final ProcessorDefinition replace,
+ final Iterator<ProcessorDefinition> it) {
return new AdviceWithTask() {
public void task() throws Exception {
boolean match = false;
while (it.hasNext()) {
- ProcessorDefinition<?> output = it.next();
+ ProcessorDefinition output = it.next();
if (matchBy.match(output)) {
- ProcessorDefinition<?> parent = output.getParent();
+ ProcessorDefinition parent = output.getParent();
if (parent != null) {
int index = parent.getOutputs().indexOf(output);
if (index != -1) {
@@ -162,33 +163,33 @@
public static AdviceWithTask removeByToString(final RouteDefinition route, final String toString,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByToString(toString);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doRemove(route, matchBy, it);
}
public static AdviceWithTask removeById(final RouteDefinition route, final String id,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchById(id);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doRemove(route, matchBy, it);
}
- public static AdviceWithTask removeByType(final RouteDefinition route, final Class<?> type,
+ public static AdviceWithTask removeByType(final RouteDefinition route, final Class type,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByType(type);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doRemove(route, matchBy, it);
}
private static AdviceWithTask doRemove(final RouteDefinition route, final MatchBy matchBy,
- final Iterator<ProcessorDefinition<?>> it) {
+ final Iterator<ProcessorDefinition> it) {
return new AdviceWithTask() {
public void task() throws Exception {
boolean match = false;
while (it.hasNext()) {
- ProcessorDefinition<?> output = it.next();
+ ProcessorDefinition output = it.next();
if (matchBy.match(output)) {
- ProcessorDefinition<?> parent = output.getParent();
+ ProcessorDefinition parent = output.getParent();
if (parent != null) {
int index = parent.getOutputs().indexOf(output);
if (index != -1) {
@@ -207,36 +208,37 @@
};
}
- public static AdviceWithTask beforeByToString(final RouteDefinition route, final String toString, final ProcessorDefinition<?> before,
+ public static AdviceWithTask beforeByToString(final RouteDefinition route, final String toString, final ProcessorDefinition before,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByToString(toString);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doBefore(route, matchBy, before, it);
}
- public static AdviceWithTask beforeById(final RouteDefinition route, final String id, final ProcessorDefinition<?> before,
+ public static AdviceWithTask beforeById(final RouteDefinition route, final String id, final ProcessorDefinition before,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchById(id);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doBefore(route, matchBy, before, it);
}
- public static AdviceWithTask beforeByType(final RouteDefinition route, final Class<?> type, final ProcessorDefinition<?> before,
+ public static AdviceWithTask beforeByType(final RouteDefinition route, final Class type, final ProcessorDefinition before,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByType(type);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doBefore(route, matchBy, before, it);
}
- private static AdviceWithTask doBefore(final RouteDefinition route, final MatchBy matchBy, final ProcessorDefinition<?> before,
- final Iterator<ProcessorDefinition<?>> it) {
+ @SuppressWarnings("unchecked")
+ private static AdviceWithTask doBefore(final RouteDefinition route, final MatchBy matchBy, final ProcessorDefinition before,
+ final Iterator<ProcessorDefinition> it) {
return new AdviceWithTask() {
public void task() throws Exception {
boolean match = false;
while (it.hasNext()) {
- ProcessorDefinition<?> output = it.next();
+ ProcessorDefinition output = it.next();
if (matchBy.match(output)) {
- ProcessorDefinition<?> parent = output.getParent();
+ ProcessorDefinition parent = output.getParent();
if (parent != null) {
int index = parent.getOutputs().indexOf(output);
if (index != -1) {
@@ -256,37 +258,38 @@
};
}
- public static AdviceWithTask afterByToString(final RouteDefinition route, final String toString, final ProcessorDefinition<?> after,
+ public static AdviceWithTask afterByToString(final RouteDefinition route, final String toString, final ProcessorDefinition after,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByToString(toString);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doAfter(route, matchBy, after, it);
}
- public static AdviceWithTask afterById(final RouteDefinition route, final String id, final ProcessorDefinition<?> after,
+ public static AdviceWithTask afterById(final RouteDefinition route, final String id, final ProcessorDefinition after,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchById(id);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doAfter(route, matchBy, after, it);
}
- public static AdviceWithTask afterByType(final RouteDefinition route, final Class<?> type, final ProcessorDefinition<?> after,
+ public static AdviceWithTask afterByType(final RouteDefinition route, final Class type, final ProcessorDefinition after,
boolean selectFirst, boolean selectLast, int selectFrom, int selectTo) {
MatchBy matchBy = new MatchByType(type);
- Iterator<ProcessorDefinition<?>> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
+ Iterator<ProcessorDefinition> it = AdviceWithTasks.createMatchByIterator(route, matchBy, selectFirst, selectLast, selectFrom, selectTo);
return doAfter(route, matchBy, after, it);
}
- private static AdviceWithTask doAfter(final RouteDefinition route, final MatchBy matchBy, final ProcessorDefinition<?> after,
- final Iterator<ProcessorDefinition<?>> it) {
+ @SuppressWarnings("unchecked")
+ private static AdviceWithTask doAfter(final RouteDefinition route, final MatchBy matchBy, final ProcessorDefinition after,
+ final Iterator<ProcessorDefinition> it) {
return new AdviceWithTask() {
public void task() throws Exception {
boolean match = false;
while (it.hasNext()) {
- ProcessorDefinition<?> output = it.next();
+ ProcessorDefinition output = it.next();
if (matchBy.match(output)) {
- ProcessorDefinition<?> parent = output.getParent();
+ ProcessorDefinition parent = output.getParent();
if (parent != null) {
int index = parent.getOutputs().indexOf(output);
if (index != -1) {
@@ -342,17 +345,15 @@
*
* @return the iterator
*/
- private static Iterator<ProcessorDefinition<?>> createMatchByIterator(final RouteDefinition route, final MatchBy matchBy,
+ private static Iterator<ProcessorDefinition> createMatchByIterator(final RouteDefinition route, final MatchBy matchBy,
final boolean selectFirst, final boolean selectLast,
final int selectFrom, final int selectTo) {
// first iterator and apply match by
- List<ProcessorDefinition<?>> matched = new ArrayList<ProcessorDefinition<?>>();
-
- @SuppressWarnings("rawtypes")
+ List<ProcessorDefinition> matched = new ArrayList<ProcessorDefinition>();
Iterator<ProcessorDefinition> itAll = ProcessorDefinitionHelper.filterTypeInOutputs(route.getOutputs(), ProcessorDefinition.class);
while (itAll.hasNext()) {
- ProcessorDefinition<?> next = itAll.next();
+ ProcessorDefinition next = itAll.next();
if (matchBy.match(next)) {
matched.add(next);
}
@@ -362,9 +363,9 @@
return createSelectorIterator(matched, selectFirst, selectLast, selectFrom, selectTo);
}
- private static Iterator<ProcessorDefinition<?>> createSelectorIterator(final List<ProcessorDefinition<?>> list, final boolean selectFirst,
+ private static Iterator<ProcessorDefinition> createSelectorIterator(final List<ProcessorDefinition> list, final boolean selectFirst,
final boolean selectLast, final int selectFrom, final int selectTo) {
- return new Iterator<ProcessorDefinition<?>>() {
+ return new Iterator<ProcessorDefinition>() {
private int current;
private boolean done;
@@ -404,8 +405,8 @@
}
@Override
- public ProcessorDefinition<?> next() {
- ProcessorDefinition<?> answer = list.get(current);
+ public ProcessorDefinition next() {
+ ProcessorDefinition answer = list.get(current);
current++;
return answer;
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java b/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
index cc8e777..da28e51 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
@@ -184,7 +184,7 @@
if (beanOrBeanRef instanceof String) {
expression = new MethodCallExpression((String) beanOrBeanRef, method);
} else {
- expression = new MethodCallExpression(beanOrBeanRef, method);
+ expression = new MethodCallExpression((Object) beanOrBeanRef, method);
}
return new ValueBuilder(expression);
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index 8044bd3..6e57965 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -23,7 +23,6 @@
import org.apache.camel.model.DataFormatDefinition;
import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.model.dataformat.AvroDataFormat;
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.BindyType;
import org.apache.camel.model.dataformat.CastorDataFormat;
@@ -72,24 +71,6 @@
this.operation = operation;
}
-
- /**
- * Uses the Avro data format
- */
- public T avro() {
- return dataFormat(new AvroDataFormat());
- }
-
- public T avro(Object schema) {
- AvroDataFormat dataFormat = new AvroDataFormat();
- dataFormat.setSchema(schema);
- return dataFormat(dataFormat);
- }
-
- public T avro(String instanceClassName) {
- return dataFormat(new AvroDataFormat(instanceClassName));
- }
-
/**
* Uses the Bindy data format
*
@@ -239,7 +220,7 @@
/**
* Uses the JiBX data format with unmarshall class.
*/
- public T jibx(Class<?> unmarshallClass) {
+ public T jibx(Class unmarshallClass) {
return dataFormat(new JibxDataFormat(unmarshallClass));
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
index 6e01369..e196245 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
@@ -162,8 +162,9 @@
*/
public static Expression headerExpression(final String headerName, final String name) {
return new ExpressionAdapter() {
+ @SuppressWarnings("unchecked")
public Object evaluate(Exchange exchange) {
- Class<?> type;
+ Class type;
try {
type = exchange.getContext().getClassResolver().resolveMandatoryClass(name);
} catch (ClassNotFoundException e) {
@@ -442,24 +443,6 @@
}
/**
- * Returns an expression for the {@link org.apache.camel.CamelContext} name
- *
- * @return an expression object which will return the camel context name
- */
- public static Expression camelContextNameExpression() {
- return new ExpressionAdapter() {
- public Object evaluate(Exchange exchange) {
- return exchange.getContext().getName();
- }
-
- @Override
- public String toString() {
- return "camelContextName";
- }
- };
- }
-
- /**
* Returns an expression for an exception message set on the exchange
*
* @see <tt>Exchange.getException().getMessage()</tt>
@@ -498,7 +481,8 @@
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
- IOHelper.close(pw, sw);
+ IOHelper.close(pw);
+ IOHelper.close(sw);
return sw.toString();
} else {
return null;
@@ -748,8 +732,9 @@
*/
public static Expression bodyExpression(final String name) {
return new ExpressionAdapter() {
+ @SuppressWarnings("unchecked")
public Object evaluate(Exchange exchange) {
- Class<?> type;
+ Class type;
try {
type = exchange.getContext().getClassResolver().resolveMandatoryClass(name);
} catch (ClassNotFoundException e) {
@@ -771,8 +756,9 @@
*/
public static Expression mandatoryBodyExpression(final String name) {
return new ExpressionAdapter() {
+ @SuppressWarnings("unchecked")
public Object evaluate(Exchange exchange) {
- Class<?> type;
+ Class type;
try {
type = exchange.getContext().getClassResolver().resolveMandatoryClass(name);
} catch (ClassNotFoundException e) {
@@ -996,7 +982,8 @@
/**
* Returns an expression which converts the given expression to the given type
*/
- public static Expression convertToExpression(final Expression expression, final Class<?> type) {
+ @SuppressWarnings("unchecked")
+ public static Expression convertToExpression(final Expression expression, final Class type) {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
if (type != null) {
@@ -1118,11 +1105,11 @@
* <p/>
* The expression is evaluted as a {@link List} object to allow sorting.
*/
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public static Expression sortExpression(final Expression expression, final Comparator comparator) {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
- List<?> list = expression.evaluate(exchange, List.class);
+ List list = expression.evaluate(exchange, List.class);
Collections.sort(list, comparator);
return list;
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
index 299a41c..3f2cf2e 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
@@ -104,7 +104,7 @@
/**
* An expression of an outbound message body converted to the expected type
*/
- public T outBody(Class<?> expectedType) {
+ public T outBody(Class expectedType) {
return delegate.outBody(expectedType);
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
index 888869e..88036cd 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
@@ -117,7 +117,8 @@
/**
* An expression of an inbound message body converted to the expected type
*/
- public T body(Class<?> expectedType) {
+ @SuppressWarnings("unchecked")
+ public T body(Class expectedType) {
return expression(ExpressionBuilder.bodyExpression(expectedType));
}
@@ -131,7 +132,8 @@
/**
* An expression of an outbound message body converted to the expected type
*/
- public T outBody(Class<?> expectedType) {
+ @SuppressWarnings("unchecked")
+ public T outBody(Class expectedType) {
return expression(ExpressionBuilder.outBodyExpression(expectedType));
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
index 957c0f5..ac9164f 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
@@ -1058,7 +1058,7 @@
return doWhenBodies(bodyList, false, true);
}
- private NotifyBuilder doWhenBodies(final List<?> bodies, final boolean received, final boolean exact) {
+ private NotifyBuilder doWhenBodies(final List bodies, final boolean received, final boolean exact) {
stack.add(new EventPredicateSupport() {
private boolean matches;
private int current;
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ProxyBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/ProxyBuilder.java
index 33c04d3..64637e4 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ProxyBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ProxyBuilder.java
@@ -60,28 +60,14 @@
/**
* Builds the proxy.
*
- * @param interfaceClass the service interface
- * @return the proxied bean
- * @throws Exception is thrown if error creating the proxy
- */
- @SuppressWarnings("unchecked")
- public <T> T build(Class<T> interfaceClass) throws Exception {
- // this method is introduced to avoid compiler warnings about the
- // generic Class arrays in the case we've got only one single Class
- // to build a Proxy for
- return build((Class<T>[]) new Class[] {interfaceClass});
- }
-
- /**
- * Builds the proxy.
- *
* @param interfaceClasses the service interface(s)
* @return the proxied bean
* @throws Exception is thrown if error creating the proxy
*/
- public <T> T build(Class<T>... interfaceClasses) throws Exception {
+ @SuppressWarnings("unchecked")
+ public <T> T build(Class<?>... interfaceClasses) throws Exception {
ObjectHelper.notNull(endpoint, "endpoint");
- return ProxyHelper.createProxy(endpoint, interfaceClasses);
+ return (T)ProxyHelper.createProxy(endpoint, interfaceClasses);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
index e17dace..151f80b 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
@@ -138,13 +138,15 @@
* Installs the given <a href="http://camel.apache.org/error-handler.html">error handler</a> builder
*
* @param errorHandlerBuilder the error handler to be used by default for all child routes
+ * @return the current builder with the error handler configured
*/
- public void errorHandler(ErrorHandlerBuilder errorHandlerBuilder) {
+ public RouteBuilder errorHandler(ErrorHandlerBuilder errorHandlerBuilder) {
if (!getRouteCollection().getRoutes().isEmpty()) {
throw new IllegalArgumentException("errorHandler must be defined before any routes in the RouteBuilder");
}
getRouteCollection().setCamelContext(getContext());
setErrorHandlerBuilder(errorHandlerBuilder);
+ return this;
}
/**
@@ -208,7 +210,7 @@
* @param exception exception to catch
* @return the builder
*/
- public OnExceptionDefinition onException(Class<? extends Throwable> exception) {
+ public OnExceptionDefinition onException(Class exception) {
// is only allowed at the top currently
if (!getRouteCollection().getRoutes().isEmpty()) {
throw new IllegalArgumentException("onException must be defined before any routes in the RouteBuilder");
@@ -224,9 +226,9 @@
* @param exceptions list of exceptions to catch
* @return the builder
*/
- public OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
+ public OnExceptionDefinition onException(Class... exceptions) {
OnExceptionDefinition last = null;
- for (Class<? extends Throwable> ex : exceptions) {
+ for (Class ex : exceptions) {
last = last == null ? onException(ex) : last.onException(ex);
}
return last != null ? last : onException(Exception.class);
diff --git a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
index 810c1cf..d3fec49 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
@@ -89,7 +89,7 @@
private static XPathFactory defaultXPathFactory;
private final Queue<XPathExpression> pool = new ConcurrentLinkedQueue<XPathExpression>();
- private final Queue<XPathExpression> poolLogNamespaces = new ConcurrentLinkedQueue<XPathExpression>();
+ private final Queue<XPathExpression> poolTraceNamespaces = new ConcurrentLinkedQueue<XPathExpression>();
private final String text;
private final ThreadLocal<MessageVariableResolver> variableResolver = new ThreadLocal<MessageVariableResolver>();
private final ThreadLocal<Exchange> exchange = new ThreadLocal<Exchange>();
@@ -103,7 +103,7 @@
private QName resultQName = XPathConstants.NODESET;
private String objectModelUri;
private DefaultNamespaceContext namespaceContext;
- private boolean logNamespaces;
+ private boolean traceNamespaces;
private XPathFunctionResolver functionResolver;
private XPathFunction bodyFunction;
private XPathFunction headerFunction;
@@ -397,8 +397,8 @@
*
* @return the current builder.
*/
- public XPathBuilder logNamespaces() {
- setLogNamespaces(true);
+ public XPathBuilder traceNamespaces() {
+ setTraceNamespaces(true);
return this;
}
@@ -477,7 +477,6 @@
public XPathFunction getBodyFunction() {
if (bodyFunction == null) {
bodyFunction = new XPathFunction() {
- @SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (exchange == null) {
return null;
@@ -496,7 +495,6 @@
public XPathFunction getHeaderFunction() {
if (headerFunction == null) {
headerFunction = new XPathFunction() {
- @SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (exchange != null && !list.isEmpty()) {
Object value = list.get(0);
@@ -519,7 +517,6 @@
public XPathFunction getOutBodyFunction() {
if (outBodyFunction == null) {
outBodyFunction = new XPathFunction() {
- @SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (exchange.get() != null && exchange.get().hasOut()) {
return exchange.get().getOut().getBody();
@@ -538,7 +535,6 @@
public XPathFunction getOutHeaderFunction() {
if (outHeaderFunction == null) {
outHeaderFunction = new XPathFunction() {
- @SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (exchange.get() != null && !list.isEmpty()) {
Object value = list.get(0);
@@ -561,7 +557,6 @@
public XPathFunction getPropertiesFunction() {
if (propertiesFunction == null) {
propertiesFunction = new XPathFunction() {
- @SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (exchange != null && !list.isEmpty()) {
Object value = list.get(0);
@@ -590,7 +585,6 @@
public XPathFunction getSimpleFunction() {
if (simpleFunction == null) {
simpleFunction = new XPathFunction() {
- @SuppressWarnings("rawtypes")
public Object evaluate(List list) throws XPathFunctionException {
if (exchange != null && !list.isEmpty()) {
Object value = list.get(0);
@@ -632,12 +626,12 @@
}
}
- public void setLogNamespaces(boolean logNamespaces) {
- this.logNamespaces = logNamespaces;
+ public void setTraceNamespaces(boolean traceNamespaces) {
+ this.traceNamespaces = traceNamespaces;
}
- public boolean isLogNamespaces() {
- return logNamespaces;
+ public boolean isTraceNamespaces() {
+ return traceNamespaces;
}
public String getObjectModelUri() {
@@ -687,8 +681,8 @@
LOG.trace("Acquired XPathExpression from pool");
}
try {
- if (logNamespaces && LOG.isInfoEnabled()) {
- logNamespaces(exchange);
+ if (traceNamespaces && LOG.isTraceEnabled()) {
+ traceNamespaces(exchange);
}
return doInEvaluateAs(xpathExpression, exchange, resultQName);
} finally {
@@ -698,13 +692,13 @@
}
}
- private void logNamespaces(Exchange exchange) {
+ private void traceNamespaces(Exchange exchange) {
InputStream is = null;
NodeList answer = null;
XPathExpression xpathExpression = null;
try {
- xpathExpression = poolLogNamespaces.poll();
+ xpathExpression = poolTraceNamespaces.poll();
if (xpathExpression == null) {
xpathExpression = createTraceNamespaceExpression();
}
@@ -729,11 +723,11 @@
answer = (NodeList) xpathExpression.evaluate(document, XPathConstants.NODESET);
}
} catch (Exception e) {
- LOG.warn("Unable to trace discovered namespaces in XPath expression", e);
+ LOG.trace("Unable to trace discovered namespaces in XPath expression", e);
} finally {
// IOHelper can handle if is is null
IOHelper.close(is);
- poolLogNamespaces.add(xpathExpression);
+ poolTraceNamespaces.add(xpathExpression);
}
if (answer != null) {
@@ -762,7 +756,7 @@
map.get(prefix).add(namespaces.item(i).getNodeValue());
}
- LOG.info("Namespaces discovered in message: {}.", map);
+ LOG.trace("Namespaces discovered in message: {}.", map);
}
protected Object doInEvaluateAs(XPathExpression xpathExpression, Exchange exchange, QName resultQName) {
@@ -823,10 +817,8 @@
// XPathFactory is not thread safe
XPath xPath = getXPathFactory().newXPath();
- if (!logNamespaces && LOG.isTraceEnabled()) {
+ if (LOG.isTraceEnabled()) {
LOG.trace("Creating new XPath expression in pool. Namespaces on XPath expression: {}", getNamespaceContext().toString());
- } else if (logNamespaces && LOG.isInfoEnabled()) {
- LOG.info("Creating new XPath expression in pool. Namespaces on XPath expression: {}", getNamespaceContext().toString());
}
xPath.setNamespaceContext(getNamespaceContext());
xPath.setXPathVariableResolver(getVariableResolver());
@@ -923,7 +915,7 @@
}
if (body instanceof WrappedFile) {
- body = ((WrappedFile<?>) body).getFile();
+ body = ((WrappedFile) body).getFile();
}
if (body instanceof File) {
// input stream is needed for File to avoid locking the file in case of errors etc
@@ -937,10 +929,11 @@
/**
* Strategy method to extract the document from the exchange.
*/
+ @SuppressWarnings("unchecked")
protected Object getDocument(Exchange exchange, Object body) {
Object answer = null;
- Class<?> type = getDocumentType();
+ Class type = getDocumentType();
if (type != null) {
// try to get the body as the desired type
answer = exchange.getContext().getTypeConverter().convertTo(type, exchange, body);
@@ -988,7 +981,7 @@
public void stop() throws Exception {
pool.clear();
- poolLogNamespaces.clear();
+ poolTraceNamespaces.clear();
}
protected synchronized void initDefaultXPathFactory() throws XPathFactoryConfigurationException {
@@ -1001,7 +994,7 @@
if (defaultXPathFactory == null) {
// read system property and see if there is a factory set
Properties properties = System.getProperties();
- for (Map.Entry<Object, Object> prop : properties.entrySet()) {
+ for (Map.Entry prop : properties.entrySet()) {
String key = (String) prop.getKey();
if (key.startsWith(XPathFactory.DEFAULT_PROPERTY_NAME)) {
String uri = ObjectHelper.after(key, ":");
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java
index 6ca7403..73660ee 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanConverter.java
@@ -43,7 +43,7 @@
return Void.TYPE;
}
- Class<?> from = bi.getArgs()[0].getClass();
+ Class from = bi.getArgs()[0].getClass();
Object body = bi.getArgs()[0];
// maybe from is already the type we want
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
index 0c44dfd..3476533 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
@@ -147,6 +147,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public MethodInvocation createInvocation(Object pojo, Exchange exchange)
throws AmbiguousMethodCallException, MethodNotFoundException {
MethodInfo methodInfo = null;
@@ -165,7 +166,7 @@
if ("class".equals(name) || "getClass".equals(name)) {
try {
Method method = pojo.getClass().getMethod("getClass");
- methodInfo = new MethodInfo(exchange.getContext(), pojo.getClass(), method, Collections.<ParameterInfo>emptyList(), Collections.<ParameterInfo>emptyList(), false, false);
+ methodInfo = new MethodInfo(exchange.getContext(), pojo.getClass(), method, Collections.EMPTY_LIST, Collections.EMPTY_LIST, false, false);
} catch (NoSuchMethodException e) {
throw new MethodNotFoundException(exchange, pojo, "getClass");
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/ClassComponent.java b/camel-core/src/main/java/org/apache/camel/component/bean/ClassComponent.java
index ef6f4bb..1ec69c1 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/ClassComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/ClassComponent.java
@@ -29,13 +29,14 @@
*/
public class ClassComponent extends BeanComponent {
+ @SuppressWarnings("unchecked")
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
BeanEndpoint endpoint = new BeanEndpoint(uri, this);
endpoint.setBeanName(remaining);
// bean name is the FQN
String name = endpoint.getBeanName();
- Class<?> clazz = getCamelContext().getClassResolver().resolveMandatoryClass(name);
+ Class clazz = getCamelContext().getClassResolver().resolveMandatoryClass(name);
// create bean
Object bean = getCamelContext().getInjector().newInstance(clazz);
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
index cda3913..2d8e3b3 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
@@ -102,7 +102,6 @@
}
}
- @SuppressWarnings("deprecation")
public MethodInfo(CamelContext camelContext, Class<?> type, Method method, List<ParameterInfo> parameters, List<ParameterInfo> bodyParameters,
boolean hasCustomAnnotation, boolean hasHandlerAnnotation) {
this.camelContext = camelContext;
@@ -370,7 +369,7 @@
// the parameter values is between the parenthesis
String methodParameters = ObjectHelper.between(methodName, "(", ")");
// use an iterator to walk the parameter values
- Iterator<?> it = null;
+ Iterator it = null;
if (methodParameters != null) {
it = ObjectHelper.createIterator(methodParameters);
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java b/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java
index 71e9760..c205d79 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java
@@ -28,6 +28,7 @@
private final Object bean;
private final String methodName;
+ @SuppressWarnings("rawtypes")
public MethodNotFoundException(Exchange exchange, Object pojo, String methodName) {
super("Method with name: " + methodName + " not found on bean: " + pojo + " of type: " + ObjectHelper.className(pojo), exchange);
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java b/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java
index d287caf..45884bf 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/ProxyHelper.java
@@ -38,68 +38,45 @@
/**
* Creates a Proxy which sends the exchange to the endpoint.
*/
+ public static Object createProxyObject(Endpoint endpoint, Producer producer, ClassLoader classLoader, Class[] interfaces, MethodInfoCache methodCache) {
+ return Proxy.newProxyInstance(classLoader, interfaces.clone(), new CamelInvocationHandler(endpoint, producer, methodCache));
+ }
+
+
+ /**
+ * Creates a Proxy which sends the exchange to the endpoint.
+ */
@SuppressWarnings("unchecked")
- public static <T> T createProxyObject(Endpoint endpoint, Producer producer, ClassLoader classLoader, Class<T>[] interfaces, MethodInfoCache methodCache) {
- return (T) Proxy.newProxyInstance(classLoader, interfaces.clone(), new CamelInvocationHandler(endpoint, producer, methodCache));
- }
-
- /**
- * Creates a Proxy which sends the exchange to the endpoint.
- */
- public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<T> interfaceClass, MethodInfoCache methodCache) throws Exception {
- return createProxy(endpoint, cl, toArray(interfaceClass), methodCache);
- }
-
- /**
- * Creates a Proxy which sends the exchange to the endpoint.
- */
- public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<T>[] interfaceClasses, MethodInfoCache methodCache) throws Exception {
+ public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class[] interfaces, MethodInfoCache methodCache) throws Exception {
Producer producer = endpoint.createProducer();
// ensure the producer is started
ServiceHelper.startService(producer);
- return createProxyObject(endpoint, producer, cl, interfaceClasses, methodCache);
+ return (T) createProxyObject(endpoint, producer, cl, interfaces, methodCache);
}
/**
* Creates a Proxy which sends the exchange to the endpoint.
*/
- public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<T> interfaceClass) throws Exception {
- return createProxy(endpoint, cl, toArray(interfaceClass));
+ @SuppressWarnings("unchecked")
+ public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<?>... interfaceClasses) throws Exception {
+ return (T) createProxy(endpoint, cl, interfaceClasses, createMethodInfoCache(endpoint));
+ }
+
+
+ /**
+ * Creates a Proxy which sends the exchange to the endpoint.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T createProxy(Endpoint endpoint, Class<?>... interfaceClasses) throws Exception {
+ return (T) createProxy(endpoint, getClassLoader(interfaceClasses), interfaceClasses);
}
/**
* Creates a Proxy which sends the exchange to the endpoint.
*/
- public static <T> T createProxy(Endpoint endpoint, ClassLoader cl, Class<T>... interfaceClasses) throws Exception {
- return createProxy(endpoint, cl, interfaceClasses, createMethodInfoCache(endpoint));
- }
-
- /**
- * Creates a Proxy which sends the exchange to the endpoint.
- */
- public static <T> T createProxy(Endpoint endpoint, Class<T> interfaceClass) throws Exception {
- return createProxy(endpoint, toArray(interfaceClass));
- }
-
- /**
- * Creates a Proxy which sends the exchange to the endpoint.
- */
- public static <T> T createProxy(Endpoint endpoint, Class<T>... interfaceClasses) throws Exception {
- return createProxy(endpoint, getClassLoader(interfaceClasses), interfaceClasses);
- }
-
- /**
- * Creates a Proxy which sends the exchange to the endpoint.
- */
- public static <T> T createProxy(Endpoint endpoint, Producer producer, Class<T> interfaceClass) throws Exception {
- return createProxy(endpoint, producer, toArray(interfaceClass));
- }
-
- /**
- * Creates a Proxy which sends the exchange to the endpoint.
- */
- public static <T> T createProxy(Endpoint endpoint, Producer producer, Class<T>... interfaceClasses) throws Exception {
- return createProxyObject(endpoint, producer, getClassLoader(interfaceClasses), interfaceClasses, createMethodInfoCache(endpoint));
+ @SuppressWarnings("unchecked")
+ public static <T> T createProxy(Endpoint endpoint, Producer producer, Class<?>... interfaceClasses) throws Exception {
+ return (T) createProxyObject(endpoint, producer, getClassLoader(interfaceClasses), interfaceClasses, createMethodInfoCache(endpoint));
}
/**
@@ -115,12 +92,4 @@
protected static MethodInfoCache createMethodInfoCache(Endpoint endpoint) {
return new MethodInfoCache(endpoint.getCamelContext());
}
-
- @SuppressWarnings("unchecked")
- private static <T> Class<T>[] toArray(Class<T> interfaceClass) {
- // this method and it's usage is introduced to avoid compiler warnings
- // about the generic Class arrays in the case we've got only one single
- // Class to build a Proxy for
- return new Class[] {interfaceClass};
- }
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java b/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java
index f97128d..b0fbc8a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/direct/DirectConsumer.java
@@ -77,7 +77,7 @@
return 0;
}
- public void prepareShutdown(boolean forced) {
+ public void prepareShutdown() {
// noop
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java b/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
index 5a09e15..5c4ca5f 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
@@ -16,57 +16,104 @@
*/
package org.apache.camel.component.file;
+import java.lang.reflect.Method;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
+import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.CollectionHelper.collectionAsCommaDelimitedString;
+
/**
- * File filter using AntPathMatcher.
+ * File filter using Spring's AntPathMatcher.
* <p/>
* Exclude take precedence over includes. If a file match both exclude and include it will be regarded as excluded.
* @param <T>
*/
-public class AntPathMatcherGenericFileFilter<T> implements GenericFileFilter<T> {
+public class AntPathMatcherGenericFileFilter<T> implements GenericFileFilter<T>, CamelContextAware {
+ private static final String ANTPATHMATCHER_CLASSNAME = "org.apache.camel.spring.util.SpringAntPathMatcherFileFilter";
- private final AntPathMatcherFileFilter filter;
+ private CamelContext context;
- public AntPathMatcherGenericFileFilter() {
- filter = new AntPathMatcherFileFilter();
- }
+ private String[] excludes;
+ private String[] includes;
- public AntPathMatcherGenericFileFilter(String... includes) {
- filter = new AntPathMatcherFileFilter();
- filter.setIncludes(includes);
- }
+ private Object filter;
+ private Method includesMethod;
+ private Method excludesMethod;
+ private Method acceptsMethod;
public boolean accept(GenericFile<T> file) {
- String path = file.getRelativeFilePath();
- return filter.acceptPathName(path);
+ try {
+ synchronized (this) {
+ if (filter == null) {
+ init();
+ }
+ }
+
+ // invoke setIncludes(String), must using string type as invoking with string[] does not work
+ ObjectHelper.invokeMethod(includesMethod, filter, collectionAsCommaDelimitedString(includes));
+
+ // invoke setExcludes(String), must using string type as invoking with string[] does not work
+ ObjectHelper.invokeMethod(excludesMethod, filter, collectionAsCommaDelimitedString(excludes));
+
+ // invoke acceptPathName(String)
+ String path = file.getRelativeFilePath();
+ return (Boolean) ObjectHelper.invokeMethod(acceptsMethod, filter, path);
+
+ } catch (NoSuchMethodException e) {
+ throw new TypeNotPresentException(ANTPATHMATCHER_CLASSNAME, e);
+ }
+ }
+
+ private void init() throws NoSuchMethodException {
+ // we must use reflection to invoke the AntPathMatcherFileFilter that reside in camel-spring.jar
+ // and we don't want camel-core to have runtime dependency on camel-spring.jar
+ // use class resolver from CamelContext to ensure it works with OSGi as well
+ Class<?> clazz = context.getClassResolver().resolveClass(ANTPATHMATCHER_CLASSNAME);
+ ObjectHelper.notNull(clazz, ANTPATHMATCHER_CLASSNAME + " not found in classpath. camel-spring.jar is required in the classpath.");
+
+ filter = ObjectHelper.newInstance(clazz);
+
+ includesMethod = filter.getClass().getMethod("setIncludes", String.class);
+ excludesMethod = filter.getClass().getMethod("setExcludes", String.class);
+ acceptsMethod = filter.getClass().getMethod("acceptPathName", String.class);
}
public String[] getExcludes() {
- return filter.getExcludes();
+ return excludes;
}
public void setExcludes(String[] excludes) {
- filter.setExcludes(excludes);
+ this.excludes = excludes;
}
public String[] getIncludes() {
- return filter.getIncludes();
+ return includes;
}
public void setIncludes(String[] includes) {
- filter.setIncludes(includes);
+ this.includes = includes;
}
/**
* Sets excludes using a single string where each element can be separated with comma
*/
public void setExcludes(String excludes) {
- filter.setExcludes(excludes);
+ setExcludes(excludes.split(","));
}
/**
* Sets includes using a single string where each element can be separated with comma
*/
public void setIncludes(String includes) {
- filter.setIncludes(includes);
+ setIncludes(includes.split(","));
+ }
+
+ public void setCamelContext(CamelContext camelContext) {
+ this.context = camelContext;
+ }
+
+ public CamelContext getCamelContext() {
+ return context;
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
index 18f5236..8660f9e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
@@ -23,10 +23,12 @@
import java.util.Queue;
import org.apache.camel.AsyncCallback;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.ShutdownRunningTask;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.StopWatch;
@@ -37,12 +39,13 @@
/**
* Base class for file consumers.
*/
-public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsumer {
+public abstract class GenericFileConsumer<T> extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
protected final transient Logger log = LoggerFactory.getLogger(getClass());
protected GenericFileEndpoint<T> endpoint;
protected GenericFileOperations<T> operations;
protected boolean loggedIn;
protected String fileExpressionResult;
+ protected int maxMessagesPerPoll;
protected volatile ShutdownRunningTask shutdownRunningTask;
protected volatile int pendingExchanges;
protected Processor customProcessor;
@@ -137,6 +140,9 @@
return polledMessages;
}
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
@SuppressWarnings("unchecked")
public int processBatch(Queue<Object> exchanges) {
@@ -181,6 +187,53 @@
return total;
}
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
/**
* Whether or not we can continue polling for more files
@@ -402,12 +455,6 @@
}
}
- if (endpoint.getAntFilter() != null) {
- if (!endpoint.getAntFilter().accept(file)) {
- return false;
- }
- }
-
if (ObjectHelper.isNotEmpty(endpoint.getExclude())) {
if (name.matches(endpoint.getExclude())) {
return false;
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index f176448..40828d5 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -86,7 +86,6 @@
protected Boolean idempotent;
protected IdempotentRepository<String> idempotentRepository;
protected GenericFileFilter<T> filter;
- protected AntPathMatcherGenericFileFilter<T> antFilter;
protected Comparator<GenericFile<T>> sorter;
protected Comparator<Exchange> sortBy;
protected String readLock = "none";
@@ -256,24 +255,6 @@
this.exclude = exclude;
}
- public void setAntInclude(String antInclude) {
- if (this.antFilter == null) {
- this.antFilter = new AntPathMatcherGenericFileFilter<T>();
- }
- this.antFilter.setIncludes(antInclude);
- }
-
- public void setAntExclude(String antExclude) {
- if (this.antFilter == null) {
- this.antFilter = new AntPathMatcherGenericFileFilter<T>();
- }
- this.antFilter.setExcludes(antExclude);
- }
-
- public GenericFileFilter<T> getAntFilter() {
- return antFilter;
- }
-
public boolean isDelete() {
return delete;
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
index 7173888..e4b7766c 100644
--- a/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
@@ -92,7 +92,7 @@
private volatile long resultMinimumWaitTime;
private volatile long assertPeriod;
private volatile int expectedMinimumCount;
- private volatile List<?> expectedBodyValues;
+ private volatile List<Object> expectedBodyValues;
private volatile List<Object> actualBodyValues;
private volatile Map<String, Object> expectedHeaderValues;
private volatile Map<String, Object> actualHeaderValues;
@@ -542,7 +542,8 @@
* Adds an expectation that the given body values are received by this
* endpoint in the specified order
*/
- public void expectedBodiesReceived(final List<?> bodies) {
+ @SuppressWarnings("unchecked")
+ public void expectedBodiesReceived(final List bodies) {
expectedMessageCount(bodies.size());
this.expectedBodyValues = bodies;
this.actualBodyValues = new ArrayList<Object>();
@@ -635,7 +636,8 @@
* Adds an expectation that the given body values are received by this
* endpoint in any order
*/
- public void expectedBodiesReceivedInAnyOrder(final List<?> bodies) {
+ @SuppressWarnings("unchecked")
+ public void expectedBodiesReceivedInAnyOrder(final List bodies) {
expectedMessageCount(bodies.size());
this.expectedBodyValues = bodies;
this.actualBodyValues = new ArrayList<Object>();
diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
index c0176bb..ff2edce 100644
--- a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
@@ -38,21 +38,21 @@
*/
public class DefaultPropertiesResolver implements PropertiesResolver {
- public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) throws Exception {
+ public Properties resolveProperties(CamelContext context, String... uri) throws Exception {
Properties answer = new Properties();
for (String path : uri) {
if (path.startsWith("ref:")) {
- Properties prop = loadPropertiesFromRegistry(context, ignoreMissingLocation, path);
+ Properties prop = loadPropertiesFromRegistry(context, path);
prop = prepareLoadedProperties(prop);
answer.putAll(prop);
} else if (path.startsWith("file:")) {
- Properties prop = loadPropertiesFromFilePath(context, ignoreMissingLocation, path);
+ Properties prop = loadPropertiesFromFilePath(context, path);
prop = prepareLoadedProperties(prop);
answer.putAll(prop);
} else {
// default to classpath
- Properties prop = loadPropertiesFromClasspath(context, ignoreMissingLocation, path);
+ Properties prop = loadPropertiesFromClasspath(context, path);
prop = prepareLoadedProperties(prop);
answer.putAll(prop);
}
@@ -61,21 +61,17 @@
return answer;
}
- protected Properties loadPropertiesFromFilePath(CamelContext context, boolean ignoreMissingLocation, String path) throws IOException {
- Properties answer = new Properties();
+ protected Properties loadPropertiesFromFilePath(CamelContext context, String path) throws IOException {
+ Properties answer = null;
if (path.startsWith("file:")) {
path = ObjectHelper.after(path, "file:");
}
- InputStream is = null;
+ InputStream is = new FileInputStream(path);
try {
- is = new FileInputStream(path);
+ answer = new Properties();
answer.load(is);
- } catch (FileNotFoundException e) {
- if (!ignoreMissingLocation) {
- throw e;
- }
} finally {
IOHelper.close(is);
}
@@ -83,8 +79,8 @@
return answer;
}
- protected Properties loadPropertiesFromClasspath(CamelContext context, boolean ignoreMissingLocation, String path) throws IOException {
- Properties answer = new Properties();
+ protected Properties loadPropertiesFromClasspath(CamelContext context, String path) throws IOException {
+ Properties answer = null;
if (path.startsWith("classpath:")) {
path = ObjectHelper.after(path, "classpath:");
@@ -92,28 +88,28 @@
InputStream is = context.getClassResolver().loadResourceAsStream(path);
if (is == null) {
- if (!ignoreMissingLocation) {
- throw new FileNotFoundException("Properties file " + path + " not found in classpath");
- }
- } else {
- try {
- answer.load(is);
- } finally {
- IOHelper.close(is);
- }
+ throw new FileNotFoundException("Properties file " + path + " not found in classpath");
}
+
+ try {
+ answer = new Properties();
+ answer.load(is);
+ } finally {
+ IOHelper.close(is);
+ }
+
return answer;
}
- protected Properties loadPropertiesFromRegistry(CamelContext context, boolean ignoreMissingLocation, String path) throws IOException {
+ protected Properties loadPropertiesFromRegistry(CamelContext context, String path) throws IOException {
if (path.startsWith("ref:")) {
path = ObjectHelper.after(path, "ref:");
}
Properties answer = context.getRegistry().lookup(path, Properties.class);
- if (answer == null && (!ignoreMissingLocation)) {
+ if (answer == null) {
throw new FileNotFoundException("Properties " + path + " not found in registry");
}
- return answer != null ? answer : new Properties();
+ return answer;
}
/**
diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index 2566ba2..9950858 100644
--- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -69,7 +69,6 @@
private PropertiesResolver propertiesResolver = new DefaultPropertiesResolver();
private PropertiesParser propertiesParser = new DefaultPropertiesParser();
private String[] locations;
- private boolean ignoreMissingLocation;
private boolean cache = true;
private String propertyPrefix;
private String propertySuffix;
@@ -94,15 +93,10 @@
// override default locations
String locations = getAndRemoveParameter(parameters, "locations", String.class);
- Boolean ignoreMissingLocationLoc = getAndRemoveParameter(parameters, "ignoreMissingLocation", Boolean.class);
if (locations != null) {
LOG.trace("Overriding default locations with location: {}", locations);
paths = locations.split(",");
}
- if (ignoreMissingLocationLoc != null) {
- ignoreMissingLocation = ignoreMissingLocationLoc;
- }
-
String endpointUri = parseUri(remaining, paths);
LOG.debug("Endpoint uri parsed as: {}", endpointUri);
return getCamelContext().getEndpoint(endpointUri);
@@ -123,7 +117,7 @@
CacheKey key = new CacheKey(locations);
prop = cache ? cacheMap.get(key) : null;
if (prop == null) {
- prop = propertiesResolver.resolveProperties(getCamelContext(), ignoreMissingLocation, locations);
+ prop = propertiesResolver.resolveProperties(getCamelContext(), locations);
if (cache) {
cacheMap.put(key, prop);
}
@@ -207,15 +201,7 @@
public void setFallbackToUnaugmentedProperty(boolean fallbackToUnaugmentedProperty) {
this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
}
-
- public boolean isIgnoreMissingLocation() {
- return ignoreMissingLocation;
- }
-
- public void setIgnoreMissingLocation(boolean ignoreMissingLocation) {
- this.ignoreMissingLocation = ignoreMissingLocation;
- }
-
+
public String getPrefixToken() {
return prefixToken;
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesResolver.java b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesResolver.java
index 008fe06..259e993 100644
--- a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesResolver.java
@@ -32,12 +32,11 @@
/**
* Resolve properties from the given uri
*
- *
* @param context the camel context
- * @param ignoreMissingLocation ignore silently if the property file is missing
- * @param uri uri(s) defining the source(s) @return the properties
+ * @param uri uri(s) defining the source(s)
+ * @return the properties
* @throws Exception is thrown if resolving the properties failed
*/
- Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) throws Exception;
+ Properties resolveProperties(CamelContext context, String... uri) throws Exception;
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
index ebaf76b..dd23a96 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
@@ -101,8 +101,7 @@
return endpoint.getQueue().size();
}
- @Override
- public void prepareShutdown(boolean forced) {
+ public void prepareShutdown() {
// signal we want to shutdown
shutdownPending = true;
diff --git a/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java b/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java
index ab92cf1..e72dfba 100644
--- a/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/component/validator/DefaultLSResourceResolver.java
@@ -34,29 +34,35 @@
public class DefaultLSResourceResolver implements LSResourceResolver {
private final CamelContext camelContext;
+ private final String resourceUri;
private final String resourcePath;
public DefaultLSResourceResolver(CamelContext camelContext, String resourceUri) {
this.camelContext = camelContext;
+ this.resourceUri = resourceUri;
this.resourcePath = FileUtil.onlyPath(resourceUri);
}
@Override
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
- return new DefaultLSInput(publicId, systemId, baseURI);
+ return new DefaultLSInput(baseURI, namespaceURI, publicId, systemId, type);
}
private final class DefaultLSInput implements LSInput {
+ private final String type;
+ private final String namespaceURI;
private final String publicId;
private final String systemId;
private final String baseURI;
private final String uri;
- private DefaultLSInput(String publicId, String systemId, String baseURI) {
+ private DefaultLSInput(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
+ this.baseURI = baseURI;
+ this.namespaceURI = namespaceURI;
this.publicId = publicId;
this.systemId = systemId;
- this.baseURI = baseURI;
+ this.type = type;
if (resourcePath != null) {
uri = resourcePath + "/" + systemId;
diff --git a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java
index 11bf38c..994a5ba 100644
--- a/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/validator/ValidatorComponent.java
@@ -32,7 +32,7 @@
import org.slf4j.LoggerFactory;
/**
- * The <a href="http://camel.apache.org/validation.html">Validator Component</a>
+ * The <a href="http://camel.apache.org/validator.html">Validator Component</a>
* for validating XML against some schema
*/
public class ValidatorComponent extends DefaultComponent {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/BreakpointSupport.java b/camel-core/src/main/java/org/apache/camel/impl/BreakpointSupport.java
index c41fa79..68c4fa9 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/BreakpointSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/BreakpointSupport.java
@@ -46,15 +46,15 @@
state = State.Active;
}
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
// noop
}
- public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
// noop
}
- public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
+ public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition definition) {
// noop
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/CompositeRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/CompositeRegistry.java
index 4435b97..4eb9c22 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/CompositeRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/CompositeRegistry.java
@@ -73,11 +73,12 @@
return answer;
}
+ @SuppressWarnings("unchecked")
public <T> Map<String, T> lookupByType(Class<T> type) {
- Map<String, T> answer = Collections.<String, T>emptyMap();
+ Map<String, T> answer = Collections.EMPTY_MAP;
for (Registry registry : registryList) {
answer = registry.lookupByType(type);
- if (!answer.isEmpty()) {
+ if (answer != Collections.EMPTY_MAP) {
break;
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ConditionSupport.java b/camel-core/src/main/java/org/apache/camel/impl/ConditionSupport.java
index 9d32662..eb3eeb3 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ConditionSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ConditionSupport.java
@@ -30,7 +30,7 @@
*/
public class ConditionSupport implements Condition {
- public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
return false;
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java
deleted file mode 100644
index cdd826a..0000000
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelBeanPostProcessor.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Produce;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ReflectionHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A bean post processor which implements the <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a>
- * features in Camel. Features such as the <a href="http://camel.apache.org/bean-injection.html">Bean Injection</a> of objects like
- * {@link org.apache.camel.Endpoint} and
- * {@link org.apache.camel.ProducerTemplate} together with support for
- * <a href="http://camel.apache.org/pojo-consuming.html">POJO Consuming</a> via the
- * {@link org.apache.camel.Consume} annotation along with
- * <a href="http://camel.apache.org/pojo-producing.html">POJO Producing</a> via the
- * {@link org.apache.camel.Produce} annotation along with other annotations such as
- * {@link org.apache.camel.DynamicRouter} for creating <a href="http://camel.apache.org/dynamicrouter-annotation.html">a Dynamic router via annotations</a>.
- * {@link org.apache.camel.RecipientList} for creating <a href="http://camel.apache.org/recipientlist-annotation.html">a Recipient List router via annotations</a>.
- * {@link org.apache.camel.RoutingSlip} for creating <a href="http://camel.apache.org/routingslip-annotation.html">a Routing Slip router via annotations</a>.
- * <p/>
- * Components such as <tt>camel-spring</tt>, and <tt>camel-blueprint</tt> can leverage this post processor to hook in Camel
- * bean post processing into their bean processing framework.
- */
-public class DefaultCamelBeanPostProcessor {
-
- protected static final transient Logger LOG = LoggerFactory.getLogger(DefaultCamelBeanPostProcessor.class);
- protected CamelPostProcessorHelper camelPostProcessorHelper;
- protected CamelContext camelContext;
-
- public DefaultCamelBeanPostProcessor() {
- }
-
- public DefaultCamelBeanPostProcessor(CamelContext camelContext) {
- this.camelContext = camelContext;
- }
-
- /**
- * Apply this post processor to the given new bean instance <i>before</i> any bean
- * initialization callbacks (like <code>afterPropertiesSet</code>
- * or a custom init-method). The bean will already be populated with property values.
- * The returned bean instance may be a wrapper around the original.
- *
- * @param bean the new bean instance
- * @param beanName the name of the bean
- * @return the bean instance to use, either the original or a wrapped one; if
- * <code>null</code>, no subsequent BeanPostProcessors will be invoked
- * @throws Exception is thrown if error post processing bean
- */
- public Object postProcessBeforeInitialization(Object bean, String beanName) throws Exception {
- LOG.trace("Camel bean processing before initialization for bean: {}", beanName);
-
- // some beans cannot be post processed at this given time, so we gotta check beforehand
- if (!canPostProcessBean(bean, beanName)) {
- return bean;
- }
-
- injectFields(bean, beanName);
- injectMethods(bean, beanName);
-
- if (bean instanceof CamelContextAware && canSetCamelContext(bean, beanName)) {
- CamelContextAware contextAware = (CamelContextAware)bean;
- CamelContext context = getOrLookupCamelContext();
- if (context == null) {
- LOG.warn("No CamelContext defined yet so cannot inject into bean: " + beanName);
- } else {
- contextAware.setCamelContext(context);
- }
- }
-
- return bean;
- }
-
- /**
- * Apply this post processor to the given new bean instance <i>after</i> any bean
- * initialization callbacks (like <code>afterPropertiesSet</code>
- * or a custom init-method). The bean will already be populated with property values.
- * The returned bean instance may be a wrapper around the original.
- *
- * @param bean the new bean instance
- * @param beanName the name of the bean
- * @return the bean instance to use, either the original or a wrapped one; if
- * <code>null</code>, no subsequent BeanPostProcessors will be invoked
- * @throws Exception is thrown if error post processing bean
- */
- public Object postProcessAfterInitialization(Object bean, String beanName) throws Exception {
- LOG.trace("Camel bean processing after initialization for bean: {}", beanName);
-
- // some beans cannot be post processed at this given time, so we gotta check beforehand
- if (!canPostProcessBean(bean, beanName)) {
- return bean;
- }
-
- if (bean instanceof DefaultEndpoint) {
- DefaultEndpoint defaultEndpoint = (DefaultEndpoint) bean;
- defaultEndpoint.setEndpointUriIfNotSpecified(beanName);
- }
-
- return bean;
- }
-
- /**
- * Strategy to get the {@link CamelContext} to use.
- */
- public CamelContext getOrLookupCamelContext() {
- return camelContext;
- }
-
- /**
- * Strategy to get the {@link CamelPostProcessorHelper}
- */
- protected CamelPostProcessorHelper getPostProcessorHelper() {
- if (camelPostProcessorHelper == null) {
- camelPostProcessorHelper = new CamelPostProcessorHelper(getOrLookupCamelContext());
- }
- return camelPostProcessorHelper;
- }
-
- protected boolean canPostProcessBean(Object bean, String beanName) {
- return bean != null;
- }
-
- protected boolean canSetCamelContext(Object bean, String beanName) {
- if (bean instanceof CamelContextAware) {
- CamelContextAware camelContextAware = (CamelContextAware) bean;
- CamelContext context = camelContextAware.getCamelContext();
- if (context != null) {
- LOG.trace("CamelContext already set on bean with id [{}]. Will keep existing CamelContext on bean.", beanName);
- return false;
- }
- }
-
- return true;
- }
-
-
- /**
- * A strategy method to allow implementations to perform some custom JBI
- * based injection of the POJO
- *
- * @param bean the bean to be injected
- */
- protected void injectFields(final Object bean, final String beanName) {
- ReflectionHelper.doWithFields(bean.getClass(), new ReflectionHelper.FieldCallback() {
- public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
- EndpointInject endpointInject = field.getAnnotation(EndpointInject.class);
- if (endpointInject != null && getPostProcessorHelper().matchContext(endpointInject.context())) {
- injectField(field, endpointInject.uri(), endpointInject.ref(), bean, beanName);
- }
-
- Produce produce = field.getAnnotation(Produce.class);
- if (produce != null && getPostProcessorHelper().matchContext(produce.context())) {
- injectField(field, produce.uri(), produce.ref(), bean, beanName);
- }
- }
- });
- }
-
- protected void injectField(Field field, String endpointUri, String endpointRef, Object bean, String beanName) {
- ReflectionHelper.setField(field, bean, getPostProcessorHelper().getInjectionValue(field.getType(), endpointUri, endpointRef, field.getName(), bean, beanName));
- }
-
- protected void injectMethods(final Object bean, final String beanName) {
- ReflectionHelper.doWithMethods(bean.getClass(), new ReflectionHelper.MethodCallback() {
- public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
- setterInjection(method, bean, beanName);
- getPostProcessorHelper().consumerInjection(method, bean, beanName);
- }
- });
- }
-
- protected void setterInjection(Method method, Object bean, String beanName) {
- EndpointInject endpointInject = method.getAnnotation(EndpointInject.class);
- if (endpointInject != null && getPostProcessorHelper().matchContext(endpointInject.context())) {
- setterInjection(method, bean, beanName, endpointInject.uri(), endpointInject.ref());
- }
-
- Produce produce = method.getAnnotation(Produce.class);
- if (produce != null && getPostProcessorHelper().matchContext(produce.context())) {
- setterInjection(method, bean, beanName, produce.uri(), produce.ref());
- }
- }
-
- protected void setterInjection(Method method, Object bean, String beanName, String endpointUri, String endpointRef) {
- Class<?>[] parameterTypes = method.getParameterTypes();
- if (parameterTypes != null) {
- if (parameterTypes.length != 1) {
- LOG.warn("Ignoring badly annotated method for injection due to incorrect number of parameters: " + method);
- } else {
- String propertyName = ObjectHelper.getPropertyName(method);
- Object value = getPostProcessorHelper().getInjectionValue(parameterTypes[0], endpointUri, endpointRef, propertyName, bean, beanName);
- ObjectHelper.invokeMethod(method, bean, value);
- }
- }
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 2bccc15..446bdfc 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -102,7 +102,6 @@
import org.apache.camel.spi.LanguageResolver;
import org.apache.camel.spi.LifecycleStrategy;
import org.apache.camel.spi.ManagementMBeanAssembler;
-import org.apache.camel.spi.ManagementNameStrategy;
import org.apache.camel.spi.ManagementStrategy;
import org.apache.camel.spi.NodeIdFactory;
import org.apache.camel.spi.PackageScanClassResolver;
@@ -137,7 +136,6 @@
private final transient Logger log = LoggerFactory.getLogger(getClass());
private JAXBContext jaxbContext;
private CamelContextNameStrategy nameStrategy = new DefaultCamelContextNameStrategy();
- private ManagementNameStrategy managementNameStrategy = new DefaultManagementNameStrategy(this);
private String managementName;
private ClassLoader applicationContextClassLoader;
private Map<EndpointKey, Endpoint> endpoints;
@@ -262,14 +260,6 @@
this.nameStrategy = nameStrategy;
}
- public ManagementNameStrategy getManagementNameStrategy() {
- return managementNameStrategy;
- }
-
- public void setManagementNameStrategy(ManagementNameStrategy managementNameStrategy) {
- this.managementNameStrategy = managementNameStrategy;
- }
-
public String getManagementName() {
return managementName;
}
@@ -390,8 +380,8 @@
answer.add(oldEndpoint);
stopServices(oldEndpoint);
} else {
- for (Map.Entry<EndpointKey, Endpoint> entry : endpoints.entrySet()) {
- oldEndpoint = entry.getValue();
+ for (Map.Entry entry : endpoints.entrySet()) {
+ oldEndpoint = (Endpoint)entry.getValue();
if (EndpointHelper.matchEndpoint(oldEndpoint.getEndpointUri(), uri)) {
try {
stopServices(oldEndpoint);
@@ -925,7 +915,7 @@
if (object instanceof Service) {
startService((Service)object);
} else if (object instanceof Collection<?>) {
- startServices((Collection<?>)object);
+ startServices((Collection)object);
}
}
@@ -1553,7 +1543,7 @@
// stop route inputs in the same order as they was started so we stop the very first inputs first
try {
- // force shutting down routes as they may otherwise cause shutdown to hang
+ // force shutting down routes as they mau otherwise cause shutdown to hang
shutdownStrategy.shutdownForced(this, getRouteStartupOrder());
} catch (Throwable e) {
log.warn("Error occurred while shutting down routes. This exception will be ignored.", e);
@@ -1607,7 +1597,8 @@
stopWatch.stop();
if (log.isInfoEnabled()) {
- log.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ") is shutdown in " + TimeUtils.printDuration(stopWatch.taken()) + ". Uptime " + getUptime() + ".");
+ log.info("Uptime: " + getUptime());
+ log.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ") is shutdown in " + TimeUtils.printDuration(stopWatch.taken()));
}
// and clear start date
@@ -1677,7 +1668,7 @@
// allow us to do custom work before delegating to service helper
try {
if (service instanceof Service) {
- ServiceHelper.stopAndShutdownService(service);
+ ServiceHelper.stopAndShutdownService((Service)service);
} else if (service instanceof Collection) {
ServiceHelper.stopAndShutdownServices((Collection<?>)service);
}
@@ -1717,7 +1708,7 @@
service.start();
}
- private void startServices(Collection<?> services) throws Exception {
+ private void startServices(Collection services) throws Exception {
for (Object element : services) {
if (element instanceof Service) {
startService((Service)element);
@@ -2059,7 +2050,6 @@
/**
* Lazily create a default implementation
*/
- @SuppressWarnings("deprecation")
protected TypeConverter createTypeConverter() {
BaseTypeConverterRegistry answer;
if (isLazyLoadTypeConverters()) {
@@ -2298,13 +2288,11 @@
public Boolean isAutoStartup() {
return autoStartup != null && autoStartup;
}
-
- @Deprecated
+
public Boolean isLazyLoadTypeConverters() {
return lazyLoadTypeConverters != null && lazyLoadTypeConverters;
}
-
- @Deprecated
+
public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
this.lazyLoadTypeConverters = lazyLoadTypeConverters;
}
@@ -2446,7 +2434,6 @@
*/
public static void setContextCounter(int value) {
DefaultCamelContextNameStrategy.setCounter(value);
- DefaultManagementNameStrategy.setCounter(value);
}
private static UuidGenerator createDefaultUuidGenerator() {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContextNameStrategy.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContextNameStrategy.java
index f7fec6c..26e4c92 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContextNameStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContextNameStrategy.java
@@ -40,7 +40,6 @@
this.name = getNextName();
}
- @Override
public String getName() {
if (name == null) {
name = getNextName();
@@ -48,16 +47,10 @@
return name;
}
- @Override
public String getNextName() {
return prefix + "-" + getNextCounter();
}
- @Override
- public boolean isFixedName() {
- return false;
- }
-
public static int getNextCounter() {
return CONTEXT_COUNTER.incrementAndGet();
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
index cc1ff4d..57b9847 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponentResolver.java
@@ -41,6 +41,7 @@
private static final transient Logger LOG = LoggerFactory.getLogger(DefaultComponentResolver.class);
private FactoryFinder factoryFinder;
+ @SuppressWarnings("unchecked")
public Component resolveComponent(String name, CamelContext context) {
// lookup in registry first
Object bean = null;
@@ -65,7 +66,7 @@
}
// not in registry then use component factory
- Class<?> type;
+ Class type;
try {
type = findComponent(name, context);
if (type == null) {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
index d6f155e..35db99d 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultDebugger.java
@@ -128,15 +128,15 @@
breakpoint.activate();
}
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
breakpoint.beforeProcess(exchange, processor, definition);
}
- public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
breakpoint.afterProcess(exchange, processor, definition, timeTaken);
}
- public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
+ public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition definition) {
if (event instanceof ExchangeCreatedEvent) {
exchange.getContext().getDebugger().startSingleStepExchange(exchange.getExchangeId(), this);
} else if (event instanceof ExchangeCompletedEvent) {
@@ -196,7 +196,7 @@
singleSteps.remove(exchangeId);
}
- public boolean beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public boolean beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
// is the exchange in single step mode?
Breakpoint singleStep = singleSteps.get(exchange.getExchangeId());
if (singleStep != null) {
@@ -219,7 +219,7 @@
return match;
}
- public boolean afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public boolean afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
// is the exchange in single step mode?
Breakpoint singleStep = singleSteps.get(exchange.getExchangeId());
if (singleStep != null) {
@@ -265,7 +265,7 @@
return match;
}
- protected void onBeforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, Breakpoint breakpoint) {
+ protected void onBeforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, Breakpoint breakpoint) {
try {
breakpoint.beforeProcess(exchange, processor, definition);
} catch (Throwable e) {
@@ -273,7 +273,7 @@
}
}
- protected void onAfterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken, Breakpoint breakpoint) {
+ protected void onAfterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken, Breakpoint breakpoint) {
try {
breakpoint.afterProcess(exchange, processor, definition, timeTaken);
} catch (Throwable e) {
@@ -282,7 +282,7 @@
}
protected void onEvent(Exchange exchange, EventObject event, Breakpoint breakpoint) {
- ProcessorDefinition<?> definition = null;
+ ProcessorDefinition definition = null;
// try to get the last known definition
if (exchange.getUnitOfWork() != null && exchange.getUnitOfWork().getTracedRouteNodes() != null) {
@@ -299,7 +299,7 @@
}
}
- private boolean matchConditions(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, BreakpointConditions breakpoint) {
+ private boolean matchConditions(Exchange exchange, Processor processor, ProcessorDefinition definition, BreakpointConditions breakpoint) {
if (breakpoint.getConditions() != null && !breakpoint.getConditions().isEmpty()) {
for (Condition condition : breakpoint.getConditions()) {
if (!condition.matchProcess(exchange, processor, definition)) {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
index 9130458..54d2bcb 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
@@ -210,13 +210,13 @@
// if the converter is a map/collection we need to check its content as well
if (converted instanceof Collection) {
- Collection<?> valueCol = (Collection<?>) converted;
+ Collection valueCol = (Collection) converted;
if (!collectionContainsAllSerializableObjects(valueCol, exchange)) {
logCannotSerializeObject(type, entry.getKey(), entry.getValue());
continue;
}
} else if (converted instanceof Map) {
- Map<?, ?> valueMap = (Map<?, ?>) converted;
+ Map valueMap = (Map) converted;
if (!mapContainsAllSerializableObjects(valueMap, exchange)) {
logCannotSerializeObject(type, entry.getKey(), entry.getValue());
continue;
@@ -248,7 +248,7 @@
}
}
- private static boolean collectionContainsAllSerializableObjects(Collection<?> col, Exchange exchange) {
+ private static boolean collectionContainsAllSerializableObjects(Collection col, Exchange exchange) {
for (Object value : col) {
if (value != null) {
Serializable converted = exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, value);
@@ -260,7 +260,7 @@
return true;
}
- private static boolean mapContainsAllSerializableObjects(Map<?, ?> map, Exchange exchange) {
+ private static boolean mapContainsAllSerializableObjects(Map map, Exchange exchange) {
for (Object value : map.values()) {
if (value != null) {
Serializable converted = exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, value);
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
index a22d5a3..6b9e8c9 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java
@@ -123,7 +123,7 @@
@Override
public void setThreadNamePattern(String threadNamePattern) {
// must set camel id here in the pattern and let the other placeholders be resolved on demand
- String name = threadNamePattern.replaceFirst("#camelId#", this.camelContext.getName());
+ String name = threadNamePattern.replaceFirst("\\$\\{camelId\\}", this.camelContext.getName());
this.threadNamePattern = name;
}
@@ -245,18 +245,13 @@
public void shutdown(ExecutorService executorService) {
ObjectHelper.notNull(executorService, "executorService");
- if (!executorService.isShutdown()) {
- LOG.debug("Shutdown ExecutorService: {}", executorService);
- executorService.shutdown();
- LOG.trace("Shutdown ExecutorService: {} complete.", executorService);
+ if (executorService.isShutdown()) {
+ return;
}
- if (executorService instanceof ThreadPoolExecutor) {
- ThreadPoolExecutor threadPool = (ThreadPoolExecutor) executorService;
- for (LifecycleStrategy lifecycle : camelContext.getLifecycleStrategies()) {
- lifecycle.onThreadPoolRemove(camelContext, threadPool);
- }
- }
+ LOG.debug("Shutdown ExecutorService: {}", executorService);
+ executorService.shutdown();
+ LOG.trace("Shutdown ExecutorService: {} complete.", executorService);
// remove reference as its shutdown
executorServices.remove(executorService);
@@ -270,19 +265,13 @@
private List<Runnable> doShutdownNow(ExecutorService executorService, boolean remove) {
ObjectHelper.notNull(executorService, "executorService");
- List<Runnable> answer = null;
- if (!executorService.isShutdown()) {
- LOG.debug("ShutdownNow ExecutorService: {}", executorService);
- answer = executorService.shutdownNow();
- LOG.trace("ShutdownNow ExecutorService: {} complete.", executorService);
+ if (executorService.isShutdown()) {
+ return null;
}
- if (executorService instanceof ThreadPoolExecutor) {
- ThreadPoolExecutor threadPool = (ThreadPoolExecutor) executorService;
- for (LifecycleStrategy lifecycle : camelContext.getLifecycleStrategies()) {
- lifecycle.onThreadPoolRemove(camelContext, threadPool);
- }
- }
+ LOG.debug("ShutdownNow ExecutorService: {}", executorService);
+ List<Runnable> answer = executorService.shutdownNow();
+ LOG.trace("ShutdownNow ExecutorService: {} complete.", executorService);
// remove reference as its shutdown
if (remove) {
@@ -305,7 +294,7 @@
protected void doStart() throws Exception {
if (threadNamePattern == null) {
// set default name pattern which includes the camel context name
- threadNamePattern = "Camel (" + camelContext.getName() + ") thread ##counter# - #name#";
+ threadNamePattern = "Camel (" + camelContext.getName() + ") thread #${counter} - ${name}";
}
}
@@ -359,7 +348,7 @@
// extract id from source
if (source instanceof NamedNode) {
- id = ((OptionalIdentifiedDefinition<?>) source).idOrCreate(this.camelContext.getNodeIdFactory());
+ id = ((OptionalIdentifiedDefinition) source).idOrCreate(this.camelContext.getNodeIdFactory());
// and let source be the short name of the pattern
sourceId = ((NamedNode) source).getShortName();
} else if (source instanceof String) {
@@ -377,7 +366,7 @@
// extract route id if possible
if (source instanceof ProcessorDefinition) {
- RouteDefinition route = ProcessorDefinitionHelper.getRoute((ProcessorDefinition<?>) source);
+ RouteDefinition route = ProcessorDefinitionHelper.getRoute((ProcessorDefinition) source);
if (route != null) {
routeId = route.idOrCreate(this.camelContext.getNodeIdFactory());
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
index fda322e..cef9447 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultInflightRepository.java
@@ -87,7 +87,7 @@
if (count > 0) {
LOG.warn("Shutting down while there are still " + count + " in flight exchanges.");
} else {
- LOG.debug("Shutting down with no inflight exchanges.");
+ LOG.info("Shutting down with no inflight exchanges.");
}
endpointCount.clear();
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
index 00ea132..3f5fd37 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultLanguageResolver.java
@@ -40,6 +40,7 @@
protected FactoryFinder languageFactory;
protected FactoryFinder languageResolver;
+ @SuppressWarnings("unchecked")
public Language resolveLanguage(String name, CamelContext context) {
// lookup in registry first
Object bean = null;
@@ -60,7 +61,7 @@
// we do not throw the exception here and try to auto create a Language from META-INF
}
- Class<?> type = null;
+ Class type = null;
try {
type = findLanguage(name, context);
} catch (NoFactoryAvailableException e) {
@@ -81,8 +82,9 @@
}
}
+ @SuppressWarnings("unchecked")
protected Language noSpecificLanguageFound(String name, CamelContext context) {
- Class<?> type = null;
+ Class type = null;
try {
type = findLanguageResolver("default", context);
} catch (NoFactoryAvailableException e) {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementNameStrategy.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementNameStrategy.java
deleted file mode 100644
index 7455c3e..0000000
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultManagementNameStrategy.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.impl;
-
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spi.ManagementNameStrategy;
-import org.apache.camel.util.ObjectHelper;
-
-/**
- * Default implementation of {@link ManagementNameStrategy}
- * <p/>
- * This implementation will by default use a name pattern as <tt>#name#</tt> and in case
- * of a clash, then the pattern will fallback to be using the counter as <tt>#name#-#counter#</tt>.
- */
-public class DefaultManagementNameStrategy implements ManagementNameStrategy {
-
- private static final Pattern INVALID_PATTERN = Pattern.compile(".*#\\w+#.*");
- private static final AtomicLong NAME_COUNTER = new AtomicLong();
-
- private final CamelContext camelContext;
- private final String defaultPattern;
- private final String nextPattern;
- private String name;
- private String namePattern;
-
- public DefaultManagementNameStrategy(CamelContext camelContext) {
- this(camelContext, "#name#", "#name#-#counter#");
- }
-
- public DefaultManagementNameStrategy(CamelContext camelContext, String defaultPattern, String nextPattern) {
- this.camelContext = camelContext;
- this.defaultPattern = defaultPattern;
- this.nextPattern = nextPattern;
- }
-
- @Override
- public String getNamePattern() {
- return namePattern;
- }
-
- @Override
- public void setNamePattern(String namePattern) {
- this.namePattern = namePattern;
- }
-
- @Override
- public String getName() {
- if (name == null) {
- String pattern = getNamePattern();
- if (pattern == null) {
- // fallback and use the default pattern which is the same name as the CamelContext has been given
- pattern = defaultPattern;
- }
- name = resolveManagementName(pattern, camelContext.getName());
- }
- return name;
- }
-
- @Override
- public String getNextName() {
- if (isFixedName()) {
- // use the fixed name
- return getName();
- } else {
- // or resolve a new name
- String pattern = getNamePattern();
- if (pattern == null) {
- // use a pattern that has a counter to ensure unique next name
- pattern = nextPattern;
- }
- return resolveManagementName(pattern, camelContext.getName());
- }
- }
-
- @Override
- public boolean isFixedName() {
- // the name will be fixed unless there is a counter token
- String pattern = getNamePattern();
- if (pattern == null) {
- // we are not fixed by default
- return false;
- }
- return !pattern.contains("#counter#");
- }
-
- /**
- * Creates a new management name with the given pattern
- *
- * @param pattern the pattern
- * @param name the name
- * @return the management name
- * @throws IllegalArgumentException if the pattern or name is invalid or empty
- */
- protected String resolveManagementName(String pattern, String name) {
- ObjectHelper.notEmpty(pattern, "pattern");
- ObjectHelper.notEmpty(name, "name");
-
- // must quote the names to have it work as literal replacement
- name = Matcher.quoteReplacement(name);
-
- // replace tokens
- String answer = pattern;
- if (pattern.contains("#counter#")) {
- // only increment the counter on-demand
- answer = pattern.replaceFirst("#counter#", "" + nextNameCounter());
- }
- // camelId and name is the same tokens
- answer = answer.replaceFirst("#camelId#", name);
- answer = answer.replaceFirst("#name#", name);
-
- // allow custom name resolution as well. For example with camel-core-osgi we have a custom
- // name strategy that supports OSGI specific tokens such as #bundleId# etc.
- answer = customResolveManagementName(pattern, answer);
-
- // are there any #word# combos left, if so they should be considered invalid tokens
- if (INVALID_PATTERN.matcher(answer).matches()) {
- throw new IllegalArgumentException("Pattern is invalid: " + pattern);
- }
-
- return answer;
- }
-
- /**
- * Strategy to do any custom resolution of the name
- *
- * @param pattern the pattern
- * @param answer the current answer, which may have custom patterns still to be resolved
- * @return the resolved name
- */
- protected String customResolveManagementName(String pattern, String answer) {
- return answer;
- }
-
- private static long nextNameCounter() {
- // we want to be 1-based, so increment first
- return NAME_COUNTER.incrementAndGet();
- }
-
- /**
- * To reset the counter, should only be used for testing purposes.
- *
- * @param value the counter value
- */
- public static void setCounter(int value) {
- NAME_COUNTER.set(value);
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
index 485ea17..5951022 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
@@ -122,9 +122,10 @@
this.classLoaders.addAll(classLoaders);
}
+ @SuppressWarnings("unchecked")
public Set<Class<?>> findAnnotated(Class<? extends Annotation> annotation, String... packageNames) {
if (packageNames == null) {
- return Collections.emptySet();
+ return Collections.EMPTY_SET;
}
if (log.isDebugEnabled()) {
@@ -142,9 +143,10 @@
return classes;
}
+ @SuppressWarnings("unchecked")
public Set<Class<?>> findAnnotated(Set<Class<? extends Annotation>> annotations, String... packageNames) {
if (packageNames == null) {
- return Collections.emptySet();
+ return Collections.EMPTY_SET;
}
if (log.isDebugEnabled()) {
@@ -162,9 +164,10 @@
return classes;
}
- public Set<Class<?>> findImplementations(Class<?> parent, String... packageNames) {
+ @SuppressWarnings("unchecked")
+ public Set<Class<?>> findImplementations(Class parent, String... packageNames) {
if (packageNames == null) {
- return Collections.emptySet();
+ return Collections.EMPTY_SET;
}
if (log.isDebugEnabled()) {
@@ -182,9 +185,10 @@
return classes;
}
+ @SuppressWarnings("unchecked")
public Set<Class<?>> findByFilter(PackageScanFilter filter, String... packageNames) {
if (packageNames == null) {
- return Collections.emptySet();
+ return Collections.EMPTY_SET;
}
Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteStartupOrder.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteStartupOrder.java
index 4eb0e54..084fec3 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteStartupOrder.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteStartupOrder.java
@@ -17,13 +17,11 @@
package org.apache.camel.impl;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.camel.Consumer;
import org.apache.camel.Route;
-import org.apache.camel.Service;
import org.apache.camel.spi.RouteStartupOrder;
/**
@@ -60,15 +58,6 @@
return answer;
}
- public List<Service> getServices() {
- List<Service> answer = new ArrayList<Service>();
- Collection<Route> routes = routeService.getRoutes();
- for (Route route : routes) {
- answer.addAll(route.getServices());
- }
- return answer;
- }
-
public RouteService getRouteService() {
return routeService;
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
index 8ad7520..250d454 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
@@ -19,9 +19,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
@@ -38,7 +36,6 @@
import org.apache.camel.SuspendableService;
import org.apache.camel.spi.RouteStartupOrder;
import org.apache.camel.spi.ShutdownAware;
-import org.apache.camel.spi.ShutdownPrepared;
import org.apache.camel.spi.ShutdownStrategy;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.EventHelper;
@@ -54,23 +51,6 @@
* Graceful shutdown ensures that any inflight and pending messages will be taken into account
* and it will wait until these exchanges has been completed.
* <p/>
- * This strategy will perform graceful shutdown in two steps:
- * <ul>
- * <li>Graceful - By suspending/stopping consumers, and let any in-flight exchanges complete</li>
- * <li>Forced - After a given period of time, a timeout occurred and if there are still pending
- * exchanges to complete, then a more aggressive forced strategy is performed.</li>
- * </ul>
- * The idea by the <tt>graceful</tt> shutdown strategy, is to stop taking in more new messages,
- * and allow any existing inflight messages to complete. Then when there is no more inflight messages
- * then the routes can be fully shutdown. This mean that if there is inflight messages then we will have
- * to wait for these messages to complete. If they do not complete after a period of time, then a
- * timeout triggers. And then a more aggressive strategy takes over.
- * <p/>
- * The idea by the <tt>forced</tt> shutdown strategy, is to stop continue processing messages.
- * And force routes and its services to shutdown now. There is a risk when shutting down now,
- * that some resources is not properly shutdown, which can cause side effects. The timeout value
- * is by default 300 seconds, but can be customized.
- * <p/>
* As this strategy will politely wait until all exchanges has been completed it can potential wait
* for a long time, and hence why a timeout value can be set. When the timeout triggers you can also
* specify whether the remainder consumers should be shutdown now or ignore.
@@ -82,15 +62,6 @@
* <p/>
* Routes will by default be shutdown in the reverse order of which they where started.
* You can customize this using the {@link #setShutdownRoutesInReverseOrder(boolean)} method.
- * <p/>
- * After route consumers have been shutdown, then any {@link ShutdownPrepared} services on the routes
- * is being prepared for shutdown, by invoking {@link ShutdownPrepared#prepareShutdown(boolean)} which
- * <tt>force=false</tt>.
- * <p/>
- * Then if a timeout occurred and the strategy has been configured with shutdown-now on timeout, then
- * the strategy performs a more aggressive forced shutdown, by forcing all consumers to shutdown
- * and then invokes {@link ShutdownPrepared#prepareShutdown(boolean)} with <tt>force=true</tt>
- * on the services. This allows the services to know they should force shutdown now.
*
* @version
*/
@@ -142,11 +113,6 @@
protected boolean doShutdown(CamelContext context, List<RouteStartupOrder> routes, long timeout, TimeUnit timeUnit,
boolean suspendOnly, boolean abortAfterTimeout, boolean forceShutdown) throws Exception {
- // just return if no routes to shutdown
- if (routes.isEmpty()) {
- return true;
- }
-
StopWatch watch = new StopWatch();
// at first sort according to route startup order
@@ -167,7 +133,7 @@
}
// use another thread to perform the shutdowns so we can support timeout
- Future<?> future = getExecutorService().submit(new ShutdownTask(context, routesOrdered, timeout, timeUnit, suspendOnly, abortAfterTimeout));
+ Future future = getExecutorService().submit(new ShutdownTask(context, routesOrdered, timeout, timeUnit, suspendOnly, abortAfterTimeout));
try {
if (timeout > 0) {
future.get(timeout, timeUnit);
@@ -190,13 +156,6 @@
LOG.warn("Timeout occurred. Now forcing the routes to be shutdown now.");
// force the routes to shutdown now
shutdownRoutesNow(routesOrdered);
-
- // now the route consumers has been shutdown, then prepare route services for shutdown now (forced)
- for (RouteStartupOrder order : routes) {
- for (Service service : order.getServices()) {
- prepareShutdown(service, true, true);
- }
- }
} else {
LOG.warn("Timeout occurred. Will ignore shutting down the remainder routes.");
}
@@ -360,38 +319,6 @@
}
}
- /**
- * Prepares the services for shutdown, by invoking the {@link ShutdownPrepared#prepareShutdown(boolean)} method
- * on the service if it implement this interface.
- *
- * @param service the service
- * @param forced whether to force shutdown
- * @param includeChildren whether to prepare the child of the service as well
- */
- private static void prepareShutdown(Service service, boolean forced, boolean includeChildren) {
- Set<Service> list;
- if (includeChildren) {
- list = ServiceHelper.getChildServices(service);
- } else {
- list = new LinkedHashSet<Service>(1);
- list.add(service);
- }
-
- for (Service child : list) {
- if (child instanceof ShutdownPrepared) {
- try {
- LOG.trace("Preparing {} shutdown on {}", forced ? "forced" : "", child);
- ((ShutdownPrepared) child).prepareShutdown(forced);
- } catch (Exception e) {
- LOG.warn("Error during prepare shutdown on " + child + ". This exception will be ignored.", e);
- }
- }
- }
- }
-
- /**
- * Holder for deferred consumers
- */
static class ShutdownDeferredConsumer {
private final Route route;
private final Consumer consumer;
@@ -445,6 +372,7 @@
// list of deferred consumers to shutdown when all exchanges has been completed routed
// and thus there are no more inflight exchanges so they can be safely shutdown at that time
List<ShutdownDeferredConsumer> deferredConsumers = new ArrayList<ShutdownDeferredConsumer>();
+
for (RouteStartupOrder order : routes) {
ShutdownRoute shutdownRoute = order.getRoute().getRouteContext().getShutdownRoute();
@@ -541,8 +469,7 @@
Consumer consumer = deferred.getConsumer();
if (consumer instanceof ShutdownAware) {
LOG.trace("Route: {} preparing to shutdown.", deferred.getRoute().getId());
- boolean forced = context.getShutdownStrategy().forceShutdown(consumer);
- prepareShutdown(consumer, forced, false);
+ ((ShutdownAware) consumer).prepareShutdown();
LOG.debug("Route: {} preparing to shutdown complete.", deferred.getRoute().getId());
}
}
@@ -558,14 +485,6 @@
LOG.info("Route: {} shutdown complete, was consuming from: {}", deferred.getRoute().getId(), deferred.getConsumer().getEndpoint());
}
}
-
- // now the route consumers has been shutdown, then prepare route services for shutdown
- for (RouteStartupOrder order : routes) {
- for (Service service : order.getServices()) {
- boolean forced = context.getShutdownStrategy().forceShutdown(service);
- prepareShutdown(service, forced, true);
- }
- }
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultThreadPoolFactory.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultThreadPoolFactory.java
index 63498f0..5cd2898 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultThreadPoolFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultThreadPoolFactory.java
@@ -30,8 +30,6 @@
import org.apache.camel.spi.ThreadPoolFactory;
import org.apache.camel.spi.ThreadPoolProfile;
-import org.apache.camel.util.concurrent.RejectableScheduledThreadPoolExecutor;
-import org.apache.camel.util.concurrent.RejectableThreadPoolExecutor;
import org.apache.camel.util.concurrent.SizedScheduledExecutorService;
/**
@@ -84,7 +82,7 @@
workQueue = new LinkedBlockingQueue<Runnable>(maxQueueSize);
}
- ThreadPoolExecutor answer = new RejectableThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, timeUnit, workQueue);
+ ThreadPoolExecutor answer = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, timeUnit, workQueue);
answer.setThreadFactory(threadFactory);
if (rejectedExecutionHandler == null) {
rejectedExecutionHandler = new ThreadPoolExecutor.CallerRunsPolicy();
@@ -100,7 +98,7 @@
rejectedExecutionHandler = new ThreadPoolExecutor.CallerRunsPolicy();
}
- ScheduledThreadPoolExecutor answer = new RejectableScheduledThreadPoolExecutor(profile.getPoolSize(), threadFactory, rejectedExecutionHandler);
+ ScheduledThreadPoolExecutor answer = new ScheduledThreadPoolExecutor(profile.getPoolSize(), threadFactory, rejectedExecutionHandler);
// TODO: when JDK7 we should setRemoveOnCancelPolicy(true)
// need to wrap the thread pool in a sized to guard against the problem that the
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
index f9b6c5b..a3a2eae 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
@@ -86,7 +86,7 @@
if (exchange.getIn().getClass().getSimpleName().equals("JmsMessage")) {
this.originalInMessage = new DefaultMessage();
this.originalInMessage.setBody(exchange.getIn().getBody());
- this.originalInMessage.setHeaders(exchange.getIn().getHeaders());
+ // cannot copy headers with a JmsMessage as the underlying javax.jms.Message object goes nuts
} else {
this.originalInMessage = exchange.getIn().copy();
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java b/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
index 7c93bd8..38d6fe3 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
@@ -81,7 +81,7 @@
}
if (answer instanceof Navigate) {
- return (Navigate<Processor>) answer;
+ return (Navigate) answer;
}
return null;
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ExplicitCamelContextNameStrategy.java b/camel-core/src/main/java/org/apache/camel/impl/ExplicitCamelContextNameStrategy.java
index 2a54df6..d0e4c2b 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ExplicitCamelContextNameStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ExplicitCamelContextNameStrategy.java
@@ -33,18 +33,7 @@
this.name = name;
}
- @Override
public String getName() {
return name;
}
-
- @Override
- public String getNextName() {
- return name;
- }
-
- @Override
- public boolean isFixedName() {
- return true;
- }
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java b/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
index c298246..9ab9fa7 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/GzipDataFormat.java
@@ -36,7 +36,8 @@
try {
IOHelper.copy(is, zipOutput);
} finally {
- IOHelper.close(is, zipOutput);
+ IOHelper.close(is);
+ IOHelper.close(zipOutput);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
index 811c1b4..15704d3 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToEndpoint.java
@@ -73,7 +73,6 @@
public EndpointConfiguration getEndpointConfiguration() {
return delegate.getEndpointConfiguration();
}
-
public String getEndpointKey() {
return delegate.getEndpointKey();
}
@@ -134,16 +133,7 @@
return;
}
- // determine if we should skip or not
- boolean shouldSkip = skip;
-
- // if then interceptor had a when predicate, then we should only skip if it matched
- Boolean whenMatches = (Boolean) exchange.removeProperty(Exchange.INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED);
- if (whenMatches != null) {
- shouldSkip = skip && whenMatches;
- }
-
- if (!shouldSkip) {
+ if (!skip) {
if (exchange.hasOut()) {
// replace OUT with IN as detour changed something
exchange.setIn(exchange.getOut());
diff --git a/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
index d9b2434..f49860f 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/JndiRegistry.java
@@ -70,9 +70,10 @@
}
}
+ @SuppressWarnings("unchecked")
public <T> Map<String, T> lookupByType(Class<T> type) {
// not implemented so we return an empty map
- return Collections.emptyMap();
+ return Collections.EMPTY_MAP;
}
public void bind(String s, Object o) {
@@ -98,8 +99,9 @@
this.context = context;
}
+ @SuppressWarnings("unchecked")
protected Context createContext() throws NamingException {
- Hashtable<?, ?> properties = new Hashtable<Object, Object>(System.getProperties());
+ Hashtable properties = new Hashtable(System.getProperties());
return new InitialContext(properties);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/RouteService.java b/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
index 13032fc..7e194a0 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/RouteService.java
@@ -27,6 +27,7 @@
import org.apache.camel.CamelContext;
import org.apache.camel.Consumer;
+import org.apache.camel.Navigate;
import org.apache.camel.Processor;
import org.apache.camel.Route;
import org.apache.camel.Service;
@@ -34,6 +35,7 @@
import org.apache.camel.model.OnExceptionDefinition;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.processor.OnCompletionProcessor;
import org.apache.camel.spi.LifecycleStrategy;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.spi.RoutePolicy;
@@ -133,7 +135,7 @@
// gather list of services to start as we need to start child services as well
Set<Service> list = new LinkedHashSet<Service>();
for (Service service : services) {
- list.addAll(ServiceHelper.getChildServices(service));
+ doGetChildServices(list, service);
}
// split into consumers and child services as we need to start the consumers
@@ -201,7 +203,7 @@
// gather list of services to stop as we need to start child services as well
Set<Service> list = new LinkedHashSet<Service>();
for (Service service : services) {
- list.addAll(ServiceHelper.getChildServices(service));
+ doGetChildServices(list, service);
}
stopChildService(route, list, isShutdownCamelContext);
@@ -239,7 +241,7 @@
// gather list of services to stop as we need to start child services as well
Set<Service> list = new LinkedHashSet<Service>();
for (Service service : services) {
- list.addAll(ServiceHelper.getChildServices(service));
+ doGetChildServices(list, service);
}
// shutdown services
@@ -329,7 +331,7 @@
* Gather all route scoped services from the given route, such as route scoped error handler.
*/
private void doGetRouteScopedServices(List<Service> services, Route route) {
- for (ProcessorDefinition<?> output : route.getRouteContext().getRoute().getOutputs()) {
+ for (ProcessorDefinition output : route.getRouteContext().getRoute().getOutputs()) {
if (output instanceof OnExceptionDefinition) {
OnExceptionDefinition onExceptionDefinition = (OnExceptionDefinition) output;
if (onExceptionDefinition.isRouteScoped()) {
@@ -350,4 +352,23 @@
}
}
+ /**
+ * Gather all child services by navigating the service to recursively gather all child services.
+ */
+ private static void doGetChildServices(Set<Service> services, Service service) throws Exception {
+ services.add(service);
+
+ if (service instanceof Navigate) {
+ Navigate<?> nav = (Navigate<?>) service;
+ if (nav.hasNext()) {
+ List<?> children = nav.next();
+ for (Object child : children) {
+ if (child instanceof Service) {
+ doGetChildServices(services, (Service) child);
+ }
+ }
+ }
+ }
+ }
+
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java
deleted file mode 100644
index 5ff6208..0000000
--- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledBatchPollingConsumer.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.impl;
-
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.apache.camel.BatchConsumer;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.ShutdownRunningTask;
-import org.apache.camel.spi.ShutdownAware;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A useful base class for any consumer which is polling batch based
- */
-public abstract class ScheduledBatchPollingConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
- private static final transient Logger LOG = LoggerFactory.getLogger(ScheduledBatchPollingConsumer.class);
- protected volatile ShutdownRunningTask shutdownRunningTask;
- protected volatile int pendingExchanges;
- protected int maxMessagesPerPoll;
-
- public ScheduledBatchPollingConsumer(Endpoint endpoint, Processor processor) {
- super(endpoint, processor);
- }
-
- public ScheduledBatchPollingConsumer(Endpoint endpoint, Processor processor, ScheduledExecutorService executor) {
- super(endpoint, processor, executor);
- }
-
- @Override
- public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
- // store a reference what to do in case when shutting down and we have pending messages
- this.shutdownRunningTask = shutdownRunningTask;
- // do not defer shutdown
- return false;
- }
-
- @Override
- public int getPendingExchangesSize() {
- int answer;
- // only return the real pending size in case we are configured to complete all tasks
- if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
- answer = pendingExchanges;
- } else {
- answer = 0;
- }
-
- if (answer == 0 && isPolling()) {
- // force at least one pending exchange if we are polling as there is a little gap
- // in the processBatch method and until an exchange gets enlisted as in-flight
- // which happens later, so we need to signal back to the shutdown strategy that
- // there is a pending exchange. When we are no longer polling, then we will return 0
- LOG.trace("Currently polling so returning 1 as pending exchanges");
- answer = 1;
- }
-
- return answer;
- }
-
- @Override
- public void prepareShutdown(boolean forced) {
- // reset task as the state of the task is not to be preserved
- // which otherwise may cause isBatchAllowed() to return a wrong answer
- this.shutdownRunningTask = null;
- }
-
- @Override
- public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
- this.maxMessagesPerPoll = maxMessagesPerPoll;
- }
-
- /**
- * Gets the maximum number of messages as a limit to poll at each polling.
- * <p/>
- * Is default unlimited, but use 0 or negative number to disable it as unlimited.
- *
- * @return max messages to poll
- */
- public int getMaxMessagesPerPoll() {
- return maxMessagesPerPoll;
- }
-
- @Override
- public boolean isBatchAllowed() {
- // stop if we are not running
- boolean answer = isRunAllowed();
- if (!answer) {
- return false;
- }
-
- if (shutdownRunningTask == null) {
- // we are not shutting down so continue to run
- return true;
- }
-
- // we are shutting down so only continue if we are configured to complete all tasks
- return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
- }
-}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ZipDataFormat.java b/camel-core/src/main/java/org/apache/camel/impl/ZipDataFormat.java
index f56220d..9808947 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ZipDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ZipDataFormat.java
@@ -41,14 +41,14 @@
}
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
- // ask for a mandatory type conversion to avoid a possible NPE beforehand as we do copy from the InputStream
- InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, graph);
+ InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, graph);
DeflaterOutputStream zipOutput = new DeflaterOutputStream(stream, new Deflater(compressionLevel));
try {
IOHelper.copy(is, zipOutput);
} finally {
- IOHelper.close(is, zipOutput);
+ IOHelper.close(is);
+ IOHelper.close(zipOutput);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/AnnotationTypeConverterLoader.java b/camel-core/src/main/java/org/apache/camel/impl/converter/AnnotationTypeConverterLoader.java
index 52b6796..f8dc3c8 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/AnnotationTypeConverterLoader.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/AnnotationTypeConverterLoader.java
@@ -106,7 +106,7 @@
Set<Class<?>> classes = new HashSet<Class<?>>();
packageNames = filterPackageNamesOnly(resolver, packageNames, classes);
if (!classes.isEmpty()) {
- LOG.debug("Loaded " + classes.size() + " @Converter classes");
+ LOG.info("Loaded " + classes.size() + " @Converter classes");
}
// if there is any packages to scan and load @Converter classes, then do it
@@ -116,7 +116,7 @@
if (scannedClasses.isEmpty()) {
throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
}
- LOG.debug("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
+ LOG.info("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
classes.addAll(scannedClasses);
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java b/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
index 8745580..9947321 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
@@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import org.apache.camel.CamelExecutionException;
@@ -40,7 +39,8 @@
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
-
+import org.apache.camel.util.StopWatch;
+import org.apache.camel.util.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,8 +52,8 @@
*/
public abstract class BaseTypeConverterRegistry extends ServiceSupport implements TypeConverter, TypeConverterRegistry {
protected final transient Logger log = LoggerFactory.getLogger(getClass());
- protected final ConcurrentMap<TypeMapping, TypeConverter> typeMappings = new ConcurrentHashMap<TypeMapping, TypeConverter>();
- protected final ConcurrentMap<TypeMapping, TypeMapping> misses = new ConcurrentHashMap<TypeMapping, TypeMapping>();
+ protected final ConcurrentHashMap<TypeMapping, TypeConverter> typeMappings = new ConcurrentHashMap<TypeMapping, TypeConverter>();
+ protected final Map<TypeMapping, TypeMapping> misses = new ConcurrentHashMap<TypeMapping, TypeMapping>();
protected final List<TypeConverterLoader> typeConverterLoaders = new ArrayList<TypeConverterLoader>();
protected final List<FallbackTypeConverter> fallbackConverters = new ArrayList<FallbackTypeConverter>();
protected final PackageScanClassResolver resolver;
@@ -395,15 +395,24 @@
* Loads the core type converters which is mandatory to use Camel
*/
public void loadCoreTypeConverters() throws Exception {
+ int before = typeMappings.size();
+
// load all the type converters from camel-core
CoreTypeConverterLoader core = new CoreTypeConverterLoader();
core.load(this);
+
+ int delta = typeMappings.size() - before;
+ log.info("Loaded {} core type converters (total {} type converters)" , delta, typeMappings.size());
}
/**
* Checks if the registry is loaded and if not lazily load it
*/
protected void loadTypeConverters() throws Exception {
+ StopWatch watch = new StopWatch();
+ int before = typeMappings.size();
+
+ log.debug("Loading additional type converters ...");
for (TypeConverterLoader typeConverterLoader : getTypeConverterLoaders()) {
typeConverterLoader.load(this);
}
@@ -414,6 +423,14 @@
} catch (NoFactoryAvailableException e) {
// ignore its fine to have none
}
+ log.debug("Loading additional type converters done");
+
+ // report how long time it took to load
+ int delta = typeMappings.size() - before;
+ if (log.isInfoEnabled()) {
+ log.info("Loaded additional " + delta + " type converters (total " + typeMappings.size()
+ + " type converters) in " + TimeUtils.printDuration(watch.stop()));
+ }
}
protected void loadFallbackTypeConverters() throws IOException, ClassNotFoundException {
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterLoader.java b/camel-core/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterLoader.java
index 06b7353..1555530 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterLoader.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterLoader.java
@@ -32,7 +32,6 @@
@Override
protected String[] findPackageNames() throws IOException {
- // this method doesn't change the behavior of the CorePackageScanClassResolver
return new String[]{"org.apache.camel.converter", "org.apache.camel.component.bean", "org.apache.camel.component.file"};
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java b/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
index 4a013f2..325a2be 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
@@ -40,9 +40,6 @@
// load type converters up front
loadCoreTypeConverters();
loadTypeConverters();
-
- // report how many type converters we have loaded
- log.info("Loaded {} type converters", typeMappings.size());
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/converter/LazyLoadingTypeConverter.java b/camel-core/src/main/java/org/apache/camel/impl/converter/LazyLoadingTypeConverter.java
index dbce726..55ad0b6 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/converter/LazyLoadingTypeConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/converter/LazyLoadingTypeConverter.java
@@ -33,10 +33,8 @@
* <p/>
* This implementation will lazy load type converters on-demand.
*
- * @version
- * @deprecated will be removed in a future Camel release.
+ * @version
*/
-@Deprecated
public class LazyLoadingTypeConverter extends BaseTypeConverterRegistry {
private final AtomicBoolean loaded = new AtomicBoolean();
diff --git a/camel-core/src/main/java/org/apache/camel/impl/osgi/tracker/AbstractTracked.java b/camel-core/src/main/java/org/apache/camel/impl/osgi/tracker/AbstractTracked.java
index 3f1b96c..435d0c4 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/osgi/tracker/AbstractTracked.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/osgi/tracker/AbstractTracked.java
@@ -66,7 +66,7 @@
*
* @GuardedBy this
*/
- private final Map<Object, Object> tracked;
+ private final Map tracked;
/**
* Modification count. This field is initialized to zero and incremented by
@@ -88,7 +88,7 @@
*
* @GuardedBy this
*/
- private final List<Object> adding;
+ private final List adding;
/**
* Initial list of items for the tracker. This is used to correctly process
@@ -104,16 +104,16 @@
*
* @GuardedBy this
*/
- private final LinkedList<Object> initial;
+ private final LinkedList initial;
/**
* AbstractTracked constructor.
*/
AbstractTracked() {
- tracked = new HashMap<Object, Object>();
+ tracked = new HashMap();
trackingCount = 0;
- adding = new ArrayList<Object>(6);
- initial = new LinkedList<Object>();
+ adding = new ArrayList(6);
+ initial = new LinkedList();
closed = false;
}
@@ -127,6 +127,7 @@
* entries in the list are ignored.
* @GuardedBy this
*/
+ @SuppressWarnings("unchecked")
void setInitial(Object[] list) {
if (list == null) {
return;
@@ -149,6 +150,7 @@
* be received. This method must be called from Tracker's open method while
* not synchronized on this object after the add listener call.
*/
+ @SuppressWarnings("unchecked")
void trackInitial() {
while (true) {
Object item;
@@ -206,6 +208,7 @@
* @param item Item to be tracked.
* @param related Action related object.
*/
+ @SuppressWarnings("unchecked")
void track(final Object item, final Object related) {
final Object object;
synchronized (this) {
@@ -250,6 +253,7 @@
* @param item Item to be tracked.
* @param related Action related object.
*/
+ @SuppressWarnings("unchecked")
private void trackAdding(final Object item, final Object related) {
if (DEBUG) {
System.out.println("AbstractTracked.trackAdding: " + item);
@@ -379,6 +383,7 @@
* items or a new array large enough to hold the tracked items.
* @GuardedBy this
*/
+ @SuppressWarnings("unchecked")
Object[] getTracked(final Object[] list) {
return tracked.keySet().toArray(list);
}
diff --git a/camel-core/src/main/java/org/apache/camel/impl/scan/InvertingPackageScanFilter.java b/camel-core/src/main/java/org/apache/camel/impl/scan/InvertingPackageScanFilter.java
index 7bbb3fb..0f7cd63 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/scan/InvertingPackageScanFilter.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/scan/InvertingPackageScanFilter.java
@@ -32,7 +32,7 @@
this.filter = filter;
}
- public boolean matches(Class<?> type) {
+ public boolean matches(Class type) {
return !filter.matches(type);
}
diff --git a/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java b/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
index db7302c..f79e041 100644
--- a/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
@@ -278,7 +278,7 @@
key = StringHelper.removeLeadingAndEndingQuotes(key);
// try map first
- Map<?, ?> map = exchange.getContext().getTypeConverter().convertTo(Map.class, result);
+ Map map = exchange.getContext().getTypeConverter().convertTo(Map.class, result);
if (map != null) {
return map.get(key);
}
@@ -288,7 +288,7 @@
boolean checkList = key.startsWith("last") || num != null;
if (checkList) {
- List<?> list = exchange.getContext().getTypeConverter().convertTo(List.class, result);
+ List list = exchange.getContext().getTypeConverter().convertTo(List.class, result);
if (list != null) {
if (key.startsWith("last")) {
num = list.size() - 1;
diff --git a/camel-core/src/main/java/org/apache/camel/language/bean/BeanLanguage.java b/camel-core/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
index 9b0215b..1906dcc 100644
--- a/camel-core/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
+++ b/camel-core/src/main/java/org/apache/camel/language/bean/BeanLanguage.java
@@ -58,7 +58,8 @@
* @param method optional name of method to invoke for instance to avoid ambiguity
* @return the expression
*/
- public static Expression bean(Class<?> beanType, String method) {
+ @SuppressWarnings("unchecked")
+ public static Expression bean(Class beanType, String method) {
Object bean = ObjectHelper.newInstance(beanType);
return bean(bean, method);
}
diff --git a/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java b/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
index b230a16..74af489 100644
--- a/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
@@ -275,8 +275,6 @@
return ExpressionBuilder.exchangeExceptionStackTraceExpression();
} else if (ObjectHelper.equal(expression, "threadName")) {
return ExpressionBuilder.threadNameExpression();
- } else if (ObjectHelper.equal(expression, "camelId")) {
- return ExpressionBuilder.camelContextNameExpression();
}
return null;
diff --git a/camel-core/src/main/java/org/apache/camel/main/MainSupport.java b/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
index ca66c1a..ed38abe 100644
--- a/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
@@ -406,7 +406,7 @@
}
RouteDotGenerator generator = new RouteDotGenerator(outputDir);
LOG.info("Generating DOT file for routes: " + outputDir + " for: " + camelContext + " with name: " + name);
- generator.drawRoutes(camelContext);
+ generator.drawRoutes((ModelCamelContext)camelContext);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
index 5d60d7c..a8e22ab 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
@@ -372,7 +372,7 @@
}
// look for the first mbean server that has match default domain name
- List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
+ List<MBeanServer> servers = (List<MBeanServer>)MBeanServerFactory.findMBeanServer(null);
for (MBeanServer server : servers) {
LOG.debug("Found MBeanServer with default domain {}", server.getDefaultDomain());
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
index f580255..5f94947 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
@@ -46,9 +46,10 @@
import org.apache.camel.VetoCamelContextStartException;
import org.apache.camel.api.management.PerformanceCounter;
import org.apache.camel.impl.ConsumerCache;
-import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.DefaultCamelContextNameStrategy;
import org.apache.camel.impl.EndpointRegistry;
import org.apache.camel.impl.EventDrivenConsumerRoute;
+import org.apache.camel.impl.ExplicitCamelContextNameStrategy;
import org.apache.camel.impl.ProducerCache;
import org.apache.camel.impl.ThrottlingInflightRoutePolicy;
import org.apache.camel.management.mbean.ManagedConsumerCache;
@@ -67,11 +68,11 @@
import org.apache.camel.model.ProcessorDefinitionHelper;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.processor.interceptor.Tracer;
+import org.apache.camel.spi.CamelContextNameStrategy;
import org.apache.camel.spi.EventNotifier;
import org.apache.camel.spi.LifecycleStrategy;
import org.apache.camel.spi.ManagementAgent;
import org.apache.camel.spi.ManagementAware;
-import org.apache.camel.spi.ManagementNameStrategy;
import org.apache.camel.spi.ManagementObjectStrategy;
import org.apache.camel.spi.ManagementStrategy;
import org.apache.camel.spi.RouteContext;
@@ -97,15 +98,14 @@
private static final Logger LOG = LoggerFactory.getLogger(DefaultManagementLifecycleStrategy.class);
// the wrapped processors is for performance counters, which are in use for the created routes
// when a route is removed, we should remove the associated processors from this map
- private final Map<Processor, KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>> wrappedProcessors =
- new HashMap<Processor, KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>>();
+ private final Map<Processor, KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>> wrappedProcessors =
+ new HashMap<Processor, KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>>();
private final List<PreRegisterService> preServices = new ArrayList<PreRegisterService>();
private final TimerListenerManager timerListenerManager = new TimerListenerManager();
private CamelContext camelContext;
private volatile boolean initialized;
private final Set<String> knowRouteIds = new HashSet<String>();
private final Map<Tracer, ManagedTracer> managedTracers = new HashMap<Tracer, ManagedTracer>();
- private final Map<ThreadPoolExecutor, Object> managedThreadPools = new HashMap<ThreadPoolExecutor, Object>();
public DefaultManagementLifecycleStrategy() {
}
@@ -125,13 +125,12 @@
public void onContextStart(CamelContext context) throws VetoCamelContextStartException {
Object mc = getManagementObjectStrategy().getManagedObjectForCamelContext(context);
- String name = context.getName();
- String managementName = context.getManagementNameStrategy().getName();
+ String managementName = context.getManagementName() != null ? context.getManagementName() : context.getName();
try {
boolean done = false;
while (!done) {
- ObjectName on = getManagementStrategy().getManagementNamingStrategy().getObjectNameForCamelContext(managementName, name);
+ ObjectName on = getManagementStrategy().getManagementNamingStrategy().getObjectNameForCamelContext(context);
boolean exists = getManagementStrategy().isManaged(mc, on);
if (!exists) {
done = true;
@@ -139,20 +138,28 @@
// okay there exists already a CamelContext with this name, we can try to fix it by finding a free name
boolean fixed = false;
// if we use the default name strategy we can find a free name to use
- String newName = findFreeName(mc, context.getManagementNameStrategy(), name);
- if (newName != null) {
+ String name = findFreeName(mc, context.getNameStrategy(), managementName);
+ if (name != null) {
// use this as the fixed name
fixed = true;
done = true;
- managementName = newName;
+ managementName = name;
}
// we could not fix it so veto starting camel
if (!fixed) {
throw new VetoCamelContextStartException("CamelContext (" + context.getName() + ") with ObjectName[" + on + "] is already registered."
+ " Make sure to use unique names on CamelContext when using multiple CamelContexts in the same MBeanServer.", context);
} else {
- LOG.warn("This CamelContext(" + context.getName() + ") will be registered using the name: " + managementName
- + " due to clash with an existing name already registered in MBeanServer.");
+ if (context.getNameStrategy() instanceof DefaultCamelContextNameStrategy) {
+ // use this as the fixed name
+ LOG.warn("Reassigned auto assigned name on CamelContext from: " + context.getName()
+ + " to: " + name + " due to clash with existing name already registered in MBeanServer.");
+ // now set the fixed name we are using onwards
+ context.setNameStrategy(new ExplicitCamelContextNameStrategy(name));
+ } else {
+ LOG.warn("This CamelContext(" + context.getName() + ") will be registered using the name: " + managementName
+ + " due to clash with an existing name already registered in MBeanServer.");
+ }
}
}
}
@@ -166,9 +173,7 @@
}
// set the name we are going to use
- if (context instanceof DefaultCamelContext) {
- ((DefaultCamelContext) context).setManagementName(managementName);
- }
+ context.setManagementName(managementName);
try {
manageObject(mc);
@@ -185,25 +190,27 @@
enlistPreRegisteredServices();
}
- private String findFreeName(Object mc, ManagementNameStrategy strategy, String name) throws MalformedObjectNameException {
- // we cannot find a free name for fixed named strategies
- if (strategy.isFixedName()) {
- return null;
- }
-
- // okay try to find a free name
+ private String findFreeName(Object mc, CamelContextNameStrategy strategy, String managementName) throws MalformedObjectNameException {
boolean done = false;
- String newName = null;
+ String name = null;
+ // start from 2 as the existing name is considered the 1st
+ int counter = 2;
while (!done) {
// compute the next name
- newName = strategy.getNextName();
- ObjectName on = getManagementStrategy().getManagementNamingStrategy().getObjectNameForCamelContext(newName, name);
+ if (strategy instanceof DefaultCamelContextNameStrategy) {
+ // prefer to use the default naming strategy to compute the next free name
+ name = ((DefaultCamelContextNameStrategy) strategy).getNextName();
+ } else {
+ // if explicit name then use a counter prefix
+ name = managementName + "-" + counter++;
+ }
+ ObjectName on = getManagementStrategy().getManagementNamingStrategy().getObjectNameForCamelContext(name);
done = !getManagementStrategy().isManaged(mc, on);
if (LOG.isTraceEnabled()) {
LOG.trace("Using name: {} in ObjectName[{}] exists? {}", new Object[]{name, on, done});
}
}
- return newName;
+ return name;
}
/**
@@ -390,7 +397,7 @@
Object answer = null;
if (service instanceof ManagementAware) {
- return ((ManagementAware<Service>) service).getManagedObject(service);
+ return ((ManagementAware) service).getManagedObject(service);
} else if (service instanceof Tracer) {
// special for tracer
Tracer tracer = (Tracer) service;
@@ -436,7 +443,7 @@
// a bit of magic here as the processors we want to manage have already been registered
// in the wrapped processors map when Camel have instrumented the route on route initialization
// so the idea is now to only manage the processors from the map
- KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor> holder = wrappedProcessors.get(processor);
+ KeyValueHolder<ProcessorDefinition, InstrumentationProcessor> holder = wrappedProcessors.get(processor);
if (holder == null) {
// skip as its not an well known processor we want to manage anyway, such as Channel/UnitOfWork/Pipeline etc.
return null;
@@ -574,36 +581,11 @@
try {
manageObject(mtp);
- // store a reference so we can unmanage from JMX when the thread pool is removed
- // we need to keep track here, as we cannot re-construct the thread pool ObjectName when removing the thread pool
- managedThreadPools.put(threadPool, mtp);
} catch (Exception e) {
LOG.warn("Could not register thread pool: " + threadPool + " as ThreadPool MBean.", e);
}
}
- public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool) {
- if (!initialized) {
- return;
- }
-
- // lookup the thread pool and remove it from JMX
- Object mtp = managedThreadPools.remove(threadPool);
- if (mtp != null) {
- // skip unmanaged routes
- if (!getManagementStrategy().isManaged(mtp, null)) {
- LOG.trace("The thread pool is not managed: {}", threadPool);
- return;
- }
-
- try {
- unmanageObject(mtp);
- } catch (Exception e) {
- LOG.warn("Could not unregister ThreadPool MBean", e);
- }
- }
- }
-
public void onRouteContextCreate(RouteContext routeContext) {
if (!initialized) {
return;
@@ -611,8 +593,8 @@
// Create a map (ProcessorType -> PerformanceCounter)
// to be passed to InstrumentationInterceptStrategy.
- Map<ProcessorDefinition<?>, PerformanceCounter> registeredCounters =
- new HashMap<ProcessorDefinition<?>, PerformanceCounter>();
+ Map<ProcessorDefinition, PerformanceCounter> registeredCounters =
+ new HashMap<ProcessorDefinition, PerformanceCounter>();
// Each processor in a route will have its own performance counter.
// These performance counter will be embedded to InstrumentationProcessor
@@ -620,7 +602,7 @@
RouteDefinition route = routeContext.getRoute();
// register performance counters for all processors and its children
- for (ProcessorDefinition<?> processor : route.getOutputs()) {
+ for (ProcessorDefinition processor : route.getOutputs()) {
registerPerformanceCounters(routeContext, processor, registeredCounters);
}
@@ -641,9 +623,9 @@
for (Route route : routes) {
String id = route.getId();
- Iterator<KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>> it = wrappedProcessors.values().iterator();
+ Iterator<KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>> it = wrappedProcessors.values().iterator();
while (it.hasNext()) {
- KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor> holder = it.next();
+ KeyValueHolder<ProcessorDefinition, InstrumentationProcessor> holder = it.next();
RouteDefinition def = ProcessorDefinitionHelper.getRoute(holder.getKey());
if (def != null && id.equals(def.getId())) {
it.remove();
@@ -653,12 +635,12 @@
}
- private void registerPerformanceCounters(RouteContext routeContext, ProcessorDefinition<?> processor,
- Map<ProcessorDefinition<?>, PerformanceCounter> registeredCounters) {
+ private void registerPerformanceCounters(RouteContext routeContext, ProcessorDefinition processor,
+ Map<ProcessorDefinition, PerformanceCounter> registeredCounters) {
// traverse children if any exists
- List<ProcessorDefinition<?>> children = processor.getOutputs();
- for (ProcessorDefinition<?> child : children) {
+ List<ProcessorDefinition> children = processor.getOutputs();
+ for (ProcessorDefinition child : children) {
registerPerformanceCounters(routeContext, child, registeredCounters);
}
@@ -684,7 +666,7 @@
/**
* Should the given processor be registered.
*/
- protected boolean registerProcessor(ProcessorDefinition<?> processor) {
+ protected boolean registerProcessor(ProcessorDefinition processor) {
// skip on exception
if (processor instanceof OnExceptionDefinition) {
return false;
@@ -821,7 +803,6 @@
preServices.clear();
wrappedProcessors.clear();
managedTracers.clear();
- managedThreadPools.clear();
ServiceHelper.stopService(timerListenerManager);
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
index 351fa51..254bf8d 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
@@ -78,23 +78,22 @@
}
}
- public ObjectName getObjectNameForCamelContext(String managementName, String name) throws MalformedObjectNameException {
+ public ObjectName getObjectNameForCamelContext(String name) throws MalformedObjectNameException {
StringBuilder buffer = new StringBuilder();
buffer.append(domainName).append(":");
- buffer.append(KEY_CONTEXT + "=").append(getContextId(managementName)).append(",");
+ buffer.append(KEY_CONTEXT + "=").append(getContextId(name)).append(",");
buffer.append(KEY_TYPE + "=" + TYPE_CONTEXT + ",");
buffer.append(KEY_NAME + "=").append(ObjectName.quote(name));
return createObjectName(buffer);
}
public ObjectName getObjectNameForCamelContext(CamelContext context) throws MalformedObjectNameException {
- // prefer to use the given management name if previously assigned
- String managementName = context.getManagementName();
- if (managementName == null) {
- managementName = context.getManagementNameStrategy().getName();
- }
- String name = context.getName();
- return getObjectNameForCamelContext(managementName, name);
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(domainName).append(":");
+ buffer.append(KEY_CONTEXT + "=").append(getContextId(context)).append(",");
+ buffer.append(KEY_TYPE + "=" + TYPE_CONTEXT + ",");
+ buffer.append(KEY_NAME + "=").append(ObjectName.quote(context.getName()));
+ return createObjectName(buffer);
}
public ObjectName getObjectNameForEndpoint(Endpoint endpoint) throws MalformedObjectNameException {
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
index 785dbf8..e41f784 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
@@ -159,7 +159,7 @@
@SuppressWarnings({"deprecation", "unchecked"})
public Object getManagedObjectForProcessor(CamelContext context, Processor processor,
- ProcessorDefinition<?> definition, Route route) {
+ ProcessorDefinition definition, Route route) {
ManagedProcessor answer = null;
// unwrap delegates as we want the real target processor
diff --git a/camel-core/src/main/java/org/apache/camel/management/InstrumentationInterceptStrategy.java b/camel-core/src/main/java/org/apache/camel/management/InstrumentationInterceptStrategy.java
index 4698c2d..c0dbd71 100644
--- a/camel-core/src/main/java/org/apache/camel/management/InstrumentationInterceptStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/InstrumentationInterceptStrategy.java
@@ -38,16 +38,16 @@
*/
public class InstrumentationInterceptStrategy implements InterceptStrategy {
- private Map<ProcessorDefinition<?>, PerformanceCounter> registeredCounters;
- private final Map<Processor, KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>> wrappedProcessors;
+ private Map<ProcessorDefinition, PerformanceCounter> registeredCounters;
+ private final Map<Processor, KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>> wrappedProcessors;
- public InstrumentationInterceptStrategy(Map<ProcessorDefinition<?>, PerformanceCounter> registeredCounters,
- Map<Processor, KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>> wrappedProcessors) {
+ public InstrumentationInterceptStrategy(Map<ProcessorDefinition, PerformanceCounter> registeredCounters,
+ Map<Processor, KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>> wrappedProcessors) {
this.registeredCounters = registeredCounters;
this.wrappedProcessors = wrappedProcessors;
}
- public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition,
+ public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition definition,
Processor target, Processor nextTarget) throws Exception {
// do not double wrap it
if (target instanceof InstrumentationProcessor) {
@@ -63,8 +63,8 @@
// add it to the mapping of wrappers so we can later change it to a decorated counter
// that when we register the processor
- KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor> holder =
- new KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>(definition, wrapper);
+ KeyValueHolder<ProcessorDefinition, InstrumentationProcessor> holder =
+ new KeyValueHolder<ProcessorDefinition, InstrumentationProcessor>(definition, wrapper);
wrappedProcessors.put(target, holder);
return wrapper;
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/ManagementStrategyFactory.java b/camel-core/src/main/java/org/apache/camel/management/ManagementStrategyFactory.java
index b10f8ed..583050f 100644
--- a/camel-core/src/main/java/org/apache/camel/management/ManagementStrategyFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/management/ManagementStrategyFactory.java
@@ -32,18 +32,18 @@
ManagementStrategy answer = null;
if (disableJMX || Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
- log.info("JMX is disabled.");
+ log.info("JMX is disabled. Using DefaultManagementStrategy.");
} else {
try {
+ log.info("JMX enabled. Using ManagedManagementStrategy.");
answer = new ManagedManagementStrategy(new DefaultManagementAgent(context));
// must start it to ensure JMX works and can load needed Spring JARs
ServiceHelper.startService(answer);
// prefer to have it at first strategy
context.getLifecycleStrategies().add(0, new DefaultManagementLifecycleStrategy(context));
- log.info("JMX enabled.");
} catch (Exception e) {
answer = null;
- log.warn("Cannot create JMX lifecycle strategy. Will fallback and disable JMX.", e);
+ log.warn("Cannot create JMX lifecycle strategy. Fallback to using DefaultManagementStrategy (non JMX).", e);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java b/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java
index ae7eae7..c12b1a9 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/JMXNotificationTraceEventHandler.java
@@ -43,14 +43,17 @@
this.tracer = tracer;
}
- public void traceExchangeOut(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
+ @SuppressWarnings("rawtypes")
+ public void traceExchangeOut(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
}
- public Object traceExchangeIn(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ @SuppressWarnings("rawtypes")
+ public Object traceExchangeIn(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
return null;
}
- public void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ @SuppressWarnings("rawtypes")
+ public void traceExchange(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
if (notificationSender != null && tracer.isJmxTraceNotifications()) {
String body = MessageHelper.extractBodyForLogging(exchange.getIn(), "", false, true, tracer.getTraceBodySize());
@@ -58,7 +61,7 @@
body = "";
}
String message = body.substring(0, Math.min(body.length(), MAX_MESSAGE_LENGTH));
- Map<String, Object> tm = createTraceMessage(node, exchange, body);
+ Map tm = createTraceMessage(node, exchange, body);
Notification notification = new Notification("TraceNotification", exchange.toString(), num++, System.currentTimeMillis(), message);
notification.setUserData(tm);
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedBrowsableEndpoint.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedBrowsableEndpoint.java
index a1e0c59..916c460 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedBrowsableEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedBrowsableEndpoint.java
@@ -26,33 +26,28 @@
import org.apache.camel.util.MessageHelper;
/**
- * @version
+ * @version
*/
@ManagedResource(description = "Managed BrowsableEndpoint")
public class ManagedBrowsableEndpoint extends ManagedEndpoint implements ManagedBrowsableEndpointMBean {
+ private BrowsableEndpoint endpoint;
+
public ManagedBrowsableEndpoint(BrowsableEndpoint endpoint) {
super(endpoint);
+ this.endpoint = endpoint;
}
- @Override
public BrowsableEndpoint getEndpoint() {
- return (BrowsableEndpoint) super.getEndpoint();
+ return endpoint;
}
- @Override
- public BrowsableEndpoint getInstance() {
- return getEndpoint();
- }
-
- @Override
public long queueSize() {
- return getEndpoint().getExchanges().size();
+ return endpoint.getExchanges().size();
}
- @Override
public String browseExchange(Integer index) {
- List<Exchange> exchanges = getEndpoint().getExchanges();
+ List<Exchange> exchanges = endpoint.getExchanges();
if (index >= exchanges.size()) {
return null;
@@ -65,9 +60,8 @@
return exchange.toString();
}
- @Override
public String browseMessageBody(Integer index) {
- List<Exchange> exchanges = getEndpoint().getExchanges();
+ List<Exchange> exchanges = endpoint.getExchanges();
if (index >= exchanges.size()) {
return null;
@@ -88,14 +82,12 @@
return body;
}
- @Override
public String browseMessageAsXml(Integer index) {
return browseMessageAsXml(index, true);
}
- @Override
public String browseMessageAsXml(Integer index, Boolean includeBody) {
- List<Exchange> exchanges = getEndpoint().getExchanges();
+ List<Exchange> exchanges = endpoint.getExchanges();
if (index >= exchanges.size()) {
return null;
@@ -111,12 +103,10 @@
return xml;
}
- @Override
public String browseAllMessagesAsXml(Boolean includeBody) {
return browseRangeMessagesAsXml(0, Integer.MAX_VALUE, includeBody);
}
- @Override
public String browseRangeMessagesAsXml(Integer fromIndex, Integer toIndex, Boolean includeBody) {
if (fromIndex == null) {
fromIndex = 0;
@@ -128,7 +118,7 @@
throw new IllegalArgumentException("From index cannot be larger than to index, was: " + fromIndex + " > " + toIndex);
}
- List<Exchange> exchanges = getEndpoint().getExchanges();
+ List<Exchange> exchanges = endpoint.getExchanges();
if (exchanges.size() == 0) {
return null;
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
index 7d4843c..6b37097 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedCamelContext.java
@@ -18,13 +18,9 @@
import java.io.InputStream;
import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.concurrent.TimeUnit;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
import org.apache.camel.CamelContext;
@@ -34,8 +30,6 @@
import org.apache.camel.TimerListener;
import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
-import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
-import org.apache.camel.api.management.mbean.ManagedRouteMBean;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.ModelHelper;
import org.apache.camel.model.RouteDefinition;
@@ -240,59 +234,6 @@
context.addRouteDefinitions(def.getRoutes());
}
- @Override
- public String dumpRoutesStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception {
- StringBuilder sb = new StringBuilder();
- sb.append("<camelContextStat").append(String.format(" id=\"%s\"", getCamelId())).append(">\n");
-
- MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
- if (server != null) {
- // gather all the routes for this CamelContext, which requires JMX
- ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=routes,*");
- Set<ObjectName> routes = server.queryNames(query, null);
-
- Set<ManagedProcessorMBean> processors = new LinkedHashSet<ManagedProcessorMBean>();
- if (includeProcessors) {
- // gather all the processors for this CamelContext, which requires JMX
- query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
- Set<ObjectName> names = server.queryNames(query, null);
- for (ObjectName on : names) {
- ManagedProcessorMBean processor = MBeanServerInvocationHandler.newProxyInstance(server, on, ManagedProcessorMBean.class, true);
- processors.add(processor);
- }
- }
-
- // loop the routes, and append the processor stats if needed
- sb.append(" <routeStats>\n");
- for (ObjectName on : routes) {
- ManagedRouteMBean route = MBeanServerInvocationHandler.newProxyInstance(server, on, ManagedRouteMBean.class, true);
- sb.append(" <routeStat").append(String.format(" id=\"%s\"", route.getRouteId()));
- // use substring as we only want the attributes
- String stat = route.dumpStatsAsXml(fullStats);
- sb.append(" ").append(stat.substring(7, stat.length() - 2)).append(">\n");
-
- // add processor details if needed
- if (includeProcessors) {
- sb.append(" <processorStats>\n");
- for (ManagedProcessorMBean processor : processors) {
- // the processor must belong to this route
- if (route.getRouteId().equals(processor.getRouteId())) {
- sb.append(" <processorStat").append(String.format(" id=\"%s\"", processor.getProcessorId()));
- // use substring as we only want the attributes
- sb.append(" ").append(processor.dumpStatsAsXml(fullStats).substring(7)).append("\n");
- }
- }
- sb.append(" </processorStats>\n");
- }
- sb.append(" </routeStat>\n");
- }
- sb.append(" </routeStats>\n");
- }
-
- sb.append("</camelContextStat>");
- return sb.toString();
- }
-
public boolean createEndpoint(String uri) throws Exception {
if (context.hasEndpoint(uri) != null) {
// endpoint already exists
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
index 2db300f..ba4f67d 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEndpoint.java
@@ -40,22 +40,18 @@
return endpoint;
}
- @Override
public String getCamelId() {
return endpoint.getCamelContext().getName();
}
- @Override
public String getEndpointUri() {
return endpoint.getEndpointUri();
}
- @Override
public boolean isSingleton() {
return endpoint.isSingleton();
}
- @Override
public String getState() {
// must use String type to be sure remote JMX can read the attribute without requiring Camel classes.
if (endpoint instanceof StatefulService) {
@@ -71,9 +67,7 @@
return ServiceStatus.Started.name();
}
- @Override
- public Endpoint getInstance() {
+ public Object getInstance() {
return endpoint;
}
-
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
index 366e39f..ae8dcbf 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedPerformanceCounter.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.management.mbean;
-import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.camel.Exchange;
@@ -28,9 +27,6 @@
@ManagedResource(description = "PerformanceCounter")
public abstract class ManagedPerformanceCounter extends ManagedCounter implements PerformanceCounter, ManagedPerformanceCounterMBean {
-
- public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
-
private Statistic exchangesCompleted;
private Statistic exchangesFailed;
private Statistic failuresHandled;
@@ -237,43 +233,4 @@
lastExchangeFailureExchangeId = exchange.getExchangeId();
}
- public String dumpStatsAsXml(boolean fullStats) {
- StringBuilder sb = new StringBuilder();
- sb.append("<stats ");
- sb.append(String.format("exchangesCompleted=\"%s\"", exchangesCompleted.getValue()));
- sb.append(String.format(" exchangesFailed=\"%s\"", exchangesFailed.getValue()));
- sb.append(String.format(" failuresHandled=\"%s\"", failuresHandled.getValue()));
- sb.append(String.format(" redeliveries=\"%s\"", redeliveries.getValue()));
- sb.append(String.format(" externalRedeliveries=\"%s\"", externalRedeliveries.getValue()));
- sb.append(String.format(" minProcessingTime=\"%s\"", minProcessingTime.getValue()));
- sb.append(String.format(" maxProcessingTime=\"%s\"", maxProcessingTime.getValue()));
- sb.append(String.format(" totalProcessingTime=\"%s\"", totalProcessingTime.getValue()));
- sb.append(String.format(" lastProcessingTime=\"%s\"", lastProcessingTime.getValue()));
- sb.append(String.format(" meanProcessingTime=\"%s\"", meanProcessingTime.getValue()));
-
- if (fullStats) {
- sb.append(String.format(" firstExchangeCompletedTimestamp=\"%s\"", dateAsString(firstExchangeCompletedTimestamp.getValue())));
- sb.append(String.format(" firstExchangeCompletedExchangeId=\"%s\"", nullSafe(firstExchangeCompletedExchangeId)));
- sb.append(String.format(" firstExchangeFailureTimestamp=\"%s\"", dateAsString(firstExchangeFailureTimestamp.getValue())));
- sb.append(String.format(" firstExchangeFailureExchangeId=\"%s\"", nullSafe(firstExchangeFailureExchangeId)));
- sb.append(String.format(" lastExchangeCompletedTimestamp=\"%s\"", dateAsString(lastExchangeCompletedTimestamp.getValue())));
- sb.append(String.format(" lastExchangeCompletedExchangeId=\"%s\"", nullSafe(lastExchangeCompletedExchangeId)));
- sb.append(String.format(" lastExchangeFailureTimestamp=\"%s\"", dateAsString(lastExchangeFailureTimestamp.getValue())));
- sb.append(String.format(" lastExchangeFailureExchangeId=\"%s\"", nullSafe(lastExchangeFailureExchangeId)));
- }
- sb.append("/>");
- return sb.toString();
- }
-
- private static String dateAsString(long value) {
- if (value == 0) {
- return "";
- }
- return new SimpleDateFormat(TIMESTAMP_FORMAT).format(value);
- }
-
- private static String nullSafe(String s) {
- return s != null ? s : "";
- }
-
}
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
index 4a2a77a..66364b9 100644
--- a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java
@@ -17,11 +17,7 @@
package org.apache.camel.management.mbean;
import java.util.List;
-import java.util.Set;
import java.util.concurrent.TimeUnit;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
@@ -30,7 +26,6 @@
import org.apache.camel.ServiceStatus;
import org.apache.camel.TimerListener;
import org.apache.camel.api.management.ManagedResource;
-import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
import org.apache.camel.api.management.mbean.ManagedRouteMBean;
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.ModelHelper;
@@ -219,38 +214,6 @@
context.addRouteDefinition(def);
}
- public String dumpRouteStatsAsXml(boolean fullStats, boolean includeProcessors) throws Exception {
- StringBuilder sb = new StringBuilder();
-
- sb.append("<routeStat").append(String.format(" id=\"%s\"", route.getId()));
- // use substring as we only want the attributes
- String stat = dumpStatsAsXml(fullStats);
- sb.append(" ").append(stat.substring(7, stat.length() - 2)).append(">\n");
-
- // gather all the processors for this route, which requires JMX
- if (includeProcessors) {
- sb.append(" <processorStats>\n");
- MBeanServer server = getContext().getManagementStrategy().getManagementAgent().getMBeanServer();
- if (server != null) {
- ObjectName query = ObjectName.getInstance("org.apache.camel:context=*/" + getContext().getManagementName() + ",type=processors,*");
- Set<ObjectName> names = server.queryNames(query, null);
- for (ObjectName on : names) {
- ManagedProcessorMBean processor = MBeanServerInvocationHandler.newProxyInstance(server, on, ManagedProcessorMBean.class, true);
- // the processor must belong to this route
- if (getRouteId().equals(processor.getRouteId())) {
- sb.append(" <processorStat").append(String.format(" id=\"%s\"", processor.getProcessorId()));
- // use substring as we only want the attributes
- sb.append(" ").append(processor.dumpStatsAsXml(fullStats).substring(7)).append("\n");
- }
- }
- }
- sb.append(" </processorStats>\n");
- }
-
- sb.append("</routeStat>");
- return sb.toString();
- }
-
@Override
public boolean equals(Object o) {
return this == o || (o != null && getClass() == o.getClass() && route.equals(((ManagedRoute)o).route));
diff --git a/camel-core/src/main/java/org/apache/camel/model/AOPDefinition.java b/camel-core/src/main/java/org/apache/camel/model/AOPDefinition.java
index 8a75452..0ab1c15 100644
--- a/camel-core/src/main/java/org/apache/camel/model/AOPDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/AOPDefinition.java
@@ -96,7 +96,7 @@
// use a pipeline to assemble the before and target processor
// and the after if not afterFinally
- Collection<ProcessorDefinition<?>> pipe = new ArrayList<ProcessorDefinition<?>>();
+ Collection<ProcessorDefinition> pipe = new ArrayList<ProcessorDefinition>();
Processor finallyProcessor = null;
diff --git a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
index 622b9d3..b49750a 100644
--- a/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java
@@ -63,7 +63,7 @@
@XmlTransient
private ExpressionDefinition expression;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
@XmlTransient
private AggregationStrategy aggregationStrategy;
@XmlTransient
@@ -248,9 +248,9 @@
}
@Override
- protected void configureChild(ProcessorDefinition<?> output) {
+ protected void configureChild(ProcessorDefinition output) {
if (expression != null && expression instanceof ExpressionClause) {
- ExpressionClause<?> clause = (ExpressionClause<?>) expression;
+ ExpressionClause clause = (ExpressionClause) expression;
if (clause.getExpressionType() != null) {
// if using the Java DSL then the expression may have been set using the
// ExpressionClause which is a fancy builder to define expressions and predicates
@@ -780,8 +780,7 @@
this.expression = expression;
}
- @Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
@@ -789,7 +788,7 @@
return true;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/Block.java b/camel-core/src/main/java/org/apache/camel/model/Block.java
index f5a7797..409dbe9 100644
--- a/camel-core/src/main/java/org/apache/camel/model/Block.java
+++ b/camel-core/src/main/java/org/apache/camel/model/Block.java
@@ -28,5 +28,5 @@
*
* @param processorDefinition the processor definition
*/
- void addOutput(ProcessorDefinition<?> processorDefinition);
+ void addOutput(ProcessorDefinition processorDefinition);
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/CatchDefinition.java b/camel-core/src/main/java/org/apache/camel/model/CatchDefinition.java
index 96719a5..a42cdd9 100644
--- a/camel-core/src/main/java/org/apache/camel/model/CatchDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/CatchDefinition.java
@@ -33,6 +33,7 @@
import org.apache.camel.builder.ExpressionBuilder;
import org.apache.camel.processor.CatchProcessor;
import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ExpressionToPredicateAdapter;
/**
@@ -50,21 +51,21 @@
@XmlElement(name = "handled")
private ExpressionSubElementDefinition handled;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
@XmlTransient
- private List<Class<? extends Throwable>> exceptionClasses;
+ private List<Class> exceptionClasses;
@XmlTransient
private Predicate handledPolicy;
public CatchDefinition() {
}
- public CatchDefinition(List<Class<? extends Throwable>> exceptionClasses) {
+ public CatchDefinition(List<Class> exceptionClasses) {
this.exceptionClasses = exceptionClasses;
}
- public CatchDefinition(Class<? extends Throwable> exceptionType) {
- exceptionClasses = new ArrayList<Class<? extends Throwable>>();
+ public CatchDefinition(Class exceptionType) {
+ exceptionClasses = new ArrayList<Class>();
exceptionClasses.add(exceptionType);
}
@@ -111,12 +112,11 @@
return new CatchProcessor(exceptionClasses, childProcessor, when, handle);
}
- @Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
}
@@ -124,11 +124,11 @@
return true;
}
- public List<Class<? extends Throwable>> getExceptionClasses() {
+ public List<Class> getExceptionClasses() {
return exceptionClasses;
}
- public void setExceptionClasses(List<Class<? extends Throwable>> exceptionClasses) {
+ public void setExceptionClasses(List<Class> exceptionClasses) {
this.exceptionClasses = exceptionClasses;
}
@@ -140,7 +140,7 @@
* @param exceptionClasses a list of the exception classes
* @return the builder
*/
- public CatchDefinition exceptionClasses(List<Class<? extends Throwable>> exceptionClasses) {
+ public CatchDefinition exceptionClasses(List<Class> exceptionClasses) {
setExceptionClasses(exceptionClasses);
return this;
}
@@ -207,8 +207,8 @@
* @param exception the exception of class
* @return the builder
*/
- public CatchDefinition exceptionClasses(Class<? extends Throwable> exception) {
- List<Class<? extends Throwable>> list = getExceptionClasses();
+ public CatchDefinition exceptionClasses(Class exception) {
+ List<Class> list = getExceptionClasses();
list.add(exception);
return this;
}
@@ -245,13 +245,13 @@
this.handled = handled;
}
- protected List<Class<? extends Throwable>> createExceptionClasses(CamelContext context) throws ClassNotFoundException {
+ protected List<Class> createExceptionClasses(CamelContext context) throws ClassNotFoundException {
// must use the class resolver from CamelContext to load classes to ensure it can
// be loaded in all kind of environments such as JEE servers and OSGi etc.
List<String> list = getExceptions();
- List<Class<? extends Throwable>> answer = new ArrayList<Class<? extends Throwable>>(list.size());
+ List<Class> answer = new ArrayList<Class>(list.size());
for (String name : list) {
- Class<Throwable> type = context.getClassResolver().resolveMandatoryClass(name, Throwable.class);
+ Class<Exception> type = CastUtils.cast(context.getClassResolver().resolveMandatoryClass(name));
answer.add(type);
}
return answer;
diff --git a/camel-core/src/main/java/org/apache/camel/model/ChoiceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ChoiceDefinition.java
index 2527aa7..c5d7941 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ChoiceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ChoiceDefinition.java
@@ -52,12 +52,12 @@
}
@Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
// wrap the outputs into a list where we can on the inside control the when/otherwise
// but make it appear as a list on the outside
- return new AbstractList<ProcessorDefinition<?>>() {
+ return new AbstractList<ProcessorDefinition>() {
- public ProcessorDefinition<?> get(int index) {
+ public ProcessorDefinition get(int index) {
if (index < whenClauses.size()) {
return whenClauses.get(index);
}
@@ -67,7 +67,7 @@
throw new IndexOutOfBoundsException("Index " + index + " is out of bounds with size " + size());
}
- public boolean add(ProcessorDefinition<?> def) {
+ public boolean add(ProcessorDefinition def) {
if (def instanceof WhenDefinition) {
return whenClauses.add((WhenDefinition)def);
} else if (def instanceof OtherwiseDefinition) {
@@ -87,7 +87,7 @@
otherwise = null;
}
- public ProcessorDefinition<?> set(int index, ProcessorDefinition<?> element) {
+ public ProcessorDefinition set(int index, ProcessorDefinition element) {
if (index < whenClauses.size()) {
if (element instanceof WhenDefinition) {
return whenClauses.set(index, (WhenDefinition)element);
@@ -95,18 +95,18 @@
throw new IllegalArgumentException("Expected WhenDefinition but was "
+ ObjectHelper.classCanonicalName(element));
} else if (index == whenClauses.size()) {
- ProcessorDefinition<?> old = otherwise;
+ ProcessorDefinition old = otherwise;
otherwise = (OtherwiseDefinition)element;
return old;
}
throw new IndexOutOfBoundsException("Index " + index + " is out of bounds with size " + size());
}
- public ProcessorDefinition<?> remove(int index) {
+ public ProcessorDefinition remove(int index) {
if (index < whenClauses.size()) {
return whenClauses.remove(index);
} else if (index == whenClauses.size()) {
- ProcessorDefinition<?> old = otherwise;
+ ProcessorDefinition old = otherwise;
otherwise = null;
return old;
}
@@ -168,7 +168,7 @@
return clause;
}
- private void addClause(ProcessorDefinition<?> when) {
+ private void addClause(ProcessorDefinition when) {
popBlock();
addOutput(when);
pushBlock(when);
@@ -229,13 +229,13 @@
}
@Override
- protected void configureChild(ProcessorDefinition<?> output) {
+ protected void configureChild(ProcessorDefinition output) {
if (whenClauses == null || whenClauses.isEmpty()) {
return;
}
for (WhenDefinition when : whenClauses) {
if (when.getExpression() instanceof ExpressionClause) {
- ExpressionClause<?> clause = (ExpressionClause<?>) when.getExpression();
+ ExpressionClause clause = (ExpressionClause) when.getExpression();
if (clause.getExpressionType() != null) {
// if using the Java DSL then the expression may have been set using the
// ExpressionClause which is a fancy builder to define expressions and predicates
diff --git a/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java b/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java
index 9a486fb..26d31b4 100644
--- a/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java
@@ -33,7 +33,7 @@
*/
@XmlRootElement(name = "dynamicRouter")
@XmlAccessorType(XmlAccessType.FIELD)
-public class DynamicRouterDefinition<Type extends ProcessorDefinition<Type>> extends NoOutputExpressionNode {
+public class DynamicRouterDefinition<Type extends ProcessorDefinition> extends NoOutputExpressionNode {
public static final String DEFAULT_DELIMITER = ",";
@@ -65,7 +65,7 @@
}
@Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return Collections.emptyList();
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/ExecutorServiceAwareDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ExecutorServiceAwareDefinition.java
index 9a25505..3609860 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ExecutorServiceAwareDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ExecutorServiceAwareDefinition.java
@@ -25,7 +25,7 @@
*
* @version
*/
-public interface ExecutorServiceAwareDefinition<Type extends ProcessorDefinition<?>> extends ExecutorServiceAware {
+public interface ExecutorServiceAwareDefinition<Type extends ProcessorDefinition> extends ExecutorServiceAware {
/**
* Setting the executor service for executing
diff --git a/camel-core/src/main/java/org/apache/camel/model/ExpressionNode.java b/camel-core/src/main/java/org/apache/camel/model/ExpressionNode.java
index 373b743..d22f00b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ExpressionNode.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ExpressionNode.java
@@ -41,7 +41,7 @@
@XmlElementRef
private ExpressionDefinition expression;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
public ExpressionNode() {
}
@@ -76,12 +76,11 @@
this.expression = expression;
}
- @Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
}
@@ -98,30 +97,13 @@
return getExpression().getLabel();
}
- /**
- * Creates the {@link FilterProcessor} from the expression node.
- *
- * @param routeContext the route context
- * @return the created {@link FilterProcessor}
- * @throws Exception is thrown if error creating the processor
- */
protected FilterProcessor createFilterProcessor(RouteContext routeContext) throws Exception {
Processor childProcessor = this.createChildProcessor(routeContext, false);
- return new FilterProcessor(createPredicate(routeContext), childProcessor);
- }
-
- /**
- * Creates the {@link Predicate} from the expression node.
- *
- * @param routeContext the route context
- * @return the created predicate
- */
- protected Predicate createPredicate(RouteContext routeContext) {
- return getExpression().createPredicate(routeContext);
+ return new FilterProcessor(getExpression().createPredicate(routeContext), childProcessor);
}
@Override
- protected void configureChild(ProcessorDefinition<?> output) {
+ protected void configureChild(ProcessorDefinition output) {
// reuse the logic from pre create processor
preCreateProcessor();
}
@@ -134,7 +116,7 @@
}
if (exp instanceof ExpressionClause) {
- ExpressionClause<?> clause = (ExpressionClause<?>) exp;
+ ExpressionClause clause = (ExpressionClause) exp;
if (clause.getExpressionType() != null) {
// if using the Java DSL then the expression may have been set using the
// ExpressionClause which is a fancy builder to define expressions and predicates
diff --git a/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java b/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java
index a7c6ece..5679f1d 100644
--- a/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/FilterDefinition.java
@@ -61,6 +61,7 @@
return "filter";
}
+
@Override
public FilterProcessor createProcessor(RouteContext routeContext) throws Exception {
return createFilterProcessor(routeContext);
@@ -70,7 +71,7 @@
protected FilterProcessor createFilterProcessor(RouteContext routeContext) throws Exception {
// filter EIP should have child outputs
Processor childProcessor = this.createChildProcessor(routeContext, true);
- return new FilterProcessor(createPredicate(routeContext), childProcessor);
+ return new FilterProcessor(getExpression().createPredicate(routeContext), childProcessor);
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/FinallyDefinition.java b/camel-core/src/main/java/org/apache/camel/model/FinallyDefinition.java
index eb0772f..5946e2f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/FinallyDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/FinallyDefinition.java
@@ -30,7 +30,7 @@
*/
@XmlRootElement(name = "doFinally")
@XmlAccessorType(XmlAccessType.FIELD)
-public class FinallyDefinition extends OutputDefinition<FinallyDefinition> {
+public class FinallyDefinition extends OutputDefinition<FinallyDefinition> implements Block {
@Override
public String toString() {
diff --git a/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java b/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
index a357516..0d5ffff 100644
--- a/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
@@ -75,7 +75,7 @@
routeContext.getInterceptStrategies().add(new InterceptStrategy() {
private Processor interceptedTarget;
- public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition,
+ public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition definition,
Processor target, Processor nextTarget) throws Exception {
// prefer next target over target as next target is the real target
interceptedTarget = nextTarget != null ? nextTarget : target;
@@ -130,17 +130,17 @@
return;
}
- ProcessorDefinition<?> first = getOutputs().get(0);
+ ProcessorDefinition first = getOutputs().get(0);
if (first instanceof WhenDefinition) {
WhenDefinition when = (WhenDefinition) first;
// move this outputs to the when, expect the first one
// as the first one is the interceptor itself
for (int i = 1; i < outputs.size(); i++) {
- ProcessorDefinition<?> out = outputs.get(i);
+ ProcessorDefinition out = outputs.get(i);
when.addOutput(out);
}
// remove the moved from the original output, by just keeping the first one
- ProcessorDefinition<?> keep = outputs.get(0);
+ ProcessorDefinition keep = outputs.get(0);
clearOutput();
outputs.add(keep);
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java b/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
index 3e96513..ec32b56 100644
--- a/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
@@ -65,7 +65,7 @@
}
@Override
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public Processor createProcessor(RouteContext routeContext) throws Exception {
// insert a set header definition so we can set the intercepted endpoint uri as a header
// this allows us to use the same header for both the interceptFrom and interceptSendToEndpoint
diff --git a/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java b/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
index 76079b4..b6b00bf 100644
--- a/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
@@ -87,13 +87,14 @@
// register endpoint callback so we can proxy the endpoint
routeContext.getCamelContext().addRegisterEndpointCallback(new EndpointStrategy() {
public Endpoint registerEndpoint(String uri, Endpoint endpoint) {
+
if (endpoint instanceof InterceptSendToEndpoint) {
// endpoint already decorated
return endpoint;
} else if (getUri() == null || EndpointHelper.matchEndpoint(uri, getUri())) {
// only proxy if the uri is matched decorate endpoint with our proxy
// should be false by default
- boolean skip = isSkipSendToOriginalEndpoint();
+ boolean skip = getSkipSendToOriginalEndpoint() != null ? getSkipSendToOriginalEndpoint() : false;
InterceptSendToEndpoint proxy = new InterceptSendToEndpoint(endpoint, skip);
proxy.setDetour(detour);
return proxy;
@@ -109,7 +110,7 @@
// instead we use the proxy endpoints producer do the triggering. That is we trigger when someone sends
// an exchange to the endpoint, see InterceptSendToEndpoint for details.
RouteDefinition route = routeContext.getRoute();
- List<ProcessorDefinition<?>> outputs = route.getOutputs();
+ List<ProcessorDefinition> outputs = route.getOutputs();
outputs.remove(this);
return new InterceptEndpointProcessor(uri, detour);
@@ -152,30 +153,19 @@
return;
}
- // if there is a when definition at first, then its a predicate for this interceptor
- ProcessorDefinition<?> first = getOutputs().get(0);
- if (first instanceof WhenDefinition && !(first instanceof WhenSkipSendToEndpointDefinition)) {
+ ProcessorDefinition first = getOutputs().get(0);
+ if (first instanceof WhenDefinition) {
WhenDefinition when = (WhenDefinition) first;
-
- // create a copy of when to use as replacement
- WhenSkipSendToEndpointDefinition newWhen = new WhenSkipSendToEndpointDefinition();
- newWhen.setExpression(when.getExpression());
- newWhen.setId(when.getId());
- newWhen.setInheritErrorHandler(when.isInheritErrorHandler());
- newWhen.setParent(when.getParent());
- newWhen.setOtherAttributes(when.getOtherAttributes());
- newWhen.setNodeFactory(when.getNodeFactory());
- newWhen.setDescription(when.getDescription());
-
// move this outputs to the when, expect the first one
// as the first one is the interceptor itself
for (int i = 1; i < outputs.size(); i++) {
- ProcessorDefinition<?> out = outputs.get(i);
- newWhen.addOutput(out);
+ ProcessorDefinition out = outputs.get(i);
+ when.addOutput(out);
}
// remove the moved from the original output, by just keeping the first one
+ ProcessorDefinition keep = outputs.get(0);
clearOutput();
- outputs.add(newWhen);
+ outputs.add(keep);
}
}
@@ -186,10 +176,6 @@
public void setSkipSendToOriginalEndpoint(Boolean skipSendToOriginalEndpoint) {
this.skipSendToOriginalEndpoint = skipSendToOriginalEndpoint;
}
-
- public boolean isSkipSendToOriginalEndpoint() {
- return skipSendToOriginalEndpoint != null && skipSendToOriginalEndpoint;
- }
public String getUri() {
return uri;
diff --git a/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
index c718623..94c5724 100644
--- a/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/LoadBalanceDefinition.java
@@ -70,7 +70,7 @@
)
private LoadBalancerDefinition loadBalancerType;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
public LoadBalanceDefinition() {
}
@@ -80,12 +80,11 @@
return "loadbalance";
}
- @Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
if (outputs != null) {
for (ProcessorDefinition<?> output : outputs) {
@@ -118,8 +117,7 @@
}
protected Processor createOutputsProcessor(RouteContext routeContext,
- Collection<ProcessorDefinition<?>> outputs) throws Exception {
-
+ Collection<ProcessorDefinition> outputs) throws Exception {
LoadBalancer loadBalancer = LoadBalancerDefinition.getLoadBalancer(routeContext, loadBalancerType, ref);
for (ProcessorDefinition<?> processorType : outputs) {
Processor processor = processorType.createProcessor(routeContext);
@@ -297,8 +295,8 @@
@Override
public String getLabel() {
CollectionStringBuffer buffer = new CollectionStringBuffer("loadBalance[");
- List<ProcessorDefinition<?>> list = getOutputs();
- for (ProcessorDefinition<?> processorType : list) {
+ List<ProcessorDefinition> list = getOutputs();
+ for (ProcessorDefinition processorType : list) {
buffer.append(processorType.getLabel());
}
buffer.append("]");
diff --git a/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java
index 0bdf52d..ff2f9d8 100644
--- a/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/LoadBalancerDefinition.java
@@ -96,9 +96,10 @@
/**
* Factory method to create the load balancer instance
*/
+ @SuppressWarnings("unchecked")
protected LoadBalancer createLoadBalancer(RouteContext routeContext) {
if (loadBalancerTypeName != null) {
- Class<?> type = routeContext.getCamelContext().getClassResolver().resolveClass(loadBalancerTypeName);
+ Class type = routeContext.getCamelContext().getClassResolver().resolveClass(loadBalancerTypeName);
if (type == null) {
throw new IllegalArgumentException("Cannot find class: " + loadBalancerTypeName + " in the classpath");
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java b/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
index 8bc3a2c..ebb2c49 100644
--- a/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/LogDefinition.java
@@ -36,7 +36,7 @@
*/
@XmlRootElement(name = "log")
@XmlAccessorType(XmlAccessType.FIELD)
-public class LogDefinition extends NoOutputDefinition<LogDefinition> {
+public class LogDefinition extends NoOutputDefinition {
@XmlAttribute(required = true)
private String message;
@XmlAttribute
@@ -87,7 +87,7 @@
}
@Override
- public void addOutput(ProcessorDefinition<?> output) {
+ public void addOutput(ProcessorDefinition output) {
// add outputs on parent as this log does not support outputs
getParent().addOutput(output);
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
index 1f0e967..7a1f966 100644
--- a/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/MarshalDefinition.java
@@ -24,8 +24,6 @@
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.Processor;
-import org.apache.camel.model.dataformat.AvroDataFormat;
-import org.apache.camel.model.dataformat.BeanioDataFormat;
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.CastorDataFormat;
import org.apache.camel.model.dataformat.CryptoDataFormat;
@@ -69,8 +67,6 @@
private String ref;
// cannot use @XmlElementRef as it doesn't allow optional properties
@XmlElements({
- @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
- @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
@XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
@XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
@XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
diff --git a/camel-core/src/main/java/org/apache/camel/model/NoOutputDefinition.java b/camel-core/src/main/java/org/apache/camel/model/NoOutputDefinition.java
index 640dabb..e130d1f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/NoOutputDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/NoOutputDefinition.java
@@ -24,8 +24,9 @@
*/
public abstract class NoOutputDefinition<Type extends ProcessorDefinition<Type>> extends ProcessorDefinition<Type> {
- public List<ProcessorDefinition<?>> getOutputs() {
- return Collections.emptyList();
+ @SuppressWarnings("unchecked")
+ public List<ProcessorDefinition> getOutputs() {
+ return Collections.EMPTY_LIST;
}
public boolean isOutputSupported() {
diff --git a/camel-core/src/main/java/org/apache/camel/model/NoOutputExpressionNode.java b/camel-core/src/main/java/org/apache/camel/model/NoOutputExpressionNode.java
index aa96a6b..53ada7b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/NoOutputExpressionNode.java
+++ b/camel-core/src/main/java/org/apache/camel/model/NoOutputExpressionNode.java
@@ -52,8 +52,9 @@
}
@Override
- public List<ProcessorDefinition<?>> getOutputs() {
- return Collections.emptyList();
+ @SuppressWarnings("unchecked")
+ public List<ProcessorDefinition> getOutputs() {
+ return Collections.EMPTY_LIST;
}
@Override
@@ -62,7 +63,7 @@
}
@Override
- public void addOutput(ProcessorDefinition<?> output) {
+ public void addOutput(ProcessorDefinition output) {
// add it to the parent as we do not support outputs
getParent().addOutput(output);
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
index fa310df..eea9216 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
@@ -34,6 +34,7 @@
import org.apache.camel.Predicate;
import org.apache.camel.Processor;
+import org.apache.camel.processor.FatalFallbackErrorHandler;
import org.apache.camel.processor.OnCompletionProcessor;
import org.apache.camel.processor.UnitOfWorkProcessor;
import org.apache.camel.spi.RouteContext;
@@ -57,7 +58,7 @@
@XmlAttribute(name = "useOriginalMessage")
private Boolean useOriginalMessagePolicy;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
@XmlTransient
private ExecutorService executorService;
@XmlTransient
@@ -147,9 +148,10 @@
*
* @param definition the parent definition that is the route
*/
- public void removeAllOnCompletionDefinition(ProcessorDefinition<?> definition) {
- for (Iterator<ProcessorDefinition<?>> it = definition.getOutputs().iterator(); it.hasNext();) {
- ProcessorDefinition<?> out = it.next();
+ @SuppressWarnings("unchecked")
+ public void removeAllOnCompletionDefinition(ProcessorDefinition definition) {
+ for (Iterator<ProcessorDefinition> it = definition.getOutputs().iterator(); it.hasNext();) {
+ ProcessorDefinition out = it.next();
if (out instanceof OnCompletionDefinition) {
it.remove();
}
@@ -157,7 +159,7 @@
}
@Override
- public ProcessorDefinition<?> end() {
+ public ProcessorDefinition end() {
// pop parent block, as we added our self as block to parent when synchronized was defined in the route
getParent().popBlock();
return super.end();
@@ -230,11 +232,11 @@
return this;
}
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
index 9ad2e4d..7979c04 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
@@ -43,6 +43,7 @@
import org.apache.camel.spi.ClassResolver;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.util.CamelContextHelper;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ExpressionToPredicateAdapter;
import org.apache.camel.util.ObjectHelper;
@@ -73,9 +74,9 @@
@XmlAttribute(name = "useOriginalMessage")
private Boolean useOriginalMessagePolicy;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
@XmlTransient
- private List<Class<? extends Throwable>> exceptionClasses;
+ private List<Class> exceptionClasses;
@XmlTransient
private Predicate handledPolicy;
@XmlTransient
@@ -93,12 +94,12 @@
public OnExceptionDefinition() {
}
- public OnExceptionDefinition(List<Class<? extends Throwable>> exceptionClasses) {
- this.exceptionClasses = exceptionClasses;
+ public OnExceptionDefinition(List<Class> exceptionClasses) {
+ this.exceptionClasses = CastUtils.cast(exceptionClasses);
}
- public OnExceptionDefinition(Class<? extends Throwable> exceptionType) {
- exceptionClasses = new ArrayList<Class<? extends Throwable>>();
+ public OnExceptionDefinition(Class exceptionType) {
+ exceptionClasses = new ArrayList<Class>();
exceptionClasses.add(exceptionType);
}
@@ -223,7 +224,7 @@
throw new IllegalArgumentException(this + " cannot have the inheritErrorHandler option set to true");
}
- List<Class<? extends Throwable>> exceptions = getExceptionClasses();
+ List<Class> exceptions = getExceptionClasses();
if (exceptions == null || exceptions.isEmpty()) {
throw new IllegalArgumentException("At least one exception must be configured on " + this);
}
@@ -247,7 +248,7 @@
//-------------------------------------------------------------------------
@Override
- public OnExceptionDefinition onException(Class<? extends Throwable> exceptionType) {
+ public OnExceptionDefinition onException(Class exceptionType) {
getExceptionClasses().add(exceptionType);
return this;
}
@@ -721,12 +722,12 @@
// Properties
//-------------------------------------------------------------------------
- @Override
- public List<ProcessorDefinition<?>> getOutputs() {
+
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
}
@@ -734,11 +735,11 @@
return true;
}
- public List<Class<? extends Throwable>> getExceptionClasses() {
+ public List<Class> getExceptionClasses() {
return exceptionClasses;
}
- public void setExceptionClasses(List<Class<? extends Throwable>> exceptionClasses) {
+ public void setExceptionClasses(List<Class> exceptionClasses) {
this.exceptionClasses = exceptionClasses;
}
@@ -875,12 +876,12 @@
return redeliveryPolicy;
}
- protected List<Class<? extends Throwable>> createExceptionClasses(ClassResolver resolver) throws ClassNotFoundException {
+ protected List<Class> createExceptionClasses(ClassResolver resolver) throws ClassNotFoundException {
List<String> list = getExceptions();
- List<Class<? extends Throwable>> answer = new ArrayList<Class<? extends Throwable>>(list.size());
+ List<Class> answer = new ArrayList<Class>(list.size());
for (String name : list) {
- Class<? extends Throwable> type = resolver.resolveMandatoryClass(name, Throwable.class);
- answer.add(type);
+ Class<?> type = resolver.resolveMandatoryClass(name);
+ answer.add(CastUtils.cast(type, Throwable.class));
}
return answer;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/OtherwiseDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OtherwiseDefinition.java
index 57615ed..06f5891 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OtherwiseDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OtherwiseDefinition.java
@@ -55,8 +55,8 @@
@Override
public String getLabel() {
CollectionStringBuffer buffer = new CollectionStringBuffer("otherwise[");
- List<ProcessorDefinition<?>> list = getOutputs();
- for (ProcessorDefinition<?> type : list) {
+ List<ProcessorDefinition> list = getOutputs();
+ for (ProcessorDefinition type : list) {
buffer.append(type.getLabel());
}
buffer.append("]");
diff --git a/camel-core/src/main/java/org/apache/camel/model/OutputDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OutputDefinition.java
index 6bdaf9a..9d5d404 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OutputDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OutputDefinition.java
@@ -32,9 +32,9 @@
@XmlAccessorType(XmlAccessType.FIELD)
public class OutputDefinition<Type extends ProcessorDefinition<Type>> extends ProcessorDefinition<Type> {
@XmlElementRef
- protected List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ protected List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
@@ -42,7 +42,7 @@
return true;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
if (outputs != null) {
for (ProcessorDefinition<?> output : outputs) {
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index e672a4a..457adc2 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -77,7 +77,7 @@
* @version
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
-public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>> extends OptionalIdentifiedDefinition<Type> implements Block {
+public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>> extends OptionalIdentifiedDefinition implements Block {
protected final transient Logger log = LoggerFactory.getLogger(getClass());
protected Boolean inheritErrorHandler;
private NodeFactory nodeFactory;
@@ -89,7 +89,7 @@
private Map<QName, Object> otherAttributes;
// else to use an optional attribute in JAXB2
- public abstract List<ProcessorDefinition<?>> getOutputs();
+ public abstract List<ProcessorDefinition> getOutputs();
public abstract boolean isOutputSupported();
@@ -126,7 +126,7 @@
* Prefer to use {#link #createChildProcessor}.
*/
public Processor createOutputsProcessor(RouteContext routeContext) throws Exception {
- Collection<ProcessorDefinition<?>> outputs = getOutputs();
+ Collection<ProcessorDefinition> outputs = getOutputs();
return createOutputsProcessor(routeContext, outputs);
}
@@ -155,8 +155,7 @@
return children;
}
- @Override
- public void addOutput(ProcessorDefinition<?> output) {
+ public void addOutput(ProcessorDefinition output) {
if (!blocks.isEmpty()) {
// let the Block deal with the output
Block block = blocks.getLast();
@@ -217,7 +216,7 @@
return wrapChannel(routeContext, processor, null);
}
- protected Processor wrapChannel(RouteContext routeContext, Processor processor, ProcessorDefinition<?> child) throws Exception {
+ protected Processor wrapChannel(RouteContext routeContext, Processor processor, ProcessorDefinition child) throws Exception {
// put a channel in between this and each output to control the route flow logic
ModelChannel channel = createChannel(routeContext);
channel.setNextProcessor(processor);
@@ -228,7 +227,7 @@
addInterceptStrategies(routeContext, channel, this.getInterceptStrategies());
// must do this ugly cast to avoid compiler error on AIX/HP-UX
- ProcessorDefinition<?> defn = (ProcessorDefinition<?>) this;
+ ProcessorDefinition defn = (ProcessorDefinition) this;
// set the child before init the channel
channel.setChildDefinition(child);
@@ -365,7 +364,7 @@
return new DefaultChannel();
}
- protected Processor createOutputsProcessor(RouteContext routeContext, Collection<ProcessorDefinition<?>> outputs) throws Exception {
+ protected Processor createOutputsProcessor(RouteContext routeContext, Collection<ProcessorDefinition> outputs) throws Exception {
List<Processor> list = new ArrayList<Processor>();
for (ProcessorDefinition<?> output : outputs) {
@@ -419,7 +418,7 @@
resolveKnownConstantFields(this);
// also resolve properties and constant fields on embedded expressions
- ProcessorDefinition<?> me = (ProcessorDefinition<?>) this;
+ ProcessorDefinition me = (ProcessorDefinition) this;
if (me instanceof ExpressionNode) {
ExpressionNode exp = (ExpressionNode) me;
ExpressionDefinition expressionDefinition = exp.getExpression();
@@ -464,12 +463,12 @@
log.trace("Resolving property placeholders for: {}", definition);
// find all getter/setter which we can use for property placeholders
- Map<String, Object> properties = new HashMap<String, Object>();
+ Map<Object, Object> properties = new HashMap<Object, Object>();
IntrospectionSupport.getProperties(definition, properties, null);
- ProcessorDefinition<?> processorDefinition = null;
+ ProcessorDefinition processorDefinition = null;
if (definition instanceof ProcessorDefinition) {
- processorDefinition = (ProcessorDefinition<?>) definition;
+ processorDefinition = (ProcessorDefinition) definition;
}
// include additional properties which have the Camel placeholder QName
// and when the definition parameter is this (otherAttributes belong to this)
@@ -504,9 +503,9 @@
if (!properties.isEmpty()) {
log.trace("There are {} properties on: {}", properties.size(), definition);
// lookup and resolve properties for String based properties
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
+ for (Map.Entry entry : properties.entrySet()) {
// the name is always a String
- String name = entry.getKey();
+ String name = (String) entry.getKey();
Object value = entry.getValue();
if (value instanceof String) {
// value must be a String, as a String is the key for a property placeholder
@@ -539,15 +538,16 @@
log.trace("Resolving known fields for: {}", definition);
// find all String getter/setter
- Map<String, Object> properties = new HashMap<String, Object>();
+ Map<Object, Object> properties = new HashMap<Object, Object>();
IntrospectionSupport.getProperties(definition, properties, null);
if (!properties.isEmpty()) {
log.trace("There are {} properties on: {}", properties.size(), definition);
// lookup and resolve known constant fields for String based properties
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- String name = entry.getKey();
+ for (Map.Entry entry : properties.entrySet()) {
+ // the name is always a String
+ String name = (String) entry.getKey();
Object value = entry.getValue();
if (value instanceof String) {
// we can only resolve String typed values
@@ -584,7 +584,7 @@
*
* @param output the child to be added as output to this
*/
- protected void configureChild(ProcessorDefinition<?> output) {
+ protected void configureChild(ProcessorDefinition output) {
// noop
}
@@ -973,10 +973,10 @@
// set it on last output as this is what the user means to do
// for Block(s) with non empty getOutputs() the id probably refers
// to the last definition in the current Block
- List<ProcessorDefinition<?>> outputs = getOutputs();
+ List<ProcessorDefinition> outputs = getOutputs();
if (!blocks.isEmpty()) {
if (blocks.getLast() instanceof ProcessorDefinition) {
- ProcessorDefinition<?> block = (ProcessorDefinition<?>)blocks.getLast();
+ ProcessorDefinition block = (ProcessorDefinition)blocks.getLast();
if (!block.getOutputs().isEmpty()) {
outputs = block.getOutputs();
}
@@ -996,7 +996,7 @@
*/
@SuppressWarnings("unchecked")
public Type routeId(String id) {
- ProcessorDefinition<?> def = this;
+ ProcessorDefinition def = this;
RouteDefinition route = ProcessorDefinitionHelper.getRoute(def);
if (route != null) {
@@ -1163,9 +1163,9 @@
*
* @return the builder
*/
- public ProcessorDefinition<?> end() {
+ public ProcessorDefinition end() {
// must do this ugly cast to avoid compiler error on AIX/HP-UX
- ProcessorDefinition<?> defn = (ProcessorDefinition<?>) this;
+ ProcessorDefinition defn = (ProcessorDefinition) this;
// when using doTry .. doCatch .. doFinally we should always
// end the try definition to avoid having to use 2 x end() in the route
@@ -1195,7 +1195,7 @@
*
* @return the end
*/
- public ProcessorDefinition<?> endParent() {
+ public ProcessorDefinition endParent() {
return this;
}
@@ -1205,7 +1205,7 @@
* @return the builder
*/
public ChoiceDefinition endChoice() {
- ProcessorDefinition<?> def = end();
+ ProcessorDefinition def = end();
if (def instanceof WhenDefinition) {
return (ChoiceDefinition) def.getParent();
} else if (def instanceof OtherwiseDefinition) {
@@ -1540,7 +1540,7 @@
@SuppressWarnings("unchecked")
@Deprecated
public Type routingSlip(String header, String uriDelimiter) {
- RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<Type>(header, uriDelimiter);
+ RoutingSlipDefinition answer = new RoutingSlipDefinition(header, uriDelimiter);
addOutput(answer);
return (Type) this;
}
@@ -1562,7 +1562,7 @@
@SuppressWarnings("unchecked")
@Deprecated
public Type routingSlip(String header) {
- RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<Type>(header);
+ RoutingSlipDefinition answer = new RoutingSlipDefinition(header);
addOutput(answer);
return (Type) this;
}
@@ -1586,7 +1586,7 @@
@SuppressWarnings("unchecked")
@Deprecated
public Type routingSlip(String header, String uriDelimiter, boolean ignoreInvalidEndpoints) {
- RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<Type>(header, uriDelimiter);
+ RoutingSlipDefinition answer = new RoutingSlipDefinition(header, uriDelimiter);
answer.setIgnoreInvalidEndpoints(ignoreInvalidEndpoints);
addOutput(answer);
return (Type) this;
@@ -1611,7 +1611,7 @@
@SuppressWarnings("unchecked")
@Deprecated
public Type routingSlip(String header, boolean ignoreInvalidEndpoints) {
- RoutingSlipDefinition<Type> answer = new RoutingSlipDefinition<Type>(header);
+ RoutingSlipDefinition answer = new RoutingSlipDefinition(header);
answer.setIgnoreInvalidEndpoints(ignoreInvalidEndpoints);
addOutput(answer);
return (Type) this;
@@ -2261,7 +2261,7 @@
* @param exceptionType the exception to catch
* @return the exception builder to configure
*/
- public OnExceptionDefinition onException(Class<? extends Throwable> exceptionType) {
+ public OnExceptionDefinition onException(Class exceptionType) {
OnExceptionDefinition answer = new OnExceptionDefinition(exceptionType);
addOutput(answer);
return answer;
@@ -2274,7 +2274,7 @@
* @param exceptions list of exceptions to catch
* @return the exception builder to configure
*/
- public OnExceptionDefinition onException(Class<? extends Throwable>... exceptions) {
+ public OnExceptionDefinition onException(Class... exceptions) {
OnExceptionDefinition answer = new OnExceptionDefinition(Arrays.asList(exceptions));
addOutput(answer);
return answer;
@@ -2409,7 +2409,7 @@
* @return the builder
*/
@SuppressWarnings("unchecked")
- public Type bean(Class<?> beanType) {
+ public Type bean(Class beanType) {
BeanDefinition answer = new BeanDefinition();
answer.setBeanType(beanType.getName());
addOutput(answer);
@@ -2425,7 +2425,7 @@
* @return the builder
*/
@SuppressWarnings("unchecked")
- public Type bean(Class<?> beanType, String method) {
+ public Type bean(Class beanType, String method) {
BeanDefinition answer = new BeanDefinition();
answer.setBeanType(beanType.getName());
answer.setMethod(method);
@@ -2697,7 +2697,7 @@
* @return the builder
*/
@SuppressWarnings("unchecked")
- public Type convertBodyTo(Class<?> type) {
+ public Type convertBodyTo(Class type) {
addOutput(new ConvertBodyDefinition(type));
return (Type) this;
}
@@ -2710,7 +2710,7 @@
* @return the builder
*/
@SuppressWarnings("unchecked")
- public Type convertBodyTo(Class<?> type, String charset) {
+ public Type convertBodyTo(Class type, String charset) {
addOutput(new ConvertBodyDefinition(type, charset));
return (Type) this;
}
@@ -2733,8 +2733,8 @@
* @return the builder
*/
@SuppressWarnings("unchecked")
- public <T> Type sort(Expression expression, Comparator<T> comparator) {
- addOutput(new SortDefinition<T>(expression, comparator));
+ public Type sort(Expression expression, Comparator comparator) {
+ addOutput(new SortDefinition(expression, comparator));
return (Type) this;
}
@@ -2743,8 +2743,8 @@
*
* @return the builder
*/
- public <T> ExpressionClause<SortDefinition<T>> sort() {
- SortDefinition<T> answer = new SortDefinition<T>();
+ public ExpressionClause<SortDefinition> sort() {
+ SortDefinition answer = new SortDefinition();
addOutput(answer);
return ExpressionClause.createAndSetExpression(answer);
}
@@ -3074,7 +3074,7 @@
setInheritErrorHandler(inheritErrorHandler);
} else {
// configure on last output as its the intended
- ProcessorDefinition<?> output = getOutputs().get(size - 1);
+ ProcessorDefinition output = getOutputs().get(size - 1);
if (output != null) {
output.setInheritErrorHandler(inheritErrorHandler);
}
@@ -3085,11 +3085,11 @@
// Properties
// -------------------------------------------------------------------------
@XmlTransient
- public ProcessorDefinition<?> getParent() {
+ public ProcessorDefinition getParent() {
return parent;
}
- public void setParent(ProcessorDefinition<?> parent) {
+ public void setParent(ProcessorDefinition parent) {
this.parent = parent;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
index 34441d3..038e89e 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
@@ -22,7 +22,6 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
-import org.apache.camel.NoSuchBeanException;
import org.apache.camel.spi.ExecutorServiceManager;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.spi.ThreadPoolProfile;
@@ -43,7 +42,7 @@
* @param type the type to look for
* @return the found definitions, or <tt>null</tt> if not found
*/
- public static <T> Iterator<T> filterTypeInOutputs(List<ProcessorDefinition<?>> outputs, Class<T> type) {
+ public static <T> Iterator<T> filterTypeInOutputs(List<ProcessorDefinition> outputs, Class<T> type) {
List<T> found = new ArrayList<T>();
doFindType(outputs, type, found);
return found.iterator();
@@ -57,7 +56,7 @@
* @param type the type to look for
* @return the first found type, or <tt>null</tt> if not found
*/
- public static <T> T findFirstTypeInOutputs(List<ProcessorDefinition<?>> outputs, Class<T> type) {
+ public static <T> T findFirstTypeInOutputs(List<ProcessorDefinition> outputs, Class<T> type) {
List<T> found = new ArrayList<T>();
doFindType(outputs, type, found);
if (found.isEmpty()) {
@@ -123,7 +122,7 @@
return null;
}
- ProcessorDefinition<?> def = node;
+ ProcessorDefinition def = node;
// drill to the top
while (def != null && def.getParent() != null) {
def = def.getParent();
@@ -138,8 +137,8 @@
}
- @SuppressWarnings({"unchecked", "rawtypes"})
- private static <T> void doFindType(List<ProcessorDefinition<?>> outputs, Class<T> type, List<T> found) {
+ @SuppressWarnings("unchecked")
+ private static <T> void doFindType(List<ProcessorDefinition> outputs, Class<T> type, List<T> found) {
if (outputs == null || outputs.isEmpty()) {
return;
}
@@ -152,7 +151,7 @@
// send is much common
if (out instanceof SendDefinition) {
SendDefinition send = (SendDefinition) out;
- List<ProcessorDefinition<?>> children = send.getOutputs();
+ List<ProcessorDefinition> children = send.getOutputs();
doFindType(children, type, found);
}
@@ -160,19 +159,19 @@
if (out instanceof ChoiceDefinition) {
ChoiceDefinition choice = (ChoiceDefinition) out;
for (WhenDefinition when : choice.getWhenClauses()) {
- List<ProcessorDefinition<?>> children = when.getOutputs();
+ List<ProcessorDefinition> children = when.getOutputs();
doFindType(children, type, found);
}
// otherwise is optional
if (choice.getOtherwise() != null) {
- List<ProcessorDefinition<?>> children = choice.getOtherwise().getOutputs();
+ List<ProcessorDefinition> children = choice.getOtherwise().getOutputs();
doFindType(children, type, found);
}
}
// try children as well
- List<ProcessorDefinition<?>> children = out.getOutputs();
+ List<ProcessorDefinition> children = out.getOutputs();
doFindType(children, type, found);
}
}
@@ -186,8 +185,8 @@
* @param excludeAbstract whether or not to exclude abstract outputs (e.g. skip onException etc.)
* @return <tt>true</tt> if has outputs, otherwise <tt>false</tt> is returned
*/
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static boolean hasOutputs(List<ProcessorDefinition<?>> outputs, boolean excludeAbstract) {
+ @SuppressWarnings("unchecked")
+ public static boolean hasOutputs(List<ProcessorDefinition> outputs, boolean excludeAbstract) {
if (outputs == null || outputs.isEmpty()) {
return false;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
index 6f97e82..8e15e42 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RecipientListDefinition.java
@@ -44,7 +44,7 @@
*/
@XmlRootElement(name = "recipientList")
@XmlAccessorType(XmlAccessType.FIELD)
-public class RecipientListDefinition<Type extends ProcessorDefinition<Type>> extends NoOutputExpressionNode implements ExecutorServiceAwareDefinition<RecipientListDefinition<Type>> {
+public class RecipientListDefinition<Type extends ProcessorDefinition> extends NoOutputExpressionNode implements ExecutorServiceAwareDefinition<RecipientListDefinition> {
@XmlTransient
private AggregationStrategy aggregationStrategy;
@XmlTransient
diff --git a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
index 4e8f952..b34d341 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java
@@ -60,7 +60,7 @@
@Required
private ExpressionDefinition expression;
@XmlElementRef
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
public ResequenceDefinition() {
}
@@ -70,11 +70,11 @@
return "resequence";
}
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/RouteContextRefDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RouteContextRefDefinition.java
index 12e59cf..5eb8d91 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteContextRefDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteContextRefDefinition.java
@@ -53,7 +53,7 @@
this.ref = ref;
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public List<RouteDefinition> lookupRoutes(CamelContext camelContext) {
ObjectHelper.notNull(camelContext, "camelContext", this);
ObjectHelper.notNull(ref, "ref", this);
diff --git a/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
index 34a0dc8..0bd4005 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
@@ -63,7 +63,7 @@
public class RouteDefinition extends ProcessorDefinition<RouteDefinition> {
private final AtomicBoolean prepared = new AtomicBoolean(false);
private List<FromDefinition> inputs = new ArrayList<FromDefinition>();
- private List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>();
+ private List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
private String group;
private String streamCache;
private String trace;
@@ -548,16 +548,16 @@
this.inputs = inputs;
}
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return outputs;
}
@XmlElementRef
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
this.outputs = outputs;
if (outputs != null) {
- for (ProcessorDefinition<?> output : outputs) {
+ for (ProcessorDefinition output : outputs) {
configureChild(output);
}
}
@@ -733,6 +733,7 @@
// Implementation methods
// -------------------------------------------------------------------------
+ @SuppressWarnings("unchecked")
protected RouteContext addRoutes(CamelContext camelContext, Collection<Route> routes, FromDefinition fromType) throws Exception {
RouteContext routeContext = new DefaultRouteContext(camelContext, this, fromType, routes);
@@ -845,8 +846,8 @@
throw new FailedToCreateRouteException(route.getId(), route.toString(), at, cause);
}
- List<ProcessorDefinition<?>> list = new ArrayList<ProcessorDefinition<?>>(outputs);
- for (ProcessorDefinition<?> output : list) {
+ List<ProcessorDefinition> list = new ArrayList<ProcessorDefinition>(outputs);
+ for (ProcessorDefinition output : list) {
try {
output.addRoutes(routeContext, routes);
} catch (Exception e) {
diff --git a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index 290dd78..89b9dc3 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -30,12 +30,12 @@
* Utility methods to help preparing {@link RouteDefinition} before they are added to
* {@link org.apache.camel.CamelContext}.
*/
-@SuppressWarnings({"unchecked", "rawtypes", "deprecation"})
public final class RouteDefinitionHelper {
private RouteDefinitionHelper() {
}
+ @SuppressWarnings("unchecked")
public static void initParent(ProcessorDefinition parent) {
List<ProcessorDefinition> children = parent.getOutputs();
for (ProcessorDefinition child : children) {
@@ -47,6 +47,7 @@
}
}
+ @SuppressWarnings("unchecked")
private static void initParentAndErrorHandlerBuilder(ProcessorDefinition parent) {
List<ProcessorDefinition> children = parent.getOutputs();
for (ProcessorDefinition child : children) {
@@ -58,8 +59,8 @@
}
}
- public static void prepareRouteForInit(RouteDefinition route, List<ProcessorDefinition<?>> abstracts,
- List<ProcessorDefinition<?>> lower) {
+ public static void prepareRouteForInit(RouteDefinition route, List<ProcessorDefinition> abstracts,
+ List<ProcessorDefinition> lower) {
// filter the route into abstracts and lower
for (ProcessorDefinition output : route.getOutputs()) {
if (output.isAbstract()) {
@@ -103,13 +104,13 @@
List<OnCompletionDefinition> onCompletions) {
// abstracts is the cross cutting concerns
- List<ProcessorDefinition<?>> abstracts = new ArrayList<ProcessorDefinition<?>>();
+ List<ProcessorDefinition> abstracts = new ArrayList<ProcessorDefinition>();
// upper is the cross cutting concerns such as interceptors, error handlers etc
- List<ProcessorDefinition<?>> upper = new ArrayList<ProcessorDefinition<?>>();
+ List<ProcessorDefinition> upper = new ArrayList<ProcessorDefinition>();
// lower is the regular route
- List<ProcessorDefinition<?>> lower = new ArrayList<ProcessorDefinition<?>>();
+ List<ProcessorDefinition> lower = new ArrayList<ProcessorDefinition>();
RouteDefinitionHelper.prepareRouteForInit(route, abstracts, lower);
@@ -156,8 +157,9 @@
}
}
+ @SuppressWarnings("deprecation")
private static void initParentAndErrorHandlerBuilder(ModelCamelContext context, RouteDefinition route,
- List<ProcessorDefinition<?>> abstracts, List<OnExceptionDefinition> onExceptions) {
+ List<ProcessorDefinition> abstracts, List<OnExceptionDefinition> onExceptions) {
if (context != null) {
// let the route inherit the error handler builder from camel context if none already set
@@ -176,7 +178,7 @@
}
}
- private static void initOnExceptions(List<ProcessorDefinition<?>> abstracts, List<ProcessorDefinition<?>> upper,
+ private static void initOnExceptions(List<ProcessorDefinition> abstracts, List<ProcessorDefinition> upper,
List<OnExceptionDefinition> onExceptions) {
// add global on exceptions if any
if (onExceptions != null && !onExceptions.isEmpty()) {
@@ -207,7 +209,7 @@
}
private static void initInterceptors(CamelContext context, RouteDefinition route,
- List<ProcessorDefinition<?>> abstracts, List<ProcessorDefinition<?>> upper,
+ List<ProcessorDefinition> abstracts, List<ProcessorDefinition> upper,
List<InterceptDefinition> intercepts,
List<InterceptFromDefinition> interceptFromDefinitions,
List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions) {
@@ -235,7 +237,7 @@
doInitInterceptors(context, route, upper, intercepts, interceptFromDefinitions, interceptSendToEndpointDefinitions);
}
- private static void doInitInterceptors(CamelContext context, RouteDefinition route, List<ProcessorDefinition<?>> upper,
+ private static void doInitInterceptors(CamelContext context, RouteDefinition route, List<ProcessorDefinition> upper,
List<InterceptDefinition> intercepts,
List<InterceptFromDefinition> interceptFromDefinitions,
List<InterceptSendToEndpointDefinition> interceptSendToEndpointDefinitions) {
@@ -301,7 +303,7 @@
}
}
- private static void initOnCompletions(List<ProcessorDefinition<?>> abstracts, List<ProcessorDefinition<?>> upper,
+ private static void initOnCompletions(List<ProcessorDefinition> abstracts, List<ProcessorDefinition> upper,
List<OnCompletionDefinition> onCompletions) {
List<OnCompletionDefinition> completions = new ArrayList<OnCompletionDefinition>();
@@ -329,11 +331,11 @@
upper.addAll(completions);
}
- private static void initTransacted(List<ProcessorDefinition<?>> abstracts, List<ProcessorDefinition<?>> lower) {
+ private static void initTransacted(List<ProcessorDefinition> abstracts, List<ProcessorDefinition> lower) {
TransactedDefinition transacted = null;
// add to correct type
- for (ProcessorDefinition<?> type : abstracts) {
+ for (ProcessorDefinition type : abstracts) {
if (type instanceof TransactedDefinition) {
if (transacted == null) {
transacted = (TransactedDefinition) type;
@@ -361,6 +363,7 @@
* @param context the camel context
* @param processor the node
*/
+ @SuppressWarnings("unchecked")
public static void forceAssignIds(CamelContext context, ProcessorDefinition processor) {
// force id on the child
processor.idOrCreate(context.getNodeIdFactory());
diff --git a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
index d84ae97..431bf5c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
@@ -264,7 +264,7 @@
* @param exception the exception
* @return the builder
*/
- public OnExceptionDefinition onException(Class<? extends Throwable> exception) {
+ public OnExceptionDefinition onException(Class exception) {
OnExceptionDefinition answer = new OnExceptionDefinition(exception);
getOnExceptions().add(answer);
return answer;
diff --git a/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
index 0eb76de..dd02ea5 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RoutingSlipDefinition.java
@@ -35,7 +35,7 @@
*/
@XmlRootElement(name = "routingSlip")
@XmlAccessorType(XmlAccessType.FIELD)
-public class RoutingSlipDefinition<Type extends ProcessorDefinition<Type>> extends NoOutputExpressionNode {
+public class RoutingSlipDefinition<Type extends ProcessorDefinition> extends NoOutputExpressionNode {
public static final String DEFAULT_DELIMITER = ",";
@XmlAttribute
@@ -93,7 +93,7 @@
}
@Override
- public List<ProcessorDefinition<?>> getOutputs() {
+ public List<ProcessorDefinition> getOutputs() {
return Collections.emptyList();
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/SortDefinition.java b/camel-core/src/main/java/org/apache/camel/model/SortDefinition.java
index 55f61ae..875520c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/SortDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/SortDefinition.java
@@ -37,9 +37,9 @@
*/
@XmlRootElement(name = "sort")
@XmlAccessorType(XmlAccessType.FIELD)
-public class SortDefinition<T> extends NoOutputExpressionNode {
+public class SortDefinition extends NoOutputExpressionNode {
@XmlTransient
- private Comparator<? super T> comparator;
+ private Comparator<Object> comparator;
@XmlAttribute
private String comparatorRef;
@@ -50,7 +50,7 @@
setExpression(new ExpressionDefinition(expression));
}
- public SortDefinition(Expression expression, Comparator<? super T> comparator) {
+ public SortDefinition(Expression expression, Comparator<Object> comparator) {
this(expression);
this.comparator = comparator;
}
@@ -80,8 +80,8 @@
// if no comparator then default on to string representation
if (comparator == null) {
- comparator = new Comparator<T>() {
- public int compare(T o1, T o2) {
+ comparator = new Comparator<Object>() {
+ public int compare(Object o1, Object o2) {
return ObjectHelper.compare(o1, o2);
}
};
@@ -94,14 +94,14 @@
} else {
exp = getExpression().createExpression(routeContext);
}
- return new SortProcessor<T>(exp, getComparator());
+ return new SortProcessor(exp, getComparator());
}
- public Comparator<? super T> getComparator() {
+ public Comparator<Object> getComparator() {
return comparator;
}
- public void setComparator(Comparator<T> comparator) {
+ public void setComparator(Comparator<Object> comparator) {
this.comparator = comparator;
}
@@ -119,7 +119,7 @@
* @param comparator the comparator to use for sorting
* @return the builder
*/
- public SortDefinition<T> comparator(Comparator<T> comparator) {
+ public SortDefinition comparator(Comparator<Object> comparator) {
setComparator(comparator);
return this;
}
@@ -130,7 +130,7 @@
* @param ref reference for the comparator
* @return the builder
*/
- public SortDefinition<T> comparatorRef(String ref) {
+ public SortDefinition comparatorRef(String ref) {
setComparatorRef(ref);
return this;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
index 7c01955..86ddcf6 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
@@ -34,7 +34,7 @@
*/
@XmlRootElement(name = "threadPoolProfile")
@XmlAccessorType(XmlAccessType.FIELD)
-public class ThreadPoolProfileDefinition extends OptionalIdentifiedDefinition<ThreadPoolProfileDefinition> {
+public class ThreadPoolProfileDefinition extends OptionalIdentifiedDefinition {
@XmlAttribute
private Boolean defaultProfile;
@XmlAttribute
diff --git a/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
index 3e65901..a43a690 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
@@ -102,7 +102,6 @@
} else {
thread.setCallerRunsWhenRejected(getCallerRunsWhenRejected());
}
- thread.setRejectedPolicy(getRejectedPolicy());
List<Processor> pipe = new ArrayList<Processor>(2);
pipe.add(thread);
diff --git a/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java b/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
index 81632f7..9950cc7 100644
--- a/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
@@ -159,6 +159,7 @@
return doResolvePolicy(routeContext, getRef(), type);
}
+ @SuppressWarnings("unchecked")
protected static Policy doResolvePolicy(RouteContext routeContext, String ref, Class<? extends Policy> type) {
// explicit ref given so lookup by it
if (ObjectHelper.isNotEmpty(ref)) {
@@ -171,7 +172,7 @@
Policy answer = null;
if (type != null) {
// try find by type, note that this method is not supported by all registry
- Map<String, ?> types = routeContext.lookupByType(type);
+ Map types = routeContext.lookupByType(type);
if (types.size() == 1) {
// only one policy defined so use it
Object found = types.values().iterator().next();
@@ -190,10 +191,10 @@
// this logic only applies if we are a transacted policy
// still no policy found then try lookup the platform transaction manager and use it as policy
if (answer == null && type == TransactedPolicy.class) {
- Class<?> tmClazz = routeContext.getCamelContext().getClassResolver().resolveClass("org.springframework.transaction.PlatformTransactionManager");
+ Class tmClazz = routeContext.getCamelContext().getClassResolver().resolveClass("org.springframework.transaction.PlatformTransactionManager");
if (tmClazz != null) {
// see if we can find the platform transaction manager in the registry
- Map<String, ?> maps = routeContext.lookupByType(tmClazz);
+ Map<String, Object> maps = routeContext.lookupByType(tmClazz);
if (maps.size() == 1) {
// only one platform manager then use it as default and create a transacted
// policy with it and default to required
@@ -204,7 +205,7 @@
// use reflection as performance is no a concern during route building
Object transactionManager = maps.values().iterator().next();
LOG.debug("One instance of PlatformTransactionManager found in registry: {}", transactionManager);
- Class<?> txClazz = routeContext.getCamelContext().getClassResolver().resolveClass("org.apache.camel.spring.spi.SpringTransactionPolicy");
+ Class txClazz = routeContext.getCamelContext().getClassResolver().resolveClass("org.apache.camel.spring.spi.SpringTransactionPolicy");
if (txClazz != null) {
LOG.debug("Creating a new temporary SpringTransactionPolicy using the PlatformTransactionManager: {}", transactionManager);
TransactedPolicy txPolicy = ObjectHelper.newInstance(txClazz, TransactedPolicy.class);
diff --git a/camel-core/src/main/java/org/apache/camel/model/TryDefinition.java b/camel-core/src/main/java/org/apache/camel/model/TryDefinition.java
index 514edb9..6e3c05a 100644
--- a/camel-core/src/main/java/org/apache/camel/model/TryDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/TryDefinition.java
@@ -33,6 +33,7 @@
import org.apache.camel.processor.CatchProcessor;
import org.apache.camel.processor.TryProcessor;
import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ExpressionToPredicateAdapter;
/**
@@ -50,7 +51,7 @@
@XmlTransient
private boolean initialized;
@XmlTransient
- private List<ProcessorDefinition<?>> outputsWithoutCatches;
+ private List<ProcessorDefinition> outputsWithoutCatches;
public TryDefinition() {
}
@@ -96,28 +97,14 @@
// -------------------------------------------------------------------------
/**
- * Handles the given exception
- *
- * @param exceptionType the exception
- * @return the try builder
- */
- @SuppressWarnings("unchecked")
- public TryDefinition doCatch(Class<? extends Throwable> exceptionType) {
- // this method is introduced to avoid compiler warnings about the
- // generic Class arrays in the case we've got only one single Class
- // to build a TryDefinition for
- return doCatch(new Class[] {exceptionType});
- }
-
- /**
* Handles the given exception(s)
*
* @param exceptionType the exception(s)
* @return the try builder
*/
- public TryDefinition doCatch(Class<? extends Throwable>... exceptionType) {
+ public TryDefinition doCatch(Class... exceptionType) {
popBlock();
- List<Class<? extends Throwable>> list = Arrays.asList(exceptionType);
+ List<Class> list = CastUtils.cast(Arrays.asList(exceptionType));
CatchDefinition answer = new CatchDefinition(list);
addOutput(answer);
pushBlock(answer);
@@ -223,20 +210,20 @@
return finallyClause;
}
- public List<ProcessorDefinition<?>> getOutputsWithoutCatches() {
+ public List<ProcessorDefinition> getOutputsWithoutCatches() {
if (outputsWithoutCatches == null) {
checkInitialized();
}
return outputsWithoutCatches;
}
- public void setOutputs(List<ProcessorDefinition<?>> outputs) {
+ public void setOutputs(List<ProcessorDefinition> outputs) {
initialized = false;
super.setOutputs(outputs);
}
@Override
- public void addOutput(ProcessorDefinition<?> output) {
+ public void addOutput(ProcessorDefinition output) {
initialized = false;
super.addOutput(output);
}
@@ -247,11 +234,11 @@
protected void checkInitialized() {
if (!initialized) {
initialized = true;
- outputsWithoutCatches = new ArrayList<ProcessorDefinition<?>>();
+ outputsWithoutCatches = new ArrayList<ProcessorDefinition>();
catchClauses = new ArrayList<CatchDefinition>();
finallyClause = null;
- for (ProcessorDefinition<?> output : outputs) {
+ for (ProcessorDefinition output : outputs) {
if (output instanceof CatchDefinition) {
catchClauses.add((CatchDefinition)output);
} else if (output instanceof FinallyDefinition) {
diff --git a/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java b/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
index e63e5d5..a9fa060 100644
--- a/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/UnmarshalDefinition.java
@@ -24,8 +24,6 @@
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.camel.Processor;
-import org.apache.camel.model.dataformat.AvroDataFormat;
-import org.apache.camel.model.dataformat.BeanioDataFormat;
import org.apache.camel.model.dataformat.BindyDataFormat;
import org.apache.camel.model.dataformat.CastorDataFormat;
import org.apache.camel.model.dataformat.CryptoDataFormat;
@@ -69,8 +67,6 @@
private String ref;
// cannot use @XmlElementRef as it doesn't allow optional properties
@XmlElements({
- @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
- @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
@XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
@XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
@XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
diff --git a/camel-core/src/main/java/org/apache/camel/model/WhenDefinition.java b/camel-core/src/main/java/org/apache/camel/model/WhenDefinition.java
index 2e35f0f..ce37173 100644
--- a/camel-core/src/main/java/org/apache/camel/model/WhenDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/WhenDefinition.java
@@ -78,7 +78,7 @@
}
@Override
- public ProcessorDefinition<?> endParent() {
+ public ProcessorDefinition endParent() {
// when using when in the DSL we don't want to end back to this when, but instead
// the parent of this, so return the parent
return this.getParent();
diff --git a/camel-core/src/main/java/org/apache/camel/model/WhenSkipSendToEndpointDefinition.java b/camel-core/src/main/java/org/apache/camel/model/WhenSkipSendToEndpointDefinition.java
deleted file mode 100644
index d276d06..0000000
--- a/camel-core/src/main/java/org/apache/camel/model/WhenSkipSendToEndpointDefinition.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.model;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Predicate;
-import org.apache.camel.spi.RouteContext;
-
-/**
- *
- */
-public class WhenSkipSendToEndpointDefinition extends WhenDefinition {
-
- @Override
- protected Predicate createPredicate(RouteContext routeContext) {
- // we need to keep track whether the when matches or not, so delegate
- // the predicate and add the matches result as a property on the exchange
- final Predicate delegate = super.createPredicate(routeContext);
- return new Predicate() {
- @Override
- public boolean matches(Exchange exchange) {
- boolean matches = delegate.matches(exchange);
- exchange.setProperty(Exchange.INTERCEPT_SEND_TO_ENDPOINT_WHEN_MATCHED, matches);
- return matches;
- }
-
- @Override
- public String toString() {
- return delegate.toString();
- }
- };
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java b/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
index c471bad..20aeaf0 100644
--- a/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/WireTapDefinition.java
@@ -41,7 +41,7 @@
*/
@XmlRootElement(name = "wireTap")
@XmlAccessorType(XmlAccessType.FIELD)
-public class WireTapDefinition<Type extends ProcessorDefinition<Type>> extends NoOutputDefinition<Type> implements ExecutorServiceAwareDefinition<WireTapDefinition<Type>> {
+public class WireTapDefinition<Type extends ProcessorDefinition> extends NoOutputDefinition implements ExecutorServiceAwareDefinition<ProcessorDefinition> {
@XmlAttribute
protected String uri;
@XmlAttribute
@@ -144,7 +144,7 @@
}
@Override
- public void addOutput(ProcessorDefinition<?> output) {
+ public void addOutput(ProcessorDefinition output) {
// add outputs on parent as this wiretap does not support outputs
getParent().addOutput(output);
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
deleted file mode 100644
index dcd4242..0000000
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/AvroDataFormat.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.model.dataformat;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.spi.DataFormat;
-
-/**
- * Represents a avro DataFormat {@link org.apache.camel.spi.DataFormat}
- *
- * @version
- */
-@XmlRootElement(name = "avro")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class AvroDataFormat extends DataFormatDefinition {
- @XmlAttribute
- private String instanceClassName;
- @XmlTransient
- private Object schema;
-
- public AvroDataFormat() {
- super("avro");
- }
-
- public AvroDataFormat(String instanceClassName) {
- this();
- setInstanceClassName(instanceClassName);
- }
-
- public String getInstanceClassName() {
- return instanceClassName;
- }
-
- public void setInstanceClassName(String instanceClassName) {
- this.instanceClassName = instanceClassName;
- }
-
- public Object getSchema() {
- return schema;
- }
-
- public void setSchema(Object schema) {
- this.schema = schema;
- }
-
- @Override
- protected void configureDataFormat(DataFormat dataFormat) {
- if (this.instanceClassName != null) {
- setProperty(dataFormat, "instanceClass", instanceClassName);
- }
- if (this.schema != null) {
- setProperty(dataFormat, "schema", schema);
- }
- }
-}
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
deleted file mode 100644
index a9c84c4..0000000
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/BeanioDataFormat.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.model.dataformat;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.spi.DataFormat;
-
-/**
- * Represents the BeanIO {@link org.apache.camel.spi.DataFormat}
- *
- * @version
- */
-@XmlRootElement(name = "beanio")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class BeanioDataFormat extends DataFormatDefinition {
-
- @XmlAttribute(required = true)
- private String mapping;
- @XmlAttribute(required = true)
- private String streamName;
- @XmlAttribute
- private Boolean ignoreUnidentifiedRecords;
- @XmlAttribute
- private Boolean ignoreUnexpectedRecords;
- @XmlAttribute
- private Boolean ignoreInvalidRecords;
- @XmlAttribute
- private String encoding;
-
- public BeanioDataFormat() {
- super("beanio");
- }
-
- @Override
- protected void configureDataFormat(DataFormat dataFormat) {
- setProperty(dataFormat, "mapping", mapping);
- setProperty(dataFormat, "streamName", streamName);
- if (ignoreUnidentifiedRecords != null) {
- setProperty(dataFormat, "ignoreUnidentifiedRecords", ignoreUnidentifiedRecords);
- }
- if (ignoreUnexpectedRecords != null) {
- setProperty(dataFormat, "ignoreUnexpectedRecords", ignoreUnexpectedRecords);
- }
- if (ignoreInvalidRecords != null) {
- setProperty(dataFormat, "ignoreInvalidRecords", ignoreInvalidRecords);
- }
- if (encoding != null) {
- setProperty(dataFormat, "encoding", encoding);
- }
- }
-
- public String getMapping() {
- return mapping;
- }
-
- public void setMapping(String mapping) {
- this.mapping = mapping;
- }
-
- public String getStreamName() {
- return streamName;
- }
-
- public void setStreamName(String streamName) {
- this.streamName = streamName;
- }
-
- public Boolean getIgnoreUnidentifiedRecords() {
- return ignoreUnidentifiedRecords;
- }
-
- public void setIgnoreUnidentifiedRecords(Boolean ignoreUnidentifiedRecords) {
- this.ignoreUnidentifiedRecords = ignoreUnidentifiedRecords;
- }
-
- public Boolean getIgnoreUnexpectedRecords() {
- return ignoreUnexpectedRecords;
- }
-
- public void setIgnoreUnexpectedRecords(Boolean ignoreUnexpectedRecords) {
- this.ignoreUnexpectedRecords = ignoreUnexpectedRecords;
- }
-
- public Boolean getIgnoreInvalidRecords() {
- return ignoreInvalidRecords;
- }
-
- public void setIgnoreInvalidRecords(Boolean ignoreInvalidRecords) {
- this.ignoreInvalidRecords = ignoreInvalidRecords;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
index 27f6d89..d091d6e 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/DataFormatsDefinition.java
@@ -37,8 +37,6 @@
// cannot use @XmlElementRef as it doesn't allow optional properties
@XmlElements({
- @XmlElement(required = false, name = "avro", type = AvroDataFormat.class),
- @XmlElement(required = false, name = "beanio", type = BeanioDataFormat.class),
@XmlElement(required = false, name = "bindy", type = BindyDataFormat.class),
@XmlElement(required = false, name = "castor", type = CastorDataFormat.class),
@XmlElement(required = false, name = "crypto", type = CryptoDataFormat.class),
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
index 24bf47c..e81d061 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JibxDataFormat.java
@@ -42,16 +42,16 @@
super("jibx");
}
- public JibxDataFormat(Class<?> unmarshallClass) {
+ public JibxDataFormat(Class unmarshallClass) {
this();
setUnmarshallClass(unmarshallClass);
}
- public Class<?> getUnmarshallClass() {
+ public Class getUnmarshallClass() {
return unmarshallClass;
}
- public void setUnmarshallClass(Class<?> unmarshallClass) {
+ public void setUnmarshallClass(Class unmarshallClass) {
this.unmarshallClass = unmarshallClass;
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index ecfdf27..d94ba24 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -87,10 +87,8 @@
protected DataFormat createDataFormat(RouteContext routeContext) {
if (library == JsonLibrary.XStream) {
setProperty(this, "dataFormatName", "json-xstream");
- } else if (library == JsonLibrary.Jackson) {
- setProperty(this, "dataFormatName", "json-jackson");
} else {
- setProperty(this, "dataFormatName", "json-gson");
+ setProperty(this, "dataFormatName", "json-jackson");
}
if (unmarshalType == null && unmarshalTypeName != null) {
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonLibrary.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonLibrary.java
index a40da31..bb98820 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonLibrary.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonLibrary.java
@@ -28,6 +28,6 @@
@XmlEnum(String.class)
public enum JsonLibrary {
- XStream, Jackson, Gson
+ XStream, Jackson
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java b/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
index bdc16fe..93e281c 100644
--- a/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/model/language/XPathExpression.java
@@ -43,8 +43,8 @@
private String factoryRef;
@XmlAttribute(name = "objectModel")
private String objectModel;
- @XmlAttribute(name = "logNamespaces")
- private Boolean logNamespaces;
+ @XmlAttribute(name = "traceNamespaces")
+ private Boolean traceNamespaces;
@XmlTransient
private Class<?> resultType;
@@ -110,16 +110,16 @@
return objectModel;
}
- public void setLogNamespaces(Boolean logNamespaces) {
- this.logNamespaces = logNamespaces;
+ public void setTraceNamespaces(Boolean traceNamespaces) {
+ this.traceNamespaces = traceNamespaces;
}
- public Boolean getLogNamespaces() {
- return logNamespaces;
+ public Boolean getTraceNamespaces() {
+ return traceNamespaces;
}
- public boolean isLogNamespaces() {
- return logNamespaces != null && logNamespaces;
+ public boolean isTraceNamespaces() {
+ return traceNamespaces != null && traceNamespaces;
}
@Override
@@ -155,8 +155,8 @@
if (objectModel != null) {
setProperty(expression, "objectModelUri", objectModel);
}
- if (isLogNamespaces()) {
- ObjectHelper.cast(XPathBuilder.class, expression).setLogNamespaces(true);
+ if (isTraceNamespaces()) {
+ ObjectHelper.cast(XPathBuilder.class, expression).setTraceNamespaces(true);
}
// moved the super configuration to the bottom so that the namespace init picks up the newly set XPath Factory
super.configureExpression(camelContext, expression);
@@ -177,8 +177,8 @@
if (objectModel != null) {
setProperty(predicate, "objectModelUri", objectModel);
}
- if (isLogNamespaces()) {
- ObjectHelper.cast(XPathBuilder.class, predicate).setLogNamespaces(true);
+ if (isTraceNamespaces()) {
+ ObjectHelper.cast(XPathBuilder.class, predicate).setTraceNamespaces(true);
}
// moved the super configuration to the bottom so that the namespace init picks up the newly set XPath Factory
super.configurePredicate(camelContext, predicate);
diff --git a/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java
index b897ace..671ca9e 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/CatchProcessor.java
@@ -31,11 +31,11 @@
* @version
*/
public class CatchProcessor extends DelegateAsyncProcessor implements Traceable {
- private final List<Class<? extends Throwable>> exceptions;
+ private final List<Class> exceptions;
private final Predicate onWhen;
private final Predicate handled;
- public CatchProcessor(List<Class<? extends Throwable>> exceptions, Processor processor, Predicate onWhen, Predicate handled) {
+ public CatchProcessor(List<Class> exceptions, Processor processor, Predicate onWhen, Predicate handled) {
super(processor);
this.exceptions = exceptions;
this.onWhen = onWhen;
@@ -95,7 +95,7 @@
return handled.matches(exchange);
}
- public List<Class<? extends Throwable>> getExceptions() {
+ public List<Class> getExceptions() {
return exceptions;
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/DynamicRouter.java b/camel-core/src/main/java/org/apache/camel/processor/DynamicRouter.java
index 0e1c117..73211d3 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/DynamicRouter.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/DynamicRouter.java
@@ -53,7 +53,7 @@
private final class DynamicRoutingSlipIterator implements RoutingSlipIterator {
private final Expression slip;
- private Iterator<?> current;
+ private Iterator current;
private DynamicRoutingSlipIterator(Expression slip) {
this.slip = slip;
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.java b/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.java
index 519c6f0..ac1190d 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ErrorHandlerSupport.java
@@ -54,8 +54,8 @@
}
}
- List<Class<? extends Throwable>> list = exceptionType.getExceptionClasses();
- for (Class<? extends Throwable> clazz : list) {
+ List<Class> list = exceptionType.getExceptionClasses();
+ for (Class clazz : list) {
String routeId = null;
// only get the route id, if the exception type is route scoped
if (exceptionType.isRouteScoped()) {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index f98c3fd..7ba332c 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -458,7 +458,7 @@
// mark that index as timed out, which allows us to try to retrieve
// any already completed tasks in the next loop
if (completion instanceof SubmitOrderedCompletionService) {
- ((SubmitOrderedCompletionService<?>) completion).timeoutTask();
+ ((SubmitOrderedCompletionService) completion).timeoutTask();
}
} else {
// there is a result to aggregate
@@ -967,7 +967,7 @@
// prefer to use per Exchange aggregation strategy over a global strategy
if (exchange != null) {
- Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class);
+ Map property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class);
Map<Object, AggregationStrategy> map = CastUtils.cast(property);
if (map != null) {
answer = map.get(this);
@@ -987,7 +987,7 @@
* @param aggregationStrategy the strategy
*/
protected void setAggregationStrategyOnExchange(Exchange exchange, AggregationStrategy aggregationStrategy) {
- Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class);
+ Map property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class);
Map<Object, AggregationStrategy> map = CastUtils.cast(property);
if (map == null) {
map = new HashMap<Object, AggregationStrategy>();
@@ -1005,7 +1005,7 @@
* @param exchange the current exchange
*/
protected void removeAggregationStrategyFromExchange(Exchange exchange) {
- Map<?, ?> property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class);
+ Map property = exchange.getProperty(Exchange.AGGREGATION_STRATEGY, Map.class);
Map<Object, AggregationStrategy> map = CastUtils.cast(property);
if (map == null) {
return;
diff --git a/camel-core/src/main/java/org/apache/camel/processor/SortProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/SortProcessor.java
index 3155cea..4d0efc4 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/SortProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/SortProcessor.java
@@ -24,16 +24,17 @@
import org.apache.camel.Expression;
import org.apache.camel.Message;
import org.apache.camel.Processor;
+import org.apache.camel.util.CastUtils;
/**
* A processor that sorts the expression using a comparator
*/
-public class SortProcessor<T> implements Processor {
+public class SortProcessor implements Processor {
private final Expression expression;
- private final Comparator<? super T> comparator;
+ private final Comparator<Object> comparator;
- public SortProcessor(Expression expression, Comparator<? super T> comparator) {
+ public SortProcessor(Expression expression, Comparator<Object> comparator) {
this.expression = expression;
this.comparator = comparator;
}
@@ -41,8 +42,7 @@
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
- @SuppressWarnings("unchecked")
- List<T> list = expression.evaluate(exchange, List.class);
+ List<Object> list = CastUtils.cast(expression.evaluate(exchange, List.class));
Collections.sort(list, comparator);
if (exchange.getPattern().isOutCapable()) {
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Splitter.java b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
index 390cadd..20fdc30 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
@@ -120,16 +120,17 @@
return answer;
}
+ @SuppressWarnings("unchecked")
private Iterable<ProcessorExchangePair> createProcessorExchangePairsIterable(final Exchange exchange, final Object value) {
- final Iterator<?> iterator = ObjectHelper.createIterator(value);
- return new Iterable<ProcessorExchangePair>() {
+ final Iterator iterator = ObjectHelper.createIterator(value);
+ return new Iterable() {
// create a copy which we use as master to copy during splitting
// this avoids any side effect reflected upon the incoming exchange
private final Exchange copy = copyExchangeNoAttachments(exchange, true);
private final RouteContext routeContext = exchange.getUnitOfWork() != null ? exchange.getUnitOfWork().getRouteContext() : null;
- public Iterator<ProcessorExchangePair> iterator() {
- return new Iterator<ProcessorExchangePair>() {
+ public Iterator iterator() {
+ return new Iterator() {
private int index;
private boolean closed;
@@ -153,7 +154,7 @@
return answer;
}
- public ProcessorExchangePair next() {
+ public Object next() {
Object part = iterator.next();
// create a correlated copy as the new exchange to be routed in the splitter from the copy
// and do not share the unit of work
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
index 7fa5775..101389d 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java
@@ -24,41 +24,23 @@
import org.apache.camel.AsyncProcessor;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
-import org.apache.camel.Rejectable;
-import org.apache.camel.ThreadPoolRejectedPolicy;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.AsyncProcessorHelper;
import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Threads processor that leverage a thread pool for continue processing the {@link Exchange}s
* using the asynchronous routing engine.
- * <p/>
- * Pay attention to how this processor handles rejected tasks.
- * <ul>
- * <li>Abort - The current exchange will be set with a {@link RejectedExecutionException} exception,
- * and marked to stop continue routing.
- * The {@link org.apache.camel.spi.UnitOfWork} will be regarded as <b>failed</b>, due the exception.</li>
- * <li>Discard - The current exchange will be marked to stop continue routing (notice no exception is set).
- * The {@link org.apache.camel.spi.UnitOfWork} will be regarded as <b>successful</b>, due no exception being set.</li>
- * <li>DiscardOldest - The oldest exchange will be marked to stop continue routing (notice no exception is set).
- * The {@link org.apache.camel.spi.UnitOfWork} will be regarded as <b>successful</b>, due no exception being set.
- * And the current exchange will be added to the task queue.</li>
- * <li>CallerRuns - The current exchange will be processed by the current thread. Which mean the current thread
- * will not be free to process a new exchange, as its processing the current exchange.</li>
- * </ul>
+ *
+ * @version
*/
public class ThreadsProcessor extends ServiceSupport implements AsyncProcessor {
- private static final Logger LOG = LoggerFactory.getLogger(ThreadsProcessor.class);
private final ExecutorService executorService;
private final AtomicBoolean shutdown = new AtomicBoolean(true);
private boolean callerRunsWhenRejected = true;
- private ThreadPoolRejectedPolicy rejectedPolicy;
- private final class ProcessCall implements Runnable, Rejectable {
+ private final class ProcessCall implements Runnable {
private final Exchange exchange;
private final AsyncCallback callback;
@@ -67,38 +49,12 @@
this.callback = callback;
}
- @Override
public void run() {
- LOG.trace("Continue routing exchange {} ", exchange);
if (shutdown.get()) {
exchange.setException(new RejectedExecutionException("ThreadsProcessor is not running."));
}
callback.done(false);
}
-
- @Override
- public void reject() {
- // abort should mark the exchange with an rejected exception
- boolean abort = ThreadPoolRejectedPolicy.Abort == rejectedPolicy;
- if (abort) {
- exchange.setException(new RejectedExecutionException());
- }
-
- LOG.trace("{} routing exchange {} ", abort ? "Aborted" : "Rejected", exchange);
- // we should not continue routing, and no redelivery should be performed
- exchange.setProperty(Exchange.ROUTE_STOP, true);
- exchange.setProperty(Exchange.REDELIVERY_EXHAUSTED, true);
-
- if (shutdown.get()) {
- exchange.setException(new RejectedExecutionException("ThreadsProcessor is not running."));
- }
- callback.done(false);
- }
-
- @Override
- public String toString() {
- return "ProcessCall[" + exchange + "]";
- }
}
public ThreadsProcessor(CamelContext camelContext, ExecutorService executorService) {
@@ -118,21 +74,19 @@
ProcessCall call = new ProcessCall(exchange, callback);
try {
- LOG.trace("Submitting task {}", call);
executorService.submit(call);
// tell Camel routing engine we continue routing asynchronous
return false;
} catch (RejectedExecutionException e) {
- boolean callerRuns = isCallerRunsWhenRejected();
- if (!callerRuns) {
+ if (isCallerRunsWhenRejected()) {
+ if (shutdown.get()) {
+ exchange.setException(new RejectedExecutionException());
+ } else {
+ callback.done(true);
+ }
+ } else {
exchange.setException(e);
}
-
- LOG.trace("{} executing task {}", callerRuns ? "CallerRuns" : "Aborted", call);
- if (shutdown.get()) {
- exchange.setException(new RejectedExecutionException());
- }
- callback.done(true);
return true;
}
}
@@ -145,14 +99,6 @@
this.callerRunsWhenRejected = callerRunsWhenRejected;
}
- public ThreadPoolRejectedPolicy getRejectedPolicy() {
- return rejectedPolicy;
- }
-
- public void setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy) {
- this.rejectedPolicy = rejectedPolicy;
- }
-
public String toString() {
return "Threads";
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
index 162c9e5..ced69c4 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java
@@ -47,7 +47,6 @@
import org.apache.camel.spi.AggregationRepository;
import org.apache.camel.spi.ExceptionHandler;
import org.apache.camel.spi.RecoverableAggregationRepository;
-import org.apache.camel.spi.ShutdownPrepared;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.support.DefaultTimeoutMap;
import org.apache.camel.support.ServiceSupport;
@@ -75,7 +74,7 @@
* and older prices are discarded). Another idea is to combine line item messages
* together into a single invoice message.
*/
-public class AggregateProcessor extends ServiceSupport implements Processor, Navigate<Processor>, Traceable, ShutdownPrepared {
+public class AggregateProcessor extends ServiceSupport implements Processor, Navigate<Processor>, Traceable {
public static final String AGGREGATE_TIMEOUT_CHECKER = "AggregateTimeoutChecker";
@@ -880,9 +879,15 @@
@Override
protected void doStop() throws Exception {
- // note: we cannot do doForceCompletionOnStop from this doStop method
- // as this is handled in the prepareShutdown method which is also invoked when stopping a route
- // and is better suited for preparing to shutdown than this doStop method is
+
+ if (forceCompletionOnStop) {
+ forceCompletionOfAllGroups();
+
+ while (inProgressCompleteExchanges.size() > 0) {
+ LOG.trace("waiting for {} in progress exchanges to complete", inProgressCompleteExchanges.size());
+ Thread.sleep(100);
+ }
+ }
if (recoverService != null) {
camelContext.getExecutorServiceManager().shutdownNow(recoverService);
@@ -899,37 +904,6 @@
}
@Override
- public void prepareShutdown(boolean forced) {
- // we are shutting down, so force completion if this option was enabled
- // but only do this when forced=false, as that is when we have chance to
- // send out new messages to be routed by Camel. When forced=true, then
- // we have to shutdown in a hurry
- if (!forced && forceCompletionOnStop) {
- doForceCompletionOnStop();
- }
- }
-
- private void doForceCompletionOnStop() {
- int expected = forceCompletionOfAllGroups();
-
- StopWatch watch = new StopWatch();
- while (inProgressCompleteExchanges.size() > 0) {
- LOG.trace("Waiting for {} inflight exchanges to complete", inProgressCompleteExchanges.size());
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // break out as we got interrupted such as the JVM terminating
- LOG.warn("Interrupted while waiting for {} inflight exchanges to complete.", inProgressCompleteExchanges.size());
- break;
- }
- }
-
- if (expected > 0) {
- LOG.info("Forcing completion of all groups with {} exchanges completed in {}", expected, TimeUtils.printDuration(watch.stop()));
- }
- }
-
- @Override
protected void doShutdown() throws Exception {
// shutdown aggregation repository
ServiceHelper.stopService(aggregationRepository);
@@ -940,13 +914,12 @@
super.doShutdown();
}
- public int forceCompletionOfAllGroups() {
+ public void forceCompletionOfAllGroups() {
- // only run if CamelContext has been fully started or is stopping
- boolean allow = camelContext.getStatus().isStarted() || camelContext.getStatus().isStopping();
- if (!allow) {
+ // only run if CamelContext has been fully started
+ if (!camelContext.getStatus().isStarted()) {
LOG.warn("Cannot start force completion of all groups because CamelContext({}) has not been started", camelContext.getName());
- return 0;
+ return;
}
LOG.trace("Starting force completion of all groups task");
@@ -954,11 +927,9 @@
// trigger completion for all in the repository
Set<String> keys = aggregationRepository.getKeys();
- int total = 0;
if (keys != null && !keys.isEmpty()) {
// must acquire the shared aggregation lock to be able to trigger force completion
lock.lock();
- total = keys.size();
try {
for (String key : keys) {
Exchange exchange = aggregationRepository.get(camelContext, key);
@@ -973,12 +944,7 @@
lock.unlock();
}
}
+
LOG.trace("Completed force completion of all groups task");
-
- if (total > 0) {
- LOG.debug("Forcing completion of all groups with {} exchanges", total);
- }
- return total;
}
-
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/ExceptionPolicyKey.java b/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/ExceptionPolicyKey.java
index 4024571..69493fa 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/ExceptionPolicyKey.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/exceptionpolicy/ExceptionPolicyKey.java
@@ -27,14 +27,14 @@
public final class ExceptionPolicyKey {
private final String routeId;
- private final Class<? extends Throwable> exceptionClass;
+ private final Class exceptionClass;
private final WhenDefinition when;
/**
* @deprecated will be removed in the near future, use the other constructor
*/
@Deprecated
- public ExceptionPolicyKey(Class<? extends Throwable> exceptionClass, WhenDefinition when) {
+ public ExceptionPolicyKey(Class exceptionClass, WhenDefinition when) {
this(null, exceptionClass, when);
}
@@ -45,7 +45,7 @@
* @param exceptionClass the exception class
* @param when optional predicate when the exception clause should trigger
*/
- public ExceptionPolicyKey(String routeId, Class<? extends Throwable> exceptionClass, WhenDefinition when) {
+ public ExceptionPolicyKey(String routeId, Class exceptionClass, WhenDefinition when) {
this.routeId = routeId;
this.exceptionClass = exceptionClass;
this.when = when;
@@ -67,7 +67,7 @@
* @deprecated will be removed in the near future. Use the constructor instead.
*/
@Deprecated
- public static ExceptionPolicyKey newInstance(Class<? extends Throwable> exceptionClass) {
+ public static ExceptionPolicyKey newInstance(Class exceptionClass) {
return new ExceptionPolicyKey(exceptionClass, null);
}
@@ -75,7 +75,7 @@
* @deprecated will be removed in the near future. Use the constructor instead.
*/
@Deprecated
- public static ExceptionPolicyKey newInstance(Class<? extends Throwable> exceptionClass, WhenDefinition when) {
+ public static ExceptionPolicyKey newInstance(Class exceptionClass, WhenDefinition when) {
return new ExceptionPolicyKey(exceptionClass, when);
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
index 190b0e3..597c083 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
@@ -157,6 +157,7 @@
ServiceHelper.stopServices(output, errorHandler, routeContextProcessor);
}
+ @SuppressWarnings("unchecked")
public void initChannel(ProcessorDefinition<?> outputDefinition, RouteContext routeContext) throws Exception {
this.routeContext = routeContext;
this.definition = outputDefinition;
@@ -319,7 +320,7 @@
// determine if we can still run, or the camel context is forcing a shutdown
boolean forceShutdown = camelContext.getShutdownStrategy().forceShutdown(this);
if (forceShutdown) {
- LOG.debug("Run not allowed as ShutdownStrategy is forcing shutting down, will reject executing exchange: {}", exchange);
+ LOG.trace("Run not allowed as ShutdownStrategy is forcing shutting down, will reject executing exchange: {}", exchange);
if (exchange.getException() == null) {
exchange.setException(new RejectedExecutionException());
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventHandler.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventHandler.java
index 2824ba9..036a4eb 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventHandler.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventHandler.java
@@ -70,7 +70,7 @@
}
@Override
- public void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ public void traceExchange(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
if (tracer.getDestination() != null || tracer.getDestinationUri() != null) {
// create event exchange and add event information
@@ -123,13 +123,13 @@
}
@Override
- public Object traceExchangeIn(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ public Object traceExchangeIn(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
traceExchange(node, target, traceInterceptor, exchange);
return null;
}
@Override
- public void traceExchangeOut(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
+ public void traceExchangeOut(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
traceExchange(node, target, traceInterceptor, exchange);
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceInterceptorFactory.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceInterceptorFactory.java
index 575d683..c391898 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceInterceptorFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceInterceptorFactory.java
@@ -21,7 +21,7 @@
public class DefaultTraceInterceptorFactory implements TraceInterceptorFactory {
- public Processor createTraceInterceptor(ProcessorDefinition<?> node, Processor target, TraceFormatter formatter, Tracer tracer) {
+ public Processor createTraceInterceptor(ProcessorDefinition node, Processor target, TraceFormatter formatter, Tracer tracer) {
return new TraceInterceptor(node, target, formatter, tracer);
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceEventHandler.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceEventHandler.java
index e8518e3..95dc1e3 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceEventHandler.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceEventHandler.java
@@ -39,7 +39,7 @@
* @param exchange the current exchange
* @throws Exception is thrown if an error occurred during tracing
*/
- void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception;
+ void traceExchange(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception;
/**
* Event called when an {@link Exchange} is about to be processed (in)
@@ -53,7 +53,7 @@
* @return an optional return object to pass in the <tt>traceEventOut</tt> method.
* @throws Exception is thrown if an error occurred during tracing
*/
- Object traceExchangeIn(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception;
+ Object traceExchangeIn(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception;
/**
* Event called when an {@link Exchange} has been processed (out)
@@ -67,6 +67,6 @@
* @param traceState the optional object which was returned from the <tt>traceEventIn</tt> method.
* @throws Exception is thrown if an error occurred during tracing
*/
- void traceExchangeOut(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception;
+ void traceExchangeOut(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception;
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptorFactory.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptorFactory.java
index a06fd32..ea4b069 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptorFactory.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptorFactory.java
@@ -38,6 +38,6 @@
* @param tracer the tracer
* @return the created trace interceptor
*/
- Processor createTraceInterceptor(ProcessorDefinition<?> node, Processor target, TraceFormatter formatter, Tracer tracer);
+ Processor createTraceInterceptor(ProcessorDefinition node, Processor target, TraceFormatter formatter, Tracer tracer);
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/WeightedRandomLoadBalancer.java b/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/WeightedRandomLoadBalancer.java
index d566a8a..c16238c 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/WeightedRandomLoadBalancer.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/loadbalancer/WeightedRandomLoadBalancer.java
@@ -23,49 +23,34 @@
import org.apache.camel.Processor;
public class WeightedRandomLoadBalancer extends WeightedLoadBalancer {
- private final Random rnd = new Random();
- private final int distributionRatioSum;
- private int runtimeRatioSum;
+ private int randomCounter;
public WeightedRandomLoadBalancer(List<Integer> distributionRatioList) {
super(distributionRatioList);
- int sum = 0;
- for (Integer distributionRatio : distributionRatioList) {
- sum += distributionRatio;
- }
- distributionRatioSum = sum;
- runtimeRatioSum = distributionRatioSum;
}
@Override
- protected Processor chooseProcessor(List<Processor> processors, Exchange exchange) {
- int selectedProcessorIndex = selectProcessIndex();
- return processors.get(selectedProcessorIndex);
+ protected Processor chooseProcessor(List<Processor> processors, Exchange exchange) {
+ boolean found = false;
+ while (!found) {
+ if (getRuntimeRatios().isEmpty()) {
+ loadRuntimeRatios(getDistributionRatioList());
+ }
+
+ randomCounter = 0;
+ if (getRuntimeRatios().size() > 0) {
+ randomCounter = new Random().nextInt(getRuntimeRatios().size());
+ }
+
+ if (getRuntimeRatios().get(randomCounter).getRuntimeWeight() > 0) {
+ getRuntimeRatios().get(randomCounter).setRuntimeWeight((getRuntimeRatios().get(randomCounter).getRuntimeWeight()) - 1);
+ found = true;
+ } else {
+ getRuntimeRatios().remove(randomCounter);
+ }
+ }
+
+ return processors.get(getRuntimeRatios().get(randomCounter).getProcessorPosition());
}
- public int selectProcessIndex() {
- if (runtimeRatioSum == 0) { // every processor is exhausted, reload for a new distribution round
- for (DistributionRatio distributionRatio : getRuntimeRatios()) {
- int weight = distributionRatio.getDistributionWeight();
- distributionRatio.setRuntimeWeight(weight);
- }
- runtimeRatioSum = distributionRatioSum;
- }
-
- DistributionRatio selected = null;
- int randomWeight = rnd.nextInt(runtimeRatioSum);
- int choiceWeight = 0;
- for (DistributionRatio distributionRatio : getRuntimeRatios()) {
- choiceWeight += distributionRatio.getRuntimeWeight();
- if (randomWeight < choiceWeight) {
- selected = distributionRatio;
- break;
- }
- }
-
- selected.setRuntimeWeight(selected.getRuntimeWeight() - 1);
- runtimeRatioSum--;
-
- return selected.getProcessorPosition();
- }
}
diff --git a/camel-core/src/main/java/org/apache/camel/processor/resequencer/DefaultExchangeComparator.java b/camel-core/src/main/java/org/apache/camel/processor/resequencer/DefaultExchangeComparator.java
index ddf8bb8..f933f3e 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/resequencer/DefaultExchangeComparator.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/resequencer/DefaultExchangeComparator.java
@@ -21,7 +21,7 @@
/**
* Compares elements of an {@link Exchange} sequence by comparing
- * <code>long</code> values returned by this comparator's
+ * <code>long</code> values returned by this comaprator's
* <code>expression</code>.
*
* @version
diff --git a/camel-core/src/main/java/org/apache/camel/spi/Breakpoint.java b/camel-core/src/main/java/org/apache/camel/spi/Breakpoint.java
index 0f3bd68..7a02167 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/Breakpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/Breakpoint.java
@@ -66,7 +66,7 @@
* @param processor the {@link Processor} about to be processed
* @param definition the {@link org.apache.camel.model.ProcessorDefinition} definition of the processor
*/
- void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition);
+ void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition);
/**
* Callback invoked when the breakpoint was hit and the {@link Exchange} has been processed (after).
@@ -76,7 +76,7 @@
* @param definition the {@link org.apache.camel.model.ProcessorDefinition} definition of the processor
* @param timeTaken time in millis it took to process the {@link Exchange} - time spend in breakpoint callbacks may affect this time
*/
- void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken);
+ void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken);
/**
* Callback invoked when the breakpoint was hit and any of the {@link Exchange} {@link EventObject event}s occurred.
@@ -87,6 +87,6 @@
* may be <tt>null</tt> if not possible to resolve from tracing
* @see org.apache.camel.management.event.AbstractExchangeEvent
*/
- void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition);
+ void onEvent(Exchange exchange, EventObject event, ProcessorDefinition definition);
}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/CamelContextNameStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/CamelContextNameStrategy.java
index 17d2739..a9a79c4 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/CamelContextNameStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/CamelContextNameStrategy.java
@@ -19,34 +19,9 @@
/**
* Strategy for assigning name to a {@link org.apache.camel.CamelContext}.
*
- * @see ManagementNameStrategy
+ * @version
*/
public interface CamelContextNameStrategy {
- /**
- * Gets the name
- * <p/>
- * The {@link #isFixedName()} determines if the name can be re-calculated such as when using a counter,
- * or the name is always fixed.
- *
- * @return the name.
- */
String getName();
-
- /**
- * Gets the next calculated name, if this strategy is not using fixed names.
- * <p/>
- * The {@link #isFixedName()} determines if the name can be re-calculated such as when using a counter,
- * or the name is always fixed.
- *
- * @return the next name
- */
- String getNextName();
-
- /**
- * Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
- *
- * @return <tt>true</tt> for fixed names, <tt>false</tt> for names which can re-calculated
- */
- boolean isFixedName();
}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/Condition.java b/camel-core/src/main/java/org/apache/camel/spi/Condition.java
index 7564b81..4af04ac 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/Condition.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/Condition.java
@@ -40,7 +40,7 @@
* @param definition the present location in the route where the {@link Exchange} is located at
* @return <tt>true</tt> to match, <tt>false</tt> otherwise
*/
- boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition);
+ boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition);
/**
* Does the condition match
diff --git a/camel-core/src/main/java/org/apache/camel/spi/Debugger.java b/camel-core/src/main/java/org/apache/camel/spi/Debugger.java
index 6c8f1eb..e2ba00c 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/Debugger.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/Debugger.java
@@ -119,7 +119,7 @@
* @param definition the definition of the processor
* @return <tt>true</tt> if any breakpoint was hit, <tt>false</tt> if not breakpoint was hit
*/
- boolean beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition);
+ boolean beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition);
/**
* Callback invoked when an {@link Exchange} has been processed which allows implementators
@@ -131,7 +131,7 @@
* @param timeTaken time in millis it took to process the {@link Exchange} - time spend in breakpoint callbacks may affect this time
* @return <tt>true</tt> if any breakpoint was hit, <tt>false</tt> if not breakpoint was hit
*/
- boolean afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken);
+ boolean afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken);
/**
* Callback invoked when an {@link Exchange} is being processed which allows implementators
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java b/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java
index 4bbb8cd..13b58a1 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java
@@ -101,12 +101,12 @@
/**
* Sets the thread name pattern used for creating the full thread name.
* <p/>
- * The default pattern is: <tt>Camel (#camelId#) thread ##counter# - #name#</tt>
+ * The default pattern is: <tt>Camel (${camelId}) thread #${counter} - ${name}</tt>
* <p/>
- * Where <tt>#camelId#</tt> is the name of the {@link org.apache.camel.CamelContext}
- * <br/>and <tt>#counter#</tt> is a unique incrementing counter.
- * <br/>and <tt>#name#</tt> is the regular thread name.
- * <br/>You can also use <tt>#longName#</tt> is the long thread name which can includes endpoint parameters etc.
+ * Where <tt>${camelId}</tt> is the name of the {@link org.apache.camel.CamelContext}
+ * <br/>and <tt>${counter}</tt> is a unique incrementing counter.
+ * <br/>and <tt>${name}</tt> is the regular thread name.
+ * <br/>You can also use <tt>${longName}</tt> is the long thread name which can includes endpoint parameters etc.
*
* @param pattern the pattern
* @throws IllegalArgumentException if the pattern is invalid.
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java
index 685f99f..5466523 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceStrategy.java
@@ -90,12 +90,12 @@
/**
* Sets the thread name pattern used for creating the full thread name.
* <p/>
- * The default pattern is: <tt>Camel (#camelId#) thread #counter# - #name#</tt>
+ * The default pattern is: <tt>Camel (${camelId}) thread #${counter} - ${name}</tt>
* <p/>
- * Where <tt>#camelId#</tt> is the name of the {@link org.apache.camel.CamelContext}
- * <br/>and <tt>#counter#</tt> is a unique incrementing counter.
- * <br/>and <tt>#name#</tt> is the regular thread name.
- * <br/>You can also use <tt>#longName#</tt> is the long thread name which can includes endpoint parameters etc.
+ * Where <tt>${camelId}</tt> is the name of the {@link org.apache.camel.CamelContext}
+ * <br/>and <tt>${counter}</tt> is a unique incrementing counter.
+ * <br/>and <tt>${name}</tt> is the regular thread name.
+ * <br/>You can also use <tt>${longName}</tt> is the long thread name which can includes endpoint parameters etc.
*
* @param pattern the pattern
* @throws IllegalArgumentException if the pattern is invalid.
diff --git a/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java
index 1545031..d006584 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/LifecycleStrategy.java
@@ -140,12 +140,4 @@
void onThreadPoolAdd(CamelContext camelContext, ThreadPoolExecutor threadPool, String id,
String sourceId, String routeId, String threadPoolProfileId);
- /**
- * Notification on removing a thread pool.
- *
- * @param camelContext the camel context
- * @param threadPool the thread pool
- */
- void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool);
-
}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ManagementNameStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/ManagementNameStrategy.java
deleted file mode 100644
index 5ed65dc..0000000
--- a/camel-core/src/main/java/org/apache/camel/spi/ManagementNameStrategy.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spi;
-
-/**
- * Strategy for assigning the name part of the {@link javax.management.ObjectName}
- * for a managed {@link org.apache.camel.CamelContext}.
- * <p/>
- * A strategy is needed as you can run multiple CamelContext in the same JVM, and want them
- * to be enlisted in the JVM wide JMXMBeanServer. And this requires a strategy to be able
- * to calculate unique names, in case of clashes. Or to enforce an explicit fixed name,
- * to ensure the JMX name is not using dynamic counters etc.
- * <p/>
- * This strategy supports a naming pattern which supports at least the following tokens
- * <ul>
- * <li>#camelId# - the camel id (eg the camel name)</li>
- * <li>#name# - same as #camelId#</li>
- * <li>#counter# - an incrementing counter</li>
- * </ul>
- *
- * @see CamelContextNameStrategy
- * @see org.apache.camel.impl.DefaultManagementNameStrategy
- */
-public interface ManagementNameStrategy {
-
- /**
- * Gets the custom name pattern.
- *
- * @return the custom name pattern, or <tt>null</tt> if using the default pattern strategy.
- */
- String getNamePattern();
-
- /**
- * Sets a custom name pattern, which will be used instead of any default patterns.
- *
- * @param pattern a custom name pattern.
- */
- void setNamePattern(String pattern);
-
- /**
- * Gets the name
- * <p/>
- * The {@link #isFixedName()} determines if the name can be re-calculated such as when using a counter,
- * or the name is always fixed.
- *
- * @return the name.
- */
- String getName();
-
- /**
- * Gets the next calculated name, if this strategy is not using fixed names.
- * <p/>
- * The {@link #isFixedName()} determines if the name can be re-calculated such as when using a counter,
- * or the name is always fixed.
- *
- * @return the next name
- */
- String getNextName();
-
- /**
- * Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
- *
- * @return <tt>true</tt> for fixed names, <tt>false</tt> for names which can re-calculated
- */
- boolean isFixedName();
-}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
index d101433..f39084b 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ManagementNamingStrategy.java
@@ -38,7 +38,7 @@
*/
public interface ManagementNamingStrategy {
- ObjectName getObjectNameForCamelContext(String managementName, String name) throws MalformedObjectNameException;
+ ObjectName getObjectNameForCamelContext(String name) throws MalformedObjectNameException;
ObjectName getObjectNameForCamelContext(CamelContext context) throws MalformedObjectNameException;
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java b/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
index 5190cd6..da9df71 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ManagementObjectStrategy.java
@@ -50,7 +50,7 @@
Object getManagedObjectForProducer(CamelContext context, Producer producer);
Object getManagedObjectForProcessor(CamelContext context, Processor processor,
- ProcessorDefinition<?> definition, Route route);
+ ProcessorDefinition definition, Route route);
Object getManagedObjectForService(CamelContext context, Service service);
diff --git a/camel-core/src/main/java/org/apache/camel/spi/RouteStartupOrder.java b/camel-core/src/main/java/org/apache/camel/spi/RouteStartupOrder.java
index d5c3e29..f7d2f87 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/RouteStartupOrder.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/RouteStartupOrder.java
@@ -20,7 +20,6 @@
import org.apache.camel.Consumer;
import org.apache.camel.Route;
-import org.apache.camel.Service;
/**
* Information about a route to be started where we want to control the order
@@ -54,11 +53,4 @@
*/
List<Consumer> getInputs();
- /**
- * Gets the services to this route.
- *
- * @return the services.
- */
- List<Service> getServices();
-
}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ShutdownAware.java b/camel-core/src/main/java/org/apache/camel/spi/ShutdownAware.java
index fd8c0e3..28b1d3c 100644
--- a/camel-core/src/main/java/org/apache/camel/spi/ShutdownAware.java
+++ b/camel-core/src/main/java/org/apache/camel/spi/ShutdownAware.java
@@ -27,7 +27,7 @@
* @version
* @see org.apache.camel.spi.ShutdownStrategy
*/
-public interface ShutdownAware extends ShutdownPrepared {
+public interface ShutdownAware {
/**
* To defer shutdown during first phase of shutdown. This allows any pending exchanges to be completed
@@ -53,4 +53,10 @@
*/
int getPendingExchangesSize();
+ /**
+ * Prepares the consumer for shutdown.
+ * <p/>
+ * For example by graceful stopping any threads or the likes.
+ */
+ void prepareShutdown();
}
diff --git a/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java b/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java
deleted file mode 100644
index 2721d7b..0000000
--- a/camel-core/src/main/java/org/apache/camel/spi/ShutdownPrepared.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spi;
-
-/**
- * Allows a {@link org.apache.camel.Service} to prepare for shutdown.
- * <p/>
- * <b>Important: </b> Implementators of this interface must be a {@link org.apache.camel.Service} as well.
- * <p/>
- * This allows {@link org.apache.camel.Processor}s to prepare for shutdown, such as when
- * {@link org.apache.camel.CamelContext} or a {@link org.apache.camel.Route} is shutting down.
- * The {@link org.apache.camel.Processor} could be a stateful EIP such as the
- * {@link org.apache.camel.processor.aggregate.AggregateProcessor}, allowing it to do custom work
- * to prepare for shutdown.
- */
-public interface ShutdownPrepared {
-
- /**
- * Prepares for shutdown.
- * <p/>
- * The {@link ShutdownStrategy} supports preparing for shutdown using two steps.
- * First a regular preparation, where the given forced parameter will be <tt>false</tt>.
- * And if the shutdown times out, then the {@link ShutdownStrategy} performs a more aggressive
- * shutdown, calling this method a second time with <tt>true</tt> for the given forced parameter.
- * <p/>
- * For example by graceful stopping any threads or the likes.
- * <p/>
- * For forced shutdown, then the service is expected to aggressively shutdown any child services, such
- * as thread pools etc. This is the last chance it has to perform such duties.
- *
- * @param forced <tt>true</tt> is forcing a more aggressive shutdown, <tt>false</tt> is for preparing to shutdown.
- */
- void prepareShutdown(boolean forced);
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java b/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java
index f34eb2b..096ba7e 100644
--- a/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/support/ChildServiceSupport.java
@@ -120,10 +120,11 @@
}
}
+ @SuppressWarnings("unchecked")
protected void addChildService(Object childService) {
synchronized (this) {
if (childServices == null) {
- childServices = new LinkedHashSet<Object>();
+ childServices = new LinkedHashSet();
}
}
childServices.add(childService);
diff --git a/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java b/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java
index 2ed0ea5..9b18978 100644
--- a/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java
+++ b/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java
@@ -252,7 +252,7 @@
return true;
}
- protected void updateExpireTime(TimeoutMapEntry<K, V> entry) {
+ protected void updateExpireTime(TimeoutMapEntry entry) {
long now = currentTime();
entry.setExpireTime(entry.getTimeout() + now);
}
diff --git a/camel-core/src/main/java/org/apache/camel/support/TimeoutMapEntry.java b/camel-core/src/main/java/org/apache/camel/support/TimeoutMapEntry.java
index 1f28f8d..fe64ab1 100644
--- a/camel-core/src/main/java/org/apache/camel/support/TimeoutMapEntry.java
+++ b/camel-core/src/main/java/org/apache/camel/support/TimeoutMapEntry.java
@@ -73,7 +73,7 @@
return 0;
}
if (that instanceof TimeoutMapEntry) {
- return compareTo((TimeoutMapEntry<K, V>) that);
+ return compareTo((TimeoutMapEntry) that);
}
return 1;
}
diff --git a/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java b/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
index 40cbfff..bfad22a 100644
--- a/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
+++ b/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
@@ -44,7 +44,7 @@
private static final Logger LOG = LoggerFactory.getLogger(TimerListenerManager.class);
private final Set<TimerListener> listeners = new LinkedHashSet<TimerListener>();
private ScheduledExecutorService executorService;
- private volatile ScheduledFuture<?> task;
+ private volatile ScheduledFuture task;
private long interval = 1000L;
public TimerListenerManager() {
diff --git a/camel-core/src/main/java/org/apache/camel/support/TokenPairExpressionIterator.java b/camel-core/src/main/java/org/apache/camel/support/TokenPairExpressionIterator.java
index 489f5e6..66bb2ea 100644
--- a/camel-core/src/main/java/org/apache/camel/support/TokenPairExpressionIterator.java
+++ b/camel-core/src/main/java/org/apache/camel/support/TokenPairExpressionIterator.java
@@ -97,7 +97,7 @@
* @param charset charset
* @return the iterator
*/
- protected Iterator<?> createIterator(InputStream in, String charset) {
+ protected Iterator createIterator(InputStream in, String charset) {
TokenPairIterator iterator = new TokenPairIterator(startToken, endToken, includeTokens, in, charset);
iterator.init();
return iterator;
@@ -111,7 +111,7 @@
/**
* Iterator to walk the input stream
*/
- static class TokenPairIterator implements Iterator<Object>, Closeable {
+ static class TokenPairIterator implements Iterator, Closeable {
final String startToken;
String scanStartToken;
diff --git a/camel-core/src/main/java/org/apache/camel/support/TokenXMLPairExpressionIterator.java b/camel-core/src/main/java/org/apache/camel/support/TokenXMLPairExpressionIterator.java
index 13c7913..b9d8cfc 100644
--- a/camel-core/src/main/java/org/apache/camel/support/TokenXMLPairExpressionIterator.java
+++ b/camel-core/src/main/java/org/apache/camel/support/TokenXMLPairExpressionIterator.java
@@ -61,7 +61,7 @@
}
@Override
- protected Iterator<?> createIterator(InputStream in, String charset) {
+ protected Iterator createIterator(InputStream in, String charset) {
XMLTokenPairIterator iterator = new XMLTokenPairIterator(startToken, endToken, inheritNamespaceToken, in, charset);
iterator.init();
return iterator;
diff --git a/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java b/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
index ab4d898..19a5b93 100644
--- a/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
@@ -78,14 +78,14 @@
* @param value the value to put in the map
*/
@SuppressWarnings("unchecked")
- public static void appendValue(Map<String, Object> map, String key, Object value) {
+ public static void appendValue(Map map, Object key, Object value) {
Object oldValue = map.get(key);
if (oldValue != null) {
- List<Object> list;
+ List list;
if (oldValue instanceof List) {
- list = (List<Object>)oldValue;
+ list = (List)oldValue;
} else {
- list = new ArrayList<Object>();
+ list = new ArrayList();
list.add(oldValue);
// replace old entry with list
map.remove(key);
diff --git a/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java b/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
index f3146fc..46f6535 100644
--- a/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
@@ -322,7 +322,7 @@
* @return list of lookup results.
* @throws IllegalArgumentException if any referenced object was not found in registry.
*/
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public static <T> List<T> resolveReferenceListParameter(CamelContext context, String value, Class<T> elementType) {
if (value == null) {
return Collections.emptyList();
diff --git a/camel-core/src/main/java/org/apache/camel/util/IOHelper.java b/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
index 5ab36a3..d808f80 100644
--- a/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/IOHelper.java
@@ -182,7 +182,8 @@
}
public static void copyAndCloseInput(InputStream input, OutputStream output) throws IOException {
- copyAndCloseInput(input, output, DEFAULT_BUFFER_SIZE);
+ copy(input, output);
+ close(input, null, LOG);
}
public static void copyAndCloseInput(InputStream input, OutputStream output, int bufferSize) throws IOException {
@@ -233,17 +234,6 @@
close(closeable, null, LOG);
}
- /**
- * Closes the given resources if they are available.
- *
- * @param closeables the objects to close
- */
- public static void close(Closeable... closeables) {
- for (Closeable closeable : closeables) {
- close(closeable, null, LOG);
- }
- }
-
public static void validateCharset(String charset) throws UnsupportedCharsetException {
if (charset != null) {
if (Charset.isSupported(charset)) {
diff --git a/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java b/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
index 7cf9f2c..cb06705 100755
--- a/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
@@ -137,7 +137,8 @@
* @param optionPrefix an optional prefix to append the property key
* @return <tt>true</tt> if any properties was found, <tt>false</tt> otherwise.
*/
- public static boolean getProperties(Object target, Map<String, Object> properties, String optionPrefix) {
+ @SuppressWarnings("unchecked")
+ public static boolean getProperties(Object target, Map properties, String optionPrefix) {
ObjectHelper.notNull(target, "target");
ObjectHelper.notNull(properties, "properties");
boolean rc = false;
@@ -145,7 +146,7 @@
optionPrefix = "";
}
- Class<?> clazz = target.getClass();
+ Class clazz = target.getClass();
Method[] methods = clazz.getMethods();
for (Method method : methods) {
if (EXCLUDED_METHODS.contains(method)) {
@@ -170,7 +171,7 @@
public static boolean hasSetter(Object target, Method getter) {
String name = getGetterShorthandName(getter);
- Class<?> clazz = target.getClass();
+ Class clazz = target.getClass();
Method[] methods = clazz.getMethods();
for (Method method : methods) {
if (EXCLUDED_METHODS.contains(method)) {
@@ -376,7 +377,8 @@
return setProperty(target, name, value, false);
}
- private static Object convert(TypeConverter typeConverter, Class<?> type, Object value)
+ @SuppressWarnings("unchecked")
+ private static Object convert(TypeConverter typeConverter, Class type, Object value)
throws URISyntaxException, NoTypeConversionAvailableException {
if (typeConverter != null) {
return typeConverter.mandatoryConvertTo(type, value);
diff --git a/camel-core/src/main/java/org/apache/camel/util/OrderedComparator.java b/camel-core/src/main/java/org/apache/camel/util/OrderedComparator.java
index caa918a..b821c24 100644
--- a/camel-core/src/main/java/org/apache/camel/util/OrderedComparator.java
+++ b/camel-core/src/main/java/org/apache/camel/util/OrderedComparator.java
@@ -25,7 +25,7 @@
*
* @version
*/
-public final class OrderedComparator implements Comparator<Object> {
+public final class OrderedComparator implements Comparator {
private final boolean reverse;
diff --git a/camel-core/src/main/java/org/apache/camel/util/ReflectionHelper.java b/camel-core/src/main/java/org/apache/camel/util/ReflectionHelper.java
deleted file mode 100644
index e3ad683..0000000
--- a/camel-core/src/main/java/org/apache/camel/util/ReflectionHelper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.util;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-/**
- * Helper for working with reflection on classes.
- * <p/>
- * This code is based on org.apache.camel.spring.util.ReflectionUtils class.
- */
-public final class ReflectionHelper {
-
- private ReflectionHelper() {
- // utility class
- }
-
- /**
- * Callback interface invoked on each field in the hierarchy.
- */
- public interface FieldCallback {
-
- /**
- * Perform an operation using the given field.
- *
- * @param field the field to operate on
- */
- void doWith(Field field) throws IllegalArgumentException, IllegalAccessException;
- }
-
- /**
- * Action to take on each method.
- */
- public interface MethodCallback {
-
- /**
- * Perform an operation using the given method.
- *
- * @param method the method to operate on
- */
- void doWith(Method method) throws IllegalArgumentException, IllegalAccessException;
- }
-
- /**
- * Invoke the given callback on all fields in the target class, going up the
- * class hierarchy to get all declared fields.
- * @param clazz the target class to analyze
- * @param fc the callback to invoke for each field
- */
- public static void doWithFields(Class<?> clazz, FieldCallback fc) throws IllegalArgumentException {
- // Keep backing up the inheritance hierarchy.
- Class<?> targetClass = clazz;
- do {
- Field[] fields = targetClass.getDeclaredFields();
- for (Field field : fields) {
- try {
- fc.doWith(field);
- } catch (IllegalAccessException ex) {
- throw new IllegalStateException("Shouldn't be illegal to access field '" + field.getName() + "': " + ex);
- }
- }
- targetClass = targetClass.getSuperclass();
- }
- while (targetClass != null && targetClass != Object.class);
- }
-
- /**
- * Perform the given callback operation on all matching methods of the given
- * class and superclasses (or given interface and super-interfaces).
- *
- * @param clazz class to start looking at
- * @param mc the callback to invoke for each method
- */
- public static void doWithMethods(Class<?> clazz, MethodCallback mc) throws IllegalArgumentException {
- // Keep backing up the inheritance hierarchy.
- Method[] methods = clazz.getDeclaredMethods();
- for (Method method : methods) {
- try {
- mc.doWith(method);
- } catch (IllegalAccessException ex) {
- throw new IllegalStateException("Shouldn't be illegal to access method '" + method.getName() + "': " + ex);
- }
- }
- if (clazz.getSuperclass() != null) {
- doWithMethods(clazz.getSuperclass(), mc);
- } else if (clazz.isInterface()) {
- for (Class<?> superIfc : clazz.getInterfaces()) {
- doWithMethods(superIfc, mc);
- }
- }
- }
-
- public static void setField(Field f, Object instance, Object value) {
- try {
- boolean oldAccessible = f.isAccessible();
- boolean shouldSetAccessible = !Modifier.isPublic(f.getModifiers()) && !oldAccessible;
- if (shouldSetAccessible) {
- f.setAccessible(true);
- }
- f.set(instance, value);
- if (shouldSetAccessible) {
- f.setAccessible(oldAccessible);
- }
- } catch (Exception ex) {
- throw new UnsupportedOperationException("Cannot inject value of class: " + value.getClass() + " into: " + f);
- }
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java b/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
index 0126239..5e79c70 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java
@@ -18,11 +18,8 @@
import java.util.Arrays;
import java.util.Collection;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
-import org.apache.camel.Navigate;
import org.apache.camel.Service;
import org.apache.camel.ShutdownableService;
import org.apache.camel.StatefulService;
@@ -344,31 +341,4 @@
return false;
}
- /**
- * Gather all child services by navigating the service to recursively gather all child services.
- *
- * @param service the service
- * @return the services, including the parent service, and all its children
- */
- public static Set<Service> getChildServices(Service service) {
- Set<Service> answer = new LinkedHashSet<Service>();
- doGetChildServices(answer, service);
- return answer;
- }
-
- private static void doGetChildServices(Set<Service> services, Service service) {
- services.add(service);
- if (service instanceof Navigate) {
- Navigate<?> nav = (Navigate<?>) service;
- if (nav.hasNext()) {
- List<?> children = nav.next();
- for (Object child : children) {
- if (child instanceof Service) {
- doGetChildServices(services, (Service) child);
- }
- }
- }
- }
- }
-
}
diff --git a/camel-core/src/main/java/org/apache/camel/util/URISupport.java b/camel-core/src/main/java/org/apache/camel/util/URISupport.java
index 45d6254..7ad98db 100644
--- a/camel-core/src/main/java/org/apache/camel/util/URISupport.java
+++ b/camel-core/src/main/java/org/apache/camel/util/URISupport.java
@@ -169,7 +169,7 @@
}
@SuppressWarnings("unchecked")
- public static String createQueryString(Map<String, Object> options) throws URISyntaxException {
+ public static String createQueryString(Map<Object, Object> options) throws URISyntaxException {
try {
if (options.size() > 0) {
StringBuilder rc = new StringBuilder();
@@ -227,7 +227,7 @@
* <p/>
* Used by various Camel components
*/
- public static URI createRemainingURI(URI originalURI, Map<String, Object> params) throws URISyntaxException {
+ public static URI createRemainingURI(URI originalURI, Map<Object, Object> params) throws URISyntaxException {
String s = createQueryString(params);
if (s.length() == 0) {
s = null;
@@ -244,6 +244,7 @@
* @throws URISyntaxException in thrown if the uri syntax is invalid
* @throws UnsupportedEncodingException
*/
+ @SuppressWarnings("unchecked")
public static String normalizeUri(String uri) throws URISyntaxException, UnsupportedEncodingException {
URI u = new URI(UnsafeUriCharactersEncoder.encode(uri));
@@ -268,7 +269,7 @@
path = UnsafeUriCharactersEncoder.encode(path);
// in case there are parameters we should reorder them
- Map<String, Object> parameters = URISupport.parseParameters(u);
+ Map parameters = URISupport.parseParameters(u);
if (parameters.isEmpty()) {
// no parameters then just return
return buildUri(scheme, path, null);
@@ -277,7 +278,7 @@
List<String> keys = new ArrayList<String>(parameters.keySet());
Collections.sort(keys);
- Map<String, Object> sorted = new LinkedHashMap<String, Object>(parameters.size());
+ Map<Object, Object> sorted = new LinkedHashMap<Object, Object>(parameters.size());
for (String key : keys) {
sorted.put(key, parameters.get(key));
}
diff --git a/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java b/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java
index 4550ece..60347ab 100644
--- a/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/UnitOfWorkHelper.java
@@ -32,6 +32,7 @@
private UnitOfWorkHelper() {
}
+ @SuppressWarnings("unchecked")
public static void doneSynchronizations(Exchange exchange, List<Synchronization> synchronizations, Logger log) {
boolean failed = exchange.isFailed();
diff --git a/camel-core/src/main/java/org/apache/camel/util/ValueHolder.java b/camel-core/src/main/java/org/apache/camel/util/ValueHolder.java
index 3778541..10527d51 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ValueHolder.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ValueHolder.java
@@ -54,7 +54,7 @@
return false;
}
- ValueHolder<?> that = (ValueHolder<?>) o;
+ ValueHolder that = (ValueHolder) o;
if (value != null ? !value.equals(that.value) : that.value != null) {
return false;
diff --git a/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableFutureTask.java b/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableFutureTask.java
deleted file mode 100644
index f7eb541..0000000
--- a/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableFutureTask.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.util.concurrent;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.FutureTask;
-
-import org.apache.camel.Rejectable;
-
-/**
- * A {@link Rejectable} {@link FutureTask} used by {@link RejectableThreadPoolExecutor}.
- *
- * @see RejectableThreadPoolExecutor
- */
-public class RejectableFutureTask<V> extends FutureTask<V> implements Rejectable {
-
- private final Rejectable rejectable;
-
- public RejectableFutureTask(Callable<V> callable) {
- super(callable);
- this.rejectable = callable instanceof Rejectable ? (Rejectable) callable : null;
- }
-
- public RejectableFutureTask(Runnable runnable, V result) {
- super(runnable, result);
- this.rejectable = runnable instanceof Rejectable ? (Rejectable) runnable : null;
- }
-
- @Override
- public void reject() {
- if (rejectable != null) {
- rejectable.reject();
- }
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableScheduledThreadPoolExecutor.java b/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableScheduledThreadPoolExecutor.java
deleted file mode 100644
index 2cba540..0000000
--- a/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableScheduledThreadPoolExecutor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.util.concurrent;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.RunnableFuture;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
-
-/**
- * Scheduled thread pool executor that creates {@link RejectableFutureTask} instead of
- * {@link java.util.concurrent.FutureTask} when registering new tasks for execution.
- * <p/>
- * Instances of {@link RejectableFutureTask} are required to handle {@link org.apache.camel.ThreadPoolRejectedPolicy#Discard}
- * and {@link org.apache.camel.ThreadPoolRejectedPolicy#DiscardOldest} policies correctly, e.g. notify
- * {@link Callable} and {@link Runnable} tasks when they are rejected.
- * To be notified of rejection tasks have to implement {@link org.apache.camel.Rejectable} interface: <br/>
- * <code><pre>
- * public class RejectableTask implements Runnable, Rejectable {
- * @Override
- * public void run() {
- * // execute task
- * }
- * @Override
- * public void reject() {
- * // do something useful on rejection
- * }
- * }
- * </pre></code>
- * <p/>
- * If the task does not implement {@link org.apache.camel.Rejectable} interface the behavior is exactly the same as with
- * ordinary {@link ScheduledThreadPoolExecutor}.
- *
- * @see RejectableFutureTask
- * @see org.apache.camel.Rejectable
- * @see RejectableThreadPoolExecutor
- */
-public class RejectableScheduledThreadPoolExecutor extends ScheduledThreadPoolExecutor {
-
- public RejectableScheduledThreadPoolExecutor(int corePoolSize) {
- super(corePoolSize);
- }
-
- public RejectableScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory) {
- super(corePoolSize, threadFactory);
- }
-
- public RejectableScheduledThreadPoolExecutor(int corePoolSize, RejectedExecutionHandler handler) {
- super(corePoolSize, handler);
- }
-
- public RejectableScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
- super(corePoolSize, threadFactory, handler);
- }
-
- @Override
- protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
- return new RejectableFutureTask<T>(runnable, value);
- }
-
- @Override
- protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
- return new RejectableFutureTask<T>(callable);
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableThreadPoolExecutor.java b/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableThreadPoolExecutor.java
deleted file mode 100644
index 5d82117..0000000
--- a/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableThreadPoolExecutor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.util.concurrent;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.RunnableFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Thread pool executor that creates {@link RejectableFutureTask} instead of
- * {@link java.util.concurrent.FutureTask} when registering new tasks for execution.
- * <p/>
- * Instances of {@link RejectableFutureTask} are required to handle {@link org.apache.camel.ThreadPoolRejectedPolicy#Discard}
- * and {@link org.apache.camel.ThreadPoolRejectedPolicy#DiscardOldest} policies correctly, e.g. notify
- * {@link Callable} and {@link Runnable} tasks when they are rejected.
- * To be notified of rejection tasks have to implement {@link org.apache.camel.Rejectable} interface: <br/>
- * <code><pre>
- * public class RejectableTask implements Runnable, Rejectable {
- * @Override
- * public void run() {
- * // execute task
- * }
- * @Override
- * public void reject() {
- * // do something useful on rejection
- * }
- * }
- * </pre></code>
- * <p/>
- * If the task does not implement {@link org.apache.camel.Rejectable} interface the behavior is exactly the same as with
- * ordinary {@link ThreadPoolExecutor}.
- *
- * @see RejectableFutureTask
- * @see org.apache.camel.Rejectable
- * @see RejectableScheduledThreadPoolExecutor
- */
-public class RejectableThreadPoolExecutor extends ThreadPoolExecutor {
-
- public RejectableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
- BlockingQueue<Runnable> workQueue) {
- super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
- }
-
- public RejectableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
- BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) {
- super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
- }
-
- public RejectableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
- BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
- super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
- }
-
- public RejectableThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
- BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
- super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
- }
-
- @Override
- protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
- return new RejectableFutureTask<T>(runnable, value);
- }
-
- @Override
- protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
- return new RejectableFutureTask<T>(callable);
- }
-
-}
diff --git a/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java b/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
index df777c2..d3ace56 100644
--- a/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
+++ b/camel-core/src/main/java/org/apache/camel/util/concurrent/SubmitOrderedCompletionService.java
@@ -89,7 +89,8 @@
this.executor = executor;
}
- public Future<V> submit(Callable<V> task) {
+ @SuppressWarnings("unchecked")
+ public Future<V> submit(Callable task) {
if (task == null) {
throw new IllegalArgumentException("Task must be provided");
}
@@ -112,9 +113,10 @@
return completionQueue.take();
}
+ @SuppressWarnings("unchecked")
public Future<V> poll() {
index.incrementAndGet();
- Future<V> answer = completionQueue.poll();
+ Future answer = completionQueue.poll();
if (answer == null) {
// decrease counter if we didnt get any data
index.decrementAndGet();
@@ -122,9 +124,10 @@
return answer;
}
+ @SuppressWarnings("unchecked")
public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException {
index.incrementAndGet();
- Future<V> answer = completionQueue.poll(timeout, unit);
+ Future answer = completionQueue.poll(timeout, unit);
if (answer == null) {
// decrease counter if we didnt get any data
index.decrementAndGet();
diff --git a/camel-core/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java b/camel-core/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
index c1a3df7..06d2def 100644
--- a/camel-core/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/concurrent/ThreadHelper.java
@@ -17,8 +17,6 @@
package org.apache.camel.util.concurrent;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.camel.util.ObjectHelper;
@@ -26,9 +24,8 @@
* Various helper method for thread naming.
*/
public final class ThreadHelper {
- public static final String DEFAULT_PATTERN = "Camel Thread ##counter# - #name#";
- private static final Pattern INVALID_PATTERN = Pattern.compile(".*#\\w+#.*");
-
+ public static final String DEFAULT_PATTERN = "Camel Thread ${counter} - ${name}";
+
private static AtomicLong threadCounter = new AtomicLong();
private ThreadHelper() {
@@ -40,8 +37,6 @@
/**
* Creates a new thread name with the given pattern
- * <p/>
- * See {@link org.apache.camel.spi.ExecutorServiceManager#setThreadNamePattern(String)} for supported patterns.
*
* @param pattern the pattern
* @param name the name
@@ -52,23 +47,26 @@
pattern = DEFAULT_PATTERN;
}
- // we support #longName# and #name# as name placeholders
+ // the name could potential have a $ sign we want to keep
+ if (name.indexOf("$") > -1) {
+ name = name.replaceAll("\\$", "CAMEL_REPLACE_ME");
+ }
+
+ // we support ${longName} and ${name} as name placeholders
String longName = name;
String shortName = name.contains("?") ? ObjectHelper.before(name, "?") : name;
- // must quote the names to have it work as literal replacement
- shortName = Matcher.quoteReplacement(shortName);
- longName = Matcher.quoteReplacement(longName);
- // replace tokens
- String answer = pattern.replaceFirst("#counter#", "" + nextThreadCounter());
- answer = answer.replaceFirst("#longName#", longName);
- answer = answer.replaceFirst("#name#", shortName);
-
- // are there any #word# combos left, if so they should be considered invalid tokens
- if (INVALID_PATTERN.matcher(answer).matches()) {
+ String answer = pattern.replaceFirst("\\$\\{counter\\}", "" + nextThreadCounter());
+ answer = answer.replaceFirst("\\$\\{longName\\}", longName);
+ answer = answer.replaceFirst("\\$\\{name\\}", shortName);
+ if (answer.indexOf("$") > -1 || answer.indexOf("${") > -1 || answer.indexOf("}") > -1) {
throw new IllegalArgumentException("Pattern is invalid: " + pattern);
}
+ if (answer.indexOf("CAMEL_REPLACE_ME") > -1) {
+ answer = answer.replaceAll("CAMEL_REPLACE_ME", "\\$");
+ }
+
return answer;
}
diff --git a/camel-core/src/main/java/org/apache/camel/util/jndi/JndiContext.java b/camel-core/src/main/java/org/apache/camel/util/jndi/JndiContext.java
index f43ae6e..69f2636 100644
--- a/camel-core/src/main/java/org/apache/camel/util/jndi/JndiContext.java
+++ b/camel-core/src/main/java/org/apache/camel/util/jndi/JndiContext.java
@@ -413,7 +413,7 @@
public Object nextElement() {
Map.Entry<String, Object> entry = getNext();
- return new NameClassPair(entry.getKey(), entry.getValue().getClass().getName());
+ return new NameClassPair((String)entry.getKey(), entry.getValue().getClass().getName());
}
}
@@ -427,7 +427,7 @@
public Object nextElement() {
Map.Entry<String, Object> entry = getNext();
- return new Binding(entry.getKey(), entry.getValue());
+ return new Binding((String)entry.getKey(), entry.getValue());
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/view/GraphSupport.java b/camel-core/src/main/java/org/apache/camel/view/GraphSupport.java
index c36ae01..f82627e 100644
--- a/camel-core/src/main/java/org/apache/camel/view/GraphSupport.java
+++ b/camel-core/src/main/java/org/apache/camel/view/GraphSupport.java
@@ -100,14 +100,14 @@
list.add(route);
}
- protected boolean isMulticastNode(ProcessorDefinition<?> node) {
+ protected boolean isMulticastNode(ProcessorDefinition node) {
return node instanceof MulticastDefinition || node instanceof ChoiceDefinition;
}
/**
* Is the given node a pipeline
*/
- protected boolean isPipeline(ProcessorDefinition<?> node) {
+ protected boolean isPipeline(ProcessorDefinition node) {
if (node instanceof MulticastDefinition) {
return false;
}
diff --git a/camel-core/src/main/java/org/apache/camel/view/NodeData.java b/camel-core/src/main/java/org/apache/camel/view/NodeData.java
index 3929592..ba29f66 100644
--- a/camel-core/src/main/java/org/apache/camel/view/NodeData.java
+++ b/camel-core/src/main/java/org/apache/camel/view/NodeData.java
@@ -51,9 +51,10 @@
public String nodeType;
public boolean nodeWritten;
public String url;
- public List<ProcessorDefinition<?>> outputs;
+ public List<ProcessorDefinition> outputs;
public String association = "property";
+ @SuppressWarnings("unchecked")
public NodeData(String id, Object node, String imagePrefix) {
this.id = id;
@@ -93,7 +94,7 @@
this.edgeLabel = "";
ChoiceDefinition choice = (ChoiceDefinition)node;
- List<ProcessorDefinition<?>> outputs = new ArrayList<ProcessorDefinition<?>>(choice.getWhenClauses());
+ List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>(choice.getWhenClauses());
if (choice.getOtherwise() != null) {
outputs.add(choice.getOtherwise());
}
@@ -155,7 +156,7 @@
this.url = "http://camel.apache.org/" + this.nodeType.toLowerCase().replace(' ', '-') + ".html";
}
if (node instanceof ProcessorDefinition && this.outputs == null) {
- ProcessorDefinition<?> processorType = (ProcessorDefinition<?>)node;
+ ProcessorDefinition processorType = (ProcessorDefinition)node;
this.outputs = processorType.getOutputs();
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java b/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java
index a37b9c4..3ac53cc 100644
--- a/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java
+++ b/camel-core/src/main/java/org/apache/camel/view/RouteDotGenerator.java
@@ -83,12 +83,13 @@
}
}
- protected NodeData printNode(PrintWriter writer, NodeData fromData, ProcessorDefinition<?> node) {
+ @SuppressWarnings("unchecked")
+ protected NodeData printNode(PrintWriter writer, NodeData fromData, ProcessorDefinition node) {
if (node instanceof MulticastDefinition) {
// no need for a multicast or interceptor node
- List<ProcessorDefinition<?>> outputs = node.getOutputs();
+ List<ProcessorDefinition> outputs = node.getOutputs();
boolean isPipeline = isPipeline(node);
- for (ProcessorDefinition<?> output : outputs) {
+ for (ProcessorDefinition output : outputs) {
NodeData out = printNode(writer, fromData, output);
// if in pipeline then we should move the from node to the next in the pipeline
if (isPipeline) {
@@ -115,9 +116,9 @@
}
// now lets write any children
- List<ProcessorDefinition<?>> outputs = toData.outputs;
+ List<ProcessorDefinition> outputs = toData.outputs;
if (outputs != null) {
- for (ProcessorDefinition<?> output : outputs) {
+ for (ProcessorDefinition output : outputs) {
NodeData newData = printNode(writer, toData, output);
if (!isMulticastNode(node)) {
toData = newData;
diff --git a/camel-core/src/main/java/org/apache/camel/view/XmlGraphGenerator.java b/camel-core/src/main/java/org/apache/camel/view/XmlGraphGenerator.java
index d8e7567..503561f 100644
--- a/camel-core/src/main/java/org/apache/camel/view/XmlGraphGenerator.java
+++ b/camel-core/src/main/java/org/apache/camel/view/XmlGraphGenerator.java
@@ -98,11 +98,12 @@
}
}
- protected NodeData printNode(PrintWriter writer, NodeData fromData, ProcessorDefinition<?> node) {
+ @SuppressWarnings("unchecked")
+ protected NodeData printNode(PrintWriter writer, NodeData fromData, ProcessorDefinition node) {
if (node instanceof MulticastDefinition) {
// no need for a multicast node
- List<ProcessorDefinition<?>> outputs = node.getOutputs();
- for (ProcessorDefinition<?> output : outputs) {
+ List<ProcessorDefinition> outputs = node.getOutputs();
+ for (ProcessorDefinition output : outputs) {
printNode(writer, fromData, output);
}
return fromData;
@@ -125,9 +126,9 @@
}
// now lets write any children
- List<ProcessorDefinition<?>> outputs = toData.outputs;
+ List<ProcessorDefinition> outputs = toData.outputs;
if (outputs != null) {
- for (ProcessorDefinition<?> output : outputs) {
+ for (ProcessorDefinition output : outputs) {
NodeData newData = printNode(writer, toData, output);
if (!isMulticastNode(node)) {
toData = newData;
diff --git a/camel-core/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/camel-core/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
index 46a5a3c..08d5839 100644
--- a/camel-core/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ b/camel-core/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -16,11 +16,8 @@
#
# keep at least one package in camel-core so the annotation type converter
-# should at least be able to discover one package to scan notice that there
-# are no @Converter classes in org.apache.camel.core. As all camel-core
+# should at least be able to discover one package to scan
+# notice that there are no @Converter classes in util. As all camel-core
# type converters have been pre-loaded without package scanning, as that is
-# faster.
-# If you adding a new converter class in camel-core, please added the class
-# into CorePackageScanClassResolver
-
+# faster
org.apache.camel.core
diff --git a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
index 6aeeabc..cd679d8 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/dataformat/jaxb.index
@@ -14,8 +14,6 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ------------------------------------------------------------------------
-AvroDataFormat
-BeanioDataFormat
BindyDataFormat
BindyType
CastorDataFormat
diff --git a/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java b/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
index 9bb8c7a..b82a982 100644
--- a/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
+++ b/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
@@ -142,12 +142,13 @@
/**
* Whether or not type converters should be lazy loaded (notice core converters is always loaded)
+ * <p/>
+ * We enabled lazy by default as it would speedup unit testing.
*
- * @return <tt>false</tt> by default.
+ * @return <tt>true</tt> by default.
*/
- @Deprecated
protected boolean isLazyLoadingTypeConverter() {
- return false;
+ return true;
}
protected void stopCamelContext() throws Exception {
@@ -175,7 +176,6 @@
}
}
- @SuppressWarnings("deprecation")
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new DefaultCamelContext(createRegistry());
context.setLazyLoadTypeConverters(isLazyLoadingTypeConverter());
diff --git a/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java b/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java
index 4c4f171..ba9446a 100644
--- a/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/builder/ExceptionBuilderTest.java
@@ -160,7 +160,6 @@
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0).maximumRedeliveries(3));
diff --git a/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseTest.java b/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseTest.java
index f45aabe..3f7629a 100644
--- a/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseTest.java
+++ b/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseTest.java
@@ -24,9 +24,13 @@
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
import org.apache.camel.Message;
import org.apache.camel.Processor;
+import org.apache.camel.component.bean.pojomessage.Person;
+import org.apache.camel.component.bean.pojomessage.PojoProxyHelperRequestReplyTest.PersonHandler;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.util.ObjectHelper;
/**
* @version
diff --git a/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java b/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
index 999d0dc..165f80b 100644
--- a/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
@@ -371,7 +371,7 @@
Channel channel = unwrapChannel(consumer.getProcessor());
Pipeline line = assertIsInstanceOf(Pipeline.class, channel.getNextProcessor());
- Iterator<?> it = line.getProcessors().iterator();
+ Iterator it = line.getProcessors().iterator();
// EvaluateExpressionProcessor should be wrapped in error handler
Object first = it.next();
@@ -486,7 +486,7 @@
Channel channel = unwrapChannel(consumer.getProcessor());
Pipeline line = assertIsInstanceOf(Pipeline.class, channel.getNextProcessor());
- Iterator<?> it = line.getProcessors().iterator();
+ Iterator it = line.getProcessors().iterator();
assertIsInstanceOf(ThreadsProcessor.class, it.next());
// output should be wrapped in a pipeline
diff --git a/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java b/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java
index b62ff74..919010a 100644
--- a/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java
+++ b/camel-core/src/test/java/org/apache/camel/builder/xml/XPathTransformTest.java
@@ -57,12 +57,12 @@
assertEquals("<root><firstname>Servicemix</firstname><lastname>Camel</lastname></root>", out);
}
- public void testXPathNamespaceLoggingEnabledJavaDSL() throws Exception {
+ public void testXPathNamespaceTracingEnabledJavaDSL() throws Exception {
Logger l = createNiceMock(Logger.class);
- expect(l.isInfoEnabled()).andReturn(true).anyTimes();
+ expect(l.isTraceEnabled()).andReturn(true).anyTimes();
- l.info(contains("Namespaces discovered in message"), anyObject());
+ l.trace(contains("Namespaces discovered in message"), anyObject());
expectLastCall().times(1);
replay(l);
@@ -79,19 +79,19 @@
logField.set(null, l);
- NodeList list = XPathBuilder.xpath("//*", NodeList.class).logNamespaces().evaluate(context, doc, NodeList.class);
+ NodeList list = XPathBuilder.xpath("//*", NodeList.class).traceNamespaces().evaluate(context, doc, NodeList.class);
assertNotNull(list);
verify(l);
}
- public void testXPathNamespaceLoggingDisabledJavaDSL() throws Exception {
+ public void testXPathNamespaceTracingDisabledJavaDSL() throws Exception {
Logger l = createNiceMock(Logger.class);
- expect(l.isInfoEnabled()).andReturn(true).anyTimes();
+ expect(l.isTraceEnabled()).andReturn(true).anyTimes();
Capture<String> captures = new Capture<String>(CaptureType.ALL);
- l.info(capture(captures), anyObject());
+ l.trace(capture(captures), anyObject());
expectLastCall().anyTimes();
replay(l);
@@ -116,7 +116,7 @@
for (String c : captures.getValues()) {
if (c.contains("Namespaces discovered in message")) {
- throw new AssertionError("Did not expect LOG.info with 'Namespaces discovered in message'");
+ throw new AssertionError("Did not expect LOG.trace with 'Namespaces discovered in message'");
}
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
index 8ee9c55..bc53a85 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
@@ -135,7 +135,7 @@
return body;
}
- public String heads(String body, Map<?, ?> headers) {
+ public String heads(String body, Map headers) {
return headers.get("hello") + " " + body;
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
index 0a2bc09..02b9005 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
@@ -166,7 +166,7 @@
return body;
}
- public String heads(String body, Map<?, ?> headers) {
+ public String heads(String body, Map headers) {
return headers.get("hello") + " " + body;
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersAndBodyInjectionTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersAndBodyInjectionTest.java
index 9345d0f..1ba507d1 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersAndBodyInjectionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersAndBodyInjectionTest.java
@@ -50,8 +50,8 @@
assertEquals("Should not fail", false, out.isFailed());
- Map<?, ?> foo = myBean.foo;
- Map<?, ?> bar = myBean.bar;
+ Map foo = myBean.foo;
+ Map bar = myBean.bar;
assertNotNull("myBean.foo", foo);
assertNotNull("myBean.bar", bar);
@@ -79,8 +79,8 @@
}
public static class MyBean {
- private Map<?, ?> foo;
- private Map<?, ?> bar;
+ private Map foo;
+ private Map bar;
private String body;
@Override
@@ -88,7 +88,7 @@
return "MyBean[foo: " + foo + " bar: " + bar + " body: " + body + "]";
}
- public void myMethod(@Properties Map<?, ?> foo, @Headers Map<?, ?> bar, @Body String body) {
+ public void myMethod(@Properties Map foo, @Headers Map bar, @Body String body) {
this.foo = foo;
this.bar = bar;
this.body = body;
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersInjectionTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersInjectionTest.java
index 45adf30..48f332a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersInjectionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanWithPropertiesAndHeadersInjectionTest.java
@@ -51,8 +51,8 @@
}
});
- Map<?, ?> foo = myBean.foo;
- Map<?, ?> bar = myBean.bar;
+ Map foo = myBean.foo;
+ Map bar = myBean.bar;
assertNotNull("myBean.foo", foo);
assertNotNull("myBean.bar", bar);
@@ -79,15 +79,15 @@
}
public static class MyBean {
- public Map<?, ?> foo;
- public Map<?, ?> bar;
+ public Map foo;
+ public Map bar;
@Override
public String toString() {
return "MyBean[foo: " + foo + " bar: " + bar + "]";
}
- public void myMethod(@Properties Map<?, ?> foo, @Headers Map<?, ?> bar) {
+ public void myMethod(@Properties Map foo, @Headers Map bar) {
this.foo = foo;
this.bar = bar;
LOG.info("myMethod() method called on " + this);
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/MyApplicationException.java b/camel-core/src/test/java/org/apache/camel/component/bean/MyApplicationException.java
index ae0bb0a..d00ca58 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/MyApplicationException.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/MyApplicationException.java
@@ -21,7 +21,6 @@
*/
public class MyApplicationException extends Exception {
- private static final long serialVersionUID = 1L;
private final int code;
public MyApplicationException(String message, int code) {
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/MyCustomException.java b/camel-core/src/test/java/org/apache/camel/component/bean/MyCustomException.java
index b4b197e..ee913a8 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/MyCustomException.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/MyCustomException.java
@@ -18,8 +18,6 @@
public class MyCustomException extends Exception {
- private static final long serialVersionUID = 1L;
-
public MyCustomException(String message) {
super(message);
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/OrderServiceBean.java b/camel-core/src/test/java/org/apache/camel/component/bean/OrderServiceBean.java
index 294ec9a..6bcbcd4 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/OrderServiceBean.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/OrderServiceBean.java
@@ -33,7 +33,7 @@
this.converter = converter;
}
- public String handleCustom(GenericFile<?> file) {
+ public String handleCustom(GenericFile file) {
String content = converter.convertTo(String.class, file.getBody());
String orderId = FileUtil.stripExt(file.getFileNameOnly());
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureExceptionTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureExceptionTest.java
index 37faa4f..05ec612 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureExceptionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureExceptionTest.java
@@ -31,7 +31,7 @@
public void testFutureEchoException() throws Exception {
Echo service = ProxyHelper.createProxy(context.getEndpoint("direct:echo"), Echo.class);
- Future<String> future = service.asText(4);
+ Future future = service.asText(4);
log.info("Got future");
assertFalse("Should not be done", future.isDone());
log.info("Waiting for future to be done ...");
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureTest.java
index 9b74f0d..bdd54ae 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/ProxyReturnFutureTest.java
@@ -31,13 +31,13 @@
public void testFutureEcho() throws Exception {
Echo service = ProxyHelper.createProxy(context.getEndpoint("direct:echo"), Echo.class);
- Future<String> future = service.asText(4);
+ Future future = service.asText(4);
log.info("Got future");
assertFalse("Should not be done", future.isDone());
log.info("Waiting for future to be done ...");
- String reply = future.get(5, TimeUnit.SECONDS);
+ String reply = (String) future.get(5, TimeUnit.SECONDS);
assertEquals("Four", reply);
}
// END SNIPPET: e2
@@ -45,7 +45,7 @@
public void testFutureEchoCallTwoTimes() throws Exception {
Echo service = ProxyHelper.createProxy(context.getEndpoint("direct:echo"), Echo.class);
- Future<String> future = service.asText(4);
+ Future future = service.asText(4);
log.info("Got future");
assertFalse("Should not be done", future.isDone());
log.info("Waiting for future to be done ...");
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java b/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java
deleted file mode 100644
index 08f3b12..0000000
--- a/camel-core/src/test/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilterTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.file;
-
-import java.io.File;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-
-/**
- * Unit tests for {@link AntPathMatcherGenericFileFilter}.
- */
-public class AntPathMatcherGenericFileFilterTest extends ContextTestSupport {
-
- @Override
- protected void setUp() throws Exception {
- deleteDirectory("target/files");
- super.setUp();
- }
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- JndiRegistry jndi = super.createRegistry();
- jndi.bind("filter", new AntPathMatcherGenericFileFilter<File>("**/c*"));
- return jndi;
- }
-
- public void testInclude() throws Exception {
-
- template.sendBodyAndHeader("file://target/files/ant-path-1/x/y/z", "Hello World", Exchange.FILE_NAME, "report.txt");
-
- MockEndpoint mock = getMockEndpoint("mock:result1");
- mock.expectedBodiesReceivedInAnyOrder("Hello World");
-
- assertMockEndpointsSatisfied();
- oneExchangeDone.matchesMockWaitTime();
- }
-
- public void testExclude() throws Exception {
-
- template.sendBodyAndHeader("file://target/files/ant-path-2/x/y/z", "Hello World 1", Exchange.FILE_NAME, "report.bak");
- template.sendBodyAndHeader("file://target/files/ant-path-2/x/y/z", "Hello World 2", Exchange.FILE_NAME, "report.txt");
-
- MockEndpoint mock = getMockEndpoint("mock:result2");
- mock.expectedBodiesReceivedInAnyOrder("Hello World 2");
-
- assertMockEndpointsSatisfied();
- oneExchangeDone.matchesMockWaitTime();
- }
-
- public void testIncludesAndExcludes() throws Exception {
-
- template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.pdf");
- template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 2", Exchange.FILE_NAME, "m.pdf");
- template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 3", Exchange.FILE_NAME, "b.txt");
- template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 4", Exchange.FILE_NAME, "m.txt");
- template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 5", Exchange.FILE_NAME, "b.bak");
- template.sendBodyAndHeader("file://target/files/ant-path-3/x/y/z", "Hello World 6", Exchange.FILE_NAME, "m.bak");
-
- MockEndpoint mock = getMockEndpoint("mock:result3");
- mock.expectedBodiesReceivedInAnyOrder("Hello World 2", "Hello World 4");
-
- assertMockEndpointsSatisfied();
- oneExchangeDone.matchesMockWaitTime();
- }
-
- public void testIncludesAndExcludesAndFilter() throws Exception {
-
- template.sendBodyAndHeader("file://target/files/ant-path-4/x/y/z", "Hello World 1", Exchange.FILE_NAME, "a.txt");
- template.sendBodyAndHeader("file://target/files/ant-path-4/x/y/z", "Hello World 2", Exchange.FILE_NAME, "b.txt");
- template.sendBodyAndHeader("file://target/files/ant-path-4/x/y/z", "Hello World 3", Exchange.FILE_NAME, "c.txt");
-
- MockEndpoint mock = getMockEndpoint("mock:result4");
- mock.expectedBodiesReceivedInAnyOrder("Hello World 3");
-
- assertMockEndpointsSatisfied();
- oneExchangeDone.matchesMockWaitTime();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() throws Exception {
-
- from("file://target/files/ant-path-1?recursive=true&antInclude=**/*.txt").convertBodyTo(String.class).to("mock:result1");
-
- from("file://target/files/ant-path-2?recursive=true&antExclude=**/*.bak").convertBodyTo(String.class).to("mock:result2");
-
- from("file://target/files/ant-path-3?recursive=true&antInclude=**/*.pdf,**/*.txt&antExclude=**/a*,**/b*").convertBodyTo(String.class).to("mock:result3");
-
- from("file://target/files/ant-path-4?recursive=true&antInclude=**/*.txt&antExclude=**/a*&filter=#filter").convertBodyTo(String.class).to("mock:result4");
- }
- };
- }
-}
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileFilterTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileFilterTest.java
index ae1777b..7cb9cfc 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileFilterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileFilterTest.java
@@ -32,7 +32,7 @@
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
- jndi.bind("myFilter", new MyFileFilter<Object>());
+ jndi.bind("myFilter", new MyFileFilter());
return jndi;
}
@@ -76,8 +76,8 @@
}
// START SNIPPET: e1
- public class MyFileFilter<T> implements GenericFileFilter<T> {
- public boolean accept(GenericFile<T> pathname) {
+ public class MyFileFilter implements GenericFileFilter {
+ public boolean accept(GenericFile pathname) {
// we dont accept any files starting with skip in the name
return !pathname.getFileName().startsWith("skip");
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempFileNameTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempFileNameTest.java
index 263b495..e3490c8 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempFileNameTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempFileNameTest.java
@@ -38,7 +38,7 @@
public void testCreateTempFileName() throws Exception {
Endpoint endpoint = context.getEndpoint(fileUrl);
- GenericFileProducer<?> producer = (GenericFileProducer<?>) endpoint.createProducer();
+ GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");
@@ -48,7 +48,7 @@
public void testNoPathCreateTempFileName() throws Exception {
Endpoint endpoint = context.getEndpoint(fileUrl);
- GenericFileProducer<?> producer = (GenericFileProducer<?>) endpoint.createProducer();
+ GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempPrefixTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempPrefixTest.java
index f2dbed0..a22ddd6 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempPrefixTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempPrefixTest.java
@@ -38,7 +38,7 @@
public void testCreateTempFileName() throws Exception {
Endpoint endpoint = context.getEndpoint(fileUrl);
- GenericFileProducer<?> producer = (GenericFileProducer<?>) endpoint.createProducer();
+ GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");
@@ -48,7 +48,7 @@
public void testCreateTempFileNameUsingComplexName() throws Exception {
Endpoint endpoint = context.getEndpoint(fileUrl);
- GenericFileProducer<?> producer = (GenericFileProducer<?>) endpoint.createProducer();
+ GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader(Exchange.FILE_NAME, "foo/claus.txt");
@@ -58,7 +58,7 @@
public void testNoPathCreateTempFileName() throws Exception {
Endpoint endpoint = context.getEndpoint(fileUrl);
- GenericFileProducer<?> producer = (GenericFileProducer<?>) endpoint.createProducer();
+ GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java
index d6afbf7..c240f8b 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileSorterRefTest.java
@@ -39,7 +39,7 @@
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
- jndi.bind("mySorter", new MyFileSorter<Object>());
+ jndi.bind("mySorter", new MyFileSorter());
return jndi;
}
@@ -73,8 +73,8 @@
}
// START SNIPPET: e1
- public class MyFileSorter<T> implements Comparator<GenericFile<T>> {
- public int compare(GenericFile<T> o1, GenericFile<T> o2) {
+ public class MyFileSorter implements Comparator<GenericFile> {
+ public int compare(GenericFile o1, GenericFile o2) {
return o1.getFileName().compareToIgnoreCase(o2.getFileName());
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameDeleteTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameDeleteTest.java
deleted file mode 100644
index c8eae2d..0000000
--- a/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameDeleteTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.file;
-
-import java.io.File;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * Unit test for writing done files
- */
-public class FilerConsumerDoneFileNameDeleteTest extends ContextTestSupport {
-
- @Override
- protected void setUp() throws Exception {
- deleteDirectory("target/done");
- super.setUp();
- }
-
- public void testDoneFile() throws Exception {
- getMockEndpoint("mock:result").expectedMessageCount(0);
-
- template.sendBodyAndHeader("file:target/done", "Hello World", Exchange.FILE_NAME, "hello.txt");
-
- // wait a bit and it should not pickup the written file as there are no done file
- Thread.sleep(250);
-
- assertMockEndpointsSatisfied();
- resetMocks();
- oneExchangeDone.reset();
-
- getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
-
- // write the done file
- template.sendBodyAndHeader("file:target/done", "", Exchange.FILE_NAME, "done");
-
- assertMockEndpointsSatisfied();
- oneExchangeDone.matchesMockWaitTime();
-
- // done file should be deleted now
- File file = new File("target/done/done").getAbsoluteFile();
- assertFalse("Done file should be deleted: " + file, file.exists());
-
- // as well the original file should be deleted
- file = new File("target/done/hello.txt").getAbsoluteFile();
- assertFalse("Original file should be deleted: " + file, file.exists());
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("file:target/done?doneFileName=done&delete=true&initialDelay=0&delay=10").to("mock:result");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java
index 707c646..6009431 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FilerConsumerDoneFileNameTest.java
@@ -56,10 +56,6 @@
// done file should be deleted now
File file = new File("target/done/done").getAbsoluteFile();
assertFalse("Done file should be deleted: " + file, file.exists());
-
- // as well the original file should be moved to backup
- file = new File("target/done/.camel/hello.txt").getAbsoluteFile();
- assertTrue("Original file should be moved: " + file, file.exists());
}
@Override
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategyTest.java b/camel-core/src/test/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategyTest.java
index bc69572..14cfd37 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategyTest.java
@@ -94,36 +94,36 @@
}
}
+ @SuppressWarnings("unchecked")
public void testTroubleDeletingFile() throws Exception {
deleteCounter = 0;
existsCounter = 0;
- @SuppressWarnings("unchecked")
- GenericFileEndpoint<Object> endpoint = context.getEndpoint("file://target/foo", GenericFileEndpoint.class);
+ GenericFileEndpoint endpoint = context.getEndpoint("file://target/foo", GenericFileEndpoint.class);
Exchange exchange = endpoint.createExchange();
- GenericFile<Object> file = new GenericFile<Object>();
+ GenericFile file = new GenericFile();
file.setAbsoluteFilePath("target/foo/me.txt");
- GenericFileDeleteProcessStrategy<Object> strategy = new GenericFileDeleteProcessStrategy<Object>();
+ GenericFileDeleteProcessStrategy strategy = new GenericFileDeleteProcessStrategy();
strategy.commit(new MyGenericFileOperations(), endpoint, exchange, file);
assertEquals("Should have tried to delete file 2 times", 2, deleteCounter);
assertEquals("Should have tried to delete file 2 times", 2, existsCounter);
}
+ @SuppressWarnings("unchecked")
public void testCannotDeleteFile() throws Exception {
deleteCounter = 0;
existsCounter = 0;
- @SuppressWarnings("unchecked")
- GenericFileEndpoint<Object> endpoint = context.getEndpoint("file://target/foo", GenericFileEndpoint.class);
+ GenericFileEndpoint endpoint = context.getEndpoint("file://target/foo", GenericFileEndpoint.class);
Exchange exchange = endpoint.createExchange();
- GenericFile<Object> file = new GenericFile<Object>();
+ GenericFile file = new GenericFile();
file.setAbsoluteFilePath("target/foo/boom.txt");
- GenericFileDeleteProcessStrategy<Object> strategy = new GenericFileDeleteProcessStrategy<Object>();
+ GenericFileDeleteProcessStrategy strategy = new GenericFileDeleteProcessStrategy();
try {
strategy.commit(new MyGenericFileOperations(), endpoint, exchange, file);
fail("Should have thrown an exception");
diff --git a/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java b/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java
index b1c2ca0..c309997 100644
--- a/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java
@@ -61,49 +61,6 @@
}
}
- public void testIgnoreMissingPropertyFilesOnClasspath() throws Exception {
- System.setProperty("bar.end", "mock:bar");
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/unknown.properties&ignoreMissingLocation=true");
- }
- });
- context.start();
- getMockEndpoint("mock:bar").expectedMessageCount(1);
- template.sendBody("direct:start", "Hello World");
- assertMockEndpointsSatisfied();
- }
-
- public void testIgnoreMissingPropertyFilesFromRegistry() throws Exception {
- System.setProperty("bar.end", "mock:bar");
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("properties:bar.end?locations=ref:unknown.properties&ignoreMissingLocation=true");
- }
- });
- context.start();
- getMockEndpoint("mock:bar").expectedMessageCount(1);
- template.sendBody("direct:start", "Hello World");
- assertMockEndpointsSatisfied();
- }
-
- public void testIgnoreMissingPropertyFilesFromFilePath() throws Exception {
- System.setProperty("bar.end", "mock:bar");
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("properties:bar.end?locations=file:unknown.properties&ignoreMissingLocation=true");
- }
- });
- context.start();
- getMockEndpoint("mock:bar").expectedMessageCount(1);
- template.sendBody("direct:start", "Hello World");
- assertMockEndpointsSatisfied();
- }
-
-
@Override
public boolean isUseRouteBuilder() {
return false;
diff --git a/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesResolverTest.java b/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesResolverTest.java
index cfae41c..cb94659 100644
--- a/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesResolverTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesResolverTest.java
@@ -64,7 +64,7 @@
public static class MyCustomResolver implements PropertiesResolver {
- public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... uri) throws Exception {
+ public Properties resolveProperties(CamelContext context, String... uri) throws Exception {
Properties answer = new Properties();
answer.put("foo", "mock:result");
return answer;
diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentTest.java
index 5cbbf5a..56b73e0 100644
--- a/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentTest.java
@@ -102,7 +102,7 @@
// must start the template
pt.start();
- List<Future<Object>> replies = new ArrayList<Future<Object>>(20);
+ List<Future> replies = new ArrayList<Future>(20);
for (int i = 0; i < 20; i++) {
Future<Object> out = pt.asyncRequestBody("seda:bar", "Message " + i);
replies.add(out);
diff --git a/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskNewerOnCompletionTest.java b/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskNewerOnCompletionTest.java
index 9e54974..5fa5b40 100644
--- a/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskNewerOnCompletionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/seda/SedaWaitForTaskNewerOnCompletionTest.java
@@ -88,4 +88,4 @@
}
};
}
-}
\ No newline at end of file
+}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java b/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java
index c664c2e..a7c95a6 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java
@@ -123,7 +123,7 @@
// should be prepared, check parents has been set
assertNotNull("Parent should be set on outputs");
route = context.getRouteDefinition("foo");
- for (ProcessorDefinition<?> output : route.getOutputs()) {
+ for (ProcessorDefinition output : route.getOutputs()) {
assertNotNull("Parent should be set on output", output.getParent());
assertEquals(route, output.getParent());
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/CamelPostProcessorHelperTest.java b/camel-core/src/test/java/org/apache/camel/impl/CamelPostProcessorHelperTest.java
index 68eb606..4091b63 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/CamelPostProcessorHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/CamelPostProcessorHelperTest.java
@@ -122,7 +122,7 @@
EndpointInject endpointInject = method.getAnnotation(EndpointInject.class);
Class<?>[] parameterTypes = method.getParameterTypes();
- for (Class<?> type : parameterTypes) {
+ for (Class type : parameterTypes) {
String propertyName = ObjectHelper.getPropertyName(method);
Object value = helper.getInjectionValue(type, endpointInject.uri(), endpointInject.ref(), propertyName, bean, "foo");
ObjectHelper.invokeMethod(method, bean, value);
@@ -145,7 +145,7 @@
EndpointInject endpointInject = method.getAnnotation(EndpointInject.class);
Class<?>[] parameterTypes = method.getParameterTypes();
- for (Class<?> type : parameterTypes) {
+ for (Class type : parameterTypes) {
String propertyName = ObjectHelper.getPropertyName(method);
Object value = helper.getInjectionValue(type, endpointInject.uri(), endpointInject.ref(), propertyName, bean, "foo");
ObjectHelper.invokeMethod(method, bean, value);
@@ -172,7 +172,7 @@
EndpointInject endpointInject = method.getAnnotation(EndpointInject.class);
Class<?>[] parameterTypes = method.getParameterTypes();
- for (Class<?> type : parameterTypes) {
+ for (Class type : parameterTypes) {
String propertyName = ObjectHelper.getPropertyName(method);
Object value = helper.getInjectionValue(type, endpointInject.uri(), endpointInject.ref(), propertyName, bean, "foo");
ObjectHelper.invokeMethod(method, bean, value);
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextLazyLoadTypeConvertersTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextLazyLoadTypeConvertersTest.java
index c13e5bf..20ff4ca 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextLazyLoadTypeConvertersTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextLazyLoadTypeConvertersTest.java
@@ -29,18 +29,15 @@
private CamelContext context = new DefaultCamelContext();
- @SuppressWarnings("deprecation")
public void testLazyLoadDefault() throws Exception {
assertFalse("Default setting should have been true", context.isLazyLoadTypeConverters());
}
- @SuppressWarnings("deprecation")
public void testConvertLoadUpFront() throws Exception {
context.setLazyLoadTypeConverters(false);
doConvertTest();
}
- @SuppressWarnings("deprecation")
public void testConvertLazyLoad() throws Exception {
context.setLazyLoadTypeConverters(true);
doConvertTest();
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextWithLifecycleStrategyRestartTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextWithLifecycleStrategyRestartTest.java
index b57ca6e..5700b4e 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextWithLifecycleStrategyRestartTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextWithLifecycleStrategyRestartTest.java
@@ -160,10 +160,6 @@
public void onThreadPoolAdd(CamelContext camelContext, ThreadPoolExecutor threadPool, String id, String sourceId, String routeId, String threadPoolProfileId) {
}
- @Override
- public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool) {
- }
-
public int getContextStartCounter() {
return contextStartCounter.get();
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultClassResolverTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultClassResolverTest.java
index 2698fe3..0149a5b 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultClassResolverTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultClassResolverTest.java
@@ -28,7 +28,7 @@
public void testResolveClass() {
DefaultClassResolver resolver = new DefaultClassResolver();
- Class<?> clazz = resolver.resolveClass("java.lang.Integer");
+ Class clazz = resolver.resolveClass("java.lang.Integer");
assertNotNull(clazz);
}
@@ -40,7 +40,7 @@
public void testResolveClassClassLoader() {
DefaultClassResolver resolver = new DefaultClassResolver();
- Class<?> clazz = resolver.resolveClass("java.lang.Integer", DefaultClassResolverTest.class.getClassLoader());
+ Class clazz = resolver.resolveClass("java.lang.Integer", DefaultClassResolverTest.class.getClassLoader());
assertNotNull(clazz);
}
@@ -52,7 +52,7 @@
public void testResolveMandatoryClass() throws Exception {
DefaultClassResolver resolver = new DefaultClassResolver();
- Class<?> clazz = resolver.resolveMandatoryClass("java.lang.Integer");
+ Class clazz = resolver.resolveMandatoryClass("java.lang.Integer");
assertNotNull(clazz);
}
@@ -64,7 +64,7 @@
public void testResolveMandatoryClassClassLoader() throws Exception {
DefaultClassResolver resolver = new DefaultClassResolver();
- Class<?> clazz = resolver.resolveMandatoryClass("java.lang.Integer", DefaultClassResolverTest.class.getClassLoader());
+ Class clazz = resolver.resolveMandatoryClass("java.lang.Integer", DefaultClassResolverTest.class.getClassLoader());
assertNotNull(clazz);
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeHolderTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeHolderTest.java
index 656a004..ac08681 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeHolderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultExchangeHolderTest.java
@@ -81,9 +81,10 @@
assertNull(exchange.getIn().getHeader("Foo"));
}
+ @SuppressWarnings("unchecked")
public void testSkipNonSerializableDataFromList() throws Exception {
// use a mixed list, the MyFoo is not serializable so the entire list should be skipped
- List<Object> list = new ArrayList<Object>();
+ List list = new ArrayList();
list.add("I am okay");
list.add(new MyFoo("Tiger"));
@@ -103,9 +104,10 @@
assertNull(exchange.getIn().getHeader("Foo"));
}
+ @SuppressWarnings("unchecked")
public void testSkipNonSerializableDataFromMap() throws Exception {
// use a mixed Map, the MyFoo is not serializable so the entire map should be skipped
- Map<String, Object> map = new HashMap<String, Object>();
+ Map map = new HashMap();
map.put("A", "I am okay");
map.put("B", new MyFoo("Tiger"));
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceManagerTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceManagerTest.java
index 8af25e7..a952bf9 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceManagerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceManagerTest.java
@@ -42,8 +42,8 @@
}
public void testGetThreadNameCustomPattern() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("##counter# - #name#");
- assertEquals("##counter# - #name#", context.getExecutorServiceManager().getThreadNamePattern());
+ context.getExecutorServiceManager().setThreadNamePattern("#${counter} - ${name}");
+ assertEquals("#${counter} - ${name}", context.getExecutorServiceManager().getThreadNamePattern());
String foo = context.getExecutorServiceManager().resolveThreadName("foo");
String bar = context.getExecutorServiceManager().resolveThreadName("bar");
@@ -55,7 +55,7 @@
}
public void testGetThreadNameCustomPatternCamelId() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("##camelId# - ##counter# - #name#");
+ context.getExecutorServiceManager().setThreadNamePattern("#${camelId} - #${counter} - ${name}");
String foo = context.getExecutorServiceManager().resolveThreadName("foo");
String bar = context.getExecutorServiceManager().resolveThreadName("bar");
@@ -67,14 +67,14 @@
}
public void testGetThreadNameCustomPatternWithDollar() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("Hello - #name#");
+ context.getExecutorServiceManager().setThreadNamePattern("Hello - ${name}");
String foo = context.getExecutorServiceManager().resolveThreadName("foo$bar");
assertEquals("Hello - foo$bar", foo);
}
public void testGetThreadNameCustomPatternLongName() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("##counter# - #longName#");
+ context.getExecutorServiceManager().setThreadNamePattern("#${counter} - ${longName}");
String foo = context.getExecutorServiceManager().resolveThreadName("foo?beer=Carlsberg");
String bar = context.getExecutorServiceManager().resolveThreadName("bar");
@@ -86,7 +86,7 @@
}
public void testGetThreadNameCustomPatternWithParameters() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("##counter# - #name#");
+ context.getExecutorServiceManager().setThreadNamePattern("#${counter} - ${name}");
String foo = context.getExecutorServiceManager().resolveThreadName("foo?beer=Carlsberg");
String bar = context.getExecutorServiceManager().resolveThreadName("bar");
@@ -98,7 +98,7 @@
}
public void testGetThreadNameCustomPatternNoCounter() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("Cool #name#");
+ context.getExecutorServiceManager().setThreadNamePattern("Cool ${name}");
String foo = context.getExecutorServiceManager().resolveThreadName("foo");
String bar = context.getExecutorServiceManager().resolveThreadName("bar");
@@ -108,16 +108,16 @@
}
public void testGetThreadNameCustomPatternInvalid() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("Cool #xxx#");
+ context.getExecutorServiceManager().setThreadNamePattern("Cool ${xxx}");
try {
context.getExecutorServiceManager().resolveThreadName("foo");
fail("Should thrown an exception");
} catch (IllegalArgumentException e) {
- assertEquals("Pattern is invalid: Cool #xxx#", e.getMessage());
+ assertEquals("Pattern is invalid: Cool ${xxx}", e.getMessage());
}
// reset it so we can shutdown properly
- context.getExecutorServiceManager().setThreadNamePattern("Camel Thread #counter# - #name#");
+ context.getExecutorServiceManager().setThreadNamePattern("Camel Thread ${counter} - ${name}");
}
public void testDefaultThreadPool() throws Exception {
@@ -237,7 +237,7 @@
// should inherit the default values
assertEquals(10, tp.getCorePoolSize());
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.CallerRunsPolicy.class, tp.getRejectedExecutionHandler());
}
public void testGetThreadPoolProfileInheritCustomDefaultValues() throws Exception {
@@ -263,7 +263,7 @@
// should inherit the default values
assertEquals(1, tp.getCorePoolSize());
assertEquals(30, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("Abort", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.AbortPolicy.class, tp.getRejectedExecutionHandler());
}
public void testGetThreadPoolProfileInheritCustomDefaultValues2() throws Exception {
@@ -285,7 +285,7 @@
// should inherit the default values
assertEquals(50, tp.getMaximumPoolSize());
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.CallerRunsPolicy.class, tp.getRejectedExecutionHandler());
}
public void testNewThreadPoolProfile() throws Exception {
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceStrategyTest.java b/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceStrategyTest.java
index 7734cc5..799a993 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceStrategyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceStrategyTest.java
@@ -22,7 +22,6 @@
import org.apache.camel.ContextTestSupport;
import org.apache.camel.ThreadPoolRejectedPolicy;
-import org.apache.camel.util.concurrent.ThreadHelper;
/**
* Unit test to ensure the {@link org.apache.camel.spi.ExecutorServiceStrategy} still
@@ -45,7 +44,7 @@
}
public void testGetThreadNameCustomPattern() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("##counter# - #name#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("#${counter} - ${name}");
String foo = context.getExecutorServiceStrategy().getThreadName("foo");
String bar = context.getExecutorServiceStrategy().getThreadName("bar");
@@ -57,7 +56,7 @@
}
public void testGetThreadNameCustomPatternCamelId() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("##camelId# - ##counter# - #name#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("#${camelId} - #${counter} - ${name}");
String foo = context.getExecutorServiceStrategy().getThreadName("foo");
String bar = context.getExecutorServiceStrategy().getThreadName("bar");
@@ -69,14 +68,14 @@
}
public void testGetThreadNameCustomPatternWithDollar() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("Hello - #name#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("Hello - ${name}");
String foo = context.getExecutorServiceStrategy().getThreadName("foo$bar");
assertEquals("Hello - foo$bar", foo);
}
public void testGetThreadNameCustomPatternLongName() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("##counter# - #longName#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("#${counter} - ${longName}");
String foo = context.getExecutorServiceStrategy().getThreadName("foo?beer=Carlsberg");
String bar = context.getExecutorServiceStrategy().getThreadName("bar");
@@ -88,7 +87,7 @@
}
public void testGetThreadNameCustomPatternWithParameters() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("##counter# - #name#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("#${counter} - ${name}");
String foo = context.getExecutorServiceStrategy().getThreadName("foo?beer=Carlsberg");
String bar = context.getExecutorServiceStrategy().getThreadName("bar");
@@ -100,7 +99,7 @@
}
public void testGetThreadNameCustomPatternNoCounter() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("Cool #name#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("Cool ${name}");
String foo = context.getExecutorServiceStrategy().getThreadName("foo");
String bar = context.getExecutorServiceStrategy().getThreadName("bar");
@@ -110,16 +109,16 @@
}
public void testGetThreadNameCustomPatternInvalid() throws Exception {
- context.getExecutorServiceStrategy().setThreadNamePattern("Cool #xxx#");
+ context.getExecutorServiceStrategy().setThreadNamePattern("Cool ${xxx}");
try {
context.getExecutorServiceStrategy().getThreadName("foo");
fail("Should thrown an exception");
} catch (IllegalArgumentException e) {
- assertEquals("Pattern is invalid: Cool #xxx#", e.getMessage());
+ assertEquals("Pattern is invalid: Cool ${xxx}", e.getMessage());
}
// reset it so we can shutdown properly
- context.getExecutorServiceStrategy().setThreadNamePattern(ThreadHelper.DEFAULT_PATTERN);
+ context.getExecutorServiceStrategy().setThreadNamePattern("Camel Thread ${counter} - ${name}");
}
public void testDefaultThreadPool() throws Exception {
@@ -239,7 +238,7 @@
// should inherit the default values
assertEquals(10, tp.getCorePoolSize());
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.CallerRunsPolicy.class, tp.getRejectedExecutionHandler());
}
public void testGetThreadPoolProfileInheritCustomDefaultValues() throws Exception {
@@ -265,7 +264,7 @@
// should inherit the default values
assertEquals(1, tp.getCorePoolSize());
assertEquals(30, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("Abort", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.AbortPolicy.class, tp.getRejectedExecutionHandler());
}
public void testGetThreadPoolProfileInheritCustomDefaultValues2() throws Exception {
@@ -287,7 +286,7 @@
// should inherit the default values
assertEquals(50, tp.getMaximumPoolSize());
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.CallerRunsPolicy.class, tp.getRejectedExecutionHandler());
}
public void testNewThreadPoolProfile() throws Exception {
diff --git a/camel-core/src/test/java/org/apache/camel/impl/DummyLifecycleStrategy.java b/camel-core/src/test/java/org/apache/camel/impl/DummyLifecycleStrategy.java
index c89bb50..7983239 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/DummyLifecycleStrategy.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/DummyLifecycleStrategy.java
@@ -91,10 +91,6 @@
events.add("onThreadPoolAdd");
}
- public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool) {
- events.add("onThreadPoolRemove");
- }
-
public List<String> getEvents() {
return events;
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java b/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
index b014bbf..b29ee07 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
@@ -51,7 +51,7 @@
context.stop();
List<String> expectedEvents = Arrays.asList("onThreadPoolAdd", "onContextStart", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd", "onServiceAdd",
- "onServiceAdd", "onServiceAdd", "onComponentAdd", "onEndpointAdd", "onComponentRemove", "onContextStop");
+ "onServiceAdd", "onServiceAdd", "onComponentAdd", "onEndpointAdd", "onComponentRemove", "onThreadPoolAdd", "onContextStop");
assertEquals(expectedEvents, dummy1.getEvents());
assertEquals(expectedEvents, dummy2.getEvents());
diff --git a/camel-core/src/test/java/org/apache/camel/impl/MySerialBean.java b/camel-core/src/test/java/org/apache/camel/impl/MySerialBean.java
index ec8e8e7..479561a 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/MySerialBean.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/MySerialBean.java
@@ -23,7 +23,6 @@
*/
public class MySerialBean implements Serializable {
- private static final long serialVersionUID = 1L;
private int id;
private String name;
diff --git a/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesShutdownGracefulTest.java b/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesShutdownGracefulTest.java
index 6ea650b..591dd05 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesShutdownGracefulTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesShutdownGracefulTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.impl;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
@@ -30,10 +27,9 @@
public class PendingExchangesShutdownGracefulTest extends ContextTestSupport {
private static String foo = "";
- private static CountDownLatch latch = new CountDownLatch(1);
public void testShutdownGraceful() throws Exception {
- getMockEndpoint("mock:foo").expectedMinimumMessageCount(1);
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
template.sendBody("seda:foo", "A");
template.sendBody("seda:foo", "B");
@@ -44,11 +40,11 @@
assertMockEndpointsSatisfied();
// now stop the route before its complete
- latch.await(10, TimeUnit.SECONDS);
+ foo = foo + "stop";
context.stop();
// it should wait as there was 1 inflight exchange and 4 pending messages left
- assertEquals("Should graceful shutdown", "ABCDE", foo);
+ assertEquals("Should graceful shutdown", "stopABCDE", foo);
}
@Override
@@ -56,10 +52,9 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("seda:foo").to("mock:foo").delay(500).process(new Processor() {
+ from("seda:foo").to("mock:foo").delay(1000).process(new Processor() {
public void process(Exchange exchange) throws Exception {
foo = foo + exchange.getIn().getBody(String.class);
- latch.countDown();
}
});
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesTwoRouteShutdownGracefulTest.java b/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesTwoRouteShutdownGracefulTest.java
index 0a04322..3ff0295 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesTwoRouteShutdownGracefulTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/PendingExchangesTwoRouteShutdownGracefulTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.impl;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
@@ -31,11 +28,10 @@
private static String foo = "";
private static String bar = "";
- private static CountDownLatch latch = new CountDownLatch(2);
public void testShutdownGraceful() throws Exception {
- getMockEndpoint("mock:foo").expectedMinimumMessageCount(1);
- getMockEndpoint("mock:bar").expectedMinimumMessageCount(1);
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+ getMockEndpoint("mock:bar").expectedMessageCount(1);
template.sendBody("seda:foo", "A");
template.sendBody("seda:foo", "B");
@@ -51,12 +47,14 @@
assertMockEndpointsSatisfied();
- latch.await(10, TimeUnit.SECONDS);
+ // now stop the route before its complete
+ foo = foo + "stop";
+ bar = bar + "stop";
context.stop();
- // it should wait as there were 2 inflight exchanges and 8 pending messages left
- assertEquals("Should graceful shutdown", "ABCDE", foo);
- assertEquals("Should graceful shutdown", "ABCDE", bar);
+ // it should wait as there was 1 inflight exchange and 4 pending messages left
+ assertEquals("Should graceful shutdown", "stopABCDE", foo);
+ assertEquals("Should graceful shutdown", "stopABCDE", bar);
}
@Override
@@ -67,14 +65,12 @@
from("seda:foo").to("mock:foo").delay(1000).process(new Processor() {
public void process(Exchange exchange) throws Exception {
foo = foo + exchange.getIn().getBody(String.class);
- latch.countDown();
}
});
from("seda:bar").to("mock:bar").delay(500).process(new Processor() {
public void process(Exchange exchange) throws Exception {
bar = bar + exchange.getIn().getBody(String.class);
- latch.countDown();
}
});
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/RegistryTest.java b/camel-core/src/test/java/org/apache/camel/impl/RegistryTest.java
index 64a6263..3db01c0 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/RegistryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/RegistryTest.java
@@ -30,11 +30,11 @@
protected JndiRegistry registry;
public void testBind() throws Exception {
- List<?> foo = Arrays.asList("a", "b", "c");
+ List foo = Arrays.asList("a", "b", "c");
registry.bind("foo", foo);
- List<?> list = registry.lookup("foo", List.class);
+ List list = registry.lookup("foo", List.class);
assertEquals("Should be same!", foo, list);
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ServicePoolTest.java b/camel-core/src/test/java/org/apache/camel/impl/ServicePoolTest.java
index 90b3b84..9009f60 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/ServicePoolTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/ServicePoolTest.java
@@ -192,11 +192,11 @@
final Endpoint endpoint = context.getEndpoint("mock:foo");
ExecutorService executor = Executors.newFixedThreadPool(5);
- List<Future<Integer>> response = new ArrayList<Future<Integer>>();
+ List<Future> response = new ArrayList<Future>();
for (int i = 0; i < 5; i++) {
final int index = i;
- Future<Integer> out = executor.submit(new Callable<Integer>() {
- public Integer call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
Producer producer = pool.acquire(endpoint);
if (producer == null) {
producer = pool.addAndAcquire(endpoint, new MyProducer(endpoint));
@@ -211,7 +211,7 @@
}
for (int i = 0; i < 5; i++) {
- assertEquals(i, response.get(i).get().intValue());
+ assertEquals(i, response.get(i).get());
}
executor.shutdownNow();
}
@@ -220,11 +220,11 @@
final Endpoint endpoint = context.getEndpoint("mock:foo");
ExecutorService executor = Executors.newFixedThreadPool(5);
- List<Future<Integer>> response = new ArrayList<Future<Integer>>();
+ List<Future> response = new ArrayList<Future>();
for (int i = 0; i < 5; i++) {
final int index = i;
- Future<Integer> out = executor.submit(new Callable<Integer>() {
- public Integer call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
for (int j = 0; j < 100; j++) {
Producer producer = pool.acquire(endpoint);
if (producer == null) {
@@ -241,7 +241,7 @@
}
for (int i = 0; i < 5; i++) {
- assertEquals(i, response.get(i).get().intValue());
+ assertEquals(i, response.get(i).get());
}
executor.shutdownNow();
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/SimpleRegistryTest.java b/camel-core/src/test/java/org/apache/camel/impl/SimpleRegistryTest.java
index 3917b41..3332edb 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/SimpleRegistryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/SimpleRegistryTest.java
@@ -55,7 +55,7 @@
}
public void testLookupByType() {
- Map<?, ?> map = registry.lookupByType(String.class);
+ Map map = registry.lookupByType(String.class);
assertEquals(1, map.size());
assertEquals("b", map.get("a"));
map = registry.lookupByType(Object.class);
@@ -65,7 +65,7 @@
}
public void testLookupByWrongType() {
- Map<?, ?> map = registry.lookupByType(Float.class);
+ Map map = registry.lookupByType(Float.class);
assertEquals(0, map.size());
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/VetoCamelContextStartTest.java b/camel-core/src/test/java/org/apache/camel/impl/VetoCamelContextStartTest.java
index a39aa6e..f629f34 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/VetoCamelContextStartTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/VetoCamelContextStartTest.java
@@ -118,9 +118,5 @@
@Override
public void onThreadPoolAdd(CamelContext camelContext, ThreadPoolExecutor threadPool, String id, String sourceId, String routeId, String threadPoolProfileId) {
}
-
- @Override
- public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool) {
- }
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ZipDataFormatTest.java b/camel-core/src/test/java/org/apache/camel/impl/ZipDataFormatTest.java
index b2b18ca..999021c 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/ZipDataFormatTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/ZipDataFormatTest.java
@@ -22,11 +22,10 @@
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
-import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spi.DataFormat;
/**
* Unit test of the zip data format.
@@ -51,36 +50,33 @@
return false;
}
- public void testMarshalMandatoryConversionFailed() throws Exception {
- DataFormat dataFormat = new ZipDataFormat();
-
- try {
- dataFormat.marshal(new DefaultExchange(new DefaultCamelContext()), new Object(), new ByteArrayOutputStream());
- fail("Should have thrown an exception");
- } catch (NoTypeConversionAvailableException e) {
- // expected
- }
+ private void sendText() throws Exception {
+ template.send("direct:start", new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // Set the property of the charset encoding
+ exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
+ Message in = exchange.getIn();
+ in.setBody(TEXT);
+ }
+
+ });
}
public void testMarshalTextToZipBestCompression() throws Exception {
context.addRoutes(new RouteBuilder() {
public void configure() {
- from("direct:start")
- .marshal().zip(Deflater.BEST_COMPRESSION)
- .process(new ZippedMessageProcessor());
+ from("direct:start").marshal().zip(Deflater.BEST_COMPRESSION).process(new ZippedMessageProcessor());
}
});
context.start();
sendText();
}
-
+
public void testMarshalTextToZipBestSpeed() throws Exception {
context.addRoutes(new RouteBuilder() {
public void configure() {
- from("direct:start")
- .marshal().zip(Deflater.BEST_SPEED)
- .process(new ZippedMessageProcessor());
+ from("direct:start").marshal().zip(Deflater.BEST_SPEED).process(new ZippedMessageProcessor());
}
});
context.start();
@@ -92,23 +88,18 @@
public void testMarshalTextToZipDefaultCompression() throws Exception {
context.addRoutes(new RouteBuilder() {
public void configure() {
- from("direct:start")
- .marshal().zip(Deflater.DEFAULT_COMPRESSION)
- .process(new ZippedMessageProcessor());
+ from("direct:start").marshal().zip(Deflater.DEFAULT_COMPRESSION).process(new ZippedMessageProcessor());
}
});
context.start();
sendText();
}
-
+
public void testUnMarshalTextToZip() throws Exception {
context.addRoutes(new RouteBuilder() {
public void configure() {
- from("direct:start")
- .marshal().zip()
- .unmarshal().zip()
- .to("mock:result");
+ from("direct:start").marshal().zip().unmarshal().zip().to("mock:result");
}
});
context.start();
@@ -117,16 +108,12 @@
result.expectedBodiesReceived(TEXT);
sendText();
result.assertIsSatisfied();
- }
-
- private void sendText() throws Exception {
- template.sendBodyAndProperty("direct:start", TEXT, Exchange.CHARSET_NAME, "UTF-8");
- }
-
+ }
+
private static class ZippedMessageProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
- byte[] body = exchange.getIn().getBody(byte[].class);
+ byte[] body = (byte[]) exchange.getIn().getBody(byte[].class);
Inflater inflater = new Inflater();
inflater.setInput(body);
@@ -147,4 +134,5 @@
assertEquals(TEXT, result);
}
}
+
}
diff --git a/camel-core/src/test/java/org/apache/camel/issues/ChangeHeaderCaseIssueTest.java b/camel-core/src/test/java/org/apache/camel/issues/ChangeHeaderCaseIssueTest.java
index 3772001..1d49699 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/ChangeHeaderCaseIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/ChangeHeaderCaseIssueTest.java
@@ -30,6 +30,7 @@
*/
public class ChangeHeaderCaseIssueTest extends ContextTestSupport {
+ @SuppressWarnings("unchecked")
public void testChangeHeaderCaseIssue() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
@@ -40,7 +41,7 @@
assertMockEndpointsSatisfied();
// only the changed case header should exist
- Map<String, Object> headers = new HashMap<String, Object>(mock.getReceivedExchanges().get(0).getIn().getHeaders());
+ Map headers = new HashMap(mock.getReceivedExchanges().get(0).getIn().getHeaders());
assertEquals("cool", headers.get("SoapAction"));
assertEquals(null, headers.get("SOAPAction"));
}
diff --git a/camel-core/src/test/java/org/apache/camel/issues/ExceptionPolicyIssueTest.java b/camel-core/src/test/java/org/apache/camel/issues/ExceptionPolicyIssueTest.java
index 21f0d05..02bcd93 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/ExceptionPolicyIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/ExceptionPolicyIssueTest.java
@@ -50,8 +50,6 @@
private static final class MyUnmarshalException extends Exception {
- private static final long serialVersionUID = 1L;
-
private MyUnmarshalException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelIssueTest.java b/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelIssueTest.java
index d1f95cb..23c38a3 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/SplitterParallelIssueTest.java
@@ -61,7 +61,7 @@
@Override
public void process(Exchange exchange) throws Exception {
int num = exchange.getIn().getBody(int.class);
- final long sleep = num * delay;
+ final long sleep = (long) (num * delay);
log.info("Sleep for " + sleep + "ms");
Thread.sleep(sleep);
}
diff --git a/camel-core/src/test/java/org/apache/camel/issues/SplitterUsingBeanReturningMessageTest.java b/camel-core/src/test/java/org/apache/camel/issues/SplitterUsingBeanReturningMessageTest.java
index 7128217..b510614 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/SplitterUsingBeanReturningMessageTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/SplitterUsingBeanReturningMessageTest.java
@@ -39,7 +39,7 @@
}
public static class MyOtherSplitterBean {
- public List<?> split(Exchange exchange) {
+ public List split(Exchange exchange) {
Message in = exchange.getIn();
assertNotNull(in.toString());
diff --git a/camel-core/src/test/java/org/apache/camel/issues/StopCamelFromRouteTest.java b/camel-core/src/test/java/org/apache/camel/issues/StopCamelFromRouteTest.java
deleted file mode 100644
index 8ae848d..0000000
--- a/camel-core/src/test/java/org/apache/camel/issues/StopCamelFromRouteTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.issues;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import junit.framework.TestCase;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.DefaultCamelContext;
-
-/**
- *
- */
-public class StopCamelFromRouteTest extends TestCase {
-
- // START SNIPPET: e1
- // use a latch as signal when to stop Camel
- private final CountDownLatch latch = new CountDownLatch(1);
-
- public void testStopCamelFromRoute() throws Exception {
- // create camel, add routes, and start camel
- CamelContext context = new DefaultCamelContext();
- context.addRoutes(createMyRoutes());
- context.start();
-
- // setup mock expectations for unit test
- MockEndpoint start = context.getEndpoint("mock:start", MockEndpoint.class);
- start.expectedMessageCount(1);
- MockEndpoint done = context.getEndpoint("mock:done", MockEndpoint.class);
- done.expectedMessageCount(1);
-
- // send a message to the route
- ProducerTemplate template = context.createProducerTemplate();
- template.sendBody("direct:start", "Hello Camel");
-
- // wait for the latch (use 1 minute as fail safe, due unit test)
- latch.await(1, TimeUnit.MINUTES);
-
- // stop camel
- context.stop();
-
- // unit test assertions
- start.assertIsSatisfied();
- done.assertIsSatisfied();
- }
- // END SNIPPET: e1
-
- // START SNIPPET: e2
- public RouteBuilder createMyRoutes() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("myRoute")
- .to("mock:start")
- .process(new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- // stop Camel by signalling to the latch
- latch.countDown();
- }
- }).to("mock:done");
- }
- };
- }
- // END SNIPPET: e2
-}
diff --git a/camel-core/src/test/java/org/apache/camel/issues/StopRouteFromRouteTest.java b/camel-core/src/test/java/org/apache/camel/issues/StopRouteFromRouteTest.java
deleted file mode 100644
index 73b52b3..0000000
--- a/camel-core/src/test/java/org/apache/camel/issues/StopRouteFromRouteTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.issues;
-
-import junit.framework.TestCase;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.DefaultCamelContext;
-
-/**
- *
- */
-public class StopRouteFromRouteTest extends TestCase {
-
- // START SNIPPET: e1
- public void testStopRouteFromRoute() throws Exception {
- // create camel, add routes, and start camel
- CamelContext context = new DefaultCamelContext();
- context.addRoutes(createMyRoutes());
- context.start();
-
- assertTrue("Route myRoute should be started", context.getRouteStatus("myRoute").isStarted());
- assertTrue("Route bar should be started", context.getRouteStatus("bar").isStarted());
-
- // setup mock expectations for unit test
- MockEndpoint start = context.getEndpoint("mock:start", MockEndpoint.class);
- start.expectedMessageCount(1);
- MockEndpoint done = context.getEndpoint("mock:done", MockEndpoint.class);
- done.expectedMessageCount(1);
-
- // send a message to the route
- ProducerTemplate template = context.createProducerTemplate();
- template.sendBody("direct:start", "Hello Camel");
-
- // just wait a bit for the thread to stop the route
- Thread.sleep(1000);
-
- // the route should now be stopped
- assertTrue("Route myRoute should be stopped", context.getRouteStatus("myRoute").isStopped());
- assertTrue("Route bar should be started", context.getRouteStatus("bar").isStarted());
-
- // stop camel
- context.stop();
-
- // unit test assertions
- start.assertIsSatisfied();
- done.assertIsSatisfied();
- }
- // END SNIPPET: e1
-
- // START SNIPPET: e2
- public RouteBuilder createMyRoutes() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("myRoute")
- .to("mock:start")
- .process(new Processor() {
- Thread stop;
-
- @Override
- public void process(final Exchange exchange) throws Exception {
- // stop this route using a thread that will stop
- // this route gracefully while we are still running
- if (stop == null) {
- stop = new Thread() {
- @Override
- public void run() {
- try {
- exchange.getContext().stopRoute("myRoute");
- } catch (Exception e) {
- // ignore
- }
- }
- };
- }
-
- // start the thread that stops this route
- stop.start();
- }
- }).to("mock:done");
-
- from("direct:bar").routeId("bar")
- .to("mock:bar");
- }
- };
- }
- // END SNIPPET: e2
-}
diff --git a/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java b/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
index a69b379..f9d7d94 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/TwoTimerWithJMXIssue.java
@@ -59,7 +59,7 @@
private static class MyTracer implements InterceptStrategy {
- public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition,
+ public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition definition,
Processor target, Processor nextTarget) throws Exception {
assertNotNull(target);
counter++;
diff --git a/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java b/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
index c6a0e67..0e6686d 100644
--- a/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/issues/TypeConverterConcurrencyIssueTest.java
@@ -22,7 +22,6 @@
import java.util.concurrent.TimeUnit;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.NoTypeConversionAvailableException;
import org.apache.camel.impl.converter.StaticMethodTypeConverter;
import org.apache.camel.util.StopWatch;
@@ -47,18 +46,13 @@
pool.submit(new Runnable() {
@Override
public void run() {
- try {
- context.getTypeConverter().mandatoryConvertTo(MyCamelBean.class, "1;MyCamel");
- latch.countDown();
- } catch (NoTypeConversionAvailableException e) {
- // ignore, as the latch will not be decremented anymore so that the assert below
- // will fail after the one minute timeout anyway
- }
+ MyCamelBean bean = context.getTypeConverter().convertTo(MyCamelBean.class, "1;MyCamel");
+ latch.countDown();
}
});
}
- assertTrue("The expected mandatory conversions failed!", latch.await(1, TimeUnit.MINUTES));
+ assertTrue(latch.await(1, TimeUnit.MINUTES));
log.info("Took " + watch.stop() + " millis to convert " + size + " objects");
}
diff --git a/camel-core/src/test/java/org/apache/camel/language/BeanLanguageInvalidOGNLTest.java b/camel-core/src/test/java/org/apache/camel/language/BeanLanguageInvalidOGNLTest.java
index 40e78b8..fa7c7e1 100644
--- a/camel-core/src/test/java/org/apache/camel/language/BeanLanguageInvalidOGNLTest.java
+++ b/camel-core/src/test/java/org/apache/camel/language/BeanLanguageInvalidOGNLTest.java
@@ -58,9 +58,9 @@
public static class MyReallyCoolBean {
- private Map<?, ?> map = new LinkedHashMap<Object, Object>();
+ private Map map = new LinkedHashMap();
- public Map<?, ?> getOther() {
+ public Map getOther() {
return map;
}
diff --git a/camel-core/src/test/java/org/apache/camel/language/SimpleOgnlMapIssueTest.java b/camel-core/src/test/java/org/apache/camel/language/SimpleOgnlMapIssueTest.java
index 913a72d..82bc664 100644
--- a/camel-core/src/test/java/org/apache/camel/language/SimpleOgnlMapIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/language/SimpleOgnlMapIssueTest.java
@@ -27,6 +27,7 @@
*/
public class SimpleOgnlMapIssueTest extends ContextTestSupport {
+ @SuppressWarnings("unchecked")
public void testSimpleOgnlIssueKing() throws Exception {
getMockEndpoint("mock:king").expectedMessageCount(1);
getMockEndpoint("mock:other").expectedMessageCount(0);
@@ -38,6 +39,7 @@
assertMockEndpointsSatisfied();
}
+ @SuppressWarnings("unchecked")
public void testSimpleOgnlIssueOther() throws Exception {
getMockEndpoint("mock:king").expectedMessageCount(0);
getMockEndpoint("mock:other").expectedMessageCount(1);
@@ -65,13 +67,13 @@
}
public static final class MyObjectMessage {
- private Map<Object, Object> property;
+ private Map property;
public MyObjectMessage() {
- this.property = new HashMap<Object, Object>();
+ this.property = new HashMap();
}
- public Map<Object, Object> getProperty() {
+ public Map getProperty() {
return property;
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java b/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java
index 7414583..fc3ce8b 100644
--- a/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/language/TokenizerTest.java
@@ -34,7 +34,7 @@
public void testTokenizeHeader() throws Exception {
Expression exp = TokenizeLanguage.tokenize("names", ",");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(3, names.size());
assertEquals("Claus", names.get(0));
@@ -47,7 +47,7 @@
exchange.getIn().setBody("Hadrian,Charles");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(2, names.size());
assertEquals("Hadrian", names.get(0));
@@ -59,7 +59,7 @@
exchange.getIn().setBody("The little fox");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(3, names.size());
assertEquals("The", names.get(0));
@@ -72,7 +72,7 @@
exchange.getIn().setHeader("quote", "Camel rocks");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(2, names.size());
assertEquals("Camel", names.get(0));
@@ -86,7 +86,7 @@
lan.setToken(",");
Expression exp = lan.createExpression();
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(3, names.size());
assertEquals("Claus", names.get(0));
@@ -104,7 +104,7 @@
exchange.getIn().setBody("2011-11-11\n!James@!Claus@\n2 records");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(2, names.size());
assertEquals("James", names.get(0));
@@ -116,7 +116,7 @@
exchange.getIn().setBody("2011-11-11\n[START]James[END]\n[START]Claus[END]\n2 records");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(2, names.size());
assertEquals("James", names.get(0));
@@ -128,7 +128,7 @@
exchange.getIn().setBody("2011-11-11\n[START]James[END]\n[START]Claus[END]\n2 records");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(2, names.size());
assertEquals("[START]James[END]", names.get(0));
@@ -140,7 +140,7 @@
exchange.getIn().setBody("<persons><person>James</person><person>Claus</person><person>Jonathan</person><person>Hadrian</person></persons>");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person>James</person>", names.get(0));
@@ -154,7 +154,7 @@
exchange.getIn().setBody("<persons><person>James</person><person>Claus</person><person>Jonathan</person><person>Hadrian</person></persons>");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person>James</person>", names.get(0));
@@ -169,7 +169,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><!-- bla bla --><persons>\n<person>James</person>\n<person>Claus</person>\n"
+ "<!-- more bla bla --><person>Jonathan</person>\n<person>Hadrian</person>\n</persons> ");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person>James</person>", names.get(0));
@@ -183,7 +183,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><!-- bla bla --><persons></persons> ");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(0, names.size());
}
@@ -192,7 +192,7 @@
exchange.getIn().setBody("");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(0, names.size());
}
@@ -201,7 +201,7 @@
exchange.getIn().setBody(null);
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertNull(names);
}
@@ -211,7 +211,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><persons xmlns=\"http:acme.com/persons\">\n<person>James</person>\n<person>Claus</person>\n"
+ "<person>Jonathan</person>\n<person>Hadrian</person>\n</persons>\n");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person xmlns=\"http:acme.com/persons\">James</person>", names.get(0));
@@ -226,7 +226,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><persons xmlns=\"http:acme.com/persons\">\n<person>James</person>\n<person>Claus</person>\n"
+ "<person>Jonathan</person>\n<person>Hadrian</person>\n</persons>\n");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person>James</person>", names.get(0));
@@ -241,7 +241,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><persons xmlns=\"http:acme.com/persons\" xmlns:foo=\"http:foo.com\">\n<person>James</person>\n<person>Claus</person>\n"
+ "<person>Jonathan</person>\n<person>Hadrian</person>\n</persons>\n");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person xmlns=\"http:acme.com/persons\" xmlns:foo=\"http:foo.com\">James</person>", names.get(0));
@@ -256,7 +256,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><persons>\n<person xmlns=\"http:acme.com/persons\">James</person>\n<person xmlns=\"http:acme.com/persons\">Claus</person>\n"
+ "<person xmlns=\"http:acme.com/persons\">Jonathan</person>\n<person xmlns=\"http:acme.com/persons\">Hadrian</person>\n</persons>\n");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person xmlns=\"http:acme.com/persons\">James</person>", names.get(0));
@@ -271,7 +271,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><persons xmlns=\"http:acme.com/persons\">\n<person xmlns:foo=\"http:foo.com\">James</person>\n<person>Claus</person>\n"
+ "<person>Jonathan</person>\n<person xmlns:bar=\"http:bar.com\">Hadrian</person>\n</persons>\n");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person xmlns:foo=\"http:foo.com\" xmlns=\"http:acme.com/persons\">James</person>", names.get(0));
@@ -286,7 +286,7 @@
exchange.getIn().setBody("<?xml version=\"1.0\"?><persons xmlns=\"http:acme.com/persons\">\n<person xmlns:foo=\"http:foo.com\">James</person>\n"
+ "<person>Claus</person>\n<person>Jonathan</person>\n<person xmlns:bar=\"http:bar.com\">Hadrian</person>\n</persons>\n");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person xmlns:foo=\"http:foo.com\">James</person>", names.get(0));
@@ -301,7 +301,7 @@
exchange.getIn().setBody("<persons><person id=\"1\">James</person><person id=\"2\">Claus</person><person id=\"3\">Jonathan</person>"
+ "<person id=\"4\">Hadrian</person></persons>");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person id=\"1\">James</person>", names.get(0));
@@ -316,7 +316,7 @@
exchange.getIn().setBody("<persons xmlns=\"http:acme.com/persons\"><person id=\"1\">James</person><person id=\"2\">Claus</person>"
+ "<person id=\"3\">Jonathan</person><person id=\"4\">Hadrian</person></persons>");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person id=\"1\" xmlns=\"http:acme.com/persons\">James</person>", names.get(0));
@@ -331,7 +331,7 @@
exchange.getIn().setBody("<persons riders=\"true\" xmlns=\"http:acme.com/persons\"><person id=\"1\">James</person><person id=\"2\">Claus</person>"
+ "<person id=\"3\">Jonathan</person><person id=\"4\">Hadrian</person></persons>");
- List<?> names = exp.evaluate(exchange, List.class);
+ List names = exp.evaluate(exchange, List.class);
assertEquals(4, names.size());
assertEquals("<person id=\"1\" xmlns=\"http:acme.com/persons\">James</person>", names.get(0));
diff --git a/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java b/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
index 3869f60..10e4fe3 100644
--- a/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
+++ b/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
@@ -162,18 +162,14 @@
assertExpression("sysenv.PATH", path);
}
}
-
- public void testSimpleCamelId() throws Exception {
- assertExpression("camelId", context.getName());
- }
-
+
public void testOGNLBodyListAndMap() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("cool", "Camel rocks");
map.put("dude", "Hey dude");
map.put("code", 4321);
- List<Map<String, Object>> lines = new ArrayList<Map<String, Object>>();
+ List<Map> lines = new ArrayList<Map>();
lines.add(map);
exchange.getIn().setBody(lines);
@@ -189,7 +185,7 @@
map.put("camel", new OrderLine(123, "Camel in Action"));
map.put("amq", new OrderLine(456, "ActiveMQ in Action"));
- List<Map<String, Object>> lines = new ArrayList<Map<String, Object>>();
+ List<Map> lines = new ArrayList<Map>();
lines.add(map);
exchange.getIn().setBody(lines);
@@ -445,7 +441,7 @@
}
public void testHeaders() throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals(2, headers.size());
assertExpression("headers", headers);
diff --git a/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationOnlyRegisterProcessorWithCustomIdTest.java b/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationOnlyRegisterProcessorWithCustomIdTest.java
index 8a71e0f..7bb771a 100644
--- a/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationOnlyRegisterProcessorWithCustomIdTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationOnlyRegisterProcessorWithCustomIdTest.java
@@ -40,7 +40,7 @@
}
public void testCustomId() throws Exception {
- Set<ObjectName> s = server.queryNames(new ObjectName(domainName + ":type=endpoints,*"), null);
+ Set s = server.queryNames(new ObjectName(domainName + ":type=endpoints,*"), null);
assertEquals("Could not find 2 endpoints: " + s, 6, s.size());
s = server.queryNames(new ObjectName(domainName + ":type=context,*"), null);
@@ -49,7 +49,7 @@
s = server.queryNames(new ObjectName(domainName + ":type=processors,*"), null);
assertEquals("Could not find 1 processor: " + s, 1, s.size());
// should be mock foo
- ObjectName on = s.iterator().next();
+ ObjectName on = (ObjectName) s.iterator().next();
String id = (String) server.getAttribute(on, "ProcessorId");
assertEquals("myfoo", id);
diff --git a/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java b/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
index 86f5a6b..ba4c758 100644
--- a/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import javax.management.MBeanServer;
@@ -189,7 +190,7 @@
}
protected void releaseMBeanServers() {
- for (MBeanServer server : MBeanServerFactory.findMBeanServer(null)) {
+ for (MBeanServer server : (List<MBeanServer>)MBeanServerFactory.findMBeanServer(null)) {
MBeanServerFactory.releaseMBeanServer(server);
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java b/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java
index dbb3c45..bd6c2c8 100644
--- a/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingPlatformMBSTest.java
@@ -55,7 +55,7 @@
@Override
protected MBeanServerConnection getMBeanConnection() throws Exception {
if (mbsc == null) {
- List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
+ List<MBeanServer> servers = (List<MBeanServer>)MBeanServerFactory.findMBeanServer(null);
for (MBeanServer server : servers) {
if (domainName.equals(server.getDefaultDomain())) {
diff --git a/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java b/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
index 106e5f6..4980b44 100644
--- a/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
@@ -66,9 +66,7 @@
MyNotificationListener listener = new MyNotificationListener();
context.getManagementStrategy().getManagementAgent().getMBeanServer().addNotificationListener(on,
listener,
- new NotificationFilter() {
- private static final long serialVersionUID = 1L;
-
+ new NotificationFilter() {
public boolean isNotificationEnabled(Notification notification) {
return notification.getSource().equals("MyCamel");
}
@@ -92,8 +90,6 @@
MyNotificationListener listener = new MyNotificationListener();
context.getManagementStrategy().getManagementAgent().getMBeanServer().addNotificationListener(on,
listener, new NotificationFilter() {
- private static final long serialVersionUID = 1L;
-
public boolean isNotificationEnabled(Notification notification) {
return true;
}
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointAsXmlTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointAsXmlTest.java
similarity index 99%
rename from camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointAsXmlTest.java
rename to camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointAsXmlTest.java
index 8922e7c..f48765a 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointAsXmlTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointAsXmlTest.java
@@ -28,7 +28,7 @@
/**
* @version
*/
-public class ManagedBrowsableEndpointAsXmlTest extends ManagementTestSupport {
+public class ManagedBrowseableEndpointAsXmlTest extends ManagementTestSupport {
public void testBrowseableEndpointAsXmlIncludeBody() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(7);
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointEmptyTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointEmptyTest.java
similarity index 95%
rename from camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointEmptyTest.java
rename to camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointEmptyTest.java
index f7f27c2..a23828d 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointEmptyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointEmptyTest.java
@@ -24,7 +24,7 @@
/**
* @version
*/
-public class ManagedBrowsableEndpointEmptyTest extends ManagementTestSupport {
+public class ManagedBrowseableEndpointEmptyTest extends ManagementTestSupport {
public void testBrowseableEndpointEmpty() throws Exception {
MBeanServer mbeanServer = getMBeanServer();
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointTest.java
similarity index 97%
rename from camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointTest.java
rename to camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointTest.java
index 6e0184a..b38b4e6 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedBrowsableEndpointTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedBrowseableEndpointTest.java
@@ -24,7 +24,7 @@
/**
* @version
*/
-public class ManagedBrowsableEndpointTest extends ManagementTestSupport {
+public class ManagedBrowseableEndpointTest extends ManagementTestSupport {
public void testBrowseableEndpoint() throws Exception {
getMockEndpoint("mock:result").expectedMessageCount(2);
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextDumpStatsAsXmlTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextDumpStatsAsXmlTest.java
deleted file mode 100644
index b09795d..0000000
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedCamelContextDumpStatsAsXmlTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.management;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.w3c.dom.Document;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * @version
- */
-public class ManagedCamelContextDumpStatsAsXmlTest extends ManagementTestSupport {
-
- public void testPerformanceCounterStats() throws Exception {
- // get the stats for the route
- MBeanServer mbeanServer = getMBeanServer();
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=context,name=\"camel-1\"");
-
- getMockEndpoint("mock:foo").expectedMessageCount(1);
- getMockEndpoint("mock:bar").expectedMessageCount(2);
- template.asyncSendBody("direct:start", "Hello World");
- template.asyncSendBody("direct:bar", "Hi World");
- template.asyncSendBody("direct:bar", "Bye World");
- assertMockEndpointsSatisfied();
-
- String xml = (String) mbeanServer.invoke(on, "dumpRoutesStatsAsXml", new Object[]{false, true}, new String[]{"boolean", "boolean"});
- log.info(xml);
-
- // should be valid XML
- Document doc = context.getTypeConverter().convertTo(Document.class, xml);
- assertNotNull(doc);
-
- int processors = doc.getDocumentElement().getElementsByTagName("processorStat").getLength();
- assertEquals(5, processors);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("foo")
- .to("log:foo").id("a")
- .delay(100).id("b")
- .to("mock:foo").id("c");
-
- from("direct:bar").routeId("bar")
- .to("log:bar").id("d")
- .to("mock:bar").id("e");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedNamePatternFixedTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedNamePatternFixedTest.java
deleted file mode 100644
index 3cd5497..0000000
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedNamePatternFixedTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.management;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * @version
- */
-public class ManagedNamePatternFixedTest extends ManagementTestSupport {
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- CamelContext context = super.createCamelContext();
- context.getManagementNameStrategy().setNamePattern("cool");
- return context;
- }
-
- public void testManagedNamePattern() throws Exception {
- MBeanServer mbeanServer = getMBeanServer();
-
- assertEquals("cool", context.getManagementName());
-
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + context.getManagementName() + ",type=context,name=\"camel-1\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("mock:result");
- }
- };
- }
-}
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedNamePatternTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedNamePatternTest.java
deleted file mode 100644
index 5366877..0000000
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedNamePatternTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.management;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * @version
- */
-public class ManagedNamePatternTest extends ManagementTestSupport {
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- CamelContext context = super.createCamelContext();
- context.getManagementNameStrategy().setNamePattern("cool-#name#");
- return context;
- }
-
- public void testManagedNamePattern() throws Exception {
- MBeanServer mbeanServer = getMBeanServer();
-
- assertTrue(context.getManagementName().startsWith("cool"));
-
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + context.getManagementName() + ",type=context,name=\"camel-1\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").to("mock:result");
- }
- };
- }
-}
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddFromRouteTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddFromRouteTest.java
index 3873b49..6be3147 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddFromRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddFromRouteTest.java
@@ -39,10 +39,6 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- // put a message pre-early on the seda queue, to trigger the route, which
- // then would add a 2nd route during CamelContext startup. This is a test
- // to ensure the foo route is not started too soon, and thus adding the 2nd
- // route works as expected
SedaEndpoint seda = context.getEndpoint("seda:start", SedaEndpoint.class);
seda.getQueue().put(new DefaultExchange(context));
@@ -74,9 +70,7 @@
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(1);
-
- // should route the message we put on the seda queue before
-
+ template.sendBody("seda:start", "Hello World");
result.assertIsSatisfied();
// find the 2nd route
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddRemoveTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddRemoveTest.java
index e590cb6..97eb939 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddRemoveTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddRemoveTest.java
@@ -218,7 +218,7 @@
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:error").expectedMessageCount(1);
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("error", "mock:error");
headers.put("bar", "mock:bar");
template.sendBodyAndHeaders("direct:bar", "Hello World", headers);
@@ -278,7 +278,7 @@
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:error").expectedMessageCount(1);
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("error", "mock:error");
headers.put("bar", "mock:bar");
template.sendBodyAndHeaders("direct:bar", "Hello World", headers);
@@ -336,7 +336,7 @@
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:done").expectedMessageCount(1);
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("done", "mock:done");
headers.put("bar", "mock:bar");
template.sendBodyAndHeaders("direct:bar", "Hello World", headers);
@@ -395,7 +395,7 @@
getMockEndpoint("mock:bar").expectedMessageCount(1);
getMockEndpoint("mock:done").expectedMessageCount(1);
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("done", "mock:done");
headers.put("bar", "mock:bar");
template.sendBodyAndHeaders("direct:bar", "Hello World", headers);
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteDumpStatsAsXmlTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedRouteDumpStatsAsXmlTest.java
deleted file mode 100644
index edb8e8d..0000000
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedRouteDumpStatsAsXmlTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.management;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.w3c.dom.Document;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * @version
- */
-public class ManagedRouteDumpStatsAsXmlTest extends ManagementTestSupport {
-
- public void testPerformanceCounterStats() throws Exception {
- // get the stats for the route
- MBeanServer mbeanServer = getMBeanServer();
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=routes,name=\"foo\"");
-
- getMockEndpoint("mock:result").expectedMessageCount(1);
-
- template.asyncSendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
-
- String xml = (String) mbeanServer.invoke(on, "dumpRouteStatsAsXml", new Object[]{false, true}, new String[]{"boolean", "boolean"});
- log.info(xml);
-
- // should be valid XML
- Document doc = context.getTypeConverter().convertTo(Document.class, xml);
- assertNotNull(doc);
-
- int processors = doc.getDocumentElement().getElementsByTagName("processorStat").getLength();
- assertEquals(3, processors);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").routeId("foo")
- .to("log:foo").delay(100).to("mock:result");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedSedaRouteRemoveTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedSedaRouteRemoveTest.java
deleted file mode 100644
index 545e1fb..0000000
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedSedaRouteRemoveTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.management;
-
-import java.util.Set;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.ServiceStatus;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-
-/**
- * @version
- */
-public class ManagedSedaRouteRemoveTest extends ManagementTestSupport {
-
- public void testRemove() throws Exception {
- MBeanServer mbeanServer = getMBeanServer();
- ObjectName on = getRouteObjectName(mbeanServer);
-
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Hello World");
-
- template.sendBody("seda:foo", "Hello World");
-
- assertMockEndpointsSatisfied();
-
- // should be started
- String state = (String) mbeanServer.getAttribute(on, "State");
- assertEquals("Should be started", ServiceStatus.Started.name(), state);
-
- // and there should be 2 thread pools (1 default + 1 seda)
- Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=threadpools,*"), null);
- // there should be a seda thread pool in there
- boolean seda = false;
- for (ObjectName names : set) {
- if (names.toString().contains("Seda")) {
- seda = true;
- break;
- }
- }
- assertTrue("There should be a seda thread pool", seda);
-
- // stop
- mbeanServer.invoke(on, "stop", null, null);
-
- state = (String) mbeanServer.getAttribute(on, "State");
- assertEquals("Should be stopped", ServiceStatus.Stopped.name(), state);
-
- // remove
- mbeanServer.invoke(on, "remove", null, null);
-
- // should not be registered anymore
- boolean registered = mbeanServer.isRegistered(on);
- assertFalse("Route mbean should have been unregistered", registered);
-
- // and no more routes
- set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
- assertEquals(0, set.size());
-
- // and thread pool should be removed (shutdown creates a new thread pool as well)
- set = mbeanServer.queryNames(new ObjectName("*:type=threadpools,*"), null);
- // there should NOT be a seda thread pool in there
- seda = false;
- for (ObjectName names : set) {
- if (names.toString().contains("Seda")) {
- seda = true;
- break;
- }
- }
- assertFalse("There should not be a seda thread pool", seda);
- }
-
- static ObjectName getRouteObjectName(MBeanServer mbeanServer) throws Exception {
- Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
- assertEquals(1, set.size());
-
- return set.iterator().next();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("seda:foo").to("mock:result");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterCamelContextTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterCamelContextTest.java
index 4468056..89b92bb 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterCamelContextTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedUnregisterCamelContextTest.java
@@ -27,6 +27,7 @@
*/
public class ManagedUnregisterCamelContextTest extends ManagementTestSupport {
+ @SuppressWarnings("unchecked")
public void testUnregisterCamelContext() throws Exception {
// The camel context already started by ContextTestSupport in the startup method
@@ -44,7 +45,7 @@
String version = (String) mbeanServer.getAttribute(on, "CamelVersion");
assertNotNull(version);
- Map<?, ?> properties = (Map<?, ?>) mbeanServer.getAttribute(on, "Properties");
+ Map<String, String> properties = (Map) mbeanServer.getAttribute(on, "Properties");
assertNull(properties);
Integer num = (Integer) mbeanServer.getAttribute(on, "InflightExchanges");
diff --git a/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextAutoAssignedNameClashTest.java b/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextAutoAssignedNameClashTest.java
index 838f3ed..5491b91 100644
--- a/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextAutoAssignedNameClashTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextAutoAssignedNameClashTest.java
@@ -46,7 +46,7 @@
assertTrue("Should be started", camel1.getStatus().isStarted());
MBeanServer mbeanServer = camel1.getManagementStrategy().getManagementAgent().getMBeanServer();
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel1.getManagementName() + ",type=context,name=\"camel-1\"");
+ ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=context,name=\"camel-1\"");
assertTrue("Should be registered", mbeanServer.isRegistered(on));
// now cheat and reset the counter so we can test for a clash
@@ -54,7 +54,7 @@
camel2 = createCamelContext();
camel2.start();
- ObjectName on2 = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel2.getManagementName() + ",type=context,name=\"camel-1\"");
+ ObjectName on2 = ObjectName.getInstance("org.apache.camel:context=localhost/camel-2,type=context,name=\"camel-2\"");
assertTrue("Should be registered", mbeanServer.isRegistered(on2));
assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on));
diff --git a/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextClashTest.java b/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextClashTest.java
index c20b583..408a491 100644
--- a/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextClashTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/TwoManagedCamelContextClashTest.java
@@ -21,7 +21,6 @@
import org.apache.camel.CamelContext;
import org.apache.camel.TestSupport;
-import org.apache.camel.VetoCamelContextStartException;
import org.apache.camel.impl.DefaultCamelContext;
/**
@@ -32,76 +31,33 @@
private CamelContext camel1;
private CamelContext camel2;
- protected CamelContext createCamelContext(String name, String managementPattern) throws Exception {
+ protected CamelContext createCamelContext(String name) throws Exception {
DefaultCamelContext context = new DefaultCamelContext();
context.setName(name);
- if (managementPattern != null) {
- context.getManagementNameStrategy().setNamePattern(managementPattern);
- }
DefaultManagementNamingStrategy naming = (DefaultManagementNamingStrategy) context.getManagementStrategy().getManagementNamingStrategy();
naming.setHostName("localhost");
naming.setDomainName("org.apache.camel");
return context;
}
- public void testTwoManagedCamelContextNoClashDefault() throws Exception {
- camel1 = createCamelContext("foo", null);
- camel2 = createCamelContext("foo", null);
-
- camel1.start();
- assertTrue("Should be started", camel1.getStatus().isStarted());
-
- MBeanServer mbeanServer = camel1.getManagementStrategy().getManagementAgent().getMBeanServer();
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel1.getManagementName() + ",type=context,name=\"foo\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
-
- // the default name pattern will ensure the JMX names is unique
- camel2.start();
- ObjectName on2 = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel2.getManagementName() + ",type=context,name=\"foo\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on2));
-
- assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on));
- assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on2));
- }
-
- public void testTwoManagedCamelContextNoClashCustomPattern() throws Exception {
- camel1 = createCamelContext("foo", "killer-#counter#");
- camel2 = createCamelContext("foo", "killer-#counter#");
-
- camel1.start();
- assertTrue("Should be started", camel1.getStatus().isStarted());
-
- MBeanServer mbeanServer = camel1.getManagementStrategy().getManagementAgent().getMBeanServer();
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel1.getManagementName() + ",type=context,name=\"foo\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
-
- // the pattern has a counter so no clash
- camel2.start();
- ObjectName on2 = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel2.getManagementName() + ",type=context,name=\"foo\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on2));
-
- assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on));
- assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on2));
- }
-
public void testTwoManagedCamelContextClash() throws Exception {
- camel1 = createCamelContext("foo", "myFoo");
- camel2 = createCamelContext("foo", "myFoo");
+ camel1 = createCamelContext("foo");
+ camel2 = createCamelContext("foo");
camel1.start();
assertTrue("Should be started", camel1.getStatus().isStarted());
MBeanServer mbeanServer = camel1.getManagementStrategy().getManagementAgent().getMBeanServer();
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + camel1.getManagementName() + ",type=context,name=\"foo\"");
+ ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/foo,type=context,name=\"foo\"");
assertTrue("Should be registered", mbeanServer.isRegistered(on));
- // we use fixed names, so we will get a clash
- try {
- camel2.start();
- fail("Should have thrown an exception");
- } catch (VetoCamelContextStartException e) {
- assertTrue(e.getMessage().contains("is already registered"));
- }
+ // camel will now automatic re assign the JMX name to avoid the clash
+ camel2.start();
+ ObjectName on2 = ObjectName.getInstance("org.apache.camel:context=localhost/foo-2,type=context,name=\"foo\"");
+ assertTrue("Should be registered", mbeanServer.isRegistered(on2));
+
+ assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on));
+ assertTrue("Should still be registered after name clash", mbeanServer.isRegistered(on2));
}
@Override
diff --git a/camel-core/src/test/java/org/apache/camel/management/TwoManagedNamePatternTest.java b/camel-core/src/test/java/org/apache/camel/management/TwoManagedNamePatternTest.java
deleted file mode 100644
index f3f585d..0000000
--- a/camel-core/src/test/java/org/apache/camel/management/TwoManagedNamePatternTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.management;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.TestSupport;
-import org.apache.camel.impl.DefaultCamelContext;
-
-/**
- * @version
- */
-public class TwoManagedNamePatternTest extends TestSupport {
-
- private CamelContext camel1;
- private CamelContext camel2;
-
- protected CamelContext createCamelContext(String name, String pattern) throws Exception {
- DefaultCamelContext context = new DefaultCamelContext();
- context.setName(name);
- context.getManagementNameStrategy().setNamePattern(pattern);
- DefaultManagementNamingStrategy naming = (DefaultManagementNamingStrategy) context.getManagementStrategy().getManagementNamingStrategy();
- naming.setHostName("localhost");
- naming.setDomainName("org.apache.camel");
- return context;
- }
-
- public void testManagedNamePattern() throws Exception {
- camel1 = createCamelContext("foo", "aaa-#name#");
- camel2 = createCamelContext("bar", "bbb-#name#");
-
- camel1.start();
- camel2.start();
-
- MBeanServer mbeanServer = camel1.getManagementStrategy().getManagementAgent().getMBeanServer();
-
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/aaa-foo,type=context,name=\"foo\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
-
- ObjectName on2 = ObjectName.getInstance("org.apache.camel:context=localhost/bbb-bar,type=context,name=\"bar\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on2));
-
- camel1.stop();
- camel2.stop();
-
- assertFalse("Should be unregistered", mbeanServer.isRegistered(on));
- assertFalse("Should be unregistered", mbeanServer.isRegistered(on2));
- }
-
- @Override
- protected void tearDown() throws Exception {
- camel1.stop();
- camel2.stop();
- super.tearDown();
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/model/ChoiceDefinitionTest.java b/camel-core/src/test/java/org/apache/camel/model/ChoiceDefinitionTest.java
index 684438c..4882234 100644
--- a/camel-core/src/test/java/org/apache/camel/model/ChoiceDefinitionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/ChoiceDefinitionTest.java
@@ -51,7 +51,7 @@
assertEquals(3, choice.getOutputs().size());
int i = 0;
- for (ProcessorDefinition<?> def : choice.getOutputs()) {
+ for (ProcessorDefinition def : choice.getOutputs()) {
if (i == 0) {
assertEquals(when1, def);
} else if (i == 1) {
@@ -90,7 +90,7 @@
assertEquals(2, choice.getOutputs().size());
int i = 0;
- for (ProcessorDefinition<?> def : choice.getOutputs()) {
+ for (ProcessorDefinition def : choice.getOutputs()) {
if (i == 0) {
assertEquals(when1, def);
} else if (i == 1) {
@@ -137,7 +137,7 @@
assertEquals(3, choice.getOutputs().size());
int i = 0;
- for (ProcessorDefinition<?> def : choice.getOutputs()) {
+ for (ProcessorDefinition def : choice.getOutputs()) {
if (i == 0) {
assertEquals(when1, def);
} else if (i == 1) {
diff --git a/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java b/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
index 1bf9e9d..5d0f72a 100644
--- a/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/GenerateXmlTest.java
@@ -44,7 +44,7 @@
route.from("seda:a");
route.filter(new GroovyExpression("in.headers.any { h -> h.startsWith('foo') }")).to("seda:b");
route.description(null, "This is a description of the route", "en");
- List<?> list = route.getOutputs();
+ List<ProcessorDefinition> list = route.getOutputs();
assertEquals("Size of list: " + list, 1, list.size());
dump(context);
diff --git a/camel-core/src/test/java/org/apache/camel/model/ModelSanityCheckerTest.java b/camel-core/src/test/java/org/apache/camel/model/ModelSanityCheckerTest.java
index f9d4b14..52da580 100644
--- a/camel-core/src/test/java/org/apache/camel/model/ModelSanityCheckerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/ModelSanityCheckerTest.java
@@ -50,7 +50,7 @@
assertTrue("There should be > 140 classes, was: " + classes.size(), classes.size() > 140);
// check each class is okay
- for (Class<?> clazz : classes) {
+ for (Class clazz : classes) {
// skip ProcessorDefinition as its special
if (clazz == ProcessorDefinition.class) {
diff --git a/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java b/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java
index 6b53540..de2031a 100644
--- a/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java
+++ b/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java
@@ -75,7 +75,7 @@
public void testParseRecipientListXml() throws Exception {
RouteDefinition route = assertOneRoute("dynamicRecipientList.xml");
assertFrom(route, "seda:a");
- RecipientListDefinition<?> node = assertOneProcessorInstanceOf(RecipientListDefinition.class, route);
+ RecipientListDefinition node = assertOneProcessorInstanceOf(RecipientListDefinition.class, route);
assertExpression(node.getExpression(), "header", "foo");
}
@@ -149,7 +149,7 @@
public void testParseRoutingSlipXml() throws Exception {
RouteDefinition route = assertOneRoute("routingSlip.xml");
assertFrom(route, "seda:a");
- RoutingSlipDefinition<?> node = assertOneProcessorInstanceOf(RoutingSlipDefinition.class, route);
+ RoutingSlipDefinition node = assertOneProcessorInstanceOf(RoutingSlipDefinition.class, route);
assertEquals("destinations", node.getExpression().getExpression());
assertEquals(RoutingSlipDefinition.DEFAULT_DELIMITER, node.getUriDelimiter());
}
@@ -157,7 +157,7 @@
public void testParseRoutingSlipWithHeaderSetXml() throws Exception {
RouteDefinition route = assertOneRoute("routingSlipHeaderSet.xml");
assertFrom(route, "seda:a");
- RoutingSlipDefinition<?> node = assertOneProcessorInstanceOf(RoutingSlipDefinition.class, route);
+ RoutingSlipDefinition node = assertOneProcessorInstanceOf(RoutingSlipDefinition.class, route);
assertEquals("theRoutingSlipHeader", node.getExpression().getExpression());
assertEquals(RoutingSlipDefinition.DEFAULT_DELIMITER, node.getUriDelimiter());
}
@@ -165,7 +165,7 @@
public void testParseRoutingSlipWithHeaderAndDelimiterSetXml() throws Exception {
RouteDefinition route = assertOneRoute("routingSlipHeaderAndDelimiterSet.xml");
assertFrom(route, "seda:a");
- RoutingSlipDefinition<?> node = assertOneProcessorInstanceOf(RoutingSlipDefinition.class, route);
+ RoutingSlipDefinition node = assertOneProcessorInstanceOf(RoutingSlipDefinition.class, route);
assertEquals("theRoutingSlipHeader", node.getExpression().getExpression());
assertEquals("#", node.getUriDelimiter());
}
@@ -357,7 +357,7 @@
}
protected void assertChildTo(ProcessorDefinition<?> route, String... uris) {
- List<ProcessorDefinition<?>> list = assertListSize(route.getOutputs(), uris.length);
+ List<ProcessorDefinition> list = assertListSize(route.getOutputs(), uris.length);
int idx = 0;
for (String uri : uris) {
assertTo("output[" + idx + "] ", list.get(idx++), uri);
@@ -365,7 +365,7 @@
}
protected void assertChildTo(ProcessorDefinition<?> route, String uri, int toIdx) {
- List<ProcessorDefinition<?>> list = route.getOutputs();
+ List<ProcessorDefinition> list = route.getOutputs();
assertTo("to and idx=" + toIdx, list.get(toIdx), uri);
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/Animal.java b/camel-core/src/test/java/org/apache/camel/processor/Animal.java
index 7227ceb..2aadd87 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/Animal.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/Animal.java
@@ -23,7 +23,7 @@
*/
// START SNIPPET: e1
public class Animal implements Serializable {
- private static final long serialVersionUID = 1L;
+
private int id;
private String name;
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java b/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
index 97c37e2..524fd7b 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
@@ -34,8 +34,8 @@
// use navigate to find that the end works as expected
Navigate<Processor> nav = getRoute("direct://start").navigate();
List<Processor> node = nav.next();
- node = ((Navigate<Processor>) node.get(0)).next();
- node = ((Navigate<Processor>) node.get(0)).next();
+ node = ((Navigate) node.get(0)).next();
+ node = ((Navigate) node.get(0)).next();
// there should be 4 outputs as the end in the otherwise should
// ensure that the transform and last send is not within the choice
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithTranfromTest.java b/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithTranfromTest.java
index cf256fe..2458cf9 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithTranfromTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithTranfromTest.java
@@ -19,6 +19,7 @@
import org.apache.camel.Body;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.processor.ChoiceWhenBeanExpressionTest.Student;
public class ChoiceWithTranfromTest extends ContextTestSupport {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java b/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
index f2d1b50..59361a5 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/CustomProcessorFactoryTest.java
@@ -83,11 +83,11 @@
// START SNIPPET: e3
public static class MyFactory implements ProcessorFactory {
- public Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition<?> definition, boolean mandatory) throws Exception {
+ public Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition definition, boolean mandatory) throws Exception {
return null;
}
- public Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> definition) throws Exception {
+ public Processor createProcessor(RouteContext routeContext, ProcessorDefinition definition) throws Exception {
if (definition instanceof SplitDefinition) {
// add additional output to the splitter
SplitDefinition split = (SplitDefinition) definition;
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java b/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
index 6a5c27b..90a72f5 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DataFormatTest.java
@@ -64,7 +64,6 @@
}
protected static class MyBean implements Serializable {
- private static final long serialVersionUID = 1L;
public String name;
public int counter;
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java b/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java
index bc85ea8..d00248a 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelHandledExampleTest.java
@@ -103,7 +103,8 @@
* @return the out payload
* @throws OrderFailedException is thrown if the order cannot be processed
*/
- public Object handleOrder(@Headers Map<?, ?> in, @Body String payload, @OutHeaders Map<String, Object> out)
+ @SuppressWarnings("unchecked")
+ public Object handleOrder(@Headers Map in, @Body String payload, @OutHeaders Map out)
throws OrderFailedException {
out.put("customerid", in.get("customerid"));
if ("Order: kaboom".equals(payload)) {
@@ -121,7 +122,8 @@
* @param out the out headers
* @return the out payload
*/
- public Object orderFailed(@Headers Map<?, ?> in, @Body String payload, @OutHeaders Map<String, Object> out) {
+ @SuppressWarnings("unchecked")
+ public Object orderFailed(@Headers Map in, @Body String payload, @OutHeaders Map out) {
out.put("customerid", in.get("customerid"));
out.put("orderid", "failed");
return "Order ERROR";
@@ -135,8 +137,6 @@
*/
public static class OrderFailedException extends Exception {
- private static final long serialVersionUID = 1L;
-
public OrderFailedException(String message) {
super(message);
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelRedeliverWithDelayBlockingTest.java b/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelRedeliverWithDelayBlockingTest.java
index 10b5829..1ea0420 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelRedeliverWithDelayBlockingTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelRedeliverWithDelayBlockingTest.java
@@ -36,6 +36,7 @@
private static int counter;
+ @SuppressWarnings("unchecked")
public void testRedeliverWithDelay() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -50,13 +51,13 @@
// use executors to simulate two different clients sending
// a request to Camel
- Callable<?> task1 = Executors.callable(new Runnable() {
+ Callable task1 = Executors.callable(new Runnable() {
public void run() {
template.sendBody("direct:start", "Message 1");
}
});
- Callable<?> task2 = Executors.callable(new Runnable() {
+ Callable task2 = Executors.callable(new Runnable() {
public void run() {
template.sendBody("direct:start", "Message 2");
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DelayerPerRouteTest.java b/camel-core/src/test/java/org/apache/camel/processor/DelayerPerRouteTest.java
index 58e306e..10d70e9 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DelayerPerRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DelayerPerRouteTest.java
@@ -25,10 +25,11 @@
public class DelayerPerRouteTest extends ContextTestSupport {
public void testDelayerPerRoute() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived("B", "A");
+ getMockEndpoint("mock:result").expectedBodiesReceived("B", "A", "C");
template.sendBody("seda:a", "A");
template.sendBody("seda:b", "B");
+ template.sendBody("seda:c", "C");
assertMockEndpointsSatisfied();
}
@@ -40,9 +41,11 @@
public void configure() throws Exception {
context.setDelayer(2000L);
- from("seda:a").to("mock:result");
+ from("seda:a").delayer(1000).to("mock:result");
from("seda:b").noDelayer().to("mock:result");
+
+ from("seda:c").to("mock:result");
}
};
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DualPipelineTest.java b/camel-core/src/test/java/org/apache/camel/processor/DualPipelineTest.java
index 4e5b707..5dba35b 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DualPipelineTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DualPipelineTest.java
@@ -47,13 +47,13 @@
assertEquals(3, pd1.getOutputs().size());
assertEquals(4, pd2.getOutputs().size());
- SendDefinition<?> send1 = assertIsInstanceOf(SendDefinition.class, pd1.getOutputs().get(2));
+ SendDefinition send1 = assertIsInstanceOf(SendDefinition.class, pd1.getOutputs().get(2));
assertEquals("mock:b", send1.getUri());
- SendDefinition<?> send2 = assertIsInstanceOf(SendDefinition.class, pd2.getOutputs().get(3));
+ SendDefinition send2 = assertIsInstanceOf(SendDefinition.class, pd2.getOutputs().get(3));
assertEquals("mock:e", send2.getUri());
- SendDefinition<?> send = assertIsInstanceOf(SendDefinition.class, context.getRouteDefinitions().get(0).getOutputs().get(1));
+ SendDefinition send = assertIsInstanceOf(SendDefinition.class, context.getRouteDefinitions().get(0).getOutputs().get(1));
assertEquals("mock:result", send.getUri());
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ErrorHandlerSupportTest.java b/camel-core/src/test/java/org/apache/camel/processor/ErrorHandlerSupportTest.java
index cdd2f66..293a7e5 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ErrorHandlerSupportTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ErrorHandlerSupportTest.java
@@ -28,7 +28,7 @@
public class ErrorHandlerSupportTest extends TestCase {
public void testOnePolicyChildFirst() {
- List<Class<? extends Throwable>> exceptions = new ArrayList<Class<? extends Throwable>>();
+ List<Class> exceptions = new ArrayList<Class>();
exceptions.add(ChildException.class);
exceptions.add(ParentException.class);
@@ -40,7 +40,7 @@
}
public void testOnePolicyChildLast() {
- List<Class<? extends Throwable>> exceptions = new ArrayList<Class<? extends Throwable>>();
+ List<Class> exceptions = new ArrayList<Class>();
exceptions.add(ParentException.class);
exceptions.add(ChildException.class);
@@ -69,17 +69,15 @@
assertEquals(ParentException.class, getExceptionPolicyFor(support, new ParentException(), 0));
}
- private static Class<? extends Throwable> getExceptionPolicyFor(ErrorHandlerSupport support, Throwable childException,
+ private static Class getExceptionPolicyFor(ErrorHandlerSupport support, Throwable childException,
int index) {
return support.getExceptionPolicy(null, childException).getExceptionClasses().get(index);
}
private static class ParentException extends Exception {
- private static final long serialVersionUID = 1L;
}
private static class ChildException extends ParentException {
- private static final long serialVersionUID = 1L;
}
private static class ShuntErrorHandlerSupport extends ErrorHandlerSupport {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceAutoStartupFalseTest.java b/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceAutoStartupFalseTest.java
deleted file mode 100644
index 01934cd..0000000
--- a/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceAutoStartupFalseTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.processor;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-
-public class FailOverLoadBalanceAutoStartupFalseTest extends ContextTestSupport {
-
- public void testFailover() throws Exception {
- getMockEndpoint("mock:x").expectedMessageCount(1);
- getMockEndpoint("mock:y").expectedMessageCount(1);
- getMockEndpoint("mock:z").expectedMessageCount(1);
-
- context.startRoute("foo");
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("direct:start").routeId("foo").noAutoStartup()
- .loadBalance().failover(3, true, true)
- .to("direct:x", "direct:y", "direct:z");
-
- from("direct:x").to("mock:x").throwException(new IllegalArgumentException("Forced"));
- from("direct:y").to("mock:y").throwException(new IllegalArgumentException("Also Forced"));
- from("direct:z").to("mock:z");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceTest.java b/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceTest.java
index 1721704..b738ebd 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/FailOverLoadBalanceTest.java
@@ -41,11 +41,9 @@
}
public static class MyException extends Exception {
- private static final long serialVersionUID = 1L;
}
public static class MyAnotherException extends Exception {
- private static final long serialVersionUID = 1L;
}
public static class MyExceptionProcessor implements Processor {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java b/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
index d1b0e8f..4b58d9d 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java
@@ -65,7 +65,7 @@
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- IdempotentRepository<String> repo = MemoryIdempotentRepository.memoryIdempotentRepository(200);
+ IdempotentRepository repo = MemoryIdempotentRepository.memoryIdempotentRepository(200);
from("direct:start")
.idempotentConsumer(header("messageId")).messageIdRepository(repo).skipDuplicate(false)
@@ -96,7 +96,7 @@
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- IdempotentRepository<String> repo = MemoryIdempotentRepository.memoryIdempotentRepository(200);
+ IdempotentRepository repo = MemoryIdempotentRepository.memoryIdempotentRepository(200);
// START SNIPPET: e1
from("direct:start")
diff --git a/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java b/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
index 6bd79db..3e71d3c 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
@@ -66,7 +66,7 @@
// navigate children
if (child instanceof Navigate) {
- navigateRoute((Navigate<Processor>) child);
+ navigateRoute((Navigate) child);
}
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java b/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
index 3b51222..1e04d03 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
@@ -82,17 +82,18 @@
if (child instanceof DefaultChannel) {
DefaultChannel channel = (DefaultChannel) child;
- ProcessorDefinition<?> def = channel.getProcessorDefinition();
+ ProcessorDefinition def = channel.getProcessorDefinition();
navigateDefinition(def, sb);
}
}
}
+ @SuppressWarnings("unchecked")
private void navigateDefinition(ProcessorDefinition<?> def, StringBuilder sb) {
// must do this ugly cast to avoid compiler error on HP-UX
- ProcessorDefinition<?> defn = (ProcessorDefinition<?>) def;
+ ProcessorDefinition defn = (ProcessorDefinition) def;
if (defn instanceof LoadBalanceDefinition) {
sb.append(".loadBalance()");
@@ -105,17 +106,18 @@
}
if (defn instanceof SendDefinition) {
- SendDefinition<?> send = (SendDefinition<?>) defn;
+ SendDefinition send = (SendDefinition) defn;
sb.append(".to(\"" + send.getUri() + "\")");
}
- List<ProcessorDefinition<?>> children = defn.getOutputs();
+ List<ProcessorDefinition> children = defn.getOutputs();
if (children == null || children.isEmpty()) {
return;
}
- for (ProcessorDefinition<?> child : children) {
+ for (ProcessorDefinition child : children) {
navigateDefinition(child, sb);
}
}
+
}
\ No newline at end of file
diff --git a/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelAggregateThreadPoolIssueTest.java b/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelAggregateThreadPoolIssueTest.java
index 7040251..fb3a1ca 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelAggregateThreadPoolIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelAggregateThreadPoolIssueTest.java
@@ -52,7 +52,7 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- context.getExecutorServiceManager().setThreadNamePattern("#counter#");
+ context.getExecutorServiceManager().setThreadNamePattern("${counter}");
from("direct:start")
.recipientList(header("foo")).parallelProcessing();
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SortBodyTest.java b/camel-core/src/test/java/org/apache/camel/processor/SortBodyTest.java
index 3d25616..3825641 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SortBodyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SortBodyTest.java
@@ -33,7 +33,7 @@
assertMockEndpointsSatisfied();
- List<?> list = mock.getExchanges().get(0).getIn().getBody(List.class);
+ List list = mock.getExchanges().get(0).getIn().getBody(List.class);
assertEquals("Claus", list.get(0));
assertEquals("Hadrian", list.get(1));
assertEquals("William", list.get(2));
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SortExpressionTest.java b/camel-core/src/test/java/org/apache/camel/processor/SortExpressionTest.java
index 4fdb913..8c8b506 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SortExpressionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SortExpressionTest.java
@@ -34,7 +34,7 @@
assertMockEndpointsSatisfied();
- List<?> list = mock.getExchanges().get(0).getIn().getBody(List.class);
+ List list = mock.getExchanges().get(0).getIn().getBody(List.class);
assertEquals("Claus", list.get(0));
assertEquals("Hadrian", list.get(1));
assertEquals("William", list.get(2));
@@ -48,7 +48,7 @@
assertMockEndpointsSatisfied();
- List<?> list = mock.getExchanges().get(0).getIn().getBody(List.class);
+ List list = mock.getExchanges().get(0).getIn().getBody(List.class);
assertEquals("William", list.get(0));
assertEquals("Hadrian", list.get(1));
assertEquals("Claus", list.get(2));
@@ -69,7 +69,7 @@
}
// START SNIPPET: e3
- public static class MyReverseComparator implements Comparator<Object> {
+ public static class MyReverseComparator implements Comparator {
// must have default constructor when used by spring bean testing
public MyReverseComparator() {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
index f80f53f..d8e0afa 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
@@ -35,8 +35,8 @@
// use navigate to find that the end works as expected
Navigate<Processor> nav = context.getRoutes().get(0).navigate();
List<Processor> node = nav.next();
- node = ((Navigate<Processor>) node.get(0)).next();
- node = ((Navigate<Processor>) node.get(0)).next();
+ node = ((Navigate) node.get(0)).next();
+ node = ((Navigate) node.get(0)).next();
// there should be 4 outputs as the end in the otherwise should
// ensure that the transform and last send is not within the choice
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitterNullBodyTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitterNullBodyTest.java
index 82d59ec..03cbb97 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitterNullBodyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitterNullBodyTest.java
@@ -49,7 +49,7 @@
getMockEndpoint("mock:split").expectedMessageCount(0);
getMockEndpoint("mock:result").expectedMessageCount(1);
- List<?> list = new ArrayList<Object>();
+ List list = new ArrayList();
template.sendBody("direct:start", list);
assertMockEndpointsSatisfied();
@@ -59,7 +59,7 @@
getMockEndpoint("mock:split").expectedMessageCount(0);
getMockEndpoint("mock:result").expectedMessageCount(1);
- List<?> list = new ArrayList<Object>();
+ List list = new ArrayList();
template.sendBody("direct:streaming", list);
assertMockEndpointsSatisfied();
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamingWithErrorHandlerTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamingWithErrorHandlerTest.java
index 118ead0..a95ec15 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamingWithErrorHandlerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitterStreamingWithErrorHandlerTest.java
@@ -18,7 +18,10 @@
import java.util.Iterator;
+import org.apache.camel.CamelExecutionException;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
/**
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java
index 765e444..e585c7a 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java
@@ -221,8 +221,8 @@
resultEndpoint.expectedMessageCount(4);
resultEndpoint.expectedBodiesReceived("A", "B", "C", "D");
final List<String> data = Arrays.asList("A", "B", "C", "D");
- Iterable<String> itb = new Iterable<String>() {
- public Iterator<String> iterator() {
+ Iterable itb = new Iterable() {
+ public Iterator iterator() {
return data.iterator();
}
};
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitterWithCustomThreadPoolExecutorTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitterWithCustomThreadPoolExecutorTest.java
index a7543ca..40a5aea 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitterWithCustomThreadPoolExecutorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitterWithCustomThreadPoolExecutorTest.java
@@ -57,10 +57,11 @@
return result;
}
- protected SplitDefinition firstSplitterType(List<ProcessorDefinition<?>> outputs) {
+ @SuppressWarnings("unchecked")
+ protected SplitDefinition firstSplitterType(List<ProcessorDefinition> outputs) {
SplitDefinition result = null;
- for (ProcessorDefinition<?> processorType : outputs) {
+ for (ProcessorDefinition processorType : outputs) {
if (processorType instanceof SplitDefinition) {
result = (SplitDefinition) processorType;
} else {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java b/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java
index 4f49a42..006b5c0 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ThreadsRejectedExecutionTest.java
@@ -22,8 +22,6 @@
import java.util.concurrent.TimeUnit;
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.ThreadPoolRejectedPolicy;
-import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -45,6 +43,8 @@
// this should force the ThreadsProcessor to run the tasks itself
ExecutorService pool = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
+ context.setTracing(true);
+
from("seda:start")
.to("log:before")
// will use our custom pool
@@ -73,6 +73,8 @@
// this should force the ThreadsProcessor to run the tasks itself
ExecutorService pool = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
+ context.setTracing(true);
+
from("seda:start")
.to("log:before")
// will use our custom pool
@@ -100,150 +102,4 @@
assertEquals(1, mock.getReceivedCounter());
}
- public void testThreadsRejectedDiscard() throws Exception {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("seda:start")
- .to("log:before")
- .threads(1, 1).maxPoolSize(1).maxQueueSize(2).rejectedPolicy(ThreadPoolRejectedPolicy.Discard)
- .delay(1000)
- .to("log:after")
- .to("mock:result");
- }
- });
- context.start();
-
- NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
-
- getMockEndpoint("mock:result").expectedMinimumMessageCount(2);
- for (int i = 0; i < 10; i++) {
- template.sendBody("seda:start", "Message " + i);
- }
- assertMockEndpointsSatisfied();
-
- assertTrue(notify.matchesMockWaitTime());
-
- int inflight = context.getInflightRepository().size();
- assertEquals(0, inflight);
- }
-
- public void testThreadsRejectedDiscardOldest() throws Exception {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("seda:start")
- .to("log:before")
- .threads(1, 1).maxPoolSize(1).maxQueueSize(2).rejectedPolicy(ThreadPoolRejectedPolicy.DiscardOldest)
- .delay(1000)
- .to("log:after")
- .to("mock:result");
- }
- });
- context.start();
-
- NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
-
- getMockEndpoint("mock:result").expectedMinimumMessageCount(2);
- for (int i = 0; i < 10; i++) {
- template.sendBody("seda:start", "Message " + i);
- }
- assertMockEndpointsSatisfied();
-
- assertTrue(notify.matchesMockWaitTime());
-
- int inflight = context.getInflightRepository().size();
- assertEquals(0, inflight);
- }
-
- public void testThreadsRejectedAbort() throws Exception {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("seda:start")
- .to("log:before")
- .threads(1, 1).maxPoolSize(1).maxQueueSize(2).rejectedPolicy(ThreadPoolRejectedPolicy.Abort)
- .delay(1000)
- .to("log:after")
- .to("mock:result");
- }
- });
- context.start();
-
- NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
-
- getMockEndpoint("mock:result").expectedMinimumMessageCount(2);
- for (int i = 0; i < 10; i++) {
- template.sendBody("seda:start", "Message " + i);
- }
- assertMockEndpointsSatisfied();
-
- assertTrue(notify.matchesMockWaitTime());
-
- int inflight = context.getInflightRepository().size();
- assertEquals(0, inflight);
- }
-
- public void testThreadsRejectedCallerRuns() throws Exception {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("seda:start")
- .to("log:before")
- .threads(1, 1).maxPoolSize(1).maxQueueSize(2).rejectedPolicy(ThreadPoolRejectedPolicy.CallerRuns)
- .delay(200)
- .to("log:after")
- .to("mock:result");
- }
- });
- context.start();
-
- NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
-
- getMockEndpoint("mock:result").expectedMessageCount(10);
- for (int i = 0; i < 10; i++) {
- template.sendBody("seda:start", "Message " + i);
- }
- assertMockEndpointsSatisfied();
-
- assertTrue(notify.matchesMockWaitTime());
-
- int inflight = context.getInflightRepository().size();
- assertEquals(0, inflight);
- }
-
- public void testThreadsRejectedAbortNoRedelivery() throws Exception {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- onException(Exception.class).maximumRedeliveries(3).handled(true).to("mock:error");
-
- from("seda:start")
- .to("log:before")
- .threads(1, 1).maxPoolSize(1).maxQueueSize(2).rejectedPolicy(ThreadPoolRejectedPolicy.Abort)
- .delay(1000)
- .to("log:after")
- .to("mock:result");
- }
- });
- context.start();
-
- NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
-
- // there should be error handling for aborted tasks (eg no redeliveries and no error handling)
- getMockEndpoint("mock:error").expectedMessageCount(0);
-
- getMockEndpoint("mock:result").expectedMinimumMessageCount(2);
- for (int i = 0; i < 10; i++) {
- template.sendBody("seda:start", "Message " + i);
- }
- assertMockEndpointsSatisfied();
-
- assertTrue(notify.matchesMockWaitTime());
-
- int inflight = context.getInflightRepository().size();
- assertEquals(0, inflight);
- }
-
-
}
\ No newline at end of file
diff --git a/camel-core/src/test/java/org/apache/camel/processor/TryCatchMustHaveExceptionConfiguredTest.java b/camel-core/src/test/java/org/apache/camel/processor/TryCatchMustHaveExceptionConfiguredTest.java
index c2be3aa..f23b977 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/TryCatchMustHaveExceptionConfiguredTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/TryCatchMustHaveExceptionConfiguredTest.java
@@ -28,7 +28,6 @@
public void testTryCatchMustHaveExceptionConfigured() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
from("direct:a")
.doTry()
diff --git a/camel-core/src/test/java/org/apache/camel/processor/TryProcessorMultipleExceptionTest.java b/camel-core/src/test/java/org/apache/camel/processor/TryProcessorMultipleExceptionTest.java
index 62b057d..385c5ff 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/TryProcessorMultipleExceptionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/TryProcessorMultipleExceptionTest.java
@@ -58,10 +58,8 @@
assertMockEndpointsSatisfied();
}
- @Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
- @SuppressWarnings("unchecked")
public void configure() {
// START SNIPPET: e1
from("direct:start")
diff --git a/camel-core/src/test/java/org/apache/camel/processor/TryProcessorOnWhenTest.java b/camel-core/src/test/java/org/apache/camel/processor/TryProcessorOnWhenTest.java
index 257e883..c6a695d 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/TryProcessorOnWhenTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/TryProcessorOnWhenTest.java
@@ -90,8 +90,6 @@
assertMockEndpointsSatisfied();
}
- @Override
- @SuppressWarnings("unchecked")
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopParallelTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopParallelTest.java
deleted file mode 100644
index 9060ce4..0000000
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopParallelTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.processor.aggregator;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.processor.BodyInAggregatingStrategy;
-
-/**
- * @version
- */
-public class AggregateForceCompletionOnStopParallelTest extends AggregateForceCompletionOnStopTest {
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:forceCompletionTrue").routeId("foo")
- .aggregate(header("id"), new BodyInAggregatingStrategy()).forceCompletionOnStop().completionSize(10).parallelProcessing()
- .delay(100)
- .processRef("myCompletionProcessor");
-
- from("direct:forceCompletionFalse").routeId("bar")
- .aggregate(header("id"), new BodyInAggregatingStrategy()).completionSize(10).parallelProcessing()
- .delay(100)
- .processRef("myCompletionProcessor");
- }
- };
- }
-}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopTest.java
index 676de45..159e03b 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregateForceCompletionOnStopTest.java
@@ -18,7 +18,6 @@
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.processor.BodyInAggregatingStrategy;
/**
@@ -26,10 +25,16 @@
*/
public class AggregateForceCompletionOnStopTest extends ContextTestSupport {
- public void testForceCompletionTrue() throws Exception {
- MyCompletionProcessor myCompletionProcessor = context.getRegistry().lookup("myCompletionProcessor", MyCompletionProcessor.class);
- myCompletionProcessor.reset();
+ // TODO: Need CAMEL-4953 to fix me
+ MyCompletionProcessor myCompletionProcessor = new MyCompletionProcessor();
+
+ public void testFixMe() throws Exception {
+ // TODO: remove me
+ }
+
+ public void xxxTestForceCompletionTrue() throws Exception {
+ myCompletionProcessor.reset();
context.getShutdownStrategy().setShutdownNowOnTimeout(true);
context.getShutdownStrategy().setTimeout(5);
@@ -37,16 +42,13 @@
template.sendBodyAndHeader("direct:forceCompletionTrue", "test2", "id", "2");
template.sendBodyAndHeader("direct:forceCompletionTrue", "test3", "id", "1");
template.sendBodyAndHeader("direct:forceCompletionTrue", "test4", "id", "2");
-
assertEquals("aggregation should not have completed yet", 0, myCompletionProcessor.getAggregationCount());
context.stop();
assertEquals("aggregation should have completed", 2, myCompletionProcessor.getAggregationCount());
}
- public void testForceCompletionFalse() throws Exception {
- MyCompletionProcessor myCompletionProcessor = context.getRegistry().lookup("myCompletionProcessor", MyCompletionProcessor.class);
+ public void xxxTestForceCompletionFalse() throws Exception {
myCompletionProcessor.reset();
-
context.getShutdownStrategy().setShutdownNowOnTimeout(true);
context.getShutdownStrategy().setTimeout(5);
@@ -54,68 +56,27 @@
template.sendBodyAndHeader("direct:forceCompletionFalse", "test2", "id", "2");
template.sendBodyAndHeader("direct:forceCompletionFalse", "test3", "id", "1");
template.sendBodyAndHeader("direct:forceCompletionFalse", "test4", "id", "2");
-
assertEquals("aggregation should not have completed yet", 0, myCompletionProcessor.getAggregationCount());
context.stop();
assertEquals("aggregation should not have completed yet", 0, myCompletionProcessor.getAggregationCount());
}
- public void testStopRouteForceCompletionTrue() throws Exception {
- MyCompletionProcessor myCompletionProcessor = context.getRegistry().lookup("myCompletionProcessor", MyCompletionProcessor.class);
- myCompletionProcessor.reset();
-
- context.getShutdownStrategy().setShutdownNowOnTimeout(true);
- context.getShutdownStrategy().setTimeout(5);
-
- template.sendBodyAndHeader("direct:forceCompletionTrue", "test1", "id", "1");
- template.sendBodyAndHeader("direct:forceCompletionTrue", "test2", "id", "2");
- template.sendBodyAndHeader("direct:forceCompletionTrue", "test3", "id", "1");
- template.sendBodyAndHeader("direct:forceCompletionTrue", "test4", "id", "2");
-
- assertEquals("aggregation should not have completed yet", 0, myCompletionProcessor.getAggregationCount());
- // stopping a route should also force the completion
- context.stopRoute("foo");
- assertEquals("aggregation should have completed", 2, myCompletionProcessor.getAggregationCount());
- }
-
- public void testStopRouteForceCompletionFalse() throws Exception {
- MyCompletionProcessor myCompletionProcessor = context.getRegistry().lookup("myCompletionProcessor", MyCompletionProcessor.class);
- myCompletionProcessor.reset();
-
- context.getShutdownStrategy().setShutdownNowOnTimeout(true);
- context.getShutdownStrategy().setTimeout(5);
-
- template.sendBodyAndHeader("direct:forceCompletionFalse", "test1", "id", "1");
- template.sendBodyAndHeader("direct:forceCompletionFalse", "test2", "id", "2");
- template.sendBodyAndHeader("direct:forceCompletionFalse", "test3", "id", "1");
- template.sendBodyAndHeader("direct:forceCompletionFalse", "test4", "id", "2");
-
- assertEquals("aggregation should not have completed yet", 0, myCompletionProcessor.getAggregationCount());
- context.stopRoute("bar");
- assertEquals("aggregation should not have completed yet", 0, myCompletionProcessor.getAggregationCount());
- }
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- JndiRegistry jndi = super.createRegistry();
- jndi.bind("myCompletionProcessor", new MyCompletionProcessor());
- return jndi;
- }
-
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
+
@Override
public void configure() throws Exception {
- from("direct:forceCompletionTrue").routeId("foo")
+
+ from("direct:forceCompletionTrue")
.aggregate(header("id"), new BodyInAggregatingStrategy()).forceCompletionOnStop().completionSize(10)
.delay(100)
- .processRef("myCompletionProcessor");
+ .process(myCompletionProcessor);
- from("direct:forceCompletionFalse").routeId("bar")
+ from("direct:forceCompletionFalse")
.aggregate(header("id"), new BodyInAggregatingStrategy()).completionSize(10)
.delay(100)
- .processRef("myCompletionProcessor");
+ .process(myCompletionProcessor);
}
};
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AlbertoAggregatorTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AlbertoAggregatorTest.java
index 5237b02..08efb4d 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AlbertoAggregatorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AlbertoAggregatorTest.java
@@ -52,7 +52,7 @@
karamazovBrothers.add("Alexei");
karamazovBrothers.add("Dimitri");
- Map<String, List<String>> allBrothers = new HashMap<String, List<String>>();
+ Map<String, List> allBrothers = new HashMap<String, List>();
allBrothers.put("Marx", marxBrothers);
allBrothers.put("Karamazov", karamazovBrothers);
@@ -100,11 +100,11 @@
Exchange answer = newExchange;
if (oldExchange != null) {
- Map<String, List<?>> brothers = oldExchange.getIn().getBody(Map.class);
+ Map<String, List> brothers = oldExchange.getIn().getBody(Map.class);
brothers.put(newExchange.getIn().getHeader(SURNAME_HEADER, String.class), newExchange.getIn().getBody(List.class));
answer = oldExchange;
} else {
- Map<String, List<?>> brothers = new HashMap<String, List<?>>();
+ Map<String, List> brothers = new HashMap<String, List>();
brothers.put(newExchange.getIn().getHeader(SURNAME_HEADER, String.class), newExchange.getIn().getBody(List.class));
newExchange.getIn().setBody(brothers);
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/MyCompletionProcessor.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/MyCompletionProcessor.java
index 5792de8..aa8ec4e 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/MyCompletionProcessor.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/MyCompletionProcessor.java
@@ -16,24 +16,22 @@
*/
package org.apache.camel.processor.aggregator;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class MyCompletionProcessor implements Processor {
- private final AtomicInteger aggregationCount = new AtomicInteger();
+ private static int aggregationCount;
public int getAggregationCount() {
- return aggregationCount.get();
+ return aggregationCount;
}
@Override
public void process(Exchange exchange) throws Exception {
- aggregationCount.incrementAndGet();
+ aggregationCount++;
}
public void reset() {
- aggregationCount.set(0);
+ aggregationCount = 0;
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/async/AsyncTraceHandlerTest.java b/camel-core/src/test/java/org/apache/camel/processor/async/AsyncTraceHandlerTest.java
index 7f18477..7bc0c61 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/async/AsyncTraceHandlerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/async/AsyncTraceHandlerTest.java
@@ -78,12 +78,12 @@
private static class MyTraceHandler implements TraceEventHandler {
@Override
- public void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ public void traceExchange(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
// noop
}
@Override
- public Object traceExchangeIn(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ public Object traceExchangeIn(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
if (node.getId().equals("async")) {
beforeThreadName = Thread.currentThread().getName();
}
@@ -91,7 +91,7 @@
}
@Override
- public void traceExchangeOut(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
+ public void traceExchangeOut(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
if (node.getId().equals("async")) {
afterThreadName = Thread.currentThread().getName();
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java b/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java
index 15631ee..5f13454 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/enricher/PollEnricherRefTest.java
@@ -65,7 +65,7 @@
public void configure() throws Exception {
cool.setEndpointUriIfNotSpecified("cool");
- from("direct:start").pollEnrichRef("cool", 2000, "agg");
+ from("direct:start").pollEnrichRef("cool", 1000, "agg");
}
};
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/CustomExceptionPolicyStrategyTest.java b/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/CustomExceptionPolicyStrategyTest.java
index 10d5ba9..8e56bef 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/CustomExceptionPolicyStrategyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/CustomExceptionPolicyStrategyTest.java
@@ -36,7 +36,6 @@
private static final String ERROR_QUEUE = "mock:error";
public static class MyPolicyException extends Exception {
- private static final long serialVersionUID = 1L;
}
// START SNIPPET e2
diff --git a/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingOnlyWhenTest.java b/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingOnlyWhenTest.java
index fed0e1d..8de5780 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingOnlyWhenTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingOnlyWhenTest.java
@@ -31,7 +31,6 @@
private static final String ERROR_USER_QUEUE = "mock:usererror";
public static class MyUserException extends Exception {
- private static final long serialVersionUID = 1L;
public MyUserException(String message) {
super(message);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java b/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java
index 009a165..52a7426 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/exceptionpolicy/DefaultExceptionPolicyStrategyUsingWhenTest.java
@@ -31,7 +31,6 @@
private static final String ERROR_USER_QUEUE = "mock:usererror";
public static class MyUserException extends Exception {
- private static final long serialVersionUID = 1L;
public MyUserException(String message) {
super(message);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkip2Test.java b/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkip2Test.java
deleted file mode 100644
index e333503..0000000
--- a/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkip2Test.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.processor.intercept;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * Unit tests on the conditional skip support on InterceptSendToEndpoint.
- *
- * @version
- */
-public class InterceptSendToEndpointConditionalSkip2Test extends ContextTestSupport {
-
- public void testInterceptSendToEndpointNone() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(0);
- getMockEndpoint("mock:detour2").expectedMessageCount(0);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- public void testInterceptSendToEndpoint1() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(1);
- getMockEndpoint("mock:detour2").expectedMessageCount(0);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "skip1");
-
- assertMockEndpointsSatisfied();
- }
-
- public void testInterceptSendToEndpoint2() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(0);
- getMockEndpoint("mock:detour2").expectedMessageCount(1);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "skip2");
-
- assertMockEndpointsSatisfied();
- }
-
- public void testInterceptSendToEndpointBoth() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(1);
- getMockEndpoint("mock:detour2").expectedMessageCount(1);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "skip1,skip2");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- // we have 2 interceptors, which may both trigger, or either or, or none
- interceptSendToEndpoint("mock:skip1").skipSendToOriginalEndpoint()
- .when(body().contains("skip1")).to("mock:detour1");
-
- interceptSendToEndpoint("mock:skip2").skipSendToOriginalEndpoint()
- .when(body().contains("skip2")).to("mock:detour2");
-
- from("direct:start")
- .to("mock:a")
- .to("mock:skip1")
- .to("mock:skip2")
- .to("mock:c");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkip3Test.java b/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkip3Test.java
deleted file mode 100644
index 3989bca..0000000
--- a/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkip3Test.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.processor.intercept;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * Unit tests on the conditional skip support on InterceptSendToEndpoint.
- *
- * @version
- */
-public class InterceptSendToEndpointConditionalSkip3Test extends ContextTestSupport {
-
- public void testInterceptSendToEndpointNone() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(0);
- getMockEndpoint("mock:detour2").expectedMessageCount(0);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- public void testInterceptSendToEndpoint1() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(1);
- getMockEndpoint("mock:detour2").expectedMessageCount(0);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "skip1");
-
- assertMockEndpointsSatisfied();
- }
-
- public void testInterceptSendToEndpoint2() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:detour1").expectedMessageCount(0);
- getMockEndpoint("mock:detour2").expectedMessageCount(1);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "skip2");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- // we have 2 interceptors, which may both trigger, or either or, or none
- interceptSendToEndpoint("mock:skip").skipSendToOriginalEndpoint()
- .when(body().contains("skip")).to("mock:detour1");
-
- // we intercept the interceptor
- interceptSendToEndpoint("mock:detour1").skipSendToOriginalEndpoint()
- .when(body().contains("skip2")).to("mock:detour2");
-
- from("direct:start")
- .to("mock:a")
- .to("mock:skip")
- .to("mock:c");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkipTest.java b/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkipTest.java
deleted file mode 100644
index 1e77526..0000000
--- a/camel-core/src/test/java/org/apache/camel/processor/intercept/InterceptSendToEndpointConditionalSkipTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.processor.intercept;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-
-/**
- * Unit tests on the conditional skip support on InterceptSendToEndpoint.
- *
- * @version
- */
-public class InterceptSendToEndpointConditionalSkipTest extends ContextTestSupport {
-
- /**
- * Verify that the endpoint is only skipped if the adjacent 'when' condition is satisfied
- */
- public void testInterceptSendToEndpointSkipConditionSatisfied() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:skippable").expectedMessageCount(0);
- getMockEndpoint("mock:detour").expectedMessageCount(1);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "skip");
-
- assertMockEndpointsSatisfied();
- }
-
- /**
- * Verify that the endpoint is not skipped if the adjacent 'when' condition evaluates to false
- */
- public void testInterceptSendToEndpointSkipConditionNotSatisfied() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:skippable").expectedMessageCount(1);
- getMockEndpoint("mock:detour").expectedMessageCount(0);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- /**
- * Verify that the conditional skip support is only activated when using interceptSendToEndpoint().when() and not
- * interceptSendToEndpoint().choice()..., as the choice keyword is not directly associated with the interception behaviour and it belongs to the
- * interception body (initiating a new routing block)
- */
- public void testInterceptSendToEndpointSkipConditionNoEffectChoice() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(2);
- getMockEndpoint("mock:skippableNoEffect").expectedMessageCount(0);
- getMockEndpoint("mock:c").expectedMessageCount(2);
-
- getMockEndpoint("mock:noSkipWhen").expectedMessageCount(1);
- getMockEndpoint("mock:noSkipOW").expectedMessageCount(1);
-
- template.sendBody("direct:startNoEffect", "skipNoEffectWhen");
- template.sendBody("direct:startNoEffect", "Hello Camel");
-
- assertMockEndpointsSatisfied();
- }
-
- /**
- * Test that when multiple conditions are chained together in Java DSL, only the first one will determine whether the endpoint is skipped or not
- */
- public void testInterceptSendToEndpointSkipMultipleConditions() throws Exception {
- getMockEndpoint("mock:a").expectedMessageCount(1);
- getMockEndpoint("mock:skippableMultipleConditions").expectedMessageCount(0);
- getMockEndpoint("mock:detour").expectedMessageCount(1);
- getMockEndpoint("mock:c").expectedMessageCount(1);
-
- template.sendBody("direct:startMultipleConditions", "skip");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- // only skip if the body equals 'skip'
- interceptSendToEndpoint("mock:skippable").skipSendToOriginalEndpoint()
- .when(body().isEqualTo("skip")).to("mock:detour");
-
- // always skip with a normal with a normal choice inside instructing where to route instead
- interceptSendToEndpoint("mock:skippableNoEffect").skipSendToOriginalEndpoint()
- .choice()
- .when(body().isEqualTo("skipNoEffectWhen")).to("mock:noSkipWhen")
- .otherwise().to("mock:noSkipOW");
-
- // in this case, the original endpoint will be skipped but no message will be sent to mock:detour
- interceptSendToEndpoint("mock:skippableMultipleConditions").skipSendToOriginalEndpoint()
- .when(body().isEqualTo("skip"))
- .when(body().isNotEqualTo("skip"))
- .to("mock:detour");
-
- from("direct:start")
- .to("mock:a")
- .to("mock:skippable")
- .to("mock:c");
-
- from("direct:startNoEffect")
- .to("mock:a")
- .to("mock:skippableNoEffect")
- .to("mock:c");
-
- from("direct:startMultipleConditions")
- .to("mock:a")
- .to("mock:skippableMultipleConditions")
- .to("mock:c");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/intercept/ParentChildInterceptStrategyTest.java b/camel-core/src/test/java/org/apache/camel/processor/intercept/ParentChildInterceptStrategyTest.java
index 4c266db1..57e685d 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/intercept/ParentChildInterceptStrategyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/intercept/ParentChildInterceptStrategyTest.java
@@ -85,7 +85,7 @@
public Processor wrapProcessorInInterceptors(final CamelContext context, final ProcessorDefinition<?> definition,
final Processor target, final Processor nextTarget) throws Exception {
String targetId = definition.hasCustomIdAssigned() ? definition.getId() : definition.getLabel();
- ProcessorDefinition<?> parent = definition.getParent();
+ ProcessorDefinition parent = definition.getParent();
String parentId = "";
if (parent != null) {
parentId = parent.hasCustomIdAssigned() ? parent.getId() : parent.getLabel();
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/CustomInterceptorRouteWithChildOutputTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/CustomInterceptorRouteWithChildOutputTest.java
index 6a99b07..7f7dfa7 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/CustomInterceptorRouteWithChildOutputTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/CustomInterceptorRouteWithChildOutputTest.java
@@ -71,7 +71,6 @@
};
}
- @SuppressWarnings("rawtypes")
private static class MyInterceptor implements InterceptStrategy {
private final List<ProcessorDefinition> defs = new ArrayList<ProcessorDefinition>();
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionBreakpointTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionBreakpointTest.java
index 654234f..ab8df84 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionBreakpointTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionBreakpointTest.java
@@ -45,7 +45,7 @@
breakpoint = new BreakpointSupport() {
@Override
- public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
Exception e = exchange.getException();
logs.add("Breakpoint at " + definition.getShortName() + " caused by: " + e.getClass().getSimpleName() + "[" + e.getMessage() + "]");
}
@@ -53,7 +53,7 @@
exceptionCondition = new ConditionSupport() {
@Override
- public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
return exchange.getException() != null;
}
};
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionEventBreakpointTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionEventBreakpointTest.java
index 3684d2a..dc98b3b 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionEventBreakpointTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugExceptionEventBreakpointTest.java
@@ -46,7 +46,7 @@
super.setUp();
breakpoint = new BreakpointSupport() {
- public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
+ public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition definition) {
AbstractExchangeEvent aee = (AbstractExchangeEvent) event;
Exception e = aee.getExchange().getException();
logs.add("Breakpoint at " + definition + " caused by: " + e.getClass().getSimpleName() + "[" + e.getMessage() + "]");
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepConditionTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepConditionTest.java
index 9074a69..0a5a030 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepConditionTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepConditionTest.java
@@ -44,14 +44,14 @@
super.setUp();
breakpoint = new BreakpointSupport() {
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Single stepping at " + definition.getLabel() + " with body: " + body);
}
};
beerCondition = new ConditionSupport() {
- public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
return "beer".equals(exchange.getFromRouteId());
}
};
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepTest.java
index b5a9363..72ecb7d 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugSingleStepTest.java
@@ -41,7 +41,7 @@
super.setUp();
breakpoint = new BreakpointSupport() {
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Single stepping at " + definition.getLabel() + " with body: " + body);
}
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java
index 34214cc..f913103 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java
@@ -49,25 +49,25 @@
super.setUp();
breakpoint = new BreakpointSupport() {
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Breakpoint at " + definition + " with body: " + body);
}
- public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
+ public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Breakpoint event " + event.getClass().getSimpleName() + " with body: " + body);
}
};
camelCondition = new ConditionSupport() {
- public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
return body().contains("Camel").matches(exchange);
}
};
mockCondition = new ConditionSupport() {
- public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
// match when sending to mocks
if (definition instanceof ToDefinition) {
ToDefinition to = (ToDefinition) definition;
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceHandlerTestHandler.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceHandlerTestHandler.java
index e30dd87..dc8f485 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceHandlerTestHandler.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceHandlerTestHandler.java
@@ -57,19 +57,19 @@
eventMessages.add(message);
}
- public static void recordComplete(StringBuilder message, ProcessorDefinition<?> node, Exchange exchange) {
+ public static void recordComplete(StringBuilder message, ProcessorDefinition node, Exchange exchange) {
message.append("Complete: ");
message.append(node.getLabel() + ": ");
message.append(exchange.getIn().getBody());
}
- public static void recordIn(StringBuilder message, ProcessorDefinition<?> node, Exchange exchange) {
+ public static void recordIn(StringBuilder message, ProcessorDefinition node, Exchange exchange) {
message.append("In: ");
message.append(node.getLabel() + ": ");
message.append(exchange.getIn().getBody());
}
- public static void recordOut(StringBuilder message, ProcessorDefinition<?> node, Exchange exchange) {
+ public static void recordOut(StringBuilder message, ProcessorDefinition node, Exchange exchange) {
message.append("Out: ");
message.append(node.getLabel() + ": ");
if (null != exchange.getOut()) {
@@ -83,7 +83,7 @@
}
}
- public void traceExchange(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ public void traceExchange(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
if (traceAllNodes || !node.getLabel().contains("TraceTestProcessor")) {
StringBuilder message = new StringBuilder();
recordComplete(message, node, exchange);
@@ -91,7 +91,7 @@
}
}
- public Object traceExchangeIn(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
+ public Object traceExchangeIn(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange) throws Exception {
if (traceAllNodes || !node.getLabel().contains("TraceTestProcessor")) {
StringBuilder message = new StringBuilder();
recordIn(message, node, exchange);
@@ -101,7 +101,7 @@
}
}
- public void traceExchangeOut(ProcessorDefinition<?> node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
+ public void traceExchangeOut(ProcessorDefinition node, Processor target, TraceInterceptor traceInterceptor, Exchange exchange, Object traceState) throws Exception {
if (traceAllNodes || !node.getLabel().contains("TraceTestProcessor")) {
if (StringBuilder.class.equals(traceState.getClass())) {
StringBuilder message = (StringBuilder) traceState;
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
index 24d8e49..5f3b2a7 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorFactoryCreatesHandlerTest.java
@@ -36,7 +36,7 @@
}
@SuppressWarnings("deprecation")
- public Processor createTraceInterceptor(ProcessorDefinition<?> node, Processor target, TraceFormatter formatter, Tracer tracer) {
+ public Processor createTraceInterceptor(ProcessorDefinition node, Processor target, TraceFormatter formatter, Tracer tracer) {
TraceInterceptor interceptor = new TraceInterceptor(node, target, formatter, tracer);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java b/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
index c490940..cc316fa 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorSubclassFactory.java
@@ -31,7 +31,7 @@
this.eventMessages = eventMessages;
}
- public TraceInterceptor createTraceInterceptor(ProcessorDefinition<?> node, Processor target, TraceFormatter formatter, Tracer tracer) {
+ public TraceInterceptor createTraceInterceptor(ProcessorDefinition node, Processor target, TraceFormatter formatter, Tracer tracer) {
return new TracerInterceptorSubclass(node, target, formatter, tracer, eventMessages, this);
}
@@ -48,7 +48,7 @@
private boolean traceThisNode = true;
private TraceInterceptorSubclassFactory factory;
- public TracerInterceptorSubclass(ProcessorDefinition<?> node, Processor target, TraceFormatter formatter,
+ public TracerInterceptorSubclass(ProcessorDefinition node, Processor target, TraceFormatter formatter,
Tracer tracer, List<StringBuilder> eventMessages, TraceInterceptorSubclassFactory factory) {
super(node, target, formatter, tracer);
this.eventMessages = eventMessages;
diff --git a/camel-core/src/test/java/org/apache/camel/processor/onexception/MyFunctionalException.java b/camel-core/src/test/java/org/apache/camel/processor/onexception/MyFunctionalException.java
index 95a4b4e..bb885c2 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/onexception/MyFunctionalException.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/onexception/MyFunctionalException.java
@@ -17,7 +17,6 @@
package org.apache.camel.processor.onexception;
public class MyFunctionalException extends Exception {
- private static final long serialVersionUID = 1L;
public MyFunctionalException(String message) {
super(message);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/onexception/MyTechnicalException.java b/camel-core/src/test/java/org/apache/camel/processor/onexception/MyTechnicalException.java
index 18426da..1c951a5 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/onexception/MyTechnicalException.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/onexception/MyTechnicalException.java
@@ -17,7 +17,6 @@
package org.apache.camel.processor.onexception;
public class MyTechnicalException extends Exception {
- private static final long serialVersionUID = 1L;
public MyTechnicalException(String message) {
super(message);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
index 5b464f0..7b7c830 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionMisconfiguredTest.java
@@ -72,7 +72,6 @@
public void testOnExceptionMisconfigured3() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
onException();
@@ -91,7 +90,6 @@
public void testOnExceptionMisconfigured4() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
onException().end();
@@ -110,7 +108,6 @@
public void testOnExceptionMisconfigured5() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
from("direct:start")
@@ -130,7 +127,6 @@
public void testOnExceptionNotMisconfigured() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
onException().handled(true);
@@ -144,7 +140,6 @@
public void testOnExceptionNotMisconfigured2() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
onException().continued(true);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionWhenSimpleOgnlTest.java b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionWhenSimpleOgnlTest.java
index 6dd2771..c4bd254 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionWhenSimpleOgnlTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionWhenSimpleOgnlTest.java
@@ -50,7 +50,6 @@
}
public static final class MyException extends Exception {
- private static final long serialVersionUID = 1L;
private final MyExceptionInfo info;
public MyException(int state) {
diff --git a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionsPerRouteTest.java b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionsPerRouteTest.java
index 49c3978..c96d2dc 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionsPerRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionsPerRouteTest.java
@@ -47,7 +47,6 @@
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
- @SuppressWarnings("unchecked")
public void configure() throws Exception {
from("direct:start")
.onException(IllegalArgumentException.class, IOException.class)
diff --git a/camel-core/src/test/java/org/apache/camel/support/DefaultTimeoutMapTest.java b/camel-core/src/test/java/org/apache/camel/support/DefaultTimeoutMapTest.java
index 51e0330d..541902e 100644
--- a/camel-core/src/test/java/org/apache/camel/support/DefaultTimeoutMapTest.java
+++ b/camel-core/src/test/java/org/apache/camel/support/DefaultTimeoutMapTest.java
@@ -32,7 +32,7 @@
private ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1);
public void testDefaultTimeoutMap() {
- DefaultTimeoutMap<?, ?> map = new DefaultTimeoutMap<Object, Object>(executor);
+ DefaultTimeoutMap map = new DefaultTimeoutMap(executor);
assertTrue(map.currentTime() > 0);
assertEquals(0, map.size());
diff --git a/camel-core/src/test/java/org/apache/camel/util/AnotherExampleBean.java b/camel-core/src/test/java/org/apache/camel/util/AnotherExampleBean.java
index f2d58d4..bab89c7 100644
--- a/camel-core/src/test/java/org/apache/camel/util/AnotherExampleBean.java
+++ b/camel-core/src/test/java/org/apache/camel/util/AnotherExampleBean.java
@@ -27,7 +27,7 @@
private String name;
private double price;
private Date date;
- private Collection<?> children;
+ private Collection children;
private Boolean goldCustomer;
private boolean little;
@@ -67,11 +67,11 @@
this.date = date;
}
- public Collection<?> getChildren() {
+ public Collection getChildren() {
return children;
}
- public void setChildren(Collection<?> children) {
+ public void setChildren(Collection children) {
this.children = children;
}
diff --git a/camel-core/src/test/java/org/apache/camel/util/AntPathMatcherTest.java b/camel-core/src/test/java/org/apache/camel/util/AntPathMatcherTest.java
deleted file mode 100644
index 1df40ff..0000000
--- a/camel-core/src/test/java/org/apache/camel/util/AntPathMatcherTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.util;
-
-import junit.framework.TestCase;
-
-/**
- * Unit tests for {@link AntPathMatcher}.
- */
-public class AntPathMatcherTest extends TestCase {
-
- public void test() {
- AntPathMatcher matcher = new AntPathMatcher();
- assertTrue(matcher.match("*.txt", "blah.txt"));
- assertFalse(matcher.match("*.txt", "foo/blah.txt"));
- assertTrue(matcher.match("???.txt", "abc.txt"));
- assertTrue(matcher.match("abc.t?t", "abc.tnt"));
- assertFalse(matcher.match("???.txt", "abcd.txt"));
- assertTrue(matcher.match("**/*.txt", "blah.txt"));
- assertTrue(matcher.match("**/*.txt", "foo/blah.txt"));
- assertTrue(matcher.match("**/*.txt", "foo/bar/blah.txt"));
- assertTrue(matcher.match("foo/**/*.txt", "foo/bar/blah.txt"));
- assertTrue(matcher.match("foo/**/*.??", "foo/bar/blah.gz"));
- assertTrue(matcher.match("foo/**/*.txt", "foo/blah.txt"));
- assertFalse(matcher.match("foo/**/*.txt", "blah/blah.txt"));
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java b/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
index bf41b1e..adeea3a 100644
--- a/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/CaseInsensitiveMapTest.java
@@ -229,7 +229,7 @@
map.put("BAR", 123);
map.put("baZ", "beer");
- Set<String> keys = map.keySet();
+ Set keys = map.keySet();
// we should be able to lookup no matter what case
assertTrue(keys.contains("Foo"));
@@ -276,14 +276,14 @@
map.put("BAR", "123");
map.put("baZ", "Beer");
- Iterator<Object> it = map.values().iterator();
+ Iterator it = map.values().iterator();
// should be String values
assertEquals("String", it.next().getClass().getSimpleName());
assertEquals("String", it.next().getClass().getSimpleName());
assertEquals("String", it.next().getClass().getSimpleName());
- Collection<Object> values = map.values();
+ Collection values = map.values();
assertEquals(3, values.size());
assertTrue(values.contains("cheese"));
assertTrue(values.contains("123"));
@@ -487,7 +487,7 @@
// retain maps so we can profile that the map doesn't duplicate
// camel keys as they are intern
- List<Map<?, ?>> maps = new ArrayList<Map<?, ?>>();
+ List<Map> maps = new ArrayList<Map>();
for (int i = 0; i < 10000; i++) {
Map<String, Object> copy = new CaseInsensitiveMap(map);
diff --git a/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java
index e433fba..4e19d69 100644
--- a/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java
@@ -30,14 +30,14 @@
public class CollectionHelperTest extends TestCase {
private String[] names = new String[]{"Claus", "Willem", "Jonathan"};
- private List<String> list = Arrays.asList(names);
+ private List list = Arrays.asList(names);
public void testCollectionAsCommaDelimitedString() {
assertEquals("Claus,Willem,Jonathan", CollectionHelper.collectionAsCommaDelimitedString(names));
assertEquals("Claus,Willem,Jonathan", CollectionHelper.collectionAsCommaDelimitedString(list));
assertEquals("", CollectionHelper.collectionAsCommaDelimitedString((String[]) null));
- assertEquals("", CollectionHelper.collectionAsCommaDelimitedString((Collection<?>) null));
+ assertEquals("", CollectionHelper.collectionAsCommaDelimitedString((Collection) null));
assertEquals("Claus", CollectionHelper.collectionAsCommaDelimitedString(new String[]{"Claus"}));
}
@@ -54,7 +54,7 @@
}
public void testAppendValue() {
- Map<String, Object> map = new HashMap<String, Object>();
+ Map map = new HashMap();
CollectionHelper.appendValue(map, "foo", 123);
assertEquals(1, map.size());
@@ -64,7 +64,7 @@
CollectionHelper.appendValue(map, "bar", 789);
assertEquals(2, map.size());
- List<?> values = (List<?>) map.get("foo");
+ List values = (List) map.get("foo");
assertEquals(2, values.size());
assertEquals(123, values.get(0));
assertEquals(456, values.get(1));
diff --git a/camel-core/src/test/java/org/apache/camel/util/ExchangeHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/ExchangeHelperTest.java
index 5a2d4d8..0a74920 100644
--- a/camel-core/src/test/java/org/apache/camel/util/ExchangeHelperTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/ExchangeHelperTest.java
@@ -53,7 +53,7 @@
public void testPropertyOfIncompatibleType() throws Exception {
try {
- List<?> value = ExchangeHelper.getMandatoryProperty(exchange, "foo", List.class);
+ List value = ExchangeHelper.getMandatoryProperty(exchange, "foo", List.class);
fail("Should have failed but got: " + value);
} catch (NoSuchPropertyException e) {
assertEquals("foo", e.getPropertyName());
@@ -72,7 +72,7 @@
public void testHeaderOfIncompatibleType() throws Exception {
exchange.getIn().setHeader("foo", 123);
try {
- List<?> value = ExchangeHelper.getMandatoryHeader(exchange, "foo", List.class);
+ List value = ExchangeHelper.getMandatoryHeader(exchange, "foo", List.class);
fail("Should have failed but got: " + value);
} catch (NoSuchHeaderException e) {
assertEquals("foo", e.getHeaderName());
@@ -135,7 +135,7 @@
exchange.getOut().setBody("bar");
exchange.getOut().setHeader("quote", "Camel rocks");
- Map<?, ?> map = ExchangeHelper.createVariableMap(exchange);
+ Map map = ExchangeHelper.createVariableMap(exchange);
assertEquals(8, map.size());
assertSame(exchange, map.get("exchange"));
@@ -154,7 +154,7 @@
exchange.getIn().setHeader("quote", "Camel rocks");
assertFalse(exchange.hasOut());
- Map<?, ?> map = ExchangeHelper.createVariableMap(exchange);
+ Map map = ExchangeHelper.createVariableMap(exchange);
// there should still be 8 in the map
assertEquals(8, map.size());
diff --git a/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java b/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java
index f51ee5b..3728b0f 100644
--- a/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java
@@ -113,7 +113,7 @@
}
public void testHasProperties() throws Exception {
- Map<String, Object> empty = Collections.emptyMap();
+ Map<String, Object> empty = CastUtils.cast(Collections.emptyMap());
assertFalse(IntrospectionSupport.hasProperties(empty, null));
assertFalse(IntrospectionSupport.hasProperties(empty, ""));
assertFalse(IntrospectionSupport.hasProperties(empty, "foo."));
@@ -159,7 +159,7 @@
bean.setDate(date);
bean.setGoldCustomer(true);
bean.setLittle(true);
- Collection<?> children = new ArrayList<Object>();
+ Collection children = new ArrayList();
bean.setChildren(children);
Map<String, Object> map = new HashMap<String, Object>();
@@ -220,7 +220,7 @@
bean.setDate(date);
bean.setGoldCustomer(true);
bean.setLittle(true);
- Collection<?> children = new ArrayList<Object>();
+ Collection children = new ArrayList();
bean.setChildren(children);
Object name = IntrospectionSupport.getProperty(bean, "name");
diff --git a/camel-core/src/test/java/org/apache/camel/util/KeyValueHolderTest.java b/camel-core/src/test/java/org/apache/camel/util/KeyValueHolderTest.java
index 2efc7e9..d1ce3e9 100644
--- a/camel-core/src/test/java/org/apache/camel/util/KeyValueHolderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/KeyValueHolderTest.java
@@ -23,19 +23,20 @@
*/
public class KeyValueHolderTest extends TestCase {
+ @SuppressWarnings("unchecked")
public void testKeyValueHolder() {
- KeyValueHolder<String, Integer> foo = new KeyValueHolder<String, Integer>("foo", 123);
+ KeyValueHolder foo = new KeyValueHolder("foo", 123);
assertEquals("foo", foo.getKey());
- assertEquals(123, foo.getValue().intValue());
+ assertEquals(123, foo.getValue());
- KeyValueHolder<String, Integer> bar = new KeyValueHolder<String, Integer>("bar", 456);
+ KeyValueHolder bar = new KeyValueHolder("bar", 456);
assertFalse("Should not be equals", foo.equals(bar));
assertNotSame(foo.hashCode(), bar.hashCode());
- KeyValueHolder<String, Integer> bar2 = new KeyValueHolder<String, Integer>("bar", 456);
+ KeyValueHolder bar2 = new KeyValueHolder("bar", 456);
assertTrue("Should be equals", bar.equals(bar2));
assertEquals("foo -> 123", foo.toString());
diff --git a/camel-core/src/test/java/org/apache/camel/util/OrderedComparatorTest.java b/camel-core/src/test/java/org/apache/camel/util/OrderedComparatorTest.java
index 6664224..bac8445 100644
--- a/camel-core/src/test/java/org/apache/camel/util/OrderedComparatorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/OrderedComparatorTest.java
@@ -29,6 +29,7 @@
*/
public class OrderedComparatorTest extends TestCase {
+ @SuppressWarnings("unchecked")
public void testOrderedComparator() throws Exception {
List<Ordered> answer = new ArrayList<Ordered>();
answer.add(new MyOrder(0));
@@ -46,6 +47,7 @@
assertEquals(5, answer.get(4).getOrder());
}
+ @SuppressWarnings("unchecked")
public void testOrderedComparatorReverse() throws Exception {
List<Ordered> answer = new ArrayList<Ordered>();
answer.add(new MyOrder(0));
@@ -63,6 +65,7 @@
assertEquals(0, answer.get(4).getOrder());
}
+ @SuppressWarnings("unchecked")
public void testOrderedComparatorHigh() throws Exception {
List<Ordered> answer = new ArrayList<Ordered>();
answer.add(new MyOrder(0));
@@ -82,6 +85,7 @@
assertEquals(200, answer.get(5).getOrder());
}
+ @SuppressWarnings("unchecked")
public void testOrderedComparatorHighReverse() throws Exception {
List<Ordered> answer = new ArrayList<Ordered>();
answer.add(new MyOrder(0));
@@ -101,6 +105,7 @@
assertEquals(Ordered.HIGHEST, answer.get(5).getOrder());
}
+ @SuppressWarnings("unchecked")
public void testOrderedComparatorLow() throws Exception {
List<Ordered> answer = new ArrayList<Ordered>();
answer.add(new MyOrder(0));
@@ -120,6 +125,7 @@
assertEquals(Ordered.LOWEST, answer.get(5).getOrder());
}
+ @SuppressWarnings("unchecked")
public void testOrderedComparatorLowReverse() throws Exception {
List<Ordered> answer = new ArrayList<Ordered>();
answer.add(new MyOrder(0));
diff --git a/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java b/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
index 55c02aa..6e0686b 100644
--- a/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/URISupportTest.java
@@ -103,7 +103,7 @@
public void testCreateRemaingURI() throws Exception {
URI original = new URI("http://camel.apache.org");
- Map<String, Object> param = new HashMap<String, Object>();
+ Map<Object, Object> param = new HashMap<Object, Object>();
param.put("foo", "123");
URI newUri = URISupport.createRemainingURI(original, param);
assertNotNull(newUri);
@@ -151,7 +151,7 @@
String uri = "http://localhost:23271/myapp/mytest?columns=name%2Ctotalsens%2Cupsens&username=apiuser";
// these are the parameters which is tricky to encode
- Map<String, Object> map = new LinkedHashMap<String, Object>();
+ Map<Object, Object> map = new LinkedHashMap<Object, Object>();
map.put("foo", "abc def");
map.put("bar", "123,456");
map.put("name", "S\u00F8ren"); // danish letter
diff --git a/camel-core/src/test/java/org/apache/camel/util/jndi/JndiTest.java b/camel-core/src/test/java/org/apache/camel/util/jndi/JndiTest.java
index eea2884..61f1a5e 100644
--- a/camel-core/src/test/java/org/apache/camel/util/jndi/JndiTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/jndi/JndiTest.java
@@ -32,12 +32,13 @@
public class JndiTest extends TestSupport {
protected Context context;
+ @SuppressWarnings("unchecked")
public static Context createInitialContext() throws Exception {
InputStream in = JndiTest.class.getClassLoader().getResourceAsStream("jndi-example.properties");
assertNotNull("Cannot find jndi-example.properties on the classpath!", in);
Properties properties = new Properties();
properties.load(in);
- return new InitialContext(new Hashtable<Object, Object>(properties));
+ return new InitialContext(new Hashtable(properties));
}
diff --git a/components/camel-ahc/pom.xml b/components/camel-ahc/pom.xml
index c6a3115..932d7e9 100644
--- a/components/camel-ahc/pom.xml
+++ b/components/camel-ahc/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcComponent.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcComponent.java
index 3829a80..1982773 100644
--- a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcComponent.java
+++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/AhcComponent.java
@@ -27,6 +27,7 @@
import org.apache.camel.Endpoint;
import org.apache.camel.impl.HeaderFilterStrategyComponent;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.URISupport;
import org.apache.camel.util.jsse.SSLContextParameters;
@@ -89,7 +90,7 @@
}
// restructure uri to be based on the parameters left as we don't want to include the Camel internal options
- URI httpUri = URISupport.createRemainingURI(new URI(addressUri), parameters);
+ URI httpUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(parameters));
endpoint.setHttpUri(httpUri);
return endpoint;
diff --git a/components/camel-amqp/pom.xml b/components/camel-amqp/pom.xml
index 669d89c..237c790 100644
--- a/components/camel-amqp/pom.xml
+++ b/components/camel-amqp/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-apns/pom.xml b/components/camel-apns/pom.xml
index e0c7473..e75e63d 100644
--- a/components/camel-apns/pom.xml
+++ b/components/camel-apns/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-apns/src/main/java/org/apache/camel/component/apns/util/ResourceUtils.java b/components/camel-apns/src/main/java/org/apache/camel/component/apns/util/ResourceUtils.java
index dc4ef6c..3421ba2 100644
--- a/components/camel-apns/src/main/java/org/apache/camel/component/apns/util/ResourceUtils.java
+++ b/components/camel-apns/src/main/java/org/apache/camel/component/apns/util/ResourceUtils.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.apns.util;
+import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -24,8 +25,6 @@
import com.notnoop.exceptions.RuntimeIOException;
-import org.apache.camel.util.IOHelper;
-
public final class ResourceUtils {
private static final String CLASSPATH_PREFIX = "classpath:";
@@ -53,7 +52,7 @@
}
} else {
try {
- is = IOHelper.buffered(new FileInputStream(path));
+ is = new BufferedInputStream(new FileInputStream(path));
} catch (FileNotFoundException e) {
throw new RuntimeIOException(e);
}
diff --git a/components/camel-atom/pom.xml b/components/camel-atom/pom.xml
index eda49ec..638579c 100644
--- a/components/camel-atom/pom.xml
+++ b/components/camel-atom/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
index 5296da0..5da082b 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
@@ -22,6 +22,7 @@
import org.apache.camel.Endpoint;
import org.apache.camel.component.feed.FeedComponent;
import org.apache.camel.component.feed.FeedEndpoint;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.URISupport;
/**
@@ -50,7 +51,8 @@
// for the http feed
String feedUri;
if (!parameters.isEmpty()) {
- URI remainingUri = URISupport.createRemainingURI(new URI(remaining), parameters);
+ Map<Object, Object> params = CastUtils.cast(parameters);
+ URI remainingUri = URISupport.createRemainingURI(new URI(remaining), params);
feedUri = remainingUri.toString();
} else {
feedUri = remaining;
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java
index 10d7980..ea13395 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java
@@ -25,6 +25,8 @@
import org.apache.camel.Processor;
import org.apache.camel.component.feed.EntryFilter;
import org.apache.camel.component.feed.FeedEntryPollingConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Consumer to poll atom feeds and return each entry from the feed step by step.
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
index 0bf75c9..d875839 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java
@@ -22,6 +22,8 @@
import org.apache.abdera.model.Feed;
import org.apache.camel.Processor;
import org.apache.camel.component.feed.FeedPollingConsumer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Consumer to poll atom feeds and return the full feed.
diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java
index 475497b..5d2b8ad 100644
--- a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java
+++ b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java
@@ -28,7 +28,6 @@
public abstract class FeedEntryPollingConsumer extends FeedPollingConsumer {
protected int entryIndex;
protected EntryFilter entryFilter;
- @SuppressWarnings("rawtypes")
protected List list;
protected boolean throttleEntries;
protected Object feed;
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java
index 2824a23..3330857 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java
@@ -47,7 +47,7 @@
Feed feed = in.getHeader(AtomConstants.ATOM_FEED, Feed.class);
assertEquals("James Strachan", feed.getAuthor().getName());
- List<?> entries = in.getBody(List.class);
+ List entries = in.getBody(List.class);
assertEquals(7, entries.size());
}
diff --git a/components/camel-avro/pom.xml b/components/camel-avro/pom.xml
deleted file mode 100644
index acbcbab..0000000
--- a/components/camel-avro/pom.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-avro</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Avro</name>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.dataformat.avro*,org.apache.camel.component.avro*</camel.osgi.export.pkg>
- </properties>
-
- <build>
- <plugins>
- <!--plugin>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro-maven-plugin</artifactId>
- <version>${avro-version}</version>
- <executions>
- <execution>
- <id>schemas</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>schema</goal>
- <goal>protocol</goal>
- <goal>idl-protocol</goal>
- </goals>
- <configuration>
- <sourceDirectory>${project.basedir}/src/test/avro/</sourceDirectory>
- <outputDirectory>${project.basedir}/src/test/java/</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin-->
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro-ipc</artifactId>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-juel</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
-</project>
\ No newline at end of file
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroComponent.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroComponent.java
deleted file mode 100644
index 811d1e7..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroComponent.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.lang.reflect.Field;
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.avro.Protocol;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.util.URISupport;
-
-public class AvroComponent extends DefaultComponent {
-
- private AvroConfiguration configuration;
-
- public AvroComponent() {
- }
-
- public AvroComponent(CamelContext context) {
- super(context);
- }
-
-
- /**
- * A factory method allowing derived components to create a new endpoint
- * from the given URI, remaining path and optional parameters
- *
- * @param uri the full URI of the endpoint
- * @param remaining the remaining part of the URI without the query
- * parameters or component prefix
- * @param parameters the optional parameters passed in
- * @return a newly created endpoint or null if the endpoint cannot be
- * created based on the inputs
- */
- @Override
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- AvroConfiguration config;
- if (configuration != null) {
- config = configuration.copy();
- } else {
- config = new AvroConfiguration();
- }
-
- URI enpointUri = new URI(URISupport.normalizeUri(remaining));
- applyToConfiguration(config, enpointUri, parameters);
-
- if (AvroConstants.AVRO_NETTY_TRANSPORT.equals(enpointUri.getScheme())) {
- return new AvroNettyEndpoint(remaining, this, config);
- } else if (AvroConstants.AVRO_HTTP_TRANSPORT.equals(enpointUri.getScheme())) {
- return new AvroHttpEndpoint(remaining, this, config);
- } else {
- throw new IllegalArgumentException("Unknown avro scheme. Should use either netty or http.");
- }
- }
-
- /**
- * Applies enpoint parameters to configuration & resolves protocol and other required configuration properties.
- * @param config
- * @param enpointUri
- * @param parameters
- * @throws Exception
- */
- private void applyToConfiguration(AvroConfiguration config, URI enpointUri, Map<String, Object> parameters) throws Exception {
- config.parseURI(enpointUri, parameters, this);
- setProperties(config, parameters);
-
- if (config.getProtocol() == null && config.getProtocolClassName() != null) {
- Class<?> protocolClass = getCamelContext().getClassResolver().resolveClass(config.getProtocolClassName());
- if (protocolClass != null) {
- Field f = protocolClass.getField("PROTOCOL");
- if (f != null) {
- Protocol protocol = (Protocol) f.get(null);
- config.setProtocol(protocol);
- }
- }
- }
-
- if (config.getProtocol() == null) {
- throw new IllegalArgumentException("Avro configuration does not contain protocol");
- }
- }
-
-
- public AvroConfiguration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(AvroConfiguration configuration) {
- this.configuration = configuration;
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConfiguration.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConfiguration.java
deleted file mode 100644
index 0666f45..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConfiguration.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.avro.Protocol;
-
-import org.apache.camel.RuntimeCamelException;
-
-public class AvroConfiguration implements Cloneable {
-
- private String host;
- private int port;
- private Protocol protocol;
- private String protocolLocation;
- private String protocolClassName;
- private String transport;
-
-
- public AvroConfiguration copy() {
- try {
- AvroConfiguration answer = (AvroConfiguration) clone();
- return answer;
- } catch (CloneNotSupportedException e) {
- throw new RuntimeCamelException(e);
- }
- }
-
- public void parseURI(URI uri, Map<String, Object> parameters, AvroComponent component) throws Exception {
- transport = uri.getScheme();
-
- if ((!transport.equalsIgnoreCase("http")) && (!transport.equalsIgnoreCase("netty"))) {
- throw new IllegalArgumentException("Unrecognized Avro IPC transport: " + protocol + " for uri: " + uri);
- }
-
- setHost(uri.getHost());
- setPort(uri.getPort());
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public Protocol getProtocol() {
- return protocol;
- }
-
- public void setProtocol(Protocol protocol) {
- this.protocol = protocol;
- }
-
- public String getTransport() {
- return transport;
- }
-
- public void setTransport(String transport) {
- this.transport = transport;
- }
-
- public String getProtocolLocation() {
- return protocolLocation;
- }
-
- public void setProtocolLocation(String protocolLocation) {
- this.protocolLocation = protocolLocation;
- }
-
- public String getProtocolClassName() {
- return protocolClassName;
- }
-
- public void setProtocolClassName(String protocolClassName) {
- this.protocolClassName = protocolClassName;
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConstants.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConstants.java
deleted file mode 100644
index abce65e..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-public final class AvroConstants {
-
- public static final transient String AVRO_NETTY_TRANSPORT = "netty";
- public static final transient String AVRO_HTTP_TRANSPORT = "http";
-
- public static final transient String AVRO_MESSAGE_NAME = "CamelAvroMessageName";
-
- private AvroConstants() {
- // Utility class
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConsumer.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConsumer.java
deleted file mode 100644
index 9e75ffa..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroConsumer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.impl.DefaultConsumer;
-
-public abstract class AvroConsumer extends DefaultConsumer {
-
- public AvroConsumer(Endpoint endpoint, Processor processor) {
- super(endpoint, processor);
- }
-
- @Override
- public AvroEndpoint getEndpoint() {
- return (AvroEndpoint) super.getEndpoint();
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroEndpoint.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroEndpoint.java
deleted file mode 100644
index 9a4f756..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroEndpoint.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.avro.Protocol;
-import org.apache.avro.Schema;
-
-import org.apache.camel.Component;
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.impl.DefaultEndpoint;
-
-public abstract class AvroEndpoint extends DefaultEndpoint {
-
- private AvroConfiguration configuration;
-
- /**
- * Constructs a fully-initialized DefaultEndpoint instance. This is the
- * preferred method of constructing an object from Java code (as opposed to
- * Spring beans, etc.).
- *
- * @param endpointUri the full URI used to create this endpoint
- * @param component the component that created this endpoint
- */
- public AvroEndpoint(String endpointUri, Component component, AvroConfiguration configuration) {
- super(endpointUri, component);
- this.configuration = configuration;
- }
-
-
- public Exchange createExchange(Protocol.Message message, Object request) {
- ExchangePattern pattern = ExchangePattern.InOut;
- if (message.getResponse().equals(Schema.Type.NULL)) {
- pattern = ExchangePattern.InOnly;
- }
- Exchange exchange = createExchange(pattern);
- exchange.getIn().setBody(request);
- exchange.getIn().setHeader(AvroConstants.AVRO_MESSAGE_NAME, message.getName());
- return exchange;
- }
-
- /**
- * Whether this class supports being singleton or not.
- *
- * @return <tt>true</tt> to be a single shared instance, <tt>false</tt> to create new instances.
- */
- @Override
- public boolean isSingleton() {
- return false;
- }
-
- public AvroConfiguration getConfiguration() {
- return configuration;
- }
-
- public Protocol getProtocol() {
- return configuration.getProtocol();
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpConsumer.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpConsumer.java
deleted file mode 100644
index 5431699..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpConsumer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.avro.ipc.HttpServer;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-
-public class AvroHttpConsumer extends AvroConsumer {
-
- HttpServer server;
-
- public AvroHttpConsumer(Endpoint endpoint, Processor processor) {
- super(endpoint, processor);
- }
-
- @Override
- protected void doStart() throws Exception {
- AvroConfiguration configuration = getEndpoint().getConfiguration();
- server = new HttpServer(new AvroResponder(this), configuration.getPort());
- server.start();
- }
-
- @Override
- protected void doStop() throws Exception {
- super.doStop();
- if (server != null) {
- server.close();
- }
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpEndpoint.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpEndpoint.java
deleted file mode 100644
index a330c93..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpEndpoint.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.camel.Component;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-
-public class AvroHttpEndpoint extends AvroEndpoint {
-
- /**
- * Constructs a fully-initialized DefaultEndpoint instance. This is the
- * preferred method of constructing an object from Java code (as opposed to
- * Spring beans, etc.).
- *
- * @param endpointUri the full URI used to create this endpoint
- * @param component the component that created this endpoint
- */
- public AvroHttpEndpoint(String endpointUri, Component component, AvroConfiguration configuration) {
- super(endpointUri, component, configuration);
- }
-
- /**
- * Creates a new producer which is used send messages into the endpoint
- *
- * @return a newly created producer
- * @throws Exception can be thrown
- */
- @Override
- public Producer createProducer() throws Exception {
- return new AvroHttpProducer(this);
- }
-
- /**
- * Creates a new <a
- * href="http://camel.apache.org/event-driven-consumer.html">Event
- * Driven Consumer</a> which consumes messages from the endpoint using the
- * given processor
- *
- * @param processor the given processor
- * @return a newly created consumer
- * @throws Exception can be thrown
- */
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- return new AvroHttpConsumer(this, processor);
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpProducer.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpProducer.java
deleted file mode 100644
index b426156..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroHttpProducer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.net.URL;
-
-import org.apache.avro.ipc.HttpTransceiver;
-import org.apache.avro.ipc.Transceiver;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.util.URISupport;
-
-public class AvroHttpProducer extends AvroProducer {
-
- public AvroHttpProducer(Endpoint endpoint) {
- super(endpoint);
- }
-
- @Override
- public Transceiver createTranceiver() throws Exception {
- return new HttpTransceiver(new URL(URISupport.normalizeUri(getEndpoint().getEndpointUri())));
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyConsumer.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyConsumer.java
deleted file mode 100644
index e3a9d9f..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyConsumer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.net.InetSocketAddress;
-
-import org.apache.avro.ipc.NettyServer;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-
-public class AvroNettyConsumer extends AvroConsumer {
-
- NettyServer server;
-
- public AvroNettyConsumer(Endpoint endpoint, Processor processor) {
- super(endpoint, processor);
- }
-
- @Override
- protected void doStart() throws Exception {
- AvroConfiguration configuration = getEndpoint().getConfiguration();
- server = new NettyServer(new AvroResponder(this), new InetSocketAddress(configuration.getHost(), configuration.getPort()));
- server.start();
- }
-
- @Override
- protected void doStop() throws Exception {
- super.doStop();
- if (server != null) {
- server.close();
- }
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyEndpoint.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyEndpoint.java
deleted file mode 100644
index 2153104..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyEndpoint.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.camel.Component;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-
-public class AvroNettyEndpoint extends AvroEndpoint {
-
- /**
- * Constructs a fully-initialized DefaultEndpoint instance. This is the
- * preferred method of constructing an object from Java code (as opposed to
- * Spring beans, etc.).
- *
- * @param endpointUri the full URI used to create this endpoint
- * @param component the component that created this endpoint
- */
- public AvroNettyEndpoint(String endpointUri, Component component, AvroConfiguration configuration) {
- super(endpointUri, component, configuration);
- }
-
- /**
- * Creates a new producer which is used send messages into the endpoint
- *
- * @return a newly created producer
- * @throws Exception can be thrown
- */
- @Override
- public Producer createProducer() throws Exception {
- return new AvroNettyProducer(this);
- }
-
- /**
- * Creates a new <a
- * href="http://camel.apache.org/event-driven-consumer.html">Event
- * Driven Consumer</a> which consumes messages from the endpoint using the
- * given processor
- *
- * @param processor the given processor
- * @return a newly created consumer
- * @throws Exception can be thrown
- */
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- return new AvroNettyConsumer(this, processor);
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyProducer.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyProducer.java
deleted file mode 100644
index 4e930db..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroNettyProducer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.net.InetSocketAddress;
-
-import org.apache.avro.ipc.NettyTransceiver;
-import org.apache.avro.ipc.Transceiver;
-
-import org.apache.camel.Endpoint;
-
-public class AvroNettyProducer extends AvroProducer {
-
- public AvroNettyProducer(Endpoint endpoint) {
- super(endpoint);
- }
-
- @Override
- public Transceiver createTranceiver() throws Exception {
- AvroConfiguration configuration = getEndpoint().getConfiguration();
- return transceiver = new NettyTransceiver(new InetSocketAddress(configuration.getHost(), configuration.getPort()));
- }
-
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroProducer.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroProducer.java
deleted file mode 100644
index 3904ff3..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroProducer.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.avro.ipc.Callback;
-import org.apache.avro.ipc.Requestor;
-import org.apache.avro.ipc.Transceiver;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.ServicePoolAware;
-import org.apache.camel.impl.DefaultProducer;
-
-public abstract class AvroProducer extends DefaultProducer implements ServicePoolAware {
-
- Transceiver transceiver;
- Requestor requestor;
-
- public AvroProducer(Endpoint endpoint) {
- super(endpoint);
- }
-
- public abstract Transceiver createTranceiver() throws Exception;
-
- /**
- * Processes the message exchange
- *
- * @param exchange the message exchange
- * @throws Exception if an internal processing error has occurred.
- */
- @Override
- public void process(final Exchange exchange) throws Exception {
- Object request = exchange.getIn().getBody();
-
- if (transceiver == null) {
- transceiver = createTranceiver();
- requestor = new AvroRequestor(getEndpoint().getProtocol(), transceiver);
- }
-
- requestor.request(exchange.getIn().getHeader(AvroConstants.AVRO_MESSAGE_NAME, String.class), wrapObjectToArray(request), new Callback<Object>() {
-
- @Override
- public void handleResult(Object result) {
- exchange.getOut().setBody(result);
- }
-
- @Override
- public void handleError(Throwable error) {
- exchange.setException(error);
- }
- });
- }
-
- public Object[] wrapObjectToArray(Object object) {
- if (object instanceof Object[]) {
- return (Object[]) object;
- } else {
- Object[] wrapper = new Object[1];
- wrapper[0] = object;
- return wrapper;
- }
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
- }
-
- @Override
- protected void doStop() throws Exception {
- super.doStop();
- if (transceiver != null) {
- transceiver.close();
- }
- }
-
- @Override
- public AvroEndpoint getEndpoint() {
- return (AvroEndpoint) super.getEndpoint();
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroRequestor.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroRequestor.java
deleted file mode 100644
index 8e6c618..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroRequestor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.io.IOException;
-
-import org.apache.avro.Protocol;
-import org.apache.avro.ipc.Transceiver;
-import org.apache.avro.ipc.specific.SpecificRequestor;
-
-public class AvroRequestor extends SpecificRequestor {
-
- public AvroRequestor(Protocol protocol, Transceiver transceiver) throws IOException {
- super(protocol, transceiver);
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroResponder.java b/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroResponder.java
deleted file mode 100644
index a1ae598..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/component/avro/AvroResponder.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.avro.Protocol;
-import org.apache.avro.Schema;
-import org.apache.avro.generic.GenericRecord;
-import org.apache.avro.ipc.specific.SpecificResponder;
-import org.apache.avro.specific.SpecificData;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.util.ExchangeHelper;
-
-public class AvroResponder extends SpecificResponder {
-
- private AvroConsumer consumer;
-
- /**
- * Constructor
- *
- * @param consumer
- */
- public AvroResponder(AvroConsumer consumer) {
- super(consumer.getEndpoint().getProtocol(), null);
- this.consumer = consumer;
- }
-
- @Override
- public Object respond(Protocol.Message message, Object request) throws Exception {
- Object response = null;
- int numParams = message.getRequest().getFields().size();
- Object[] params = new Object[numParams];
- Class<?>[] paramTypes = new Class[numParams];
- int i = 0;
- for (Schema.Field param : message.getRequest().getFields()) {
- params[i] = ((GenericRecord) request).get(param.name());
- paramTypes[i] = SpecificData.get().getClass(param.schema());
- i++;
- }
- Exchange exchange = consumer.getEndpoint().createExchange(message, params);
-
- try {
- consumer.getProcessor().process(exchange);
- } catch (Throwable e) {
- consumer.getExceptionHandler().handleException(e);
- }
-
- if (ExchangeHelper.isOutCapable(exchange)) {
- response = exchange.getOut().getBody();
- } else {
- response = null;
- }
-
- boolean failed = exchange.isFailed();
- if (failed) {
- if (exchange.getException() != null) {
- response = exchange.getException();
- } else {
- // failed and no exception, must be a fault
- response = exchange.getOut().getBody();
- }
- }
- return response;
-
- }
-}
diff --git a/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java b/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
deleted file mode 100644
index cf3ee60..0000000
--- a/components/camel-avro/src/main/java/org/apache/camel/dataformat/avro/AvroDataFormat.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.dataformat.avro;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Method;
-
-import org.apache.avro.Schema;
-import org.apache.avro.generic.GenericContainer;
-import org.apache.avro.generic.GenericRecord;
-import org.apache.avro.io.DatumReader;
-import org.apache.avro.io.DatumWriter;
-import org.apache.avro.io.Decoder;
-import org.apache.avro.io.DecoderFactory;
-import org.apache.avro.io.Encoder;
-import org.apache.avro.io.EncoderFactory;
-import org.apache.avro.specific.SpecificDatumReader;
-import org.apache.avro.specific.SpecificDatumWriter;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelException;
-import org.apache.camel.Exchange;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.util.ObjectHelper;
-
-public class AvroDataFormat implements DataFormat {
-
- private Schema schema;
- private String instanceClassName;
-
- /**
- * @param schema
- */
- public AvroDataFormat(Schema schema) {
- this.schema = schema;
- }
-
- public AvroDataFormat() {
- }
-
- public synchronized Schema getSchema(Exchange exchange, Object graph) throws Exception {
- if (schema == null) {
- if (instanceClassName != null) {
- return loadDefaultSchema(instanceClassName, exchange.getContext());
- }
- if (graph != null && graph instanceof GenericContainer) {
- return loadDefaultSchema(graph.getClass().getName(), exchange.getContext());
- } else {
- throw new CamelException("There is not schema for avro marshaling / unmarshaling");
- }
- }
- return schema;
- }
-
- public void setSchema(Object schema) {
- if (schema instanceof Schema) {
- this.schema = (Schema) schema;
- } else {
- throw new IllegalArgumentException("The argument for setDefaultInstance should be subClass of " + Schema.class.getName());
- }
- }
-
- public void setInstanceClass(String className) throws Exception {
- ObjectHelper.notNull(className, "AvroDataFormat messageClass");
- instanceClassName = className;
- }
-
- protected Schema loadDefaultSchema(String className, CamelContext context) throws CamelException, ClassNotFoundException {
- Class<?> instanceClass = context.getClassResolver().resolveMandatoryClass(className);
- if (GenericContainer.class.isAssignableFrom(instanceClass)) {
- try {
- Method method = instanceClass.getMethod("getSchema", new Class[0]);
- return (Schema) method.invoke(instanceClass.newInstance(), new Object[0]);
- } catch (Exception ex) {
- throw new CamelException("Can't set the defaultInstance of AvroDataFormat with "
- + className + ", caused by " + ex);
- }
- } else {
- throw new CamelException("Can't set the shcema of AvroDataFormat with "
- + className + ", as the class is not a subClass of SpecificData");
- }
- }
-
- public void marshal(Exchange exchange, Object graph, OutputStream outputStream) throws Exception {
- DatumWriter<Object> datum = new SpecificDatumWriter<Object>(getSchema(exchange, graph));
- Encoder encoder = EncoderFactory.get().binaryEncoder(outputStream, null);
- datum.write(graph, encoder);
- encoder.flush();
- }
-
- public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
- DatumReader<GenericRecord> reader = new SpecificDatumReader<GenericRecord>(getSchema(exchange, null));
- Decoder decoder = DecoderFactory.get().binaryDecoder(inputStream, null);
- Object result = reader.read(null, decoder);
- return result;
- }
-
-}
diff --git a/components/camel-avro/src/main/resources/META-INF/LICENSE.txt b/components/camel-avro/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/components/camel-avro/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-avro/src/main/resources/META-INF/NOTICE.txt b/components/camel-avro/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-avro/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-avro/src/main/resources/META-INF/services/org/apache/camel/component/avro b/components/camel-avro/src/main/resources/META-INF/services/org/apache/camel/component/avro
deleted file mode 100644
index b4e1935..0000000
--- a/components/camel-avro/src/main/resources/META-INF/services/org/apache/camel/component/avro
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# 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.
-#
-class=org.apache.camel.component.avro.AvroComponent
diff --git a/components/camel-avro/src/main/resources/META-INF/services/org/apache/camel/dataformat/avro b/components/camel-avro/src/main/resources/META-INF/services/org/apache/camel/dataformat/avro
deleted file mode 100644
index 7b19e8d..0000000
--- a/components/camel-avro/src/main/resources/META-INF/services/org/apache/camel/dataformat/avro
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.dataformat.avro.AvroDataFormat
diff --git a/components/camel-avro/src/test/avro/test.avpr b/components/camel-avro/src/test/avro/test.avpr
deleted file mode 100644
index 920d21c..0000000
--- a/components/camel-avro/src/test/avro/test.avpr
+++ /dev/null
@@ -1,27 +0,0 @@
-{"namespace": "org.apache.camel.avro.generated",
- "protocol": "KeyValueProtocol",
-
- "types": [
- {"name": "Key", "type": "record",
- "fields": [
- {"name": "key", "type": "string"}
- ]
- },
- {"name": "Value", "type": "record",
- "fields": [
- {"name": "value", "type": "string"}
- ]
- }
- ],
-
- "messages": {
- "put": {
- "request": [{"name": "key", "type": "Key"}, {"name": "value", "type": "Value"} ],
- "response": "null"
- },
- "get": {
- "request": [{"name": "key", "type": "Key"}],
- "response": "Value"
- }
- }
-}
\ No newline at end of file
diff --git a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java
deleted file mode 100644
index d6575b2..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * 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.
- */
-// CHECKSTYLE:OFF
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-package org.apache.camel.avro.generated;
-@SuppressWarnings("all")
-public class Key extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"Key\",\"namespace\":\"org.apache.camel.avro.generated\",\"fields\":[{\"name\":\"key\",\"type\":\"string\"}]}");
- @Deprecated public java.lang.CharSequence key;
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return key;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: key = (java.lang.CharSequence)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'key' field.
- */
- public java.lang.CharSequence getKey() {
- return key;
- }
-
- /**
- * Sets the value of the 'key' field.
- * @param value the value to set.
- */
- public void setKey(java.lang.CharSequence value) {
- this.key = value;
- }
-
- /** Creates a new Key RecordBuilder */
- public static org.apache.camel.avro.generated.Key.Builder newBuilder() {
- return new org.apache.camel.avro.generated.Key.Builder();
- }
-
- /** Creates a new Key RecordBuilder by copying an existing Builder */
- public static org.apache.camel.avro.generated.Key.Builder newBuilder(org.apache.camel.avro.generated.Key.Builder other) {
- return new org.apache.camel.avro.generated.Key.Builder(other);
- }
-
- /** Creates a new Key RecordBuilder by copying an existing Key instance */
- public static org.apache.camel.avro.generated.Key.Builder newBuilder(org.apache.camel.avro.generated.Key other) {
- return new org.apache.camel.avro.generated.Key.Builder(other);
- }
-
- /**
- * RecordBuilder for Key instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Key>
- implements org.apache.avro.data.RecordBuilder<Key> {
-
- private java.lang.CharSequence key;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.camel.avro.generated.Key.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(org.apache.camel.avro.generated.Key.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing Key instance */
- private Builder(org.apache.camel.avro.generated.Key other) {
- super(org.apache.camel.avro.generated.Key.SCHEMA$);
- if (isValidValue(fields()[0], other.key)) {
- this.key = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.key);
- fieldSetFlags()[0] = true;
- }
- }
-
- /** Gets the value of the 'key' field */
- public java.lang.CharSequence getKey() {
- return key;
- }
-
- /** Sets the value of the 'key' field */
- public org.apache.camel.avro.generated.Key.Builder setKey(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.key = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'key' field has been set */
- public boolean hasKey() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'key' field */
- public org.apache.camel.avro.generated.Key.Builder clearKey() {
- key = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- @Override
- public Key build() {
- try {
- Key record = new Key();
- record.key = fieldSetFlags()[0] ? this.key : (java.lang.CharSequence) defaultValue(fields()[0]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/KeyValueProtocol.java b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/KeyValueProtocol.java
deleted file mode 100644
index a5ddb1c..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/KeyValueProtocol.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.
- */
-// CHECKSTYLE:OFF
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-package org.apache.camel.avro.generated;
-
-@SuppressWarnings("all")
-public interface KeyValueProtocol {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.avro.Protocol.parse("{\"protocol\":\"KeyValueProtocol\",\"namespace\":\"org.apache.camel.avro.generated\",\"types\":[{\"type\":\"record\",\"name\":\"Key\",\"fields\":[{\"name\":\"key\",\"type\":\"string\"}]},{\"type\":\"record\",\"name\":\"Value\",\"fields\":[{\"name\":\"value\",\"type\":\"string\"}]}],\"messages\":{\"put\":{\"request\":[{\"name\":\"key\",\"type\":\"Key\"},{\"name\":\"value\",\"type\":\"Value\"}],\"response\":\"null\"},\"get\":{\"request\":[{\"name\":\"key\",\"type\":\"Key\"}],\"response\":\"Value\"}}}");
- java.lang.Void put(org.apache.camel.avro.generated.Key key, org.apache.camel.avro.generated.Value value) throws org.apache.avro.AvroRemoteException;
- org.apache.camel.avro.generated.Value get(org.apache.camel.avro.generated.Key key) throws org.apache.avro.AvroRemoteException;
-
- @SuppressWarnings("all")
- public interface Callback extends KeyValueProtocol {
- public static final org.apache.avro.Protocol PROTOCOL = org.apache.camel.avro.generated.KeyValueProtocol.PROTOCOL;
- void put(org.apache.camel.avro.generated.Key key, org.apache.camel.avro.generated.Value value, org.apache.avro.ipc.Callback<java.lang.Void> callback) throws java.io.IOException;
- void get(org.apache.camel.avro.generated.Key key, org.apache.avro.ipc.Callback<org.apache.camel.avro.generated.Value> callback) throws java.io.IOException;
- }
-}
\ No newline at end of file
diff --git a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java
deleted file mode 100644
index d61e442..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * 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.
- */
-// CHECKSTYLE:OFF
-/**
- * Autogenerated by Avro
- *
- * DO NOT EDIT DIRECTLY
- */
-package org.apache.camel.avro.generated;
-@SuppressWarnings("all")
-public class Value extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
- public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"Value\",\"namespace\":\"org.apache.camel.avro.generated\",\"fields\":[{\"name\":\"value\",\"type\":\"string\"}]}");
- @Deprecated public java.lang.CharSequence value;
- public org.apache.avro.Schema getSchema() { return SCHEMA$; }
- // Used by DatumWriter. Applications should not call.
- public java.lang.Object get(int field$) {
- switch (field$) {
- case 0: return value;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
- // Used by DatumReader. Applications should not call.
- @SuppressWarnings(value="unchecked")
- public void put(int field$, java.lang.Object value$) {
- switch (field$) {
- case 0: value = (java.lang.CharSequence)value$; break;
- default: throw new org.apache.avro.AvroRuntimeException("Bad index");
- }
- }
-
- /**
- * Gets the value of the 'value' field.
- */
- public java.lang.CharSequence getValue() {
- return value;
- }
-
- /**
- * Sets the value of the 'value' field.
- * @param value the value to set.
- */
- public void setValue(java.lang.CharSequence value) {
- this.value = value;
- }
-
- /** Creates a new Value RecordBuilder */
- public static org.apache.camel.avro.generated.Value.Builder newBuilder() {
- return new org.apache.camel.avro.generated.Value.Builder();
- }
-
- /** Creates a new Value RecordBuilder by copying an existing Builder */
- public static org.apache.camel.avro.generated.Value.Builder newBuilder(org.apache.camel.avro.generated.Value.Builder other) {
- return new org.apache.camel.avro.generated.Value.Builder(other);
- }
-
- /** Creates a new Value RecordBuilder by copying an existing Value instance */
- public static org.apache.camel.avro.generated.Value.Builder newBuilder(org.apache.camel.avro.generated.Value other) {
- return new org.apache.camel.avro.generated.Value.Builder(other);
- }
-
- /**
- * RecordBuilder for Value instances.
- */
- public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Value>
- implements org.apache.avro.data.RecordBuilder<Value> {
-
- private java.lang.CharSequence value;
-
- /** Creates a new Builder */
- private Builder() {
- super(org.apache.camel.avro.generated.Value.SCHEMA$);
- }
-
- /** Creates a Builder by copying an existing Builder */
- private Builder(org.apache.camel.avro.generated.Value.Builder other) {
- super(other);
- }
-
- /** Creates a Builder by copying an existing Value instance */
- private Builder(org.apache.camel.avro.generated.Value other) {
- super(org.apache.camel.avro.generated.Value.SCHEMA$);
- if (isValidValue(fields()[0], other.value)) {
- this.value = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.value);
- fieldSetFlags()[0] = true;
- }
- }
-
- /** Gets the value of the 'value' field */
- public java.lang.CharSequence getValue() {
- return value;
- }
-
- /** Sets the value of the 'value' field */
- public org.apache.camel.avro.generated.Value.Builder setValue(java.lang.CharSequence value) {
- validate(fields()[0], value);
- this.value = value;
- fieldSetFlags()[0] = true;
- return this;
- }
-
- /** Checks whether the 'value' field has been set */
- public boolean hasValue() {
- return fieldSetFlags()[0];
- }
-
- /** Clears the value of the 'value' field */
- public org.apache.camel.avro.generated.Value.Builder clearValue() {
- value = null;
- fieldSetFlags()[0] = false;
- return this;
- }
-
- @Override
- public Value build() {
- try {
- Value record = new Value();
- record.value = fieldSetFlags()[0] ? this.value : (java.lang.CharSequence) defaultValue(fields()[0]);
- return record;
- } catch (Exception e) {
- throw new org.apache.avro.AvroRuntimeException(e);
- }
- }
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/avro/impl/KeyValueProtocolImpl.java b/components/camel-avro/src/test/java/org/apache/camel/avro/impl/KeyValueProtocolImpl.java
deleted file mode 100644
index 024bcc9..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/avro/impl/KeyValueProtocolImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.avro.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avro.AvroRemoteException;
-
-import org.apache.camel.avro.generated.Key;
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.avro.generated.Value;
-
-public class KeyValueProtocolImpl implements KeyValueProtocol {
-
- private Map<Key, Value> store = new HashMap<Key, Value>();
-
- @Override
- public Void put(Key key, Value value) throws AvroRemoteException {
- store.put(key, value);
- return null;
- }
-
- @Override
- public Value get(Key key) throws AvroRemoteException {
- return store.get(key);
- }
-
- public Map<Key, Value> getStore() {
- return store;
- }
-
- public void setStore(Map<Key, Value> store) {
- this.store = store;
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroConsumerTestSupport.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroConsumerTestSupport.java
deleted file mode 100644
index a8d6454..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroConsumerTestSupport.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.io.IOException;
-import junit.framework.Assert;
-
-import org.apache.avro.Protocol;
-import org.apache.avro.ipc.Requestor;
-import org.apache.avro.ipc.Transceiver;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.avro.generated.Key;
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.avro.generated.Value;
-import org.apache.camel.avro.impl.KeyValueProtocolImpl;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public abstract class AvroConsumerTestSupport extends AvroTestSupport {
-
- Transceiver transceiver;
- Requestor requestor;
- KeyValueProtocolImpl keyValue = new KeyValueProtocolImpl();
-
- protected abstract void initializeTranceiver() throws IOException;
-
- @Before
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @After
- protected void tearDown() throws Exception {
- super.tearDown();
- if (transceiver != null) {
- transceiver.close();
- }
- }
-
-
- @Test
- public void testInOnly() throws Exception {
- initializeTranceiver();
- Key key = Key.newBuilder().setKey("1").build();
- Value value = Value.newBuilder().setValue("test value").build();
- Object[] request = {key, value};
- requestor.request("put", request);
- }
-
-
- @Test
- public void testInOut() throws Exception {
- initializeTranceiver();
- keyValue.getStore().clear();
- Key key = Key.newBuilder().setKey("2").build();
- Value value = Value.newBuilder().setValue("test value").build();
- keyValue.getStore().put(key, value);
- Object[] request = {key};
- Object response = requestor.request("get", request);
- Assert.assertEquals(value, response);
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- CamelContext context = super.createCamelContext();
- Protocol protocol = KeyValueProtocol.PROTOCOL;
- AvroConfiguration configuration = new AvroConfiguration();
- configuration.setProtocol(protocol);
- AvroComponent component = new AvroComponent(context);
- component.setConfiguration(configuration);
- context.addComponent("avro", component);
- return context;
- }
-}
\ No newline at end of file
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerTest.java
deleted file mode 100644
index 4dc1a78..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.avro.ipc.HttpTransceiver;
-import org.apache.avro.ipc.specific.SpecificRequestor;
-
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.avro.processors.GetProcessor;
-import org.apache.camel.component.avro.processors.PutProcessor;
-
-public class AvroHttpConsumerTest extends AvroConsumerTestSupport {
-
- static int avroPort = setupFreePort("avroport");
-
- @Override
- protected void initializeTranceiver() throws IOException {
- transceiver = new HttpTransceiver(new URL("http://localhost:" + avroPort));
- requestor = new SpecificRequestor(KeyValueProtocol.class, transceiver);
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- //In Only
- from("avro:http:localhost:" + avroPort).choice()
- .when().el("${in.headers." + AvroConstants.AVRO_MESSAGE_NAME + " == 'put'}").process(new PutProcessor(keyValue))
- .when().el("${in.headers." + AvroConstants.AVRO_MESSAGE_NAME + " == 'get'}").process(new GetProcessor(keyValue));
- }
- };
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java
deleted file mode 100644
index 651d4e7..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpProducerTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.io.IOException;
-
-import org.apache.avro.ipc.HttpServer;
-import org.apache.avro.ipc.specific.SpecificResponder;
-
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.builder.RouteBuilder;
-
-public class AvroHttpProducerTest extends AvroProducerTestSupport {
-
- static int avroPort = setupFreePort("avroport");
-
- @Override
- protected void initializeServer() throws IOException {
- if (server == null) {
- server = new HttpServer(new SpecificResponder(KeyValueProtocol.PROTOCOL, keyValue), avroPort);
- server.start();
- }
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- //In Only
- from("direct:in").to("avro:http:localhost:" + avroPort);
-
- //InOut
- from("direct:inout").to("avro:http:localhost:" + avroPort).to("mock:result-inout");
- }
- };
- }
-
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
deleted file mode 100644
index d8c0721..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spring.SpringCamelContext;
-
-import org.junit.After;
-import org.junit.Before;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class AvroHttpSpringProducerTest extends AvroHttpProducerTest {
-
- private AbstractApplicationContext applicationContext;
-
- @Override
- @Before
- public void setUp() throws Exception {
- initializeServer();
- applicationContext = createApplicationContext();
- super.setUp();
- }
-
- @Override
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- if (applicationContext != null) {
- applicationContext.destroy();
- }
- }
-
- public AbstractApplicationContext createApplicationContext() throws Exception {
- return new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-http-producer.xml");
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- public boolean isUseRouteBuilder() {
- return false;
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java
deleted file mode 100644
index e8405b7..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyConsumerTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
-import org.apache.avro.ipc.NettyTransceiver;
-import org.apache.avro.ipc.specific.SpecificRequestor;
-
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.avro.processors.GetProcessor;
-import org.apache.camel.component.avro.processors.PutProcessor;
-
-public class AvroNettyConsumerTest extends AvroConsumerTestSupport {
-
- static int avroPort = setupFreePort("avroport");
-
- @Override
- protected void initializeTranceiver() throws IOException {
- transceiver = new NettyTransceiver(new InetSocketAddress("localhost", avroPort));
- requestor = new SpecificRequestor(KeyValueProtocol.class, transceiver);
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- //In Only
- from("avro:netty:localhost:" + avroPort).choice()
- .when().el("${in.headers." + AvroConstants.AVRO_MESSAGE_NAME + " == 'put'}").process(new PutProcessor(keyValue))
- .when().el("${in.headers." + AvroConstants.AVRO_MESSAGE_NAME + " == 'get'}").process(new GetProcessor(keyValue));
- }
- };
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java
deleted file mode 100644
index b8d7ebd..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettyProducerTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.net.InetSocketAddress;
-
-import org.apache.avro.ipc.NettyServer;
-import org.apache.avro.ipc.specific.SpecificResponder;
-
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.builder.RouteBuilder;
-
-import org.junit.After;
-
-public class AvroNettyProducerTest extends AvroProducerTestSupport {
-
- static int avroPort = setupFreePort("avroport");
-
- @After
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- //In Only
- from("direct:in").to("avro:netty:localhost:" + avroPort);
-
- //InOut
- from("direct:inout").to("avro:netty:localhost:" + avroPort).to("mock:result-inout");
- }
- };
- }
-
- @Override
- protected void initializeServer() {
- if (server == null) {
- server = new NettyServer(new SpecificResponder(KeyValueProtocol.PROTOCOL, keyValue), new InetSocketAddress("localhost", avroPort));
- server.start();
- }
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
deleted file mode 100644
index bd760e8..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.camel.avro.impl.KeyValueProtocolImpl;
-import org.apache.camel.spring.SpringCamelContext;
-
-import org.junit.After;
-import org.junit.Before;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class AvroNettySpringConsumerTest extends AvroNettyConsumerTest {
-
- private AbstractApplicationContext applicationContext;
-
- @Override
- @Before
- public void setUp() throws Exception {
- applicationContext = createApplicationContext();
- context = SpringCamelContext.springCamelContext(applicationContext);
- keyValue = (KeyValueProtocolImpl) applicationContext.getBean("keyValue");
- super.setUp();
- }
-
- @Override
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- if (applicationContext != null) {
- applicationContext.destroy();
- }
- }
-
- public AbstractApplicationContext createApplicationContext() throws Exception {
- return new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-netty-consumer.xml");
- }
-
- @Override
- public boolean isUseRouteBuilder() {
- return false;
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
deleted file mode 100644
index c543cc7..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spring.SpringCamelContext;
-
-import org.junit.After;
-import org.junit.Before;
-
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class AvroNettySpringProducerTest extends AvroNettyProducerTest {
-
- private AbstractApplicationContext applicationContext;
-
- @Override
- @Before
- public void setUp() throws Exception {
- initializeServer();
- applicationContext = createApplicationContext();
- super.setUp();
- }
-
- @Override
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- if (applicationContext != null) {
- applicationContext.destroy();
- }
- }
-
- public AbstractApplicationContext createApplicationContext() throws Exception {
- return new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-netty-producer.xml");
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- public boolean isUseRouteBuilder() {
- return false;
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java
deleted file mode 100644
index 7f21494..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroProducerTestSupport.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.avro;
-
-import java.io.IOException;
-
-import junit.framework.Assert;
-
-import org.apache.avro.Protocol;
-import org.apache.avro.ipc.Server;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.avro.generated.Key;
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.avro.generated.Value;
-import org.apache.camel.avro.impl.KeyValueProtocolImpl;
-import org.apache.camel.component.mock.MockEndpoint;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public abstract class AvroProducerTestSupport extends AvroTestSupport {
-
- Server server;
- KeyValueProtocolImpl keyValue = new KeyValueProtocolImpl();
-
- protected abstract void initializeServer() throws IOException;
-
- @Before
- protected void setUp() throws Exception {
- initializeServer();
- super.setUp();
- }
-
- @After
- protected void tearDown() throws Exception {
- super.tearDown();
- if (server != null) {
- server.close();
- }
- }
-
- @Test
- public void testInOnly() throws InterruptedException {
- Key key = Key.newBuilder().setKey("1").build();
- Value value = Value.newBuilder().setValue("test value").build();
- Object[] request = {key, value};
- template.sendBodyAndHeader("direct:in", request, AvroConstants.AVRO_MESSAGE_NAME, "put");
- Assert.assertEquals(value, keyValue.getStore().get(key));
- }
-
-
- @Test
- public void testInOut() throws InterruptedException {
- keyValue.getStore().clear();
- Key key = Key.newBuilder().setKey("2").build();
- Value value = Value.newBuilder().setValue("test value").build();
- keyValue.getStore().put(key, value);
-
- MockEndpoint mock = getMockEndpoint("mock:result-inout");
- mock.expectedMessageCount(1);
- mock.expectedBodiesReceived(value);
- template.sendBodyAndHeader("direct:inout", key, AvroConstants.AVRO_MESSAGE_NAME, "get");
- mock.assertIsSatisfied(10000);
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- CamelContext context = super.createCamelContext();
- Protocol protocol = KeyValueProtocol.PROTOCOL;
- AvroConfiguration configuration = new AvroConfiguration();
- configuration.setProtocol(protocol);
- AvroComponent component = new AvroComponent(context);
- component.setConfiguration(configuration);
- context.addComponent("avro", component);
- return context;
- }
-}
\ No newline at end of file
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java
deleted file mode 100644
index 86bd94e..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroTestSupport.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.avro;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import java.util.Properties;
-
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.CamelTestSupport;
-
-public class AvroTestSupport extends CamelTestSupport {
-
-
- public static int setupFreePort(String name) {
- int port = -1;
- FileInputStream fis = null;
- FileOutputStream fos = null;
- try {
- Properties properties = new Properties();
- File propertiesFile = new File("target/custom.properties");
- if (!propertiesFile.exists()) {
- propertiesFile.createNewFile();
- }
- fis = new FileInputStream(propertiesFile);
- fos = new FileOutputStream(propertiesFile);
- properties.load(fis);
- if (properties.contains(name)) {
- return Integer.parseInt((String) properties.get(name));
- } else {
- // find a free port number from 9100 onwards, and write that in the custom.properties file
- // which we will use for the unit tests, to avoid port number in use problems
- port = AvailablePortFinder.getNextAvailable(9100);
- properties.put(name, String.valueOf(port));
- properties.store(fos, "avro");
- }
- } catch (IOException e) {
- //Ignore
- } finally {
- if (fis != null) {
- try {
- fis.close();
- } catch (Exception ex) {
- }
- }
- if (fos != null) {
- try {
- fos.close();
- } catch (Exception ex) {
- }
- }
- }
- return port;
- }
-
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java
deleted file mode 100644
index eb08b36..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/GetProcessor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.avro.processors;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.avro.generated.Key;
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.avro.generated.Value;
-
-public class GetProcessor implements Processor {
-
- private KeyValueProtocol keyValue;
-
- public GetProcessor(KeyValueProtocol keyValue) {
- this.keyValue = keyValue;
- }
-
- @Override
- public void process(Exchange exchange) throws Exception {
- Object body = exchange.getIn().getBody();
- if (body instanceof Object[]) {
- Object[] args = (Object[]) body;
- if (args.length == 1 && args[0] instanceof Key) {
- Value v = keyValue.get((Key) args[0]);
- exchange.getOut().setBody(v);
- }
- }
- }
-
- public KeyValueProtocol getKeyValue() {
- return keyValue;
- }
-
- public void setKeyValue(KeyValueProtocol keyValue) {
- this.keyValue = keyValue;
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java
deleted file mode 100644
index 23fe618..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/processors/PutProcessor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.avro.processors;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.avro.generated.Key;
-import org.apache.camel.avro.generated.KeyValueProtocol;
-import org.apache.camel.avro.generated.Value;
-
-public class PutProcessor implements Processor {
-
- private KeyValueProtocol keyValue;
-
- public PutProcessor(KeyValueProtocol keyValue) {
- this.keyValue = keyValue;
- }
-
- @Override
- public void process(Exchange exchange) throws Exception {
- Object body = exchange.getIn().getBody();
- if (body instanceof Object[]) {
- Object[] args = (Object[]) body;
- if (args.length == 2 && args[0] instanceof Key && args[1] instanceof Value) {
- keyValue.put((Key) args[0], (Value) args[1]);
- }
- }
- }
-
- public KeyValueProtocol getKeyValue() {
- return keyValue;
- }
-
- public void setKeyValue(KeyValueProtocol keyValue) {
- this.keyValue = keyValue;
- }
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
deleted file mode 100644
index 40d9278..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.avro;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class AvroMarshalAndUnmarshalSpringTest extends AvroMarshalAndUnmarshallTest {
-
- protected ClassPathXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/avro/springDataFormat.xml");
- }
-
-}
diff --git a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java
deleted file mode 100644
index 92bf4c4..0000000
--- a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.avro;
-
-import org.apache.camel.CamelException;
-import org.apache.camel.FailedToCreateRouteException;
-import org.apache.camel.avro.generated.Value;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-
-import org.junit.Test;
-
-public class AvroMarshalAndUnmarshallTest extends CamelTestSupport {
-
- @Test
- public void testMarshalAndUnmarshalWithDataFormat() throws Exception {
- marshalAndUnmarshal("direct:in", "direct:back");
- }
-
- @Test
- public void testMarshalAndUnmarshalWithDSL1() throws Exception {
- marshalAndUnmarshal("direct:marshal", "direct:unmarshalA");
- }
-
- @Test
- public void testMarshalAndUnmarshalWithDSL2() throws Exception {
- marshalAndUnmarshal("direct:marshal", "direct:unmarshalB");
- }
-
- @Test
- public void testMarshalAndUnmarshalWithDSL3() throws Exception {
- try {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:unmarshalC").unmarshal().avro(new CamelException("wrong schema"))
- .to("mock:reverse");
- }
- });
- fail("Expect the exception here");
- } catch (Exception ex) {
- assertTrue("Expect FailedToCreateRouteException", ex instanceof FailedToCreateRouteException);
- assertTrue("Get a wrong reason", ex.getCause() instanceof IllegalArgumentException);
- }
- }
-
-
- private void marshalAndUnmarshal(String inURI, String outURI) throws Exception {
- Value input = Value.newBuilder().build();
- input.setValue("test body");
-
- MockEndpoint mock = getMockEndpoint("mock:reverse");
- mock.expectedMessageCount(1);
- mock.message(0).body().isInstanceOf(Value.class);
- mock.message(0).body().equals(input);
-
- Object marshalled = template.requestBody(inURI, input);
-
- template.sendBody(outURI, marshalled);
-
- mock.assertIsSatisfied();
-
- Value output = mock.getReceivedExchanges().get(0).getIn().getBody(Value.class);
- assertEquals(input, output);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- AvroDataFormat format = new AvroDataFormat(Value.SCHEMA$);
-
- from("direct:in").marshal(format);
- from("direct:back").unmarshal(format).to("mock:reverse");
-
- from("direct:marshal").marshal().avro();
- from("direct:unmarshalA").unmarshal().avro(Value.class.getName()).to("mock:reverse");
-
- from("direct:unmarshalB").unmarshal().avro(Value.SCHEMA$).to("mock:reverse");
- }
- };
- }
-
-}
diff --git a/components/camel-avro/src/test/resources/log4j.properties b/components/camel-avro/src/test/resources/log4j.properties
deleted file mode 100644
index 6bb82ad..0000000
--- a/components/camel-avro/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,39 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out
-
-log4j.logger.org.apache.camel.component.avro=DEBUG
-log4j.logger.org.apache.camel.dataformat.avro=DEBUG
-
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/camel-avro-test.log
-log4j.appender.out.append=true
-
-log4j.logger.org.apache.camel=DEBUG
diff --git a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml b/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml
deleted file mode 100644
index 45bfab4..0000000
--- a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-consumer.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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 id="camel" xmlns="http://camel.apache.org/schema/spring">
- <propertyPlaceholder id="properties" location="file:target/custom.properties"/>
- <route>
- <from uri="avro:http:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/>
- <choice>
- <when>
- <el>${in.headers.CamelAvroMessageName == 'put'}</el>
- <process ref="putProcessor"/>
- </when>
- <when>
- <el>${in.headers.CamelAvroMessageName == 'get'}</el>
- <process ref="getProcessor"/>
- </when>
- </choice>
- </route>
-
- </camelContext>
-
- <bean id="keyValue" class="org.apache.camel.avro.impl.KeyValueProtocolImpl"/>
-
- <bean id="getProcessor" class="org.apache.camel.component.avro.processors.GetProcessor">
- <constructor-arg ref="keyValue"/>
- </bean>
-
- <bean id="putProcessor" class="org.apache.camel.component.avro.processors.PutProcessor">
- <constructor-arg ref="keyValue"/>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml b/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml
deleted file mode 100644
index c25cee7..0000000
--- a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-http-producer.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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 id="camel" xmlns="http://camel.apache.org/schema/spring">
- <propertyPlaceholder id="properties" location="file:target/custom.properties"/>
- <route>
- <from uri="direct:in"/>
- <to uri="avro:http:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/>
- </route>
-
- <route>
- <from uri="direct:inout"/>
- <to uri="avro:http:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/>
- <to uri="mock:result-inout"/>
- </route>
-
- </camelContext>
-
-</beans>
\ No newline at end of file
diff --git a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml b/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml
deleted file mode 100644
index 4b4b785..0000000
--- a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-consumer.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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 id="camel" xmlns="http://camel.apache.org/schema/spring">
- <propertyPlaceholder id="properties" location="file:target/custom.properties"/>
- <route>
- <from uri="avro:netty:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/>
- <choice>
- <when>
- <el>${in.headers.CamelAvroMessageName == 'put'}</el>
- <process ref="putProcessor"/>
- </when>
- <when>
- <el>${in.headers.CamelAvroMessageName == 'get'}</el>
- <process ref="getProcessor"/>
- </when>
- </choice>
- </route>
-
- </camelContext>
-
- <bean id="keyValue" class="org.apache.camel.avro.impl.KeyValueProtocolImpl"/>
-
- <bean id="getProcessor" class="org.apache.camel.component.avro.processors.GetProcessor">
- <constructor-arg ref="keyValue"/>
- </bean>
-
- <bean id="putProcessor" class="org.apache.camel.component.avro.processors.PutProcessor">
- <constructor-arg ref="keyValue"/>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml b/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml
deleted file mode 100644
index edb5e62..0000000
--- a/components/camel-avro/src/test/resources/org/apache/camel/component/avro/avro-netty-producer.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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 id="camel" xmlns="http://camel.apache.org/schema/spring">
- <propertyPlaceholder id="properties" location="file:target/custom.properties"/>
- <route>
- <from uri="direct:in"/>
- <to uri="avro:netty:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/>
- </route>
-
- <route>
- <from uri="direct:inout"/>
- <to uri="avro:netty:localhost:{{avroport}}?protocolClassName=org.apache.camel.avro.generated.KeyValueProtocol"/>
- <to uri="mock:result-inout"/>
- </route>
-
- </camelContext>
-
-</beans>
\ No newline at end of file
diff --git a/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml b/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
deleted file mode 100644
index b8e8400..0000000
--- a/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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 id="camel" xmlns="http://camel.apache.org/schema/spring">
- <dataFormats>
- <avro id="avro1" instanceClass="org.apache.camel.dataformat.avro.Message"/>
- </dataFormats>
- <route>
- <from uri="direct:in"/>
- <marshal>
- <avro instanceClass="org.apache.camel.dataformat.avro.Message"/>
- </marshal>
- </route>
- <route>
- <from uri="direct:back"/>
- <unmarshal>
- <avro instanceClass="org.apache.camel.dataformat.avro.Message"/>
- </unmarshal>
- <to uri="mock:reverse"/>
- </route>
- <route>
- <from uri="direct:marshal"/>
- <marshal ref="avro1"/>
- </route>
- <route>
- <from uri="direct:unmarshalA"/>
- <unmarshal ref="avro1"/>
- <to uri="mock:reverse"/>
- </route>
- <route>
- <from uri="direct:unmarshalB"/>
- <unmarshal ref="avro1"/>
- <to uri="mock:reverse"/>
- </route>
- </camelContext>
-
- <bean id="avro2" class="org.apache.camel.datafromat.avro.AvrofDataFormat">
- <property name="instanceClassName" value="org.apache.camel.dataformat.avro.Message"/>
- </bean>
-
-</beans>
diff --git a/components/camel-aws/pom.xml b/components/camel-aws/pom.xml
index caef2c8..d87274f 100644
--- a/components/camel-aws/pom.xml
+++ b/components/camel-aws/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -47,7 +47,7 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
- <version>1.3.0</version>
+ <version>1.2.12</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
@@ -104,7 +104,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
deleted file mode 100644
index fd0c801..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/AbstractDdbCommand.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Collection;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.ExpectedAttributeValue;
-import com.amazonaws.services.dynamodb.model.Key;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-
-public abstract class AbstractDdbCommand {
- protected DdbConfiguration configuration;
- protected Exchange exchange;
- protected AmazonDynamoDB ddbClient;
-
- public AbstractDdbCommand(AmazonDynamoDB ddbClient,
- DdbConfiguration configuration, Exchange exchange) {
-
- this.ddbClient = ddbClient;
- this.configuration = configuration;
- this.exchange = exchange;
- }
-
-
- public abstract void execute();
-
- protected Message getMessageForResponse(Exchange exchange) {
- if (exchange.getPattern().isOutCapable()) {
- Message out = exchange.getOut();
- out.copyFrom(exchange.getIn());
- return out;
- }
- return exchange.getIn();
- }
-
- protected String determineTableName() {
- String tableName = exchange.getIn().getHeader(DdbConstants.TABLE_NAME, String.class);
- return tableName != null ? tableName : configuration.getTableName();
- }
-
- @SuppressWarnings("unchecked")
- protected Map<String, ExpectedAttributeValue> determineUpdateCondition() {
- return exchange.getIn().getHeader(DdbConstants.UPDATE_CONDITION, Map.class);
- }
-
- @SuppressWarnings("unchecked")
- protected Map<String, AttributeValue> determineItem() {
- return exchange.getIn().getHeader(DdbConstants.ITEM, Map.class);
- }
-
- protected String determineReturnValues() {
- return exchange.getIn().getHeader(DdbConstants.RETURN_VALUES, String.class);
- }
-
- protected void addAttributesToResult(Map<String, AttributeValue> attributes) {
- Message msg = getMessageForResponse(exchange);
- msg.setHeader(DdbConstants.ATTRIBUTES, attributes);
- }
-
- protected void addToResult(String headerKey, Object value) {
- Message msg = getMessageForResponse(exchange);
- msg.setHeader(headerKey, value);
- }
-
- protected Key determineKey() {
- return exchange.getIn().getHeader(DdbConstants.KEY, Key.class);
- }
-
- @SuppressWarnings("unchecked")
- protected Collection<String> determineAttributeNames() {
- return exchange.getIn().getHeader(DdbConstants.ATTRIBUTE_NAMES, Collection.class);
- }
-
- protected Boolean determineConsistentRead() {
- Boolean consistentRead = exchange.getIn().getHeader(DdbConstants.CONSISTENT_READ, Boolean.class);
- return consistentRead != null ? consistentRead : configuration.getConsistentRead();
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java
deleted file mode 100644
index fc9d04c..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.BatchGetItemRequest;
-import com.amazonaws.services.dynamodb.model.BatchGetItemResult;
-import com.amazonaws.services.dynamodb.model.KeysAndAttributes;
-
-import org.apache.camel.Exchange;
-
-public class BatchGetItemsCommand extends AbstractDdbCommand {
- public BatchGetItemsCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- BatchGetItemResult result = ddbClient.batchGetItem(
- new BatchGetItemRequest().withRequestItems(determineBatchItems()));
-
- addToResult(DdbConstants.BATCH_RESPONSE, result.getResponses());
- addToResult(DdbConstants.UNPROCESSED_KEYS, result.getUnprocessedKeys());
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, KeysAndAttributes> determineBatchItems() {
- return exchange.getIn().getHeader(DdbConstants.BATCH_ITEMS, Map.class);
- }
-}
-
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java
deleted file mode 100644
index 368b331..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbComponent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-
-/**
- * Defines the <a href="http://aws.amazon.com/dynamodb/">AWS DynamoDB component</a>
- */
-public class DdbComponent extends DefaultComponent {
-
- public DdbComponent() {
- }
-
- public DdbComponent(CamelContext context) {
- super(context);
- }
-
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- DdbConfiguration configuration = new DdbConfiguration();
- setProperties(configuration, parameters);
-
- if (remaining == null || remaining.trim().length() == 0) {
- throw new IllegalArgumentException("Table name must be specified.");
- }
- configuration.setTableName(remaining);
-
- if (configuration.getAmazonDDBClient() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
- throw new IllegalArgumentException("amazonDDBClient or accessKey and secretKey must be specified");
- }
-
- DdbEndpoint endpoint = new DdbEndpoint(uri, this, configuration);
- return endpoint;
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
deleted file mode 100644
index 906b84a..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConfiguration.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-
-/**
- * The AWS SDB component configuration properties
- *
- */
-public class DdbConfiguration {
-
- private String accessKey;
- private String secretKey;
- private AmazonDynamoDB amazonDDBClient;
- private String amazonDdbEndpoint;
- private String tableName;
- private Boolean consistentRead;
- private DdbOperations operation = DdbOperations.PutItem;
- private Long readCapacity;
- private Long writeCapacity;
- private String keyAttributeName;
- private String keyAttributeType;
-
- public void setAmazonDdbEndpoint(String amazonDdbEndpoint) {
- this.amazonDdbEndpoint = amazonDdbEndpoint;
- }
-
- public String getAmazonDdbEndpoint() {
- return amazonDdbEndpoint;
- }
-
- public String getAccessKey() {
- return accessKey;
- }
-
- public void setAccessKey(String accessKey) {
- this.accessKey = accessKey;
- }
-
- public String getSecretKey() {
- return secretKey;
- }
-
- public void setSecretKey(String secretKey) {
- this.secretKey = secretKey;
- }
-
- public AmazonDynamoDB getAmazonDDBClient() {
- return amazonDDBClient;
- }
-
- public void setAmazonDDBClient(AmazonDynamoDB amazonDDBClient) {
- this.amazonDDBClient = amazonDDBClient;
- }
-
- public String getTableName() {
- return tableName;
- }
-
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
-
- public DdbOperations getOperation() {
- return operation;
- }
-
- public void setOperation(DdbOperations operation) {
- this.operation = operation;
- }
-
- public Boolean getConsistentRead() {
- return consistentRead;
- }
-
- public void setConsistentRead(Boolean consistentRead) {
- this.consistentRead = consistentRead;
- }
-
- public Long getReadCapacity() {
- return readCapacity;
- }
-
- public void setReadCapacity(Long readCapacity) {
- this.readCapacity = readCapacity;
- }
-
- public Long getWriteCapacity() {
- return writeCapacity;
- }
-
- public void setWriteCapacity(Long writeCapacity) {
- this.writeCapacity = writeCapacity;
- }
-
- public String getKeyAttributeName() {
- return keyAttributeName;
- }
-
- public void setKeyAttributeName(String keyAttributeName) {
- this.keyAttributeName = keyAttributeName;
- }
-
- public String getKeyAttributeType() {
- return keyAttributeType;
- }
-
- public void setKeyAttributeType(String keyAttributeType) {
- this.keyAttributeType = keyAttributeType;
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
deleted file mode 100644
index dbd1a9d..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbConstants.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-/**
- * Constants used in Camel AWS DynamoDB component
- */
-public interface DdbConstants {
- String ATTRIBUTES = "CamelAwsDdbAttributes";
- String ATTRIBUTE_NAMES = "CamelAwsDdbAttributeNames";
- String BATCH_ITEMS = "CamelAwsDdbBatchItems";
- String BATCH_RESPONSE = "CamelAwsDdbBatchResponse";
- String CONSISTENT_READ = "CamelAwsDdbConsistentRead";
- String CONSUMED_CAPACITY = "CamelAwsDdbConsumedCapacity";
- String COUNT = "CamelAwsDdbCount";
- String CREATION_DATE = "CamelAwsDdbCreationDate";
- String EXACT_COUNT = "CamelAwsDdbExactCount";
- String HASH_KEY_VALUE = "CamelAwsDdbHashKeyValue";
- String ITEM = "CamelAwsDdbItem";
- String ITEMS = "CamelAwsDdbItems";
- String ITEM_COUNT = "CamelAwsDdbTableItemCount";
- String ITEM_NAME = "CamelAwsDdbItemName";
- String MESSAGE_ID = "CamelAwsDdbMessageId";
- String NEXT_TOKEN = "CamelAwsDdbNextToken";
- String KEY = "CamelAwsDdbKey";
- String KEY_SCHEMA = "CamelAwsDdbKeySchema";
- String LAST_EVALUATED_KEY = "CamelAwsDdbLastEvaluatedKey";
- String LIMIT = "CamelAwsDdbLimit";
- String OPERATION = "CamelAwsDdbOperation";
- String PROVISIONED_THROUGHPUT = "CamelAwsDdbProvisionedThroughput";
- String READ_CAPACITY = "CamelAwsDdbReadCapacity";
- String RETURN_VALUES = "CamelAwsDdbReturnValues";
- String SCANNED_COUNT = "CamelAwsDdbScannedCount";
- String SCAN_INDEX_FORWARD = "CamelAwsDdbScanIndexForward";
- String SCAN_RANGE_KEY_CONDITION = "CamelAwsDdbScanRangeKeyCondition";
- String SCAN_FILTER = "CamelAwsDdbScanFilter";
- String START_KEY = "CamelAwsDdbStartKey";
- String TABLE_NAME = "CamelAwsDdbTableName";
- String TABLE_SIZE = "CamelAwsDdbTableSize";
- String TABLE_STATUS = "CamelAwsDdbTableStatus";
- String UPDATE_CONDITION = "CamelAwsDdbUpdateCondition";
- String UPDATE_VALUES = "CamelAwsDdbUpdateValues";
- String UNPROCESSED_KEYS = "CamelAwsDdbUnprocessedKeys";
- String WRITE_CAPACITY = "CamelAwsDdbWriteCapacity";
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
deleted file mode 100644
index 443cef5..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbEndpoint.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.AmazonServiceException;
-import com.amazonaws.auth.AWSCredentials;
-import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.AmazonDynamoDBClient;
-import com.amazonaws.services.dynamodb.model.CreateTableRequest;
-import com.amazonaws.services.dynamodb.model.DescribeTableRequest;
-import com.amazonaws.services.dynamodb.model.KeySchema;
-import com.amazonaws.services.dynamodb.model.KeySchemaElement;
-import com.amazonaws.services.dynamodb.model.ProvisionedThroughput;
-import com.amazonaws.services.dynamodb.model.ResourceNotFoundException;
-import com.amazonaws.services.dynamodb.model.TableDescription;
-import com.amazonaws.services.dynamodb.model.TableStatus;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Component;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.impl.ScheduledPollEndpoint;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Defines the <a href="http://aws.amazon.com/dynamodb/">AWS DynamoDB endpoint</a>
- */
-public class DdbEndpoint extends ScheduledPollEndpoint {
-
- private static final Logger LOG = LoggerFactory.getLogger(DdbEndpoint.class);
- private DdbConfiguration configuration;
-
- @Deprecated
- public DdbEndpoint(String uri, CamelContext context, DdbConfiguration configuration) {
- super(uri, context);
- this.configuration = configuration;
- }
-
- public DdbEndpoint(String uri, Component component, DdbConfiguration configuration) {
- super(uri, component);
- this.configuration = configuration;
- }
-
- public Consumer createConsumer(Processor processor) throws Exception {
- throw new UnsupportedOperationException("You cannot receive messages from this endpoint");
- }
-
- public Producer createProducer() throws Exception {
- return new DdbProducer(this);
- }
-
- public boolean isSingleton() {
- return true;
- }
-
- @Override
- public void doStart() throws Exception {
- super.doStart();
-
- AmazonDynamoDB ddbClient = getDdbClient();
- String tableName = getConfiguration().getTableName();
- LOG.trace("Querying whether table [{}] already exists...", tableName);
-
- try {
- DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
- TableDescription tableDescription = ddbClient.describeTable(request).getTable();
- if (!isTableActive(tableDescription)) {
- waitForTableToBecomeAvailable(tableName);
- }
-
- LOG.trace("Table [{}] already exists", tableName);
- return;
- } catch (ResourceNotFoundException e) {
- LOG.trace("Table [{}] doesn't exist yet", tableName);
- LOG.trace("Creating table [{}]...", tableName);
- TableDescription tableDescription = createTable(tableName);
- if (!isTableActive(tableDescription)) {
- waitForTableToBecomeAvailable(tableName);
- }
-
- LOG.trace("Table [{}] created", tableName);
- }
- }
-
- private TableDescription createTable(String tableName) {
- CreateTableRequest createTableRequest = new CreateTableRequest().withTableName(tableName)
- .withKeySchema(new KeySchema(
- new KeySchemaElement().withAttributeName(
- configuration.getKeyAttributeName())
- .withAttributeType(configuration.getKeyAttributeType())))
- .withProvisionedThroughput(
- new ProvisionedThroughput().withReadCapacityUnits(configuration.getReadCapacity())
- .withWriteCapacityUnits(configuration.getWriteCapacity()));
- return getDdbClient().createTable(createTableRequest).getTableDescription();
- }
-
- public DdbConfiguration getConfiguration() {
- return configuration;
- }
-
- public AmazonDynamoDB getDdbClient() {
- return configuration.getAmazonDDBClient() != null ? configuration.getAmazonDDBClient()
- : createDdbClient();
- }
-
- AmazonDynamoDB createDdbClient() {
- AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(),
- configuration.getSecretKey());
- AmazonDynamoDB client = new AmazonDynamoDBClient(credentials);
- if (configuration.getAmazonDdbEndpoint() != null) {
- client.setEndpoint(configuration.getAmazonDdbEndpoint());
- }
- configuration.setAmazonDDBClient(client);
- return client;
- }
-
- private void waitForTableToBecomeAvailable(String tableName) {
- LOG.trace("Waiting for [{}] to become ACTIVE...", tableName);
-
- long waitTime = 5 * 60 * 1000;
- while (waitTime > 0) {
- try {
- Thread.sleep(1000 * 5);
- waitTime -= 5000;
- } catch (Exception e) {
- }
- try {
- DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
- TableDescription tableDescription = getDdbClient().describeTable(request).getTable();
- if (isTableActive(tableDescription)) {
- LOG.trace("Table [{}] became active", tableName);
- return;
- }
- LOG.trace("Table [{}] not active yet", tableName);
- } catch (AmazonServiceException ase) {
- if (!ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException")) {
- throw ase;
- }
- }
- }
-
- throw new RuntimeException("Table " + tableName + " never went active");
- }
-
- private boolean isTableActive(TableDescription tableDescription) {
- return tableDescription.getTableStatus().equals(TableStatus.ACTIVE.toString());
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java
deleted file mode 100644
index 4305b90..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbOperations.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-public enum DdbOperations {
- BatchGetItems,
- DeleteItem,
- DeleteTable,
- DescribeTable,
- GetItem,
- PutItem,
- Query,
- Scan,
- UpdateItem,
- UpdateTable
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java
deleted file mode 100644
index 93234df..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DdbProducer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.URISupport;
-
-/**
- * A Producer which stores data into the Amazon DynamoDB Service
- * <a href="http://aws.amazon.com/dynamodb/">AWS DynamoDB</a>
- */
-public class DdbProducer extends DefaultProducer {
-
- public DdbProducer(Endpoint endpoint) {
- super(endpoint);
- }
-
- public void process(Exchange exchange) throws Exception {
- switch (determineOperation(exchange)) {
- case BatchGetItems:
- new BatchGetItemsCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case DeleteItem:
- new DeleteItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case DeleteTable:
- new DeleteTableCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case DescribeTable:
- new DescribeTableCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case GetItem:
- new GetItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case PutItem:
- new PutItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case Query:
- new QueryCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case Scan:
- new ScanCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case UpdateItem:
- new UpdateItemCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- case UpdateTable:
- new UpdateTableCommand(getEndpoint().getDdbClient(), getConfiguration(), exchange).execute();
- break;
- default:
- throw new IllegalArgumentException("Unsupported operation");
- }
- }
-
- private DdbOperations determineOperation(Exchange exchange) {
- DdbOperations operation = exchange.getIn().getHeader(DdbConstants.OPERATION, DdbOperations.class);
- return operation != null ? operation : getConfiguration().getOperation();
- }
-
- protected DdbConfiguration getConfiguration() {
- return getEndpoint().getConfiguration();
- }
-
- @Override
- public String toString() {
- return "DdbProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
- }
-
- @Override
- public DdbEndpoint getEndpoint() {
- return (DdbEndpoint)super.getEndpoint();
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java
deleted file mode 100644
index c14d2dd..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteItemCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.DeleteItemRequest;
-import com.amazonaws.services.dynamodb.model.DeleteItemResult;
-
-import org.apache.camel.Exchange;
-
-public class DeleteItemCommand extends AbstractDdbCommand {
- public DeleteItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- DeleteItemResult result = ddbClient.deleteItem(new DeleteItemRequest()
- .withTableName(determineTableName())
- .withKey(determineKey())
- .withReturnValues(determineReturnValues())
- .withExpected(determineUpdateCondition()));
-
- addAttributesToResult(result.getAttributes());
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java
deleted file mode 100644
index a9ce1b5..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DeleteTableCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.DeleteTableRequest;
-import com.amazonaws.services.dynamodb.model.TableDescription;
-
-import org.apache.camel.Exchange;
-
-public class DeleteTableCommand extends AbstractDdbCommand {
- public DeleteTableCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration,
- Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- TableDescription tableDescription = ddbClient
- .deleteTable(new DeleteTableRequest(determineTableName())).getTableDescription();
-
- addToResult(DdbConstants.PROVISIONED_THROUGHPUT, tableDescription.getProvisionedThroughput());
- addToResult(DdbConstants.CREATION_DATE, tableDescription.getCreationDateTime());
- addToResult(DdbConstants.ITEM_COUNT, tableDescription.getItemCount());
- addToResult(DdbConstants.KEY_SCHEMA, tableDescription.getKeySchema());
- addToResult(DdbConstants.TABLE_NAME, tableDescription.getTableName());
- addToResult(DdbConstants.TABLE_SIZE, tableDescription.getTableSizeBytes());
- addToResult(DdbConstants.TABLE_STATUS, tableDescription.getTableStatus());
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java
deleted file mode 100644
index 5229c69..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/DescribeTableCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.DescribeTableRequest;
-import com.amazonaws.services.dynamodb.model.DescribeTableResult;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-
-public class DescribeTableCommand extends AbstractDdbCommand {
- public DescribeTableCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration,
- Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- DescribeTableResult result = ddbClient.describeTable(new DescribeTableRequest()
- .withTableName(determineTableName()));
-
- Message msg = getMessageForResponse(exchange);
- msg.setHeader(DdbConstants.TABLE_NAME, result.getTable().getTableName());
- msg.setHeader(DdbConstants.TABLE_STATUS, result.getTable().getTableStatus());
- msg.setHeader(DdbConstants.CREATION_DATE, result.getTable().getCreationDateTime());
- msg.setHeader(DdbConstants.ITEM_COUNT, result.getTable().getItemCount());
- msg.setHeader(DdbConstants.KEY_SCHEMA, result.getTable().getKeySchema());
- msg.setHeader(DdbConstants.READ_CAPACITY,
- result.getTable().getProvisionedThroughput().getReadCapacityUnits());
- msg.setHeader(DdbConstants.WRITE_CAPACITY,
- result.getTable().getProvisionedThroughput().getWriteCapacityUnits());
- msg.setHeader(DdbConstants.TABLE_SIZE, result.getTable().getTableSizeBytes());
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java
deleted file mode 100644
index 41b20f7..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/GetItemCommand.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.GetItemRequest;
-import com.amazonaws.services.dynamodb.model.GetItemResult;
-
-import org.apache.camel.Exchange;
-
-public class GetItemCommand extends AbstractDdbCommand {
- public GetItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- GetItemResult result = ddbClient.getItem(new GetItemRequest()
- .withKey(determineKey())
- .withTableName(determineTableName())
- .withAttributesToGet(determineAttributeNames())
- .withConsistentRead(determineConsistentRead()));
- addAttributesToResult(result.getItem());
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java
deleted file mode 100644
index 99aa488..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/PutItemCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.PutItemRequest;
-import com.amazonaws.services.dynamodb.model.PutItemResult;
-
-import org.apache.camel.Exchange;
-
-public class PutItemCommand extends AbstractDdbCommand {
- public PutItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- PutItemResult result = ddbClient.putItem(new PutItemRequest()
- .withTableName(determineTableName())
- .withItem(determineItem())
- .withExpected(determineUpdateCondition())
- .withReturnValues(determineReturnValues()));
-
- addAttributesToResult(result.getAttributes());
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
deleted file mode 100644
index 29a3c88..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/QueryCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.Condition;
-import com.amazonaws.services.dynamodb.model.Key;
-import com.amazonaws.services.dynamodb.model.QueryRequest;
-import com.amazonaws.services.dynamodb.model.QueryResult;
-
-import org.apache.camel.Exchange;
-
-public class QueryCommand extends AbstractDdbCommand {
- public QueryCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- QueryResult result = ddbClient.query(new QueryRequest()
- .withTableName(determineTableName())
- .withAttributesToGet(determineAttributeNames())
- .withCount(determineExactCount())
- .withConsistentRead(determineConsistentRead())
- .withExclusiveStartKey(determineStartKey())
- .withHashKeyValue(determineHashKeyValue())
- .withLimit(determineLimit())
- .withRangeKeyCondition(determineRangeKeyCondition())
- .withScanIndexForward(determineScanIndexForward()));
-
- addToResult(DdbConstants.ITEMS, result.getItems());
- addToResult(DdbConstants.LAST_EVALUATED_KEY, result.getLastEvaluatedKey());
- addToResult(DdbConstants.CONSUMED_CAPACITY, result.getConsumedCapacityUnits());
- addToResult(DdbConstants.COUNT, result.getCount());
- }
-
- private Key determineStartKey() {
- return exchange.getIn().getHeader(DdbConstants.START_KEY, Key.class);
- }
-
- private Boolean determineScanIndexForward() {
- return exchange.getIn().getHeader(DdbConstants.SCAN_INDEX_FORWARD, Boolean.class);
- }
-
- private Condition determineRangeKeyCondition() {
- return exchange.getIn().getHeader(DdbConstants.SCAN_RANGE_KEY_CONDITION, Condition.class);
- }
-
- private Integer determineLimit() {
- return exchange.getIn().getHeader(DdbConstants.LIMIT, Integer.class);
- }
-
- private AttributeValue determineHashKeyValue() {
- return exchange.getIn().getHeader(DdbConstants.HASH_KEY_VALUE, AttributeValue.class);
- }
-
- private Boolean determineExactCount() {
- return exchange.getIn().getHeader(DdbConstants.EXACT_COUNT, Boolean.class);
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
deleted file mode 100644
index 79b83be..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/ScanCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.Condition;
-import com.amazonaws.services.dynamodb.model.ScanRequest;
-import com.amazonaws.services.dynamodb.model.ScanResult;
-
-import org.apache.camel.Exchange;
-
-public class ScanCommand extends AbstractDdbCommand {
- public ScanCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- ScanResult result = ddbClient.scan(new ScanRequest()
- .withTableName(determineTableName())
- .withScanFilter(determineScanFilter()));
-
- addToResult(DdbConstants.ITEMS, result.getItems());
- addToResult(DdbConstants.LAST_EVALUATED_KEY, result.getLastEvaluatedKey());
- addToResult(DdbConstants.CONSUMED_CAPACITY, result.getConsumedCapacityUnits());
- addToResult(DdbConstants.COUNT, result.getCount());
- addToResult(DdbConstants.SCANNED_COUNT, result.getScannedCount());
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, Condition> determineScanFilter() {
- return exchange.getIn().getHeader(DdbConstants.SCAN_FILTER, Map.class);
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java
deleted file mode 100644
index 3d3ce2a..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateItemCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.AttributeValueUpdate;
-import com.amazonaws.services.dynamodb.model.UpdateItemRequest;
-import com.amazonaws.services.dynamodb.model.UpdateItemResult;
-
-import org.apache.camel.Exchange;
-
-public class UpdateItemCommand extends AbstractDdbCommand {
- public UpdateItemCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- UpdateItemResult result = ddbClient.updateItem(new UpdateItemRequest()
- .withTableName(determineTableName())
- .withKey(determineKey())
- .withAttributeUpdates(determineUpdateValues())
- .withExpected(determineUpdateCondition())
- .withReturnValues(determineReturnValues()));
-
- addAttributesToResult(result.getAttributes());
- }
-
- @SuppressWarnings("unchecked")
- private Map<String, AttributeValueUpdate> determineUpdateValues() {
- return exchange.getIn().getHeader(DdbConstants.UPDATE_VALUES, Map.class);
- }
-
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java
deleted file mode 100644
index f9d20ec..0000000
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/ddb/UpdateTableCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import com.amazonaws.services.dynamodb.AmazonDynamoDB;
-import com.amazonaws.services.dynamodb.model.ProvisionedThroughput;
-import com.amazonaws.services.dynamodb.model.UpdateTableRequest;
-
-import org.apache.camel.Exchange;
-
-public class UpdateTableCommand extends AbstractDdbCommand {
- public UpdateTableCommand(AmazonDynamoDB ddbClient, DdbConfiguration configuration, Exchange exchange) {
- super(ddbClient, configuration, exchange);
- }
-
- @Override
- public void execute() {
- ddbClient.updateTable(new UpdateTableRequest()
- .withTableName(determineTableName())
- .withProvisionedThroughput(new ProvisionedThroughput()
- .withReadCapacityUnits(determineReadCapacity())
- .withWriteCapacityUnits(determineWriteCapacity())));
- }
-
- private Long determineReadCapacity() {
- Long readCapacity = exchange.getIn().getHeader(DdbConstants.READ_CAPACITY, Long.class);
- return readCapacity != null ? readCapacity : configuration.getReadCapacity();
- }
-
-
- private Long determineWriteCapacity() {
- Long writeCapacity = exchange.getIn().getHeader(DdbConstants.WRITE_CAPACITY, Long.class);
- return writeCapacity != null ? writeCapacity : configuration.getWriteCapacity();
- }
-}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Consumer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Consumer.java
index 31da280..91d201f 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Consumer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Consumer.java
@@ -27,10 +27,13 @@
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
@@ -43,9 +46,12 @@
* <a href="http://aws.amazon.com/s3/">AWS S3</a>
*
*/
-public class S3Consumer extends ScheduledBatchPollingConsumer {
+public class S3Consumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
private static final transient Logger LOG = LoggerFactory.getLogger(S3Consumer.class);
+
+ private volatile ShutdownRunningTask shutdownRunningTask;
+ private volatile int pendingExchanges;
public S3Consumer(S3Endpoint endpoint, Processor processor) throws NoFactoryAvailableException {
super(endpoint, processor);
@@ -62,7 +68,7 @@
ListObjectsRequest listObjectsRequest = new ListObjectsRequest();
listObjectsRequest.setBucketName(bucketName);
- listObjectsRequest.setMaxKeys(maxMessagesPerPoll);
+ listObjectsRequest.setMaxKeys(getMaxMessagesPerPoll());
ObjectListing listObjects = getAmazonS3Client().listObjects(listObjectsRequest);
@@ -159,7 +165,55 @@
LOG.warn("Exchange failed, so rolling back message status: {}", exchange);
}
}
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
protected S3Configuration getConfiguration() {
return getEndpoint().getConfiguration();
}
@@ -172,7 +226,15 @@
public S3Endpoint getEndpoint() {
return (S3Endpoint) super.getEndpoint();
}
-
+
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ getEndpoint().setMaxMessagesPerPoll(maxMessagesPerPoll);
+ }
+
+ public int getMaxMessagesPerPoll() {
+ return getEndpoint().getMaxMessagesPerPoll();
+ }
+
@Override
public String toString() {
return "S3Consumer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
index b085c46..459ae74 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Endpoint.java
@@ -49,7 +49,7 @@
private AmazonS3Client s3Client;
private S3Configuration configuration;
private int maxMessagesPerPoll = 10;
-
+
@Deprecated
public S3Endpoint(String uri, CamelContext context, S3Configuration configuration) {
super(uri, context);
@@ -63,7 +63,6 @@
public Consumer createConsumer(Processor processor) throws Exception {
S3Consumer s3Consumer = new S3Consumer(this, processor);
configureConsumer(s3Consumer);
- s3Consumer.setMaxMessagesPerPoll(maxMessagesPerPoll);
return s3Consumer;
}
@@ -179,7 +178,7 @@
}
return client;
}
-
+
public int getMaxMessagesPerPoll() {
return maxMessagesPerPoll;
}
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
index 0ccc115..99b2386 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java
@@ -27,10 +27,13 @@
import com.amazonaws.services.sqs.model.ReceiveMessageRequest;
import com.amazonaws.services.sqs.model.ReceiveMessageResult;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.NoFactoryAvailableException;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
@@ -44,9 +47,12 @@
* <a href="http://aws.amazon.com/sqs/">AWS SQS</a>
*
*/
-public class SqsConsumer extends ScheduledBatchPollingConsumer {
+public class SqsConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
private static final transient Logger LOG = LoggerFactory.getLogger(SqsConsumer.class);
+
+ private volatile ShutdownRunningTask shutdownRunningTask;
+ private volatile int pendingExchanges;
public SqsConsumer(SqsEndpoint endpoint, Processor processor) throws NoFactoryAvailableException {
super(endpoint, processor);
@@ -137,7 +143,7 @@
LOG.trace("Deleting message with receipt handle {}...", receiptHandle);
getClient().deleteMessage(deleteRequest);
-
+
LOG.trace("Message deleted");
}
} catch (AmazonClientException e) {
@@ -159,7 +165,55 @@
LOG.warn("Exchange failed, so rolling back message status: {}", exchange);
}
}
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
protected SqsConfiguration getConfiguration() {
return getEndpoint().getConfiguration();
}
@@ -176,7 +230,15 @@
public SqsEndpoint getEndpoint() {
return (SqsEndpoint) super.getEndpoint();
}
-
+
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ getEndpoint().setMaxMessagesPerPoll(maxMessagesPerPoll);
+ }
+
+ public int getMaxMessagesPerPoll() {
+ return getEndpoint().getMaxMessagesPerPoll();
+ }
+
@Override
public String toString() {
return "SqsConsumer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]";
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
index 05f5d05..3e1e629 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
@@ -63,7 +63,6 @@
public Consumer createConsumer(Processor processor) throws Exception {
SqsConsumer sqsConsumer = new SqsConsumer(this, processor);
configureConsumer(sqsConsumer);
- sqsConsumer.setMaxMessagesPerPoll(maxMessagesPerPoll);
return sqsConsumer;
}
diff --git a/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb b/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb
deleted file mode 100644
index 487ac86..0000000
--- a/components/camel-aws/src/main/resources/META-INF/services/org/apache/camel/component/aws-ddb
+++ /dev/null
@@ -1,18 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-class=org.apache.camel.component.aws.ddb.DdbComponent
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java
deleted file mode 100644
index 14824a1..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/AmazonDDBClientMock.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.amazonaws.auth.BasicAWSCredentials;
-import com.amazonaws.services.dynamodb.AmazonDynamoDBClient;
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.BatchGetItemRequest;
-import com.amazonaws.services.dynamodb.model.BatchGetItemResult;
-import com.amazonaws.services.dynamodb.model.BatchResponse;
-import com.amazonaws.services.dynamodb.model.CreateTableRequest;
-import com.amazonaws.services.dynamodb.model.CreateTableResult;
-import com.amazonaws.services.dynamodb.model.DeleteItemRequest;
-import com.amazonaws.services.dynamodb.model.DeleteItemResult;
-import com.amazonaws.services.dynamodb.model.DeleteTableRequest;
-import com.amazonaws.services.dynamodb.model.DeleteTableResult;
-import com.amazonaws.services.dynamodb.model.DescribeTableRequest;
-import com.amazonaws.services.dynamodb.model.DescribeTableResult;
-import com.amazonaws.services.dynamodb.model.GetItemRequest;
-import com.amazonaws.services.dynamodb.model.GetItemResult;
-import com.amazonaws.services.dynamodb.model.Key;
-import com.amazonaws.services.dynamodb.model.KeySchema;
-import com.amazonaws.services.dynamodb.model.KeySchemaElement;
-import com.amazonaws.services.dynamodb.model.KeysAndAttributes;
-import com.amazonaws.services.dynamodb.model.ProvisionedThroughputDescription;
-import com.amazonaws.services.dynamodb.model.PutItemRequest;
-import com.amazonaws.services.dynamodb.model.PutItemResult;
-import com.amazonaws.services.dynamodb.model.QueryRequest;
-import com.amazonaws.services.dynamodb.model.QueryResult;
-import com.amazonaws.services.dynamodb.model.ResourceNotFoundException;
-import com.amazonaws.services.dynamodb.model.ScanRequest;
-import com.amazonaws.services.dynamodb.model.ScanResult;
-import com.amazonaws.services.dynamodb.model.TableDescription;
-import com.amazonaws.services.dynamodb.model.TableStatus;
-import com.amazonaws.services.dynamodb.model.UpdateItemRequest;
-import com.amazonaws.services.dynamodb.model.UpdateItemResult;
-import com.amazonaws.services.dynamodb.model.UpdateTableRequest;
-import com.amazonaws.services.dynamodb.model.UpdateTableResult;
-
-public class AmazonDDBClientMock extends AmazonDynamoDBClient {
- public static final long NOW = 1327709390233L;
- DescribeTableRequest describeTableRequest;
- CreateTableRequest createTableRequest;
- UpdateTableRequest updateTableRequest;
- DeleteTableRequest deleteTableRequest;
- PutItemRequest putItemRequest;
- UpdateItemRequest updateItemRequest;
- DeleteItemRequest deleteItemRequest;
- GetItemRequest getItemRequest;
- BatchGetItemRequest batchGetItemRequest;
- ScanRequest scanRequest;
- QueryRequest queryRequest;
-
- public AmazonDDBClientMock() {
- super(new BasicAWSCredentials("user", "secret"));
- }
-
- @Override
- public DescribeTableResult describeTable(DescribeTableRequest describeTableRequest) {
- this.describeTableRequest = describeTableRequest;
- String tableName = describeTableRequest.getTableName();
- if ("activeTable".equals(tableName)) {
- return tableWithStatus(TableStatus.ACTIVE);
- } else if ("creatibleTable".equals(tableName) && createTableRequest != null) {
- return tableWithStatus(TableStatus.ACTIVE);
- } else if ("FULL_DESCRIBE_TABLE".equals(tableName)) {
- return new DescribeTableResult().withTable(new TableDescription()
- .withTableName(tableName)
- .withTableStatus(TableStatus.ACTIVE)
- .withCreationDateTime(new Date(NOW))
- .withItemCount(100L)
- .withKeySchema(new KeySchema(new KeySchemaElement().withAttributeName("name")))
- .withProvisionedThroughput(new ProvisionedThroughputDescription()
- .withReadCapacityUnits(20L)
- .withWriteCapacityUnits(10L))
- .withTableSizeBytes(1000L));
- }
- throw new ResourceNotFoundException(tableName + " is missing");
- }
-
- private DescribeTableResult tableWithStatus(TableStatus active) {
- return new DescribeTableResult().withTable(new TableDescription().withTableStatus(active));
- }
-
- @Override
- public CreateTableResult createTable(CreateTableRequest createTableRequest) {
- this.createTableRequest = createTableRequest;
- return new CreateTableResult().withTableDescription(
- new TableDescription().withTableStatus(TableStatus.CREATING));
- }
-
- @Override
- public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest) {
- this.updateTableRequest = updateTableRequest;
- return null;
- }
-
- @Override
- public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) {
- this.deleteTableRequest = deleteTableRequest;
- return new DeleteTableResult().withTableDescription(new TableDescription()
- .withProvisionedThroughput(new ProvisionedThroughputDescription())
- .withTableName(deleteTableRequest.getTableName())
- .withCreationDateTime(new Date(NOW))
- .withItemCount(10L)
- .withKeySchema(new KeySchema())
- .withTableSizeBytes(20L)
- .withTableStatus(TableStatus.ACTIVE));
- }
-
- @Override
- public PutItemResult putItem(PutItemRequest putItemRequest) {
- this.putItemRequest = putItemRequest;
- return new PutItemResult().withAttributes(getAttributes());
- }
-
- private Map<String, AttributeValue> getAttributes() {
- Map<String, AttributeValue> attributes = new HashMap<String, AttributeValue>();
- attributes.put("attrName", new AttributeValue("attrValue"));
- return attributes;
- }
-
- @Override
- public UpdateItemResult updateItem(UpdateItemRequest updateItemRequest) {
- this.updateItemRequest = updateItemRequest;
- return new UpdateItemResult().withAttributes(getAttributes());
- }
-
- @Override
- public DeleteItemResult deleteItem(DeleteItemRequest deleteItemRequest) {
- this.deleteItemRequest = deleteItemRequest;
- return new DeleteItemResult().withAttributes(getAttributes());
- }
-
- @Override
- public GetItemResult getItem(GetItemRequest getItemRequest) {
- this.getItemRequest = getItemRequest;
- return new GetItemResult().withItem(getAttributes());
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) {
- this.batchGetItemRequest = batchGetItemRequest;
- Map<String, BatchResponse> responseMap = new HashMap<String, BatchResponse>();
- responseMap.put("DOMAIN1", new BatchResponse().withItems(getAttributes()));
-
- Map<String, KeysAndAttributes> unprocessedKeys = new HashMap<String, KeysAndAttributes>();
- unprocessedKeys.put("DOMAIN1", new KeysAndAttributes().withKeys(
- new Key(new AttributeValue("UNPROCESSED_KEY"))));
-
- return new BatchGetItemResult()
- .withResponses(responseMap)
- .withUnprocessedKeys(unprocessedKeys);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public ScanResult scan(ScanRequest scanRequest) {
- this.scanRequest = scanRequest;
- return new ScanResult()
- .withConsumedCapacityUnits(1.0)
- .withCount(1)
- .withItems(getAttributes())
- .withScannedCount(10)
- .withLastEvaluatedKey(new Key(new AttributeValue("LAST_KEY")));
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public QueryResult query(QueryRequest queryRequest) {
- this.queryRequest = queryRequest;
- return new QueryResult()
- .withConsumedCapacityUnits(1.0)
- .withCount(1)
- .withItems(getAttributes())
- .withLastEvaluatedKey(new Key(new AttributeValue("LAST_KEY")));
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java
deleted file mode 100644
index 3a161bf..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/BatchGetItemsCommandTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.BatchResponse;
-import com.amazonaws.services.dynamodb.model.Key;
-import com.amazonaws.services.dynamodb.model.KeysAndAttributes;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class BatchGetItemsCommandTest {
-
- private BatchGetItemsCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new BatchGetItemsCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
- Key key = new Key(new AttributeValue("Key_1"));
- Key unprocessedKey = new Key(new AttributeValue("UNPROCESSED_KEY"));
- Map<String, KeysAndAttributes> keysAndAttributesMap = new HashMap<String, KeysAndAttributes>();
- KeysAndAttributes keysAndAttributes = new KeysAndAttributes().withKeys(key);
- keysAndAttributesMap.put("DOMAIN1", keysAndAttributes);
- exchange.getIn().setHeader(DdbConstants.BATCH_ITEMS, keysAndAttributesMap);
-
- command.execute();
-
- assertEquals(keysAndAttributesMap, ddbClient.batchGetItemRequest.getRequestItems());
-
-
- BatchResponse batchResponse = (BatchResponse)exchange.getIn()
- .getHeader(DdbConstants.BATCH_RESPONSE, Map.class).get("DOMAIN1");
- AttributeValue value = batchResponse.getItems().get(0).get("attrName");
-
- KeysAndAttributes unProcessedAttributes = (KeysAndAttributes)exchange.getIn().getHeader(
- DdbConstants.UNPROCESSED_KEYS, Map.class).get("DOMAIN1");
- Key next = unProcessedAttributes.getKeys().iterator().next();
-
- assertEquals(new AttributeValue("attrValue"), value);
- assertEquals(unprocessedKey, next);
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java
deleted file mode 100644
index ddfcadb..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DdbComponentTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.DefaultProducerTemplate;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class DdbComponentTest extends CamelTestSupport {
-
- private AmazonDDBClientMock amazonDDBClient;
-
- @Test
- public void whenTableExistsThenDoesntCreateItOnStart() throws Exception {
- assertNull(amazonDDBClient.createTableRequest);
- }
-
-
- @Test
- public void whenTableIsMissingThenCreateItOnStart() throws Exception {
- DefaultProducerTemplate.newInstance(context,
- "aws-ddb://creatibleTable?amazonDDBClient=#amazonDDBClient");
- assertEquals("creatibleTable", amazonDDBClient.createTableRequest.getTableName());
- }
-
-
-
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- JndiRegistry registry = super.createRegistry();
-
- amazonDDBClient = new AmazonDDBClientMock();
- registry.bind("amazonDDBClient", amazonDDBClient);
-
- return registry;
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start")
- .to("aws-ddb://activeTable?amazonDDBClient=#amazonDDBClient");
- }
- };
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteItemCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteItemCommandTest.java
deleted file mode 100644
index 026571e..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteItemCommandTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.ExpectedAttributeValue;
-import com.amazonaws.services.dynamodb.model.Key;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class DeleteItemCommandTest {
-
- private DeleteItemCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new DeleteItemCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
- Key key = new Key(new AttributeValue("Key_1"));
- exchange.getIn().setHeader(DdbConstants.KEY, key);
-
-
- Map<String, ExpectedAttributeValue> updateCondition = new HashMap<String, ExpectedAttributeValue>();
- updateCondition
- .put("name", new ExpectedAttributeValue(new AttributeValue("expected value")));
- exchange.getIn().setHeader(DdbConstants.UPDATE_CONDITION, updateCondition);
- exchange.getIn().setHeader(DdbConstants.RETURN_VALUES, "ALL_OLD");
-
- command.execute();
-
- assertEquals("DOMAIN1", ddbClient.deleteItemRequest.getTableName());
- assertEquals(key, ddbClient.deleteItemRequest.getKey());
- assertEquals(updateCondition, ddbClient.deleteItemRequest.getExpected());
- assertEquals("ALL_OLD", ddbClient.deleteItemRequest.getReturnValues());
- assertEquals(new AttributeValue("attrValue"),
- exchange.getIn().getHeader(DdbConstants.ATTRIBUTES, Map.class).get(
- "attrName"));
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteTableCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteTableCommandTest.java
deleted file mode 100644
index 91bb696..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DeleteTableCommandTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Date;
-
-import com.amazonaws.services.dynamodb.model.KeySchema;
-import com.amazonaws.services.dynamodb.model.ProvisionedThroughputDescription;
-import com.amazonaws.services.dynamodb.model.TableStatus;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class DeleteTableCommandTest {
-
- private DeleteTableCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
-
- command = new DeleteTableCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void testExecute() {
- command.execute();
-
- assertEquals("DOMAIN1", ddbClient.deleteTableRequest.getTableName());
- assertEquals(new ProvisionedThroughputDescription(), exchange.getIn().getHeader(
- DdbConstants.PROVISIONED_THROUGHPUT));
- assertEquals(new Date(AmazonDDBClientMock.NOW), exchange.getIn().getHeader(DdbConstants.CREATION_DATE,
- Date.class));
- assertEquals(Long.valueOf(10L), exchange.getIn().getHeader(DdbConstants.ITEM_COUNT, Long.class));
- assertEquals(new KeySchema(), exchange.getIn().getHeader(DdbConstants.KEY_SCHEMA, KeySchema.class));
- assertEquals(Long.valueOf(20L), exchange.getIn().getHeader(DdbConstants.TABLE_SIZE, Long.class));
- assertEquals(TableStatus.ACTIVE, exchange.getIn().getHeader(DdbConstants.TABLE_STATUS, TableStatus.class));
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DescribeTableCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DescribeTableCommandTest.java
deleted file mode 100644
index d1d14f5..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/DescribeTableCommandTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Date;
-
-import com.amazonaws.services.dynamodb.model.KeySchema;
-import com.amazonaws.services.dynamodb.model.KeySchemaElement;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class DescribeTableCommandTest {
-
- private DescribeTableCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("FULL_DESCRIBE_TABLE");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new DescribeTableCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void testExecute() {
- command.execute();
- assertEquals("FULL_DESCRIBE_TABLE", ddbClient.describeTableRequest.getTableName());
- assertEquals("FULL_DESCRIBE_TABLE", exchange.getIn().getHeader(DdbConstants.TABLE_NAME));
- assertEquals("ACTIVE", exchange.getIn().getHeader(DdbConstants.TABLE_STATUS));
- assertEquals(new Date(AmazonDDBClientMock.NOW), exchange.getIn().getHeader(DdbConstants.CREATION_DATE));
- assertEquals(100L, exchange.getIn().getHeader(DdbConstants.ITEM_COUNT));
- assertEquals(new KeySchema(new KeySchemaElement().withAttributeName("name")),
- exchange.getIn().getHeader(DdbConstants.KEY_SCHEMA));
- assertEquals(20L, exchange.getIn().getHeader(DdbConstants.READ_CAPACITY));
- assertEquals(10L, exchange.getIn().getHeader(DdbConstants.WRITE_CAPACITY));
- assertEquals(1000L, exchange.getIn().getHeader(DdbConstants.TABLE_SIZE));
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/GetItemCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/GetItemCommandTest.java
deleted file mode 100644
index d329ec6..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/GetItemCommandTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.Key;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class GetItemCommandTest {
- private GetItemCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new GetItemCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
- Key key = new Key(new AttributeValue("Key_1"));
- exchange.getIn().setHeader(DdbConstants.KEY, key);
-
- List<String> attrNames = Arrays.asList("attrName");
- exchange.getIn().setHeader(DdbConstants.ATTRIBUTE_NAMES, attrNames);
- exchange.getIn().setHeader(DdbConstants.CONSISTENT_READ, true);
-
- command.execute();
-
- assertEquals("DOMAIN1", ddbClient.getItemRequest.getTableName());
- assertEquals(attrNames, ddbClient.getItemRequest.getAttributesToGet());
- assertEquals(true, ddbClient.getItemRequest.getConsistentRead());
- assertEquals(key, ddbClient.getItemRequest.getKey());
- assertEquals(new AttributeValue("attrValue"),
- exchange.getIn().getHeader(DdbConstants.ATTRIBUTES, Map.class).get(
- "attrName"));
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/PutItemCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/PutItemCommandTest.java
deleted file mode 100644
index 22c5a9a..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/PutItemCommandTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.ExpectedAttributeValue;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class PutItemCommandTest {
-
- private PutItemCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new PutItemCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
- Map<String, AttributeValue> attributeMap = new HashMap<String, AttributeValue>();
- AttributeValue attributeValue = new AttributeValue("test value");
- attributeMap.put("name", attributeValue);
- exchange.getIn().setHeader(DdbConstants.ITEM, attributeMap);
-
- Map<String, ExpectedAttributeValue> expectedAttributeValueMap = new HashMap<String, ExpectedAttributeValue>();
- expectedAttributeValueMap.put("name", new ExpectedAttributeValue(attributeValue));
- exchange.getIn().setHeader(DdbConstants.UPDATE_CONDITION, expectedAttributeValueMap);
-
- command.execute();
-
- assertEquals("DOMAIN1", ddbClient.putItemRequest.getTableName());
- assertEquals(attributeMap, ddbClient.putItemRequest.getItem());
- assertEquals(expectedAttributeValueMap, ddbClient.putItemRequest.getExpected());
- assertEquals(new AttributeValue("attrValue"),
- exchange.getIn().getHeader(DdbConstants.ATTRIBUTES, Map.class).get("attrName"));
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/QueryCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/QueryCommandTest.java
deleted file mode 100644
index 2e11d21..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/QueryCommandTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.ComparisonOperator;
-import com.amazonaws.services.dynamodb.model.Condition;
-import com.amazonaws.services.dynamodb.model.Key;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class QueryCommandTest {
-
- private QueryCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new QueryCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
-
- Key startKey = new Key(new AttributeValue("startKey"));
- AttributeValue attributeValue = new AttributeValue().withN("1985");
- Condition condition = new Condition()
- .withComparisonOperator(ComparisonOperator.GT.toString())
- .withAttributeValueList(new AttributeValue().withN("1985"));
-
- List<String> attributeNames = Arrays.asList("attrNameOne", "attrNameTwo");
- exchange.getIn().setHeader(DdbConstants.ATTRIBUTE_NAMES, attributeNames);
- exchange.getIn().setHeader(DdbConstants.EXACT_COUNT, true);
- exchange.getIn().setHeader(DdbConstants.CONSISTENT_READ, true);
- exchange.getIn().setHeader(DdbConstants.START_KEY, startKey);
- exchange.getIn().setHeader(DdbConstants.HASH_KEY_VALUE, attributeValue);
- exchange.getIn().setHeader(DdbConstants.LIMIT, 10);
- exchange.getIn().setHeader(DdbConstants.SCAN_RANGE_KEY_CONDITION, condition);
- exchange.getIn().setHeader(DdbConstants.SCAN_INDEX_FORWARD, true);
-
- command.execute();
-
- assertEquals(Integer.valueOf(1), exchange.getIn().getHeader(DdbConstants.COUNT, Integer.class));
- assertEquals(Double.valueOf(1.0), exchange.getIn().getHeader(DdbConstants.CONSUMED_CAPACITY, Double.class));
- assertEquals(new Key(new AttributeValue("LAST_KEY")), exchange.getIn().getHeader(DdbConstants.LAST_EVALUATED_KEY, Key.class));
-
- Map<?, ?> items = (Map<?, ?>) exchange.getIn().getHeader(DdbConstants.ITEMS, List.class).get(0);
- assertEquals(new AttributeValue("attrValue"), items.get("attrName"));
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/ScanCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/ScanCommandTest.java
deleted file mode 100644
index 44a7eb9..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/ScanCommandTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.ComparisonOperator;
-import com.amazonaws.services.dynamodb.model.Condition;
-import com.amazonaws.services.dynamodb.model.Key;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class ScanCommandTest {
-
- private ScanCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new ScanCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
- HashMap<String, Condition> scanFilter = new HashMap<String, Condition>();
- Condition condition = new Condition()
- .withComparisonOperator(ComparisonOperator.GT.toString())
- .withAttributeValueList(new AttributeValue().withN("1985"));
- scanFilter.put("year", condition);
- exchange.getIn().setHeader(DdbConstants.SCAN_FILTER, scanFilter);
-
- command.execute();
-
- assertEquals(scanFilter, ddbClient.scanRequest.getScanFilter());
- assertEquals(Integer.valueOf(10), exchange.getIn().getHeader(DdbConstants.SCANNED_COUNT, Integer.class));
- assertEquals(Integer.valueOf(1), exchange.getIn().getHeader(DdbConstants.COUNT, Integer.class));
- assertEquals(Double.valueOf(1.0), exchange.getIn().getHeader(DdbConstants.CONSUMED_CAPACITY, Double.class));
- assertEquals(new Key(new AttributeValue("LAST_KEY")), exchange.getIn().getHeader(DdbConstants.LAST_EVALUATED_KEY, Key.class));
-
- Map<?, ?> items = (Map<?, ?>) exchange.getIn().getHeader(DdbConstants.ITEMS, List.class).get(0);
- assertEquals(new AttributeValue("attrValue"), items.get("attrName"));
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateItemCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateItemCommandTest.java
deleted file mode 100644
index a99be93..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateItemCommandTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeAction;
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-import com.amazonaws.services.dynamodb.model.AttributeValueUpdate;
-import com.amazonaws.services.dynamodb.model.ExpectedAttributeValue;
-import com.amazonaws.services.dynamodb.model.Key;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class UpdateItemCommandTest {
-
- private UpdateItemCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- exchange = new DefaultExchange(new DefaultCamelContext());
- command = new UpdateItemCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void execute() {
- Key key = new Key(new AttributeValue("Key_1"));
- exchange.getIn().setHeader(DdbConstants.KEY, key);
-
- Map<String, AttributeValueUpdate> attributeMap = new HashMap<String, AttributeValueUpdate>();
- AttributeValueUpdate attributeValue = new AttributeValueUpdate(
- new AttributeValue("new value"), AttributeAction.ADD);
- attributeMap.put("name", attributeValue);
- exchange.getIn().setHeader(DdbConstants.UPDATE_VALUES, attributeMap);
-
- Map<String, ExpectedAttributeValue> expectedAttributeValueMap = new HashMap<String, ExpectedAttributeValue>();
- expectedAttributeValueMap
- .put("name", new ExpectedAttributeValue(new AttributeValue("expected value")));
- exchange.getIn().setHeader(DdbConstants.UPDATE_CONDITION, expectedAttributeValueMap);
- exchange.getIn().setHeader(DdbConstants.RETURN_VALUES, "ALL_OLD");
-
- command.execute();
-
- assertEquals("DOMAIN1", ddbClient.updateItemRequest.getTableName());
- assertEquals(attributeMap, ddbClient.updateItemRequest.getAttributeUpdates());
- assertEquals(key, ddbClient.updateItemRequest.getKey());
- assertEquals(expectedAttributeValueMap, ddbClient.updateItemRequest.getExpected());
- assertEquals("ALL_OLD", ddbClient.updateItemRequest.getReturnValues());
- assertEquals(new AttributeValue("attrValue"),
- exchange.getIn().getHeader(DdbConstants.ATTRIBUTES, Map.class).get(
- "attrName"));
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateTableCommandTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateTableCommandTest.java
deleted file mode 100644
index d10b1b8..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/UpdateTableCommandTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.DefaultExchange;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class UpdateTableCommandTest {
-
- private UpdateTableCommand command;
- private AmazonDDBClientMock ddbClient;
- private DdbConfiguration configuration;
- private Exchange exchange;
-
- @Before
- public void setUp() {
- ddbClient = new AmazonDDBClientMock();
- configuration = new DdbConfiguration();
- configuration.setTableName("DOMAIN1");
- configuration.setReadCapacity(20L);
- configuration.setWriteCapacity(30L);
- exchange = new DefaultExchange(new DefaultCamelContext());
-
- command = new UpdateTableCommand(ddbClient, configuration, exchange);
- }
-
- @Test
- public void testExecute() {
- command.execute();
-
- assertEquals("DOMAIN1", ddbClient.updateTableRequest.getTableName());
- assertEquals(Long.valueOf(20), ddbClient.updateTableRequest.getProvisionedThroughput().getReadCapacityUnits());
- assertEquals(Long.valueOf(30), ddbClient.updateTableRequest.getProvisionedThroughput().getWriteCapacityUnits());
- }
-}
\ No newline at end of file
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/integration/DdbComponentIntegrationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/integration/DdbComponentIntegrationTest.java
deleted file mode 100644
index 9bfe77b..0000000
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/ddb/integration/DdbComponentIntegrationTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.aws.ddb.integration;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.amazonaws.services.dynamodb.model.AttributeValue;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.aws.ddb.DdbConstants;
-import org.apache.camel.component.aws.ddb.DdbOperations;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
-
-@Ignore("Must be manually tested. Provide your own accessKey and secretKey!")
-public class DdbComponentIntegrationTest extends CamelTestSupport {
-
- @EndpointInject(uri = "direct:start")
- private ProducerTemplate template;
-
- @Test
- public void select() {
- final Map<String, AttributeValue> attributeMap = new HashMap<String, AttributeValue>();
- AttributeValue attributeValue = new AttributeValue("test value");
- attributeMap.put("name", attributeValue);
-
- Exchange exchange = template.send("direct:start", new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader(DdbConstants.OPERATION, DdbOperations.PutItem);
- exchange.getIn().setHeader(DdbConstants.RETURN_VALUES, "ALL_OLD");
- exchange.getIn().setHeader(DdbConstants.ITEM, attributeMap);
- }
- });
-
- assertNotNull(exchange.getIn().getHeader(DdbConstants.ITEMS, List.class));
- }
-
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start")
- .to("aws-ddb://TestTable?accessKey=xxx&secretKey=yyy");
- }
- };
- }
-}
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/integration/S3ComponentIntegrationTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/integration/S3ComponentIntegrationTest.java
index 3194b16..db13679 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/integration/S3ComponentIntegrationTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/s3/integration/S3ComponentIntegrationTest.java
@@ -42,18 +42,11 @@
@Test
public void sendInOnly() throws Exception {
- result.expectedMessageCount(2);
+ result.expectedMessageCount(1);
- Exchange exchange1 = template.send("direct:start", ExchangePattern.InOnly, new Processor() {
+ Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() {
public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader(S3Constants.KEY, "CamelUnitTest1");
- exchange.getIn().setBody("This is my bucket content.");
- }
- });
-
- Exchange exchange2 = template.send("direct:start", ExchangePattern.InOnly, new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader(S3Constants.KEY, "CamelUnitTest2");
+ exchange.getIn().setHeader(S3Constants.KEY, "CamelUnitTest");
exchange.getIn().setBody("This is my bucket content.");
}
});
@@ -61,10 +54,8 @@
assertMockEndpointsSatisfied();
assertResultExchange(result.getExchanges().get(0));
- assertResultExchange(result.getExchanges().get(1));
- assertResponseMessage(exchange1.getIn());
- assertResponseMessage(exchange2.getIn());
+ assertResponseMessage(exchange.getIn());
}
@Test
@@ -89,7 +80,7 @@
assertIsInstanceOf(InputStream.class, resultExchange.getIn().getBody());
assertEquals("This is my bucket content.", resultExchange.getIn().getBody(String.class));
assertEquals("mynewcamelbucket", resultExchange.getIn().getHeader(S3Constants.BUCKET_NAME));
- assertTrue(resultExchange.getIn().getHeader(S3Constants.KEY, String.class).startsWith("CamelUnitTest"));
+ assertEquals("CamelUnitTest", resultExchange.getIn().getHeader(S3Constants.KEY));
assertNull(resultExchange.getIn().getHeader(S3Constants.VERSION_ID)); // not enabled on this bucket
assertNotNull(resultExchange.getIn().getHeader(S3Constants.LAST_MODIFIED));
assertEquals("3a5c8b1ad448bca04584ecb55b836264", resultExchange.getIn().getHeader(S3Constants.E_TAG));
diff --git a/components/camel-bam/pom.xml b/components/camel-bam/pom.xml
index faa08b6..114a4db 100644
--- a/components/camel-bam/pom.xml
+++ b/components/camel-bam/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -60,7 +60,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java b/components/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
index 99da337..fafac9f 100644
--- a/components/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
+++ b/components/camel-bam/src/main/java/org/apache/camel/bam/processor/ActivityMonitorEngine.java
@@ -103,10 +103,11 @@
}
}
+ @SuppressWarnings("unchecked")
protected void fireExpiredEvent(final ActivityState activityState) {
LOG.debug("Trying to fire expiration of: {}", activityState);
- template.execute(new JpaCallback<Object>() {
+ template.execute(new JpaCallback() {
public Object doInJpa(EntityManager entityManager) throws PersistenceException {
// let's try locking the object first
if (isUseLocking()) {
diff --git a/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java b/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
index 2b6b669..e5a502e 100644
--- a/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
+++ b/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
@@ -22,7 +22,6 @@
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.TransactionStatus;
@@ -75,6 +74,7 @@
this.correlationKeyExpression = correlationKeyExpression;
}
+ @SuppressWarnings("unchecked")
public void process(final Exchange exchange) {
for (int i = 1; i <= retryCount; i++) {
if (i > 1) {
@@ -86,8 +86,8 @@
}
}
try {
- transactionTemplate.execute(new TransactionCallback<T>() {
- public T doInTransaction(TransactionStatus status) {
+ transactionTemplate.execute(new TransactionCallback() {
+ public Object doInTransaction(TransactionStatus status) {
try {
Object key = getCorrelationKey(exchange);
@@ -98,8 +98,7 @@
return entity;
} catch (Exception e) {
- onError(status, e);
- return null;
+ return onError(status, e);
}
}
});
@@ -145,7 +144,7 @@
return value;
}
- protected void onError(TransactionStatus status, Exception e) throws RuntimeCamelException {
+ protected Object onError(TransactionStatus status, Exception e) {
status.setRollbackOnly();
LOG.error("Caught: " + e, e);
throw wrapRuntimeCamelException(e);
diff --git a/components/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessorSupport.java b/components/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessorSupport.java
index f5d6005..ec4ba2c 100644
--- a/components/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessorSupport.java
+++ b/components/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessorSupport.java
@@ -178,7 +178,7 @@
* Create a new instance of the entity for the given key
*/
protected T createEntity(Exchange exchange, Object key) {
- return exchange.getContext().getInjector().newInstance(getEntityType());
+ return (T)exchange.getContext().getInjector().newInstance(getEntityType());
}
protected void processEntity(Exchange exchange, T entity) throws Exception {
diff --git a/components/camel-bam/src/main/java/org/apache/camel/bam/rules/TemporalRule.java b/components/camel-bam/src/main/java/org/apache/camel/bam/rules/TemporalRule.java
index 8d50391..0e182bb 100644
--- a/components/camel-bam/src/main/java/org/apache/camel/bam/rules/TemporalRule.java
+++ b/components/camel-bam/src/main/java/org/apache/camel/bam/rules/TemporalRule.java
@@ -50,9 +50,7 @@
private long expectedMillis;
private long overdueMillis;
private Processor overdueAction;
-
- @SuppressWarnings("rawtypes")
- private OutputDefinition<?> overdueProcessors = new OutputDefinition();
+ private OutputDefinition overdueProcessors = new OutputDefinition();
public TemporalRule(TimeExpression first, TimeExpression second) {
this.first = first;
@@ -68,11 +66,11 @@
return this;
}
- public OutputDefinition<?> errorIfOver(Time builder) {
+ public OutputDefinition errorIfOver(Time builder) {
return errorIfOver(builder.toMillis());
}
- public OutputDefinition<?> errorIfOver(long millis) {
+ public OutputDefinition errorIfOver(long millis) {
overdueMillis = millis;
return overdueProcessors;
}
diff --git a/components/camel-bam/src/test/java/org/apache/camel/bam/BamRouteTest.java b/components/camel-bam/src/test/java/org/apache/camel/bam/BamRouteTest.java
index 881c393..6d54d91 100644
--- a/components/camel-bam/src/test/java/org/apache/camel/bam/BamRouteTest.java
+++ b/components/camel-bam/src/test/java/org/apache/camel/bam/BamRouteTest.java
@@ -89,4 +89,9 @@
// END SNIPPET: example
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
}
diff --git a/components/camel-bean-validator/pom.xml b/components/camel-bean-validator/pom.xml
index 917d352..8473c95 100644
--- a/components/camel-bean-validator/pom.xml
+++ b/components/camel-bean-validator/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-beanio/pom.xml b/components/camel-beanio/pom.xml
deleted file mode 100644
index 057ce65..0000000
--- a/components/camel-beanio/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-beanio</artifactId>
- <packaging>bundle</packaging>
-
- <name>Camel :: BeanIO</name>
- <description>Camel BeanIO support</description>
- <url>http://www.beanio.org</url>
-
- <properties>
- <camel.osgi.export.pkg>
- org.apache.camel.dataformat.beanio.*;
- </camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.beanio</groupId>
- <artifactId>beanio</artifactId>
- <version>${beanio-version}</version>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
deleted file mode 100644
index 5ec90c1..0000000
--- a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.CamelContextAware;
-import org.apache.camel.Exchange;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.support.ServiceSupport;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ResourceHelper;
-import org.beanio.BeanReader;
-import org.beanio.BeanReaderErrorHandlerSupport;
-import org.beanio.BeanWriter;
-import org.beanio.InvalidRecordException;
-import org.beanio.StreamFactory;
-import org.beanio.UnexpectedRecordException;
-import org.beanio.UnidentifiedRecordException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A <a href="http://camel.apache.org/data-format.html">data format</a> (
- * {@link DataFormat}) for beanio data.
- */
-public class BeanIODataFormat extends ServiceSupport implements DataFormat, CamelContextAware {
-
- private static final String LOG_PREFIX = "BeanIO: ";
- private static final transient Logger LOG = LoggerFactory.getLogger(BeanIODataFormat.class);
-
- private transient CamelContext camelContext;
- private transient StreamFactory factory;
- private String streamName;
- private String mapping;
- private boolean ignoreUnidentifiedRecords;
- private boolean ignoreUnexpectedRecords;
- private boolean ignoreInvalidRecords;
- private Charset encoding = Charset.defaultCharset();
-
- public BeanIODataFormat() {
- }
-
- public BeanIODataFormat(String mapping, String streamName) {
- this.mapping = mapping;
- this.streamName = streamName;
- }
-
- @Override
- protected void doStart() throws Exception {
- ObjectHelper.notNull(streamName, "Stream name not configured.");
- if (factory == null) {
- // Create the stream factory that will be used to read/write objects.
- factory = StreamFactory.newInstance();
-
- // Load the mapping file using the resource helper to ensure it can be loaded in OSGi and other environments
- InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(getCamelContext().getClassResolver(), mapping);
- try {
- factory.load(is);
- } finally {
- IOHelper.close(is);
- }
- }
- }
-
- @Override
- protected void doStop() throws Exception {
- factory = null;
- }
-
- public CamelContext getCamelContext() {
- return camelContext;
- }
-
- public void setCamelContext(CamelContext camelContext) {
- this.camelContext = camelContext;
- }
-
- public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
- List<Object> models = getModels(exchange, body);
- writeModels(stream, models);
- }
-
- public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
- return readModels(exchange, stream);
- }
-
- @SuppressWarnings("unchecked")
- private List<Object> getModels(Exchange exchange, Object body) {
- List<Object> models;
- if ((models = exchange.getContext().getTypeConverter().convertTo(List.class, body)) == null) {
- models = new ArrayList<Object>();
- Iterator<Object> it = ObjectHelper.createIterator(body);
- while (it.hasNext()) {
- models.add(it.next());
- }
- }
- return models;
- }
-
- private void writeModels(OutputStream stream, List<Object> models) {
- BufferedWriter streamWriter = new BufferedWriter(new OutputStreamWriter(stream, encoding));
- BeanWriter out = factory.createWriter(streamName, streamWriter);
-
- for (Object obj : models) {
- out.write(obj);
- }
-
- out.flush();
- out.close();
- }
-
- private List<Object> readModels(Exchange exchange, InputStream stream) {
- List<Object> results = new ArrayList<Object>();
- BufferedReader streamReader = new BufferedReader(new InputStreamReader(stream, encoding));
-
- BeanReader in = factory.createReader(streamName, streamReader);
-
- try {
- registerErrorHandler(in);
-
- Object readObject;
- while ((readObject = in.read()) != null) {
- if (readObject instanceof BeanIOHeader) {
- exchange.getOut().getHeaders().putAll(((BeanIOHeader) readObject).getHeaders());
- }
- results.add(readObject);
- }
- } finally {
- in.close();
- }
-
- return results;
- }
-
- private void registerErrorHandler(BeanReader in) {
- in.setErrorHandler(new BeanReaderErrorHandlerSupport() {
-
- @Override
- public void invalidRecord(InvalidRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getContext().getRecordText());
-
- if (!ignoreInvalidRecords) {
- throw ex;
- }
- }
-
- @Override
- public void unexpectedRecord(UnexpectedRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getContext().getRecordText());
-
- if (!ignoreUnexpectedRecords) {
- throw ex;
- }
- }
-
- @Override
- public void unidentifiedRecord(UnidentifiedRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getContext().getRecordText());
-
- if (!ignoreUnidentifiedRecords) {
- throw ex;
- }
- }
- });
- }
-
- public Charset getEncoding() {
- return encoding;
- }
-
- public void setEncoding(Charset encoding) {
- this.encoding = encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = Charset.forName(encoding);
- }
-
- public boolean isIgnoreInvalidRecords() {
- return ignoreInvalidRecords;
- }
-
- public void setIgnoreInvalidRecords(boolean ignoreInvalidRecords) {
- this.ignoreInvalidRecords = ignoreInvalidRecords;
- }
-
- public boolean isIgnoreUnexpectedRecords() {
- return ignoreUnexpectedRecords;
- }
-
- public void setIgnoreUnexpectedRecords(boolean ignoreUnexpectedRecords) {
- this.ignoreUnexpectedRecords = ignoreUnexpectedRecords;
- }
-
- public boolean isIgnoreUnidentifiedRecords() {
- return ignoreUnidentifiedRecords;
- }
-
- public void setIgnoreUnidentifiedRecords(boolean ignoreUnidentifiedRecords) {
- this.ignoreUnidentifiedRecords = ignoreUnidentifiedRecords;
- }
-
- public String getMapping() {
- return mapping;
- }
-
- public void setMapping(String mapping) {
- this.mapping = mapping;
- }
-
- public String getStreamName() {
- return streamName;
- }
-
- public void setStreamName(String streamName) {
- this.streamName = streamName;
- }
-}
diff --git a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java
deleted file mode 100644
index 1c03efb8..0000000
--- a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIOHeader.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.util.Map;
-
-public interface BeanIOHeader {
-
- Map<String, Object> getHeaders();
-
-}
diff --git a/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt b/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100755
index 6b0b127..0000000
--- a/components/camel-beanio/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt b/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-beanio/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio b/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio
deleted file mode 100644
index f5f1bf8..0000000
--- a/components/camel-beanio/src/main/resources/META-INF/services/org/apache/camel/dataformat/beanio
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.dataformat.beanio.BeanIODataFormat
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java
deleted file mode 100644
index 3445df4..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/A1Record.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-public class A1Record extends Record {
- Double currentPrice;
-
- public A1Record() {
- }
-
- public A1Record(String sedol, String source, Double currentPrice) {
- super(sedol, source);
- this.currentPrice = currentPrice;
- }
-
- public Double getCurrentPrice() {
- return currentPrice;
- }
-
- public void setCurrentPrice(Double currentPrice) {
- this.currentPrice = currentPrice;
- }
-
- @Override
- public int hashCode() {
- return currentPrice != null ? currentPrice.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- } else if (obj == this) {
- return true;
- } else {
- A1Record record = (A1Record) obj;
- return super.equals(record) && this.currentPrice.doubleValue() == record.getCurrentPrice().doubleValue();
- }
- }
-
- @Override
- public String toString() {
- return "SEDOL[" + this.sedol + "], SOURCE[" + this.source + "], PRICE[" + this.currentPrice + "]";
- }
-}
\ No newline at end of file
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java
deleted file mode 100644
index 012fb9a..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/B1Record.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-public class B1Record extends Record {
- String securityName;
-
- public B1Record() {
- }
-
- public B1Record(String sedol, String source, String securityName) {
- super(sedol, source);
- this.securityName = securityName;
- }
-
- public String getSecurityName() {
- return securityName;
- }
-
- public void setSecurityName(String securityName) {
- this.securityName = securityName;
- }
-
- @Override
- public int hashCode() {
- return securityName != null ? securityName.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- } else if (obj == this) {
- return true;
- } else {
- B1Record record = (B1Record) obj;
- return super.equals(record) && this.securityName.equals(record.getSecurityName());
- }
- }
-
- @Override
- public String toString() {
- return "SEDOL[" + this.sedol + "], SOURCE[" + this.source + "], NAME[" + this.securityName + "]";
- }
-}
\ No newline at end of file
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java
deleted file mode 100644
index e5f69b9..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatComplexTest.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-
-import org.beanio.InvalidRecordException;
-import org.beanio.UnexpectedRecordException;
-import org.beanio.UnidentifiedRecordException;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class BeanIODataFormatComplexTest extends CamelTestSupport {
-
- private static Locale defaultLocale;
-
- private final String recordData = "0001917A112345.678900 " + LS
- + "0002374A159303290.020 " + LS
- + "0015219B1SECURITY ONE " + LS
- + "END OF SECTION 1 " + LS
- + "0076647A10.0000000001 " + LS
- + "0135515A1999999999999 " + LS
- + "2000815B1SECURITY TWO " + LS
- + "2207122B1SECURITY THR " + LS
- + "END OF FILE 000007 " + LS;
-
- private final String data = "0000000A1030808PRICE " + LS
- + "0000000B1030808SECURITY " + LS
- + "HEADER END " + LS
- + recordData;
-
- private final String unExpectedData = "0000000A1030808PRICE " + LS
- + "0000000B1030808SECURITY " + LS
- + "0000000B1030808SECURITY " + LS
- + "HEADER END " + LS
- + recordData;
-
- private final String invalidData = "0000000A1030808PRICE " + LS
- + "0000000B1030808SECURITY EXTRA DATA" + LS
- + "0000000B1030808SECURITY " + LS
- + "HEADER END " + LS
- + recordData;
-
- private final String unidentifiedData = "0000000A1030808PRICE " + LS
- + "0000000C1030808SECURITY " + LS
- + "0000000B1030808SECURITY " + LS
- + "HEADER END " + LS
- + recordData;
-
- @BeforeClass
- public static void setLocale() {
- if (!Locale.getDefault().equals(Locale.ENGLISH)) {
-
- // the Locale used for the number formatting of the above data is
- // english which could be other than the default locale
- defaultLocale = Locale.getDefault();
- Locale.setDefault(Locale.ENGLISH);
- }
- }
-
- @AfterClass
- public static void resetLocale() {
- if (defaultLocale != null) {
- Locale.setDefault(defaultLocale);
- }
- }
-
- @Test
- public void testMarshal() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:beanio-marshal");
- mock.expectedBodiesReceived(data);
-
- template.sendBody("direct:marshal", createTestData(false));
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshal() throws Exception {
- context.setTracing(true);
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(createTestData(false));
-
- template.sendBody("direct:unmarshal", data);
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshalUnexpected() throws Exception {
- Throwable ex = null;
-
- try {
- template.sendBody("direct:unmarshal", unExpectedData);
- } catch (Exception e) {
- ex = e.getCause();
- }
-
- assertIsInstanceOf(UnexpectedRecordException.class, ex);
- }
-
- @Test
- public void testUnmarshalInvalid() throws Exception {
- Throwable ex = null;
-
- try {
- template.sendBody("direct:unmarshal", invalidData);
- } catch (Exception e) {
- ex = e.getCause();
- }
-
- assertIsInstanceOf(InvalidRecordException.class, ex);
- }
-
- @Test
- public void testUnmarshalUnidentifiedIgnore() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(createTestData(false));
- template.sendBody("direct:unmarshal-forgiving", unidentifiedData);
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshalUnexpectedIgnore() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(createTestData(false));
- template.sendBody("direct:unmarshal-forgiving", unExpectedData);
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshalInvalidIgnore() throws Exception {
- context.setTracing(true);
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(createTestData(true));
- template.sendBody("direct:unmarshal-forgiving", invalidData);
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshalUnidentified() throws Exception {
- Throwable ex = null;
-
- try {
- template.sendBody("direct:unmarshal", unidentifiedData);
- } catch (Exception e) {
- ex = e.getCause();
- }
-
- assertIsInstanceOf(UnidentifiedRecordException.class, ex);
- }
-
- private List<Object> createTestData(boolean skipB1header) throws ParseException {
- String source = "camel-beanio";
- List<Object> body = new ArrayList<Object>();
-
- Date date = new SimpleDateFormat("ddMMyy").parse("030808");
- Header hFirst = new Header("A1", date, "PRICE");
- Header hSecond = new Header("B1", date, "SECURITY");
- Separator headerEnd = new Separator("HEADER END");
-
- A1Record first = new A1Record("0001917", source, 12345.678900);
- A1Record second = new A1Record("0002374", source, 59303290.020);
- B1Record third = new B1Record("0015219", source, "SECURITY ONE");
- Separator sectionEnd = new Separator("END OF SECTION 1");
- A1Record fourth = new A1Record("0076647", source, 0.0000000001);
- A1Record fifth = new A1Record("0135515", source, 999999999999d);
- B1Record sixth = new B1Record("2000815", source, "SECURITY TWO");
- B1Record seventh = new B1Record("2207122", source, "SECURITY THR");
-
- body.add(hFirst);
- if (!skipB1header) {
- body.add(hSecond);
- }
- body.add(headerEnd);
- body.add(first);
- body.add(second);
- body.add(third);
- body.add(sectionEnd);
- body.add(fourth);
- body.add(fifth);
- body.add(sixth);
- body.add(seventh);
-
- Trailer trailer = new Trailer(7);
- body.add(trailer);
-
- return body;
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- BeanIODataFormat format = new BeanIODataFormat("org/apache/camel/dataformat/beanio/mappings.xml", "securityData");
-
- BeanIODataFormat forgivingFormat = new BeanIODataFormat("org/apache/camel/dataformat/beanio/mappings.xml", "securityData");
- forgivingFormat.setIgnoreInvalidRecords(true);
- forgivingFormat.setIgnoreUnexpectedRecords(true);
- forgivingFormat.setIgnoreUnidentifiedRecords(true);
-
- from("direct:unmarshal").unmarshal(format).split(simple("body")).to("mock:beanio-unmarshal");
-
- from("direct:unmarshal-forgiving").unmarshal(forgivingFormat).split(simple("body")).to("mock:beanio-unmarshal");
-
- from("direct:marshal").marshal(format).to("mock:beanio-marshal");
- }
- };
- }
-}
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
deleted file mode 100644
index 4a475a5..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/BeanIODataFormatSimpleTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class BeanIODataFormatSimpleTest extends CamelTestSupport {
-
- private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + LS
- + "Jane,Doe,Architect,80000,01152008" + LS
- + "Jon,Anderson,Manager,85000,03182007" + LS;
-
- @Test
- public void testMarshal() throws Exception {
- List<Employee> employees = getEmployees();
-
- MockEndpoint mock = getMockEndpoint("mock:beanio-marshal");
- mock.expectedBodiesReceived(FIXED_DATA);
-
- template.sendBody("direct:marshal", employees);
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshal() throws Exception {
- List<Employee> employees = getEmployees();
-
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(employees);
-
- template.sendBody("direct:unmarshal", FIXED_DATA);
-
- mock.assertIsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- DataFormat format = new BeanIODataFormat(
- "org/apache/camel/dataformat/beanio/mappings.xml",
- "employeeFile");
-
- from("direct:unmarshal").unmarshal(format)
- .split(simple("body")).to("mock:beanio-unmarshal");
-
- from("direct:marshal").marshal(format)
- .to("mock:beanio-marshal");
- }
- };
- }
-
- private List<Employee> getEmployees() throws ParseException {
- List<Employee> employees = new ArrayList<Employee>();
- Employee one = new Employee();
- one.setFirstName("Joe");
- one.setLastName("Smith");
- one.setTitle("Developer");
- one.setSalary(75000);
- one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009"));
- employees.add(one);
-
- Employee two = new Employee();
- two.setFirstName("Jane");
- two.setLastName("Doe");
- two.setTitle("Architect");
- two.setSalary(80000);
- two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008"));
- employees.add(two);
-
- Employee three = new Employee();
- three.setFirstName("Jon");
- three.setLastName("Anderson");
- three.setTitle("Manager");
- three.setSalary(85000);
- three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007"));
- employees.add(three);
- return employees;
- }
-}
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java
deleted file mode 100644
index 8a952e6..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Employee.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.util.Date;
-
-public class Employee {
-
- private String firstName;
- private String lastName;
- private String title;
- private int salary;
- private Date hireDate;
-
- public Employee() {
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getSalary() {
- return salary;
- }
-
- public void setSalary(int salary) {
- this.salary = salary;
- }
-
- public Date getHireDate() {
- return hireDate;
- }
-
- public void setHireDate(Date hireDate) {
- this.hireDate = hireDate;
- }
-
- @Override
- public int hashCode() {
- int result = firstName != null ? firstName.hashCode() : 0;
- result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + salary;
- result = 31 * result + (hireDate != null ? hireDate.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object object) {
- if (object == null) {
- return false;
- } else if (object == this) {
- return true;
- } else if (!(object instanceof Employee)) {
- return false;
- }
-
- Employee e = (Employee) object;
-
- return this.getFirstName().equals(e.getFirstName())
- && this.getLastName().equals(e.getLastName())
- && this.getTitle().equals(e.getTitle())
- && this.getSalary() == e.getSalary()
- && this.getHireDate().equals(e.getHireDate());
- }
-}
\ No newline at end of file
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java
deleted file mode 100644
index d949942..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Header.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-public class Header implements BeanIOHeader {
-
- String identifier;
- String recordType;
- Date headerDate;
-
- public Header() {
- }
-
- public Header(String identifier, Date headerDate, String recordType) {
- this.identifier = identifier;
- this.headerDate = headerDate;
- this.recordType = recordType;
- }
-
- @Override
- public int hashCode() {
- int result = identifier != null ? identifier.hashCode() : 0;
- result = 31 * result + (recordType != null ? recordType.hashCode() : 0);
- result = 31 * result + (headerDate != null ? headerDate.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- } else if (obj == this) {
- return true;
- } else {
- Header record = (Header) obj;
- return identifier.equals(record.getIdentifier()) && recordType.equals(record.getRecordType());
- }
- }
-
- @Override
- public String toString() {
- return "TYPE[" + this.recordType + "], IDENTIFIER[" + this.identifier + "]";
- }
-
- /**
- * @return the identifier
- */
- public String getIdentifier() {
- return identifier;
- }
-
- /**
- * @param identifier the identifier to set
- */
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- /**
- * @return the headerDate
- */
- public Date getHeaderDate() {
- return headerDate;
- }
-
- /**
- * @param headerDate the headerDate to set
- */
- public void setHeaderDate(Date headerDate) {
- this.headerDate = headerDate;
- }
-
- /**
- * @return the recordType
- */
- public String getRecordType() {
- return recordType;
- }
-
- /**
- * @param recordType the recordType to set
- */
- public void setRecordType(String recordType) {
- this.recordType = recordType;
- }
-
- @Override
- public Map<String, Object> getHeaders() {
- Map<String, Object> headers = new HashMap<String, Object>();
- headers.put(recordType + "Date", headerDate);
- return headers;
- }
-}
\ No newline at end of file
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java
deleted file mode 100644
index 50ec28b..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Record.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-public abstract class Record {
- String sedol;
- String source;
-
- public Record() {
- }
-
- public Record(String sedol, String source) {
- this.sedol = sedol;
- this.source = source;
- }
-
- public String getSedol() {
- return sedol;
- }
-
- public void setSedol(String sedol) {
- this.sedol = sedol;
- }
-
- public String getSource() {
- return source;
- }
-
- public void setSource(String source) {
- this.source = source;
- }
-
- @Override
- public int hashCode() {
- int result = sedol != null ? sedol.hashCode() : 0;
- result = 31 * result + (source != null ? source.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- } else if (obj == this) {
- return true;
- } else {
- Record record = (Record) obj;
- return sedol.equals(record.getSedol()) && source.equals(record.getSource());
- }
- }
-}
-
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java
deleted file mode 100644
index 501f7e4a..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Separator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-public class Separator {
- String value;
-
- public Separator() {
- }
-
- public Separator(String value) {
- this.value = value;
- }
-
- @Override
- public int hashCode() {
- return value != null ? value.hashCode() : 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- } else if (obj == this) {
- return true;
- } else {
- Separator record = (Separator) obj;
- return this.value.equals(record.getValue());
- }
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-}
-
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java
deleted file mode 100644
index 929b66d..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelSpringTestSupport;
-import org.junit.Test;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class SpringBeanIODataFormatSimpleTest extends CamelSpringTestSupport {
-
- private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + LS
- + "Jane,Doe,Architect,80000,01152008" + LS
- + "Jon,Anderson,Manager,85000,03182007" + LS;
-
- @Override
- protected AbstractApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml");
- }
-
- @Test
- public void testMarshal() throws Exception {
- List<Employee> employees = getEmployees();
-
- MockEndpoint mock = getMockEndpoint("mock:beanio-marshal");
- mock.expectedBodiesReceived(FIXED_DATA);
-
- template.sendBody("direct:marshal", employees);
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshal() throws Exception {
- List<Employee> employees = getEmployees();
-
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(employees);
-
- template.sendBody("direct:unmarshal", FIXED_DATA);
-
- mock.assertIsSatisfied();
- }
-
- private List<Employee> getEmployees() throws ParseException {
- List<Employee> employees = new ArrayList<Employee>();
- Employee one = new Employee();
- one.setFirstName("Joe");
- one.setLastName("Smith");
- one.setTitle("Developer");
- one.setSalary(75000);
- one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009"));
- employees.add(one);
-
- Employee two = new Employee();
- two.setFirstName("Jane");
- two.setLastName("Doe");
- two.setTitle("Architect");
- two.setSalary(80000);
- two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008"));
- employees.add(two);
-
- Employee three = new Employee();
- three.setFirstName("Jon");
- three.setLastName("Anderson");
- three.setTitle("Manager");
- three.setSalary(85000);
- three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007"));
- employees.add(three);
- return employees;
- }
-}
diff --git a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java b/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java
deleted file mode 100644
index b6d2281..0000000
--- a/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/Trailer.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.dataformat.beanio;
-
-public class Trailer {
- int numberOfRecords;
-
- public Trailer() {
- }
-
- public Trailer(int numberOfRecords) {
- this.numberOfRecords = numberOfRecords;
- }
-
- @Override
- public int hashCode() {
- return numberOfRecords;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- } else if (obj == this) {
- return true;
- } else {
- Trailer record = (Trailer) obj;
- return this.numberOfRecords == record.getNumberOfRecords();
- }
- }
-
- /**
- * @return the numberOfRecords
- */
- public int getNumberOfRecords() {
- return numberOfRecords;
- }
-
- /**
- * @param numberOfRecords the numberOfRecords to set
- */
- public void setNumberOfRecords(int numberOfRecords) {
- this.numberOfRecords = numberOfRecords;
- }
-}
-
diff --git a/components/camel-beanio/src/test/resources/log4j.properties b/components/camel-beanio/src/test/resources/log4j.properties
deleted file mode 100644
index d44f242..0000000
--- a/components/camel-beanio/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, file
-
-#log4j.logger.org.apache.camel.dataformat.beanio=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d %-5p %c{1} - %m %n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
-log4j.appender.file.file=target/camel-beanio-test.log
-
diff --git a/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml b/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
deleted file mode 100644
index 710b32c..0000000
--- a/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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">
-
-<!-- START SNIPPET: e1 -->
- <camelContext xmlns="http://camel.apache.org/schema/spring">
- <!-- setup beanio data format -->
- <dataFormats>
- <beanio id="myBeanio" mapping="org/apache/camel/dataformat/beanio/mappings.xml" streamName="employeeFile"/>
- </dataFormats>
-
- <route>
- <from uri="direct:unmarshal"/>
- <unmarshal ref="myBeanio"/>
- <split>
- <simple>body</simple>
- <to uri="mock:beanio-unmarshal"/>
- </split>
- </route>
-
- <route>
- <from uri="direct:marshal"/>
- <marshal ref="myBeanio"/>
- <to uri="mock:beanio-marshal"/>
- </route>
- </camelContext>
- <!-- END SNIPPET: e1 -->
-
-</beans>
diff --git a/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml b/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml
deleted file mode 100644
index d2f1f0a..0000000
--- a/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<!--
- 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.
--->
-<beanio xmlns="http://www.beanio.org/2011/01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.beanio.org/2011/01 http://www.beanio.org/2011/01/mapping.xsd">
-
- <template name="A1Record">
- <field name="sedol" type="string" length="7"/>
- <field name="identifier" rid="true" literal="A1" ignore="true"/>
- <field name="currentPrice" type="double" length="12" format="0.000000####"/>
- <field name="padding" type="string" length="11" ignore="true"/>
- <property name="source" value="camel-beanio"/>
- </template>
-
- <template name="B1Record">
- <field name="sedol" type="string" length="7"/>
- <field name="identifier" rid="true" literal="B1" ignore="true"/>
- <field name="securityName" type="string" length="12"/>
- <field name="padding" type="string" length="11" ignore="true"/>
- <property name="source" value="camel-beanio"/>
- </template>
-
- <stream name="employeeFile" format="csv">
- <record name="employee" class="org.apache.camel.dataformat.beanio.Employee">
- <field name="firstName"/>
- <field name="lastName"/>
- <field name="title"/>
- <field name="salary"/>
- <field name="hireDate" format="MMddyyyy"/>
- </record>
- </stream>
-
- <stream name="securityData" format="fixedlength" ordered="true">
-
- <group name="headerGroup" minOccurs="1" maxOccurs="1" order="1">
-
- <record name="headerA1" class="org.apache.camel.dataformat.beanio.Header" order="1" minLength="32" maxLength="32"
- minOccurs="1" maxOccurs="1">
- <field name="zeros" type="string" length="7" literal="0000000" ignore="true"/>
- <field name="identifier" type="string" length="2" rid="true" literal="A1"/>
- <field name="headerDate" type="date" length="6" format="ddMMyy"/>
- <field name="recordType" type="string" length="17"/>
- </record>
-
- <record name="headerB1" class="org.apache.camel.dataformat.beanio.Header" order="2" minLength="32" maxLength="32"
- minOccurs="1" maxOccurs="1">
- <field name="zeros" type="string" length="7" literal="0000000" ignore="true"/>
- <field name="identifier" type="string" length="2" rid="true" literal="B1"/>
- <field name="headerDate" type="date" length="6" format="ddMMyy"/>
- <field name="recordType" type="string" length="17"/>
- </record>
-
- <!-- Ignore the HEADER END by not setting a class -->
- <record name="headerEnd" class="org.apache.camel.dataformat.beanio.Separator" order="3" minLength="32"
- maxLength="32" minOccurs="1" maxOccurs="1">
- <field name="value" rid="true" literal="HEADER END" default="HEADER END" required="true"/>
- <field name="padding" length="22" ignore="true"/>
- </record>
-
- </group>
-
- <group name="section1" minOccurs="1" maxOccurs="1" order="2">
-
- <record name="A1" template="A1Record"
- class="org.apache.camel.dataformat.beanio.A1Record" minOccurs="0"
- maxOccurs="unbounded" minLength="32" maxLength="32"/>
- <record name="B1" template="B1Record"
- class="org.apache.camel.dataformat.beanio.B1Record" minOccurs="0"
- maxOccurs="unbounded" minLength="32" maxLength="32"/>
-
- <record name="endOfUk" class="org.apache.camel.dataformat.beanio.Separator" minOccurs="1" maxOccurs="1"
- minLength="32" maxLength="32">
- <field name="value" rid="true" literal="END OF SECTION 1"/>
- <field name="padding" length="16" ignore="true"/>
- </record>
-
- </group>
-
- <group name="section2" minOccurs="1" maxOccurs="1" order="3">
-
- <record name="A1" template="A1Record"
- class="org.apache.camel.dataformat.beanio.A1Record" minOccurs="0"
- maxOccurs="unbounded" minLength="32" maxLength="32"/>
- <record name="B1" template="B1Record"
- class="org.apache.camel.dataformat.beanio.B1Record" minOccurs="0"
- maxOccurs="unbounded" minLength="32" maxLength="32"/>
-
- <record name="endOfFile" class="org.apache.camel.dataformat.beanio.Trailer" minOccurs="1" maxOccurs="1"
- minLength="32" maxLength="32">
- <field name="endOfFile" rid="true" literal="END OF FILE" ignore="true"/>
- <field name="spacer" literal=" " length="1" ignore="true"/>
- <field name="numberOfRecords" type="integer" length="6" format="000000"/>
- <field name="padding" length="14" ignore="true"/>
- </record>
-
- </group>
-
- </stream>
-
-</beanio>
\ No newline at end of file
diff --git a/components/camel-bindy/pom.xml b/components/camel-bindy/pom.xml
index a7d44ed..28aae85 100755
--- a/components/camel-bindy/pom.xml
+++ b/components/camel-bindy/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
index 70ed20d..3aef7aa 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java
@@ -195,9 +195,9 @@
}
/**
- * Format the object into a string according to the format rule defined
+ * Format the object into a string according to the format rue defined
*/
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public String formatString(Format format, Object value) throws Exception {
String strValue = "";
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 91ff31c..c358c8e 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -200,11 +200,7 @@
throw new IllegalArgumentException("Parsing error detected for field defined at the position: " + pos + ", line: " + line, e);
}
} else {
- if (!dataField.defaultValue().isEmpty()) {
- value = format.parse(dataField.defaultValue());
- } else {
- value = getDefaultValueForPrimitive(field.getType());
- }
+ value = getDefaultValueForPrimitive(field.getType());
}
field.set(modelField, value);
@@ -215,16 +211,17 @@
LOG.debug("Counter mandatory fields: {}", counterMandatoryFields);
+ if (pos < totalFields) {
+ throw new IllegalArgumentException("Some fields are missing (optional or mandatory), line: " + line);
+ }
+
if (counterMandatoryFields < numberMandatoryFields) {
throw new IllegalArgumentException("Some mandatory fields are missing, line: " + line);
}
- if (pos < totalFields) {
- setDefaultValuesForFields(model);
- }
-
}
+ @SuppressWarnings("unchecked")
public String unbind(Map<String, Object> model) throws Exception {
StringBuilder buffer = new StringBuilder();
@@ -239,7 +236,7 @@
LOG.debug("Separator converted: '0x{}', from: {}", Integer.toHexString(separator), this.getSeparator());
}
- for (Class<?> clazz : models) {
+ for (Class clazz : models) {
if (model.containsKey(clazz.getName())) {
Object obj = model.get(clazz.getName());
@@ -256,17 +253,17 @@
}
// Transpose result
- List<List<String>> l = new ArrayList<List<String>>();
+ List<List> l = new ArrayList<List>();
if (isOneToMany) {
l = product(results);
} else {
// Convert Map<Integer, List> into List<List>
- TreeMap<Integer, List<String>> sortValues = new TreeMap<Integer, List<String>>(results);
+ TreeMap<Integer, List> sortValues = new TreeMap<Integer, List>(results);
List<String> temp = new ArrayList<String>();
- for (Entry<Integer, List<String>> entry : sortValues.entrySet()) {
+ for (Entry<Integer, List> entry : sortValues.entrySet()) {
// Get list of values
- List<String> val = entry.getValue();
+ List<String> val = (List<String>)entry.getValue();
// For one to one relation
// There is only one item in the list
@@ -284,13 +281,13 @@
}
if (l != null) {
- Iterator<List<String>> it = l.iterator();
+ Iterator it = l.iterator();
while (it.hasNext()) {
- List<String> tokens = it.next();
- Iterator<String> itx = tokens.iterator();
+ List<String> tokens = (ArrayList<String>)it.next();
+ Iterator itx = tokens.iterator();
while (itx.hasNext()) {
- String res = itx.next();
+ String res = (String)itx.next();
if (res != null) {
// the field may be enclosed in quotes if a quote was configured
if (quote != null) {
@@ -316,10 +313,10 @@
return buffer.toString();
}
- private List<List<String>> product(Map<Integer, List<String>> values) {
- TreeMap<Integer, List<String>> sortValues = new TreeMap<Integer, List<String>>(values);
+ private List<List> product(Map<Integer, List<String>> values) {
+ TreeMap<Integer, List> sortValues = new TreeMap<Integer, List>(values);
- List<List<String>> product = new ArrayList<List<String>>();
+ List<List> product = new ArrayList<List>();
Map<Integer, Integer> index = new HashMap<Integer, Integer>();
int idx = 0;
@@ -369,7 +366,7 @@
* If a relation @OneToMany is defined, than we iterate recursively through this function
* The result is placed in the Map<Integer, List> results
*/
- private void generateCsvPositionMap(Class<?> clazz, Object obj, Map<Integer, List<String>> results) throws Exception {
+ private void generateCsvPositionMap(Class clazz, Object obj, Map<Integer, List<String>> results) throws Exception {
String result = "";
@@ -385,12 +382,12 @@
// Retrieve the format, pattern and precision associated to
// the type
- Class<?> type = field.getType();
+ Class type = field.getType();
String pattern = datafield.pattern();
int precision = datafield.precision();
// Create format
- Format<?> format = FormatFactory.getFormat(type, pattern, getLocale(), precision);
+ Format format = FormatFactory.getFormat(type, pattern, getLocale(), precision);
// Get field value
Object value = field.get(obj);
@@ -451,10 +448,10 @@
// Will be used during generation of CSV
isOneToMany = true;
- ArrayList<?> list = (ArrayList<?>)field.get(obj);
+ ArrayList list = (ArrayList)field.get(obj);
if (list != null) {
- Iterator<?> it = list.iterator();
+ Iterator it = list.iterator();
while (it.hasNext()) {
Object target = it.next();
generateCsvPositionMap(target.getClass(), target, results);
@@ -562,29 +559,6 @@
}
}
}
- /**
- * Set the default values for the non defined fields.
- * @param The model which has its default fields set.
- * @throws IllegalAccessException if the underlying fields are inaccessible
- * @throws Exception In case the field cannot be parsed
- */
- private void setDefaultValuesForFields(final Map<String, Object> model) throws IllegalAccessException,
- Exception {
- // Set the default values, if defined
- for (int i = 1; i <= dataFields.size(); i++) {
- Field field = annotatedFields.get(i);
- field.setAccessible(true);
- DataField dataField = dataFields.get(i);
- Object modelField = model.get(field.getDeclaringClass().getName());
- if (field.get(modelField) == null && !dataField.defaultValue().isEmpty()) {
- String pattern = dataField.pattern();
- Format<?> format = FormatFactory.getFormat(field.getType(), pattern, getLocale(),
- dataField.precision());
- Object value = format.parse(dataField.defaultValue());
- field.set(modelField, value);
- }
- }
- }
/**
* Find the separator used to delimit the CSV fields
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
index 9e5a67b..a1c3359 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyFixedLengthFactory.java
@@ -158,11 +158,11 @@
// Iterate through the list of positions
// defined in the @DataField
// and grab the data from the line
- Collection<DataField> c = dataFields.values();
- Iterator<DataField> itr = c.iterator();
+ Collection c = dataFields.values();
+ Iterator itr = c.iterator();
while (itr.hasNext()) {
- dataField = itr.next();
+ dataField = (DataField)itr.next();
offset = dataField.pos();
length = dataField.length();
@@ -251,7 +251,7 @@
StringBuilder buffer = new StringBuilder();
Map<Integer, List<String>> results = new HashMap<Integer, List<String>>();
- for (Class<?> clazz : models) {
+ for (Class clazz : models) {
if (model.containsKey(clazz.getName())) {
@@ -290,7 +290,7 @@
* Generate a table containing the data formatted and sorted with their position/offset
* The result is placed in the Map<Integer, List> results
*/
- private void generateFixedLengthPositionMap(Class<?> clazz, Object obj, Map<Integer, List<String>> results) throws Exception {
+ private void generateFixedLengthPositionMap(Class clazz, Object obj, Map<Integer, List<String>> results) throws Exception {
String result = "";
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
index d127b6e..19fe79d 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java
@@ -165,7 +165,7 @@
}
// Iterate over the model
- for (Class<?> clazz : models) {
+ for (Class clazz : models) {
Object obj = model.get(clazz.getName());
@@ -179,7 +179,7 @@
}
- private void generateModelFromKeyValueMap(Class<?> clazz, Object obj, Map<Integer, List<String>> results, int line, Map<String, List<Object>> lists) throws Exception {
+ private void generateModelFromKeyValueMap(Class clazz, Object obj, Map<Integer, List<String>> results, int line, Map<String, List<Object>> lists) throws Exception {
for (Field field : clazz.getDeclaredFields()) {
@@ -272,7 +272,7 @@
if (obj != null) {
// Relation OneToOne
- value = values.get(0);
+ value = (String)values.get(0);
Object result = null;
if (value != null) {
@@ -315,7 +315,7 @@
obj = clazz.newInstance();
}
- value = values.get(i);
+ value = (String)values.get(i);
// Get pattern defined for the field
String pattern = keyValuePairField.pattern();
@@ -379,7 +379,7 @@
if (!targetClass.equals("")) {
// Class cl = Class.forName(targetClass); Does not work in
// OSGI when class is defined in another bundle
- Class<?> cl = null;
+ Class cl = null;
try {
cl = Thread.currentThread().getContextClassLoader().loadClass(targetClass);
@@ -550,7 +550,7 @@
return builder.toString();
}
- private Object formatField(Format<?> format, String value, int tag, int line) throws Exception {
+ private Object formatField(Format format, String value, int tag, int line) throws Exception {
Object obj = null;
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
index 1870b2d..912eb09 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/DataField.java
@@ -96,9 +96,4 @@
* Indicates to clip data in the field if it exceeds the allowed length when using fixed length.
*/
boolean clip() default false;
-
- /**
- * Field's default value in case no value is set
- */
- String defaultValue() default "";
}
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index cab9392..e576e09 100755
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -28,6 +28,7 @@
import java.util.Scanner;
import org.apache.camel.Exchange;
+import org.apache.camel.converter.IOConverter;
import org.apache.camel.dataformat.bindy.BindyAbstractDataFormat;
import org.apache.camel.dataformat.bindy.BindyAbstractFactory;
import org.apache.camel.dataformat.bindy.BindyCsvFactory;
@@ -36,7 +37,6 @@
import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,7 +78,7 @@
// the body is not a prepared list so help a bit here and create one for us
if (exchange.getContext().getTypeConverter().convertTo(List.class, body) == null) {
models = new ArrayList<Map<String, Object>>();
- Iterator<Object> it = ObjectHelper.createIterator(body);
+ Iterator it = ObjectHelper.createIterator(body);
while (it.hasNext()) {
Object model = it.next();
String name = model.getClass().getName();
diff --git a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
index 89488c1..b41e630 100644
--- a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
+++ b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
@@ -67,7 +67,7 @@
// the body is not a prepared list so help a bit here and create one for us
if (exchange.getContext().getTypeConverter().convertTo(List.class, body) == null) {
models = new ArrayList<Map<String, Object>>();
- Iterator<?> it = ObjectHelper.createIterator(body);
+ Iterator it = ObjectHelper.createIterator(body);
while (it.hasNext()) {
Object model = it.next();
String name = model.getClass().getName();
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
index 6c960e5..137f1b5 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCarQuoteAndCommaDelimiterTest.java
@@ -51,7 +51,7 @@
assertMockEndpointsSatisfied();
- Map<?, ?> map1 = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map1 = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
Car rec1 = (Car) map1.values().iterator().next();
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
index 3a376eb..651a14d 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyCsvBigFileUnmarshallTest.java
@@ -46,7 +46,7 @@
protected void assertCountRecords() {
Exchange exchange = resultEndpoint.getExchanges().get(0);
- List<?> models = exchange.getIn().getBody(List.class);
+ List models = exchange.getIn().getBody(List.class);
assertEquals(10000, models.size());
}
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
index 37a2bb0..90114c9 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyInlinedQuotesCsvUnmarshallTest.java
@@ -55,7 +55,7 @@
result.expectedMessageCount(1);
result.assertIsSatisfied();
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
BindyDoubleQuotesCsvUnmarshallTest.Order order = (BindyDoubleQuotesCsvUnmarshallTest.Order) map.values().iterator().next();
Assert.assertEquals(10, order.getOrderNr());
Assert.assertEquals("Pauline", order.getFirstName());
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
index 552937b..1d28fe5 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyPipeDelimiterTest.java
@@ -40,8 +40,8 @@
assertMockEndpointsSatisfied();
- Map<?, ?> map1 = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
- Map<?, ?> map2 = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(1);
+ Map map1 = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map2 = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(1);
MyData rec1 = (MyData) map1.values().iterator().next();
MyData rec2 = (MyData) map2.values().iterator().next();
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
index f0fdcb5..962ed52 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindySimpleCsvUnmarshallTest.java
@@ -16,9 +16,6 @@
*/
package org.apache.camel.dataformat.bindy.csv;
-import java.util.List;
-import java.util.Map;
-
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
@@ -27,7 +24,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.dataformat.bindy.format.FormatException;
-import org.apache.camel.dataformat.bindy.model.simple.oneclass.Order;
import org.apache.camel.processor.interceptor.Tracer;
import org.apache.camel.test.junit4.TestSupport;
import org.junit.Test;
@@ -35,10 +31,7 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
@ContextConfiguration
public class BindySimpleCsvUnmarshallTest extends AbstractJUnit4SpringContextTests {
@@ -107,32 +100,6 @@
}
- @SuppressWarnings("unchecked")
- @Test
- @DirtiesContext
- public void testUnMarshallMessageWithMissingFields() throws Exception {
-
- // We suppress the firstName field of the first record
- expected = "01,,,Cartier,ISIN,BE12345678,SELL,,1500,EUR\r\n" + "02,A1,,Preud'Homme,ISIN,XD12345678,BUY,,2500,USD,08-01-2009\r\n"
- + "03,A2,Jacques,,,BE12345678,SELL,,1500,EUR,08-01-2009\r\n" + "04,A3,Michel,Dupond,,,BUY,,2500,USD,08-01-2009\r\n"
- + "05,A4,Annie,Dutronc,ISIN,BE12345678,,,1500,EUR,08-01-2009\r\n" + "06,A5,Andr" + "\uc3a9" + ",Rieux,ISIN,XD12345678,SELL,Share,,USD,08-01-2009\r\n"
- + "07,A6,Myl" + "\uc3a8" + "ne,Farmer,ISIN,BE12345678,BUY,1500,,,08-01-2009\r\n" + "08,A7,Eva,Longoria,ISIN,XD12345678,SELL,Share,2500,USD,\r\n"
- + ",,,D,,BE12345678,SELL,,,,08-01-2009\r\n" + ",,,D,ISIN,BE12345678,,,,,08-01-2009\r\n" + ",,,D,ISIN,LU123456789,,,,,\r\n"
- + "10,A8,Pauline,M,ISIN,XD12345678,SELL,Share,2500,USD,08-01-2009\r\n" + "10,A9,Pauline,M,ISIN,XD12345678,BUY,Share,2500.45";
-
- template.sendBody(expected);
-
- List<Map<String, Order>> orders = (List<Map<String, Order>>) result.getExchanges().get(0).getIn().getBody();
-
- result.expectedMessageCount(1);
- result.assertIsSatisfied();
-
- assertNotNull(orders);
- // As the @DataField defines a default value for the firstName, the
- // value might not be empty
- assertFalse(orders.get(0).get(Order.class.getName()).getFirstName().isEmpty());
- }
-
public static class ContextConfig extends RouteBuilder {
BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat("org.apache.camel.dataformat.bindy.model.simple.oneclass");
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
index 9326fdd..670ea5b 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv/BindyTabSeparatorTest.java
@@ -41,8 +41,8 @@
assertMockEndpointsSatisfied();
- List<Map<?, PurchaseOrder>> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
- PurchaseOrder order = rows.get(0).get(PurchaseOrder.class.getName());
+ List<Map> rows = CastUtils.cast(mock.getReceivedExchanges().get(0).getIn().getBody(List.class));
+ PurchaseOrder order = (PurchaseOrder) rows.get(0).get(PurchaseOrder.class.getName());
assertEquals(123, order.getId());
assertEquals("Camel in Action", order.getName());
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
index f2b471b..cebc576 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/csv2/BindyUnmarshalCommaIssueTest.java
@@ -40,7 +40,7 @@
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
WeatherModel model = (WeatherModel) map.values().iterator().next();
assertEquals(123, model.getId());
@@ -58,7 +58,7 @@
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
WeatherModel model = (WeatherModel) map.values().iterator().next();
assertEquals(123, model.getId());
@@ -76,7 +76,7 @@
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
WeatherModel model = (WeatherModel) map.values().iterator().next();
assertEquals(123, model.getId());
@@ -94,7 +94,7 @@
assertMockEndpointsSatisfied();
- Map<?, ?> map = (Map<?, ?>) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) mock.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
WeatherModel model = (WeatherModel) map.values().iterator().next();
assertEquals(123, model.getId());
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
index f2ebdc1..99fd2c2 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fix/BindyComplexKeyValuePairStandaloneTest.java
@@ -40,7 +40,7 @@
private static final transient Logger LOG = LoggerFactory.getLogger(BindyComplexKeyValuePairStandaloneTest.class);
protected Map<String, Object> model = new HashMap<String, Object>();
- protected Set<Class<?>> models = new HashSet<Class<?>>();
+ protected Set<Class> models = new HashSet<Class>();
BindyKeyValuePairFactory factory;
int counter;
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
index a74abeb..fa83ce4 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trim/BindySimpleFixedLengthUnmarshallTest.java
@@ -61,7 +61,7 @@
result.assertIsSatisfied();
// check the model
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
BindySimpleFixedLengthUnmarshallTest.Order order = (BindySimpleFixedLengthUnmarshallTest.Order) map.values().iterator().next();
Assert.assertEquals(10, order.getOrderNr());
// the field is not trimmed
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
index 7f65c8d..d950480 100644
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/fixed/unmarshall/simple/trimfield/BindySimpleFixedLengthUnmarshallTrimFieldTest.java
@@ -61,7 +61,7 @@
result.assertIsSatisfied();
// check the model
- Map<?, ?> map = (Map<?, ?>) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
+ Map map = (Map) result.getReceivedExchanges().get(0).getIn().getBody(List.class).get(0);
BindySimpleFixedLengthUnmarshallTrimFieldTest.Order order = (BindySimpleFixedLengthUnmarshallTrimFieldTest.Order) map.values().iterator().next();
Assert.assertEquals(10, order.getOrderNr());
// the field is not trimmed
diff --git a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
index 0b3369e..ea20f4f 100755
--- a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
+++ b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclass/Order.java
@@ -31,7 +31,7 @@
@DataField(pos = 2)
private String clientNr;
- @DataField(pos = 3, defaultValue = "Joe")
+ @DataField(pos = 3)
private String firstName;
@DataField(pos = 4)
diff --git a/components/camel-blueprint/pom.xml b/components/camel-blueprint/pom.xml
index de630e5..f7c2d86 100644
--- a/components/camel-blueprint/pom.xml
+++ b/components/camel-blueprint/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
index a061b52..92858bc 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintContainerRegistry.java
@@ -74,7 +74,7 @@
for (String id : ids) {
try {
ComponentMetadata metadata = blueprintContainer.getComponentMetadata(id);
- Class<?> cl = null;
+ Class cl = null;
if (metadata instanceof BeanMetadata) {
BeanMetadata beanMetadata = (BeanMetadata)metadata;
cl = bundle.loadClass(beanMetadata.getClassName());
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
index ac15b2a..edce646 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
@@ -64,7 +64,7 @@
String id = (String) componentId;
ComponentMetadata meta = container.getComponentMetadata(id);
if (meta instanceof ExtendedBeanMetadata) {
- Class<?> clazz = ((ExtendedBeanMetadata) meta).getRuntimeClass();
+ Class clazz = ((ExtendedBeanMetadata) meta).getRuntimeClass();
if (clazz != null && AbstractPropertyPlaceholder.class.isAssignableFrom(clazz)) {
ids.add(id);
}
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesResolver.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesResolver.java
index dc2bd8d..c2b9c61 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesResolver.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesResolver.java
@@ -40,7 +40,7 @@
}
@Override
- public Properties resolveProperties(CamelContext context, boolean ignoreMissingLocation, String... urls) throws Exception {
+ public Properties resolveProperties(CamelContext context, String... urls) throws Exception {
Properties answer = new Properties();
boolean explicit = false;
@@ -53,7 +53,7 @@
explicit = true;
} else {
// delegate the url
- answer.putAll(delegate.resolveProperties(context, ignoreMissingLocation, url));
+ answer.putAll(delegate.resolveProperties(context, url));
}
}
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
index 95bd242..be094cc 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -92,15 +92,12 @@
@XmlAttribute(required = false)
private String useBreadcrumb;
@XmlAttribute(required = false)
- private String managementNamePattern;
- @XmlAttribute(required = false)
private Boolean useBlueprintPropertyResolver;
@XmlAttribute(required = false)
private ShutdownRoute shutdownRoute;
@XmlAttribute(required = false)
private ShutdownRunningTask shutdownRunningTask;
@XmlAttribute(required = false)
- @Deprecated
private Boolean lazyLoadTypeConverters = Boolean.FALSE;
@XmlElement(name = "properties", required = false)
private PropertiesDefinition properties;
@@ -121,7 +118,7 @@
@XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false),
@XmlElement(name = "errorHandler", type = CamelErrorHandlerFactoryBean.class, required = false)
})
- private List<?> beans;
+ private List beans;
@XmlElement(name = "routeBuilder", required = false)
private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
@XmlElement(name = "routeContextRef", required = false)
@@ -158,7 +155,7 @@
private boolean implicitId;
- public Class<BlueprintCamelContext> getObjectType() {
+ public Class getObjectType() {
return BlueprintCamelContext.class;
}
@@ -310,20 +307,10 @@
this.useBreadcrumb = useBreadcrumb;
}
- public String getManagementNamePattern() {
- return managementNamePattern;
- }
-
- public void setManagementNamePattern(String managementNamePattern) {
- this.managementNamePattern = managementNamePattern;
- }
-
- @Deprecated
public Boolean getLazyLoadTypeConverters() {
return lazyLoadTypeConverters;
}
- @Deprecated
public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
this.lazyLoadTypeConverters = lazyLoadTypeConverters;
}
@@ -464,11 +451,11 @@
this.camelJMXAgent = camelJMXAgent;
}
- public List<?> getBeans() {
+ public List getBeans() {
return beans;
}
- public void setBeans(List<?> beans) {
+ public void setBeans(List beans) {
this.beans = beans;
}
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
index 985cf8e..e94faed 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelErrorHandlerFactoryBean.java
@@ -104,8 +104,9 @@
}
@Override
+ @SuppressWarnings("unchecked")
public Class<? extends ErrorHandlerBuilder> getObjectType() {
- return type.getTypeAsClass();
+ return (Class<ErrorHandlerBuilder>) type.getTypeAsClass();
}
public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
index 7f4ca99..6d664be 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelProxyFactoryBean.java
@@ -93,7 +93,7 @@
try {
producer = endpoint.createProducer();
ServiceHelper.startService(producer);
- Class<?> clazz = blueprintContainer.loadClass(getServiceInterface());
+ Class clazz = blueprintContainer.loadClass(getServiceInterface());
serviceProxy = ProxyHelper.createProxy(endpoint, producer, clazz);
} catch (Exception e) {
throw new FailedToCreateProducerException(endpoint, e);
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ErrorHandlerType.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ErrorHandlerType.java
index 8fb3eae..b5538fe 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ErrorHandlerType.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ErrorHandlerType.java
@@ -21,7 +21,6 @@
import org.apache.camel.builder.DeadLetterChannelBuilder;
import org.apache.camel.builder.DefaultErrorHandlerBuilder;
-import org.apache.camel.builder.ErrorHandlerBuilder;
import org.apache.camel.builder.LoggingErrorHandlerBuilder;
import org.apache.camel.builder.NoErrorHandlerBuilder;
@@ -41,7 +40,7 @@
*
* @return the class which represents the selected type.
*/
- public Class<? extends ErrorHandlerBuilder> getTypeAsClass() {
+ public Class getTypeAsClass() {
switch (this) {
case DefaultErrorHandler:
return DefaultErrorHandlerBuilder.class;
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java
index dbd1d1e..c37d1b5 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java
@@ -54,7 +54,7 @@
*/
public void appendBuilders(List<RoutesBuilder> list) throws IllegalAccessException, InstantiationException {
Set<Class<?>> classes = resolver.findImplementations(RoutesBuilder.class, packages);
- for (Class<?> aClass : classes) {
+ for (Class aClass : classes) {
LOG.trace("Found RouteBuilder class: {}", aClass);
// certain beans should be ignored
@@ -94,7 +94,7 @@
/**
* Returns <tt>true</tt>if the class is a public, non-abstract class
*/
- protected boolean isValidClass(Class<?> type) {
+ protected boolean isValidClass(Class type) {
// should skip non public classes
if (!Modifier.isPublic(type.getModifiers())) {
return false;
@@ -106,7 +106,8 @@
return false;
}
- protected RoutesBuilder instantiateBuilder(Class<?> type) throws IllegalAccessException, InstantiationException {
+ @SuppressWarnings("unchecked")
+ protected RoutesBuilder instantiateBuilder(Class type) throws IllegalAccessException, InstantiationException {
return (RoutesBuilder) camelContext.getInjector().newInstance(type);
}
}
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
index bf7d7c8..5917b73 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
@@ -126,7 +126,7 @@
return getClass().getClassLoader().getResource("camel-blueprint.xsd");
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public Set<Class> getManagedClasses() {
return new HashSet<Class>(Arrays.asList(BlueprintCamelContext.class));
}
@@ -403,7 +403,7 @@
if (beans != null) {
for (Object bean : beans) {
if (bean instanceof AbstractCamelFactoryBean) {
- registerBean(context, contextId, (AbstractCamelFactoryBean<?>) bean);
+ registerBean(context, contextId, (AbstractCamelFactoryBean) bean);
}
}
}
@@ -462,7 +462,7 @@
protected JAXBContext createJaxbContext() throws JAXBException {
StringBuilder packages = new StringBuilder();
- for (Class<?> cl : getJaxbPackages()) {
+ for (Class cl : getJaxbPackages()) {
if (packages.length() > 0) {
packages.append(":");
}
@@ -471,8 +471,8 @@
return JAXBContext.newInstance(packages.toString(), getClass().getClassLoader());
}
- protected Set<Class<?>> getJaxbPackages() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
+ protected Set<Class> getJaxbPackages() {
+ Set<Class> classes = new HashSet<Class>();
classes.add(CamelContextFactoryBean.class);
classes.add(AbstractCamelContextFactoryBean.class);
classes.add(org.apache.camel.ExchangePattern.class);
@@ -538,7 +538,7 @@
* @param bean the bean to be injected
*/
protected void injectFields(final Object bean, final String beanName) {
- Class<?> clazz = bean.getClass();
+ Class clazz = bean.getClass();
do {
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
@@ -579,7 +579,7 @@
}
protected void injectMethods(final Object bean, final String beanName) {
- Class<?> clazz = bean.getClass();
+ Class clazz = bean.getClass();
do {
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
@@ -759,10 +759,10 @@
}
}
- @SuppressWarnings({"rawtypes"})
- private void findOutputComponents(List<ProcessorDefinition<?>> defs, Set<String> components, Set<String> languages, Set<String> dataformats) {
+ @SuppressWarnings("unchecked")
+ private void findOutputComponents(List<ProcessorDefinition> defs, Set<String> components, Set<String> languages, Set<String> dataformats) {
if (defs != null) {
- for (ProcessorDefinition<?> def : defs) {
+ for (ProcessorDefinition def : defs) {
if (def instanceof SendDefinition) {
findUriComponent(((SendDefinition) def).getUri(), components);
}
@@ -797,7 +797,7 @@
findLanguage(((SortDefinition) def).getExpression(), languages);
}
if (def instanceof WireTapDefinition) {
- findLanguage(((WireTapDefinition<?>) def).getNewExchangeExpression(), languages);
+ findLanguage(((WireTapDefinition) def).getNewExchangeExpression(), languages);
}
findOutputComponents(def.getOutputs(), components, languages, dataformats);
}
diff --git a/components/camel-cache/pom.xml b/components/camel-cache/pom.xml
index 37739a5..2d7b9c2 100755
--- a/components/camel-cache/pom.xml
+++ b/components/camel-cache/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-cache</artifactId>
diff --git a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
index 549868f..1369f1f 100755
--- a/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
+++ b/components/camel-cache/src/main/java/org/apache/camel/component/cache/CacheConfiguration.java
@@ -64,7 +64,7 @@
setCacheName(uri.getHost());
- Map<String, Object> cacheSettings = URISupport.parseParameters(uri);
+ Map cacheSettings = URISupport.parseParameters(uri);
if (cacheSettings.containsKey("maxElementsInMemory")) {
setMaxElementsInMemory(Integer.valueOf((String) cacheSettings.get("maxElementsInMemory")).intValue());
}
diff --git a/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java b/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
index 189998d..e6b4c6a 100755
--- a/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
+++ b/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.cache;
+import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -29,10 +30,7 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Test;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +57,8 @@
template.send("direct:a", new Processor() {
public void process(Exchange exchange) throws Exception {
// Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream(path)); // "./src/test/resources/test.txt"));
+ InputStream is = new BufferedInputStream(
+ new FileInputStream(path)); // "./src/test/resources/test.txt"));
byte buffer[] = IOConverter.toBytes(is);
is.close();
@@ -82,7 +81,7 @@
private byte[] getFileAsByteArray(String path) throws Exception {
// Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream(path));
+ InputStream is = new BufferedInputStream(new FileInputStream(path));
byte[] buffer = IOConverter.toBytes(is);
is.close();
diff --git a/components/camel-castor/pom.xml b/components/camel-castor/pom.xml
index 2387056..b1b5163 100644
--- a/components/camel-castor/pom.xml
+++ b/components/camel-castor/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -50,10 +50,16 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
diff --git a/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java b/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java
index 9e8c7f4..c3ee59d 100644
--- a/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java
+++ b/components/camel-castor/src/main/java/org/apache/camel/dataformat/castor/AbstractCastorDataFormat.java
@@ -89,7 +89,7 @@
}
if (getClassNames() != null) {
for (String name : getClassNames()) {
- Class<?> clazz = resolver.resolveClass(name);
+ Class clazz = resolver.resolveClass(name);
xmlContext.addClass(clazz);
}
}
diff --git a/components/camel-cdi/pom.xml b/components/camel-cdi/pom.xml
deleted file mode 100644
index bf41df2..0000000
--- a/components/camel-cdi/pom.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-cdi</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: CDI</name>
- <description>Camel CDI</description>
-
- <properties>
- <camel.osgi.export.pkg>
- org.apache.camel.component.cdi.*;${camel.osgi.version}
- </camel.osgi.export.pkg>
- <camel.osgi.import.pkg>
- !org.apache.camel.component.cdi.*,
- ${camel.osgi.import.defaults},
- *
- </camel.osgi.import.pkg>
- <openwebbeans.version>1.1.4-SNAPSHOT</openwebbeans.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- </dependency>
-
- <!-- JSR-299 Impl -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-impl</artifactId>
- <version>${openwebbeans.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- SPI API -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-spi</artifactId>
- <version>${openwebbeans.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- Interceptor API -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.1_spec</artifactId>
- <version>1.0</version>
- </dependency>
-
- <!-- EL Plugin -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-el10</artifactId>
- <version>${openwebbeans.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <!-- JSR-299 API -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- JSR-330 API -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <!-- Test -->
- <dependency>
- <groupId>org.apache.openwebbeans.test</groupId>
- <artifactId>cditest</artifactId>
- <version>${openwebbeans.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans.test</groupId>
- <artifactId>cditest-owb</artifactId>
- <version>${openwebbeans.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_2.5_spec</artifactId>
- <version>1.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <defaultGoal>install</defaultGoal>
- </build>
-</project>
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java b/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java
deleted file mode 100644
index ad0f892..0000000
--- a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.cdi;
-
-import java.util.Map;
-
-import org.apache.camel.component.cdi.util.BeanProvider;
-import org.apache.camel.spi.Registry;
-import org.apache.camel.util.ObjectHelper;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * CdiBeanRegistry used by Camel to perform lookup into the
- * Cdi BeanManager. The BeanManager must be passed as argument
- * to the CdiRegistry constructor.
- */
-public class CdiBeanRegistry implements Registry {
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- /**
- * @see org.apache.camel.spi.Registry#lookup(java.lang.String)
- */
- @Override
- public Object lookup(final String name) {
- ObjectHelper.notEmpty(name, "name");
- log.trace("Looking up bean using name = [{}] in CDI registry ...", name);
-
- return BeanProvider.getContextualReference(name, true);
- }
-
- @Override
- public <T> T lookup(final String name, final Class<T> type) {
- ObjectHelper.notEmpty(name, "name");
- ObjectHelper.notNull(type, "type");
- return type.cast(lookup(name));
- }
-
- @Override
- public <T> Map<String, T> lookupByType(final Class<T> type) {
- ObjectHelper.notNull(type, "type");
- return BeanProvider.getContextualNamesReferences(type, true, true);
- }
-
- @Override
- public String toString() {
- return "CdiRegistry[" + System.identityHashCode(this) + "]";
- }
-}
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiCamelContext.java b/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiCamelContext.java
deleted file mode 100644
index 265851f..0000000
--- a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiCamelContext.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.cdi;
-
-import org.apache.camel.impl.DefaultCamelContext;
-
-/**
- * CDI Camel Context class
- * Register the CDI BeanManager to lookup CDI Beans
- */
-public class CdiCamelContext extends DefaultCamelContext {
-
- public CdiCamelContext() {
- super.setRegistry(new CdiBeanRegistry());
- }
-
-
-}
\ No newline at end of file
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java b/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java
deleted file mode 100644
index 6f7a30e..0000000
--- a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/AnyLiteral.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.cdi.util;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.util.AnnotationLiteral;
-
-public class AnyLiteral extends AnnotationLiteral<Any> {
- private static final long serialVersionUID = 1L;
-}
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java b/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java
deleted file mode 100644
index 0d0bd48..0000000
--- a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanManagerProvider.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.cdi.util;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.BeforeShutdown;
-import javax.enterprise.inject.spi.Extension;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-
-/**
- * <p>This class provides access to the {@link BeanManager}
- * by registering the current {@link BeanManager} in an extension and
- * making it available via a singleton factory for the current application.</p>
- * <p>This is really handy if you like to access CDI functionality
- * from places where no injection is available.</p>
- * <p>If a simple but manual bean-lookup is needed, it's easier to use the {@link BeanProvider}.</p>
- * <p/>
- * <p>As soon as an application shuts down, the reference to the {@link BeanManager} will be removed.<p>
- * <p/>
- * <p>Usage:<p/>
- * <pre>
- * BeanManager bm = BeanManagerProvider.getInstance().getBeanManager();
- * </pre>
- */
-public class BeanManagerProvider implements Extension {
- private static BeanManagerProvider bmp;
-
- private volatile Map<ClassLoader, BeanManager> bms = new ConcurrentHashMap<ClassLoader, BeanManager>();
-
- /**
- * Returns if the {@link BeanManagerProvider} has been initialized.
- * Usually it isn't needed to call this method in application code.
- * It's e.g. useful for other frameworks to check if DeltaSpike and the CDI container in general have been started.
- *
- * @return true if the bean-manager-provider is ready to be used
- */
- public static boolean isActive() {
- return bmp != null;
- }
-
- /**
- * Allows to get the current provider instance which provides access to the current {@link BeanManager}
- *
- * @return the singleton BeanManagerProvider
- * @throws IllegalStateException if the {@link BeanManagerProvider} isn't ready to be used.
- * That's the case if the environment isn't configured properly and therefore the {@link AfterBeanDiscovery}
- * hasn't be called before this method gets called.
- */
- public static BeanManagerProvider getInstance() {
- if (bmp == null) {
- //X TODO Java-EE5 support needs to be discussed
- // workaround for some Java-EE5 environments in combination with a special
- // StartupBroadcaster for bootstrapping CDI
-
- // CodiStartupBroadcaster.broadcastStartup();
- // here bmp might not be null (depends on the broadcasters)
- }
- if (bmp == null) {
- throw new IllegalStateException("No " + BeanManagerProvider.class.getName() + " in place! "
- + "Please ensure that you configured the CDI implementation of your choice properly. "
- + "If your setup is correct, please clear all caches and compiled artifacts.");
- }
- return bmp;
- }
-
-
- /**
- * The active {@link BeanManager} for the current application (/{@link ClassLoader})
- *
- * @return the current bean-manager
- */
- public BeanManager getBeanManager() {
- ClassLoader classLoader = getClassLoader();
-
- BeanManager result = bms.get(classLoader);
-
- if (result == null) {
- result = resolveBeanManagerViaJndi();
-
- if (result != null) {
- bms.put(classLoader, result);
- }
- }
- return result;
- }
-
- public static ClassLoader getClassLoader() {
- ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- /**
- * {@inheritDoc}
- */
- @Override
- public ClassLoader run() {
- try {
- return Thread.currentThread().getContextClassLoader();
- } catch (Exception e) {
- return null;
- }
- }
- }
- );
-
- if (loader == null) {
- loader = BeanManagerProvider.class.getClassLoader();
- }
-
- return loader;
- }
-
- /**
- * It basically doesn't matter which of the system events we use,
- * but basically we use the {@link AfterBeanDiscovery} event since it allows to use the
- * {@link BeanManagerProvider} for all events which occur after the {@link AfterBeanDiscovery} event.
- *
- * @param afterBeanDiscovery event which we don't actually use ;)
- * @param beanManager the BeanManager we store and make available.
- */
- protected void setBeanManager(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) {
- BeanManagerProvider bmpFirst = setBeanManagerProvider(this);
-
- ClassLoader cl = getClassLoader();
- bmpFirst.bms.put(cl, beanManager);
-
- //X TODO Java-EE5 support needs to be discussed
- //CodiStartupBroadcaster.broadcastStartup();
- }
-
- /**
- * Cleanup on container shutdown
- *
- * @param beforeShutdown cdi shutdown event
- */
- protected void cleanupStoredBeanManagerOnShutdown(@Observes BeforeShutdown beforeShutdown) {
- bms.remove(getClassLoader());
- }
-
- /**
- * Get the BeanManager from the JNDI registry.
- * <p/>
- * Workaround for JBossAS 6 (see EXTCDI-74)
- * {@link #setBeanManager(javax.enterprise.inject.spi.AfterBeanDiscovery, javax.enterprise.inject.spi.BeanManager)}
- * is called in context of a different {@link ClassLoader}
- *
- * @return current {@link javax.enterprise.inject.spi.BeanManager} which is provided via JNDI
- */
- private BeanManager resolveBeanManagerViaJndi() {
- try {
- return (BeanManager) new InitialContext().lookup("java:comp/BeanManager");
- } catch (NamingException e) {
- //workaround didn't work -> force NPE
- return null;
- }
- }
-
- /**
- * This function exists to prevent findbugs to complain about
- * setting a static member from a non-static function.
- *
- * @param beanManagerProvider the bean-manager-provider which should be used if there isn't an existing provider
- * @return the first BeanManagerProvider
- */
- private static BeanManagerProvider setBeanManagerProvider(BeanManagerProvider beanManagerProvider) {
- if (bmp == null) {
- bmp = beanManagerProvider;
- }
-
- return bmp;
- }
-}
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java b/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java
deleted file mode 100644
index fcc5a1f..0000000
--- a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/BeanProvider.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.cdi.util;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.Typed;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-/**
- * This class contains utility methods to resolve contextual references
- * in situations where no injection is available.
- *
- * @see BeanManagerProvider
- */
-@Typed
-public final class BeanProvider {
-
- private BeanProvider() {
- // this is a utility class which doesn't get instantiated.
- }
-
- /**
- * <p></p>Get a Contextual Reference by it's type and annotation (qualifier).
- * You can use this method to get contextual references of a given type.
- * A 'Contextual Reference' is a proxy which will automatically resolve
- * the correct contextual instance when you access any method.</p>
- * <p/>
- * <p><b>Attention:</b> You shall not use this method to manually resolve a
- * @Dependent bean! The reason is that this contextual instances do usually
- * live in the well defined lifecycle of their injection point (the bean they got
- * injected into). But if we manually resolve a @Dependent bean, then it does <b>not</b>
- * belong to such a well defined lifecycle (because @Dependent it is not
- * @NormalScoped) and thus will not automatically be
- * destroyed at the end of the lifecycle. You need to manually destroy this contextual instance via
- * {@link javax.enterprise.context.spi.Contextual#destroy(Object, javax.enterprise.context.spi.CreationalContext)}.
- * Thus you also need to manually store the CreationalContext and the Bean you
- * used to create the contextual instance which this method will not provide.</p>
- *
- * @param type the type of the bean in question
- * @param optional if <code>true</code> it will return <code>null</code> if no bean could be found or created.
- * Otherwise it will throw an {@code IllegalStateException}
- * @param qualifiers additional qualifiers which further distinct the resolved bean
- * @param <T> target type
- * @return the resolved Contextual Reference
- */
- public static <T> T getContextualReference(Class<T> type, boolean optional, Annotation... qualifiers) {
- BeanManager beanManager = getBeanManager();
- Set<Bean<?>> beans = beanManager.getBeans(type, qualifiers);
-
- if (beans == null || beans.isEmpty()) {
- if (optional) {
- return null;
- }
-
- throw new IllegalStateException("Could not find beans for Type='" + type
- + "' and qualifiers: " + Arrays.toString(qualifiers));
- }
- return getContextualReference(type, beanManager, beans);
- }
-
- /**
- * <p>Get a Contextual Reference by it's EL Name.
- * This only works for beans with the @Named annotation.</p>
- * <p/>
- * <p><b>Attention:</b> please see the notes on manually resolving @Dependent bean
- * in {@link #getContextualReference(Class, boolean, java.lang.annotation.Annotation...)}!</p>
- *
- * @param name the EL name of the bean
- * @param optional if <code>true</code> it will return <code>null</code> if no bean could be found or created.
- * Otherwise it will throw an {@code IllegalStateException}
- * @return the resolved Contextual Reference
- */
- public static Object getContextualReference(String name, boolean optional) {
- return getContextualReference(name, optional, Object.class);
- }
-
- /**
- * <p>Get a Contextual Reference by it's EL Name.
- * This only works for beans with the @Named annotation.</p>
- * <p/>
- * <p><b>Attention:</b> please see the notes on manually resolving @Dependent bean
- * in {@link #getContextualReference(Class, boolean, java.lang.annotation.Annotation...)}!</p>
- *
- * @param name the EL name of the bean
- * @param optional if <code>true</code> it will return <code>null</code> if no bean could be found or created.
- * Otherwise it will throw an {@code IllegalStateException}
- * @param type the type of the bean in question - use {@link #getContextualReference(String, boolean)}
- * if the type is unknown e.g. in dyn. use-cases
- * @param <T> target type
- * @return the resolved Contextual Reference
- */
- public static <T> T getContextualReference(String name, boolean optional, Class<T> type) {
- BeanManager beanManager = getBeanManager();
- Set<Bean<?>> beans = beanManager.getBeans(name);
-
- if (beans == null || beans.isEmpty()) {
- if (optional) {
- return null;
- }
- throw new IllegalStateException("Could not find beans for Type=" + type
- + " and name:" + name);
- }
- return getContextualReference(type, beanManager, beans);
- }
-
- /**
- * <p>Get a list of Contextual References by it's type independent of the qualifier
- * (including dependent scoped beans).
- * <p/>
- * You can use this method to get all contextual references of a given type.
- * A 'Contextual Reference' is a proxy which will automatically resolve
- * the correct contextual instance when you access any method.</p>
- * <p/>
- * <p><b>Attention:</b> please see the notes on manually resolving @Dependent bean
- * in {@link #getContextualReference(Class, boolean, java.lang.annotation.Annotation...)}!</p>
- *
- * @param type the type of the bean in question
- * @param optional if <code>true</code> it will return an empty list if no bean could be found or created.
- * Otherwise it will throw an {@code IllegalStateException}
- * @param <T> target type
- * @return the resolved list of Contextual Reference or an empty-list if optional is true
- */
- public static <T> List<T> getContextualReferences(Class<T> type, boolean optional) {
- return getContextualReferences(type, optional, true);
- }
-
- /**
- * <p>Get a list of Contextual References by it's type independent of the qualifier.
- * <p/>
- * Further details are available at {@link #getContextualReferences(Class, boolean)}
- *
- * @param type the type of the bean in question
- * @param optional if <code>true</code> it will return an empty list if no bean could be found or created.
- * Otherwise it will throw an {@code IllegalStateException}
- * @param includeDefaultScopedBeans specifies if dependent scoped beans should be included in the in the result
- * @param <T> target type
- * @return the resolved list of Contextual Reference or an empty-list if optional is true
- */
- public static <T> List<T> getContextualReferences(
- Class<T> type, boolean optional, boolean includeDefaultScopedBeans) {
-
- BeanManager beanManager = getBeanManager();
- Set<Bean<?>> beans = beanManager.getBeans(type, new AnyLiteral());
-
- if (beans == null || beans.isEmpty()) {
- if (optional) {
- return Collections.emptyList();
- }
-
- throw new IllegalStateException("Could not find beans for Type=" + type);
- }
-
- if (!includeDefaultScopedBeans) {
- beans = filterDefaultScopedBeans(beans);
- }
-
- List<T> result = new ArrayList<T>(beans.size());
-
- for (Bean<?> bean : beans) {
- result.add(getContextualReference(type, beanManager,
- new HashSet<Bean<?>>(Arrays.asList(new Bean<?>[]{bean}))));
- }
- return result;
- }
-
- public static <T> Map<String, T> getContextualNamesReferences(Class<T> type,
- boolean optional,
- boolean includeDefaultScopedBeans) {
- BeanManager beanManager = getBeanManager();
- Set<Bean<?>> beans = beanManager.getBeans(type, new AnyLiteral());
-
- if (beans == null || beans.isEmpty()) {
- if (optional) {
- return Collections.emptyMap();
- }
-
- throw new IllegalStateException("Could not find beans for Type=" + type);
- }
-
- if (!includeDefaultScopedBeans) {
- beans = filterDefaultScopedBeans(beans);
- }
-
- Map<String, T> result = new HashMap<String, T>(beans.size());
-
- for (Bean<?> bean : beans) {
- result.put(bean.getName(), getContextualReference(type, beanManager,
- new HashSet<Bean<?>>(Arrays.asList(new Bean<?>[]{bean}))));
- }
- return result;
- }
-
- private static Set<Bean<?>> filterDefaultScopedBeans(Set<Bean<?>> beans) {
- Set<Bean<?>> result = new HashSet<Bean<?>>(beans.size());
-
- Iterator<Bean<?>> beanIterator = beans.iterator();
-
- Bean<?> currentBean;
- while (beanIterator.hasNext()) {
- currentBean = beanIterator.next();
-
- if (!Dependent.class.isAssignableFrom(currentBean.getScope())) {
- result.add(currentBean);
- }
- }
- return result;
- }
-
- /**
- * Internal helper method to resolve the right bean and resolve the contextual reference.
- *
- * @param type the type of the bean in question
- * @param beanManager current bean-manager
- * @param beans beans in question
- * @param <T> target type
- * @return the contextual reference
- */
- @SuppressWarnings("unchecked")
- private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Set<Bean<?>> beans) {
- Bean<?> bean = beanManager.resolve(beans);
- CreationalContext<?> creationalContext = beanManager.createCreationalContext(bean);
- return (T)beanManager.getReference(bean, type, creationalContext);
- }
-
- /**
- * Internal method to resolve the BeanManager via the {@link BeanManagerProvider}
- */
- private static BeanManager getBeanManager() {
- return BeanManagerProvider.getInstance().getBeanManager();
- }
-}
diff --git a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java b/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java
deleted file mode 100644
index 85f7fac..0000000
--- a/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/util/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * mainly copied from deltaspike to avoid to bring to whole
- * package when only 2 classes are useful.
- */
-package org.apache.camel.component.cdi.util;
diff --git a/components/camel-cdi/src/main/resources/META-INF/LICENSE.txt b/components/camel-cdi/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/components/camel-cdi/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-cdi/src/main/resources/META-INF/NOTICE.txt b/components/camel-cdi/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-cdi/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-cdi/src/main/resources/META-INF/beans.xml b/components/camel-cdi/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index 85b6e63..0000000
--- a/components/camel-cdi/src/main/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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/>
\ No newline at end of file
diff --git a/components/camel-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/components/camel-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
deleted file mode 100644
index 7a4819e..0000000
--- a/components/camel-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# 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.
-#
-org.apache.camel.component.cdi.util.BeanManagerProvider
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java
deleted file mode 100644
index 01efcec..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/CdiContainerBeanManagerTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.cdi;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.cdi.store.Item;
-import org.apache.camel.component.cdi.CdiBeanRegistry;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.webbeans.cditest.CdiTestContainer;
-import org.apache.webbeans.cditest.CdiTestContainerLoader;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class CdiContainerBeanManagerTest extends CamelTestSupport {
- private static final Logger LOG = LoggerFactory.getLogger(CdiContainerBeanManagerTest.class);
-
- private MockEndpoint resultEndpoint;
- private ProducerTemplate template;
-
- private CdiTestContainer cdiContainer;
-
- // @Inject
- // private ShoppingBean shoppingBean;
-
- @Before
- public void setUp() throws Exception {
- cdiContainer = CdiTestContainerLoader.getCdiContainer();
- cdiContainer.bootContainer();
-
- LOG.info(">> Container started and bean manager instantiated !");
-
- // Camel
- context = new DefaultCamelContext(new CdiBeanRegistry());
- context.addRoutes(createRouteBuilder());
- context.setTracing(true);
- context.start();
- resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
- template = context.createProducerTemplate();
-
- LOG.info(">> Camel started !");
- }
-
- @After
- public void shutDown() throws Exception {
- cdiContainer.shutdownContainer();
- context.stop();
- }
-
- @Test
- public void testInjection() throws InterruptedException {
- resultEndpoint.expectedMessageCount(1);
- template.sendBody("direct:inject", "hello");
-
- assertMockEndpointsSatisfied();
-
- Exchange exchange = resultEndpoint.getExchanges().get(0);
- List<?> results = exchange.getIn().getBody(List.class);
- ArrayList<Item> expected = itemsExpected();
- assertNotNull(results);
- assertNotNull(expected);
- assertEquals(expected.size(), results.size());
-
- Object[] items = results.toArray();
- Object[] itemsExpected = itemsExpected().toArray();
- for (int i = 0; i < items.length; ++i) {
- assertTrue(itemsExpected[i] != null && (itemsExpected[i] instanceof Item));
- assertTrue(items[i] != null && (items[i] instanceof Item));
- Item itemExpected = (Item)itemsExpected[i];
- Item itemReceived = (Item)items[i];
- assertEquals(itemExpected.getName(), itemReceived.getName());
- assertEquals(itemExpected.getPrice(), itemReceived.getPrice());
- }
- assertNotNull(results);
- }
-
- private ArrayList<Item> itemsExpected() {
- ArrayList<Item> products = new ArrayList<Item>();
- for (int i = 1; i < 10; i++) {
- products.add(new Item("Item-" + i, 1500L * i));
- }
- return products;
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
-
- from("direct:inject")
- .beanRef("shoppingBean", "listAllProducts")
- .to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Item.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Item.java
deleted file mode 100644
index 2c36424..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Item.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.cdi.store;
-
-import java.io.Serializable;
-
-public class Item implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name;
-
- private long price;
-
- public Item() {
-
- }
-
- public Item(String name, long price) {
- this.name = name;
- this.price = price;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the price
- */
- public long getPrice() {
- return price;
- }
-
- /**
- * @param price the price to set
- */
- public void setPrice(long price) {
- this.price = price;
- }
-
-
-}
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java
deleted file mode 100644
index c91acdd..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/Products.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.cdi.store;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Named;
-
-@Named
-public class Products implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private List<Item> products = new ArrayList<Item>();
-
- public Products() {
- }
-
- @PostConstruct
- public void afterInit() {
- for (int i = 1; i < 10; i++) {
- Item item = new Item("Item-" + i, i * 1500L);
- products.add(item);
- }
- }
-
- @PreDestroy
- public void preDestroy() {
- products.clear();
- }
-
- /**
- * @return the products
- */
- public List<Item> getProducts() {
- return products;
- }
-
-
-}
diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java
deleted file mode 100644
index 0b0639a..0000000
--- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/store/ShoppingBean.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.cdi.store;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import javax.enterprise.inject.New;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named
-public class ShoppingBean implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @Inject
- private Products products;
- private List<Item> items = new ArrayList<Item>();
-
- public ShoppingBean() {
- }
-
- @Inject
- public ShoppingBean(@New Item defaultItem) {
- defaultItem.setName("Default Item");
- defaultItem.setPrice(1000L);
-
- items.add(defaultItem);
- }
-
- @Produces
- @Named("selectedItems")
- public List<Item> listSelectedItems() {
- return this.items;
- }
-
- @Produces
- @Named("allProducts")
- public List<Item> listAllProducts() {
- return this.products.getProducts();
- }
-
-}
diff --git a/components/camel-cdi/src/test/resources/META-INF/beans.xml b/components/camel-cdi/src/test/resources/META-INF/beans.xml
deleted file mode 100644
index 112d56d..0000000
--- a/components/camel-cdi/src/test/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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/>
\ No newline at end of file
diff --git a/components/camel-cdi/src/test/resources/log4j.properties b/components/camel-cdi/src/test/resources/log4j.properties
deleted file mode 100644
index 0260f8f..0000000
--- a/components/camel-cdi/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, file
-
-#log4j.logger.org.apache.camel.component.cdi=DEBUG
-log4j.logger.org.apache.openwebbeans=DEBUG
-#log4j.logger.com.mycompany=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-# MDC
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{breadcrumbId} - %-10.10X{exchangeId} - %-10.10X{correlationId} - %-10.10X{routeId} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.file=target/camel-cdi-test.log
-log4j.appender.file.append=true
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-# MDC
-#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{breadcrumbId} - %-10.10X{exchangeId} - %-10.10X{correlationId} - %-10.10X{routeId} - %m%n
-
-log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file
diff --git a/components/camel-cometd/pom.xml b/components/camel-cometd/pom.xml
index a139d64..d167951 100644
--- a/components/camel-cometd/pom.xml
+++ b/components/camel-cometd/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
index 4e623b6..14b2b60 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
@@ -19,7 +19,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
@@ -28,36 +27,21 @@
import org.cometd.bayeux.server.ServerMessage;
import org.cometd.bayeux.server.ServerSession;
import org.cometd.server.BayeuxServerImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* A Strategy used to convert between a Camel {@link Exchange} and
* to and from a Cometd messages
*/
public class CometdBinding {
-
public static final String HEADERS_FIELD = "CamelHeaders";
public static final String COMETD_CLIENT_ID_HEADER_NAME = "CometdClientId";
- public static final String COMETD_SUBSCRIPTION_HEADER_NAME = "subscription";
- public static final String COMETD_SESSION_ATTR_HEADER_NAME = "CometdSessionAttr";
-
- private static final String IMPROPER_SESSTION_ATTRIBUTE_TYPE_MESSAGE = "Sesstion attribute %s has a value of %s which cannot be included as at header because it is not an int, string, or long.";
- private static final transient Logger LOG = LoggerFactory.getLogger(CometdBinding.class);
+ public static final String SUBSCRIPTION_HEADER_NAME = "subscription";
private final BayeuxServerImpl bayeux;
- private boolean enableSessionHeader;
public CometdBinding(BayeuxServerImpl bayeux) {
- this(bayeux, false);
- }
-
-
- public CometdBinding(BayeuxServerImpl bayeux, boolean enableSessionHeader) {
this.bayeux = bayeux;
- this.enableSessionHeader = enableSessionHeader;
}
-
public ServerMessage.Mutable createCometdMessage(ServerChannel channel, ServerSession serverSession, Message camelMessage) {
ServerMessage.Mutable mutable = bayeux.newMessage();
@@ -81,38 +65,18 @@
message.setHeaders(getHeadersFromMessage(cometdMessage));
message.setHeader(COMETD_CLIENT_ID_HEADER_NAME, remote.getId());
- if (cometdMessage.get(COMETD_SUBSCRIPTION_HEADER_NAME) != null) {
- message.setHeader(COMETD_SUBSCRIPTION_HEADER_NAME, cometdMessage.get(COMETD_SUBSCRIPTION_HEADER_NAME));
- }
-
- if (enableSessionHeader) {
- addSessionAttributesToMessageHeaders(remote, message);
+ if (cometdMessage.get(SUBSCRIPTION_HEADER_NAME) != null) {
+ message.setHeader(SUBSCRIPTION_HEADER_NAME, cometdMessage.get(SUBSCRIPTION_HEADER_NAME));
}
return message;
}
- private void addSessionAttributesToMessageHeaders(ServerSession remote, Message message) {
- Set<String> attributeNames = remote.getAttributeNames();
- for (String attributeName : attributeNames) {
- Object attribute = remote.getAttribute(attributeName);
-
- if (attribute instanceof Integer || attribute instanceof String || attribute instanceof Long
- || attribute instanceof Double) {
- message.setHeader(attributeName, attribute);
- } else {
- // Do we need to support other type of session objects ?
- LOG.info(String.format(IMPROPER_SESSTION_ATTRIBUTE_TYPE_MESSAGE, attributeName, attribute));
- }
-
- }
- }
-
-
public void addHeadersToMessage(ServerMessage.Mutable cometdMessage, Message camelMessage) {
if (camelMessage.hasHeaders()) {
Map<String, Object> ext = cometdMessage.getExt(true);
+
ext.put(HEADERS_FIELD, filterHeaders(camelMessage.getHeaders()));
}
}
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
index ae975cc..6791eb6 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdComponent.java
@@ -97,7 +97,7 @@
*/
public void connect(CometdProducerConsumer prodcon) throws Exception {
// Make sure that there is a connector for the requested endpoint.
- CometdEndpoint endpoint = prodcon.getEndpoint();
+ CometdEndpoint endpoint = (CometdEndpoint) prodcon.getEndpoint();
String connectorKey = endpoint.getProtocol() + ":" + endpoint.getUri().getHost() + ":" + endpoint.getPort();
synchronized (connectors) {
diff --git a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
index b56cb16..e6f11ed 100644
--- a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
+++ b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdEndpoint.java
@@ -37,7 +37,6 @@
private int maxInterval = 30000;
private int multiFrameInterval = 1500;
private boolean jsonCommented = true;
- private boolean sessionHeadersEnabled;
private int logLevel = 1;
private URI uri;
private CometdComponent component;
@@ -150,14 +149,6 @@
public void setJsonCommented(boolean commented) {
jsonCommented = commented;
}
-
- public void setSessionHeadersEnabled(boolean enable) {
- this.sessionHeadersEnabled = enable;
- }
-
- public boolean areSessionHeadersEnabled() {
- return sessionHeadersEnabled;
- }
public int getLogLevel() {
return logLevel;
diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java
deleted file mode 100644
index f802970..0000000
--- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometBindingTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.cometd;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.camel.Message;
-import org.cometd.bayeux.server.ServerMessage;
-import org.cometd.bayeux.server.ServerSession;
-import org.cometd.server.BayeuxServerImpl;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class CometBindingTest {
-
- private static final Object FOO = new Object();
- private static final Long THIRTY_FOUR = Long.valueOf(34L);
- private static final Double TWO_POINT_ONE = Double.valueOf(2.1);
- private static final Integer EIGHT = new Integer(8);
- private static final String HELLO = "hello";
- private static final String FOO_ATTR_NAME = "foo";
- private static final String LONG_ATTR_NAME = "long";
- private static final String DOUBLE_ATTR_NAME = "double";
- private static final String INTEGER_ATTR_NAME = "integer";
- private static final String STRING_ATTR_NAME = "string";
- private CometdBinding testObj;
- @Mock
- private BayeuxServerImpl bayeux;
- @Mock
- private ServerSession remote;
- @Mock
- private ServerMessage cometdMessage;
-
- @Before
- public void before() {
- testObj = new CometdBinding(bayeux);
-
- Set<String> attributeNames = new HashSet<String>(Arrays.asList(STRING_ATTR_NAME, INTEGER_ATTR_NAME,
- LONG_ATTR_NAME, DOUBLE_ATTR_NAME,
- FOO_ATTR_NAME));
- when(remote.getAttributeNames()).thenReturn(attributeNames);
- when(remote.getAttribute(STRING_ATTR_NAME)).thenReturn(HELLO);
- when(remote.getAttribute(INTEGER_ATTR_NAME)).thenReturn(EIGHT);
- when(remote.getAttribute(LONG_ATTR_NAME)).thenReturn(THIRTY_FOUR);
- when(remote.getAttribute(DOUBLE_ATTR_NAME)).thenReturn(TWO_POINT_ONE);
- when(remote.getAttribute(FOO_ATTR_NAME)).thenReturn(FOO);
- }
-
- @Test
- public void testBindingTransfersSessionAttributtes() {
- // setup
- testObj = new CometdBinding(bayeux, true);
-
- // act
- Message result = testObj.createCamelMessage(remote, cometdMessage, null);
-
- // assert
- assertEquals(5, result.getHeaders().size());
- assertEquals(HELLO, result.getHeader(STRING_ATTR_NAME));
- assertEquals(EIGHT, result.getHeader(INTEGER_ATTR_NAME));
- assertEquals(THIRTY_FOUR, result.getHeader(LONG_ATTR_NAME));
- assertEquals(TWO_POINT_ONE, result.getHeader(DOUBLE_ATTR_NAME));
- assertEquals(null, result.getHeader(FOO_ATTR_NAME));
- }
-
- @Test
- public void testBindingHonorsFlagForSessionAttributtes() {
- // act
- Message result = testObj.createCamelMessage(remote, cometdMessage, null);
-
- // assert
- assertEquals(1, result.getHeaders().size());
- assertEquals(null, result.getHeader(STRING_ATTR_NAME));
- assertEquals(null, result.getHeader(INTEGER_ATTR_NAME));
- assertEquals(null, result.getHeader(LONG_ATTR_NAME));
- assertEquals(null, result.getHeader(FOO_ATTR_NAME));
- assertEquals(null, result.getHeader(DOUBLE_ATTR_NAME));
- }
-
- @Test
- public void testSubscriptionHeadersPassed() {
- // setup
- String expectedSubscriptionInfo = "subscriptionInfo";
- when(cometdMessage.get(CometdBinding.COMETD_SUBSCRIPTION_HEADER_NAME))
- .thenReturn(expectedSubscriptionInfo);
-
- // act
- Message result = testObj.createCamelMessage(remote, cometdMessage, null);
-
- // assert
- assertEquals(2, result.getHeaders().size());
- assertEquals(expectedSubscriptionInfo,
- result.getHeader(CometdBinding.COMETD_SUBSCRIPTION_HEADER_NAME));
- }
-
-}
-
diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
index 08bbbc4..fde5b01 100644
--- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
+++ b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdProducerConsumerTest.java
@@ -18,7 +18,6 @@
import java.util.List;
-import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
@@ -72,31 +71,13 @@
assertNotNull(message.getHeader(CometdBinding.COMETD_CLIENT_ID_HEADER_NAME));
}
}
-
- @Test
- public void testSessionHeaderArgumentSet() throws Exception {
- // setup
- CometdComponent component = context.getComponent("cometd", CometdComponent.class);
-
- // act
- Endpoint result = component
- .createEndpoint("cometd://127.0.0.1:"
- + port
- + "/service/testArgs?baseResource=file:./target/test-classes/webapp&"
- + "timeout=240000&interval=0&maxInterval=30000&multiFrameInterval=1500&jsonCommented=true&sessionHeadersEnabled=true&logLevel=2");
-
- // assert
- assertTrue(result instanceof CometdEndpoint);
- CometdEndpoint cometdEndpoint = (CometdEndpoint)result;
- assertTrue(cometdEndpoint.areSessionHeadersEnabled());
- }
@Override
@Before
public void setUp() throws Exception {
port = AvailablePortFinder.getNextAvailable(23500);
uri = "cometd://127.0.0.1:" + port + "/service/test?baseResource=file:./target/test-classes/webapp&"
- + "timeout=240000&interval=0&maxInterval=30000&multiFrameInterval=1500&jsonCommented=true&sessionHeadersEnabled=true&logLevel=2";
+ + "timeout=240000&interval=0&maxInterval=30000&multiFrameInterval=1500&jsonCommented=true&logLevel=2";
super.setUp();
}
@@ -140,4 +121,3 @@
}
}
}
-
diff --git a/components/camel-context/pom.xml b/components/camel-context/pom.xml
index c224b92..8cf825b 100644
--- a/components/camel-context/pom.xml
+++ b/components/camel-context/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>camel-parent</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-core-osgi/pom.xml b/components/camel-core-osgi/pom.xml
index 6021031..6b8b2cc 100644
--- a/components/camel-core-osgi/pom.xml
+++ b/components/camel-core-osgi/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java
index ef002ac..d3595a1 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextHelper.java
@@ -37,8 +37,6 @@
LOG.debug("Using OsgiCamelContextNameStrategy");
camelContext.setNameStrategy(new OsgiCamelContextNameStrategy(bundleContext));
- LOG.debug("Using OsgiManagementNameStrategy");
- camelContext.setManagementNameStrategy(new OsgiManagementNameStrategy(camelContext, bundleContext));
LOG.debug("Using OsgiClassResolver");
camelContext.setClassResolver(new OsgiClassResolver(bundleContext));
LOG.debug("Using OsgiFactoryFinderResolver");
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
index de318da..c633871 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
@@ -88,7 +88,7 @@
}
public static Version getBundleVersion(Bundle bundle) {
- Dictionary<?, ?> headers = bundle.getHeaders();
+ Dictionary headers = bundle.getHeaders();
String version = (String) headers.get(Constants.BUNDLE_VERSION);
return (version != null) ? Version.parseVersion(version) : Version.emptyVersion;
}
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
index 80002c1..d6d1eec 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiDefaultCamelContext.java
@@ -58,4 +58,10 @@
return new OsgiTypeConverter(ctx, getInjector(), finder);
}
+ @Override
+ public void setName(String name) {
+ super.setName(name);
+ // in OSGi append the bundle id to the management name so it will be unique in the JVM
+ super.setManagementName(name + "-" + bundleContext.getBundle().getBundleId());
+ }
}
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiEventAdminNotifier.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiEventAdminNotifier.java
index b68a158..9a5c48e 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiEventAdminNotifier.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiEventAdminNotifier.java
@@ -139,7 +139,7 @@
}
public static Version getBundleVersion(Bundle bundle) {
- Dictionary<?, ?> headers = bundle.getHeaders();
+ Dictionary headers = bundle.getHeaders();
String version = (String)headers.get(Constants.BUNDLE_VERSION);
return (version != null) ? Version.parseVersion(version) : Version.emptyVersion;
}
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiFactoryFinder.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiFactoryFinder.java
index b12cf71..1dfd118 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiFactoryFinder.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiFactoryFinder.java
@@ -26,7 +26,6 @@
import org.apache.camel.impl.DefaultFactoryFinder;
import org.apache.camel.spi.ClassResolver;
import org.apache.camel.util.IOHelper;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -49,7 +48,7 @@
propertyPrefix = "";
}
- Class<?> clazz = classMap.get(propertyPrefix + key);
+ Class clazz = classMap.get(propertyPrefix + key);
if (clazz == null) {
BundleEntry entry = getResource(key, checkClass);
if (entry != null) {
@@ -58,7 +57,7 @@
// lets load the file
BufferedInputStream reader = null;
try {
- reader = IOHelper.buffered(in);
+ reader = new BufferedInputStream(in);
Properties properties = new Properties();
properties.load(reader);
String className = properties.getProperty(propertyPrefix + "class");
@@ -112,7 +111,7 @@
return entry;
}
- private boolean checkCompat(Bundle bundle, Class<?> clazz) {
+ private boolean checkCompat(Bundle bundle, Class clazz) {
if (clazz == null) {
return true;
}
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiManagementNameStrategy.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiManagementNameStrategy.java
deleted file mode 100644
index 1ac6efb..0000000
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiManagementNameStrategy.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.core.osgi;
-
-import java.util.regex.Matcher;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.impl.DefaultManagementNameStrategy;
-import org.osgi.framework.BundleContext;
-
-/**
- * OSGI enhanced {@link org.apache.camel.spi.ManagementNameStrategy}.
- * <p/>
- * This {@link org.apache.camel.spi.ManagementNameStrategy} supports the default
- * tokens (see {@link DefaultManagementNameStrategy}) and the following additional OSGi specific tokens
- * <ul>
- * <li>#bundleId# - The bundle id</li>
- * <li>#symbolicName# - The bundle symbolic name</li>
- * </ul>
- * <p/>
- * This implementation will by default use a name pattern as <tt>#bundleId#-#name#</tt> and in case
- * of a clash, then the pattern will fallback to be using the counter as <tt>#bundleId#-#name#-#counter#</tt>.
- *
- * @see DefaultManagementNameStrategy
- */
-public class OsgiManagementNameStrategy extends DefaultManagementNameStrategy {
-
- private final BundleContext bundleContext;
-
- public OsgiManagementNameStrategy(CamelContext camelContext, BundleContext bundleContext) {
- super(camelContext, "#bundleId#-#name#", "#bundleId#-#name#-#counter#");
- this.bundleContext = bundleContext;
- }
-
- @Override
- protected String customResolveManagementName(String pattern, String answer) {
- String bundleId = "" + bundleContext.getBundle().getBundleId();
- String symbolicName = Matcher.quoteReplacement(bundleContext.getBundle().getSymbolicName());
-
- answer = answer.replaceFirst("#bundleId#", bundleId);
- answer = answer.replaceFirst("#symbolicName#", symbolicName);
- return answer;
- }
-
-}
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiServiceRegistry.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiServiceRegistry.java
index 3bba592..ac86fbc 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiServiceRegistry.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiServiceRegistry.java
@@ -70,9 +70,10 @@
return service;
}
+ @SuppressWarnings("unchecked")
public <T> Map<String, T> lookupByType(Class<T> type) {
// not implemented so we return an empty map
- return Collections.<String, T>emptyMap();
+ return Collections.EMPTY_MAP;
}
public void onComponentAdd(String name, Component component) {
@@ -134,8 +135,4 @@
String id, String sourceId, String routeId, String threadPoolProfileId) {
// noop
}
-
- public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPoolExecutor) {
- // noop
- }
}
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java
index c0137ef..7c9611f 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleContextUtils.java
@@ -35,7 +35,7 @@
* @param clazz the class to find the bundle context from
* @return the bundle context or <code>null</code> if it can't be found
*/
- public static BundleContext getBundleContext(Class<?> clazz) {
+ public static BundleContext getBundleContext(Class clazz) {
// Ideally we should use FrameworkUtil.getBundle(clazz).getBundleContext()
// but that does not exist in OSGi 4.1, so until we upgrade, we keep that one
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleDelegatingClassLoader.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleDelegatingClassLoader.java
index e4e2cea..75e799e 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleDelegatingClassLoader.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/utils/BundleDelegatingClassLoader.java
@@ -56,7 +56,7 @@
return resource;
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
protected Enumeration findResources(String name) throws IOException {
LOG.trace("FindResource: {}", name);
return bundle.getResources(name);
@@ -64,7 +64,7 @@
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
LOG.trace("LoadClass: {}, resolve: {}", name, resolve);
- Class<?> clazz;
+ Class clazz;
try {
clazz = findClass(name);
} catch (ClassNotFoundException cnfe) {
diff --git a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/CamelMockBundle.java b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/CamelMockBundle.java
index 3b8a903..6eb7b7a 100644
--- a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/CamelMockBundle.java
+++ b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/CamelMockBundle.java
@@ -21,7 +21,6 @@
import java.util.Enumeration;
import java.util.List;
-import org.apache.camel.util.CastUtils;
import org.springframework.osgi.mock.MockBundle;
/**
@@ -34,11 +33,11 @@
public static final String META_INF_LANGUAGE_RESOLVER = "META-INF/services/org/apache/camel/language/resolver/";
public static final String META_INF_DATAFORMAT = "META-INF/services/org/apache/camel/dataformat/";
- private static class ListEnumeration<E> implements Enumeration<E> {
- private final List<E> list;
+ private static class ListEnumeration implements Enumeration {
+ private final List list;
private int index;
- public ListEnumeration(List<E> list) {
+ public ListEnumeration(List list) {
this.list = list;
}
@@ -46,8 +45,8 @@
return list != null && index < list.size();
}
- public E nextElement() {
- E result = null;
+ public Object nextElement() {
+ Object result = null;
if (list != null) {
result = list.get(index);
index++;
@@ -61,16 +60,16 @@
setClassLoader(getClass().getClassLoader());
}
- private Enumeration<String> getListEnumeration(String prefix, String entrys[]) {
+ private Enumeration getListEnumeration(String prefix, String entrys[]) {
List<String> list = new ArrayList<String>();
for (String entry : entrys) {
list.add(prefix + entry);
}
- return new ListEnumeration<String>(list);
+ return new ListEnumeration(list);
}
- public Enumeration<String> getEntryPaths(String path) {
- Enumeration<String> result = null;
+ public Enumeration getEntryPaths(String path) {
+ Enumeration result = null;
if (META_INF_COMPONENT.equals(path)) {
String[] entries = new String[] {"timer_test", "file_test"};
result = getListEnumeration(META_INF_COMPONENT, entries);
@@ -87,20 +86,20 @@
return result;
}
- public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) {
+ public Enumeration findEntries(String path, String filePattern, boolean recurse) {
if (path.equals("/org/apache/camel/core/osgi/test") && filePattern.equals("*.class")) {
List<URL> urls = new ArrayList<URL>();
URL url = getClass().getClassLoader().getResource("org/apache/camel/core/osgi/test/MyTypeConverter.class");
urls.add(url);
url = getClass().getClassLoader().getResource("org/apache/camel/core/osgi/test/MyRouteBuilder.class");
urls.add(url);
- return new ListEnumeration<URL>(urls);
+ return new ListEnumeration(urls);
} else {
- return CastUtils.cast(super.findEntries(path, filePattern, recurse));
+ return super.findEntries(path, filePattern, recurse);
}
}
- public Class<?> loadClass(String name) throws ClassNotFoundException {
+ public Class loadClass(String name) throws ClassNotFoundException {
if (isLoadableClass(name)) {
return super.loadClass(name);
} else {
diff --git a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiClassResolverTest.java b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiClassResolverTest.java
index a339288..125c993 100644
--- a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiClassResolverTest.java
+++ b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiClassResolverTest.java
@@ -26,7 +26,7 @@
@Test
public void testResolveClass() {
ClassResolver classResolver = getClassResolver();
- Class<?> routeBuilder = classResolver.resolveClass("org.apache.camel.core.osgi.test.MyRouteBuilder");
+ Class routeBuilder = classResolver.resolveClass("org.apache.camel.core.osgi.test.MyRouteBuilder");
assertNotNull("The class of routeBuilder should not be null.", routeBuilder);
}
diff --git a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiFactoryFinderTest.java b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiFactoryFinderTest.java
index f53e29e..d08db0d 100644
--- a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiFactoryFinderTest.java
+++ b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/OsgiFactoryFinderTest.java
@@ -27,7 +27,7 @@
@Test
public void testFindClass() throws Exception {
OsgiFactoryFinder finder = new OsgiFactoryFinder(getBundleContext(), new DefaultClassResolver(), "META-INF/services/org/apache/camel/component/");
- Class<?> clazz = finder.findClass("file_test", "strategy.factory.");
+ Class clazz = finder.findClass("file_test", "strategy.factory.");
assertNotNull("We should get the file strategy factory here", clazz);
try {
diff --git a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/other/MyOtherTypeConverter.java b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/other/MyOtherTypeConverter.java
index dd8ea95..c6e8761 100644
--- a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/other/MyOtherTypeConverter.java
+++ b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/other/MyOtherTypeConverter.java
@@ -56,7 +56,7 @@
public static Object convertTo(Class<?> type, Exchange exchange, Object value, TypeConverterRegistry registry) {
// use a fallback type converter so we can convert the embedded body if the value is GenericFile
if (GenericFile.class.isAssignableFrom(value.getClass())) {
- GenericFile<?> file = (GenericFile<?>) value;
+ GenericFile file = (GenericFile) value;
Class<?> from = file.getBody().getClass();
// maybe from is already the type we want
diff --git a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MockTypeConverterRegistry.java b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MockTypeConverterRegistry.java
index 4c9fc0f..d197dc1 100644
--- a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MockTypeConverterRegistry.java
+++ b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MockTypeConverterRegistry.java
@@ -35,7 +35,7 @@
return fallbackTypeConverters;
}
- public void addTypeConverter(Class<?> toType, Class<?> fromType, TypeConverter typeConverter) {
+ public void addTypeConverter(Class toType, Class fromType, TypeConverter typeConverter) {
typeConverters.add(typeConverter);
}
@@ -43,7 +43,7 @@
fallbackTypeConverters.add(typeConverter);
}
- public TypeConverter lookup(Class<?> toType, Class<?> fromType) {
+ public TypeConverter lookup(Class toType, Class fromType) {
return null;
}
diff --git a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MyTypeConverter.java b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MyTypeConverter.java
index be98bbe..9183b60 100644
--- a/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MyTypeConverter.java
+++ b/components/camel-core-osgi/src/test/java/org/apache/camel/core/osgi/test/MyTypeConverter.java
@@ -56,7 +56,7 @@
public static Object convertTo(Class<?> type, Exchange exchange, Object value, TypeConverterRegistry registry) {
// use a fallback type converter so we can convert the embedded body if the value is GenericFile
if (GenericFile.class.isAssignableFrom(value.getClass())) {
- GenericFile<?> file = (GenericFile<?>) value;
+ GenericFile file = (GenericFile) value;
Class<?> from = file.getBody().getClass();
// maybe from is already the type we want
diff --git a/components/camel-core-xml/pom.xml b/components/camel-core-xml/pom.xml
index 14ba541..135ffb6 100644
--- a/components/camel-core-xml/pom.xml
+++ b/components/camel-core-xml/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
index 877b51a..ced70ec 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelConsumerTemplateFactoryBean.java
@@ -52,8 +52,8 @@
return template;
}
- public Class<ConsumerTemplate> getObjectType() {
- return ConsumerTemplate.class;
+ public Class<DefaultConsumerTemplate> getObjectType() {
+ return DefaultConsumerTemplate.class;
}
public void destroy() throws Exception {
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
index e549e5f..63b1236 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -36,6 +36,7 @@
import org.apache.camel.component.properties.PropertiesComponent;
import org.apache.camel.component.properties.PropertiesParser;
import org.apache.camel.component.properties.PropertiesResolver;
+import org.apache.camel.core.xml.scan.PatternBasedPackageScanFilter;
import org.apache.camel.management.DefaultManagementAgent;
import org.apache.camel.management.DefaultManagementLifecycleStrategy;
import org.apache.camel.management.DefaultManagementStrategy;
@@ -113,11 +114,13 @@
contextClassLoaderOnStart = Thread.currentThread().getContextClassLoader();
}
- public T getObject() throws Exception {
+ public Object getObject() throws Exception {
return getContext();
}
- public abstract Class<T> getObjectType();
+ public Class getObjectType() {
+ return CamelContext.class;
+ }
public boolean isSingleton() {
return true;
@@ -330,7 +333,6 @@
protected abstract void initCustomRegistry(T context);
- @SuppressWarnings("deprecation")
protected void initLazyLoadTypeConverteres() {
if (getLazyLoadTypeConverters() != null) {
getContext().setLazyLoadTypeConverters(getLazyLoadTypeConverters());
@@ -396,10 +398,6 @@
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation(def.getLocation());
- if (def.isIgnoreMissingLocation() != null) {
- pc.setIgnoreMissingLocation(def.isIgnoreMissingLocation());
- }
-
// if using a custom resolver
if (ObjectHelper.isNotEmpty(def.getPropertiesResolverRef())) {
PropertiesResolver resolver = CamelContextHelper.mandatoryLookup(getContext(), def.getPropertiesResolverRef(),
@@ -498,12 +496,6 @@
public abstract String getUseBreadcrumb();
- public abstract String getManagementNamePattern();
-
- /**
- * @deprecated this option is no longer supported, will be removed in a future Camel release.
- */
- @Deprecated
public abstract Boolean getLazyLoadTypeConverters();
public abstract CamelJMXAgentDefinition getCamelJMXAgent();
@@ -562,9 +554,6 @@
if (getUseBreadcrumb() != null) {
ctx.setUseBreadcrumb(CamelContextHelper.parseBoolean(getContext(), getUseBreadcrumb()));
}
- if (getManagementNamePattern() != null) {
- ctx.getManagementNameStrategy().setNamePattern(getManagementNamePattern());
- }
if (getShutdownRoute() != null) {
ctx.setShutdownRoute(getShutdownRoute());
}
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
index c04e86b..8e9b15b 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
@@ -36,9 +36,6 @@
private String location;
@XmlAttribute
- private Boolean ignoreMissingLocation;
-
- @XmlAttribute
private String propertiesResolverRef;
@XmlAttribute
@@ -107,14 +104,6 @@
this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
}
- public Boolean isIgnoreMissingLocation() {
- return ignoreMissingLocation;
- }
-
- public void setIgnoreMissingLocation(Boolean ignoreMissingLocation) {
- this.ignoreMissingLocation = ignoreMissingLocation;
- }
-
public String getPrefixToken() {
return prefixToken;
}
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
index c2acaf2..961a60b 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelProxyFactoryDefinition.java
@@ -34,7 +34,7 @@
@XmlAttribute
private String serviceRef;
@XmlAttribute
- private Class<?> serviceInterface;
+ private Class serviceInterface;
@XmlAttribute
private String camelContextId;
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
index 0e011a6..dee5437 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelServiceExporterDefinition.java
@@ -34,7 +34,7 @@
@XmlAttribute
private String serviceRef;
@XmlAttribute
- private Class<?> serviceInterface;
+ private Class serviceInterface;
@XmlAttribute
private String camelContextId;
diff --git a/camel-core/src/main/java/org/apache/camel/util/AntPathMatcher.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/scan/AntPathMatcher.java
similarity index 99%
rename from camel-core/src/main/java/org/apache/camel/util/AntPathMatcher.java
rename to components/camel-core-xml/src/main/java/org/apache/camel/core/xml/scan/AntPathMatcher.java
index 53bf3de..5b737b4 100644
--- a/camel-core/src/main/java/org/apache/camel/util/AntPathMatcher.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/scan/AntPathMatcher.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.util;
+package org.apache.camel.core.xml.scan;
import java.util.ArrayList;
import java.util.List;
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/PatternBasedPackageScanFilter.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/scan/PatternBasedPackageScanFilter.java
similarity index 97%
rename from components/camel-core-xml/src/main/java/org/apache/camel/core/xml/PatternBasedPackageScanFilter.java
rename to components/camel-core-xml/src/main/java/org/apache/camel/core/xml/scan/PatternBasedPackageScanFilter.java
index 99bf76b..c4fd9cb 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/PatternBasedPackageScanFilter.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/scan/PatternBasedPackageScanFilter.java
@@ -14,14 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.core.xml;
+package org.apache.camel.core.xml.scan;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.camel.spi.PackageScanFilter;
-import org.apache.camel.util.AntPathMatcher;
/**
* {@link PatternBasedPackageScanFilter} uses an underlying
diff --git a/components/camel-crypto/pom.xml b/components/camel-crypto/pom.xml
index c11ad76..355723e 100644
--- a/components/camel-crypto/pom.xml
+++ b/components/camel-crypto/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -73,7 +73,7 @@
<!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java
index 0425efa..0524bca 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/component/crypto/DigitalSignatureConstants.java
@@ -21,13 +21,14 @@
* header keys.
*/
public final class DigitalSignatureConstants {
+
public static final String SIGNATURE_PRIVATE_KEY = "CamelSignaturePrivateKey";
public static final String SIGNATURE_PUBLIC_KEY_OR_CERT = "CamelSignaturePublicKeyOrCert";
public static final String SIGNATURE = "CamelDigitalSignature";
public static final String KEYSTORE_ALIAS = "CamelSignatureKeyStoreAlias";
public static final String KEYSTORE_PASSWORD = "CamelSignatureKeyStorePassword";
-
+
private DigitalSignatureConstants() {
- // Helper Class
+ // Utility class
}
}
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
index 1da2044..3803fe3 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormat.java
@@ -82,7 +82,8 @@
try {
encOut.write(compressedData);
} finally {
- IOHelper.close(encOut, outputStream);
+ IOHelper.close(encOut);
+ IOHelper.close(outputStream);
}
}
diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
index cdc1f47..468dd3a 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java
@@ -63,15 +63,15 @@
NoSuchProviderException {
PGPPublicKeyRingCollection pgpSec = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input));
- Iterator<PGPPublicKeyRing> keyRingIter = pgpSec.getKeyRings();
+ Iterator<PGPPublicKeyRing> keyRingIter = (Iterator<PGPPublicKeyRing>) pgpSec.getKeyRings();
while (keyRingIter.hasNext()) {
PGPPublicKeyRing keyRing = keyRingIter.next();
- Iterator<PGPPublicKey> keyIter = keyRing.getPublicKeys();
+ Iterator<PGPPublicKey> keyIter = (Iterator<PGPPublicKey>) keyRing.getPublicKeys();
String keyUserId = null;
while (keyIter.hasNext()) {
PGPPublicKey key = keyIter.next();
- for (Iterator<String> iterator = key.getUserIDs(); iterator.hasNext();) {
+ for (Iterator<String> iterator = (Iterator<String>) key.getUserIDs(); iterator.hasNext();) {
keyUserId = iterator.next();
}
if (key.isEncryptionKey() && keyUserId != null && keyUserId.contains(userid)) {
@@ -102,14 +102,14 @@
PGPException, NoSuchProviderException {
PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(input));
- Iterator<PGPSecretKeyRing> keyRingIter = pgpSec.getKeyRings();
+ Iterator<PGPSecretKeyRing> keyRingIter = (Iterator<PGPSecretKeyRing>) pgpSec.getKeyRings();
while (keyRingIter.hasNext()) {
PGPSecretKeyRing keyRing = keyRingIter.next();
- Iterator<PGPSecretKey> keyIter = keyRing.getSecretKeys();
+ Iterator<PGPSecretKey> keyIter = (Iterator<PGPSecretKey>) keyRing.getSecretKeys();
while (keyIter.hasNext()) {
PGPSecretKey key = keyIter.next();
- for (Iterator<String> iterator = key.getUserIDs(); iterator.hasNext();) {
+ for (Iterator<String> iterator = (Iterator<String>) key.getUserIDs(); iterator.hasNext();) {
String userId = iterator.next();
if (key.isSigningKey() && userId.contains(userid)) {
return key.extractPrivateKey(passphrase.toCharArray(), "BC");
diff --git a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
index 3240ba2..6dd6b15 100644
--- a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
+++ b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SignatureTests.java
@@ -299,8 +299,9 @@
return mock;
}
+ @SuppressWarnings("unchecked")
public Exchange doTestSignatureRoute(RouteBuilder builder) throws Exception {
- return doSignatureRouteTest(builder, null, Collections.<String, Object>emptyMap());
+ return doSignatureRouteTest(builder, null, Collections.EMPTY_MAP);
}
public Exchange doSignatureRouteTest(RouteBuilder builder, Exchange e, Map<String, Object> headers) throws Exception {
diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
index 01205bb..c3e797a 100644
--- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
+++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/CryptoDataFormatTest.java
@@ -88,8 +88,9 @@
assertTrue(!ex.getIn().getHeaders().containsKey(CryptoDataFormat.KEY) || "".equals(header) || header == null);
}
+ @SuppressWarnings("unchecked")
private void doRoundTripEncryptionTests(String endpointUri) throws Exception, InterruptedException, InvalidPayloadException {
- doRoundTripEncryptionTests(endpointUri, Collections.<String, Object>emptyMap());
+ doRoundTripEncryptionTests(endpointUri, Collections.EMPTY_MAP);
}
private void doRoundTripEncryptionTests(String endpoint, Map<String, Object> headers) throws Exception, InterruptedException, InvalidPayloadException {
diff --git a/components/camel-csv/pom.xml b/components/camel-csv/pom.xml
index a377f86..f7db98c 100644
--- a/components/camel-csv/pom.xml
+++ b/components/camel-csv/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -49,7 +49,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
index 8d5b69d..e5fe8f8 100644
--- a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
+++ b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java
@@ -64,14 +64,14 @@
csv.setWriter(out);
try {
- List<?> list = ExchangeHelper.convertToType(exchange, List.class, object);
+ List list = ExchangeHelper.convertToType(exchange, List.class, object);
if (list != null) {
for (Object child : list) {
- Map<?, ?> row = ExchangeHelper.convertToMandatoryType(exchange, Map.class, child);
+ Map row = ExchangeHelper.convertToMandatoryType(exchange, Map.class, child);
doMarshalRecord(exchange, row, out, csv);
}
} else {
- Map<?, ?> row = ExchangeHelper.convertToMandatoryType(exchange, Map.class, object);
+ Map row = ExchangeHelper.convertToMandatoryType(exchange, Map.class, object);
doMarshalRecord(exchange, row, out, csv);
}
} finally {
@@ -79,10 +79,10 @@
}
}
- private void doMarshalRecord(Exchange exchange, Map<?, ?> row, Writer out, CSVWriter csv) throws Exception {
+ private void doMarshalRecord(Exchange exchange, Map row, Writer out, CSVWriter csv) throws Exception {
if (autogenColumns) {
// no specific config has been set so lets add fields
- Set<?> set = row.keySet();
+ Set set = row.keySet();
updateFieldsInConfig(set, exchange);
}
csv.writeRecord(row);
@@ -151,7 +151,7 @@
this.autogenColumns = autogenColumns;
}
- private synchronized void updateFieldsInConfig(Set<?> set, Exchange exchange) {
+ private synchronized void updateFieldsInConfig(Set set, Exchange exchange) {
for (Object value : set) {
if (value != null) {
String text = exchange.getContext().getTypeConverter().convertTo(String.class, value);
diff --git a/components/camel-cxf-transport/pom.xml b/components/camel-cxf-transport/pom.xml
index 7901f61..0246400 100644
--- a/components/camel-cxf-transport/pom.xml
+++ b/components/camel-cxf-transport/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -75,10 +75,10 @@
<version>${cxf-version}</version>
</dependency>
- <!-- dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- </dependency -->
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -88,11 +88,6 @@
<!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-cxf/pom.xml b/components/camel-cxf/pom.xml
index 2f7d1ac..8ae234b 100644
--- a/components/camel-cxf/pom.xml
+++ b/components/camel-cxf/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -147,7 +147,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
@@ -157,11 +157,6 @@
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-bindings-soap</artifactId>
- <version>${cxf-version}</version>
- </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
index bfd29e43..fe7f52b 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java
@@ -143,7 +143,7 @@
checkName(factoryBean.getEndpointName(), "endpoint/port name");
checkName(factoryBean.getServiceName(), "service name");
- return factoryBean.create();
+ return (Client)factoryBean.create();
}
}
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
index 719ff95..ceac272 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
@@ -186,7 +186,7 @@
BindingOperationInfo boi = camelExchange.getProperty(BindingOperationInfo.class.getName(),
BindingOperationInfo.class);
if (boi != null) {
- Service service = cxfExchange.get(Service.class);
+ Service service = (Service)cxfExchange.get(Service.class);
if (service != null) {
MethodDispatcher md = (MethodDispatcher)service
.get(MethodDispatcher.class.getName());
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/WSDLServiceConfiguration.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/WSDLServiceConfiguration.java
index c928a51..79b52f7 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/WSDLServiceConfiguration.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/WSDLServiceConfiguration.java
@@ -61,7 +61,7 @@
if (services.size() > 1) {
throw new IllegalArgumentException("service name must be specified, there is more than one service in the WSDL" + serviceFactoryBean.getWsdlURL());
}
- serviceQName = services.keySet().iterator().next();
+ serviceQName = (QName)services.keySet().iterator().next();
}
return serviceQName;
}
@@ -84,7 +84,7 @@
+ serviceFactoryBean.getServiceQName()
+ " of the WSDL" + serviceFactoryBean.getWsdlURL());
}
- endpointQName = new QName(service.getQName().getNamespaceURI(), ports.keySet().iterator().next());
+ endpointQName = new QName(service.getQName().getNamespaceURI(), (String)ports.keySet().iterator().next());
}
return endpointQName;
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SetSoapVersionInterceptor.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SetSoapVersionInterceptor.java
index 54a16c2..dfba44b 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SetSoapVersionInterceptor.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/interceptors/SetSoapVersionInterceptor.java
@@ -31,7 +31,7 @@
public void handleMessage(SoapMessage message) throws Fault {
if (message.getExchange() != null) {
if (message.getExchange().getInMessage() instanceof SoapMessage) {
- message.setVersion(((SoapMessage)message.getExchange().getInMessage()).getVersion());
+ ((SoapMessage)message).setVersion(((SoapMessage)message.getExchange().getInMessage()).getVersion());
}
}
}
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
index ba35c1a..3ce2197 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
@@ -85,7 +85,7 @@
|| "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
|| "features".equals(name) || "schemaLocations".equals(name)
|| "handlers".equals(name)) {
- List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+ List<?> list = (List<?>)ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
bean.addPropertyValue(name, list);
} else {
setFirstChildAsProperty(el, ctx, bean, name);
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerResponseTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerResponseTest.java
index 1d00e1c..b2ebe9a 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerResponseTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerResponseTest.java
@@ -89,7 +89,7 @@
// Get the parameter list
List<?> parameter = in.getBody(List.class);
// Put the result back
- exchange.getOut().setBody(parameter.get(0));
+ exchange.getOut().setBody((Boolean)parameter.get(0));
}
})
.when(header(CxfConstants.OPERATION_NAME).isEqualTo(PING_OPERATION)).process(new Processor() {
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
index 264197d..a7efe6b 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java
@@ -89,7 +89,7 @@
// Get the parameter list
List<?> parameter = in.getBody(List.class);
// Put the result back
- exchange.getOut().setBody(parameter.get(0));
+ exchange.getOut().setBody((Boolean)parameter.get(0));
}
});
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java
index 3c979e8..f45ae5a 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfEndpointTest.java
@@ -58,7 +58,7 @@
endpoint.getServiceClass().getCanonicalName(),
"org.apache.camel.component.cxf.HelloService");
}
-
+
@Test
public void testSettingClientBus() throws Exception {
CXFBusImpl bus = (CXFBusImpl) BusFactory.newInstance().createBus();
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
index 20ca725..04e2d66 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
@@ -75,7 +75,6 @@
exchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext);
exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, ECHO_OPERATION);
exchange.getIn().setHeader(Exchange.FILE_NAME, "testFile");
- exchange.getIn().setHeader("requestObject", new DefaultCxfBinding());
exchange.getProperties().put(TEST_KEY, TEST_VALUE);
}
});
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerOperationTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerOperationTest.java
index 985e949..181242e 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerOperationTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerOperationTest.java
@@ -55,7 +55,6 @@
params.add(TEST_MESSAGE);
exchange.getIn().setBody(params);
exchange.getIn().setHeader(Exchange.FILE_NAME, "testFile");
- exchange.getIn().setHeader("requestObject", new DefaultCxfBinding());
}
});
return exchange;
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
index 9fbb446..b5101ca 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
@@ -16,24 +16,18 @@
*/
package org.apache.camel.component.cxf;
-import java.net.ConnectException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.xml.ws.Endpoint;
-import org.w3c.dom.Document;
-
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.cxf.common.message.CxfConstants;
-import org.apache.camel.component.cxf.converter.CxfPayloadConverter;
-import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.test.AvailablePortFinder;
import org.apache.cxf.bus.CXFBusFactory;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.Server;
@@ -69,8 +63,7 @@
return "http://localhost:" + CXFTestSupport.getPort2() + "/" + getClass().getSimpleName() + "/test";
}
protected String getWrongServerAddress() {
- // Avoiding the test error on camel-cxf module
- return "http://localhost:" + AvailablePortFinder.getNextAvailable() + "/" + getClass().getSimpleName() + "/test";
+ return "http://localhost:" + CXFTestSupport.getPort3() + "/" + getClass().getSimpleName() + "/test";
}
@Before
@@ -122,28 +115,12 @@
// check the other camel header copying
String fileName = out.getHeader(Exchange.FILE_NAME, String.class);
assertEquals("Should get the file name from out message header", "testFile", fileName);
-
- // check if the header object is turned into String
- Object requestObject = out.getHeader("requestObject");
- assertTrue("We should get the right requestObject.", requestObject instanceof DefaultCxfBinding);
}
@Test
public void testInvokingAWrongServer() throws Exception {
Exchange reply = sendSimpleMessage(getWrongEndpointUri());
assertNotNull("We should get the exception here", reply.getException());
- assertTrue(reply.getException().getCause() instanceof ConnectException);
-
-
- //Test the data format PAYLOAD
- reply = sendSimpleMessageWithPayloadMessage(getWrongEndpointUri() + "&dataFormat=PAYLOAD");
- assertNotNull("We should get the exception here", reply.getException());
- assertTrue(reply.getException().getCause() instanceof ConnectException);
-
- //Test the data format MESSAGE
- reply = sendSimpleMessageWithRawMessage(getWrongEndpointUri() + "&dataFormat=MESSAGE");
- assertNotNull("We should get the exception here", reply.getException());
- assertTrue(reply.getException().getCause() instanceof ConnectException);
}
@Test
@@ -188,39 +165,11 @@
exchange.getIn().setBody(params);
exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, ECHO_OPERATION);
exchange.getIn().setHeader(Exchange.FILE_NAME, "testFile");
- exchange.getIn().setHeader("requestObject", new DefaultCxfBinding());
}
});
return exchange;
}
-
- private Exchange sendSimpleMessageWithRawMessage(String endpointUri) {
- Exchange exchange = template.request(endpointUri, new Processor() {
- public void process(final Exchange exchange) {
- exchange.getIn().setBody("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
- + "<soap:Body><ns1:echo xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
- + "<arg0 xmlns=\"http://cxf.component.camel.apache.org/\">hello world</arg0>"
- + "</ns1:echo></soap:Body></soap:Envelope>");
- }
- });
- return exchange;
- }
-
- private Exchange sendSimpleMessageWithPayloadMessage(String endpointUri) {
- Exchange exchange = template.request(endpointUri, new Processor() {
- public void process(final Exchange exchange) throws Exception {
- Document document = new XmlConverter().toDOMDocument("<ns1:echo xmlns:ns1=\"http://cxf.component.camel.apache.org/\">"
- + "<arg0 xmlns=\"http://cxf.component.camel.apache.org/\">hello world</arg0>"
- + "</ns1:echo>");
- exchange.getIn().setBody(CxfPayloadConverter.documentToCxfPayload(document, exchange));
- exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, ECHO_OPERATION);
-
- }
- });
- return exchange;
- }
-
protected Exchange sendJaxWsMessage() {
Exchange exchange = template.request(getJaxwsEndpointUri(), new Processor() {
public void process(final Exchange exchange) {
@@ -233,6 +182,4 @@
});
return exchange;
}
-
-
}
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CamelEndpointSpringConfigureTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CamelEndpointSpringConfigureTest.java
index b6d066e..006697f 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CamelEndpointSpringConfigureTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CamelEndpointSpringConfigureTest.java
@@ -60,5 +60,9 @@
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("/org/apache/camel/component/cxf/transport/CamelEndpointSpringConfigure.xml");
}
-
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
}
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java
index 51c10a0..530b975 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumerTest.java
@@ -65,7 +65,7 @@
assertEquals("Get a wrong http method", "GET", httpMethod);
String path = inMessage.getHeader(Exchange.HTTP_PATH, String.class);
// The parameter of the invocation is stored in the body of in message
- String id = inMessage.getBody(String.class);
+ String id = (String) inMessage.getBody(String.class);
if ("/customerservice/customers/126".equals(path)) {
Customer customer = new Customer();
customer.setId(Long.parseLong(id));
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java
index ef12afc..e3bb276 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointTest.java
@@ -51,6 +51,11 @@
}
@Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext(new String("org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpointBeans.xml"));
}
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
index e2e5f8b..48245d5 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanWithBusTest.java
@@ -19,7 +19,6 @@
import org.apache.camel.CamelContext;
import org.apache.camel.component.cxf.CXFTestSupport;
import org.apache.camel.component.cxf.CxfEndpoint;
-import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.junit.Test;
@@ -46,12 +45,7 @@
// Spring 3.0.0 has an issue of SPR-6589 which will call the BusApplicationListener twice for the same event,
// so we will get more one InInterceptors here
assertTrue(endpoint.getBus().getInInterceptors().size() >= 1);
- for (Interceptor<?> i : endpoint.getBus().getInInterceptors()) {
- if (i instanceof LoggingInInterceptor) {
- return;
- }
- }
- fail("Could not find the LoggingInInterceptor on the bus. " + endpoint.getBus().getInInterceptors());
+ assertEquals(LoggingInInterceptor.class, endpoint.getBus().getInInterceptors().get(0).getClass());
}
@Test
diff --git a/components/camel-dns/pom.xml b/components/camel-dns/pom.xml
index 67fed42..0cea677 100644
--- a/components/camel-dns/pom.xml
+++ b/components/camel-dns/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -57,7 +57,12 @@
<!-- Testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-dozer/pom.xml b/components/camel-dozer/pom.xml
index 89764fe..fb11b35 100644
--- a/components/camel-dozer/pom.xml
+++ b/components/camel-dozer/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-dozer</artifactId>
@@ -47,7 +47,12 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/dto/CustomerDTO.java b/components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/dto/CustomerDTO.java
index dfbb77d..7ca210e 100644
--- a/components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/dto/CustomerDTO.java
+++ b/components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/dto/CustomerDTO.java
@@ -21,7 +21,6 @@
public class CustomerDTO implements Serializable {
- private static final long serialVersionUID = 1L;
private String firstName;
private String lastName;
private AddressDTO address;
diff --git a/components/camel-eclipse/pom.xml b/components/camel-eclipse/pom.xml
index 4153926..ee56ae7 100644
--- a/components/camel-eclipse/pom.xml
+++ b/components/camel-eclipse/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-ejb/pom.xml b/components/camel-ejb/pom.xml
index a5fdaae..31599ea 100644
--- a/components/camel-ejb/pom.xml
+++ b/components/camel-ejb/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -57,7 +57,12 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-eventadmin/pom.xml b/components/camel-eventadmin/pom.xml
index 40a10470..1fd5f33 100644
--- a/components/camel-eventadmin/pom.xml
+++ b/components/camel-eventadmin/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
index 73f6b93..9378240 100644
--- a/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
+++ b/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
@@ -89,18 +89,19 @@
Event event = context.getTypeConverter().convertTo(Event.class, exchange, in.getBody());
if (event == null) {
String topic = getTopic(exchange);
- Dictionary<?, ?> props = getProperties(exchange);
+ Dictionary props = getProperties(exchange);
event = new Event(topic, props);
}
return event;
}
- protected Dictionary<?, ?> getProperties(Exchange exchange) {
+ protected Dictionary getProperties(Exchange exchange) {
Message in = exchange.getIn();
CamelContext context = endpoint.getCamelContext();
- Map<?, ?> map = context.getTypeConverter().convertTo(Map.class, exchange, in.getBody());
+ Map map = context.getTypeConverter().convertTo(Map.class, exchange, in.getBody());
Dictionary<String, Object> dict = new Hashtable<String, Object>();
- for (Entry<?, ?> entry : map.entrySet()) {
+ for (Object object : map.entrySet()) {
+ Entry entry = (Entry) object;
String keyString = CamelContextHelper.convertTo(context, String.class, entry.getKey());
if (keyString != null) {
Object val = entry.getValue();
diff --git a/components/camel-exec/pom.xml b/components/camel-exec/pom.xml
index cff5829..34d80c3 100644
--- a/components/camel-exec/pom.xml
+++ b/components/camel-exec/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -56,7 +56,7 @@
<!-- test scope -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecScriptTest.java b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecScriptTest.java
index e92adfa..fb2f594 100644
--- a/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecScriptTest.java
+++ b/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecScriptTest.java
@@ -66,7 +66,7 @@
String classpathArg = getClasspathArg();
Exchange exchange = executeScript(scriptFile, NO_TIMEOUT, classpathArg, PRINT_IN_STDOUT);
if (exchange != null) {
- String out = exchange.getIn().getBody(String.class);
+ String out = (String)exchange.getIn().getBody(String.class);
String err = (String)exchange.getIn().getHeader(EXEC_STDERR);
assertNotNull(out);
diff --git a/components/camel-flatpack/pom.xml b/components/camel-flatpack/pom.xml
index a6e735d..0a043aa 100644
--- a/components/camel-flatpack/pom.xml
+++ b/components/camel-flatpack/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -77,7 +77,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-freemarker/pom.xml b/components/camel-freemarker/pom.xml
index ddcf9cb..575535c 100644
--- a/components/camel-freemarker/pom.xml
+++ b/components/camel-freemarker/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -50,7 +50,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-ftp/pom.xml b/components/camel-ftp/pom.xml
index 8ae2449..14314a3 100644
--- a/components/camel-ftp/pom.xml
+++ b/components/camel-ftp/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
index f3dca2b..d6f780c 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
@@ -137,7 +137,7 @@
// must set soTimeout after connect
if (endpoint instanceof FtpEndpoint) {
- FtpEndpoint<?> ftpEndpoint = (FtpEndpoint<?>) endpoint;
+ FtpEndpoint ftpEndpoint = (FtpEndpoint) endpoint;
if (ftpEndpoint.getSoTimeout() > 0) {
log.trace("Using SoTimeout=" + ftpEndpoint.getSoTimeout());
try {
@@ -169,7 +169,7 @@
// site commands
if (endpoint.getConfiguration().getSiteCommand() != null) {
// commands can be separated using new line
- Iterator<?> it = ObjectHelper.createIterator(endpoint.getConfiguration().getSiteCommand(), "\n");
+ Iterator it = ObjectHelper.createIterator(endpoint.getConfiguration().getSiteCommand(), "\n");
while (it.hasNext()) {
Object next = it.next();
String command = endpoint.getCamelContext().getTypeConverter().convertTo(String.class, next);
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
index 342bf7b..85c9596 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
@@ -65,9 +65,9 @@
}
@Override
- public void copyFromPopulateAdditional(GenericFile<T> source, GenericFile<T> result) {
- RemoteFile<?> remoteSource = (RemoteFile<?>) source;
- RemoteFile<?> remoteResult = (RemoteFile<?>) result;
+ public void copyFromPopulateAdditional(GenericFile source, GenericFile result) {
+ RemoteFile remoteSource = (RemoteFile) source;
+ RemoteFile remoteResult = (RemoteFile) result;
remoteResult.setHostname(remoteSource.getHostname());
}
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index 0bb5dc7..11a5855 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -42,8 +42,8 @@
return (RemoteFileEndpoint<T>) super.getEndpoint();
}
- protected RemoteFileOperations<T> getOperations() {
- return (RemoteFileOperations<T>) operations;
+ protected RemoteFileOperations getOperations() {
+ return (RemoteFileOperations) operations;
}
protected boolean prePollCheck() throws Exception {
@@ -152,7 +152,7 @@
* Returns human readable server information for logging purpose
*/
protected String remoteServer() {
- return ((RemoteFileEndpoint<?>) endpoint).remoteServerInformation();
+ return ((RemoteFileEndpoint) endpoint).remoteServerInformation();
}
@Override
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
index c43a7cc..097e7d0 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
@@ -29,10 +29,10 @@
@Override
public boolean rollback(Consumer consumer, Endpoint endpoint, int retryCounter, Exception e) throws Exception {
- RemoteFileConsumer<?> rfc = (RemoteFileConsumer<?>) consumer;
+ RemoteFileConsumer rfc = (RemoteFileConsumer) consumer;
// only try to recover if we are allowed to run
- if (((RemoteFileConsumer<?>) consumer).isRunAllowed()) {
+ if (((RemoteFileConsumer) consumer).isRunAllowed()) {
// disconnect from the server to force it to re login at next poll to recover
log.warn("Trying to recover by disconnecting from remote server forcing a re-connect at next poll: " + rfc.remoteServer());
try {
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
index bec9697..cbce2e6 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
@@ -52,8 +52,8 @@
ExchangeHelper.copyResults(exchange, remoteExchange);
}
- protected RemoteFileOperations<T> getOperations() {
- return (RemoteFileOperations<T>) operations;
+ protected RemoteFileOperations getOperations() {
+ return (RemoteFileOperations) operations;
}
@Override
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
index 43a8822..2e0ab54 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
@@ -65,7 +65,7 @@
public interface ExtendedUserInfo extends UserInfo, UIKeyboardInteractive {
}
- public void setEndpoint(GenericFileEndpoint<ChannelSftp.LsEntry> endpoint) {
+ public void setEndpoint(GenericFileEndpoint endpoint) {
this.endpoint = (SftpEndpoint) endpoint;
}
@@ -450,8 +450,6 @@
try {
final List<ChannelSftp.LsEntry> list = new ArrayList<ChannelSftp.LsEntry>();
-
- @SuppressWarnings("rawtypes")
Vector files = channel.ls(path);
// can return either null or an empty list depending on FTP servers
if (files != null) {
@@ -715,7 +713,6 @@
String onlyName = FileUtil.stripPath(name);
try {
- @SuppressWarnings("rawtypes")
Vector files = channel.ls(directory);
// can return either null or an empty list depending on FTP servers
if (files == null) {
@@ -744,7 +741,6 @@
protected boolean fastExistsFile(String name) throws GenericFileOperationFailedException {
LOG.trace("fastExistsFile({})", name);
try {
- @SuppressWarnings("rawtypes")
Vector files = channel.ls(name);
if (files == null) {
return false;
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
index 7a62620..b2cba90 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
@@ -28,14 +28,14 @@
import org.apache.camel.component.file.strategy.GenericFileRenameExclusiveReadLockStrategy;
import org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy;
import org.apache.camel.util.ObjectHelper;
-import org.apache.commons.net.ftp.FTPFile;
public final class FtpProcessStrategyFactory {
private FtpProcessStrategyFactory() {
}
- public static GenericFileProcessStrategy<FTPFile> createGenericFileProcessStrategy(CamelContext context, Map<String, Object> params) {
+ @SuppressWarnings("unchecked")
+ public static <FTPFile> GenericFileProcessStrategy<FTPFile> createGenericFileProcessStrategy(CamelContext context, Map<String, Object> params) {
// We assume a value is present only if its value not null for String and 'true' for boolean
Expression moveExpression = (Expression) params.get("move");
@@ -47,7 +47,7 @@
if (isDelete) {
GenericFileDeleteProcessStrategy<FTPFile> strategy = new GenericFileDeleteProcessStrategy<FTPFile>();
- strategy.setExclusiveReadLockStrategy(getExclusiveReadLockStrategy(params));
+ strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<FTPFile>) getExclusiveReadLockStrategy(params));
if (preMoveExpression != null) {
GenericFileExpressionRenamer<FTPFile> renamer = new GenericFileExpressionRenamer<FTPFile>();
renamer.setExpression(preMoveExpression);
@@ -61,7 +61,7 @@
return strategy;
} else if (isMove || isNoop) {
GenericFileRenameProcessStrategy<FTPFile> strategy = new GenericFileRenameProcessStrategy<FTPFile>();
- strategy.setExclusiveReadLockStrategy(getExclusiveReadLockStrategy(params));
+ strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<FTPFile>) getExclusiveReadLockStrategy(params));
if (!isNoop && moveExpression != null) {
// move on commit is only possible if not noop
GenericFileExpressionRenamer<FTPFile> renamer = new GenericFileExpressionRenamer<FTPFile>();
@@ -84,13 +84,13 @@
} else {
// default strategy will do nothing
GenericFileNoOpProcessStrategy<FTPFile> strategy = new GenericFileNoOpProcessStrategy<FTPFile>();
- strategy.setExclusiveReadLockStrategy(getExclusiveReadLockStrategy(params));
+ strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<FTPFile>) getExclusiveReadLockStrategy(params));
return strategy;
}
}
@SuppressWarnings("unchecked")
- private static GenericFileExclusiveReadLockStrategy<FTPFile> getExclusiveReadLockStrategy(Map<String, Object> params) {
+ private static <FTPFile> GenericFileExclusiveReadLockStrategy<FTPFile> getExclusiveReadLockStrategy(Map<String, Object> params) {
GenericFileExclusiveReadLockStrategy<FTPFile> strategy = (GenericFileExclusiveReadLockStrategy<FTPFile>) params.get("exclusiveReadLockStrategy");
if (strategy != null) {
return strategy;
@@ -109,7 +109,7 @@
}
return readLockStrategy;
} else if ("changed".equals(readLock)) {
- GenericFileExclusiveReadLockStrategy<FTPFile> readLockStrategy = new FtpChangedExclusiveReadLockStrategy();
+ GenericFileExclusiveReadLockStrategy readLockStrategy = new FtpChangedExclusiveReadLockStrategy();
Long timeout = (Long) params.get("readLockTimeout");
if (timeout != null) {
readLockStrategy.setTimeout(timeout);
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
index e27efbd..af423b5 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
@@ -89,7 +89,7 @@
}
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
private static <LsEntry> GenericFileExclusiveReadLockStrategy<LsEntry> getExclusiveReadLockStrategy(Map<String, Object> params) {
GenericFileExclusiveReadLockStrategy<LsEntry> strategy = (GenericFileExclusiveReadLockStrategy<LsEntry>) params.get("exclusiveReadLockStrategy");
if (strategy != null) {
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java
index a88bbc9..9fcfdee 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpFilterTest.java
@@ -35,7 +35,7 @@
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
- jndi.bind("myFilter", new MyFileFilter<Object>());
+ jndi.bind("myFilter", new MyFileFilter());
return jndi;
}
@@ -72,8 +72,8 @@
}
// START SNIPPET: e1
- public class MyFileFilter<T> implements GenericFileFilter<T> {
- public boolean accept(GenericFile<T> file) {
+ public class MyFileFilter implements GenericFileFilter {
+ public boolean accept(GenericFile file) {
// we don't accept any files starting with skip in the name
return !file.getFileName().startsWith("skip");
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java
index 28e5bd3..ead6c1c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileFilterTest.java
@@ -36,7 +36,7 @@
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
- jndi.bind("myFilter", new MyFileFilter<Object>());
+ jndi.bind("myFilter", new MyFileFilter());
return jndi;
}
@@ -79,9 +79,9 @@
}
// START SNIPPET: e1
- public class MyFileFilter<T> implements GenericFileFilter<T> {
+ public class MyFileFilter implements GenericFileFilter {
- public boolean accept(GenericFile<T> file) {
+ public boolean accept(GenericFile file) {
// we only want report files
return file.getFileName().startsWith("report");
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java
index 40774f0..c68724c 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java
@@ -72,9 +72,9 @@
}
// START SNIPPET: e1
- public class MyRemoteFileSorter implements Comparator<RemoteFile<?>> {
+ public class MyRemoteFileSorter implements Comparator<RemoteFile> {
- public int compare(RemoteFile<?> o1, RemoteFile<?> o2) {
+ public int compare(RemoteFile o1, RemoteFile o2) {
return o1.getFileNameOnly().compareToIgnoreCase(o2.getFileNameOnly());
}
}
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java
index 736d3d1..61ef4b7 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpBrowsableEndpointTest.java
@@ -55,12 +55,13 @@
public void testBrowsableOneFile() throws Exception {
template.sendBodyAndHeader(getFtpUrl(), "A", Exchange.FILE_NAME, "a.txt");
- FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
assertNotNull(endpoint);
MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
assertEquals(0, repo.getCacheSize());
+ @SuppressWarnings("unchecked")
List<Exchange> list = endpoint.getExchanges();
assertNotNull(list);
assertEquals(1, list.size());
@@ -80,12 +81,13 @@
template.sendBodyAndHeader(getFtpUrl(), "A", Exchange.FILE_NAME, "a.txt");
template.sendBodyAndHeader(getFtpUrl(), "B", Exchange.FILE_NAME, "b.txt");
- FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl() + "&sortBy=file:name", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint(getFtpUrl() + "&sortBy=file:name", FtpEndpoint.class);
assertNotNull(endpoint);
MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
assertEquals(0, repo.getCacheSize());
+ @SuppressWarnings("unchecked")
List<Exchange> list = endpoint.getExchanges();
assertNotNull(list);
assertEquals(2, list.size());
@@ -109,12 +111,13 @@
template.sendBodyAndHeader(getFtpUrl(), "B", Exchange.FILE_NAME, "foo/b.txt");
template.sendBodyAndHeader(getFtpUrl(), "C", Exchange.FILE_NAME, "bar/c.txt");
- FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl() + "&recursive=true&sortBy=file:name", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint(getFtpUrl() + "&recursive=true&sortBy=file:name", FtpEndpoint.class);
assertNotNull(endpoint);
MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
assertEquals(0, repo.getCacheSize());
+ @SuppressWarnings("unchecked")
List<Exchange> list = endpoint.getExchanges();
assertNotNull(list);
assertEquals(3, list.size());
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java
index b2c3338..4b22c08 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMultipleDirectoriesTest.java
@@ -47,14 +47,14 @@
assertMockEndpointsSatisfied();
Exchange exchange = mock.getExchanges().get(0);
- RemoteFile<?> file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ RemoteFile file = (RemoteFile) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
assertNotNull(file);
assertDirectoryEquals("multidir/bye.txt", file.getAbsoluteFilePath());
assertDirectoryEquals("bye.txt", file.getRelativeFilePath());
assertEquals("bye.txt", file.getFileName());
exchange = mock.getExchanges().get(1);
- file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ file = (RemoteFile) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
assertNotNull(file);
assertDirectoryEquals("multidir/sub/hello.txt", file.getAbsoluteFilePath());
assertDirectoryEquals("sub/hello.txt", file.getRelativeFilePath());
@@ -62,7 +62,7 @@
assertEquals("hello.txt", file.getFileNameOnly());
exchange = mock.getExchanges().get(2);
- file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ file = (RemoteFile) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
assertNotNull(file);
assertDirectoryEquals("multidir/sub/sub2/godday.txt", file.getAbsoluteFilePath());
assertDirectoryEquals("sub/sub2/godday.txt", file.getRelativeFilePath());
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java
index 9cc980c..5ff3ca2 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerWithNoFileOptionTest.java
@@ -49,7 +49,7 @@
assertMockEndpointsSatisfied();
Exchange exchange = mock.getExchanges().get(0);
- RemoteFile<?> file = (RemoteFile<?>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ RemoteFile file = (RemoteFile) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
assertNotNull(file);
assertEquals("hello.txt", file.getAbsoluteFilePath());
assertEquals("hello.txt", file.getRelativeFilePath());
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
index 12aea2a..1745ee1 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
@@ -28,7 +28,7 @@
@Test
public void testFtpConfigurationDefaults() {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://hostname", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://hostname", FtpEndpoint.class);
RemoteFileConfiguration config = endpoint.getConfiguration();
assertEquals("ftp", config.getProtocol());
@@ -87,7 +87,7 @@
@Test
public void testFtpExplicitConfiguration() {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://user@hostname:1021/some/file?password=secret&binary=true", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://user@hostname:1021/some/file?password=secret&binary=true", FtpEndpoint.class);
RemoteFileConfiguration config = endpoint.getConfiguration();
assertEquals("ftp", config.getProtocol());
@@ -162,7 +162,7 @@
}
private void assertRemoteFileEndpointFile(String endpointUri, String expectedFile) {
- RemoteFileEndpoint<?> endpoint = resolveMandatoryEndpoint(context, endpointUri, RemoteFileEndpoint.class);
+ RemoteFileEndpoint endpoint = resolveMandatoryEndpoint(context, endpointUri, RemoteFileEndpoint.class);
assertNotNull("Could not find endpoint: " + endpointUri, endpoint);
String file = endpoint.getConfiguration().getDirectory();
@@ -185,7 +185,7 @@
@Test
public void testPasswordInContextPathConfiguration() {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://user:secret@hostname:1021/some/file", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://user:secret@hostname:1021/some/file", FtpEndpoint.class);
RemoteFileConfiguration config = endpoint.getConfiguration();
assertEquals("ftp", config.getProtocol());
@@ -197,7 +197,7 @@
@Test
public void testStartingDirectoryWithDot() throws Exception {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://user@hostname?password=secret", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://user@hostname?password=secret", FtpEndpoint.class);
FtpConfiguration config = endpoint.getConfiguration();
config.setHost("somewhere");
config.setDirectory("temp.dir");
@@ -210,7 +210,7 @@
@Test
public void testPathSeparatorAuto() {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://hostname/foo/bar?separator=Auto", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://hostname/foo/bar?separator=Auto", FtpEndpoint.class);
RemoteFileConfiguration config = endpoint.getConfiguration();
assertEquals("ftp", config.getProtocol());
@@ -224,7 +224,7 @@
@Test
public void testPathSeparatorUnix() {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://hostname/foo/bar?separator=UNIX", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://hostname/foo/bar?separator=UNIX", FtpEndpoint.class);
RemoteFileConfiguration config = endpoint.getConfiguration();
assertEquals("ftp", config.getProtocol());
@@ -238,7 +238,7 @@
@Test
public void testPathSeparatorWindows() {
- FtpEndpoint<?> endpoint = context.getEndpoint("ftp://hostname/foo/bar?separator=Windows", FtpEndpoint.class);
+ FtpEndpoint endpoint = context.getEndpoint("ftp://hostname/foo/bar?separator=Windows", FtpEndpoint.class);
RemoteFileConfiguration config = endpoint.getConfiguration();
assertEquals("ftp", config.getProtocol());
diff --git a/components/camel-gae/pom.xml b/components/camel-gae/pom.xml
index 01fb3cd..b497c4a 100644
--- a/components/camel-gae/pom.xml
+++ b/components/camel-gae/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java
index 66dea9d..a4983a8 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthComponent.java
@@ -18,8 +18,6 @@
import java.util.Map;
-import com.google.gdata.client.authn.oauth.GoogleOAuthParameters;
-
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.component.gae.bind.OutboundBinding;
@@ -80,11 +78,12 @@
}
@Override
+ @SuppressWarnings("unchecked")
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
GAuthEndpoint endpoint = new GAuthEndpoint(uri, this, remaining);
- OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> authorizeBinding = resolveAndRemoveReferenceParameter(
+ OutboundBinding authorizeBinding = resolveAndRemoveReferenceParameter(
parameters, "authorizeBindingRef", GAuthAuthorizeBinding.class, new GAuthAuthorizeBinding());
- OutboundBinding<GAuthEndpoint, GoogleOAuthParameters, GoogleOAuthParameters> upgradeBinding = resolveAndRemoveReferenceParameter(
+ OutboundBinding upgradeBinding = resolveAndRemoveReferenceParameter(
parameters, "upgradeBindingRef", GAuthUpgradeBinding.class, new GAuthUpgradeBinding());
GAuthService service = resolveAndRemoveReferenceParameter(
parameters, "serviceRef", GAuthService.class, new GAuthServiceImpl(endpoint));
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
index 132ffca..9932118 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpComponent.java
@@ -19,12 +19,6 @@
import java.net.URI;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import com.google.appengine.api.urlfetch.HTTPRequest;
-import com.google.appengine.api.urlfetch.HTTPResponse;
-
import org.apache.camel.Endpoint;
import org.apache.camel.component.gae.bind.InboundBinding;
import org.apache.camel.component.gae.bind.OutboundBinding;
@@ -49,9 +43,9 @@
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
boolean throwException = getAndRemoveParameter(parameters, "throwExceptionOnFailure", Boolean.class, true);
boolean bridgeEndpoint = getAndRemoveParameter(parameters, "bridgeEndpoint", Boolean.class, true);
- OutboundBinding<GHttpEndpoint, HTTPRequest, HTTPResponse> outboundBinding = resolveAndRemoveReferenceParameter(
+ OutboundBinding outboundBinding = resolveAndRemoveReferenceParameter(
parameters, "outboundBindingRef", OutboundBinding.class, new GHttpBinding());
- InboundBinding<GHttpEndpoint, HttpServletRequest, HttpServletResponse> inboundBinding = resolveAndRemoveReferenceParameter(
+ InboundBinding inboundBinding = resolveAndRemoveReferenceParameter(
parameters, "inboundBindingRef", InboundBinding.class, new GHttpBinding());
GHttpEndpoint endpoint = (GHttpEndpoint)super.createEndpoint(uri, remaining, parameters);
endpoint.setThrowExceptionOnFailure(throwException);
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
index c2a6449..71589bc 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java
@@ -83,6 +83,7 @@
* decoded query string. Replaces the query part of
* <code>uri</code> if not <code>null</code>.
*/
+ @SuppressWarnings("unchecked")
static URL getEndpointUrl(String uri, String query) throws Exception {
Map<String, Object> parameters = null;
URI uriObj = new URI(uri);
@@ -96,7 +97,7 @@
} else { // ghttp or anything else
uriObj = new URI(HTTP_SCHEME + ":" + uriObj.getRawSchemeSpecificPart());
}
- return URISupport.createRemainingURI(uriObj, parameters).toURL();
+ return URISupport.createRemainingURI(uriObj, (Map)parameters).toURL();
}
public URL getEndpointUrl() throws Exception {
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginComponent.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginComponent.java
index 5c0f79f..1c908bd 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginComponent.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/login/GLoginComponent.java
@@ -47,8 +47,9 @@
}
@Override
+ @SuppressWarnings("unchecked")
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- OutboundBinding<GLoginEndpoint, GLoginData, GLoginData> outboundBinding = resolveAndRemoveReferenceParameter(
+ OutboundBinding outboundBinding = resolveAndRemoveReferenceParameter(
parameters, "outboundBindingRef", GLoginBinding.class, new GLoginBinding());
GLoginService service = resolveAndRemoveReferenceParameter(
parameters, "serviceRef", GLoginService.class, new GLoginServiceImpl());
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
index 66decb5..f28dcb3 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/mail/GMailComponent.java
@@ -18,8 +18,6 @@
import java.util.Map;
-import com.google.appengine.api.mail.MailService.Message;
-
import org.apache.camel.Endpoint;
import org.apache.camel.component.gae.bind.OutboundBinding;
import org.apache.camel.impl.DefaultComponent;
@@ -34,7 +32,7 @@
@Override
@SuppressWarnings("unchecked")
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- OutboundBinding<GMailEndpoint, Message, Void> binding = resolveAndRemoveReferenceParameter(
+ OutboundBinding binding = resolveAndRemoveReferenceParameter(
parameters, "outboundBindingRef", OutboundBinding.class, new GMailBinding());
GMailEndpoint endpoint = new GMailEndpoint(uri, this, remaining);
endpoint.setOutboundBinding(binding);
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java
index 2adcaf3..b679ab7 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/task/GTaskComponent.java
@@ -19,11 +19,7 @@
import java.net.URI;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import com.google.appengine.api.taskqueue.QueueFactory;
-import com.google.appengine.api.taskqueue.TaskOptions;
import org.apache.camel.Endpoint;
import org.apache.camel.component.gae.bind.InboundBinding;
@@ -50,9 +46,9 @@
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
String workerRoot = getAndRemoveParameter(
parameters, "workerRoot", String.class, "worker");
- OutboundBinding<GTaskEndpoint, TaskOptions, Void> outboundBinding = resolveAndRemoveReferenceParameter(
+ OutboundBinding outboundBinding = resolveAndRemoveReferenceParameter(
parameters, "outboundBindingRef", OutboundBinding.class, new GTaskBinding());
- InboundBinding<GTaskEndpoint, HttpServletRequest, HttpServletResponse> inboundBinding = resolveAndRemoveReferenceParameter(
+ InboundBinding inboundBinding = resolveAndRemoveReferenceParameter(
parameters, "inboundBindingRef", InboundBinding.class, new GTaskBinding());
GTaskEndpointInfo info = new GTaskEndpointInfo(uri, remaining);
GTaskEndpoint endpoint = (GTaskEndpoint)super.createEndpoint(
diff --git a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java
index a1c33cf..5820cc8 100644
--- a/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java
+++ b/components/camel-gae/src/test/java/org/apache/camel/component/gae/http/GHttpTestServlet.java
@@ -26,9 +26,6 @@
import org.apache.commons.io.IOUtils;
public class GHttpTestServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
-
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doPost(req, resp);
diff --git a/components/camel-groovy/pom.xml b/components/camel-groovy/pom.xml
index e5beb9c..c47e900 100644
--- a/components/camel-groovy/pom.xml
+++ b/components/camel-groovy/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -49,7 +49,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/CamelGroovyMethods.java b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/CamelGroovyMethods.java
index 3d81fcb..691e6ff 100644
--- a/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/CamelGroovyMethods.java
+++ b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/CamelGroovyMethods.java
@@ -31,15 +31,15 @@
// Utility Class
}
- public static FilterDefinition filter(ProcessorDefinition<?> self, Closure<?> filter) {
+ public static FilterDefinition filter(ProcessorDefinition self, Closure filter) {
return self.filter(toExpression(filter));
}
- public static ChoiceDefinition when(ChoiceDefinition self, Closure<?> filter) {
+ public static ChoiceDefinition when(ChoiceDefinition self, Closure filter) {
return self.when(toExpression(filter));
}
- public static ExpressionSupport toExpression(final Closure<?> filter) {
+ public static ExpressionSupport toExpression(final Closure filter) {
return new ExpressionSupport() {
protected String assertionFailureMessage(Exchange exchange) {
return filter.toString();
diff --git a/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/GroovyExpression.java b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/GroovyExpression.java
index 43b6812..9fdbc23 100644
--- a/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/GroovyExpression.java
+++ b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/GroovyExpression.java
@@ -65,9 +65,10 @@
return null;
}
+ @SuppressWarnings("unchecked")
@Override
- public Set<Entry<String, Object>> entrySet() {
- return Collections.emptySet();
+ public Set entrySet() {
+ return Collections.EMPTY_SET;
}
});
}
diff --git a/components/camel-gson/pom.xml b/components/camel-gson/pom.xml
deleted file mode 100644
index 7955d46..0000000
--- a/components/camel-gson/pom.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-gson</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Gson</name>
- <description>Camel Gson support</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.component.gson.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- <version>${gson-version}</version>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
deleted file mode 100644
index 4545166..0000000
--- a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.gson;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.Map;
-
-import com.google.gson.Gson;
-import org.apache.camel.Exchange;
-import org.apache.camel.spi.DataFormat;
-
-/**
- * A <a href="http://camel.apache.org/data-format.html">data format</a> ({@link DataFormat})
- * using <a href="http://code.google.com/p/google-gson/">Gson</a> to marshal to and from JSON.
- */
-public class GsonDataFormat implements DataFormat {
-
- private final Gson gson;
- private Class<?> unmarshalType;
-
- public GsonDataFormat() {
- this(Map.class);
- }
-
- /**
- * Use the default Gson {@link Gson} and with a custom
- * unmarshal type
- *
- * @param unmarshalType the custom unmarshal type
- */
- public GsonDataFormat(Class<?> unmarshalType) {
- this(new Gson(), unmarshalType);
- }
-
- /**
- * Use a custom Gson mapper and and unmarshal type
- *
- * @param gson the custom mapper
- * @param unmarshalType the custom unmarshal type
- */
- public GsonDataFormat(Gson gson, Class<?> unmarshalType) {
- this.gson = gson;
- this.unmarshalType = unmarshalType;
- }
-
- @Override
- public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
- Writer writer = new BufferedWriter(new OutputStreamWriter(stream));
- gson.toJson(graph, writer);
- writer.close();
- }
-
- @Override
- public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
- BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
- Object result = gson.fromJson(reader, this.unmarshalType);
- reader.close();
- return result;
- }
-
- // Properties
- // -------------------------------------------------------------------------
-
- public Class<?> getUnmarshalType() {
- return this.unmarshalType;
- }
-
- public void setUnmarshalType(Class<?> unmarshalType) {
- this.unmarshalType = unmarshalType;
- }
-
- public Gson getGson() {
- return this.gson;
- }
-
-}
diff --git a/components/camel-gson/src/main/resources/META-INF/LICENSE.txt b/components/camel-gson/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/components/camel-gson/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-gson/src/main/resources/META-INF/NOTICE.txt b/components/camel-gson/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-gson/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-gson/src/main/resources/META-INF/services/org/apache/camel/dataformat/json-gson b/components/camel-gson/src/main/resources/META-INF/services/org/apache/camel/dataformat/json-gson
deleted file mode 100644
index 5256011..0000000
--- a/components/camel-gson/src/main/resources/META-INF/services/org/apache/camel/dataformat/json-gson
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.component.gson.GsonDataFormat
diff --git a/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonConcurrentTest.java b/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonConcurrentTest.java
deleted file mode 100644
index ddd7471..0000000
--- a/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonConcurrentTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.gson;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.dataformat.JsonLibrary;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-/**
- * @version
- */
-public class GsonConcurrentTest extends CamelTestSupport {
-
- @Test
- public void testNoConcurrentProducers() throws Exception {
- doSendMessages(1, 1);
- }
-
- @Test
- public void testConcurrentProducers() throws Exception {
- doSendMessages(10, 5);
- }
-
- private void doSendMessages(int files, int poolSize) throws Exception {
- getMockEndpoint("mock:result").expectedMessageCount(files);
- getMockEndpoint("mock:result").assertNoDuplicates(body());
-
- ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- for (int i = 0; i < files; i++) {
- final int index = i;
- executor.submit(new Callable<Object>() {
- public Object call() throws Exception {
- TestPojo pojo = new TestPojo();
- pojo.setName("Hi " + index);
-
- template.sendBody("direct:start", pojo);
- return null;
- }
- });
- }
-
- assertMockEndpointsSatisfied();
- executor.shutdownNow();
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("direct:start").
- marshal().json(JsonLibrary.Gson).
- to("log:marshalled").
- to("direct:marshalled");
-
- from("direct:marshalled").
- unmarshal().json(JsonLibrary.Gson, TestPojo.class).
- to("mock:result");
- }
- };
- }
-
-}
diff --git a/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonJsonDataFormatTest.java b/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonJsonDataFormatTest.java
deleted file mode 100644
index 972f905..0000000
--- a/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonJsonDataFormatTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.gson;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.model.dataformat.JsonLibrary;
-
-public class GsonJsonDataFormatTest extends GsonMarshalTest {
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:in").marshal().json(JsonLibrary.Gson);
- from("direct:back").unmarshal().json(JsonLibrary.Gson).to("mock:reverse");
-
- from("direct:inPojo").marshal().json(JsonLibrary.Gson);
- from("direct:backPojo").unmarshal().json(JsonLibrary.Gson, TestPojo.class).to("mock:reversePojo");
- }
- };
- }
-
-}
\ No newline at end of file
diff --git a/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonMarshalTest.java b/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonMarshalTest.java
deleted file mode 100644
index 2ea29eb..0000000
--- a/components/camel-gson/src/test/java/org/apache/camel/component/gson/GsonMarshalTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.gson;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class GsonMarshalTest extends CamelTestSupport {
-
- @Test
- public void testMarshalAndUnmarshalMap() throws Exception {
- Map<String, String> in = new HashMap<String, String>();
- in.put("name", "Camel");
-
- MockEndpoint mock = getMockEndpoint("mock:reverse");
- mock.expectedMessageCount(1);
- mock.message(0).body().isInstanceOf(Map.class);
- mock.message(0).body().equals(in);
-
- Object marshalled = template.requestBody("direct:in", in);
- String marshalledAsString = context.getTypeConverter().convertTo(String.class, marshalled);
- assertEquals("{\"name\":\"Camel\"}", marshalledAsString);
-
- template.sendBody("direct:back", marshalled);
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testMarshalAndUnmarshalPojo() throws Exception {
- TestPojo in = new TestPojo();
- in.setName("Camel");
-
- MockEndpoint mock = getMockEndpoint("mock:reversePojo");
- mock.expectedMessageCount(1);
- mock.message(0).body().isInstanceOf(TestPojo.class);
- mock.message(0).body().equals(in);
-
- Object marshalled = template.requestBody("direct:inPojo", in);
- String marshalledAsString = context.getTypeConverter().convertTo(String.class, marshalled);
- assertEquals("{\"name\":\"Camel\"}", marshalledAsString);
-
- template.sendBody("direct:backPojo", marshalled);
-
- mock.assertIsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- GsonDataFormat format = new GsonDataFormat();
-
- from("direct:in").marshal(format);
- from("direct:back").unmarshal(format).to("mock:reverse");
-
- GsonDataFormat formatPojo = new GsonDataFormat(TestPojo.class);
-
- from("direct:inPojo").marshal(formatPojo);
- from("direct:backPojo").unmarshal(formatPojo).to("mock:reversePojo");
- }
- };
- }
-
-}
diff --git a/components/camel-gson/src/test/java/org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.java b/components/camel-gson/src/test/java/org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.java
deleted file mode 100644
index c15a297..0000000
--- a/components/camel-gson/src/test/java/org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.gson;
-
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelSpringTestSupport;
-import org.junit.Test;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * @version
- */
-public class SpringGsonJsonDataFormatTest extends CamelSpringTestSupport {
-
- @Test
- public void testMarshalAndUnmarshalPojo() throws Exception {
- TestPojo in = new TestPojo();
- in.setName("Camel");
-
- MockEndpoint mock = getMockEndpoint("mock:reversePojo");
- mock.expectedMessageCount(1);
- mock.message(0).body().isInstanceOf(TestPojo.class);
- mock.message(0).body().equals(in);
-
- Object marshalled = template.requestBody("direct:inPojo", in);
- String marshalledAsString = context.getTypeConverter().convertTo(String.class, marshalled);
- assertEquals("{\"name\":\"Camel\"}", marshalledAsString);
-
- template.sendBody("direct:backPojo", marshalled);
-
- mock.assertIsSatisfied();
- }
-
- @Override
- protected AbstractXmlApplicationContext createApplicationContext() {
- return new ClassPathXmlApplicationContext("org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.xml");
- }
-
-}
diff --git a/components/camel-gson/src/test/java/org/apache/camel/component/gson/TestPojo.java b/components/camel-gson/src/test/java/org/apache/camel/component/gson/TestPojo.java
deleted file mode 100644
index b13bf7e..0000000
--- a/components/camel-gson/src/test/java/org/apache/camel/component/gson/TestPojo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.gson;
-
-public class TestPojo {
-
- private String name;
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public boolean equals(Object obj) {
- return this.name.equals(((TestPojo) obj).getName());
- }
-
- @Override
- public int hashCode() {
- return name != null ? name.hashCode() : 0;
- }
-
- @Override
- public String toString() {
- return "TestPojo[" + name + "]";
- }
-}
\ No newline at end of file
diff --git a/components/camel-gson/src/test/resources/log4j.properties b/components/camel-gson/src/test/resources/log4j.properties
deleted file mode 100644
index 3244a4b..0000000
--- a/components/camel-gson/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, file
-
-# uncomment this to turn on debug of camel
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-gson-test.log
-log4j.appender.file.append=true
diff --git a/components/camel-gson/src/test/resources/org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.xml b/components/camel-gson/src/test/resources/org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.xml
deleted file mode 100644
index 2111799..0000000
--- a/components/camel-gson/src/test/resources/org/apache/camel/component/gson/SpringGsonJsonDataFormatTest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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
- ">
-
- <!-- START SNIPPET: e1 -->
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-
- <!-- we define the json jackson data formats to be used -->
- <dataFormats>
- <!-- this one uses our own TestPojo class as unmarshal type -->
- <json id="gson" library="Gson" unmarshalTypeName="org.apache.camel.component.gson.TestPojo"/>
- </dataFormats>
-
- <route>
- <from uri="direct:inPojo"/>
- <marshal ref="gson"/>
- </route>
-
- <route>
- <from uri="direct:backPojo"/>
- <unmarshal ref="gson"/>
- <to uri="mock:reversePojo"/>
- </route>
-
- </camelContext>
- <!-- END SNIPPET: e1 -->
-
-</beans>
diff --git a/components/camel-guice/pom.xml b/components/camel-guice/pom.xml
index ed7c796..ce512af 100644
--- a/components/camel-guice/pom.xml
+++ b/components/camel-guice/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModuleWithMatchingRoutes.java b/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModuleWithMatchingRoutes.java
index 4105514..f47df21 100644
--- a/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModuleWithMatchingRoutes.java
+++ b/components/camel-guice/src/main/java/org/apache/camel/guice/CamelModuleWithMatchingRoutes.java
@@ -40,7 +40,6 @@
*
* @version
*/
-@SuppressWarnings("rawtypes")
public class CamelModuleWithMatchingRoutes extends CamelModule {
private final Matcher<Class> matcher;
diff --git a/components/camel-guice/src/test/java/org/apache/camel/guice/FileEndpointReferenceRouteTest.java b/components/camel-guice/src/test/java/org/apache/camel/guice/FileEndpointReferenceRouteTest.java
index 713ca1e..0710ed5 100644
--- a/components/camel-guice/src/test/java/org/apache/camel/guice/FileEndpointReferenceRouteTest.java
+++ b/components/camel-guice/src/test/java/org/apache/camel/guice/FileEndpointReferenceRouteTest.java
@@ -41,9 +41,9 @@
}
}
- public static class MyFileFilter<T> implements GenericFileFilter<T> {
+ public static class MyFileFilter implements GenericFileFilter {
- public boolean accept(GenericFile<T> file) {
+ public boolean accept(GenericFile file) {
// we only want report files
return file.getFileName().startsWith("report");
}
@@ -59,8 +59,8 @@
@Provides
@JndiBind("fileFilter")
- public GenericFileFilter<?> getfileFilter() {
- return new MyFileFilter<Object>();
+ public GenericFileFilter getfileFilter() {
+ return new MyFileFilter();
}
diff --git a/components/camel-hawtdb/pom.xml b/components/camel-hawtdb/pom.xml
index 71980e7..85727a9 100644
--- a/components/camel-hawtdb/pom.xml
+++ b/components/camel-hawtdb/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -55,7 +55,12 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-hazelcast/pom.xml b/components/camel-hazelcast/pom.xml
index 39a03d5..782f51c 100644
--- a/components/camel-hazelcast/pom.xml
+++ b/components/camel-hazelcast/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -62,7 +62,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
@@ -70,12 +70,19 @@
<build>
<plugins>
+
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <childDelegation>false</childDelegation>
+ <useFile>true</useFile>
<forkMode>pertest</forkMode>
+ <excludes>
+ <exclude>**/XXXTest.*</exclude>
+ </excludes>
</configuration>
</plugin>
+
</plugins>
</build>
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListProducer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListProducer.java
index 3ae6fd2..c41a8e5 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListProducer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/list/HazelcastListProducer.java
@@ -35,9 +35,11 @@
private final IList<Object> list;
private final HazelcastComponentHelper helper = new HazelcastComponentHelper();
+ private HazelcastInstance hazelcastInstance;
public HazelcastListProducer(HazelcastInstance hazelcastInstance, Endpoint endpoint, String listName) {
super(endpoint);
+ this.hazelcastInstance = hazelcastInstance;
this.list = hazelcastInstance.getList(listName);
}
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapProducer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapProducer.java
index c19d353..bf289f8 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapProducer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/map/HazelcastMapProducer.java
@@ -32,9 +32,11 @@
private final IMap<String, Object> cache;
private final HazelcastComponentHelper helper = new HazelcastComponentHelper();
+ private HazelcastInstance hazelcastInstance;
public HazelcastMapProducer(HazelcastInstance hazelcastInstance, HazelcastMapEndpoint endpoint, String cacheName) {
super(endpoint);
+ this.hazelcastInstance = hazelcastInstance;
this.cache = hazelcastInstance.getMap(cacheName);
}
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapProducer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapProducer.java
index 73e58a8..5ba1cb4 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapProducer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/multimap/HazelcastMultimapProducer.java
@@ -32,9 +32,11 @@
private final MultiMap<Object, Object> cache;
private final HazelcastComponentHelper helper = new HazelcastComponentHelper();
+ private HazelcastInstance hazelcastInstance;
public HazelcastMultimapProducer(HazelcastInstance hazelcastInstance, Endpoint endpoint, String cacheName) {
super(endpoint);
+ this.hazelcastInstance = hazelcastInstance;
this.cache = Hazelcast.getMultiMap(cacheName);
}
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueProducer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueProducer.java
index 2edf49a3..4f5a664 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueProducer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/queue/HazelcastQueueProducer.java
@@ -34,9 +34,11 @@
private IQueue<Object> queue;
private HazelcastComponentHelper helper = new HazelcastComponentHelper();
+ private HazelcastInstance hazelcastInstance;
public HazelcastQueueProducer(HazelcastInstance hazelcastInstance, Endpoint endpoint, String queueName) {
super(endpoint);
+ this.hazelcastInstance = hazelcastInstance;
this.queue = hazelcastInstance.getQueue(queueName);
}
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
index 3697313..2f5111e 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java
@@ -69,7 +69,7 @@
}
public void run() {
- final BlockingQueue<?> queue = endpoint.getQueue();
+ final BlockingQueue queue = endpoint.getQueue();
while (queue != null && isRunAllowed()) {
final Exchange exchange = this.getEndpoint().createExchange();
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java
index 931e48a..e369313 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaEndpoint.java
@@ -32,11 +32,13 @@
*/
public class HazelcastSedaEndpoint extends HazelcastDefaultEndpoint {
- private final BlockingQueue<Object> queue;
+ private final BlockingQueue queue;
private final HazelcastSedaConfiguration configuration;
+ private HazelcastInstance hazelcastInstance;
public HazelcastSedaEndpoint(final HazelcastInstance hazelcastInstance, final String uri, final HazelcastComponent component, final HazelcastSedaConfiguration configuration) {
super(component.getHazelcastInstance(), uri, component);
+ this.hazelcastInstance = hazelcastInstance;
this.queue = hazelcastInstance.getQueue(configuration.getQueueName());
this.configuration = configuration;
if (ObjectHelper.isEmpty(configuration.getQueueName())) {
@@ -52,7 +54,7 @@
return new HazelcastSedaConsumer(this, processor);
}
- public BlockingQueue<Object> getQueue() {
+ public BlockingQueue getQueue() {
return queue;
}
diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaProducer.java b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaProducer.java
index b8c4696f..6bcb7a2 100644
--- a/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaProducer.java
+++ b/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaProducer.java
@@ -31,9 +31,9 @@
*/
public class HazelcastSedaProducer extends DefaultAsyncProducer {
- private final transient BlockingQueue<Object> queue;
+ private final transient BlockingQueue queue;
- public HazelcastSedaProducer(final HazelcastSedaEndpoint endpoint, final BlockingQueue<Object> hzlq) {
+ public HazelcastSedaProducer(final HazelcastSedaEndpoint endpoint, final BlockingQueue hzlq) {
super(endpoint);
this.queue = hzlq;
}
@@ -44,6 +44,7 @@
return true;
}
+ @SuppressWarnings("unchecked")
private void checkAndStore(final Exchange exchange) {
Object obj;
Object body = exchange.getIn().getBody();
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java
index abf8bf8..178021d 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java
@@ -16,12 +16,8 @@
*/
package org.apache.camel.component.hazelcast;
-import com.hazelcast.core.Hazelcast;
-
import org.apache.camel.test.junit4.CamelSpringTestSupport;
-
import org.junit.Test;
-
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -64,12 +60,21 @@
assertEquals(9, body);
}
+ /*
+ * will be fixed in next hazelcast version (1.9.3). Mail from Talip (21.02.2011):
+ *
+ * I see. Hazelcast.shutdownAll() should cleanup instances (maps/queues). I just fixed it.
+ *
+ * AtomicNumber.destroy() should also destroy the number and if you call atomicNumber.get() after the destroy it should throw IllegalStateException. It is also fixed.
+ *
+ * set test to true by default. TODO: if we'll get the new hazelcast version I'll fix the test.
+ */
@Test
public void testDestroy() {
template.sendBody("direct:set", 10);
template.sendBody("direct:destroy", null);
- assertTrue(Hazelcast.getInstances().isEmpty());
+ // assertTrue(Hazelcast.getInstances().isEmpty());
}
}
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java
index 7f9d660..1b20dc0 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerTest.java
@@ -16,11 +16,8 @@
*/
package org.apache.camel.component.hazelcast;
-import com.hazelcast.core.Hazelcast;
-
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
-
import org.junit.Test;
public class HazelcastAtomicnumberProducerTest extends CamelTestSupport {
@@ -57,12 +54,21 @@
assertEquals(9, body);
}
+ /*
+ * will be fixed in next hazelcast version (1.9.3). Mail from Talip (21.02.2011):
+ *
+ * I see. Hazelcast.shutdownAll() should cleanup instances (maps/queues). I just fixed it.
+ *
+ * AtomicNumber.destroy() should also destroy the number and if you call atomicNumber.get() after the destroy it should throw IllegalStateException. It is also fixed.
+ *
+ * set test to true by default. TODO: if we'll get the new hazelcast version I'll fix the test.
+ */
@Test
public void testDestroy() {
template.sendBody("direct:set", 10);
template.sendBody("direct:destroy", null);
- assertTrue(Hazelcast.getInstances().isEmpty());
+ // assertTrue(Hazelcast.getInstances().isEmpty());
}
@Override
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastInstanceConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastInstanceConsumerTest.java
index 229ee19..cc985f0 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastInstanceConsumerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastInstanceConsumerTest.java
@@ -26,7 +26,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -54,6 +53,7 @@
}
@Test
+ @SuppressWarnings("deprecation")
@Ignore("Shutdown causes further hazelast tests to fail")
public void testRemoveInstance() throws InterruptedException {
@@ -62,7 +62,8 @@
HazelcastInstance h1 = Hazelcast.newHazelcastInstance(null);
- h1.getLifecycleService().shutdown();
+ // TODO --> check how an instance can be killed...
+ h1.shutdown();
assertMockEndpointsSatisfied(5000, TimeUnit.MILLISECONDS);
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java
index a1f858d..e3dff8f 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListConsumerTest.java
@@ -32,12 +32,13 @@
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
list = hazelcastInstance.getList("mm");
list.clear();
}
+
@Test
public void add() throws InterruptedException {
MockEndpoint out = getMockEndpoint("mock:added");
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java
index 3d88b87..a73693a 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastListProducerTest.java
@@ -18,11 +18,11 @@
import java.util.List;
-import com.hazelcast.core.HazelcastInstance;
+import com.hazelcast.core.Hazelcast;
+import com.hazelcast.core.HazelcastInstance;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
-
import org.junit.Test;
public class HazelcastListProducerTest extends CamelTestSupport {
@@ -31,7 +31,7 @@
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
list = hazelcastInstance.getList("bar");
list.clear();
@@ -39,12 +39,14 @@
@Test
public void addValue() throws InterruptedException {
+
template.sendBody("direct:add", "bar");
assertTrue(list.contains("bar"));
}
@Test
public void removeValue() throws InterruptedException {
+
list.add("foo1");
list.add("foo2");
list.add("foo3");
@@ -60,6 +62,8 @@
@Test
public void getValueWithIdx() {
+ // unsupported operation --> supported since 1.9.3
+
list.add("foo1");
list.add("foo2");
@@ -73,6 +77,8 @@
@Test
public void setValueWithIdx() {
+ // unsupported operation --> supported since 1.9.3
+
list.add("foo1");
list.add("foo2");
@@ -87,30 +93,36 @@
@Test
public void removeValueWithIdx() {
+ // unsupported operation --> supported since 1.9.3
+
list.add("foo1");
list.add("foo2");
assertEquals(2, list.size());
- // do not specify the value to delete, but the index
template.sendBodyAndHeader("direct:removevalue", null, HazelcastConstants.OBJECT_POS, 1);
assertEquals(1, list.size());
- assertEquals("foo1", list.get(0));
+
}
- @Test
- public void removeValueWithoutIdx() {
+ // @Test(expected = CamelExecutionException.class)
+ public void removeNullValue() {
+ // unsupported operation
+
+ /*
+ * TODO: is this case a norm ? should this case handled in a different way ?
+ */
+
+ List<String> list = Hazelcast.getList("bar");
+ list.clear();
+
list.add("foo1");
- list.add("foo2");
- assertEquals(2, list.size());
+ // do not specify the value to delete (null)
+ template.sendBody("direct:removevalue", null);
+ assertEquals(0, list.size());
- // do not specify the index to delete, but the value
- template.sendBody("direct:removevalue", "foo1");
-
- assertEquals(1, list.size());
- assertEquals("foo2", list.get(0));
}
@Override
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapConsumerTest.java
index 59f964d..aa495c7 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapConsumerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapConsumerTest.java
@@ -33,7 +33,7 @@
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
map = hazelcastInstance.getMap("foo");
map.clear();
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerForSpringTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerForSpringTest.java
index 6862be2..531ca93 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerForSpringTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerForSpringTest.java
@@ -31,13 +31,12 @@
public class HazelcastMapProducerForSpringTest extends CamelSpringTestSupport implements Serializable {
- private static final long serialVersionUID = 1L;
private IMap<String, Object> map;
@Override
protected void doPostSetup() throws Exception {
super.doPostSetup();
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
this.map = hazelcastInstance.getMap("foo");
this.map.clear();
@@ -110,7 +109,7 @@
public class Dummy implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3688457704655925278L;
private String foo;
private int bar;
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerTest.java
index 18c73e7..110ca14 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMapProducerTest.java
@@ -30,12 +30,11 @@
public class HazelcastMapProducerTest extends CamelTestSupport implements Serializable {
- private static final long serialVersionUID = 1L;
private IMap<String, Object> map;
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
map = hazelcastInstance.getMap("foo");
map.clear();
@@ -125,7 +124,7 @@
public class Dummy implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3688457704655925278L;
private String foo;
private int bar;
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapConsumerTest.java
index 1c379a8..aeb3559 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapConsumerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapConsumerTest.java
@@ -25,10 +25,9 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
-
-import org.junit.Ignore;
import org.junit.Test;
+
public class HazelcastMultimapConsumerTest extends CamelTestSupport {
private MultiMap<String, Object> map;
@@ -36,7 +35,7 @@
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
this.map = hazelcastInstance.getMultiMap("mm");
this.map.clear();
@@ -57,11 +56,12 @@
/*
* mail from talip (hazelcast) on 21.02.2011: MultiMap doesn't support eviction yet. We can and should add this feature.
+ *
+ * we leave the test in our code an set the result to asserted by default.
*/
- @Ignore("See also http://code.google.com/p/hazelcast/issues/detail?id=577&q=eviction")
@Test
public void testEnvict() throws InterruptedException {
- MockEndpoint out = getMockEndpoint("mock:envicted");
+ MockEndpoint out = super.getMockEndpoint("mock:envicted");
out.expectedMessageCount(1);
map.put("1", "my-foo-1");
@@ -71,7 +71,9 @@
map.put("5", "my-foo-5");
map.put("6", "my-foo-6");
- assertMockEndpointsSatisfied(30000, TimeUnit.MILLISECONDS);
+ // assertMockEndpointsSatisfied(30000, TimeUnit.MILLISECONDS);
+
+ assertTrue(true);
}
@Test
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerForSpringTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerForSpringTest.java
index b18fbba..85d0424 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerForSpringTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerForSpringTest.java
@@ -22,10 +22,10 @@
import com.hazelcast.core.MultiMap;
import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.apache.camel.util.CastUtils;
import org.junit.AfterClass;
import org.junit.Test;
-
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -81,7 +81,7 @@
map.put("4711", "my-foo");
template.sendBodyAndHeader("direct:get", null, HazelcastConstants.OBJECT_ID, "4711");
- Collection<?> body = consumer.receiveBody("seda:out", 5000, Collection.class);
+ Collection<Object> body = CastUtils.cast(consumer.receiveBody("seda:out", 5000, Collection.class));
assertTrue(body.contains("my-foo"));
}
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerTest.java
index f065a72..f5d3865 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastMultimapProducerTest.java
@@ -42,6 +42,8 @@
Hazelcast.shutdownAll();
}
+
+
@Test
public void testPut() throws InterruptedException {
template.sendBodyAndHeader("direct:put", "my-foo", HazelcastConstants.OBJECT_ID, "4711");
@@ -68,11 +70,12 @@
}
@Test
+ @SuppressWarnings("unchecked")
public void testGet() {
map.put("4711", "my-foo");
template.sendBodyAndHeader("direct:get", null, HazelcastConstants.OBJECT_ID, "4711");
- Collection<?> body = consumer.receiveBody("seda:out", 5000, Collection.class);
+ Collection<Object> body = consumer.receiveBody("seda:out", 5000, Collection.class);
assertTrue(body.contains("my-foo"));
}
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerTest.java
index 879929c..aa4f14b 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueConsumerTest.java
@@ -34,17 +34,19 @@
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
this.map = hazelcastInstance.getQueue("mm");
this.map.clear();
}
+
@AfterClass
public static void tearDownClass() {
Hazelcast.shutdownAll();
}
+
@Test
public void add() throws InterruptedException {
MockEndpoint out = getMockEndpoint("mock:added");
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueProducerTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueProducerTest.java
index 087729d..8c671e0 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueProducerTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastQueueProducerTest.java
@@ -32,7 +32,7 @@
@Override
protected void doPostSetup() throws Exception {
- HazelcastComponent component = context().getComponent("hazelcast", HazelcastComponent.class);
+ HazelcastComponent component = (HazelcastComponent) context().getComponent("hazelcast");
HazelcastInstance hazelcastInstance = component.getHazelcastInstance();
queue = hazelcastInstance.getQueue("bar");
queue.clear();
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaConfigurationTest.java.orig b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaConfigurationTest.java.orig
new file mode 100644
index 0000000..e57c439
--- /dev/null
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastSedaConfigurationTest.java.orig
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+package org.apache.camel.component.hazelcast;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.hazelcast.seda.HazelcastSedaEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class HazelcastSedaConfigurationTest extends CamelTestSupport {
+
+ @Test
+ public void createEndpointWithTransferExchange() throws Exception {
+ HazelcastComponent hzlqComponent = new HazelcastComponent(context);
+
+ HazelcastSedaEndpoint hzlqEndpoint = (HazelcastSedaEndpoint) hzlqComponent.createEndpoint("hazelcast:seda:foo?transferExchange=true");
+
+ assertEquals("Invalid queue name", "foo", hzlqEndpoint.getConfiguration().getQueueName());
+ assertTrue("Default value of concurrent consumers is invalid", hzlqEndpoint.getConfiguration().isTransferExchange());
+
+ hzlqEndpoint = (HazelcastSedaEndpoint) hzlqComponent.createEndpoint("hazelcast:seda:foo?transferExchange=false");
+
+ assertEquals("Invalid queue name", "foo", hzlqEndpoint.getConfiguration().getQueueName());
+ assertFalse("Default value of concurrent consumers is invalid", hzlqEndpoint.getConfiguration().isTransferExchange());
+ }
+
+ @Test
+ public void createEndpointWithNoParams() throws Exception {
+ HazelcastComponent hzlqComponent = new HazelcastComponent(context);
+
+ HazelcastSedaEndpoint hzlqEndpoint = (HazelcastSedaEndpoint) hzlqComponent.createEndpoint("hazelcast:seda:foo");
+
+ assertEquals("Invalid queue name", "foo", hzlqEndpoint.getConfiguration().getQueueName());
+ assertEquals("Default value of concurrent consumers is invalid", 1, hzlqEndpoint.getConfiguration().getConcurrentConsumers());
+ assertEquals("Default value of pool interval is invalid", 1000, hzlqEndpoint.getConfiguration().getPollInterval());
+ }
+
+ @Test
+ public void createEndpointWithConcurrentConsumersParam() throws Exception {
+ HazelcastComponent hzlqComponent = new HazelcastComponent(context);
+ HazelcastSedaEndpoint hzlqEndpoint = (HazelcastSedaEndpoint) hzlqComponent.createEndpoint("hazelcast:seda:foo?concurrentConsumers=4");
+
+ assertEquals("Invalid queue name", "foo", hzlqEndpoint.getConfiguration().getQueueName());
+ assertEquals("Value of concurrent consumers is invalid", 4, hzlqEndpoint.getConfiguration().getConcurrentConsumers());
+ assertEquals("Default value of pool interval is invalid", 1000, hzlqEndpoint.getConfiguration().getPollInterval());
+
+ }
+
+ @Test
+ public void createEndpointWithPoolIntevalParam() throws Exception {
+ HazelcastComponent hzlqComponent = new HazelcastComponent(context);
+ HazelcastSedaEndpoint hzlqEndpoint = (HazelcastSedaEndpoint) hzlqComponent.createEndpoint("hazelcast:seda:foo?pollInterval=4000");
+
+ assertEquals("Invalid queue name", "foo", hzlqEndpoint.getConfiguration().getQueueName());
+ assertEquals("Default value of concurrent consumers is invalid", 1, hzlqEndpoint.getConfiguration().getConcurrentConsumers());
+ assertEquals("Invalid pool interval", 4000, hzlqEndpoint.getConfiguration().getPollInterval());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void createEndpointWithoutEmptyName() throws Exception {
+ HazelcastComponent hzlqComponent = new HazelcastComponent(context);
+ hzlqComponent.createEndpoint("hazelcast:seda: ?concurrentConsumers=4");
+ }
+}
diff --git a/components/camel-hdfs/pom.xml b/components/camel-hdfs/pom.xml
index 2df07f4..f614441 100644
--- a/components/camel-hdfs/pom.xml
+++ b/components/camel-hdfs/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsComponent.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsComponent.java
index 76baa99..a700091 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsComponent.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsComponent.java
@@ -39,7 +39,8 @@
initHdfs();
}
- protected final Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ @SuppressWarnings("unchecked")
+ protected final Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
HdfsEndpoint hdfsEndpoint = new HdfsEndpoint(uri, this.getCamelContext());
setProperties(hdfsEndpoint.getConfig(), parameters);
return hdfsEndpoint;
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
index 0c609e1..fd4c984 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConfiguration.java
@@ -54,7 +54,7 @@
public HdfsConfiguration() {
}
- private Boolean getBoolean(Map<String, Object> hdfsSettings, String param, Boolean dflt) {
+ private Boolean getBoolean(Map hdfsSettings, String param, Boolean dflt) {
if (hdfsSettings.containsKey(param)) {
return Boolean.valueOf((String) hdfsSettings.get(param));
} else {
@@ -62,7 +62,7 @@
}
}
- private Integer getInteger(Map<String, Object> hdfsSettings, String param, Integer dflt) {
+ private Integer getInteger(Map hdfsSettings, String param, Integer dflt) {
if (hdfsSettings.containsKey(param)) {
return Integer.valueOf((String) hdfsSettings.get(param));
} else {
@@ -70,7 +70,7 @@
}
}
- private Short getShort(Map<String, Object> hdfsSettings, String param, Short dflt) {
+ private Short getShort(Map hdfsSettings, String param, Short dflt) {
if (hdfsSettings.containsKey(param)) {
return Short.valueOf((String) hdfsSettings.get(param));
} else {
@@ -78,7 +78,7 @@
}
}
- private Long getLong(Map<String, Object> hdfsSettings, String param, Long dflt) {
+ private Long getLong(Map hdfsSettings, String param, Long dflt) {
if (hdfsSettings.containsKey(param)) {
return Long.valueOf((String) hdfsSettings.get(param));
} else {
@@ -86,7 +86,7 @@
}
}
- private HdfsFileType getFileType(Map<String, Object> hdfsSettings, String param, HdfsFileType dflt) {
+ private HdfsFileType getFileType(Map hdfsSettings, String param, HdfsFileType dflt) {
String eit = (String) hdfsSettings.get(param);
if (eit != null) {
return HdfsFileType.valueOf(eit);
@@ -95,7 +95,7 @@
}
}
- private HdfsFileSystemType getFileSystemType(Map<String, Object> hdfsSettings, String param, HdfsFileSystemType dflt) {
+ private HdfsFileSystemType getFileSystemType(Map hdfsSettings, String param, HdfsFileSystemType dflt) {
String eit = (String) hdfsSettings.get(param);
if (eit != null) {
return HdfsFileSystemType.valueOf(eit);
@@ -104,7 +104,7 @@
}
}
- private HdfsWritableFactories.WritableType getWritableType(Map<String, Object> hdfsSettings, String param, HdfsWritableFactories.WritableType dflt) {
+ private HdfsWritableFactories.WritableType getWritableType(Map hdfsSettings, String param, HdfsWritableFactories.WritableType dflt) {
String eit = (String) hdfsSettings.get(param);
if (eit != null) {
return HdfsWritableFactories.WritableType.valueOf(eit);
@@ -113,7 +113,7 @@
}
}
- private SequenceFile.CompressionType getCompressionType(Map<String, Object> hdfsSettings, String param, SequenceFile.CompressionType ct) {
+ private SequenceFile.CompressionType getCompressionType(Map hdfsSettings, String param, SequenceFile.CompressionType ct) {
String eit = (String) hdfsSettings.get(param);
if (eit != null) {
return SequenceFile.CompressionType.valueOf(eit);
@@ -122,7 +122,7 @@
}
}
- private HdfsCompressionCodec getCompressionCodec(Map<String, Object> hdfsSettings, String param, HdfsCompressionCodec cd) {
+ private HdfsCompressionCodec getCompressionCodec(Map hdfsSettings, String param, HdfsCompressionCodec cd) {
String eit = (String) hdfsSettings.get(param);
if (eit != null) {
return HdfsCompressionCodec.valueOf(eit);
@@ -131,7 +131,7 @@
}
}
- private String getString(Map<String, Object> hdfsSettings, String param, String dflt) {
+ private String getString(Map hdfsSettings, String param, String dflt) {
if (hdfsSettings.containsKey(param)) {
return (String) hdfsSettings.get(param);
} else {
@@ -139,7 +139,7 @@
}
}
- private List<HdfsProducer.SplitStrategy> getSplitStrategies(Map<String, Object> hdfsSettings) {
+ private List<HdfsProducer.SplitStrategy> getSplitStrategies(Map hdfsSettings) {
List<HdfsProducer.SplitStrategy> strategies = new ArrayList<HdfsProducer.SplitStrategy>();
for (Object obj : hdfsSettings.keySet()) {
String key = (String) obj;
@@ -184,7 +184,7 @@
hostName = uri.getHost();
port = uri.getPort() == -1 ? HdfsConstants.DEFAULT_PORT : uri.getPort();
path = uri.getPath();
- Map<String, Object> hdfsSettings = URISupport.parseParameters(uri);
+ Map hdfsSettings = URISupport.parseParameters(uri);
overwrite = getBoolean(hdfsSettings, "overwrite", overwrite);
append = getBoolean(hdfsSettings, "append", append);
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsEndpoint.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsEndpoint.java
index f02452d..cd132e8 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsEndpoint.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsEndpoint.java
@@ -29,7 +29,6 @@
private final HdfsConfiguration config;
- @SuppressWarnings("deprecation")
public HdfsEndpoint(String endpointUri, CamelContext context) throws URISyntaxException {
super(endpointUri, context);
this.config = new HdfsConfiguration();
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
index 2d0473b..ae9685f 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsFileType.java
@@ -207,8 +207,8 @@
try {
Closeable rout;
HdfsInfo hdfsInfo = new HdfsInfo(hdfsPath);
- Class<?> keyWritableClass = configuration.getKeyType().getWritableClass();
- Class<?> valueWritableClass = configuration.getValueType().getWritableClass();
+ Class keyWritableClass = configuration.getKeyType().getWritableClass();
+ Class valueWritableClass = configuration.getValueType().getWritableClass();
rout = SequenceFile.createWriter(hdfsInfo.getFileSystem(), hdfsInfo.getConf(), hdfsInfo.getPath(), keyWritableClass,
valueWritableClass, configuration.getBufferSize(), configuration.getReplication(), configuration.getBlockSize(),
configuration.getCompressionType(), configuration.getCompressionCodec().getCodec(), new Progressable() {
@@ -243,7 +243,7 @@
Writable keyWritable = getWritable(key, typeConverter, keySize);
Holder<Integer> valueSize = new Holder<Integer>();
Writable valueWritable = getWritable(value, typeConverter, valueSize);
- ((MapFile.Writer) hdfsostr.getOut()).append((WritableComparable<?>) keyWritable, valueWritable);
+ ((MapFile.Writer) hdfsostr.getOut()).append((WritableComparable) keyWritable, valueWritable);
return keySize.value + valueSize.value;
} catch (Exception ex) {
throw new RuntimeCamelException(ex);
@@ -255,7 +255,7 @@
try {
MapFile.Reader reader = (MapFile.Reader) hdfsistr.getIn();
Holder<Integer> keySize = new Holder<Integer>();
- WritableComparable<?> keyWritable = (WritableComparable<?>) ReflectionUtils.newInstance(reader.getKeyClass(), new Configuration());
+ WritableComparable keyWritable = (WritableComparable) ReflectionUtils.newInstance(reader.getKeyClass(), new Configuration());
Holder<Integer> valueSize = new Holder<Integer>();
Writable valueWritable = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), new Configuration());
if (reader.next(keyWritable, valueWritable)) {
@@ -271,13 +271,13 @@
}
@Override
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings("unchecked")
public Closeable createOutputStream(String hdfsPath, HdfsConfiguration configuration) {
try {
Closeable rout;
HdfsInfo hdfsInfo = new HdfsInfo(hdfsPath);
- Class<? extends WritableComparable> keyWritableClass = configuration.getKeyType().getWritableClass();
- Class<? extends WritableComparable> valueWritableClass = configuration.getValueType().getWritableClass();
+ Class keyWritableClass = configuration.getKeyType().getWritableClass();
+ Class valueWritableClass = configuration.getValueType().getWritableClass();
rout = new MapFile.Writer(hdfsInfo.getConf(), hdfsInfo.getFileSystem(), hdfsPath, keyWritableClass, valueWritableClass,
configuration.getCompressionType(), configuration.getCompressionCodec().getCodec(), new Progressable() {
@Override
@@ -311,7 +311,7 @@
Writable keyWritable = getWritable(key, typeConverter, keySize);
Holder<Integer> valueSize = new Holder<Integer>();
Writable valueWritable = getWritable(value, typeConverter, valueSize);
- ((BloomMapFile.Writer) hdfsostr.getOut()).append((WritableComparable<?>) keyWritable, valueWritable);
+ ((BloomMapFile.Writer) hdfsostr.getOut()).append((WritableComparable) keyWritable, valueWritable);
return keySize.value + valueSize.value;
} catch (Exception ex) {
throw new RuntimeCamelException(ex);
@@ -323,7 +323,7 @@
try {
MapFile.Reader reader = (BloomMapFile.Reader) hdfsistr.getIn();
Holder<Integer> keySize = new Holder<Integer>();
- WritableComparable<?> keyWritable = (WritableComparable<?>) ReflectionUtils.newInstance(reader.getKeyClass(), new Configuration());
+ WritableComparable keyWritable = (WritableComparable) ReflectionUtils.newInstance(reader.getKeyClass(), new Configuration());
Holder<Integer> valueSize = new Holder<Integer>();
Writable valueWritable = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), new Configuration());
if (reader.next(keyWritable, valueWritable)) {
@@ -338,14 +338,14 @@
}
}
- @SuppressWarnings("rawtypes")
@Override
+ @SuppressWarnings("unchecked")
public Closeable createOutputStream(String hdfsPath, HdfsConfiguration configuration) {
try {
Closeable rout;
HdfsInfo hdfsInfo = new HdfsInfo(hdfsPath);
- Class<? extends WritableComparable> keyWritableClass = configuration.getKeyType().getWritableClass();
- Class<? extends WritableComparable> valueWritableClass = configuration.getValueType().getWritableClass();
+ Class keyWritableClass = configuration.getKeyType().getWritableClass();
+ Class valueWritableClass = configuration.getValueType().getWritableClass();
rout = new BloomMapFile.Writer(hdfsInfo.getConf(), hdfsInfo.getFileSystem(), hdfsPath, keyWritableClass, valueWritableClass,
configuration.getCompressionType(), configuration.getCompressionCodec().getCodec(), new Progressable() {
@Override
@@ -401,13 +401,13 @@
}
}
- @SuppressWarnings("rawtypes")
@Override
+ @SuppressWarnings("unchecked")
public Closeable createOutputStream(String hdfsPath, HdfsConfiguration configuration) {
try {
Closeable rout;
HdfsInfo hdfsInfo = new HdfsInfo(hdfsPath);
- Class<? extends WritableComparable> valueWritableClass = configuration.getValueType().getWritableClass();
+ Class valueWritableClass = configuration.getValueType().getWritableClass();
rout = new ArrayFile.Writer(hdfsInfo.getConf(), hdfsInfo.getFileSystem(), hdfsPath, valueWritableClass,
configuration.getCompressionType(), new Progressable() {
@Override
@@ -433,7 +433,6 @@
}
};
- @SuppressWarnings({"rawtypes"})
private static final class WritableCache {
private static Map<Class, HdfsWritableFactories.HdfsWritableFactory> writables = new HashMap<Class, HdfsWritableFactories.HdfsWritableFactory>();
@@ -468,7 +467,7 @@
}
private static Writable getWritable(Object obj, TypeConverter typeConverter, Holder<Integer> size) {
- Class<?> objCls = obj == null ? null : obj.getClass();
+ Class objCls = obj == null ? null : obj.getClass();
HdfsWritableFactories.HdfsWritableFactory objWritableFactory = WritableCache.writables.get(objCls);
if (objWritableFactory == null) {
objWritableFactory = new HdfsWritableFactories.HdfsObjectWritableFactory();
@@ -477,7 +476,7 @@
}
private static Object getObject(Writable writable, Holder<Integer> size) {
- Class<?> writableClass = NullWritable.class;
+ Class writableClass = NullWritable.class;
if (writable != null) {
writableClass = writable.getClass();
}
@@ -509,7 +508,8 @@
}
} finally {
if (close) {
- IOHelper.close(out, in);
+ IOHelper.close(out);
+ IOHelper.close(in);
}
}
return numBytes;
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsWritableFactories.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsWritableFactories.java
index 8f962b1..3022bb3 100644
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsWritableFactories.java
+++ b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsWritableFactories.java
@@ -35,76 +35,74 @@
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
public class HdfsWritableFactories {
public enum WritableType {
NULL {
@Override
- public Class<NullWritable> getWritableClass() {
+ public Class getWritableClass() {
return NullWritable.class;
}
},
BOOLEAN {
@Override
- public Class<BooleanWritable> getWritableClass() {
+ public Class getWritableClass() {
return BooleanWritable.class;
}
},
BYTE {
@Override
- public Class<ByteWritable> getWritableClass() {
+ public Class getWritableClass() {
return ByteWritable.class;
}
},
INT {
@Override
- public Class<IntWritable> getWritableClass() {
+ public Class getWritableClass() {
return IntWritable.class;
}
},
FLOAT {
@Override
- public Class<FloatWritable> getWritableClass() {
+ public Class getWritableClass() {
return FloatWritable.class;
}
},
LONG {
@Override
- public Class<LongWritable> getWritableClass() {
+ public Class getWritableClass() {
return LongWritable.class;
}
},
DOUBLE {
@Override
- public Class<DoubleWritable> getWritableClass() {
+ public Class getWritableClass() {
return DoubleWritable.class;
}
},
TEXT {
@Override
- public Class<Text> getWritableClass() {
+ public Class getWritableClass() {
return Text.class;
}
},
BYTES {
@Override
- public Class<BytesWritable> getWritableClass() {
+ public Class getWritableClass() {
return BytesWritable.class;
}
};
- @SuppressWarnings("rawtypes")
- public abstract Class<? extends WritableComparable> getWritableClass();
+ public abstract Class getWritableClass();
}
interface HdfsWritableFactory {
diff --git a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsProducerTest.java b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsProducerTest.java
index 299e25d..a188789 100644
--- a/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsProducerTest.java
+++ b/components/camel-hdfs/src/test/java/org/apache/camel/component/hdfs/HdfsProducerTest.java
@@ -206,7 +206,7 @@
Writable key = (Writable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Text value = (Text) ReflectionUtils.newInstance(reader.getValueClass(), conf);
reader.next(key, value);
- String rTxt = value.toString();
+ String rTxt = ((Text) value).toString();
Assert.assertEquals(rTxt, txt);
}
diff --git a/components/camel-hl7/pom.xml b/components/camel-hl7/pom.xml
index 19a2aa0..682e7a6 100644
--- a/components/camel-hl7/pom.xml
+++ b/components/camel-hl7/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
index bee6a96..a6119da 100644
--- a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
+++ b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecBoundaryTest.java
@@ -27,8 +27,6 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Test;
/**
@@ -60,7 +58,7 @@
@Test
public void testSendHL7Message() throws Exception {
- BufferedReader in = IOHelper.buffered(new InputStreamReader(getClass().getResourceAsStream("/mdm_t02-1022.txt")));
+ BufferedReader in = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/mdm_t02-1022.txt")));
String line = "";
String message = "";
while (line != null) {
diff --git a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
index a61fdd1..22e7eac 100644
--- a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
+++ b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecLongTest.java
@@ -28,8 +28,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Test;
@@ -71,7 +69,7 @@
@Test
public void testSendHL7Message() throws Exception {
// START SNIPPET: e2
- BufferedReader in = IOHelper.buffered(new InputStreamReader(getClass().getResourceAsStream("/mdm_t02.txt")));
+ BufferedReader in = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/mdm_t02.txt")));
String line = "";
String message = "";
while (line != null) {
diff --git a/components/camel-http/pom.xml b/components/camel-http/pom.xml
index 6b48701..9c2e63f 100644
--- a/components/camel-http/pom.xml
+++ b/components/camel-http/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java b/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
index c65d118..c60e662 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/DefaultHttpBinding.java
@@ -81,7 +81,7 @@
Map<String, Object> headers = message.getHeaders();
//apply the headerFilterStrategy
- Enumeration<?> names = request.getHeaderNames();
+ Enumeration names = request.getHeaderNames();
while (names.hasMoreElements()) {
String name = (String)names.nextElement();
String value = request.getHeader(name);
@@ -150,7 +150,7 @@
protected void populateRequestParameters(HttpServletRequest request, HttpMessage message) throws Exception {
//we populate the http request parameters without checking the request method
Map<String, Object> headers = message.getHeaders();
- Enumeration<?> names = request.getParameterNames();
+ Enumeration names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = (String)names.nextElement();
// there may be multiple values for the same name
@@ -197,7 +197,7 @@
protected void populateAttachments(HttpServletRequest request, HttpMessage message) {
// check if there is multipart files, if so will put it into DataHandler
- Enumeration<?> names = request.getAttributeNames();
+ Enumeration names = request.getAttributeNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Object object = request.getAttribute(name);
@@ -275,7 +275,7 @@
String key = entry.getKey();
Object value = entry.getValue();
// use an iterator as there can be multiple values. (must not use a delimiter)
- final Iterator<?> it = ObjectHelper.createIterator(value, null);
+ final Iterator it = ObjectHelper.createIterator(value, null);
while (it.hasNext()) {
String headerValue = exchange.getContext().getTypeConverter().convertTo(String.class, it.next());
if (headerValue != null && headerFilterStrategy != null
@@ -320,7 +320,8 @@
// copy directly from input stream to output stream
IOHelper.copy(is, os);
} finally {
- IOHelper.close(os, is);
+ IOHelper.close(os);
+ IOHelper.close(is);
}
} else {
// not convertable as a stream so try as a String
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
index 50bb2bb..c1e6bd8 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
@@ -25,6 +25,7 @@
import org.apache.camel.Endpoint;
import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.impl.HeaderFilterStrategyComponent;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.CollectionHelper;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
@@ -218,7 +219,7 @@
// create the configurer to use for this endpoint (authMethods contains the used methods created by the configurer)
final Set<AuthMethod> authMethods = new LinkedHashSet<AuthMethod>();
HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods);
- URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), httpClientParameters);
+ URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(httpClientParameters));
// create the endpoint
HttpEndpoint endpoint = new HttpEndpoint(endpointUri.toString(), this, clientParams, httpConnectionManager, configurer);
@@ -253,7 +254,7 @@
}
setProperties(endpoint, parameters);
// restructure uri to be based on the parameters left as we dont want to include the Camel internal options
- URI httpUri = URISupport.createRemainingURI(new URI(addressUri), parameters);
+ URI httpUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(parameters));
// validate http uri that end-user did not duplicate the http part that can be a common error
String part = httpUri.getSchemeSpecificPart();
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
index 17d1ded..eea3627 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpEndpoint.java
@@ -119,7 +119,7 @@
if (authMethodPriority != null) {
List<String> authPrefs = new ArrayList<String>();
- Iterator<?> it = getCamelContext().getTypeConverter().convertTo(Iterator.class, authMethodPriority);
+ Iterator it = getCamelContext().getTypeConverter().convertTo(Iterator.class, authMethodPriority);
int i = 1;
while (it.hasNext()) {
Object value = it.next();
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
index 0897ab1..5eda555 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
@@ -266,14 +266,14 @@
* @param value the value
*/
@SuppressWarnings("unchecked")
- public static void appendHeader(Map<String, Object> headers, String key, Object value) {
+ public static void appendHeader(Map headers, String key, Object value) {
if (headers.containsKey(key)) {
Object existing = headers.get(key);
- List<Object> list;
+ List list;
if (existing instanceof List) {
- list = (List<Object>) existing;
+ list = (List) existing;
} else {
- list = new ArrayList<Object>();
+ list = new ArrayList();
list.add(existing);
}
list.add(value);
@@ -295,6 +295,7 @@
* @param value the parameter value
* @return the extracted parameter value, see more details in javadoc.
*/
+ @SuppressWarnings("unchecked")
public static Object extractHttpParameterValue(String value) {
if (value == null || ObjectHelper.isEmpty(value)) {
return value;
@@ -306,7 +307,7 @@
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
// remove the [ ] markers
trimmed = trimmed.substring(1, trimmed.length() - 1);
- List<String> list = new ArrayList<String>();
+ List list = new ArrayList<String>();
String[] values = trimmed.split(",");
for (String s : values) {
list.add(s.trim());
diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
index 6f8f66b..0cd5ffa 100644
--- a/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
+++ b/components/camel-http/src/test/java/org/apache/camel/component/http/helper/HttpHelperTest.java
@@ -38,7 +38,7 @@
@Test
public void testAppendHeader() throws Exception {
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
HttpHelper.appendHeader(headers, "foo", "a");
HttpHelper.appendHeader(headers, "bar", "b");
HttpHelper.appendHeader(headers, "baz", "c");
@@ -51,7 +51,7 @@
@Test
public void testAppendHeaderMultipleValues() throws Exception {
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
HttpHelper.appendHeader(headers, "foo", "a");
HttpHelper.appendHeader(headers, "bar", "b");
HttpHelper.appendHeader(headers, "bar", "c");
@@ -59,7 +59,7 @@
assertEquals(2, headers.size());
assertEquals("a", headers.get("foo"));
- List<?> list = (List<?>) headers.get("bar");
+ List list = (List) headers.get("bar");
assertNotNull(list);
assertEquals(2, list.size());
assertEquals("b", list.get(0));
diff --git a/components/camel-http4/pom.xml b/components/camel-http4/pom.xml
index 2a08144..143faa5 100644
--- a/components/camel-http4/pom.xml
+++ b/components/camel-http4/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java
index 7263ae2..871c23e 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/CamelServlet.java
@@ -55,7 +55,7 @@
// Have the camel process the HTTP exchange.
DefaultExchange exchange = new DefaultExchange(consumer.getEndpoint(), ExchangePattern.InOut);
- if (consumer.getEndpoint().isBridgeEndpoint()) {
+ if (((HttpEndpoint)consumer.getEndpoint()).isBridgeEndpoint()) {
exchange.setProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.TRUE);
}
if (consumer.getEndpoint().isDisableStreamCache()) {
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
index bf20017..6d67630 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/DefaultHttpBinding.java
@@ -80,7 +80,7 @@
Map<String, Object> headers = message.getHeaders();
//apply the headerFilterStrategy
- Enumeration<?> names = request.getHeaderNames();
+ Enumeration names = request.getHeaderNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Object value = request.getHeader(name);
@@ -138,7 +138,7 @@
protected void populateRequestParameters(HttpServletRequest request, HttpMessage message) throws Exception {
//we populate the http request parameters without checking the request method
Map<String, Object> headers = message.getHeaders();
- Enumeration<?> names = request.getParameterNames();
+ Enumeration names = request.getParameterNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
// there may be multiple values for the same name
@@ -182,7 +182,7 @@
protected void populateAttachments(HttpServletRequest request, HttpMessage message) {
// check if there is multipart files, if so will put it into DataHandler
- Enumeration<?> names = request.getAttributeNames();
+ Enumeration names = request.getAttributeNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Object object = request.getAttribute(name);
@@ -258,7 +258,7 @@
String key = entry.getKey();
Object value = entry.getValue();
// use an iterator as there can be multiple values. (must not use a delimiter)
- final Iterator<?> it = ObjectHelper.createIterator(value, null);
+ final Iterator it = ObjectHelper.createIterator(value, null);
while (it.hasNext()) {
String headerValue = exchange.getContext().getTypeConverter().convertTo(String.class, it.next());
if (headerValue != null && headerFilterStrategy != null
@@ -303,7 +303,8 @@
// copy directly from input stream to output stream
IOHelper.copy(is, os);
} finally {
- IOHelper.close(os, is);
+ IOHelper.close(os);
+ IOHelper.close(is);
}
} else {
// not convertable as a stream so try as a String
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
index 356517f..c071bb0 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
@@ -24,6 +24,7 @@
import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.component.http4.helper.HttpHelper;
import org.apache.camel.impl.HeaderFilterStrategyComponent;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.URISupport;
import org.apache.camel.util.jsse.SSLContextParameters;
@@ -191,7 +192,7 @@
// create the configurer to use for this endpoint
HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, secure);
- URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), httpClientParameters);
+ URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), CastUtils.cast(httpClientParameters));
// create the endpoint and set the http uri to be null
HttpEndpoint endpoint = new HttpEndpoint(endpointUri.toString(), this, clientParams, clientConnectionManager, configurer);
// configure the endpoint
@@ -206,7 +207,7 @@
}
// restructure uri to be based on the parameters left as we dont want to include the Camel internal options
// build up the http uri
- URI httpUri = URISupport.createRemainingURI(new URI(httpUriAddress), parameters);
+ URI httpUri = URISupport.createRemainingURI(new URI(httpUriAddress), CastUtils.cast(parameters));
// validate http uri that end-user did not duplicate the http part that can be a common error
String part = httpUri.getSchemeSpecificPart();
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
index 3f4fc2b..c37ec6a 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/helper/HttpHelper.java
@@ -298,15 +298,15 @@
* @param key the key
* @param value the value
*/
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static void appendHeader(Map<String, Object> headers, String key, Object value) {
+ @SuppressWarnings("unchecked")
+ public static void appendHeader(Map headers, String key, Object value) {
if (headers.containsKey(key)) {
Object existing = headers.get(key);
- List<Object> list;
+ List list;
if (existing instanceof List) {
list = (List) existing;
} else {
- list = new ArrayList<Object>();
+ list = new ArrayList();
list.add(existing);
}
list.add(value);
@@ -328,6 +328,7 @@
* @param value the parameter value
* @return the extracted parameter value, see more details in javadoc.
*/
+ @SuppressWarnings("unchecked")
public static Object extractHttpParameterValue(String value) {
if (value == null || ObjectHelper.isEmpty(value)) {
return value;
@@ -339,7 +340,7 @@
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
// remove the [ ] markers
trimmed = trimmed.substring(1, trimmed.length() - 1);
- List<String> list = new ArrayList<String>();
+ List list = new ArrayList<String>();
String[] values = trimmed.split(",");
for (String s : values) {
list.add(s.trim());
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java
index 8965180..2b9df10 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpEndpointOptionsNotChangeComponentTest.java
@@ -67,11 +67,9 @@
assertIsInstanceOf(MyBinding.class, end3.getBinding());
}
- @SuppressWarnings("deprecation")
private static class MyBinding extends DefaultHttpBinding {
}
- @SuppressWarnings("deprecation")
private static class MyOtherBinding extends DefaultHttpBinding {
}
}
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoHeadersWithSameKeyTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoHeadersWithSameKeyTest.java
index fcea1fd..5c0b450 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoHeadersWithSameKeyTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoHeadersWithSameKeyTest.java
@@ -57,7 +57,7 @@
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
- List<?> foo = out.getOut().getHeader("foo", List.class);
+ List foo = out.getOut().getHeader("foo", List.class);
assertNotNull(foo);
assertEquals(2, foo.size());
assertEquals("123", foo.get(0));
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoParametersWithSameKeyTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoParametersWithSameKeyTest.java
index 585772b..c64e7f6 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoParametersWithSameKeyTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProducerTwoParametersWithSameKeyTest.java
@@ -45,7 +45,7 @@
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
- List<?> foo = out.getOut().getHeader("foo", List.class);
+ List foo = out.getOut().getHeader("foo", List.class);
assertNotNull(foo);
assertEquals(2, foo.size());
assertEquals("123", foo.get(0));
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
index ac4a376..7b4bf90 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpReferenceParameterTest.java
@@ -77,7 +77,6 @@
};
}
- @SuppressWarnings("deprecation")
private static class TestHttpBinding extends DefaultHttpBinding {
}
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/helper/HttpHelperTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/helper/HttpHelperTest.java
index 08d97f4..362d0e3 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/helper/HttpHelperTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/helper/HttpHelperTest.java
@@ -38,7 +38,7 @@
@Test
public void testAppendHeader() throws Exception {
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
HttpHelper.appendHeader(headers, "foo", "a");
HttpHelper.appendHeader(headers, "bar", "b");
HttpHelper.appendHeader(headers, "baz", "c");
@@ -51,7 +51,7 @@
@Test
public void testAppendHeaderMultipleValues() throws Exception {
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
HttpHelper.appendHeader(headers, "foo", "a");
HttpHelper.appendHeader(headers, "bar", "b");
HttpHelper.appendHeader(headers, "bar", "c");
@@ -59,7 +59,7 @@
assertEquals(2, headers.size());
assertEquals("a", headers.get("foo"));
- List<?> list = (List<?>) headers.get("bar");
+ List list = (List) headers.get("bar");
assertNotNull(list);
assertEquals(2, list.size());
assertEquals("b", list.get(0));
diff --git a/components/camel-ibatis/pom.xml b/components/camel-ibatis/pom.xml
index 98fdca8..fb941ff 100644
--- a/components/camel-ibatis/pom.xml
+++ b/components/camel-ibatis/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisConsumer.java b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisConsumer.java
index 950abc4..ab3f837 100644
--- a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisConsumer.java
+++ b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisConsumer.java
@@ -20,11 +20,14 @@
import java.util.List;
import java.util.Queue;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Message;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -35,7 +38,7 @@
*
* @see org.apache.camel.component.ibatis.strategy.IBatisProcessingStrategy
*/
-public class IBatisConsumer extends ScheduledBatchPollingConsumer {
+public class IBatisConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
private static final Logger LOG = LoggerFactory.getLogger(IBatisConsumer.class);
@@ -46,6 +49,9 @@
}
}
+ protected volatile ShutdownRunningTask shutdownRunningTask;
+ protected volatile int pendingExchanges;
+
/**
* Statement to run after data has been processed in the route
*/
@@ -110,6 +116,10 @@
return processBatch(CastUtils.cast(answer));
}
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
+
public int processBatch(Queue<Object> exchanges) throws Exception {
final IBatisEndpoint endpoint = getEndpoint();
@@ -151,6 +161,54 @@
return total;
}
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
private Exchange createExchange(Object data) {
final IBatisEndpoint endpoint = getEndpoint();
final Exchange exchange = endpoint.createExchange(ExchangePattern.InOnly);
diff --git a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java
index 96ed289..6532179 100644
--- a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java
+++ b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/IBatisProducer.java
@@ -97,7 +97,7 @@
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
- Iterator<?> iter = ObjectHelper.createIterator(in);
+ Iterator iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Inserting: {} using statement: {}", value, statement);
@@ -118,7 +118,7 @@
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
- Iterator<?> iter = ObjectHelper.createIterator(in);
+ Iterator iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Updating: {} using statement: {}", value, statement);
@@ -139,7 +139,7 @@
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
- Iterator<?> iter = ObjectHelper.createIterator(in);
+ Iterator iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Deleting: {} using statement: {}", value, statement);
diff --git a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/DefaultIBatisProcessingStategy.java b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/DefaultIBatisProcessingStategy.java
index 18da5f9..60d456c 100644
--- a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/DefaultIBatisProcessingStategy.java
+++ b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/DefaultIBatisProcessingStategy.java
@@ -52,8 +52,7 @@
}
}
- @SuppressWarnings("unchecked")
- public List<Object> poll(IBatisConsumer consumer, IBatisEndpoint endpoint) throws Exception {
+ public List poll(IBatisConsumer consumer, IBatisEndpoint endpoint) throws Exception {
SqlMapClient client = endpoint.getSqlMapClient();
return client.queryForList(endpoint.getStatement(), null);
}
diff --git a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/IBatisProcessingStrategy.java b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/IBatisProcessingStrategy.java
index d037dff..10f2b86 100644
--- a/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/IBatisProcessingStrategy.java
+++ b/components/camel-ibatis/src/main/java/org/apache/camel/component/ibatis/strategy/IBatisProcessingStrategy.java
@@ -35,7 +35,7 @@
* @return Results of the query as a {@link List}
* @throws Exception can be thrown in case of error
*/
- List<Object> poll(IBatisConsumer consumer, IBatisEndpoint endpoint) throws Exception;
+ List poll(IBatisConsumer consumer, IBatisEndpoint endpoint) throws Exception;
/**
* Commit callback if there are a statements to be run after processing.
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerIsolationLevelTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerIsolationLevelTest.java
index c8bfa8b..8f3d77a 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerIsolationLevelTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerIsolationLevelTest.java
@@ -59,7 +59,7 @@
account2.setLastName("Hale");
account2.setEmailAddress("TryGuessingSkipper@gmail.com");
- List<Object> accounts = new ArrayList<Object>();
+ List<Account> accounts = new ArrayList<Account>();
accounts.add(account1);
accounts.add(account2);
diff --git a/components/camel-irc/pom.xml b/components/camel-irc/pom.xml
index 269a089..62dd5fe 100644
--- a/components/camel-irc/pom.xml
+++ b/components/camel-irc/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
index b0fb13f..ab2d043 100644
--- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
+++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
@@ -475,7 +475,7 @@
Object value = pair.getValue();
// the value may be a list since the same key has multiple values
if (value instanceof List) {
- List<?> list = (List<?>)value;
+ List list = (List)value;
for (Object s : list) {
addQueryParameter(result, pair.getKey(), s);
}
diff --git a/components/camel-jackson/pom.xml b/components/camel-jackson/pom.xml
index 1c0bd10..f3ece70 100644
--- a/components/camel-jackson/pom.xml
+++ b/components/camel-jackson/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -50,7 +50,12 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-jasypt/pom.xml b/components/camel-jasypt/pom.xml
index c62db61..1b8eb1e 100644
--- a/components/camel-jasypt/pom.xml
+++ b/components/camel-jasypt/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -53,7 +53,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-javaspace/pom.xml b/components/camel-javaspace/pom.xml
index 1387442..6efaeac 100644
--- a/components/camel-javaspace/pom.xml
+++ b/components/camel-javaspace/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -56,7 +56,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceComponent.java b/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceComponent.java
index 50b57a6..6738c34 100644
--- a/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceComponent.java
+++ b/components/camel-javaspace/src/main/java/org/apache/camel/component/javaspace/JavaSpaceComponent.java
@@ -38,7 +38,7 @@
}
@Override
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
JavaSpaceEndpoint endpoint = new JavaSpaceEndpoint(uri, remaining, parameters, this);
endpoint.setExchangePattern(ExchangePattern.InOnly);
return endpoint;
diff --git a/components/camel-jaxb/pom.xml b/components/camel-jaxb/pom.xml
index b9467c4..0c9c62a 100644
--- a/components/camel-jaxb/pom.xml
+++ b/components/camel-jaxb/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -59,7 +59,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -68,6 +68,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index ca98c05..db9ff2f 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -64,7 +64,7 @@
// partial support
private QName partNamespace;
private String partClass;
- private Class<Object> partialClass;
+ private Class partialClass;
public JaxbDataFormat() {
}
@@ -105,12 +105,13 @@
}
}
+ @SuppressWarnings("unchecked")
void marshal(Exchange exchange, Object graph, OutputStream stream, Marshaller marshaller)
throws XMLStreamException, JAXBException {
Object e = graph;
if (partialClass != null && getPartNamespace() != null) {
- e = new JAXBElement<Object>(getPartNamespace(), partialClass, graph);
+ e = new JAXBElement(getPartNamespace(), partialClass, graph);
}
if (needFiltering(exchange)) {
@@ -127,6 +128,7 @@
return filteringWriter;
}
+ @SuppressWarnings("unchecked")
public Object unmarshal(Exchange exchange, InputStream stream) throws IOException {
try {
// must create a new instance of unmarshaller as its not thread safe
@@ -260,7 +262,7 @@
context = createContext();
}
if (partClass != null) {
- partialClass = camelContext.getClassResolver().resolveMandatoryClass(partClass, Object.class);
+ partialClass = camelContext.getClassResolver().resolveMandatoryClass(partClass);
}
}
diff --git a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TimerBeanToBeanNotificationTypeTest.java b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TimerBeanToBeanNotificationTypeTest.java
index d0ebf07..394836a 100644
--- a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TimerBeanToBeanNotificationTypeTest.java
+++ b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/TimerBeanToBeanNotificationTypeTest.java
@@ -38,7 +38,7 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("timer:foo?delay=500&repeatCount=1")
+ from("timer:foo?repeatCount=1")
.log("Timer triggered")
.bean(MyNotificationService.class, "createNotification")
.bean(MyNotificationService.class, "sendNotification");
diff --git a/components/camel-jclouds/pom.xml b/components/camel-jclouds/pom.xml
index b6c5435..ce39ecd 100644
--- a/components/camel-jclouds/pom.xml
+++ b/components/camel-jclouds/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -67,7 +67,7 @@
<!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java
index 817714b..6119e67 100644
--- a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java
+++ b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreConsumer.java
@@ -19,9 +19,11 @@
import java.util.LinkedList;
import java.util.Queue;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
@@ -31,14 +33,21 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class JcloudsBlobStoreConsumer extends ScheduledBatchPollingConsumer {
+public class JcloudsBlobStoreConsumer extends JcloudsConsumer implements BatchConsumer, ShutdownAware {
private static final Logger LOG = LoggerFactory.getLogger(JcloudsBlobStoreConsumer.class);
+
private final JcloudsBlobStoreEndpoint endpoint;
+
private final String container;
private final BlobStore blobStore;
+
private int maxMessagesPerPoll = 10;
+ private volatile ShutdownRunningTask shutdownRunningTask;
+ private volatile int pendingExchanges;
+
+
public JcloudsBlobStoreConsumer(JcloudsBlobStoreEndpoint endpoint, Processor processor, BlobStore blobStore) {
super(endpoint, processor);
this.blobStore = blobStore;
@@ -66,6 +75,11 @@
return queue.isEmpty() ? 0 : processBatch(CastUtils.cast(queue));
}
+ @Override
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
+
public int processBatch(Queue<Object> exchanges) throws Exception {
int total = exchanges.size();
@@ -98,4 +112,53 @@
return total;
}
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ @Override
+ public void prepareShutdown() {
+ //Empty method
+ }
}
diff --git a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreHelper.java b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreHelper.java
index b2ac1c9..8fafa3d 100644
--- a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreHelper.java
+++ b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsBlobStoreHelper.java
@@ -58,7 +58,8 @@
} catch (IOException e) {
LOG.error("Error while writing blob", e);
} finally {
- IOHelper.close(oos, baos);
+ IOHelper.close(oos);
+ IOHelper.close(baos);
}
}
@@ -97,7 +98,8 @@
e) {
e.printStackTrace();
} finally {
- IOHelper.close(ois, is);
+ IOHelper.close(ois);
+ IOHelper.close(is);
}
return result;
}
diff --git a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java
index 4dc2657..f5a6f107 100644
--- a/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java
+++ b/components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java
@@ -196,6 +196,9 @@
*/
public Predicate<ComputeMetadata> getComputePredicate(final Exchange exchange) {
final String nodeId = getNodeId(exchange);
+ final String imageId = getImageId(exchange);
+ final String group = getGroup(exchange);
+ final NodeState queryState = getNodeState(exchange);
Predicate<ComputeMetadata> predicate = new Predicate<ComputeMetadata>() {
public boolean apply(ComputeMetadata metadata) {
diff --git a/components/camel-jclouds/src/test/java/org/apache/camel/component/jclouds/JcloudsSpringComputeTest.java b/components/camel-jclouds/src/test/java/org/apache/camel/component/jclouds/JcloudsSpringComputeTest.java
index 53046f1..a377a75 100644
--- a/components/camel-jclouds/src/test/java/org/apache/camel/component/jclouds/JcloudsSpringComputeTest.java
+++ b/components/camel-jclouds/src/test/java/org/apache/camel/component/jclouds/JcloudsSpringComputeTest.java
@@ -56,7 +56,7 @@
List<Exchange> exchanges = result.getExchanges();
if (exchanges != null && !exchanges.isEmpty()) {
for (Exchange exchange : exchanges) {
- Set<?> images = exchange.getIn().getBody(Set.class);
+ Set images = (Set) exchange.getIn().getBody();
assertTrue(images.size() > 0);
for (Object obj : images) {
assertTrue(obj instanceof Image);
@@ -73,7 +73,7 @@
List<Exchange> exchanges = result.getExchanges();
if (exchanges != null && !exchanges.isEmpty()) {
for (Exchange exchange : exchanges) {
- Set<?> hardwares = exchange.getIn().getBody(Set.class);
+ Set hardwares = (Set) exchange.getIn().getBody();
assertTrue(hardwares.size() > 0);
for (Object obj : hardwares) {
assertTrue(obj instanceof Hardware);
@@ -90,7 +90,7 @@
List<Exchange> exchanges = result.getExchanges();
if (exchanges != null && !exchanges.isEmpty()) {
for (Exchange exchange : exchanges) {
- Set<?> nodeMetadatas = exchange.getIn().getBody(Set.class);
+ Set nodeMetadatas = (Set) exchange.getIn().getBody();
assertEquals("Nodes should be 0", 0, nodeMetadatas.size());
}
}
@@ -106,7 +106,7 @@
List<Exchange> exchanges = result.getExchanges();
if (exchanges != null && !exchanges.isEmpty()) {
for (Exchange exchange : exchanges) {
- Set<?> nodeMetadatas = exchange.getIn().getBody(Set.class);
+ Set nodeMetadatas = (Set) exchange.getIn().getBody();
assertEquals("Nodes should be 1", 1, nodeMetadatas.size());
}
}
@@ -131,20 +131,20 @@
List<Exchange> exchanges = result.getExchanges();
Exchange exchange = exchanges.get(3);
- Set<?> nodeMetadatas = exchange.getIn().getBody(Set.class);
+ Set<NodeMetadata> nodeMetadatas = (Set<NodeMetadata>) exchange.getIn().getBody();
assertEquals("Nodes should be 2", 2, nodeMetadatas.size());
NodeMetadata nodeMetadata = nodeMetadatas.toArray(new NodeMetadata[0])[0];
assertEquals("other", nodeMetadata.getGroup());
exchange = exchanges.get(4);
- nodeMetadatas = exchange.getIn().getBody(Set.class);
+ nodeMetadatas = (Set<NodeMetadata>) exchange.getIn().getBody();
assertEquals("Nodes should be 1", 1, nodeMetadatas.size());
nodeMetadata = nodeMetadatas.toArray(new NodeMetadata[0])[0];
assertEquals("other", nodeMetadata.getGroup());
assertEquals("3", nodeMetadata.getId());
exchange = exchanges.get(5);
- nodeMetadatas = exchange.getIn().getBody(Set.class);
+ nodeMetadatas = (Set<NodeMetadata>) exchange.getIn().getBody();
assertEquals("Nodes should be 1", 1, nodeMetadatas.size());
nodeMetadata = nodeMetadatas.toArray(new NodeMetadata[0])[0];
assertEquals("other", nodeMetadata.getGroup());
@@ -159,7 +159,7 @@
List<Exchange> exchanges = result.getExchanges();
if (exchanges != null && !exchanges.isEmpty()) {
for (Exchange exchange : exchanges) {
- Set<?> nodeMetadatas = exchange.getIn().getBody(Set.class);
+ Set nodeMetadatas = (Set) exchange.getIn().getBody();
assertEquals("There should be no node running", 1, nodeMetadatas.size());
for (Object obj : nodeMetadatas) {
diff --git a/components/camel-jcr/pom.xml b/components/camel-jcr/pom.xml
index c17ca03..87a8ef7 100644
--- a/components/camel-jcr/pom.xml
+++ b/components/camel-jcr/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
index 270352a..d613410 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
@@ -46,7 +46,7 @@
}
node.addMixin("mix:referenceable");
session.save();
- exchange.getOut().setBody(node.getIdentifier());
+ exchange.getOut().setBody(node.getUUID());
} finally {
if (session != null && session.isLive()) {
session.logout();
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/AuthTokenLoginFailureTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/AuthTokenLoginFailureTest.java
index 5cf762e..3348acf 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/AuthTokenLoginFailureTest.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/AuthTokenLoginFailureTest.java
@@ -38,7 +38,7 @@
Session session = getRepository().login(
new SimpleCredentials("admin", "admin".toCharArray()));
try {
- Node node = session.getNodeByIdentifier(uuid);
+ Node node = session.getNodeByUUID(uuid);
assertNotNull(node);
assertEquals(BASE_REPO_PATH + "/node", node.getPath());
} finally {
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java
index 1298e3c..6491238 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java
@@ -69,7 +69,8 @@
assertJcrConverterAvailable(StringValue.class, "plain text");
}
- private void assertJcrConverterAvailable(Class<?> expected, Object object) {
+ @SuppressWarnings("unchecked")
+ private void assertJcrConverterAvailable(Class expected, Object object) {
Value value = converter.convertTo(Value.class, object);
assertNotNull(value);
assertTrue(expected.isAssignableFrom(value.getClass()));
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrNodePathCreationTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrNodePathCreationTest.java
index f688faf..6aaef38 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrNodePathCreationTest.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrNodePathCreationTest.java
@@ -49,7 +49,7 @@
assertNotNull("Out body was null; expected JCR node UUID", uuid);
Session session = repository.login(new SimpleCredentials("user", "pass".toCharArray()));
try {
- Node node = session.getNodeByIdentifier(uuid);
+ Node node = session.getNodeByUUID(uuid);
assertNotNull(node);
assertEquals("/home/test/node/with/path", node.getPath());
} finally {
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java
index 6701213..fdfb359 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java
@@ -48,7 +48,7 @@
String uuid = out.getOut().getBody(String.class);
Session session = repository.login(new SimpleCredentials("user", "pass".toCharArray()));
try {
- Node node = session.getNodeByIdentifier(uuid);
+ Node node = session.getNodeByUUID(uuid);
assertNotNull(node);
assertEquals("/home/test/node", node.getPath());
assertEquals("<hello>world!</hello>", node.getProperty("my.contents.property").getString());
diff --git a/components/camel-jdbc/pom.xml b/components/camel-jdbc/pom.xml
index 8f63952..c665392 100644
--- a/components/camel-jdbc/pom.xml
+++ b/components/camel-jdbc/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
<artifactId>camel-jdbc</artifactId>
@@ -44,7 +44,12 @@
<!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-jetty/pom.xml b/components/camel-jetty/pom.xml
index ae5b2bc..f06dbf0 100644
--- a/components/camel-jetty/pom.xml
+++ b/components/camel-jetty/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -84,7 +84,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
index e5e3c3f..6700348 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -36,6 +36,7 @@
import org.apache.camel.component.http.HttpEndpoint;
import org.apache.camel.spi.ManagementAgent;
import org.apache.camel.spi.ManagementStrategy;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.URISupport;
@@ -194,9 +195,9 @@
String address = uri.startsWith("jetty:") ? remaining : uri;
URI addressUri = new URI(UnsafeUriCharactersEncoder.encode(address));
- URI endpointUri = URISupport.createRemainingURI(addressUri, httpClientParameters);
+ URI endpointUri = URISupport.createRemainingURI(addressUri, CastUtils.cast(httpClientParameters));
// restructure uri to be based on the parameters left as we dont want to include the Camel internal options
- URI httpUri = URISupport.createRemainingURI(addressUri, parameters);
+ URI httpUri = URISupport.createRemainingURI(addressUri, CastUtils.cast(parameters));
// create endpoint after all known parameters have been extracted from parameters
JettyHttpEndpoint endpoint = new JettyHttpEndpoint(this, endpointUri.toString(), httpUri);
@@ -344,7 +345,7 @@
}
private void enableSessionSupport(Server server, String connectorKey) throws Exception {
- ServletContextHandler context = server.getChildHandlerByClass(ServletContextHandler.class);
+ ServletContextHandler context = (ServletContextHandler)server.getChildHandlerByClass(ServletContextHandler.class);
if (context.getSessionHandler() == null) {
SessionHandler sessionHandler = new SessionHandler();
if (context.isStarted()) {
@@ -356,7 +357,8 @@
}
private void setFilters(JettyHttpEndpoint endpoint, Server server, String connectorKey) {
- ServletContextHandler context = server.getChildHandlerByClass(ServletContextHandler.class);
+ ServletContextHandler context = (ServletContextHandler) server
+ .getChildHandlerByClass(ServletContextHandler.class);
List<Filter> filters = endpoint.getFilters();
for (Filter filter : filters) {
FilterHolder filterHolder = new FilterHolder();
@@ -368,13 +370,14 @@
if (endpoint.isMatchOnUriPrefix()) {
pathSpec = pathSpec.endsWith("/") ? pathSpec + "*" : pathSpec + "/*";
}
- context.addFilter(filterHolder, pathSpec, null);
+ context.addFilter(filterHolder, pathSpec, 0);
}
}
private void enableMultipartFilter(HttpEndpoint endpoint, Server server, String connectorKey) throws Exception {
- ServletContextHandler context = server.getChildHandlerByClass(ServletContextHandler.class);
+ ServletContextHandler context = (ServletContextHandler) server
+ .getChildHandlerByClass(ServletContextHandler.class);
CamelContext camelContext = this.getCamelContext();
FilterHolder filterHolder = new FilterHolder();
filterHolder.setInitParameter("deleteFiles", "true");
@@ -401,7 +404,7 @@
if (endpoint.isMatchOnUriPrefix()) {
pathSpec = pathSpec.endsWith("/") ? pathSpec + "*" : pathSpec + "/*";
}
- context.addFilter(filterHolder, pathSpec, null);
+ context.addFilter(filterHolder, pathSpec, 0);
LOG.debug("using multipart filter implementation " + filter.getClass().getName() + " for path " + pathSpec);
}
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
index 1b29881..0587830 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
@@ -192,6 +192,7 @@
return httpExchange;
}
+ @SuppressWarnings("unchecked")
private void doSetQueryParameters(Exchange exchange, JettyContentExchange httpExchange) throws URISyntaxException {
// is a query string provided in the endpoint URI or in a header (header
// overrules endpoint)
@@ -207,7 +208,7 @@
// okay we need to add the query string to the URI so we need to juggle a bit with the parameters
String uri = httpExchange.getRequestURI();
- Map<String, Object> parameters = URISupport.parseParameters(new URI(uri));
+ Map parameters = URISupport.parseParameters(new URI(uri));
parameters.putAll(URISupport.parseQuery(queryString));
if (uri.contains("?")) {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java
index 7ff661f..b741a11 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java
@@ -24,10 +24,7 @@
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.util.IOHelper;
-
import org.eclipse.jetty.server.handler.StatisticsHandler;
-
import org.junit.Test;
public class HandlerTest extends BaseJettyTest {
@@ -47,7 +44,7 @@
assertEquals(0, statisticsHandler3.getRequests());
InputStream html = (InputStream) template.requestBody("http://localhost:" + port1, "");
- BufferedReader br = IOHelper.buffered(new InputStreamReader(html));
+ BufferedReader br = new BufferedReader(new InputStreamReader(html));
assertEquals(htmlResponse, br.readLine());
assertEquals(1, statisticsHandler1.getRequests());
@@ -63,7 +60,7 @@
assertEquals(0, statisticsHandler3.getRequests());
InputStream html = (InputStream) template.requestBody("http://localhost:" + port2, "");
- BufferedReader br = IOHelper.buffered(new InputStreamReader(html));
+ BufferedReader br = new BufferedReader(new InputStreamReader(html));
assertEquals(htmlResponse, br.readLine());
assertEquals(0, statisticsHandler1.getRequests());
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
index 35b2338..b78e85f 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
@@ -50,11 +50,11 @@
getMockEndpoint("mock:result").assertNoDuplicates(body());
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- Map<Integer, Future<String>> responses = new ConcurrentHashMap<Integer, Future<String>>();
+ Map<Integer, Future> responses = new ConcurrentHashMap<Integer, Future>();
for (int i = 0; i < files; i++) {
final int index = i;
- Future<String> out = executor.submit(new Callable<String>() {
- public String call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
return template.requestBody("http://localhost:{{port}}/echo", "" + index, String.class);
}
});
@@ -67,7 +67,7 @@
// get all responses
Set<Object> unique = new HashSet<Object>();
- for (Future<String> future : responses.values()) {
+ for (Future future : responses.values()) {
unique.add(future.get());
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerTwoParametersWithSameKeyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerTwoParametersWithSameKeyTest.java
index 0b03809..aa38a83 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerTwoParametersWithSameKeyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerTwoParametersWithSameKeyTest.java
@@ -38,7 +38,7 @@
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
- List<?> foo = out.getOut().getHeader("foo", List.class);
+ List foo = out.getOut().getHeader("foo", List.class);
assertNotNull(foo);
assertEquals(2, foo.size());
assertEquals("123", foo.get(0));
@@ -63,7 +63,7 @@
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
- List<?> foo = out.getOut().getHeader("foo", List.class);
+ List foo = out.getOut().getHeader("foo", List.class);
assertNotNull(foo);
assertEquals(2, foo.size());
assertEquals("123", foo.get(0));
@@ -80,7 +80,7 @@
String from = exchange.getIn().getHeader("from", String.class);
assertEquals("me", from);
- List<?> to = exchange.getIn().getHeader("to", List.class);
+ List to = exchange.getIn().getHeader("to", List.class);
assertNotNull(to);
assertEquals(2, to.size());
assertEquals("foo", to.get(0));
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
index 16a9201..c147909 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
@@ -29,8 +29,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Test;
public class HttpRoundtripHeaderTest extends BaseJettyTest {
@@ -111,7 +109,7 @@
private String readLastLine(InputStream answer) throws IOException {
String lastLine = null;
- BufferedReader reader = IOHelper.buffered(new InputStreamReader(answer));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(answer));
while (true) {
String line = reader.readLine();
if (line == null) {
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/MyCoolBean.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/MyCoolBean.java
index 0700fca..e1b3df5 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/MyCoolBean.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/javabody/MyCoolBean.java
@@ -23,7 +23,6 @@
*/
public class MyCoolBean implements Serializable {
- private static final long serialVersionUID = 1L;
private final int id;
private final String name;
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
index 0b9ea95..f128f6d 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java
@@ -47,7 +47,7 @@
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
- List<?> foo = out.getOut().getHeader("foo", List.class);
+ List foo = out.getOut().getHeader("foo", List.class);
assertEquals(2, foo.size());
assertEquals("123", foo.get(0));
assertEquals("456", foo.get(1));
@@ -79,7 +79,7 @@
assertEquals("OK", out.getOut().getBody(String.class));
assertEquals("yes", out.getOut().getHeader("bar"));
- List<?> foo = out.getOut().getHeader("foo", List.class);
+ List foo = out.getOut().getHeader("foo", List.class);
assertNotNull(foo);
assertEquals(2, foo.size());
assertEquals("123", foo.get(0));
@@ -96,7 +96,7 @@
String from = exchange.getIn().getHeader("from", String.class);
assertEquals("me", from);
- List<?> values = exchange.getIn().getHeader("to", List.class);
+ List values = exchange.getIn().getHeader("to", List.class);
assertNotNull(values);
assertEquals(2, values.size());
assertEquals("foo", values.get(0));
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
index 4e4b02b..81d2b3c 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
@@ -67,11 +67,11 @@
getMockEndpoint("mock:result").assertNoDuplicates(body());
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- Map<Integer, Future<String>> responses = new ConcurrentHashMap<Integer, Future<String>>();
+ Map<Integer, Future> responses = new ConcurrentHashMap<Integer, Future>();
for (int i = 0; i < files; i++) {
final int index = i;
- Future<String> out = executor.submit(new Callable<String>() {
- public String call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
return template.requestBody("jetty://http://localhost:{{port}}/echo", "" + index, String.class);
}
});
@@ -84,7 +84,7 @@
// get all responses
Set<Object> unique = new HashSet<Object>();
- for (Future<String> future : responses.values()) {
+ for (Future future : responses.values()) {
unique.add(future.get());
}
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
index b9a4db7..5da261b 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
@@ -45,7 +45,7 @@
assertNotNull(exchange);
String body = exchange.getOut().getBody(String.class);
- Map<?, ?> headers = exchange.getOut().getHeaders();
+ Map headers = exchange.getOut().getHeaders();
assertEquals("Bye World", body);
assertEquals("Carlsberg", headers.get("beer"));
@@ -69,7 +69,7 @@
assertNotNull(exchange);
String body = exchange.getOut().getBody(String.class);
- Map<?, ?> headers = exchange.getOut().getHeaders();
+ Map headers = exchange.getOut().getHeaders();
assertEquals("Bye World", body);
assertEquals("Carlsberg", headers.get("beer"));
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
index b93fb26..a87b8d1 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/MyCoolBean.java
@@ -23,7 +23,6 @@
*/
public class MyCoolBean implements Serializable {
- private static final long serialVersionUID = 1L;
private final int id;
private final String name;
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/MyAppException.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/MyAppException.java
index ba20cfa..b26f648 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/MyAppException.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/proxy/MyAppException.java
@@ -21,7 +21,6 @@
*/
public class MyAppException extends Exception {
- private static final long serialVersionUID = 1L;
private final String name;
public MyAppException(String msg, String name) {
diff --git a/components/camel-jibx/pom.xml b/components/camel-jibx/pom.xml
index 8db0482..5dd201b 100644
--- a/components/camel-jibx/pom.xml
+++ b/components/camel-jibx/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -49,7 +49,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java b/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java
index 4adb014..1d63a57 100644
--- a/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java
+++ b/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java
@@ -28,12 +28,12 @@
import org.jibx.runtime.IUnmarshallingContext;
public class JibxDataFormat implements DataFormat {
- private Class<?> unmarshallClass;
+ private Class unmarshallClass;
public JibxDataFormat() {
}
- public JibxDataFormat(Class<?> unmarshallClass) {
+ public JibxDataFormat(Class unmarshallClass) {
this.setUnmarshallClass(unmarshallClass);
}
@@ -50,11 +50,11 @@
return unmarshallingContext.unmarshalDocument(stream, null);
}
- public Class<?> getUnmarshallClass() {
+ public Class getUnmarshallClass() {
return unmarshallClass;
}
- public void setUnmarshallClass(Class<?> unmarshallClass) {
+ public void setUnmarshallClass(Class unmarshallClass) {
this.unmarshallClass = unmarshallClass;
}
diff --git a/components/camel-jing/pom.xml b/components/camel-jing/pom.xml
index cd2e134..14f5060 100644
--- a/components/camel-jing/pom.xml
+++ b/components/camel-jing/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -56,7 +56,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-jms/pom.xml b/components/camel-jms/pom.xml
index 8ec1264..5a53aba 100644
--- a/components/camel-jms/pom.xml
+++ b/components/camel-jms/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -74,7 +74,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
index e337e4f..5923dde 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/DefaultQueueBrowseStrategy.java
@@ -47,7 +47,7 @@
// not the best implementation in the world as we have to browse
// the entire queue, which could be massive
List<Exchange> answer = new ArrayList<Exchange>();
- Enumeration<?> iter = browser.getEnumeration();
+ Enumeration iter = browser.getEnumeration();
for (int i = 0; i < size && iter.hasMoreElements(); i++) {
Message message = (Message) iter.nextElement();
Exchange exchange = endpoint.createExchange(message);
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
index 8cff06d..b8ef4ff 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsBinding.java
@@ -172,7 +172,7 @@
throw new RuntimeCamelException(e);
}
- Enumeration<?> names;
+ Enumeration names;
try {
names = jmsMessage.getPropertyNames();
} catch (JMSException e) {
@@ -526,7 +526,7 @@
}
case Map: {
MapMessage message = session.createMapMessage();
- Map<?, ?> payload = context.getTypeConverter().convertTo(Map.class, exchange, body);
+ Map payload = context.getTypeConverter().convertTo(Map.class, exchange, body);
populateMapMessage(message, payload, context);
return message;
}
@@ -564,7 +564,7 @@
*/
public Map<String, Object> createMapFromMapMessage(MapMessage message) throws JMSException {
Map<String, Object> answer = new HashMap<String, Object>();
- Enumeration<?> names = message.getMapNames();
+ Enumeration names = message.getMapNames();
while (names.hasMoreElements()) {
String name = names.nextElement().toString();
Object value = message.getObject(name);
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
index 0c33277..2933ed9 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
@@ -104,7 +104,6 @@
this.pubSubDomain = pubSubDomain;
}
- @SuppressWarnings("deprecation")
public JmsEndpoint(String endpointUri, JmsBinding binding, JmsConfiguration configuration, String destinationName, boolean pubSubDomain) {
super(UnsafeUriCharactersEncoder.encode(endpointUri));
this.binding = binding;
diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java
index a74da7a..e567428 100644
--- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java
+++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsMessageHelper.java
@@ -64,7 +64,7 @@
// clear a single property, but must clear them all and redo
// the properties
Map<String, Object> map = new LinkedHashMap<String, Object>();
- Enumeration<?> en = jmsMessage.getPropertyNames();
+ Enumeration en = jmsMessage.getPropertyNames();
while (en.hasMoreElements()) {
String key = (String) en.nextElement();
if (name.equals(key)) {
@@ -92,7 +92,7 @@
* @throws JMSException can be thrown
*/
public static boolean hasProperty(Message jmsMessage, String name) throws JMSException {
- Enumeration<?> en = jmsMessage.getPropertyNames();
+ Enumeration en = jmsMessage.getPropertyNames();
while (en.hasMoreElements()) {
String key = (String) en.nextElement();
if (name.equals(key)) {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsMapMessageTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsMapMessageTest.java
index 41bc333..478c8d3 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsMapMessageTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsMapMessageTest.java
@@ -69,7 +69,7 @@
JmsMessage in = (JmsMessage) exchange.getIn();
assertNotNull(in);
- Map<?, ?> map = exchange.getIn().getBody(Map.class);
+ Map map = exchange.getIn().getBody(Map.class);
log.info("Received map: " + map);
assertNotNull("Should have received a map message!", map);
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsObjectMessageTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsObjectMessageTest.java
index 8a73925..f4e6953 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsObjectMessageTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/ConsumeJmsObjectMessageTest.java
@@ -115,8 +115,6 @@
}
public static class MyUser implements Serializable {
-
- private static final long serialVersionUID = 1L;
private String name;
public String getName() {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutBeanReturnNullTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutBeanReturnNullTest.java
index 7471188..b2b9b4b 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutBeanReturnNullTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsInOutBeanReturnNullTest.java
@@ -97,7 +97,6 @@
public static final class MyBean implements Serializable {
- private static final long serialVersionUID = 1L;
public String name;
public MyBean(String name) {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageAsOriginalMessageInDefaultUnitOfWorkTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageAsOriginalMessageInDefaultUnitOfWorkTest.java
deleted file mode 100644
index 4bb0c15..0000000
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageAsOriginalMessageInDefaultUnitOfWorkTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jms;
-
-import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
-
-import javax.jms.ConnectionFactory;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class JmsMessageAsOriginalMessageInDefaultUnitOfWorkTest extends CamelTestSupport {
-
- @EndpointInject(uri = "mock:result")
- private MockEndpoint mockResult;
-
- @Test
- public void testUseOriginalMessage() throws Exception {
- context.addRoutes(new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- onException(Exception.class)
- .useOriginalMessage()
- .to(mockResult);
-
- from("jms:queue:foo")
- .throwException(new Exception("forced exception for test"));
- }
- });
- context.start();
-
- mockResult.expectedBodiesReceived("Hello World");
- mockResult.expectedHeaderReceived("header-key", "header-value");
-
- template.sendBodyAndHeader("jms:queue:foo", "Hello World", "header-key", "header-value");
-
- assertMockEndpointsSatisfied();
- }
-
- protected CamelContext createCamelContext() throws Exception {
- CamelContext camelContext = super.createCamelContext();
-
- ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
- camelContext.addComponent("jms", jmsComponentAutoAcknowledge(connectionFactory));
-
- return camelContext;
- }
-
- @Override
- public boolean isUseRouteBuilder() {
- return false;
- }
-}
-
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageTypeTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageTypeTest.java
index ebd196a..52e915a 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageTypeTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsMessageTypeTest.java
@@ -213,7 +213,6 @@
public static final class MyFooBean implements TypeConverter, Serializable {
- private static final long serialVersionUID = 1L;
private String name;
private MyFooBean() {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProduerConcurrentWithReplyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProduerConcurrentWithReplyTest.java
index a4da518..d7bf2dc9 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProduerConcurrentWithReplyTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProduerConcurrentWithReplyTest.java
@@ -50,11 +50,11 @@
getMockEndpoint("mock:result").expectsNoDuplicates(body());
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- final List<Future<String>> futures = new ArrayList<Future<String>>();
+ final List<Future> futures = new ArrayList<Future>();
for (int i = 0; i < files; i++) {
final int index = i;
- Future<String> out = executor.submit(new Callable<String>() {
- public String call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
return template.requestBody("direct:start", "Message " + index, String.class);
}
});
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java
index d535f95..91bd9e9 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java
@@ -93,11 +93,13 @@
assertFalse("CorrelationID should NOT start with ID, was: " + correlationId, correlationId.startsWith("ID:"));
}
+
/**
* When the setting useMessageIdAsCorrelationid is false and
* a correlation id is set to empty String ("") the message then we expect the reply
* to contain the correlation id dynamically generated on send.
- */
+ */
+
@Test
public void testRequestReplyCorrelationWithEmptyString() throws Exception {
MockEndpoint result = getMockEndpoint("mock:result");
@@ -113,14 +115,15 @@
assertNotNull(out);
result.assertIsSatisfied();
-
+
assertEquals(REPLY_BODY, out.getOut().getBody(String.class));
String correlationId = out.getOut().getHeader("JMSCorrelationID", String.class);
assertNotNull(correlationId);
// In ActiveMQ messageIds start with ID: (currently) so the ID should not be generated from AMQ
assertFalse("CorrelationID should NOT start with ID, was: " + correlationId, correlationId.startsWith("ID:"));
}
-
+
+
/**
* When the setting useMessageIdAsCorrelationid is true for the client and
* false for the server and a correlation id is not set on the message then
@@ -178,7 +181,6 @@
assertEquals("a", out.getOut().getHeader("JMSCorrelationID"));
}
- @Override
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
@@ -194,7 +196,6 @@
return camelContext;
}
- @Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteDeliveryModePreserveQoSTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteDeliveryModePreserveQoSTest.java
index 6598f41..f411710 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteDeliveryModePreserveQoSTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteDeliveryModePreserveQoSTest.java
@@ -44,7 +44,7 @@
assertMockEndpointsSatisfied();
// should be persistent by default
- Map<String, Object> map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
+ Map map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
assertNotNull(map);
assertEquals(DeliveryMode.PERSISTENT, map.get("JMSDeliveryMode"));
}
@@ -59,7 +59,7 @@
assertMockEndpointsSatisfied();
// should preserve non persistent
- Map<String, Object> map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
+ Map map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
assertNotNull(map);
assertEquals(DeliveryMode.NON_PERSISTENT, map.get("JMSDeliveryMode"));
}
@@ -74,7 +74,7 @@
assertMockEndpointsSatisfied();
// should preserve non persistent
- Map<String, Object> map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
+ Map map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
assertNotNull(map);
assertEquals(DeliveryMode.NON_PERSISTENT, map.get("JMSDeliveryMode"));
}
@@ -89,7 +89,7 @@
assertMockEndpointsSatisfied();
// should preserve persistent
- Map<String, Object> map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
+ Map map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
assertNotNull(map);
assertEquals(DeliveryMode.PERSISTENT, map.get("JMSDeliveryMode"));
}
@@ -104,7 +104,7 @@
assertMockEndpointsSatisfied();
// should preserve persistent
- Map<String, Object> map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
+ Map map = mock.getReceivedExchanges().get(0).getIn().getHeaders();
assertNotNull(map);
assertEquals(DeliveryMode.PERSISTENT, map.get("JMSDeliveryMode"));
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java
index 7207f25..775a454 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteRequestReplyTest.java
@@ -278,7 +278,7 @@
}
}
- public class Task implements Callable<Task> {
+ public class Task implements Callable {
private AtomicInteger counter;
private String fromUri;
private volatile boolean ok = true;
@@ -289,7 +289,7 @@
this.fromUri = fromUri;
}
- public Task call() throws Exception {
+ public Object call() throws Exception {
for (int i = 0; i < maxCalls; i++) {
int callId = counter.incrementAndGet();
Object reply = "";
@@ -445,6 +445,7 @@
runRequestReplyThreaded(endpointUriA);
}
+ @SuppressWarnings("unchecked")
protected void runRequestReplyThreaded(String fromUri) throws Exception {
// start template
template.start();
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/PurchaseOrder.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/PurchaseOrder.java
index 49b9b84..6ac55db 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/PurchaseOrder.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/PurchaseOrder.java
@@ -24,7 +24,6 @@
* @version
*/
public class PurchaseOrder implements Serializable {
- private static final long serialVersionUID = 1L;
private String product;
private double amount;
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/JmsMessageBindTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/JmsMessageBindTest.java
index 33b320d..f0607f3 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/JmsMessageBindTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/JmsMessageBindTest.java
@@ -49,13 +49,17 @@
MyBean bean = getMandatoryBean(MyBean.class, "myBean");
assertEquals("body", "SomeBody", bean.getBody());
- Map<?, ?> beanHeaders = bean.getHeaders();
+ Map beanHeaders = bean.getHeaders();
assertNotNull("No headers!", beanHeaders);
assertEquals("foo header", "bar", beanHeaders.get("foo"));
assertNull("Should get a null value", beanHeaders.get("binding"));
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
protected ClassPathXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/bind/spring.xml");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
index 0923314..02d57d6 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/MyBean.java
@@ -27,13 +27,13 @@
* @version
*/
public class MyBean {
- private Map<?, ?> headers;
+ private Map headers;
private String body;
@EndpointInject(uri = "mock:result")
private ProducerTemplate producer;
@Consume(uri = "activemq:Test.BindingQueue")
- public void myMethod(@Headers Map<?, ?> headers, String body) {
+ public void myMethod(@Headers Map headers, String body) {
this.headers = headers;
this.body = body;
@@ -45,7 +45,7 @@
return body;
}
- public Map<?, ?> getHeaders() {
+ public Map getHeaders() {
return headers;
}
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/JmsDiscoveryTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/JmsDiscoveryTest.java
index 3e5cdc3..11432bd 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/JmsDiscoveryTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/JmsDiscoveryTest.java
@@ -50,7 +50,7 @@
// sleep a little
Thread.sleep(1000);
- Map<String, Map<?, ?>> map = new HashMap<String, Map<?, ?>>(registry.getServices());
+ Map<String, Map> map = new HashMap<String, Map>(registry.getServices());
assertTrue("There should be 1 or more, was: " + map.size(), map.size() >= 1);
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyRegistry.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyRegistry.java
index 0a773df..1f69414 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyRegistry.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyRegistry.java
@@ -30,15 +30,15 @@
public class MyRegistry {
private static final transient Logger LOG = LoggerFactory.getLogger(MyRegistry.class);
- private Map<String, Map<String, Object>> services = new HashMap<String, Map<String, Object>>();
+ private Map<String, Map> services = new HashMap<String, Map>();
- public void onEvent(Map<String, Object> heartbeat) {
+ public void onEvent(Map heartbeat) {
String key = (String) heartbeat.get("name");
LOG.debug(">>> event for: " + key + " details: " + heartbeat);
services.put(key, heartbeat);
}
- public Map<String, Map<String, Object>> getServices() {
+ public Map<String, Map> getServices() {
return services;
}
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyService.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyService.java
index ba5c934..f3c4f92 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyService.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/discovery/MyService.java
@@ -30,7 +30,7 @@
this.name = name;
}
- public Map<String, Object> status() {
+ public Map status() {
Map<String, Object> answer = new HashMap<String, Object>();
answer.put("name", name);
answer.put("time", new Date().getTime());
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/DummyOrder.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/DummyOrder.java
index e1449a0..258272d 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/DummyOrder.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/DummyOrder.java
@@ -23,7 +23,6 @@
*/
public class DummyOrder implements Serializable {
- private static final long serialVersionUID = 1L;
private long orderId;
private long itemId;
private int quantity;
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsGetHeaderKeyFormatIssueTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsGetHeaderKeyFormatIssueTest.java
index e2b9677..e83aeaf 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsGetHeaderKeyFormatIssueTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsGetHeaderKeyFormatIssueTest.java
@@ -65,7 +65,7 @@
from(uri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("VALUE_1", headers.get("HEADER_1"));
assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
}
@@ -73,7 +73,7 @@
.setHeader("HEADER_1", constant("VALUE_2"))
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("VALUE_2", headers.get("HEADER_1"));
assertEquals("VALUE_2", exchange.getIn().getHeader("HEADER_1"));
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutWithSpringRestartIssueTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutWithSpringRestartIssueTest.java
index 63686d0..d113b9d 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutWithSpringRestartIssueTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsInOutWithSpringRestartIssueTest.java
@@ -32,6 +32,11 @@
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/issues/JmsInOutWithSpringRestartIssueTest.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testRestartSpringIssue() throws Exception {
context.startRoute("foo");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsMQSpecialHeaderTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsMQSpecialHeaderTest.java
index ed2db80..70184d8 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsMQSpecialHeaderTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsMQSpecialHeaderTest.java
@@ -46,12 +46,13 @@
}
@Test
+ @SuppressWarnings("unchecked")
public void testUsingSpecialIBMJMSHeaderAndStandardJMSHeader() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello IBM");
mock.message(0).header("JMS_IBM_Character_Set").isEqualTo("ISO8859_1");
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("JMSPriority", 3);
headers.put("JMS_IBM_Character_Set", "ISO8859_1");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyEndUserIssueTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyEndUserIssueTest.java
index 6b5ae2d..2a4cba5 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyEndUserIssueTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyEndUserIssueTest.java
@@ -65,7 +65,7 @@
from(uri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("VALUE_1", headers.get("HEADER_1"));
assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
}
@@ -73,7 +73,7 @@
.setHeader("HEADER_1", constant("VALUE_2"))
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("VALUE_2", headers.get("HEADER_1"));
assertEquals("VALUE_2", exchange.getIn().getHeader("HEADER_1"));
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyTest.java
index 231cb8f..b4b93da 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyTest.java
@@ -72,7 +72,7 @@
from(uri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("VALUE_1", headers.get("HEADER_1"));
assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyUsingJmsConfigurationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyUsingJmsConfigurationTest.java
index 1df902b..5b81199 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyUsingJmsConfigurationTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsPassThroughtJmsKeyFormatStrategyUsingJmsConfigurationTest.java
@@ -81,7 +81,7 @@
from(uri)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("VALUE_1", headers.get("HEADER_1"));
assertEquals("VALUE_1", exchange.getIn().getHeader("HEADER_1"));
}
@@ -90,7 +90,7 @@
.setHeader("HEADER_2", constant("VALUE_2"))
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- Map<String, Object> headers = exchange.getIn().getHeaders();
+ Map headers = exchange.getIn().getHeaders();
assertEquals("START", headers.get("HEADER_3"));
assertEquals("START", exchange.getIn().getHeader("HEADER_3"));
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
index 6c68bd8..d0863be 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
@@ -33,6 +33,10 @@
private static final transient Logger LOG = LoggerFactory.getLogger(JmsSendToAlotOfDestinationWithSameEndpointTest.class);
private static final String URI = "activemq:queue:foo?autoStartup=false";
+ public int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testSendToAlotOfMessageToQueues() throws Exception {
int size = 100;
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java
index f617a7f..be87493 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/remoting/JmsRemotingTest.java
@@ -28,7 +28,12 @@
protected ClassPathXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/remoting/spring.xml");
}
-
+
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testRemoting() throws Exception {
ISay proxy = applicationContext.getBean("sayProxy", ISay.class);
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
index 137e86d..95fa478 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AbstractTransactionTest.java
@@ -82,7 +82,7 @@
return assertIsInstanceOf(ConditionalExceptionProcessor.class, processor);
}
- protected Processor findProcessorByClass(Processor processor, Class<?> findClass) {
+ protected Processor findProcessorByClass(Processor processor, Class findClass) {
while (true) {
processor = unwrapDeadLetter(processor);
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTX2Test.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTX2Test.java
index 321faad..c5193b1 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTX2Test.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTX2Test.java
@@ -33,6 +33,12 @@
private static String afterThreadName;
@Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXMulticastTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXMulticastTest.java
index 459cc29..8d3282e 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXMulticastTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXMulticastTest.java
@@ -32,6 +32,13 @@
private static String beforeThreadName;
private static String afterThreadName;
+
+ @Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRecipientListTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRecipientListTest.java
index 4e641ca..d12ea19 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRecipientListTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRecipientListTest.java
@@ -33,6 +33,12 @@
private static String afterThreadName;
@Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollback2Test.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollback2Test.java
index 024d2cb..4d1575b 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollback2Test.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollback2Test.java
@@ -36,6 +36,12 @@
private static String afterThreadName;
@Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollbackTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollbackTest.java
index a742366..673aa8d 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollbackTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRollbackTest.java
@@ -35,6 +35,12 @@
private static String afterThreadName;
@Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRoutingSlipTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRoutingSlipTest.java
index 3250b9b..e1066e7 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRoutingSlipTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXRoutingSlipTest.java
@@ -33,6 +33,11 @@
private static String beforeThreadName;
private static String afterThreadName;
+ @Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTest.java
index eb15f30..1a13ea4 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTest.java
@@ -33,6 +33,12 @@
private static String afterThreadName;
@Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTryCatchFinallyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTryCatchFinallyTest.java
index 475d9c4..246e2bb 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTryCatchFinallyTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXTryCatchFinallyTest.java
@@ -34,6 +34,12 @@
private static String afterThreadName;
@Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXWireTapTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXWireTapTest.java
index a6b0df1..cd852b1 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXWireTapTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/AsyncEndpointJmsTXWireTapTest.java
@@ -31,6 +31,13 @@
public class AsyncEndpointJmsTXWireTapTest extends CamelSpringTestSupport {
private static String beforeThreadName;
private static String afterThreadName;
+
+
+ @Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML so return 0
+ return 0;
+ }
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTXInOutPersistentQueueTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTXInOutPersistentQueueTest.java
index cc73c07..1aecca8 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTXInOutPersistentQueueTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTXInOutPersistentQueueTest.java
@@ -36,6 +36,12 @@
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/JmsTransacted-context.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ // no routes in Spring XML
+ return 0;
+ }
+
@Test
public void testJMSTXInOutPersistentQueueWithClientRedelivery() throws Exception {
getMockEndpoint("mock:foo").expectedBodiesReceived("World", "World", "World");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionErrorHandlerTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionErrorHandlerTest.java
index d47afe8..3f27a14 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionErrorHandlerTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionErrorHandlerTest.java
@@ -33,6 +33,10 @@
"/org/apache/camel/component/jms/tx/JMSTransactionErrorHandlerTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Test
public void testTransactionSuccess() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
index a5d580d..fde251e 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionIsTransactedRedeliveredTest.java
@@ -38,6 +38,12 @@
}
@Override
+ protected int getExpectedRouteCount() {
+ // have to return 0 because we enable advice with
+ return 0;
+ }
+
+ @Override
public boolean isUseAdviceWith() {
return true;
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionThrottlingRoutePolicyTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionThrottlingRoutePolicyTest.java
index 0f15e12..368b932 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionThrottlingRoutePolicyTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionThrottlingRoutePolicyTest.java
@@ -30,6 +30,10 @@
"/org/apache/camel/component/jms/tx/JMSTransactionThrottlingRoutePolicyTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Override
public void setUp() throws Exception {
deleteDirectory("activemq-data");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
index e232cda..d76a3ad 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.java
@@ -33,6 +33,10 @@
"/org/apache/camel/component/jms/tx/JMSTransactionalClientTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Test
public void testTransactionSuccess() throws Exception {
// START SNIPPET: e1
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientWithRollbackTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientWithRollbackTest.java
index 1bd6033..dee3e2b 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientWithRollbackTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JMSTransactionalClientWithRollbackTest.java
@@ -33,6 +33,10 @@
"/org/apache/camel/component/jms/tx/JMSTransactionalClientWithRollbackTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Test
public void testTransactionSuccess() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedSecurityTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedSecurityTest.java
index ec760bb8..f5f98cf 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedSecurityTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedSecurityTest.java
@@ -30,7 +30,11 @@
protected ClassPathXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("/org/apache/camel/component/jms/tx/JmsToJmsTransactedSecurityTest.xml");
}
-
+
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testJmsSecurityFailure() throws Exception {
context.addRoutes(new RouteBuilder() {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedTest.java
index 95cd899..1115f34 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/JmsToJmsTransactedTest.java
@@ -31,6 +31,10 @@
return new ClassPathXmlApplicationContext("/org/apache/camel/component/jms/tx/JmsToJmsTransactedTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testJmsToJmsTestOK() throws Exception {
context.addRoutes(new RouteBuilder() {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java
index 41f9483..4bbe6ca 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToProcessorTransactionTest.java
@@ -30,6 +30,10 @@
* NOTE: had to split into separate test classes as I was unable to fully tear down and isolate the test cases, I'm not sure why, but as soon as we know the Transaction classes can be joined into one.
*/
public class QueueToProcessorTransactionTest extends AbstractTransactionTest {
+
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
@Test
public void testRollbackUsingXmlQueueToProcessor() throws Exception {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueRequestReplyTransactionTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueRequestReplyTransactionTest.java
index ef4903c..6376102 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueRequestReplyTransactionTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueRequestReplyTransactionTest.java
@@ -36,6 +36,10 @@
*/
public class QueueToQueueRequestReplyTransactionTest extends AbstractTransactionTest {
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testRollbackUsingXmlQueueToQueueRequestReplyUsingDynamicMessageSelector() throws Exception {
final ConditionalExceptionProcessor cp = new ConditionalExceptionProcessor(5);
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionTest.java
index 9bf910b..5c454cf 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionTest.java
@@ -32,6 +32,10 @@
*/
public class QueueToQueueTransactionTest extends AbstractTransactionTest {
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testRollbackUsingXmlQueueToQueue() throws Exception {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
index 86dfc81..65f3209 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/QueueToQueueTransactionWithoutDefineTransactionManagerTest.java
@@ -24,6 +24,10 @@
public class QueueToQueueTransactionWithoutDefineTransactionManagerTest extends AbstractTransactionTest {
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/jms/tx/ActiveMQWithoutTransactionManager.xml");
}
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/RouteIdTransactedTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/RouteIdTransactedTest.java
index 33987f3..df2e1e1 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/RouteIdTransactedTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/RouteIdTransactedTest.java
@@ -31,6 +31,10 @@
"/org/apache/camel/component/jms/tx/RouteIdTransactedTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Test
public void testRouteId() throws Exception {
getMockEndpoint("mock:error").expectedMessageCount(0);
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactedAsyncUsingThreadsTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactedAsyncUsingThreadsTest.java
index f40121e..eaba196 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactedAsyncUsingThreadsTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactedAsyncUsingThreadsTest.java
@@ -38,6 +38,10 @@
"/org/apache/camel/component/jms/tx/TransactedAsyncUsingThreadsTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Before
public void init() {
counter = 0;
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
index 0fbe8ce..60cd2cb 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.java
@@ -33,6 +33,10 @@
"/org/apache/camel/component/jms/tx/TransactionErrorHandlerBuilderAsSpringBeanTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Test
public void testTransactionSuccess() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerCustomerSpringParserTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerCustomerSpringParserTest.java
index 8566eff..0704b9d 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerCustomerSpringParserTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionErrorHandlerCustomerSpringParserTest.java
@@ -33,6 +33,10 @@
"/org/apache/camel/component/jms/tx/TransactionErrorHandlerCustomerSpringParserTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Test
public void testTransactionSuccess() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionInterceptSendToEndpointTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionInterceptSendToEndpointTest.java
index 55d3a24..8ed0276 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionInterceptSendToEndpointTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionInterceptSendToEndpointTest.java
@@ -30,6 +30,9 @@
"/org/apache/camel/component/jms/tx/TransactionInterceptSendToEndpointTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
@Test
public void testIntercepted() throws Exception {
diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.java
index 5edbdd2..c7d5c54 100644
--- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.java
+++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.java
@@ -33,6 +33,10 @@
"/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Test
public void testTransactionSuccess() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
diff --git a/components/camel-jmx/pom.xml b/components/camel-jmx/pom.xml
index 749e8c5..1aec6eb 100644
--- a/components/camel-jmx/pom.xml
+++ b/components/camel-jmx/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXEndpointTest.java b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXEndpointTest.java
index dd28305..d24a34e 100644
--- a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXEndpointTest.java
+++ b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXEndpointTest.java
@@ -41,7 +41,6 @@
DefaultCamelContext context;
@Before
- @SuppressWarnings("deprecation")
public void setUp() throws Exception {
context = new DefaultCamelContext();
// saves 5 seconds on this unit test
diff --git a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
index 71a39c4..5a7d3d3 100644
--- a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
+++ b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/JMXRemoteTest.java
@@ -49,6 +49,7 @@
connector.stop();
}
+ @SuppressWarnings("unchecked")
@Override
protected void initServer() throws Exception {
registry = LocateRegistry.createRegistry(61000);
@@ -57,7 +58,7 @@
// create MBean server
server = MBeanServerFactory.createMBeanServer(DOMAIN);
// create JMXConnectorServer MBean
- connector = JMXConnectorServerFactory.newJMXConnectorServer(url, Collections.<String, Object>emptyMap(), server);
+ connector = JMXConnectorServerFactory.newJMXConnectorServer(url, Collections.EMPTY_MAP, server);
connector.start();
}
diff --git a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java
index cd67288..e88cb0b 100644
--- a/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java
+++ b/components/camel-jmx/src/test/java/org/apache/camel/component/jmx/SimpleBeanFixture.java
@@ -112,7 +112,7 @@
* Gets the mxbean for our remote object using the specified name
*/
protected ISimpleMXBean getMXBean(ObjectName aObjectName) {
- return MBeanServerInvocationHandler.newProxyInstance(
+ return (ISimpleMXBean) MBeanServerInvocationHandler.newProxyInstance(
server,
aObjectName,
ISimpleMXBean.class,
@@ -159,7 +159,6 @@
* Initializes the camel context by creating a simple route from our mbean
* to the mock endpoint.
*/
- @SuppressWarnings("deprecation")
protected void initContext() throws Exception {
mContext.setLazyLoadTypeConverters(true);
final MockEndpoint mock = mContext.getEndpoint("mock:sink", MockEndpoint.class);
diff --git a/components/camel-josql/pom.xml b/components/camel-josql/pom.xml
index a9d0a70a..898ef34 100644
--- a/components/camel-josql/pom.xml
+++ b/components/camel-josql/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java b/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java
index 4fb1347..c6f83be 100644
--- a/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java
+++ b/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java
@@ -54,12 +54,12 @@
}
public boolean matches(Exchange exchange) {
- List<?> list = evaluateQuery(exchange);
+ List list = evaluateQuery(exchange);
return matches(exchange, list);
}
public void assertMatches(String text, Exchange exchange) throws AssertionError {
- List<?> list = evaluateQuery(exchange);
+ List list = evaluateQuery(exchange);
if (!matches(exchange, list)) {
throw new AssertionError(this + " failed on " + exchange + " as found " + list);
}
@@ -101,14 +101,14 @@
// Implementation methods
// -----------------------------------------------------------------------
- protected boolean matches(Exchange exchange, List<?> list) {
+ protected boolean matches(Exchange exchange, List list) {
return ObjectHelper.matches(list);
}
- protected List<?> evaluateQuery(Exchange exchange) {
+ protected List evaluateQuery(Exchange exchange) {
configureQuery(exchange);
Message in = exchange.getIn();
- List<?> list = in.getBody(List.class);
+ List list = in.getBody(List.class);
if (list == null) {
list = Collections.singletonList(in.getBody());
}
diff --git a/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java b/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java
index 1837d81..b0111c7 100644
--- a/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java
+++ b/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java
@@ -33,29 +33,35 @@
*/
public class SqlTest extends CamelTestSupport {
+ //protected CamelContext context = new DefaultCamelContext();
protected Exchange exchange;
@Test
public void testExpression() throws Exception {
Expression expression = sql("SELECT * FROM org.apache.camel.builder.sql.Person where city = 'London'");
- List<?> value = expression.evaluate(exchange, List.class);
- assertEquals("List size", 2, value.size());
+ List value = expression.evaluate(exchange, List.class);
- for (Object person : value) {
+ List list = (List)value;
+ assertEquals("List size", 2, list.size());
+
+ for (Object person : list) {
log.info("Found: " + person);
}
}
+ @SuppressWarnings("unchecked")
@Test
public void testExpressionWithHeaderVariable() throws Exception {
Expression expression = sql("SELECT * FROM org.apache.camel.builder.sql.Person where name = :fooHeader");
- List<?> value = expression.evaluate(exchange, List.class);
- assertEquals("List size", 1, value.size());
+ List value = expression.evaluate(exchange, List.class);
- for (Object person : value) {
+ List<Person> list = (List<Person>)value;
+ assertEquals("List size", 1, list.size());
+
+ for (Person person : list) {
log.info("Found: " + person);
- assertEquals("name", "James", ((Person)person).getName());
+ assertEquals("name", "James", person.getName());
}
}
diff --git a/components/camel-josql/src/test/java/org/apache/camel/lanaguage/sql/SqlLanguageTest.java b/components/camel-josql/src/test/java/org/apache/camel/lanaguage/sql/SqlLanguageTest.java
index d6cb174..251388e 100644
--- a/components/camel-josql/src/test/java/org/apache/camel/lanaguage/sql/SqlLanguageTest.java
+++ b/components/camel-josql/src/test/java/org/apache/camel/lanaguage/sql/SqlLanguageTest.java
@@ -34,26 +34,31 @@
Language language = assertResolveLanguage(getLanguageName());
Expression expression = language.createExpression("SELECT * FROM org.apache.camel.builder.sql.Person where city = 'London'");
- List<?> value = expression.evaluate(exchange, List.class);
- assertEquals("List size", 2, value.size());
+ List value = expression.evaluate(exchange, List.class);
- for (Object person : value) {
+ List list = (List)value;
+ assertEquals("List size", 2, list.size());
+
+ for (Object person : list) {
log.info("Found: " + person);
}
}
+ @SuppressWarnings("unchecked")
@Test
public void testExpressionWithHeaderVariable() throws Exception {
Language language = assertResolveLanguage(getLanguageName());
Expression expression = language.createExpression("SELECT * FROM org.apache.camel.builder.sql.Person where name = :fooHeader");
- List<?> value = expression.evaluate(exchange, List.class);
- assertEquals("List size", 1, value.size());
+ List value = expression.evaluate(exchange, List.class);
- for (Object person : value) {
+ List<Person> list = (List<Person>)value;
+ assertEquals("List size", 1, list.size());
+
+ for (Person person : list) {
log.info("Found: " + person);
- assertEquals("name", "James", ((Person) person).getName());
+ assertEquals("name", "James", person.getName());
}
}
diff --git a/components/camel-jpa/pom.xml b/components/camel-jpa/pom.xml
index 107657b..88825ee 100644
--- a/components/camel-jpa/pom.xml
+++ b/components/camel-jpa/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -116,40 +116,63 @@
</systemProperties>
</configuration>
</plugin>
-
+
+
+ <!-- lets enhance the classes for OpenJPA (shame it can't do it at runtime!) -->
<plugin>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>${openjpa-version}</version>
- <configuration>
- <persistenceXmlFile>${project.basedir}/src/test/resources/META-INF/persistence.xml</persistenceXmlFile>
- <includes>org/apache/camel/processor/idempotent/jpa/MessageProcessed.class,org/apache/camel/processor/interceptor/jpa/JpaTraceEventMessage.class,org/apache/camel/examples/*.class</includes>
- <addDefaultConstructor>true</addDefaultConstructor>
- <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
- </configuration>
- <executions>
- <execution>
- <id>enhancer</id>
- <phase>process-classes</phase>
- <goals>
- <goal>enhance</goal>
- </goals>
- </execution>
- <execution>
- <id>test enhancer</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>test-enhance</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>${openjpa-version}</version>
- </dependency>
- </dependencies>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ <version>${openjpa-version}</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <phase>process-test-classes</phase>
+ <configuration>
+ <target>
+ <path id="cp">
+ <path refid="maven.test.classpath" />
+ <path refid="maven.compile.classpath" />
+ <path refid="maven.dependency.classpath" />
+ </path>
+ <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
+ <classpath refid="cp" />
+ </taskdef>
+
+ <mkdir dir="${basedir}/target/jpa-test-classes" />
+
+ <openjpac directory="${basedir}/target/jpa-test-classes">
+ <classpath refid="cp" />
+ <fileset dir="${basedir}/target/classes">
+ <include name="org/apache/camel/processor/**/MessageProcessed.class" />
+ <include name="org/apache/camel/processor/**/JpaTraceEventMessage.class" />
+ </fileset>
+ <config propertiesFile="${basedir}/src/test/resources/META-INF/persistence.xml" />
+ </openjpac>
+
+ <openjpac directory="${basedir}/target/jpa-test-classes">
+ <classpath refid="cp" />
+ <fileset dir="${basedir}/target/test-classes">
+ <include name="org/apache/camel/examples/*.class" />
+ </fileset>
+ <config propertiesFile="${basedir}/src/test/resources/META-INF/persistence.xml" />
+ </openjpac>
+
+ <copy overwrite="true" todir="${basedir}/target/test-classes">
+ <fileset dir="${basedir}/target/jpa-test-classes" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
index c9ac19f..c0e678b 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
@@ -27,9 +27,12 @@
import javax.persistence.PersistenceException;
import javax.persistence.Query;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -39,7 +42,7 @@
/**
* @version
*/
-public class JpaConsumer extends ScheduledBatchPollingConsumer {
+public class JpaConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
private static final transient Logger LOG = LoggerFactory.getLogger(JpaConsumer.class);
private final JpaEndpoint endpoint;
@@ -50,7 +53,10 @@
private String namedQuery;
private String nativeQuery;
private Class<?> resultClass;
+ private int maxMessagesPerPoll;
private boolean transacted;
+ private volatile ShutdownRunningTask shutdownRunningTask;
+ private volatile int pendingExchanges;
private static final class DataHolder {
private Exchange exchange;
@@ -122,6 +128,9 @@
return endpoint.getCamelContext().getTypeConverter().convertTo(int.class, messagePolled);
}
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
public int processBatch(Queue<Object> exchanges) throws Exception {
int total = exchanges.size();
@@ -163,6 +172,54 @@
return total;
}
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
// Properties
// -------------------------------------------------------------------------
@Override
diff --git a/components/camel-jsch/pom.xml b/components/camel-jsch/pom.xml
deleted file mode 100644
index c2e9c25..0000000
--- a/components/camel-jsch/pom.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-jsch</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Jsch</name>
- <description>Camel SCP Support</description>
-
- <properties>
- <camel.osgi.import.before.defaults>
- com.jcraft.jsch.*;version="[0.1.40,0.1.50)",
- org.apache.camel.component.file.strategy;${camel.osgi.import.strict.version}
- </camel.osgi.import.before.defaults>
- <camel.osgi.export.pkg>org.apache.camel.component.jsch.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-ftp</artifactId>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>${jsch-version}</version>
- </dependency>
-
- <!-- logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- for testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <version>${sshd-version}</version>
- <scope>test</scope>
- </dependency>
- <!-- needed by sshd server -->
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>${mina2-version}</version>
- </dependency>
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- <version>${bouncycastle-version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <defaultGoal>install</defaultGoal>
- </build>
-</project>
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/JschComponent.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/JschComponent.java
deleted file mode 100644
index 252c6bf..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/JschComponent.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import java.net.URI;
-import java.util.Map;
-
-import com.jcraft.jsch.JSch;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.file.GenericFileEndpoint;
-import org.apache.camel.component.file.remote.RemoteFileComponent;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Component providing secure messaging using JSch
- */
-public class JschComponent extends RemoteFileComponent<ScpFile> {
- private static final transient Logger LOG = LoggerFactory.getLogger(JschComponent.class);
- static {
- JSch.setConfig("StrictHostKeyChecking", "yes");
- JSch.setLogger(new com.jcraft.jsch.Logger() {
- @Override
- public boolean isEnabled(int level) {
- return level == FATAL || level == ERROR ? LOG.isErrorEnabled()
- : level == WARN ? LOG.isWarnEnabled()
- : level == INFO ? LOG.isInfoEnabled() : LOG.isDebugEnabled();
- }
- @Override
- public void log(int level, String message) {
- if (level == FATAL || level == ERROR) {
- LOG.error("[JSCH] {}", message);
- } else if (level == WARN) {
- LOG.warn("[JSCH] {}", message);
- } else if (level == INFO) {
- LOG.info("[JSCH] {}", message);
- } else {
- LOG.debug("[JSCH] {}", message);
- }
- }
- });
- }
-
- public JschComponent() {
- }
-
- public JschComponent(CamelContext context) {
- super(context);
- }
-
- @Override
- protected GenericFileEndpoint<ScpFile> buildFileEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- // TODO: revisit stripping the query part; should not be needed with valid uris
- int query = uri.indexOf("?");
- return new ScpEndpoint(uri, this, new ScpConfiguration(new URI(query >= 0 ? uri.substring(0, query) : uri)));
- }
-
- protected void afterPropertiesSet(GenericFileEndpoint<ScpFile> endpoint) throws Exception {
- // noop
- }
-
- @Override
- public void doStop() throws Exception {
- // TODO: close all sessions
- super.doStop();
- }
-}
-
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
deleted file mode 100644
index eabfd85..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpConfiguration.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import java.net.URI;
-
-import org.apache.camel.component.file.remote.RemoteFileConfiguration;
-
-/**
- * Secure FTP configuration
- */
-public class ScpConfiguration extends RemoteFileConfiguration {
-
- public static final int DEFAULT_SFTP_PORT = 22;
- private String knownHostsFile;
- private String privateKeyFile;
- private String privateKeyFilePassphrase;
- private String strictHostKeyChecking = "no";
- private int serverAliveInterval;
- private int serverAliveCountMax = 1;
- private String chmod;
- // comma separated list of ciphers.
- // null means default jsch list will be used
- private String ciphers;
- private int compression;
-
- public ScpConfiguration() {
- setProtocol("sftp");
- }
-
- public ScpConfiguration(URI uri) {
- super(uri);
- }
-
- @Override
- protected void setDefaultPort() {
- setPort(DEFAULT_SFTP_PORT);
- }
-
- public String getKnownHostsFile() {
- return knownHostsFile;
- }
-
- public void setKnownHostsFile(String knownHostsFile) {
- this.knownHostsFile = knownHostsFile;
- }
-
- public String getPrivateKeyFile() {
- return privateKeyFile;
- }
-
- public void setPrivateKeyFile(String privateKeyFile) {
- this.privateKeyFile = privateKeyFile;
- }
-
- public String getPrivateKeyFilePassphrase() {
- return privateKeyFilePassphrase;
- }
-
- public void setPrivateKeyFilePassphrase(String privateKeyFilePassphrase) {
- this.privateKeyFilePassphrase = privateKeyFilePassphrase;
- }
-
- public String getStrictHostKeyChecking() {
- return strictHostKeyChecking;
- }
-
- public void setStrictHostKeyChecking(String strictHostKeyChecking) {
- this.strictHostKeyChecking = strictHostKeyChecking;
- }
-
- public void setServerAliveInterval(int serverAliveInterval) {
- this.serverAliveInterval = serverAliveInterval;
- }
-
- public int getServerAliveInterval() {
- return serverAliveInterval;
- }
-
- public void setServerAliveCountMax(int serverAliveCountMax) {
- this.serverAliveCountMax = serverAliveCountMax;
- }
-
- public int getServerAliveCountMax() {
- return serverAliveCountMax;
- }
-
- public void setChmod(String chmod) {
- this.chmod = chmod;
- }
-
- public String getChmod() {
- return chmod;
- }
-
- public void setCiphers(String ciphers) {
- this.ciphers = ciphers;
- }
-
- public String getCiphers() {
- return ciphers;
- }
-
- public int getCompression() {
- return compression;
- }
-
- public void setCompression(int compression) {
- this.compression = compression;
- }
-}
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpEndpoint.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpEndpoint.java
deleted file mode 100644
index 5030dfc..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpEndpoint.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import org.apache.camel.Expression;
-import org.apache.camel.Processor;
-import org.apache.camel.component.file.GenericFileProducer;
-import org.apache.camel.component.file.remote.RemoteFileConfiguration;
-import org.apache.camel.component.file.remote.RemoteFileConsumer;
-import org.apache.camel.component.file.remote.RemoteFileEndpoint;
-import org.apache.camel.component.file.remote.RemoteFileOperations;
-
-/**
- * Secure Copy Endpoint
- */
-public class ScpEndpoint extends RemoteFileEndpoint<ScpFile> {
-
- public ScpEndpoint() {
- }
-
- public ScpEndpoint(String uri, JschComponent component, RemoteFileConfiguration configuration) {
- super(uri, component, configuration);
- }
-
- @Override
- public ScpConfiguration getConfiguration() {
- return (ScpConfiguration) this.configuration;
- }
-
- @Override
- protected RemoteFileConsumer<ScpFile> buildConsumer(Processor processor) {
- return null; // new ScpConsumer(this, processor, createRemoteFileOperations());
- }
-
- protected GenericFileProducer<ScpFile> buildProducer() {
- return new ScpProducer(this, createRemoteFileOperations());
- }
-
- public RemoteFileOperations<ScpFile> createRemoteFileOperations() {
- ScpOperations operations = new ScpOperations();
- operations.setEndpoint(this);
- return operations;
- }
-
- @Override
- public String getScheme() {
- return "scp";
- }
-
- @Override
- public Expression getTempFileName() {
- log.debug("Creation of temporary files not supported by the scp: protocol.");
- return null;
- }
-}
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpFile.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpFile.java
deleted file mode 100644
index e69ef56..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpFile.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-
-/**
- * SFTP remote file operations
- */
-public class ScpFile {
- private boolean directory;
- private int attrs;
- private int length;
- private String name;
- private String parent;
-
- public String header() {
- StringBuffer buffer = new StringBuffer();
- buffer.append(directory ? "D" : "C");
- buffer.append(" ");
- return buffer.toString();
- }
-
- public boolean isDirectory() {
- return directory;
- }
- public void setDirectory(boolean directory) {
- this.directory = directory;
- }
- public int getAttrs() {
- return attrs;
- }
- public void setAttrs(int attrs) {
- this.attrs = attrs;
- }
- public int getLength() {
- return length;
- }
- public void setLength(int length) {
- this.length = length;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getParent() {
- return parent;
- }
-
- public void setParent(String parent) {
- this.parent = parent;
- }
-}
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
deleted file mode 100644
index 6ee9aa6..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpOperations.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Hashtable;
-import java.util.List;
-
-import com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UIKeyboardInteractive;
-import com.jcraft.jsch.UserInfo;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.InvalidPayloadException;
-import org.apache.camel.component.file.GenericFileEndpoint;
-import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.apache.camel.component.file.remote.RemoteFileConfiguration;
-import org.apache.camel.component.file.remote.RemoteFileOperations;
-import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.camel.util.ObjectHelper.isNotEmpty;
-
-/**
- * SCP remote file operations
- */
-public class ScpOperations implements RemoteFileOperations<ScpFile> {
- private static final String DEFAULT_KNOWN_HOSTS = "META-INF/.ssh/known_hosts";
- private static final transient Logger LOG = LoggerFactory.getLogger(ScpOperations.class);
-
- private ScpEndpoint endpoint;
- private Session session;
- private ChannelExec channel;
-
- @Override
- public void setEndpoint(GenericFileEndpoint<ScpFile> endpoint) {
- this.endpoint = (ScpEndpoint)endpoint;
- }
-
- @Override
- public boolean deleteFile(String name) throws GenericFileOperationFailedException {
- throw new GenericFileOperationFailedException("Operation 'delete' not supported by the scp: protocol");
- }
-
- @Override
- public boolean existsFile(String name) throws GenericFileOperationFailedException {
- // maybe... cannot determine using the scp: protocol
- return false;
- }
-
- @Override
- public boolean renameFile(String from, String to) throws GenericFileOperationFailedException {
- throw new GenericFileOperationFailedException("Operation 'rename' not supported by the scp: protocol");
- }
-
- @Override
- public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException {
- // done by the server
- return true;
- }
-
- @Override
- public boolean retrieveFile(String name, Exchange exchange) throws GenericFileOperationFailedException {
- // TODO: implement
- return false;
- }
-
- @Override
- public boolean storeFile(String name, Exchange exchange) throws GenericFileOperationFailedException {
- ObjectHelper.notNull(session, "session");
- ScpConfiguration cfg = endpoint.getConfiguration();
-
- int timeout = cfg.getConnectTimeout();
- LOG.trace("Opening channel to {} with {} timeout...", cfg.remoteServerInformation(),
- timeout > 0 ? (Integer.toString(timeout) + " ms") : "no");
- String file = getRemoteFile(name, cfg);
- try {
- channel = (ChannelExec) session.openChannel("exec");
- channel.setCommand(getScpCommand(cfg, file));
- channel.connect(timeout);
- LOG.trace("Channel connected to {}", cfg.remoteServerInformation());
-
- try {
- write(channel, file, ExchangeHelper.getMandatoryInBody(exchange, InputStream.class));
- } catch (InvalidPayloadException e) {
- throw new GenericFileOperationFailedException("Failed extract message body as InputStream", e);
- } catch (IOException e) {
- throw new GenericFileOperationFailedException("Failed to write file " + file, e);
- }
- } catch (JSchException e) {
- LOG.warn("Failed to secure copy file " + file, e);
- return false;
- } finally {
- if (channel != null) {
- LOG.trace("Disconnecting 'exec' scp channel");
- channel.disconnect();
- channel = null;
- LOG.trace("Channel disconnected from {}", cfg.remoteServerInformation());
- }
- }
- return true;
- }
-
- @Override
- public String getCurrentDirectory() throws GenericFileOperationFailedException {
- return endpoint.getConfiguration().getDirectory();
- }
-
- @Override
- public void changeCurrentDirectory(String path) throws GenericFileOperationFailedException {
- throw new GenericFileOperationFailedException("Operation 'cd " + path + "' not supported by the scp: protocol");
- }
-
- @Override
- public void changeToParentDirectory() throws GenericFileOperationFailedException {
- throw new GenericFileOperationFailedException("Operation 'cd ..' not supported by the scp: protocol");
- }
-
- @Override
- public List<ScpFile> listFiles() throws GenericFileOperationFailedException {
- throw new GenericFileOperationFailedException("Operation 'ls' not supported by the scp: protocol");
- }
-
- @Override
- public List<ScpFile> listFiles(String path) throws GenericFileOperationFailedException {
- throw new GenericFileOperationFailedException("Operation 'ls " + path + "' not supported by the scp: protocol");
- }
-
- @Override
- public boolean connect(RemoteFileConfiguration configuration) throws GenericFileOperationFailedException {
- if (!isConnected()) {
- session = createSession(configuration instanceof ScpConfiguration ? (ScpConfiguration)configuration : null);
- // TODO: deal with reconnection attempts
- if (!isConnected()) {
- session = null;
- throw new GenericFileOperationFailedException("Failed to connect to " + configuration.remoteServerInformation());
- }
- }
- return true;
- }
-
- @Override
- public boolean isConnected() throws GenericFileOperationFailedException {
- return session != null && session.isConnected();
- }
-
- @Override
- public void disconnect() throws GenericFileOperationFailedException {
- if (isConnected()) {
- session.disconnect();
- }
- session = null;
- }
-
- @Override
- public boolean sendNoop() throws GenericFileOperationFailedException {
- // not supported by scp:
- return true;
- }
-
- @Override
- public boolean sendSiteCommand(String command) throws GenericFileOperationFailedException {
- // TODO: not really used, maybe implement at a later time
- return true;
- }
-
- private Session createSession(ScpConfiguration config) {
- ObjectHelper.notNull(config, "ScpConfiguration");
- try {
- final JSch jsch = new JSch();
- // get from configuration
- if (isNotEmpty(config.getCiphers())) {
- LOG.debug("Using ciphers: {}", config.getCiphers());
- Hashtable<String, String> ciphers = new Hashtable<String, String>();
- ciphers.put("cipher.s2c", config.getCiphers());
- ciphers.put("cipher.c2s", config.getCiphers());
- JSch.setConfig(ciphers);
- }
-
- String knownHostsFile = config.getKnownHostsFile();
- jsch.setKnownHosts(ObjectHelper.isEmpty(knownHostsFile) ? DEFAULT_KNOWN_HOSTS : knownHostsFile);
- session = jsch.getSession(config.getUsername(), config.getHost(), config.getPort());
- session.setTimeout(config.getTimeout());
- session.setUserInfo(new SessionUserInfo(config));
-
- int timeout = config.getConnectTimeout();
- LOG.debug("Connecting to {} with {} timeout...", config.remoteServerInformation(),
- timeout > 0 ? (Integer.toString(timeout) + " ms") : "no");
- if (timeout > 0) {
- session.connect(timeout);
- } else {
- session.connect();
- }
- } catch (JSchException e) {
- session = null;
- LOG.warn("Could not create ssh session for " + config.remoteServerInformation(), e);
- }
- return session;
- }
-
- private void write(ChannelExec c, String name, InputStream data) throws IOException {
- OutputStream os = c.getOutputStream();
- InputStream is = c.getInputStream();
-
- writeFile(name, data, os, is);
-
- os.close();
- is.close();
- }
-
- private void writeFile(String filename, InputStream data, OutputStream os, InputStream is) throws IOException {
- int pos = filename.indexOf('/');
- if (pos >= 0) {
- // write to child directory
- String dir = filename.substring(0, pos);
- os.write(("D0775 0 " + dir + "\n").getBytes());
- os.flush();
- is.read();
-
- writeFile(filename.substring(pos + 1), data, os, is);
-
- os.write("E\n".getBytes());
- os.flush();
- is.read();
- } else {
- int count = 0;
- int read = 0;
- int size = endpoint.getBufferSize();
- byte[] bytes = new byte[size];
-
- // figure out the stream size as we need to pass it in the header
- BufferedInputStream buffer = new BufferedInputStream(data, size);
- buffer.mark(Integer.MAX_VALUE);
- while ((read = buffer.read(bytes)) != -1) {
- count += read;
- }
-
- // send the header
- os.write(("C0775 " + count + " " + filename + "\n").getBytes());
- os.flush();
- is.read();
-
- // now send the stream
- buffer.reset();
- while ((read = buffer.read(bytes)) != -1) {
- os.write(bytes, 0, read);
- }
- os.flush();
- is.read();
- }
- os.write(0);
- os.flush();
- }
-
- private static String getRemoteTarget(ScpConfiguration config) {
- // use current dir (".") if target directory not specified in uri
- return config.getDirectory().isEmpty() ? "." : config.getDirectory();
- }
-
- private static String getRemoteFile(String name, ScpConfiguration config) {
- String dir = config.getDirectory();
- dir = dir.endsWith("/") ? dir : dir + "/";
- return name.startsWith(dir) ? name.substring(dir.length()) : name;
- }
-
- private static boolean isRecursiveScp(String name) {
- return name.indexOf('/') > 0;
- }
-
- private static String getScpCommand(ScpConfiguration config, String name) {
- StringBuilder cmd = new StringBuilder();
- cmd.append("scp ");
- // TODO: need config for scp *-p* (preserves modification times, access times, and modes from the original file)
- // String command="scp " + (ptimestamp ? "-p " : "") + "-t " + configuration.getDirectory();
- // TODO: refactor to use generic command
- cmd.append(isRecursiveScp(name) ? "-r " : "");
- cmd.append("-t ");
- cmd.append(getRemoteTarget(config));
- return cmd.toString();
- }
-
- protected static final class SessionUserInfo implements UserInfo, UIKeyboardInteractive {
- private final ScpConfiguration config;
- public SessionUserInfo(ScpConfiguration config) {
- ObjectHelper.notNull(config, "config");
- this.config = config;
- }
-
- @Override
- public String getPassphrase() {
- LOG.info("Private Key authentication not supported");
- return null;
- }
- @Override
- public String getPassword() {
- LOG.debug("Providing password for ssh authentication of user '{}'", config.getUsername());
- return config.getPassword();
- }
- @Override
- public boolean promptPassword(String message) {
- LOG.debug(message);
- return true;
- }
- @Override
- public boolean promptPassphrase(String message) {
- LOG.debug(message);
- return true;
- }
- @Override
- public boolean promptYesNo(String message) {
- LOG.debug(message);
- return false;
- }
- @Override
- public void showMessage(String message) {
- LOG.debug(message);
- }
-
- @Override
- public String[] promptKeyboardInteractive(String destination, String name,
- String instruction, String[] prompt, boolean[] echo) {
- LOG.debug(instruction);
- // Called for either SSH_MSG_USERAUTH_INFO_REQUEST or SSH_MSG_USERAUTH_PASSWD_CHANGEREQ
- // The most secure choice (especially for the second case) is to return null
- return null;
- }
- }
-}
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpProcessStrategyFactory.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpProcessStrategyFactory.java
deleted file mode 100644
index 64445d6..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpProcessStrategyFactory.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
-import org.apache.camel.component.file.GenericFileProcessStrategy;
-import org.apache.camel.component.file.strategy.GenericFileNoOpProcessStrategy;
-
-public final class ScpProcessStrategyFactory {
-
- private ScpProcessStrategyFactory() {
- }
-
- @SuppressWarnings("unchecked")
- public static <LsEntry> GenericFileProcessStrategy<LsEntry> createGenericFileProcessStrategy(CamelContext context, Map<String, Object> params) {
-
- /*
- // We assume a value is present only if its value not null for String and 'true' for boolean
- Expression moveExpression = (Expression) params.get("move");
- Expression moveFailedExpression = (Expression) params.get("moveFailed");
- Expression preMoveExpression = (Expression) params.get("preMove");
- boolean isNoop = params.get("noop") != null;
- boolean isDelete = params.get("delete") != null;
- boolean isMove = moveExpression != null || preMoveExpression != null || moveFailedExpression != null;
- */
-
- // default strategy will do nothing
- GenericFileNoOpProcessStrategy<LsEntry> strategy = new GenericFileNoOpProcessStrategy<LsEntry>();
- strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<LsEntry>) getExclusiveReadLockStrategy(params));
- return strategy;
- }
-
- @SuppressWarnings({"unchecked"})
- private static <LsEntry> GenericFileExclusiveReadLockStrategy<LsEntry> getExclusiveReadLockStrategy(Map<String, Object> params) {
- GenericFileExclusiveReadLockStrategy<LsEntry> strategy = (GenericFileExclusiveReadLockStrategy<LsEntry>) params.get("exclusiveReadLockStrategy");
- if (strategy != null) {
- return strategy;
- }
-/*
- // no explicit strategy set then fallback to readLock option
- String readLock = (String) params.get("readLock");
- if (ObjectHelper.isNotEmpty(readLock)) {
- if ("none".equals(readLock) || "false".equals(readLock)) {
- return null;
- } else if ("rename".equals(readLock)) {
- GenericFileRenameExclusiveReadLockStrategy<LsEntry> readLockStrategy = new GenericFileRenameExclusiveReadLockStrategy<LsEntry>();
- Long timeout = (Long) params.get("readLockTimeout");
- if (timeout != null) {
- readLockStrategy.setTimeout(timeout);
- }
- return readLockStrategy;
- } else if ("changed".equals(readLock)) {
- GenericFileExclusiveReadLockStrategy readLockStrategy = new SftpChangedExclusiveReadLockStrategy();
- Long timeout = (Long) params.get("readLockTimeout");
- if (timeout != null) {
- readLockStrategy.setTimeout(timeout);
- }
- Long checkInterval = (Long) params.get("readLockCheckInterval");
- if (checkInterval != null) {
- readLockStrategy.setCheckInterval(checkInterval);
- }
- return readLockStrategy;
- }
- }
-*/
- return null;
- }
-}
diff --git a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpProducer.java b/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpProducer.java
deleted file mode 100644
index 4a34f6c..0000000
--- a/components/camel-jsch/src/main/java/org/apache/camel/component/jsch/ScpProducer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import org.apache.camel.component.file.remote.RemoteFileEndpoint;
-import org.apache.camel.component.file.remote.RemoteFileOperations;
-import org.apache.camel.component.file.remote.RemoteFileProducer;
-
-public class ScpProducer extends RemoteFileProducer<ScpFile> {
-
- protected ScpProducer(RemoteFileEndpoint<ScpFile> endpoint, RemoteFileOperations<ScpFile> operations) {
- super(endpoint, operations);
- }
-}
diff --git a/components/camel-jsch/src/main/resources/META-INF/services/org/apache/camel/component/scp b/components/camel-jsch/src/main/resources/META-INF/services/org/apache/camel/component/scp
deleted file mode 100644
index 52e6f95..0000000
--- a/components/camel-jsch/src/main/resources/META-INF/services/org/apache/camel/component/scp
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.component.jsch.JschComponent
-strategy.factory.class=org.apache.camel.component.jsch.ScpProcessStrategyFactory
diff --git a/components/camel-jsch/src/main/resources/log4j.properties b/components/camel-jsch/src/main/resources/log4j.properties
deleted file mode 100644
index 4621723..0000000
--- a/components/camel-jsch/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#
-# The logging properties used
-#
-log4j.rootLogger=INFO, out
-
-# uncomment the following line to turn on Camel debugging
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file
diff --git a/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java b/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java
deleted file mode 100644
index 34aa27c..0000000
--- a/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpServerTestSupport.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import java.io.File;
-import java.io.IOException;
-import java.security.Provider;
-import java.security.Provider.Service;
-import java.security.Security;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UserInfo;
-
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.FileUtil;
-import org.apache.sshd.SshServer;
-import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.apache.sshd.server.command.ScpCommandFactory;
-import org.apache.sshd.server.session.ServerSession;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @version
- */
-public abstract class ScpServerTestSupport extends CamelTestSupport {
- protected static final Logger LOG = LoggerFactory.getLogger(ScpServerTestSupport.class);
- protected static final String SCP_ROOT_DIR = "target/scp";
- protected static final String KNOWN_HOSTS = "known_hosts";
- protected static int port;
-
- private boolean acceptLocalhostConnections = true;
- private String knownHostsFile;
-
- private boolean setupComplete;
- private SshServer sshd;
-
- protected ScpServerTestSupport() {
- this(true);
- }
-
- protected ScpServerTestSupport(boolean acceptLocalhostConnections) {
- this.acceptLocalhostConnections = acceptLocalhostConnections;
- }
-
- protected int getPort() {
- return port;
- }
-
- protected SshServer getSshd() {
- return sshd;
- }
-
- @BeforeClass
- public static void initPort() throws Exception {
- port = AvailablePortFinder.getNextAvailable(21000);
- }
-
- @Override
- @Before
- public void setUp() throws Exception {
- File root = new File(getScpPath());
- root.mkdirs(); // implicitly create sshd home dir
-
- setupComplete = startSshd();
- setupKnownHosts();
- super.setUp();
- }
-
- @Override
- @After
- public void tearDown() throws Exception {
- super.tearDown();
-
- if (sshd != null) {
- try {
- sshd.stop();
- sshd = null;
- } catch (Exception e) {
- // ignore while shutting down as we could be polling during shutdown
- // and get errors when the ssh server is stopping.
- }
- }
- FileUtil.deleteFile(new File(knownHostsFile));
- }
-
- protected final String getScpPath() {
- // use this convention and use separate directories for tests
- // (easier to debug and avoid interference)
- return SCP_ROOT_DIR + "/" + getClass().getSimpleName();
- }
-
- protected String getScpUri() {
- return "scp://localhost:" + getPort() + "/" + getScpPath();
- }
-
-
- protected boolean startSshd() {
- sshd = SshServer.setUpDefaultServer();
- sshd.setPort(getPort());
- sshd.setKeyPairProvider(new FileKeyPairProvider(new String[]{"src/test/resources/hostkey.pem"}));
- sshd.setCommandFactory(new ScpCommandFactory());
- sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
- @Override
- public boolean authenticate(String username, String password, ServerSession session) {
- // dummy authentication: allow any user whose password is the same as the username
- return username != null && username.equals(password);
- }
- });
-
- try {
- sshd.start();
- return true;
- } catch (IOException e) {
- LOG.info("Failed to start ssh server.", e);
- }
- return false;
- }
-
- protected void setupKnownHosts() {
- knownHostsFile = SCP_ROOT_DIR + "/" + KNOWN_HOSTS + "-" + getPort();
- FileUtil.deleteFile(new File(knownHostsFile));
- if (!acceptLocalhostConnections) {
- return;
- }
-
- // For security reasons (avoiding man in the middle attacks),
- // camel-jsch will only connect to known hosts. For unit testing
- // we use a known key, but since the port it dynamic, the
- // known_hosts file will be generated by the following code and
- // should should contain a line like below (if
- // "HashKnownHosts"=="yes" the hostname:port part will be
- // hashed and look a bit more complicated).
- //
- // [localhost]:21000 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDd \
- // fIWeSV4o68dRrKSzFd/Bk51E65UTmmSrmW0O1ohtzi6HzsDPjXgCtlTt3F \
- // qTcfFfI92IlTr4JWqC9UK1QT1ZTeng0MkPQmv68hDANHbt5CpETZHjW5q4 \
- // OOgWhVvj5IyOC2NZHtKlJBkdsMAa15ouOOJLzBvAvbqOR/yUROsEiQ==
-
- JSch jsch = new JSch();
- try {
- LOG.debug("Using '{}' for known hosts.", knownHostsFile);
- jsch.setKnownHosts(knownHostsFile);
- Session s = jsch.getSession("admin", "localhost", getPort());
- s.setConfig("StrictHostKeyChecking", "ask");
- s.setConfig("HashKnownHosts", "yes");
- s.setUserInfo(new UserInfo() {
- @Override
- public String getPassphrase() {
- return null;
- }
- @Override
- public String getPassword() {
- return "admin";
- }
- @Override
- public boolean promptPassword(String message) {
- return true;
- }
- @Override
- public boolean promptPassphrase(String message) {
- return false;
- }
- @Override
- public boolean promptYesNo(String message) {
- // accept host authenticity
- return true;
- }
- @Override
- public void showMessage(String message) {
- }
- });
- // in the process of connecting, "[localhost]:<port>" is added to the knownHostsFile
- s.connect();
- s.disconnect();
- } catch (JSchException e) {
- LOG.info("Could not add [localhost] to known hosts", e);
- }
- }
-
- public String getKnownHostsFile() {
- return knownHostsFile;
- }
-
- public boolean isSetupComplete() {
- return setupComplete;
- }
-
- protected static void traceSecurityProviders() {
- for (Provider p : Security.getProviders()) {
- for (Service s : p.getServices()) {
- LOG.trace("Security provider {} for '{}' algorithm", s.getClassName(), s.getAlgorithm());
- }
- }
- }
-}
diff --git a/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java b/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java
deleted file mode 100644
index eca8ef8..0000000
--- a/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.jsch;
-
-import java.io.File;
-
-import org.apache.camel.Exchange;
-import org.junit.Assume;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @version
- */
-public class ScpSimpleProduceTest extends ScpServerTestSupport {
- @Override
- public boolean isUseRouteBuilder() {
- return false;
- }
-
- @Test
- public void testScpSimpleProduce() throws Exception {
- Assume.assumeTrue(this.isSetupComplete());
-
- String uri = getScpUri() + "?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
- template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME, "hello.txt");
-
- File file = new File(getScpPath() + "/hello.txt").getAbsoluteFile();
- assertTrue("File should exist: " + file, file.exists());
- assertEquals("Hello World", context.getTypeConverter().convertTo(String.class, file));
- }
-
- @Test
- public void testScpSimpleSubPathProduce() throws Exception {
- Assume.assumeTrue(this.isSetupComplete());
-
- String uri = getScpUri() + "?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
- template.sendBodyAndHeader(uri, "Bye World", Exchange.FILE_NAME, "mysub/bye.txt");
-
- File file = new File(getScpPath() + "/mysub/bye.txt").getAbsoluteFile();
- assertTrue("File should exist: " + file, file.exists());
- assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));
- }
-
- @Test
- public void testScpSimpleTwoSubPathProduce() throws Exception {
- Assume.assumeTrue(this.isSetupComplete());
-
- String uri = getScpUri() + "?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
- template.sendBodyAndHeader(uri, "Farewell World", Exchange.FILE_NAME, "mysub/mysubsub/farewell.txt");
-
- File file = new File(getScpPath() + "/mysub/mysubsub/farewell.txt").getAbsoluteFile();
- assertTrue("File should exist: " + file, file.exists());
- assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));
- }
-}
diff --git a/components/camel-jsch/src/test/resources/hostkey.pem b/components/camel-jsch/src/test/resources/hostkey.pem
deleted file mode 100644
index 9b215f4..0000000
--- a/components/camel-jsch/src/test/resources/hostkey.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDdfIWeSV4o68dRrKSzFd/Bk51E65UTmmSrmW0O1ohtzi6HzsDP
-jXgCtlTt3FqTcfFfI92IlTr4JWqC9UK1QT1ZTeng0MkPQmv68hDANHbt5CpETZHj
-W5q4OOgWhVvj5IyOC2NZHtKlJBkdsMAa15ouOOJLzBvAvbqOR/yUROsEiQIDAQAB
-AoGBANG3JDW6NoP8rF/zXoeLgLCj+tfVUPSczhGFVrQkAk4mWfyRkhN0WlwHFOec
-K89MpkV1ij/XPVzU4MNbQ2yod1KiDylzvweYv+EaEhASCmYNs6LS03punml42SL9
-97tOmWfVJXxlQoLiY6jHPU97vTc65k8gL+gmmrpchsW0aqmZAkEA/c8zfmKvY37T
-cxcLLwzwsqqH7g2KZGTf9aRmx2ebdW+QKviJJhbdluDgl1TNNFj5vCLznFDRHiqJ
-wq0wkZ39cwJBAN9l5v3kdXj21UrurNPdlV0n2GZBt2vblooQC37XHF97r2zM7Ou+
-Lg6MyfJClyguhWL9dxnGbf3btQ0l3KDstxMCQCRaiEqjAfIjWVATzeNIXDWLHXso
-b1kf5cA+cwY+vdKdTy4IeUR+Y/DXdvPWDqpf0C11aCVMohdLCn5a5ikFUycCQDhV
-K/BuAallJNfmY7JxN87r00fF3ojWMJnT/fIYMFFrkQrwifXQWTDWE76BSDibsosJ
-u1TGksnm8zrDh2UVC/0CQFrHTiSl/3DHvWAbOJawGKg46cnlDcAhSyV8Frs8/dlP
-7YGG3eqkw++lsghqmFO6mRUTKsBmiiB2wgLGhL5pyYY=
------END RSA PRIVATE KEY-----
\ No newline at end of file
diff --git a/components/camel-jsch/src/test/resources/log4j.properties b/components/camel-jsch/src/test/resources/log4j.properties
deleted file mode 100644
index 2937d72..0000000
--- a/components/camel-jsch/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used for eclipse testing, We want to see debug output on the console.
-#
-log4j.rootLogger=INFO, file
-
-# uncomment the following to enable camel debugging
-# log4j.logger.org.apache.camel=DEBUG
-# log4j.logger.org.apache.camel.component.jsch=TRACE
-# log4j.logger.org.apache.sshd=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-jsch-test.log
\ No newline at end of file
diff --git a/components/camel-jt400/pom.xml b/components/camel-jt400/pom.xml
index 901cabc..055cbb0 100644
--- a/components/camel-jt400/pom.xml
+++ b/components/camel-jt400/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
<artifactId>camel-jt400</artifactId>
diff --git a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
index baa1323..9f70ef3 100644
--- a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
+++ b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueConsumer.java
@@ -16,18 +16,22 @@
*/
package org.apache.camel.component.jt400;
+import java.io.IOException;
import com.ibm.as400.access.AS400;
-import com.ibm.as400.access.BaseDataQueue;
+import com.ibm.as400.access.AS400SecurityException;
import com.ibm.as400.access.DataQueue;
import com.ibm.as400.access.DataQueueEntry;
-import com.ibm.as400.access.KeyedDataQueue;
-import com.ibm.as400.access.KeyedDataQueueEntry;
+import com.ibm.as400.access.ErrorCompletingRequestException;
+import com.ibm.as400.access.IllegalObjectTypeException;
+import com.ibm.as400.access.ObjectDoesNotExistException;
+
import org.apache.camel.Exchange;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.component.jt400.Jt400DataQueueEndpoint.Format;
import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.impl.PollingConsumerSupport;
+
/**
* {@link org.apache.camel.PollingConsumer} that polls a data queue for data
*/
@@ -75,79 +79,46 @@
* <code>byte[]</code>. If the endpoint's format is set to
* {@link Format#text}, the data queue entry's data will be received/sent as
* a <code>String</code>.
- * <p/>
- * The following message headers may be set by the receiver
- * <ul>
- * <li>SENDER_INFORMATION: The Sender Information from the Data Queue</li>
- * <li>KEY: The message key if the endpoint is configured to connect to a <code>KeyedDataQueue</code></li>
- * </ul>
*
* @param timeout time to wait when reading from data queue. A value of -1
- * indicates a blocking read.
+ * indicates a blocking read.
*/
public Exchange receive(long timeout) {
- BaseDataQueue queue = endpoint.getDataQueue();
+ DataQueue queue = endpoint.getDataQueue();
try {
- if (endpoint.isKeyed()) {
- return receive((KeyedDataQueue) queue, timeout);
+ DataQueueEntry entry;
+ if (timeout >= 0) {
+ int seconds = (int)timeout / 1000;
+ log.trace("Reading from data queue: {} with {} seconds timeout", queue.getName(), seconds);
+ entry = queue.read(seconds);
} else {
- return receive((DataQueue) queue, timeout);
+ log.trace("Reading from data queue: {} with no timeout", queue.getName());
+ entry = queue.read(-1);
}
- } catch (Exception e) {
+
+ Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
+ if (entry != null) {
+ if (endpoint.getFormat() == Format.binary) {
+ exchange.getIn().setBody(entry.getData());
+ } else {
+ exchange.getIn().setBody(entry.getString());
+ }
+ return exchange;
+ }
+ } catch (AS400SecurityException e) {
+ throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
+ } catch (ErrorCompletingRequestException e) {
+ throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
+ } catch (IOException e) {
+ throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
+ } catch (IllegalObjectTypeException e) {
+ throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
+ } catch (InterruptedException e) {
+ throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
+ } catch (ObjectDoesNotExistException e) {
throw new RuntimeCamelException("Unable to read from data queue: " + queue.getName(), e);
}
- }
-
- private Exchange receive(DataQueue queue, long timeout) throws Exception {
- DataQueueEntry entry;
- if (timeout >= 0) {
- int seconds = (int) timeout / 1000;
- log.trace("Reading from data queue: {} with {} seconds timeout", queue.getName(), seconds);
- entry = queue.read(seconds);
- } else {
- log.trace("Reading from data queue: {} with no timeout", queue.getName());
- entry = queue.read(-1);
- }
-
- Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
- if (entry != null) {
- exchange.getIn().setHeader(Jt400DataQueueEndpoint.SENDER_INFORMATION, entry.getSenderInformation());
- if (endpoint.getFormat() == Format.binary) {
- exchange.getIn().setBody(entry.getData());
- } else {
- exchange.getIn().setBody(entry.getString());
- }
- return exchange;
- }
return null;
}
- private Exchange receive(KeyedDataQueue queue, long timeout) throws Exception {
- String key = endpoint.getSearchKey();
- String searchType = endpoint.getSearchType().name();
- KeyedDataQueueEntry entry;
- if (timeout >= 0) {
- int seconds = (int) timeout / 1000;
- log.trace("Reading from data queue: {} with {} seconds timeout", queue.getName(), seconds);
- entry = queue.read(key, seconds, searchType);
- } else {
- log.trace("Reading from data queue: {} with no timeout", queue.getName());
- entry = queue.read(key, -1, searchType);
- }
-
- Exchange exchange = new DefaultExchange(endpoint.getCamelContext());
- if (entry != null) {
- exchange.getIn().setHeader(Jt400DataQueueEndpoint.SENDER_INFORMATION, entry.getSenderInformation());
- if (endpoint.getFormat() == Format.binary) {
- exchange.getIn().setBody(entry.getData());
- exchange.getIn().setHeader(Jt400DataQueueEndpoint.KEY, entry.getKey());
- } else {
- exchange.getIn().setBody(entry.getString());
- exchange.getIn().setHeader(Jt400DataQueueEndpoint.KEY, entry.getKeyString());
- }
-
- return exchange;
- }
- return null;
- }
}
diff --git a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
index 5cc6bd8..cb339a5 100644
--- a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
+++ b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueEndpoint.java
@@ -21,9 +21,8 @@
import java.net.URISyntaxException;
import com.ibm.as400.access.AS400;
-import com.ibm.as400.access.BaseDataQueue;
import com.ibm.as400.access.DataQueue;
-import com.ibm.as400.access.KeyedDataQueue;
+
import org.apache.camel.CamelException;
import org.apache.camel.PollingConsumer;
import org.apache.camel.Producer;
@@ -36,16 +35,6 @@
*/
public class Jt400DataQueueEndpoint extends DefaultPollingEndpoint {
- public static final String KEY = "KEY";
- public static final String SENDER_INFORMATION = "SENDER_INFORMATION";
-
- /**
- * SearchTypes for reading from Keyed Data Queues
- */
- public enum SearchType {
- EQ, NE, LT, LE, GT, GE;
- }
-
/**
* Enumeration of supported data formats
*/
@@ -60,16 +49,13 @@
*/
binary;
}
-
+
private static final transient Logger LOG = LoggerFactory.getLogger(Jt400DataQueueEndpoint.class);
private final AS400 system;
private final String objectPath;
- private BaseDataQueue dataQueue;
+ private DataQueue dataqueue;
private Format format = Format.text;
- private boolean keyed;
- private String searchKey;
- private SearchType searchType = SearchType.EQ;
/**
* Creates a new AS/400 data queue endpoint
@@ -88,7 +74,7 @@
try {
system.setGuiAvailable(false);
} catch (PropertyVetoException e) {
- LOG.warn("Failed to disable AS/400 prompting in the environment running Camel. This exception will be ignored.", e);
+ LOG.warn("Failed do disable AS/400 prompting in the environment running Camel.", e);
}
}
@@ -104,30 +90,6 @@
return format;
}
- public void setKeyed(boolean keyed) {
- this.keyed = keyed;
- }
-
- public boolean isKeyed() {
- return keyed;
- }
-
- public void setSearchKey(String searchKey) {
- this.searchKey = searchKey;
- }
-
- public String getSearchKey() {
- return searchKey;
- }
-
- public void setSearchType(SearchType searchType) {
- this.searchType = searchType;
- }
-
- public SearchType getSearchType() {
- return searchType;
- }
-
public void setGuiAvailable(boolean guiAvailable) throws PropertyVetoException {
this.system.setGuiAvailable(guiAvailable);
}
@@ -137,7 +99,6 @@
return new Jt400DataQueueConsumer(this);
}
- @Override
public Producer createProducer() throws Exception {
return new Jt400DataQueueProducer(this);
}
@@ -146,11 +107,11 @@
return system;
}
- protected BaseDataQueue getDataQueue() {
- if (dataQueue == null) {
- dataQueue = keyed ? new KeyedDataQueue(system, objectPath) : new DataQueue(system, objectPath);
+ protected DataQueue getDataQueue() {
+ if (dataqueue == null) {
+ dataqueue = new DataQueue(system, objectPath);
}
- return dataQueue;
+ return dataqueue;
}
public boolean isSingleton() {
diff --git a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueProducer.java b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueProducer.java
index e37f4b2..87b83ef 100644
--- a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueProducer.java
+++ b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400DataQueueProducer.java
@@ -17,9 +17,7 @@
package org.apache.camel.component.jt400;
import com.ibm.as400.access.AS400;
-import com.ibm.as400.access.BaseDataQueue;
import com.ibm.as400.access.DataQueue;
-import com.ibm.as400.access.KeyedDataQueue;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
import org.apache.camel.component.jt400.Jt400DataQueueEndpoint.Format;
@@ -43,20 +41,9 @@
* data will be sent as a <code>byte[]</code>. If the endpoint's format is
* set to {@link Format#text}, the data queue entry's data will be sent as a
* <code>String</code>.
- * <p/>
- * If the endpoint is configured to publish to a {@link KeyedDataQueue},
- * then the {@link org.apache.camel.Message} header <code>KEY</code> must be set.
*/
public void process(Exchange exchange) throws Exception {
- BaseDataQueue queue = endpoint.getDataQueue();
- if (endpoint.isKeyed()) {
- process((KeyedDataQueue) queue, exchange);
- } else {
- process((DataQueue) queue, exchange);
- }
- }
-
- private void process(DataQueue queue, Exchange exchange) throws Exception {
+ DataQueue queue = endpoint.getDataQueue();
if (endpoint.getFormat() == Format.binary) {
queue.write(exchange.getIn().getBody(byte[].class));
} else {
@@ -64,14 +51,6 @@
}
}
- private void process(KeyedDataQueue queue, Exchange exchange) throws Exception {
- if (endpoint.getFormat() == Format.binary) {
- queue.write(exchange.getIn().getHeader(Jt400DataQueueEndpoint.KEY, byte[].class), exchange.getIn().getBody(byte[].class));
- } else {
- queue.write(exchange.getIn().getHeader(Jt400DataQueueEndpoint.KEY, String.class), exchange.getIn().getBody(String.class));
- }
- }
-
@Override
protected void doStart() throws Exception {
if (!endpoint.getSystem().isConnected()) {
diff --git a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400PgmEndpoint.java b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400PgmEndpoint.java
index c47507c..2a4dd5d 100644
--- a/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400PgmEndpoint.java
+++ b/components/camel-jt400/src/main/java/org/apache/camel/component/jt400/Jt400PgmEndpoint.java
@@ -65,7 +65,6 @@
}
}
- @SuppressWarnings("deprecation")
public Jt400PgmEndpoint(String endpointUri, String programToExecute, Map<String, Object> parameters,
CamelContext camelContext) {
super(endpointUri, camelContext);
diff --git a/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400ComponentTest.java b/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400ComponentTest.java
index 64df79b..67fd779 100644
--- a/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400ComponentTest.java
+++ b/components/camel-jt400/src/test/java/org/apache/camel/component/jt400/Jt400ComponentTest.java
@@ -27,6 +27,7 @@
/**
* Test case for {@link Jt400Component}
*/
+@SuppressWarnings("unchecked")
public class Jt400ComponentTest extends Assert {
private Jt400Component component;
@@ -43,7 +44,7 @@
public void testCreateDatqEndpoint() throws Exception {
Endpoint endpoint = component
.createEndpoint("jt400://user:password@host/qsys.lib/library.lib/queue.dtaq",
- "/user:password@host/qsys.lib/library.lib/queue.dtaq", new HashMap<String, Object>());
+ "/user:password@host/qsys.lib/library.lib/queue.dtaq", new HashMap());
assertNotNull(endpoint);
assertTrue(endpoint instanceof Jt400DataQueueEndpoint);
}
@@ -55,7 +56,7 @@
public void testCreatePgmEndpoint() throws Exception {
Endpoint endpoint = component
.createEndpoint("jt400://user:password@host/qsys.lib/library.lib/queue.pgm",
- "/user:password@host/qsys.lib/library.lib/queue.pgm", new HashMap<String, Object>());
+ "/user:password@host/qsys.lib/library.lib/queue.pgm", new HashMap());
assertNotNull(endpoint);
assertTrue(endpoint instanceof Jt400PgmEndpoint);
}
@@ -67,7 +68,7 @@
public void testCreateEndpointForOtherObjectType() throws Exception {
try {
component.createEndpoint("jt400://user:password@host/qsys.lib/library.lib/program.xxx",
- "/user:password@host/qsys.lib/library.lib/program.xxx", new HashMap<String, Object>());
+ "/user:password@host/qsys.lib/library.lib/program.xxx", new HashMap());
fail("Exception should been thrown when trying to create an endpoint for an unsupported object type");
} catch (CamelException e) {
// this is just what we expected
diff --git a/components/camel-juel/pom.xml b/components/camel-juel/pom.xml
index 04b089f..ea47bda 100644
--- a/components/camel-juel/pom.xml
+++ b/components/camel-juel/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-jxpath/pom.xml b/components/camel-jxpath/pom.xml
index 23c4169..4ef7ef5 100644
--- a/components/camel-jxpath/pom.xml
+++ b/components/camel-jxpath/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -50,7 +50,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-kestrel/pom.xml b/components/camel-kestrel/pom.xml
index c44ef43..9272891 100644
--- a/components/camel-kestrel/pom.xml
+++ b/components/camel-kestrel/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -64,7 +64,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelComponent.java b/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelComponent.java
index c5b2b1d..e1e2750 100644
--- a/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelComponent.java
+++ b/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelComponent.java
@@ -80,7 +80,8 @@
this.configuration = configuration;
}
- protected KestrelEndpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ @SuppressWarnings("unchecked")
+ protected KestrelEndpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
// Copy the configuration as each endpoint can override defaults
KestrelConfiguration config = getConfiguration().copy();
diff --git a/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java b/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
index e45e829..4beebf5 100644
--- a/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
+++ b/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java
@@ -36,7 +36,7 @@
public class KestrelConsumer extends DefaultConsumer implements ShutdownAware {
private final KestrelEndpoint endpoint;
private final MemcachedClient memcachedClient;
- private final BlockingQueue<Exchanger<?>> exchangerQueue = new LinkedBlockingQueue<Exchanger<?>>();
+ private final BlockingQueue<Exchanger> exchangerQueue = new LinkedBlockingQueue<Exchanger>();
private ExecutorService pollerExecutor;
private ExecutorService handlerExecutor;
private volatile boolean shutdownPending;
@@ -103,8 +103,7 @@
return pendingExchangeCount.get();
}
- @Override
- public void prepareShutdown(boolean forced) {
+ public void prepareShutdown() {
// Signal to our threads that shutdown is happening
shutdownPending = true;
@@ -153,7 +152,6 @@
target = endpoint.getQueue();
}
- @SuppressWarnings("rawtypes")
Exchanger exchanger = null;
while (isRunAllowed() && !shutdownPending) {
if (concurrent) {
@@ -248,8 +246,9 @@
}
}
+ @SuppressWarnings("unchecked")
private final class Handler implements Runnable {
- private Exchanger<Handler> exchanger = new Exchanger<Handler>();
+ private Exchanger exchanger = new Exchanger();
public void run() {
if (log.isTraceEnabled()) {
diff --git a/components/camel-krati/pom.xml b/components/camel-krati/pom.xml
index d6b045e..bee57c0 100644
--- a/components/camel-krati/pom.xml
+++ b/components/camel-krati/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -50,7 +50,7 @@
<!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<!-- logging -->
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiConsumer.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiConsumer.java
index 92f45f3..1bcaf19 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiConsumer.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiConsumer.java
@@ -19,11 +19,13 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
-
import krati.store.DataStore;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
@@ -34,15 +36,18 @@
/**
* The Krati consumer.
*/
-public class KratiConsumer extends ScheduledBatchPollingConsumer {
+public class KratiConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
private static final transient Logger LOG = LoggerFactory.getLogger(KratiConsumer.class);
protected final KratiEndpoint endpoint;
- protected DataStore<Object, Object> dataStore;
+ protected DataStore dataStore;
protected int maxMessagesPerPoll = 10;
- public KratiConsumer(KratiEndpoint endpoint, Processor processor, DataStore<Object, Object> dataStore) {
+ protected volatile ShutdownRunningTask shutdownRunningTask;
+ protected volatile int pendingExchanges;
+
+ public KratiConsumer(KratiEndpoint endpoint, Processor processor, DataStore dataStore) {
super(endpoint, processor);
this.endpoint = endpoint;
this.dataStore = dataStore;
@@ -55,7 +60,7 @@
Queue<Exchange> queue = new LinkedList<Exchange>();
- Iterator<Object> keyIterator = dataStore.keyIterator();
+ Iterator keyIterator = dataStore.keyIterator();
while (keyIterator.hasNext()) {
Object key = keyIterator.next();
Object value = dataStore.get(key);
@@ -67,6 +72,21 @@
return queue.isEmpty() ? 0 : processBatch(CastUtils.cast(queue));
}
+ /**
+ * Sets a maximum number of messages as a limit to poll at each polling.
+ * <p/>
+ * Can be used to limit eg to 100 to avoid when starting and there are millions
+ * of messages for you in the first poll.
+ * <p/>
+ * Default value is 10.
+ *
+ * @param maxMessagesPerPoll maximum messages to poll.
+ */
+ @Override
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
+
@Override
public int processBatch(Queue<Object> exchanges) throws Exception {
int total = exchanges.size();
@@ -103,4 +123,55 @@
return total;
}
+
+ @Override
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
+ @Override
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ @Override
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ @Override
+ public void prepareShutdown() {
+ }
}
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiDataStoreRegistration.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiDataStoreRegistration.java
index 048f525..f2aa627 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiDataStoreRegistration.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiDataStoreRegistration.java
@@ -26,10 +26,10 @@
private static final transient Logger LOG = LoggerFactory.getLogger(KratiDataStoreRegistration.class);
- private final DataStore<Object, Object> dataStore;
+ private final DataStore dataStore;
private int registrationCount;
- public KratiDataStoreRegistration(DataStore<Object, Object> dataStore) {
+ public KratiDataStoreRegistration(DataStore dataStore) {
this.dataStore = dataStore;
}
@@ -50,7 +50,7 @@
}
}
- public DataStore<Object, Object> getDataStore() {
+ public DataStore getDataStore() {
register();
return dataStore;
}
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiEndpoint.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiEndpoint.java
index b419445..76f1bb2 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiEndpoint.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiEndpoint.java
@@ -45,12 +45,10 @@
protected int initialCapacity = 100;
protected int segmentFileSize = 64;
- @SuppressWarnings({"unchecked", "rawtypes"})
- protected Serializer<Object> keySerializer = new KratiDefaultSerializer();
- @SuppressWarnings({"unchecked", "rawtypes"})
- protected Serializer<Object> valueSerializer = new KratiDefaultSerializer();
+ protected Serializer keySerializer = new KratiDefaultSerializer();
+ protected Serializer valueSerializer = new KratiDefaultSerializer();
protected SegmentFactory segmentFactory = new ChannelSegmentFactory();
- protected HashFunction<byte[]> hashFunction = new FnvHashFunction();
+ protected HashFunction hashFunction = new FnvHashFunction();
protected String path;
@@ -59,6 +57,11 @@
this.path = getPath(uri);
}
+ public KratiEndpoint(String endpointUri) throws URISyntaxException {
+ super(endpointUri);
+ this.path = getPath(endpointUri);
+ }
+
@Override
public void stop() throws Exception {
super.stop();
@@ -69,20 +72,20 @@
}
public Producer createProducer() throws Exception {
- DataStore<Object, Object> dataStore = null;
+ DataStore dataStore = null;
KratiDataStoreRegistration registration = dataStoreRegistry.get(path);
if (registration != null) {
dataStore = registration.getDataStore();
}
if (dataStore == null || !dataStore.isOpen()) {
- dataStore = KratiHelper.<Object, Object>createDataStore(path, initialCapacity, segmentFileSize, segmentFactory, hashFunction, keySerializer, valueSerializer);
+ dataStore = KratiHelper.createDataStore(path, initialCapacity, segmentFileSize, segmentFactory, hashFunction, keySerializer, valueSerializer);
dataStoreRegistry.put(path, new KratiDataStoreRegistration(dataStore));
}
return new KratiProducer(this, dataStore);
}
public Consumer createConsumer(Processor processor) throws Exception {
- DataStore<Object, Object> dataStore = null;
+ DataStore dataStore = null;
KratiDataStoreRegistration registration = dataStoreRegistry.get(path);
if (registration != null) {
dataStore = registration.getDataStore();
@@ -165,11 +168,11 @@
this.segmentFactory = segmentFactory;
}
- public HashFunction<byte[]> getHashFunction() {
+ public HashFunction getHashFunction() {
return hashFunction;
}
- public void setHashFunction(HashFunction<byte[]> hashFunction) {
+ public void setHashFunction(HashFunction hashFunction) {
this.hashFunction = hashFunction;
}
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiHelper.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiHelper.java
index 18ca295..9ce0a1f 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiHelper.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiHelper.java
@@ -29,9 +29,13 @@
import krati.util.HashFunction;
import org.apache.camel.RuntimeCamelException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public final class KratiHelper {
+ private static final transient Logger LOG = LoggerFactory.getLogger(KratiHelper.class);
+
private KratiHelper() {
//Utillity Class
}
@@ -48,9 +52,9 @@
* @param valueSerializer The serializer used for values,defaults to {@link org.apache.camel.component.krati.serializer.KratiDefaultSerializer}.
* @return
*/
- public static <K, V> DataStore<K, V> createDataStore(String path, int initialCapacity, int segmentFileSize, SegmentFactory segmentFactory,
- HashFunction<byte[]> hashFunction, Serializer<K> keySerializer, Serializer<V> valueSerializer) {
- DataStore<K, V> result = null;
+ public static DataStore createDataStore(String path, int initialCapacity, int segmentFileSize, SegmentFactory segmentFactory,
+ HashFunction hashFunction, Serializer keySerializer, Serializer valueSerializer) {
+ DataStore result = null;
File homeDir = new File(path);
homeDir.mkdirs();
try {
@@ -58,8 +62,8 @@
storeConfig.setSegmentFactory(segmentFactory);
storeConfig.setHashFunction(hashFunction);
storeConfig.setSegmentFileSizeMB(segmentFileSize);
- DataStore<byte[], byte[]> dynamicDataStore = new DynamicDataStore(storeConfig);
- result = new SerializableObjectStore<K, V>(dynamicDataStore, keySerializer, valueSerializer);
+ DataStore dynamicDataStore = new DynamicDataStore(storeConfig);
+ result = new SerializableObjectStore(dynamicDataStore, keySerializer, valueSerializer);
} catch (Exception e) {
throw new RuntimeCamelException("Failed to create Krati DataStore.", e);
}
@@ -75,8 +79,8 @@
* @param segmentFactory The segment factory, defaults to {@link krati.core.segment.ChannelSegmentFactory}.
* @return
*/
- public static DataSet<byte[]> createDataSet(String path, int initialCapacity, SegmentFactory segmentFactory) {
- DataSet<byte[]> result = null;
+ public static DataSet createDataSet(String path, int initialCapacity, SegmentFactory segmentFactory) {
+ DataSet result = null;
File homeDir = new File(path);
homeDir.mkdirs();
try {
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java
index 68db6cf..5524a9d 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/KratiProducer.java
@@ -29,9 +29,9 @@
private static final transient Logger LOG = LoggerFactory.getLogger(KratiProducer.class);
protected KratiEndpoint endpoint;
- protected DataStore<Object, Object> dataStore;
+ protected DataStore dataStore;
- public KratiProducer(KratiEndpoint endpoint, DataStore<Object, Object> dataStore) {
+ public KratiProducer(KratiEndpoint endpoint, DataStore dataStore) {
super(endpoint);
this.endpoint = endpoint;
this.dataStore = dataStore;
@@ -113,7 +113,7 @@
Object value = ((KratiEndpoint) getEndpoint()).getValue();
if (exchange.getIn().getHeader(KratiConstants.VALUE) != null) {
- value = exchange.getIn().getHeader(KratiConstants.VALUE);
+ value = (String) exchange.getIn().getHeader(KratiConstants.VALUE);
}
if (exchange.getIn().getBody() != null) {
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepository.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepository.java
index f029aaf..5a8b9fb 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepository.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepository.java
@@ -34,9 +34,9 @@
private String repositoryPath;
- private DataSet<byte[]> dataSet;
+ private DataSet dataSet;
private int initialCapacity = 100;
- private Serializer<String> serializer = new KratiDefaultSerializer<String>();
+ private Serializer serializer = new KratiDefaultSerializer();
private SegmentFactory segmentFactory = new ChannelSegmentFactory();
public KratiIdempotentRepository(String repositoryPath) {
@@ -76,7 +76,7 @@
}
@Override
- @ManagedOperation(description = "Removes the given key from the store")
+ @ManagedOperation(description = "Does the store contain the given key")
public boolean remove(String s) {
byte[] bytes = serializer.serialize(s);
try {
@@ -114,11 +114,11 @@
this.repositoryPath = repositoryPath;
}
- public DataSet<byte[]> getDataSet() {
+ public DataSet getDataSet() {
return dataSet;
}
- public void setDataSet(DataSet<byte[]> dataSet) {
+ public void setDataSet(DataSet dataSet) {
this.dataSet = dataSet;
}
@@ -130,11 +130,11 @@
this.initialCapacity = initialCapacity;
}
- public Serializer<String> getSerializer() {
+ public Serializer getSerializer() {
return serializer;
}
- public void setSerializer(Serializer<String> serializer) {
+ public void setSerializer(Serializer serializer) {
this.serializer = serializer;
}
diff --git a/components/camel-krati/src/main/java/org/apache/camel/component/krati/serializer/KratiDefaultSerializer.java b/components/camel-krati/src/main/java/org/apache/camel/component/krati/serializer/KratiDefaultSerializer.java
index 4c4b0af..d4982fe 100644
--- a/components/camel-krati/src/main/java/org/apache/camel/component/krati/serializer/KratiDefaultSerializer.java
+++ b/components/camel-krati/src/main/java/org/apache/camel/component/krati/serializer/KratiDefaultSerializer.java
@@ -56,7 +56,8 @@
} catch (IOException e) {
LOG.warn("Error while serializing object. Null will be used.", e);
} finally {
- IOHelper.close(oos, baos);
+ IOHelper.close(oos);
+ IOHelper.close(baos);
}
return result;
}
@@ -68,7 +69,6 @@
* @return an object constructed from the raw bytes.
* @throws SerializationException if the object cannot be constructed from the raw bytes.
*/
- @SuppressWarnings("unchecked")
public T deserialize(byte[] binary) throws SerializationException {
T result = null;
ObjectInputStream ois = null;
@@ -96,7 +96,8 @@
} catch (ClassNotFoundException e) {
LOG.warn("Could not find class while deserializing object. Null will be used.", e);
} finally {
- IOHelper.close(ois, bais);
+ IOHelper.close(ois);
+ IOHelper.close(bais);
}
return result;
}
diff --git a/components/camel-krati/src/test/java/org/apache/camel/component/krati/KeyObject.java b/components/camel-krati/src/test/java/org/apache/camel/component/krati/KeyObject.java
index 67626e3..b638e6d 100644
--- a/components/camel-krati/src/test/java/org/apache/camel/component/krati/KeyObject.java
+++ b/components/camel-krati/src/test/java/org/apache/camel/component/krati/KeyObject.java
@@ -20,7 +20,6 @@
public class KeyObject implements Serializable {
- private static final long serialVersionUID = 1L;
private String id;
public KeyObject(String id) {
diff --git a/components/camel-krati/src/test/java/org/apache/camel/component/krati/ValueObject.java b/components/camel-krati/src/test/java/org/apache/camel/component/krati/ValueObject.java
index 731c440..47b2ed1 100644
--- a/components/camel-krati/src/test/java/org/apache/camel/component/krati/ValueObject.java
+++ b/components/camel-krati/src/test/java/org/apache/camel/component/krati/ValueObject.java
@@ -21,7 +21,6 @@
public class ValueObject implements Serializable {
- private static final long serialVersionUID = 1L;
Object value;
public ValueObject(Object value) {
diff --git a/components/camel-krati/src/test/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepositoryTest.java b/components/camel-krati/src/test/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepositoryTest.java
index 8eb38ab..1bc383c 100644
--- a/components/camel-krati/src/test/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepositoryTest.java
+++ b/components/camel-krati/src/test/java/org/apache/camel/component/krati/processor/idempotent/KratiIdempotentRepositoryTest.java
@@ -30,8 +30,8 @@
public class KratiIdempotentRepositoryTest extends CamelTestSupport {
private String path = "target/test/idempotent";
- private DataSet<byte[]> dataSet = KratiHelper.createDataSet(path, 2, new ChannelSegmentFactory());
- private Serializer<String> serializer = new KratiDefaultSerializer<String>();
+ private DataSet dataSet = KratiHelper.createDataSet(path, 2, new ChannelSegmentFactory());
+ private Serializer serializer = new KratiDefaultSerializer();
private KratiIdempotentRepository repository;
private String key01 = "123";
diff --git a/components/camel-ldap/pom.xml b/components/camel-ldap/pom.xml
index cc6a358..2229f87 100644
--- a/components/camel-ldap/pom.xml
+++ b/components/camel-ldap/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java b/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java
index 67f5728..1775d57 100644
--- a/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java
+++ b/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java
@@ -45,7 +45,6 @@
this.remaining = remaining;
}
- @SuppressWarnings("deprecation")
public LdapEndpoint(String endpointUri, String remaining) throws URISyntaxException {
super(endpointUri);
this.remaining = remaining;
diff --git a/components/camel-lucene/pom.xml b/components/camel-lucene/pom.xml
index 5b3a983..bd89ac9 100644
--- a/components/camel-lucene/pom.xml
+++ b/components/camel-lucene/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-lucene</artifactId>
diff --git a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
index 61d28d9..ec9de3f 100644
--- a/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
+++ b/components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneEndpoint.java
@@ -31,7 +31,6 @@
public LuceneEndpoint() {
}
- @SuppressWarnings("deprecation")
public LuceneEndpoint(String endpointUri, CamelContext camelContext) {
super(endpointUri, camelContext);
}
@@ -40,7 +39,6 @@
super(endpointUri, component);
}
- @SuppressWarnings("deprecation")
public LuceneEndpoint(String endpointUri) {
super(endpointUri);
}
diff --git a/components/camel-lucene/src/test/java/org/apache/camel/component/lucene/LuceneIndexAndQueryProducerTest.java b/components/camel-lucene/src/test/java/org/apache/camel/component/lucene/LuceneIndexAndQueryProducerTest.java
index 1edc861..1245e24 100644
--- a/components/camel-lucene/src/test/java/org/apache/camel/component/lucene/LuceneIndexAndQueryProducerTest.java
+++ b/components/camel-lucene/src/test/java/org/apache/camel/component/lucene/LuceneIndexAndQueryProducerTest.java
@@ -93,7 +93,7 @@
@Test
public void testLuceneIndexProducer() throws Exception {
- MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
+ MockEndpoint mockEndpoint = new MockEndpoint("mock:result");
context.stop();
context.addRoutes(new RouteBuilder() {
@@ -120,7 +120,7 @@
@Test
public void testLucenePhraseQueryProducer() throws Exception {
- MockEndpoint mockSearchEndpoint = getMockEndpoint("mock:searchResult");
+ MockEndpoint mockSearchEndpoint = new MockEndpoint("mock:searchResult");
context.stop();
context.addRoutes(new RouteBuilder() {
@@ -159,7 +159,7 @@
@Test
public void testLuceneWildcardQueryProducer() throws Exception {
- MockEndpoint mockSearchEndpoint = getMockEndpoint("mock:searchResult");
+ MockEndpoint mockSearchEndpoint = new MockEndpoint("mock:searchResult");
context.stop();
context.addRoutes(new RouteBuilder() {
diff --git a/components/camel-lucene/src/test/java/org/apache/camel/processor/lucene/LuceneQueryProcessorTest.java b/components/camel-lucene/src/test/java/org/apache/camel/processor/lucene/LuceneQueryProcessorTest.java
index 668ea09..118abb4 100644
--- a/components/camel-lucene/src/test/java/org/apache/camel/processor/lucene/LuceneQueryProcessorTest.java
+++ b/components/camel-lucene/src/test/java/org/apache/camel/processor/lucene/LuceneQueryProcessorTest.java
@@ -54,7 +54,7 @@
@Test
public void testPhraseSearcher() throws Exception {
final StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
- MockEndpoint mockSearchEndpoint = getMockEndpoint("mock:searchResult");
+ MockEndpoint mockSearchEndpoint = new MockEndpoint("mock:searchResult");
context.stop();
context.addRoutes(new RouteBuilder() {
@@ -98,7 +98,7 @@
@Test
public void testWildcardSearcher() throws Exception {
final SimpleAnalyzer analyzer = new SimpleAnalyzer();
- MockEndpoint mockSearchEndpoint = getMockEndpoint("mock:searchResult");
+ MockEndpoint mockSearchEndpoint = new MockEndpoint("mock:searchResult");
context.stop();
context.addRoutes(new RouteBuilder() {
diff --git a/components/camel-mail/pom.xml b/components/camel-mail/pom.xml
index f27d906..e13dd20 100644
--- a/components/camel-mail/pom.xml
+++ b/components/camel-mail/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
index 019b3bb..04c1fc6 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
@@ -366,7 +366,7 @@
// Mail messages can repeat the same header...
if (ObjectConverter.isCollection(headerValue)) {
- Iterator<?> iter = ObjectHelper.createIterator(headerValue);
+ Iterator iter = ObjectHelper.createIterator(headerValue);
while (iter.hasNext()) {
Object value = iter.next();
mimeMessage.addHeader(headerName, asString(exchange, value));
@@ -386,7 +386,7 @@
if (headerValue != null && isRecipientHeader(headerName)) {
// special handling of recipients
if (ObjectConverter.isCollection(headerValue)) {
- Iterator<?> iter = ObjectHelper.createIterator(headerValue);
+ Iterator iter = ObjectHelper.createIterator(headerValue);
while (iter.hasNext()) {
Object recipient = iter.next();
appendRecipientToMimeMessage(mimeMessage, configuration, exchange, headerName, asString(exchange, recipient));
@@ -552,7 +552,7 @@
protected Map<String, Object> extractHeadersFromMail(Message mailMessage, Exchange exchange) throws MessagingException {
Map<String, Object> answer = new HashMap<String, Object>();
- Enumeration<?> names = mailMessage.getAllHeaders();
+ Enumeration names = mailMessage.getAllHeaders();
while (names.hasMoreElements()) {
Header header = (Header) names.nextElement();
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
index 04e1a7a..ca902a8 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java
@@ -19,6 +19,7 @@
import java.net.URI;
import java.util.HashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.apache.camel.CamelContext;
@@ -74,11 +75,13 @@
return endpoint;
}
- private void configureAdditionalJavaMailProperties(MailConfiguration config, Map<String, Object> parameters) {
+ @SuppressWarnings("unchecked")
+ private void configureAdditionalJavaMailProperties(MailConfiguration config, Map parameters) {
// we cannot remove while iterating, as we will get a modification exception
- Set<Object> toRemove = new HashSet<Object>();
+ Set toRemove = new HashSet();
- for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ for (Object object : parameters.entrySet()) {
+ Entry entry = (Entry) object;
if (entry.getKey().toString().startsWith("mail.")) {
config.getAdditionalJavaMailProperties().put(entry.getKey(), entry.getValue());
toRemove.add(entry.getKey());
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
index 3a5b4ae..71068a1 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
@@ -29,9 +29,12 @@
import javax.mail.Store;
import javax.mail.search.FlagTerm;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.ShutdownRunningTask;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.spi.Synchronization;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
@@ -42,7 +45,7 @@
* A {@link org.apache.camel.Consumer Consumer} which consumes messages from JavaMail using a
* {@link javax.mail.Transport Transport} and dispatches them to the {@link Processor}
*/
-public class MailConsumer extends ScheduledBatchPollingConsumer {
+public class MailConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
public static final String POP3_UID = "CamelPop3Uid";
public static final long DEFAULT_CONSUMER_DELAY = 60 * 1000L;
private static final transient Logger LOG = LoggerFactory.getLogger(MailConsumer.class);
@@ -50,6 +53,9 @@
private final JavaMailSender sender;
private Folder folder;
private Store store;
+ private int maxMessagesPerPoll;
+ private volatile ShutdownRunningTask shutdownRunningTask;
+ private volatile int pendingExchanges;
public MailConsumer(MailEndpoint endpoint, Processor processor, JavaMailSender sender) {
super(endpoint, processor);
@@ -146,6 +152,10 @@
return polledMessages;
}
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
+
public int processBatch(Queue<Object> exchanges) throws Exception {
int total = exchanges.size();
@@ -192,6 +202,54 @@
return total;
}
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
protected Queue<Exchange> createExchanges(Message[] messages) throws MessagingException {
Queue<Exchange> answer = new LinkedList<Exchange>();
@@ -316,7 +374,7 @@
// to be unique
StringBuilder buffer = new StringBuilder();
try {
- Enumeration<?> it = message.getAllHeaders();
+ Enumeration it = message.getAllHeaders();
while (it.hasMoreElements()) {
Header header = (Header)it.nextElement();
buffer.append(header.getName()).append("=").append(header.getValue()).append("\n");
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailCollectionHeaderTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailCollectionHeaderTest.java
index 58a10e1..92dfd57 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailCollectionHeaderTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailCollectionHeaderTest.java
@@ -45,7 +45,7 @@
Object beers = mock.getReceivedExchanges().get(0).getIn().getHeader("beers");
assertNotNull(beers);
- List<?> list = assertIsInstanceOf(List.class, beers);
+ List list = assertIsInstanceOf(List.class, beers);
assertEquals("Carlsberg", list.get(0));
assertEquals("Heineken", list.get(1));
}
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProducerUnsupportedCharsetTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProducerUnsupportedCharsetTest.java
index 0b5b878..db04ccc 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProducerUnsupportedCharsetTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailProducerUnsupportedCharsetTest.java
@@ -38,6 +38,7 @@
}
@Test
+ @SuppressWarnings("unchecked")
public void testSencUnsupportedCharset() throws Exception {
Mailbox.clearAll();
@@ -53,7 +54,7 @@
mock.expectedBodiesReceived("Hello World", "Bye World");
mock.allMessages().header("Content-Type").isEqualTo("text/plain");
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("To", "jones@localhost");
headers.put("Content-Type", "text/plain");
template.sendBodyAndHeaders("smtp://localhost?ignoreUnsupportedCharset=true", "Hello World", headers);
@@ -67,6 +68,7 @@
}
@Test
+ @SuppressWarnings("unchecked")
public void testSencUnsupportedCharsetDisabledOption() throws Exception {
Mailbox.clearAll();
@@ -82,7 +84,7 @@
mock.expectedBodiesReceived("Hello World");
mock.allMessages().header("Content-Type").isEqualTo("text/plain");
- Map<String, Object> headers = new HashMap<String, Object>();
+ Map headers = new HashMap();
headers.put("To", "jones@localhost");
headers.put("Content-Type", "text/plain");
template.sendBodyAndHeaders("smtp://localhost?ignoreUnsupportedCharset=false", "Hello World", headers);
diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMessageConsumeTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMessageConsumeTest.java
index 786f939..0be8702 100644
--- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMessageConsumeTest.java
+++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MimeMessageConsumeTest.java
@@ -78,7 +78,7 @@
DataHandler dh = exchange.getIn().getAttachment(s);
Object content = dh.getContent();
assertNotNull("Content should not be empty", content);
- assertEquals("log4j.properties", dh.getName());
+ //assertEquals("log4j.properties", dh.getName());
}
}
diff --git a/components/camel-mina/pom.xml b/components/camel-mina/pom.xml
index dfa2985..27492f3 100644
--- a/components/camel-mina/pom.xml
+++ b/components/camel-mina/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -60,7 +60,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerAnotherConcurrentTest.java b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerAnotherConcurrentTest.java
index 3dd46e8..5eb6a81 100644
--- a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerAnotherConcurrentTest.java
+++ b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerAnotherConcurrentTest.java
@@ -53,11 +53,11 @@
getMockEndpoint("mock:result").expectedMessageCount(files);
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- Map<Integer, Future<String>> responses = new ConcurrentHashMap<Integer, Future<String>>();
+ Map<Integer, Future> responses = new ConcurrentHashMap<Integer, Future>();
for (int i = 0; i < files; i++) {
final int index = i;
- Future<String> out = executor.submit(new Callable<String>() {
- public String call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
return template.requestBody("direct:start", index, String.class);
}
});
diff --git a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java
index 41e56cb..8e40389 100644
--- a/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java
+++ b/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaProducerConcurrentTest.java
@@ -49,11 +49,11 @@
getMockEndpoint("mock:result").expectedMessageCount(files);
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- Map<Integer, Future<String>> responses = new ConcurrentHashMap<Integer, Future<String>>();
+ Map<Integer, Future> responses = new ConcurrentHashMap<Integer, Future>();
for (int i = 0; i < files; i++) {
final int index = i;
- Future<String> out = executor.submit(new Callable<String>() {
- public String call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
return template.requestBody("mina:tcp://localhost:{{port}}?sync=true", index, String.class);
}
});
@@ -65,7 +65,7 @@
// get all responses
Set<Object> unique = new HashSet<Object>();
- for (Future<String> future : responses.values()) {
+ for (Future future : responses.values()) {
unique.add(future.get());
}
diff --git a/components/camel-mina2/pom.xml b/components/camel-mina2/pom.xml
index f370b76..00ad348 100644
--- a/components/camel-mina2/pom.xml
+++ b/components/camel-mina2/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -58,7 +58,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
index 9b51033..e1ebab9 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Component.java
@@ -72,6 +72,7 @@
private Endpoint createEndpoint(String uri, Mina2Configuration config) throws Exception {
ObjectHelper.notNull(getCamelContext(), "camelContext");
+ Endpoint endpoint;
String protocol = config.getProtocol();
// if mistyped uri then protocol can be null
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
index 1cd12a8..7bde4a2 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Consumer.java
@@ -26,14 +26,17 @@
import org.apache.camel.ExchangePattern;
import org.apache.camel.Processor;
import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.util.CamelLogger;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.IOHelper;
import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.core.filterchain.IoFilter;
import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.core.service.IoHandler;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.service.IoService;
import org.apache.mina.core.session.IoSession;
+import org.apache.mina.core.session.IoSessionConfig;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
@@ -58,11 +61,15 @@
private static final transient Logger LOG = LoggerFactory.getLogger(Mina2Consumer.class);
private SocketAddress address;
private IoAcceptor acceptor;
+ private CamelLogger noReplyLogger;
private Mina2Configuration configuration;
+ private IoSessionConfig acceptorConfig;
+ private boolean sync;
public Mina2Consumer(final Mina2Endpoint endpoint, Processor processor) {
super(endpoint, processor);
this.configuration = endpoint.getConfiguration();
+ this.noReplyLogger = new CamelLogger(LOG, configuration.getNoReplyLogLevel());
//
// All mina2 endpoints are InOut. The endpoints are asynchronous.
// Endpoints can send "n" messages and receive "m" messages.
@@ -83,7 +90,8 @@
protected void doStart() throws Exception {
super.doStart();
- acceptor.setHandler(new ReceiveHandler());
+ IoHandler handler = new ReceiveHandler();
+ acceptor.setHandler(handler);
acceptor.bind(address);
LOG.info("Bound to server address: {} using acceptor: {}", address, acceptor);
}
@@ -116,6 +124,7 @@
protected void createSocketEndpoint(String uri, Mina2Configuration configuration) {
LOG.debug("createSocketEndpoint");
boolean minaLogger = configuration.isMinaLogger();
+ long timeout = configuration.getTimeout();
List<IoFilter> filters = configuration.getFilters();
address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
@@ -124,6 +133,7 @@
new NioProcessor(this.getEndpoint().getCamelContext().getExecutorServiceManager().newDefaultThreadPool(this, "MinaSocketAcceptor")));
// acceptor connectorConfig
+ acceptorConfig = acceptor.getSessionConfig();
configureCodecFactory("Mina2Consumer", acceptor, configuration);
((NioSocketAcceptor) acceptor).setReuseAddress(true);
acceptor.setCloseOnDeactivation(true);
@@ -171,12 +181,14 @@
protected void createDatagramEndpoint(String uri, Mina2Configuration configuration) {
boolean minaLogger = configuration.isMinaLogger();
+ long timeout = configuration.getTimeout();
List<IoFilter> filters = configuration.getFilters();
address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
acceptor = new NioDatagramAcceptor(this.getEndpoint().getCamelContext().getExecutorServiceManager().newDefaultThreadPool(this, "MinaDatagramAcceptor"));
// acceptor connectorConfig
+ acceptorConfig = acceptor.getSessionConfig();
configureDataGramCodecFactory("MinaConsumer", acceptor, configuration);
acceptor.setCloseOnDeactivation(true);
// reuse address is default true for datagram
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java
index 46da8d1..dbf1df0 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Helper.java
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.mina2;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
+import org.apache.mina.core.future.WriteFuture;
import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
index 911b4a7..ed461cf 100644
--- a/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
+++ b/components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Producer.java
@@ -104,7 +104,6 @@
return false;
}
- @SuppressWarnings("deprecation")
public void process(Exchange exchange) throws Exception {
LOG.debug("Mina2Producer process");
@@ -238,7 +237,7 @@
connector.getSessionConfig().setAll(connectorConfig);
}
- connector.setHandler(new ResponseHandler());
+ connector.setHandler(new ResponseHandler(getEndpoint()));
ConnectFuture future = connector.connect(address);
future.awaitUninterruptibly();
session = future.getSession();
@@ -440,10 +439,15 @@
*/
private final class ResponseHandler extends IoHandlerAdapter {
+ private Mina2Endpoint endpoint;
private Object message;
private Throwable cause;
private boolean messageReceived;
+ private ResponseHandler(Mina2Endpoint endpoint) {
+ this.endpoint = endpoint;
+ }
+
public void reset() {
this.message = null;
this.cause = null;
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/BaseMina2Test.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/BaseMina2Test.java
index 3c3d0df..1a7a12a 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/BaseMina2Test.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/BaseMina2Test.java
@@ -16,10 +16,21 @@
*/
package org.apache.camel.component.mina2;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Properties;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
+/**
+ *
+ */
public class BaseMina2Test extends CamelTestSupport {
private static volatile int port;
@@ -29,7 +40,41 @@
port = AvailablePortFinder.getNextAvailable();
}
+ @AfterClass
+ public static void savePort() throws Exception {
+ File file = new File("./target/minaport.txt");
+ file = file.getAbsoluteFile();
+
+ // save to file, do not append
+ FileOutputStream fos = new FileOutputStream(file, false);
+ try {
+ fos.write(String.valueOf(port).getBytes());
+ } finally {
+ fos.close();
+ }
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext context = super.createCamelContext();
+ context.addComponent("properties", new PropertiesComponent("ref:prop"));
+ return context;
+ }
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+
+ Properties prop = new Properties();
+ prop.setProperty("port", "" + getPort());
+ jndi.bind("prop", prop);
+
+ return jndi;
+ }
+
protected int getNextPort() {
+// port = AvailablePortFinder.getNextAvailable();
+// return port;
return AvailablePortFinder.getNextAvailable();
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/MessageIOSessionTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/MessageIOSessionTest.java
index cb2fc2c..1963264 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/MessageIOSessionTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/MessageIOSessionTest.java
@@ -34,7 +34,7 @@
public void testIoSession() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
- template.sendBody(String.format("mina2:tcp://localhost:%1$s?textline=true", getPort()), "Hello World");
+ template.sendBody("mina2:tcp://localhost:{{port}}?textline=true", "Hello World");
assertMockEndpointsSatisfied();
Exchange exchange = mock.getExchanges().get(0);
@@ -47,7 +47,7 @@
public void testLocalAndRemoteAddressHeaders() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
- template.sendBody(String.format("mina2:tcp://localhost:%1$s?textline=true", getPort()), "Hello World");
+ template.sendBody("mina2:tcp://localhost:{{port}}?textline=true", "Hello World");
assertMockEndpointsSatisfied();
Message message = mock.getExchanges().get(0).getIn();
@@ -63,9 +63,7 @@
@Override
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?textline=true", getPort()))
- .to("log://mytest")
- .to("mock:result");
+ from("mina2:tcp://localhost:{{port}}?textline=true").to("log://mytest").to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ClientServerTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ClientServerTest.java
index 47316835a..7923e5a 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ClientServerTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ClientServerTest.java
@@ -21,12 +21,15 @@
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;
+/**
+ * @version
+ */
public class Mina2ClientServerTest extends BaseMina2Test {
@Test
public void testSendToServer() throws InterruptedException {
// START SNIPPET: e3
- String out = (String) template.requestBody(String.format("mina2:tcp://localhost:%1$s?textline=true", getPort()), "Chad");
+ String out = (String) template.requestBody("mina2:tcp://localhost:{{port}}?textline=true", "Chad");
assertEquals("Hello Chad", out);
// END SNIPPET: e3
}
@@ -38,9 +41,9 @@
@Override
public void configure() throws Exception {
// START SNIPPET: e1
- // lets setup a server on port %1$s
+ // lets setup a server on port {{port}}
// and we let the request-reply be processed in the MyServerProcessor
- from(String.format("mina2:tcp://localhost:%1$s?textline=true", getPort())).process(new MyServerProcessor());
+ from("mina2:tcp://localhost:{{port}}?textline=true").process(new MyServerProcessor());
// END SNIPPET: e1
}
};
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2CustomCodecTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2CustomCodecTest.java
index 427a0ab..402c123 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2CustomCodecTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2CustomCodecTest.java
@@ -41,7 +41,7 @@
mock.expectedMessageCount(1);
mock.expectedBodiesReceived("Bye World");
- Object out = template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true&codec=#myCodec", getPort()), "Hello World");
+ Object out = template.requestBody("mina2:tcp://localhost:{{port}}?sync=true&codec=#myCodec", "Hello World");
assertEquals("Bye World", out);
mock.assertIsSatisfied();
@@ -49,8 +49,9 @@
@Test
public void testTCPEncodeUTF8InputIsString() throws Exception {
- final String myUri = String.format("mina2:tcp://localhost:%1$s?encoding=UTF-8&sync=false", getNextPort());
+ final String myUri = "mina2:tcp://localhost:" + getNextPort() + "?encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
+
public void configure() {
from(myUri).to("mock:result");
}
@@ -71,7 +72,7 @@
@Test
public void testBadConfiguration() throws Exception {
try {
- template.sendBody(String.format("mina2:tcp://localhost:%1$s?sync=true&codec=#XXX", getPort()), "Hello World");
+ template.sendBody("mina2:tcp://localhost:{{port}}?sync=true&codec=#XXX", "Hello World");
fail("Should have thrown a ResolveEndpointFailedException");
} catch (ResolveEndpointFailedException e) {
// ok
@@ -88,7 +89,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&codec=#myCodec", getPort())).transform(constant("Bye World")).to("mock:result");
+ from("mina2:tcp://localhost:{{port}}?sync=true&codec=#myCodec").transform(constant("Bye World")).to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2DisconnectTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2DisconnectTest.java
index abb6953..73ca176 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2DisconnectTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2DisconnectTest.java
@@ -28,7 +28,7 @@
@Test
public void testCloseSessionWhenComplete() throws Exception {
- Object out = template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true&disconnect=true", getPort()), "Chad");
+ Object out = template.requestBody("mina2:tcp://localhost:{{port}}?sync=true&textline=true&disconnect=true", "Chad");
assertEquals("Bye Chad", out);
}
@@ -37,7 +37,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true&disconnect=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true&textline=true&disconnect=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
index f6130c1..cea7d56 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2EncodingTest.java
@@ -18,8 +18,10 @@
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
+import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
+import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
@@ -33,7 +35,7 @@
@Test
public void testTCPEncodeUTF8InputIsBytes() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?encoding=UTF-8&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() {
@@ -55,7 +57,7 @@
@Test
public void testTCPEncodeUTF8InputIsString() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?encoding=UTF-8&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() {
@@ -77,7 +79,7 @@
@Test
public void testTCPEncodeUTF8TextLineInputIsString() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?textline=true&encoding=UTF-8&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?textline=true&encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() {
@@ -101,7 +103,7 @@
// See TextLineEncoder#encode where the message is converted to String using .toString()
@Test
public void testUDPEncodeUTF8InputIsBytes() throws Exception {
- final String uri = String.format("mina2:udp://localhost:%1$s?encoding=UTF-8&sync=false", getPort());
+ final String uri = "mina2:udp://localhost:{{port}}?encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() {
@@ -123,7 +125,7 @@
@Test
public void testUDPEncodeUTF8InputIsString() throws Exception {
- final String uri = String.format("mina2:udp://localhost:%1$s?encoding=UTF-8&sync=false", getPort());
+ final String uri = "mina2:udp://localhost:{{port}}?encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() {
@@ -153,7 +155,7 @@
final String hello = "Hello Thai Elephant \u0E08";
final String bye = "Hello Thai Elephant \u0E08";
- final String uri = String.format("mina2:udp://localhost:%1$s?sync=true&encoding=UTF-8", getPort());
+ final String uri = "mina2:udp://localhost:{{port}}?sync=true&encoding=UTF-8";
context.addRoutes(new RouteBuilder() {
public void configure() {
@@ -184,7 +186,7 @@
@Test
public void testInvalidEncoding() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?textline=true&encoding=XXX&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?textline=true&encoding=XXX&sync=false";
try {
context.addRoutes(new RouteBuilder() {
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeDefaultTimeOutTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeDefaultTimeOutTest.java
index afe5b4d..168cc10 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeDefaultTimeOutTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeDefaultTimeOutTest.java
@@ -32,7 +32,7 @@
@Test
public void testDefaultTimeOut() {
try {
- String result = (String) template.requestBody(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true", getPort()), "Hello World");
+ String result = (String) template.requestBody("mina2:tcp://localhost:{{port}}?textline=true&sync=true", "Hello World");
assertEquals("Okay I will be faster in the future", result);
} catch (RuntimeCamelException e) {
fail("Should not get a RuntimeCamelException");
@@ -43,7 +43,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?textline=true&sync=true").process(new Processor() {
public void process(Exchange e) throws Exception {
assertEquals("Hello World", e.getIn().getBody(String.class));
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeTimeOutTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeTimeOutTest.java
index 512c1f6..f419747 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeTimeOutTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ExchangeTimeOutTest.java
@@ -26,13 +26,16 @@
/**
* To test timeout.
+ *
+ * @version
*/
public class Mina2ExchangeTimeOutTest extends BaseMina2Test {
@Test
public void testUsingTimeoutParameter() throws Exception {
+
// use a timeout value of 2 seconds (timeout is in millis) so we should actually get a response in this test
- Endpoint endpoint = context.getEndpoint(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true&timeout=500", getPort()));
+ Endpoint endpoint = context.getEndpoint("mina2:tcp://localhost:{{port}}?textline=true&sync=true&timeout=500");
Producer producer = endpoint.createProducer();
producer.start();
Exchange exchange = producer.createExchange();
@@ -50,17 +53,17 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true&timeout=30000", getPort()))
- .process(new Processor() {
- public void process(Exchange e) throws Exception {
- assertEquals("Hello World", e.getIn().getBody(String.class));
- // MinaProducer has a default timeout of 3 seconds so we just wait 2 seconds
- // (template.requestBody is a MinaProducer behind the doors)
- Thread.sleep(2000);
-
- e.getOut().setBody("Okay I will be faster in the future");
- }
- });
+ from("mina2:tcp://localhost:{{port}}?textline=true&sync=true&timeout=30000").process(new Processor() {
+
+ public void process(Exchange e) throws Exception {
+ assertEquals("Hello World", e.getIn().getBody(String.class));
+ // MinaProducer has a default timeout of 3 seconds so we just wait 2 seconds
+ // (template.requestBody is a MinaProducer behind the doors)
+ Thread.sleep(2000);
+
+ e.getOut().setBody("Okay I will be faster in the future");
+ }
+ });
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileTcpTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileTcpTest.java
index e4d5a94..c67d5c9 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileTcpTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileTcpTest.java
@@ -39,10 +39,10 @@
public void configure() {
// lets setup a server
- from(String.format("mina2:tcp://localhost:%1$s?sync=false&textline=true", getPort())).to("mock:results");
+ from("mina2:tcp://localhost:{{port}}?sync=false&textline=true").to("mock:results");
from("file:src/test/data?noop=true&fileName=message1.txt").
- to(String.format("mina2:tcp://localhost:%1$s?sync=false&textline=true", getPort()));
+ to("mina2:tcp://localhost:{{port}}?sync=false&textline=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileUdpTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileUdpTest.java
index 746e7a1..83cceaa 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileUdpTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FileUdpTest.java
@@ -39,10 +39,10 @@
public void configure() {
// lets setup a server
- from(String.format("mina2:udp://localhost:%1$s?sync=false&textline=true", getPort())).to("mock:results");
+ from("mina2:udp://localhost:{{port}}?sync=false&textline=true").to("mock:results");
from("file:src/test/data?noop=true").
- to(String.format("mina2:udp://localhost:%1$s?sync=false&textline=true", getPort()));
+ to("mina2:udp://localhost:{{port}}?sync=false&textline=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FiltersTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FiltersTest.java
index ed17f72..2d3e1fc 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FiltersTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2FiltersTest.java
@@ -40,12 +40,12 @@
@Test
public void testFilterListRef() throws Exception {
- testFilter(String.format("mina2:tcp://localhost:%1$s?textline=true&minaLogger=true&sync=false&filters=#myFilters", getPort()));
+ testFilter("mina2:tcp://localhost:{{port}}?textline=true&minaLogger=true&sync=false&filters=#myFilters");
}
@Test
public void testFilterElementRef() throws Exception {
- testFilter(String.format("mina2:tcp://localhost:%1$s?textline=true&minaLogger=true&sync=false&filters=#myFilter", getPort()));
+ testFilter("mina2:tcp://localhost:{{port}}?textline=true&minaLogger=true&sync=false&filters=#myFilter");
}
@Override
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOnlyRouteTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOnlyRouteTest.java
index 8fe1dc6..5999606 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOnlyRouteTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOnlyRouteTest.java
@@ -42,7 +42,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
@@ -50,10 +50,7 @@
}
});
- from("timer://start?period=10000&delay=2000")
- .setBody(constant("Chad"))
- .to(String.format("mina2:tcp://localhost:%1$s?sync=true&lazySessionCreation=true", getPort()))
- .to("mock:result");
+ from("timer://start?period=10000&delay=2000").setBody(constant("Chad")).to("mina2:tcp://localhost:{{port}}?sync=true&lazySessionCreation=true").to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutCloseSessionWhenCompleteTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutCloseSessionWhenCompleteTest.java
index 17fe6c4..0467def 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutCloseSessionWhenCompleteTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutCloseSessionWhenCompleteTest.java
@@ -28,7 +28,7 @@
@Test
public void testCloseSessionWhenComplete() throws Exception {
- Object out = template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true", getPort()), "Chad");
+ Object out = template.requestBody("mina2:tcp://localhost:{{port}}?sync=true&textline=true", "Chad");
assertEquals("Bye Chad", out);
}
@@ -37,7 +37,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true&textline=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTest.java
index 2db9f39..fcb7a6a 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTest.java
@@ -47,7 +47,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
@@ -55,7 +55,7 @@
}
});
- from("direct:in").to(String.format("mina2:tcp://localhost:%1$s?sync=true&lazySessionCreation=true", getPort())).to("mock:result");
+ from("direct:in").to("mina2:tcp://localhost:{{port}}?sync=true&lazySessionCreation=true").to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTextLineDelimiterTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTextLineDelimiterTest.java
index 681b318..9afd7dc 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTextLineDelimiterTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2InOutRouteTextLineDelimiterTest.java
@@ -35,7 +35,7 @@
// we should preserve headers
mock.setResultWaitTime(5000);
- Object out = template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true&textlineDelimiter=MAC", getPort()), "Chad");
+ Object out = template.requestBody("mina2:tcp://localhost:{{port}}?sync=true&textline=true&textlineDelimiter=MAC", "Chad");
assertMockEndpointsSatisfied();
assertEquals("Bye Chad", out);
@@ -46,7 +46,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true&textlineDelimiter=MAC", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true&textline=true&textlineDelimiter=MAC").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2LoggerOptionTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2LoggerOptionTest.java
index 93509b4..bafd063 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2LoggerOptionTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2LoggerOptionTest.java
@@ -33,8 +33,9 @@
@Test
public void testLoggerOptionTrue() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?textline=true&minaLogger=true&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?textline=true&minaLogger=true&sync=false";
context.addRoutes(new RouteBuilder() {
+
public void configure() throws Exception {
from(uri).to("mock:result");
}
@@ -63,7 +64,7 @@
@Test
public void testLoggerOptionFalse() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?textline=true&minaLogger=false&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?textline=true&minaLogger=false&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
@@ -95,7 +96,7 @@
@Test
public void testNoLoggerOption() throws Exception {
- final String uri = String.format("mina2:tcp://localhost:%1$s?textline=true&sync=false", getPort());
+ final String uri = "mina2:tcp://localhost:{{port}}?textline=true&sync=false";
context.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2MaxLineLengthTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2MaxLineLengthTest.java
index 4faeca3..9720548 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2MaxLineLengthTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2MaxLineLengthTest.java
@@ -34,7 +34,7 @@
}
// START SNIPPET: e3
- String out = (String) template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true&encoderMaxLineLength=5000&decoderMaxLineLength=5000", getPort()), request);
+ String out = (String) template.requestBody("mina2:tcp://localhost:{{port}}?sync=true&textline=true&encoderMaxLineLength=5000&decoderMaxLineLength=5000", request);
assertEquals(request, out);
// END SNIPPET: e3
}
@@ -46,10 +46,10 @@
@Override
public void configure() throws Exception {
// START SNIPPET: e1
- // lets setup a server on port %1$s
+ // lets setup a server on port {{port}}
// we set the sync option so we will send a reply
// and we let the request-reply be processed in the MyServerProcessor
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&textline=true&encoderMaxLineLength=5000&decoderMaxLineLength=5000", getPort())).process(new MyServerProcessor());
+ from("mina2:tcp://localhost:{{port}}?sync=true&textline=true&encoderMaxLineLength=5000&decoderMaxLineLength=5000").process(new MyServerProcessor());
// END SNIPPET: e1
}
};
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2NoResponseFromServerTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2NoResponseFromServerTest.java
index 197ddb4..80e2207 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2NoResponseFromServerTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2NoResponseFromServerTest.java
@@ -41,7 +41,7 @@
mock.expectedMessageCount(0);
try {
- template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true&codec=#myCodec", getPort()), "Hello World");
+ template.requestBody("mina2:tcp://localhost:{{port}}?sync=true&codec=#myCodec", "Hello World");
fail("Should throw a CamelExchangeException");
} catch (RuntimeCamelException e) {
assertIsInstanceOf(CamelExchangeException.class, e.getCause());
@@ -61,7 +61,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&codec=#myCodec", getPort())).transform(constant("Bye World")).to("mock:result");
+ from("mina2:tcp://localhost:{{port}}?sync=true&codec=#myCodec").transform(constant("Bye World")).to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerAnotherConcurrentTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerAnotherConcurrentTest.java
index ca9e9a6..8302ab2 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerAnotherConcurrentTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerAnotherConcurrentTest.java
@@ -80,9 +80,9 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from("direct:start").to(String.format("mina2:tcp://localhost:%1$s?sync=true", getPort()));
+ from("direct:start").to("mina2:tcp://localhost:{{port}}?sync=true");
- from(String.format("mina2:tcp://localhost:%1$s?sync=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerConcurrentTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerConcurrentTest.java
index a780082..6fa1922 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerConcurrentTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerConcurrentTest.java
@@ -55,7 +55,7 @@
Future<Object> out = executor.submit(new Callable<Object>() {
public Object call() throws Exception {
- return template.requestBody(String.format("mina2:tcp://localhost:%1$s?sync=true", getPort()), index, String.class);
+ return template.requestBody("mina2:tcp://localhost:{{port}}?sync=true", index, String.class);
}
});
responses.put(index, out);
@@ -80,7 +80,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String body = exchange.getIn().getBody(String.class);
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerShutdownMockTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerShutdownMockTest.java
index c36bade..40be818 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerShutdownMockTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ProducerShutdownMockTest.java
@@ -47,7 +47,8 @@
replay(mockConnector);
// normal camel code to get a producer
- Endpoint endpoint = context.getEndpoint(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=false", getPort()));
+ Endpoint endpoint = context.getEndpoint(
+ "mina2:tcp://localhost:{{port}}?textline=true&sync=false");
Exchange exchange = endpoint.createExchange();
Producer producer = endpoint.createProducer();
producer.start();
@@ -78,7 +79,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=false", getPort())).to("mock:result");
+ from("mina2:tcp://localhost:{{port}}?textline=true&sync=false").to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
index 04579fa..6c5062a 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2ReverseProtocolHandler.java
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.mina2;
-import org.apache.camel.test.junit4.TestSupport;
import org.apache.mina.core.service.IoHandler;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;
@@ -41,11 +40,6 @@
buf.append(str.charAt(i));
}
- if (TestSupport.isPlatform("windows")) {
- // seems to be only required on windows to make it work!
- buf.append(System.getProperty("line.separator"));
- }
-
// and write it back.
session.write(buf.toString());
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
index 0ce99df..bcbe669 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SendToProcessorTest.java
@@ -28,7 +28,7 @@
@Override
public void configure() throws Exception {
- from("direct:start").to(String.format("mina2:tcp://localhost:%1$s?sync=false&lazySessionCreation=false", getPort()));
+ from("direct:start").to("mina2:tcp://localhost:{{port}}?sync=false&lazySessionCreation=false");
}
});
@@ -46,7 +46,7 @@
@Override
public void configure() throws Exception {
- from("direct:start").to(String.format("mina2:tcp://localhost:%1$s?sync=false", getPort()));
+ from("direct:start").to("mina2:tcp://localhost:{{port}}?sync=false");
}
});
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
index 37295b1..ed26b5a 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMinaEndpointUDPTest.java
@@ -31,7 +31,7 @@
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(1);
- template.sendBody("myMinaEndpoint", "Hello World" + LS);
+ template.sendBody("myMinaEndpoint", "Hello World\n");
assertMockEndpointsSatisfied();
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
index 633a993..eea0c8f 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2SpringMultipleUDPTest.java
@@ -39,8 +39,10 @@
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(7);
+ int fooValue = 15;
+
for (int i = 0; i < 7; i++) {
- template.requestBody("myMinaEndpoint", "Hello World" + i + LS);
+ template.requestBody("myMinaEndpoint", "Hello World" + i + "\n");
}
// Sleep for awhile to let the messages go through.
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpLineDelimiterUsingPlainSocketTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpLineDelimiterUsingPlainSocketTest.java
index 78d242a..049b39d 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpLineDelimiterUsingPlainSocketTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpLineDelimiterUsingPlainSocketTest.java
@@ -127,22 +127,22 @@
// use no delay for fast unit testing
errorHandler(defaultErrorHandler().maximumRedeliveries(2));
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&minaLogger=true&textlineDelimiter=MAC&sync=true", getPort()))
- .process(new Processor() {
- public void process(Exchange e) {
- String in = e.getIn().getBody(String.class);
- if ("force-null-out-body".equals(in)) {
- // forcing a null out body
- e.getOut().setBody(null);
- } else if ("force-exception".equals(in)) {
- // clear out before throwing exception
- e.getOut().setBody(null);
- throw new IllegalArgumentException("Forced exception");
- } else {
- e.getOut().setBody("Hello " + in);
- }
+ from("mina2:tcp://localhost:{{port}}?textline=true&minaLogger=true&textlineDelimiter=MAC&sync=true").process(new Processor() {
+
+ public void process(Exchange e) {
+ String in = e.getIn().getBody(String.class);
+ if ("force-null-out-body".equals(in)) {
+ // forcing a null out body
+ e.getOut().setBody(null);
+ } else if ("force-exception".equals(in)) {
+ // clear out before throwing exception
+ e.getOut().setBody(null);
+ throw new IllegalArgumentException("Forced exception");
+ } else {
+ e.getOut().setBody("Hello " + in);
}
- });
+ }
+ });
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTest.java
index f268a106..8fb3c56 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTest.java
@@ -31,7 +31,7 @@
Object body = "Hello there!";
endpoint.expectedBodiesReceived(body);
- template.sendBodyAndHeader(String.format("mina2:tcp://localhost:%1$s?sync=false&minaLogger=true", getPort()), body, "cheese", 123);
+ template.sendBodyAndHeader("mina2:tcp://localhost:{{port}}?sync=false&minaLogger=true", body, "cheese", 123);
assertMockEndpointsSatisfied();
}
@@ -40,7 +40,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?sync=false&minaLogger=true", getPort())).to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
+ from("mina2:tcp://localhost:{{port}}?sync=false&minaLogger=true").to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineDelimiterTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineDelimiterTest.java
index 4c99227..4613a20 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineDelimiterTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineDelimiterTest.java
@@ -20,6 +20,9 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
+/**
+ * @version
+ */
public class Mina2TcpTextlineDelimiterTest extends BaseMina2Test {
@Test
@@ -28,7 +31,7 @@
Object body = "Hello there!";
endpoint.expectedBodiesReceived(body);
- template.sendBodyAndHeader(String.format("mina2:tcp://localhost:%1$s?sync=false&textline=true&textlineDelimiter=UNIX", getPort()), body, "cheese", 123);
+ template.sendBodyAndHeader("mina2:tcp://localhost:{{port}}?sync=false&textline=true&textlineDelimiter=UNIX", body, "cheese", 123);
assertMockEndpointsSatisfied();
}
@@ -37,10 +40,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?sync=false&textline=true&textlineDelimiter=UNIX", getPort()))
- .to("log:before?showAll=true")
- .to("mock:result")
- .to("log:after?showAll=true");
+ from("mina2:tcp://localhost:{{port}}?sync=false&textline=true&textlineDelimiter=UNIX").to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineProtocolTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineProtocolTest.java
index 925a6ca..05847af 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineProtocolTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpTextlineProtocolTest.java
@@ -20,6 +20,9 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
+/**
+ * @version
+ */
public class Mina2TcpTextlineProtocolTest extends BaseMina2Test {
@Test
@@ -28,7 +31,7 @@
Object body = "Hello there!";
endpoint.expectedBodiesReceived(body);
- template.sendBodyAndHeader(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=false", getPort()), body, "cheese", 123);
+ template.sendBodyAndHeader("mina2:tcp://localhost:{{port}}?textline=true&sync=false", body, "cheese", 123);
assertMockEndpointsSatisfied();
}
@@ -37,10 +40,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=false", getPort()))
- .to("log:before?showAll=true")
- .to("mock:result")
- .to("log:after?showAll=true");
+ from("mina2:tcp://localhost:{{port}}?textline=true&sync=false").to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutTest.java
index c4a0bc3..6643a1d 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutTest.java
@@ -40,7 +40,7 @@
@Test
public void testMinaRouteWithInOut() throws Exception {
latch = new CountDownLatch(1);
- uri = String.format("mina2:tcp://localhost:%1$s?textline=true", getPort());
+ uri = "mina2:tcp://localhost:{{port}}?textline=true";
Mina2ReverserServer server = new Mina2ReverserServer(getPort());
server.start();
@@ -85,7 +85,7 @@
@Test
public void testMinaRouteWithInOutLazy() throws Exception {
latch = new CountDownLatch(1);
- uri = String.format("mina2:tcp://localhost:%1$s?textline=true&lazySessionCreation=true", getPort());
+ uri = "mina2:tcp://localhost:{{port}}?textline=true&lazySessionCreation=true";
// The server is activated after Camel to check if the lazyness is working
Mina2ReverserServer server = new Mina2ReverserServer(getPort());
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
index beaff30..a1858af 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithInOutUsingPlainSocketTest.java
@@ -87,7 +87,7 @@
try {
os = soc.getOutputStream();
// must append newline at the end to flag end of textline to Camel-Mina
- os.write((input + LS).getBytes());
+ os.write((input + "\n").getBytes());
is = soc.getInputStream();
int len = is.read(buf);
@@ -109,7 +109,7 @@
StringBuilder sb = new StringBuilder();
for (byte b : buf) {
char ch = (char) b;
- if (LS.indexOf(ch) > -1) {
+ if (ch == '\n' || ch == 0) {
// newline denotes end of text (added in the end in the processor below)
break;
} else {
@@ -124,23 +124,22 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true", getPort()))
- .process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?textline=true&sync=true").process(new Processor() {
- public void process(Exchange e) {
- String in = e.getIn().getBody(String.class);
- if ("force-null-out-body".equals(in)) {
- // forcing a null out body
- e.getOut().setBody(null);
- } else if ("force-exception".equals(in)) {
- // clear out before throwing exception
- e.getOut().setBody(null);
- throw new IllegalArgumentException("Forced exception");
- } else {
- e.getOut().setBody("Hello " + in);
- }
+ public void process(Exchange e) {
+ String in = e.getIn().getBody(String.class);
+ if ("force-null-out-body".equals(in)) {
+ // forcing a null out body
+ e.getOut().setBody(null);
+ } else if ("force-exception".equals(in)) {
+ // clear out before throwing exception
+ e.getOut().setBody(null);
+ throw new IllegalArgumentException("Forced exception");
+ } else {
+ e.getOut().setBody("Hello " + in);
}
- });
+ }
+ });
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithIoOutProcessorExceptionTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithIoOutProcessorExceptionTest.java
index 721bc8e..4b71525 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithIoOutProcessorExceptionTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TcpWithIoOutProcessorExceptionTest.java
@@ -29,7 +29,7 @@
@Test
public void testExceptionThrownInProcessor() {
String body = "Hello World";
- Object result = template.requestBody(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true", getPort()), body);
+ Object result = template.requestBody("mina2:tcp://localhost:{{port}}?textline=true&sync=true", body);
// The exception should be passed to the client
assertNotNull("the result should not be null", result);
assertEquals("result is IllegalArgumentException", result, "java.lang.IllegalArgumentException: Forced exception");
@@ -42,7 +42,7 @@
// use no delay for fast unit testing
errorHandler(defaultErrorHandler().maximumRedeliveries(2));
- from(String.format("mina2:tcp://localhost:%1$s?textline=true&sync=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?textline=true&sync=true").process(new Processor() {
public void process(Exchange e) {
assertEquals("Hello World", e.getIn().getBody(String.class));
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TransferExchangeOptionTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TransferExchangeOptionTest.java
index 02bac14..13d6a23 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TransferExchangeOptionTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2TransferExchangeOptionTest.java
@@ -52,7 +52,7 @@
}
private Exchange sendExchange(boolean setException) throws Exception {
- Endpoint endpoint = context.getEndpoint(String.format("mina2:tcp://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort()));
+ Endpoint endpoint = context.getEndpoint("mina2:tcp://localhost:{{port}}?sync=true&encoding=UTF-8&transferExchange=true");
Producer producer = endpoint.createProducer();
Exchange exchange = producer.createExchange();
//Exchange exchange = endpoint.createExchange();
@@ -100,7 +100,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:tcp://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort())).process(new Processor() {
+ from("mina2:tcp://localhost:{{port}}?sync=true&encoding=UTF-8&transferExchange=true").process(new Processor() {
public void process(Exchange e) throws InterruptedException {
LOG.debug("Enter Processor...");
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java
index 91572a1..adbb38b 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpNoCamelTest.java
@@ -72,7 +72,7 @@
UDPClient client = new UDPClient();
client.connect("127.0.0.1", 1234);
for (int i = 0; i < 222; i++) {
- client.sendNoMina("Hello Mina " + i + System.getProperty("line.separator"));
+ client.sendNoMina("Hello Mina " + i + "\n");
}
Thread.sleep(2000);
assertEquals(222, server.numMessagesReceived);
@@ -130,6 +130,7 @@
* @param args The command line args.
*/
private final NioDatagramConnector connector;
+ private IoSession session;
private DatagramSocket socket;
private InetAddress address;
private int localPort = 1234;
@@ -138,6 +139,7 @@
private UDPClient() {
connector = new NioDatagramConnector();
connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(codecFactory));
+ //connector.getFilterChain().addLast("logger", new LoggingFilter());
connector.setHandler(this);
}
@@ -145,6 +147,8 @@
public void connect(String host, int port) {
localPort = port;
localHost = host;
+ session = connector.connect(new InetSocketAddress(localHost, localPort)).awaitUninterruptibly().
+ getSession();
try {
socket = new DatagramSocket();
address = InetAddress.getByName(localHost);
@@ -159,6 +163,10 @@
}
+ public void send(String msg) {
+ session.write(msg);
+ }
+
public void sendNoMina(String msg) {
try {
DatagramPacket packet = new DatagramPacket(msg.getBytes(), msg.getBytes().length,
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpTest.java
index 0aed0d6..d969ea0 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpTest.java
@@ -66,7 +66,15 @@
return new RouteBuilder() {
public void configure() {
+ int port2 = getNextPort();
+
+ //from("mina2:udp://127.0.0.1:" + getPort() + "?sync=false").to("mina2:udp://127.0.0.1:" + port2 + "?sync=false");
+ //from("mina2:udp://127.0.0.1:" + port2 + "?sync=false").to("mock:result");
+
+ //from("mina2:udp://127.0.0.1:10111?sync=false").to("mina2:udp://127.0.0.1:10112?sync=false");
+ //from("mina2:udp://127.0.0.1:10112?sync=false").to("mock:result");
from("mina2:udp://127.0.0.1:10111?sync=false&minaLogger=true").to("mock:result");
+ //from("mina2:udp://127.0.0.1:10111").to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpUsingTemplateTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpUsingTemplateTest.java
index 1d66b4b..582e045 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpUsingTemplateTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpUsingTemplateTest.java
@@ -45,7 +45,7 @@
protected void sendUdpMessages() throws Exception {
for (int i = 0; i < messageCount; i++) {
- template.sendBody(String.format("mina2:udp://127.0.0.1:%1$s?sync=false", getPort()), "Hello Message: " + i);
+ template.sendBody("mina2:udp://127.0.0.1:{{port}}?sync=false", "Hello Message: " + i);
}
}
@@ -55,7 +55,7 @@
endpoint.expectedMessageCount(1);
byte[] in = "Hello from bytes".getBytes();
- template.sendBody(String.format("mina2:udp://127.0.0.1:%1$s?sync=false", getPort()), in);
+ template.sendBody("mina2:udp://127.0.0.1:{{port}}?sync=false", in);
// sleeping for while to let the mock endpoint get all the message
Thread.sleep(2000);
@@ -71,9 +71,9 @@
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
+
public void configure() {
- from(String.format("mina2:udp://127.0.0.1:%1$s?sync=false&minaLogger=true", getPort()))
- .to("mock:result");
+ from("mina2:udp://127.0.0.1:{{port}}?sync=false&minaLogger=true").to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpWithInOutUsingPlainSocketTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpWithInOutUsingPlainSocketTest.java
index f8052ce..76da08a 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpWithInOutUsingPlainSocketTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2UdpWithInOutUsingPlainSocketTest.java
@@ -67,7 +67,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:udp://127.0.0.1:%1$s?sync=true", getPort())).process(new Processor() {
+ from("mina2:udp://127.0.0.1:{{port}}?sync=true").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String s = exchange.getIn().getBody(String.class);
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMCustomCodecTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMCustomCodecTest.java
index ba8c7f7..1e5b4c1 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMCustomCodecTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMCustomCodecTest.java
@@ -41,7 +41,7 @@
mock.expectedMessageCount(1);
mock.expectedBodiesReceived("Bye World");
- Object out = template.requestBody(String.format("mina2:vm://localhost:%1$s?sync=true&codec=#myCodec", getPort()), "Hello World");
+ Object out = template.requestBody("mina2:vm://localhost:{{port}}?sync=true&codec=#myCodec", "Hello World");
assertEquals("Bye World", out);
mock.assertIsSatisfied();
@@ -49,8 +49,9 @@
@Test
public void testTCPEncodeUTF8InputIsString() throws Exception {
- final String myUri = String.format("mina2:vm://localhost:%1$s?encoding=UTF-8&sync=false", getNextPort());
+ final String myUri = "mina2:vm://localhost:" + getNextPort() + "?encoding=UTF-8&sync=false";
context.addRoutes(new RouteBuilder() {
+
public void configure() {
from(myUri).to("mock:result");
}
@@ -71,7 +72,7 @@
@Test
public void testBadConfiguration() throws Exception {
try {
- template.sendBody(String.format("mina2:vm://localhost:%1$s?sync=true&codec=#XXX", getPort()), "Hello World");
+ template.sendBody("mina2:vm://localhost:{{port}}?sync=true&codec=#XXX", "Hello World");
fail("Should have thrown a ResolveEndpointFailedException");
} catch (ResolveEndpointFailedException e) {
// ok
@@ -88,7 +89,7 @@
return new RouteBuilder() {
public void configure() throws Exception {
- from(String.format("mina2:vm://localhost:%1$s?sync=true&codec=#myCodec", getPort())).transform(constant("Bye World")).to("mock:result");
+ from("mina2:vm://localhost:{{port}}?sync=true&codec=#myCodec").transform(constant("Bye World")).to("mock:result");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMFileTcpTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMFileTcpTest.java
index 12ae536..101882d 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMFileTcpTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMFileTcpTest.java
@@ -39,10 +39,10 @@
public void configure() {
// lets setup a server
- from(String.format("mina2:vm://localhost:%1$s?sync=false&textline=true", getPort())).to("mock:results");
+ from("mina2:vm://localhost:{{port}}?sync=false&textline=true").to("mock:results");
from("file:src/test/data?noop=true&fileName=message1.txt").
- to(String.format("mina2:vm://localhost:%1$s?sync=false&textline=true", getPort()));
+ to("mina2:vm://localhost:{{port}}?sync=false&textline=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTextlineProtocolTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTextlineProtocolTest.java
index 5b11824..5f2ffe5 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTextlineProtocolTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTextlineProtocolTest.java
@@ -20,6 +20,9 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.Test;
+/**
+ * @version
+ */
public class Mina2VMTextlineProtocolTest extends BaseMina2Test {
@Test
@@ -28,18 +31,16 @@
Object body = "Hello there!";
endpoint.expectedBodiesReceived(body);
- template.sendBodyAndHeader(String.format("mina2:vm://localhost:%1$s?textline=true&sync=false", getPort()), body, "cheese", 123);
+ template.sendBodyAndHeader("mina2:vm://localhost:{{port}}?textline=true&sync=false", body, "cheese", 123);
assertMockEndpointsSatisfied();
}
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
+
public void configure() {
- from(String.format("mina2:vm://localhost:%1$s?textline=true&sync=false", getPort()))
- .to("log:before?showAll=true")
- .to("mock:result")
- .to("log:after?showAll=true");
+ from("mina2:vm://localhost:{{port}}?textline=true&sync=false").to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
}
};
}
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTransferExchangeOptionTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTransferExchangeOptionTest.java
index c00fe14..381f267 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTransferExchangeOptionTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VMTransferExchangeOptionTest.java
@@ -48,7 +48,7 @@
}
private Exchange sendExchange(boolean setException) throws Exception {
- Endpoint endpoint = context.getEndpoint(String.format("mina2:vm://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort()));
+ Endpoint endpoint = context.getEndpoint("mina2:vm://localhost:{{port}}?sync=true&encoding=UTF-8&transferExchange=true");
Exchange exchange = endpoint.createExchange();
Message message = exchange.getIn();
@@ -95,7 +95,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:vm://localhost:%1$s?sync=true&encoding=UTF-8&transferExchange=true", getPort())).process(new Processor() {
+ from("mina2:vm://localhost:{{port}}?sync=true&encoding=UTF-8&transferExchange=true").process(new Processor() {
public void process(Exchange e) throws InterruptedException {
Assert.assertNotNull(e.getIn().getBody());
diff --git a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VmTest.java b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VmTest.java
index 28a57d5..e5d72e9 100644
--- a/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VmTest.java
+++ b/components/camel-mina2/src/test/java/org/apache/camel/component/mina2/Mina2VmTest.java
@@ -31,7 +31,7 @@
Object body = "Hello there!";
endpoint.expectedBodiesReceived(body);
- template.sendBodyAndHeader(String.format("mina2:vm://localhost:%1$s?sync=false&minaLogger=true", getPort()), body, "cheese", 123);
+ template.sendBodyAndHeader("mina2:vm://localhost:{{port}}?sync=false&minaLogger=true", body, "cheese", 123);
assertMockEndpointsSatisfied();
}
@@ -40,7 +40,7 @@
return new RouteBuilder() {
public void configure() {
- from(String.format("mina2:vm://localhost:%1$s?sync=false&minaLogger=true", getPort())).to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
+ from("mina2:vm://localhost:{{port}}?sync=false&minaLogger=true").to("log:before?showAll=true").to("mock:result").to("log:after?showAll=true");
}
};
}
diff --git a/components/camel-mongodb/pom.xml b/components/camel-mongodb/pom.xml
deleted file mode 100644
index 5fb55ec..0000000
--- a/components/camel-mongodb/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>components</artifactId>
- <groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../</relativePath>
- </parent>
-
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-mongodb</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: MongoDB</name>
- <description>Camel MongoDB component</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.component.mongodb.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
-
- <!-- JSON is vital to MongoDB, so we absolutely require camel-jackson -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jackson</artifactId>
- </dependency>
-
- <!-- MongoDB driver dependency -->
- <dependency>
- <groupId>org.mongodb</groupId>
- <artifactId>mongo-java-driver</artifactId>
- <version>${mongo-java-driver-version}</version>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/CamelMongoDbException.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/CamelMongoDbException.java
deleted file mode 100644
index 9e5fab7..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/CamelMongoDbException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-public class CamelMongoDbException extends Exception {
-
- private static final long serialVersionUID = 7834484945432331909L;
-
- public CamelMongoDbException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public CamelMongoDbException(String message) {
- super(message);
- }
-
- public CamelMongoDbException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbComponent.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbComponent.java
deleted file mode 100644
index 7667d10..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbComponent.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.Map;
-
-import com.mongodb.Mongo;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.util.CamelContextHelper;
-
-/**
- * Represents the component that manages {@link MongoDbEndpoint}.
- */
-public class MongoDbComponent extends DefaultComponent {
-
- /**
- * Should access a singleton of type Mongo
- */
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- Mongo db = CamelContextHelper.mandatoryLookup(getCamelContext(), remaining, Mongo.class);
-
- Endpoint endpoint = new MongoDbEndpoint(uri, this);
- parameters.put("mongoConnection", db);
- setProperties(endpoint, parameters);
-
- return endpoint;
- }
-
- public static CamelMongoDbException wrapInCamelMongoDbException(Throwable t) {
- if (t instanceof CamelMongoDbException) {
- return (CamelMongoDbException) t;
- } else {
- return new CamelMongoDbException(t);
- }
- }
-
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbConstants.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbConstants.java
deleted file mode 100644
index bb6d11a..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbConstants.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-public final class MongoDbConstants {
-
- public static final String OPERATION_HEADER = "CamelMongoDbOperation";
- public static final String RESULT_TOTAL_SIZE = "CamelMongoDbResultTotalSize";
- public static final String RESULT_PAGE_SIZE = "CamelMongoDbResultPageSize";
- public static final String FIELDS_FILTER = "CamelMongoDbFieldsFilter";
- public static final String BATCH_SIZE = "CamelMongoDbBatchSize";
- public static final String NUM_TO_SKIP = "CamelMongoDbNumToSkip";
- public static final String INSERT_RECORDS_AFFECTED = "CamelMongoDbInsertRecordsAffected";
- public static final String LAST_ERROR = "CamelMongoDbLastError";
- public static final String MULTIUPDATE = "CamelMongoDbMultiUpdate";
- public static final String UPSERT = "CamelMongoDbUpsert";
- public static final String RECORDS_AFFECTED = "CamelMongoDbRecordsAffected";
- public static final String SORT_BY = "CamelMongoDbSortBy";
- public static final String DATABASE = "CamelMongoDbDatabase";
- public static final String COLLECTION = "CamelMongoDbCollection";
- public static final String WRITECONCERN = "CamelMongoDbWriteConcern";
- public static final String LIMIT = "CamelMongoDbLimit";
- public static final String FROM_TAILABLE = "CamelMongoDbTailable";
-
- private MongoDbConstants() { }
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbConsumerType.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbConsumerType.java
deleted file mode 100644
index 4d012df..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbConsumerType.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-public enum MongoDbConsumerType {
-
- tailable
- // more consumer types to be included in future versions
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
deleted file mode 100644
index 01bf25d..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.Mongo;
-import com.mongodb.ReadPreference;
-import com.mongodb.WriteConcern;
-import com.mongodb.WriteResult;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultExchange;
-import org.apache.camel.impl.DefaultMessage;
-import org.apache.camel.util.ObjectHelper;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents a MongoDb endpoint.
- * It is responsible for creating {@link MongoDbProducer} and {@link MongoDbTailableCursorConsumer} instances.
- * It accepts a number of options to customise the behaviour of consumers and producers.
- */
-public class MongoDbEndpoint extends DefaultEndpoint {
-
- private static final Logger LOG = LoggerFactory.getLogger(MongoDbEndpoint.class);
- private Mongo mongoConnection;
- private String database;
- private String collection;
- private MongoDbOperation operation;
- private boolean createCollection = true;
- private boolean invokeGetLastError; // = false
- private WriteConcern writeConcern;
- private WriteConcern writeConcernRef;
- private ReadPreference readPreference;
- private boolean dynamicity; // = false
- // tailable cursor consumer by default
- private MongoDbConsumerType consumerType;
- private long cursorRegenerationDelay = 1000L;
- private String tailTrackIncreasingField;
-
- // persitent tail tracking
- private boolean persistentTailTracking; // = false;
- private String persistentId;
- private String tailTrackDb;
- private String tailTrackCollection;
- private String tailTrackField;
-
- private MongoDbTailTrackingConfig tailTrackingConfig;
-
- private DBCollection dbCollection;
- private DB db;
-
- // ======= Constructors ===============================================
-
- public MongoDbEndpoint() {
- }
-
- public MongoDbEndpoint(String uri, MongoDbComponent component) {
- super(uri, component);
- }
-
- @SuppressWarnings("deprecation")
- public MongoDbEndpoint(String endpointUri) {
- super(endpointUri);
- }
-
- // ======= Implementation methods =====================================
-
- public Producer createProducer() throws Exception {
- validateOptions('P');
- initializeConnection();
- return new MongoDbProducer(this);
- }
-
- public Consumer createConsumer(Processor processor) throws Exception {
- validateOptions('C');
- // we never create the collection
- createCollection = false;
- initializeConnection();
-
- // select right consumer type
- if (consumerType == null) {
- consumerType = MongoDbConsumerType.tailable;
- }
-
- Consumer consumer = null;
- if (consumerType == MongoDbConsumerType.tailable) {
- consumer = new MongoDbTailableCursorConsumer(this, processor);
- } else {
- throw new CamelMongoDbException("Consumer type not supported: " + consumerType);
- }
-
- return consumer;
- }
-
- private void validateOptions(char role) throws IllegalArgumentException {
- // make our best effort to validate, options with defaults are checked against their defaults, which is not always a guarantee that
- // they haven't been explicitly set, but it is enough
- if (role == 'P') {
- if (!ObjectHelper.isEmpty(consumerType) || persistentTailTracking || !ObjectHelper.isEmpty(tailTrackDb)
- || !ObjectHelper.isEmpty(tailTrackCollection) || !ObjectHelper.isEmpty(tailTrackField) || cursorRegenerationDelay != 1000L) {
- throw new IllegalArgumentException("consumerType, tailTracking, cursorRegenerationDelay options cannot appear on a producer endpoint");
- }
- } else if (role == 'C') {
- if (!ObjectHelper.isEmpty(operation) || !ObjectHelper.isEmpty(writeConcern) || writeConcernRef != null
- || readPreference != null || dynamicity || invokeGetLastError) {
- throw new IllegalArgumentException("operation, writeConcern, writeConcernRef, readPreference, dynamicity, invokeGetLastError "
- + "options cannot appear on a consumer endpoint");
- }
-
- if (consumerType == MongoDbConsumerType.tailable) {
- if (tailTrackIncreasingField == null) {
- throw new IllegalArgumentException("tailTrackIncreasingField option must be set for tailable cursor MongoDB consumer endpoint");
- }
- if (persistentTailTracking && (ObjectHelper.isEmpty(persistentId))) {
- throw new IllegalArgumentException("persistentId is compulsory for persistent tail tracking");
- }
- }
-
- } else {
- throw new IllegalArgumentException("Unknown endpoint role");
- }
- }
-
- public boolean isSingleton() {
- return true;
- }
-
- /**
- * Initialises the MongoDB connection using the Mongo object provided to the endpoint
- * @throws CamelMongoDbException
- */
- public void initializeConnection() throws CamelMongoDbException {
- LOG.info("Initialising MongoDb endpoint: {}", this.toString());
- if (database == null || collection == null) {
- throw new CamelMongoDbException("Missing required endpoint configuration: database and/or collection");
- }
- db = mongoConnection.getDB(database);
- if (db == null) {
- throw new CamelMongoDbException("Could not initialise MongoDbComponent. Database " + database + " does not exist.");
- }
- if (!createCollection && !db.collectionExists(collection)) {
- throw new CamelMongoDbException("Could not initialise MongoDbComponent. Collection " + collection + " and createCollection is false.");
- }
- dbCollection = db.getCollection(collection);
-
- LOG.info("MongoDb component initialised and endpoint bound to MongoDB collection with the following paramters. Address list: {}, Db: {}, Collection: {}",
- new Object[] {mongoConnection.getAllAddress().toString(), db.getName(), dbCollection.getName()});
- }
-
- /**
- * Applies validation logic specific to this endpoint type. If everything succeeds, continues initialization
- */
- @Override
- protected void doStart() throws Exception {
- if (writeConcern != null && writeConcernRef != null) {
- LOG.error("Cannot set both writeConcern and writeConcernRef at the same time. Respective values: {}, {}. "
- + "Aborting initialization.", new Object[] {writeConcern, writeConcernRef});
- throw new IllegalArgumentException("Cannot set both writeConcern and writeConcernRef at the same time on MongoDB endpoint");
- }
-
- setWriteReadOptionsOnConnection();
- super.doStart();
- }
-
- public Exchange createMongoDbExchange(DBObject dbObj) {
- Exchange exchange = new DefaultExchange(this.getCamelContext(), getExchangePattern());
- Message message = new DefaultMessage();
- message.setHeader(MongoDbConstants.DATABASE, database);
- message.setHeader(MongoDbConstants.COLLECTION, collection);
- message.setHeader(MongoDbConstants.FROM_TAILABLE, true);
-
- message.setBody(dbObj);
- exchange.setIn(message);
- return exchange;
- }
-
- private void setWriteReadOptionsOnConnection() {
- // Set the WriteConcern
- if (writeConcern != null) {
- mongoConnection.setWriteConcern(writeConcern);
- } else if (writeConcernRef != null) {
- mongoConnection.setWriteConcern(writeConcernRef);
- }
-
- // Set the ReadPreference
- if (readPreference != null) {
- mongoConnection.setReadPreference(readPreference);
- }
- }
-
-
- // ======= Getters and setters ===============================================
-
- /**
- * Sets the name of the MongoDB collection to bind to this endpoint
- * @param collection collection name
- */
- public void setCollection(String collection) {
- this.collection = collection;
- }
-
- public String getCollection() {
- return collection;
- }
-
- /**
- * Sets the operation this endpoint will execute against MongoDB. For possible values, see {@link MongoDbOperation}.
- * @param operation name of the operation as per catalogued values
- * @throws CamelMongoDbException
- */
- public void setOperation(String operation) throws CamelMongoDbException {
- try {
- this.operation = MongoDbOperation.valueOf(operation);
- } catch (IllegalArgumentException e) {
- throw new CamelMongoDbException("Operation not supported", e);
- }
- }
-
- public MongoDbOperation getOperation() {
- return operation;
- }
-
- /**
- * Sets the name of the MongoDB database to target
- * @param database name of the MongoDB database
- */
- public void setDatabase(String database) {
- this.database = database;
- }
-
- public String getDatabase() {
- return database;
- }
-
- /**
- * Create collection during initialisation if it doesn't exist. Default is true.
- * @param createCollection true or false
- */
- public void setCreateCollection(boolean createCollection) {
- this.createCollection = createCollection;
- }
-
- public boolean isCreateCollection() {
- return createCollection;
- }
-
- public DB getDb() {
- return db;
- }
-
- public DBCollection getDbCollection() {
- return dbCollection;
- }
-
- /**
- * Sets the Mongo instance that represents the backing connection
- * @param mongoConnection the connection to the database
- */
- public void setMongoConnection(Mongo mongoConnection) {
- this.mongoConnection = mongoConnection;
- }
-
- public Mongo getMongoConnection() {
- return mongoConnection;
- }
-
- /**
- * Set the {@link WriteConcern} for write operations on MongoDB using the standard ones.
- * Resolved from the fields of the WriteConcern class by calling the {@link WriteConcern#valueOf(String)} method.
- * @param writeConcern the standard name of the WriteConcern
- * @see <a href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html#valueOf(java.lang.String)">possible options</a>
- */
- public void setWriteConcern(String writeConcern) {
- this.writeConcern = WriteConcern.valueOf(writeConcern);
- }
-
- public WriteConcern getWriteConcern() {
- return writeConcern;
- }
-
- /**
- * Instructs this endpoint to invoke {@link WriteResult#getLastError()} with every operation. By default, MongoDB does not wait
- * for the write operation to occur before returning. If set to true, each exchange will only return after the write operation
- * has actually occurred in MongoDB.
- * @param invokeGetLastError true or false
- */
- public void setInvokeGetLastError(boolean invokeGetLastError) {
- this.invokeGetLastError = invokeGetLastError;
- }
-
- public boolean isInvokeGetLastError() {
- return invokeGetLastError;
- }
-
- /**
- * Set the {@link WriteConcern} for write operations on MongoDB, passing in the bean ref to a custom WriteConcern which exists in the Registry.
- * You can also use standard WriteConcerns by passing in their key. See the {@link #setWriteConcern(String) setWriteConcern} method.
- * @param writeConcernRef the name of the bean in the registry that represents the WriteConcern to use
- */
- public void setWriteConcernRef(String writeConcernRef) {
- WriteConcern wc = this.getCamelContext().getRegistry().lookup(writeConcernRef, WriteConcern.class);
- if (wc == null) {
- LOG.error("Camel MongoDB component could not find the WriteConcern in the Registry. Verify that the "
- + "provided bean name ({}) is correct. Aborting initialization.", writeConcernRef);
- throw new IllegalArgumentException("Camel MongoDB component could not find the WriteConcern in the Registry");
- }
-
- this.writeConcernRef = wc;
- }
-
- public WriteConcern getWriteConcernRef() {
- return writeConcernRef;
- }
-
- /**
- * Sets a MongoDB {@link ReadPreference} on the Mongo connection. Read preferences set directly on the connection will be
- * overridden by this setting.
- * @param readPreference the bean name of the read preference to set
- */
- public void setReadPreference(String readPreference) {
- Class<?>[] innerClasses = ReadPreference.class.getDeclaredClasses();
- for (Class<?> inClass : innerClasses) {
- if (inClass.getSuperclass() == ReadPreference.class && inClass.getName().equals(readPreference)) {
- try {
- this.readPreference = (ReadPreference) inClass.getConstructor((Class<?>) null).newInstance((Object[]) null);
- } catch (Exception e) {
- continue;
- }
- break;
- }
- }
-
- LOG.error("Could not resolve specified ReadPreference of type {}. Read preferences are resolved from inner "
- + "classes of com.mongodb.ReadPreference.", readPreference);
- throw new IllegalArgumentException("MongoDB endpoint could not resolve specified ReadPreference");
- }
-
- public ReadPreference getReadPreference() {
- return readPreference;
- }
-
- /**
- * Sets whether this endpoint will attempt to dynamically resolve the target database and collection from the incoming Exchange properties.
- * Can be used to override at runtime the database and collection specified on the otherwise static endpoint URI.
- * It is disabled by default to boost performance. Enabling it will take a minimal performance hit.
- * @see MongoDbConstants#DATABASE
- * @see MongoDbConstants#COLLECTION
- * @param dynamicity true or false indicated whether target database and collection should be calculated dynamically based on Exchange properties.
- */
- public void setDynamicity(boolean dynamicity) {
- this.dynamicity = dynamicity;
- }
-
- public boolean isDynamicity() {
- return dynamicity;
- }
-
- /**
- * Reserved for future use, when more consumer types are supported.
- * @param consumerType key of the consumer type
- * @throws CamelMongoDbException
- */
- public void setConsumerType(String consumerType) throws CamelMongoDbException {
- try {
- this.consumerType = MongoDbConsumerType.valueOf(consumerType);
- } catch (IllegalArgumentException e) {
- throw new CamelMongoDbException("Consumer type not supported", e);
- }
- }
-
- public MongoDbConsumerType getConsumerType() {
- return consumerType;
- }
-
- public String getTailTrackDb() {
- return tailTrackDb;
- }
-
- /**
- * Indicates what database the tail tracking mechanism will persist to. If not specified, the current database will
- * be picked by default. Dynamicity will not be taken into account even if enabled, i.e. the tail tracking database
- * will not vary past endpoint initialisation.
- * @param tailTrackDb database name
- */
- public void setTailTrackDb(String tailTrackDb) {
- this.tailTrackDb = tailTrackDb;
- }
-
- public String getTailTrackCollection() {
- return tailTrackCollection;
- }
-
- /**
- * Collection where tail tracking information will be persisted. If not specified, {@link MongoDbTailTrackingConfig#DEFAULT_COLLECTION}
- * will be used by default.
- * @param tailTrackCollection collection name
- */
- public void setTailTrackCollection(String tailTrackCollection) {
- this.tailTrackCollection = tailTrackCollection;
- }
-
- public String getTailTrackField() {
- return tailTrackField;
- }
-
- /**
- * Field where the last tracked value will be placed. If not specified, {@link MongoDbTailTrackingConfig#DEFAULT_FIELD}
- * will be used by default.
- * @param tailTrackField field name
- */
- public void setTailTrackField(String tailTrackField) {
- this.tailTrackField = tailTrackField;
- }
-
- /**
- * Enable persistent tail tracking, which is a mechanism to keep track of the last consumed message across system restarts.
- * The next time the system is up, the endpoint will recover the cursor from the point where it last stopped slurping records.
- * @param persistentTailTracking true or false
- */
- public void setPersistentTailTracking(boolean persistentTailTracking) {
- this.persistentTailTracking = persistentTailTracking;
- }
-
- public boolean isPersistentTailTracking() {
- return persistentTailTracking;
- }
-
- /**
- * Correlation field in the incoming record which is of increasing nature and will be used to position the tailing cursor every
- * time it is generated.
- * The cursor will be (re)created with a query of type: tailTrackIncreasingField > lastValue (possibly recovered from persistent
- * tail tracking).
- * Can be of type Integer, Date, String, etc.
- * NOTE: No support for dot notation at the current time, so the field should be at the top level of the document.
- * @param tailTrackIncreasingField
- */
- public void setTailTrackIncreasingField(String tailTrackIncreasingField) {
- this.tailTrackIncreasingField = tailTrackIncreasingField;
- }
-
- public String getTailTrackIncreasingField() {
- return tailTrackIncreasingField;
- }
-
- public MongoDbTailTrackingConfig getTailTrackingConfig() {
- if (tailTrackingConfig == null) {
- tailTrackingConfig = new MongoDbTailTrackingConfig(persistentTailTracking, tailTrackIncreasingField,
- tailTrackDb == null ? database : tailTrackDb, tailTrackCollection, tailTrackField, getPersistentId());
- }
- return tailTrackingConfig;
- }
-
- /**
- * MongoDB tailable cursors will block until new data arrives. If no new data is inserted, after some time the cursor will be automatically
- * freed and closed by the MongoDB server. The client is expected to regenerate the cursor if needed. This value specifies the time to wait
- * before attempting to fetch a new cursor, and if the attempt fails, how long before the next attempt is made. Default value is 1000ms.
- * @param cursorRegenerationDelay delay specified in milliseconds
- */
- public void setCursorRegenerationDelay(long cursorRegenerationDelay) {
- this.cursorRegenerationDelay = cursorRegenerationDelay;
- }
-
- public long getCursorRegenerationDelay() {
- return cursorRegenerationDelay;
- }
-
- /**
- * One tail tracking collection can host many trackers for several tailable consumers.
- * To keep them separate, each tracker should have its own unique persistentId.
- * @param persistentId the value of the persistent ID to use for this tailable consumer
- */
- public void setPersistentId(String persistentId) {
- this.persistentId = persistentId;
- }
-
- public String getPersistentId() {
- return persistentId;
- }
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbOperation.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbOperation.java
deleted file mode 100644
index 5cfd23f..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbOperation.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-public enum MongoDbOperation {
-
- // read operations
- findById,
- findOneByQuery,
- findAll,
- // group, // future
- // mapReduce, // future
-
- // create/update operations
- insert,
- save,
- update,
-
- // delete operations
- remove,
-
- // others
- getDbStats,
- getColStats,
- count,
-
-}
\ No newline at end of file
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java
deleted file mode 100644
index 2bfb874..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbProducer.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.CommandResult;
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBCursor;
-import com.mongodb.DBObject;
-import com.mongodb.WriteConcern;
-import com.mongodb.WriteResult;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.TypeConverter;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.ObjectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The MongoDb producer.
- */
-public class MongoDbProducer extends DefaultProducer {
- private static final transient Logger LOG = LoggerFactory.getLogger(MongoDbProducer.class);
- private MongoDbEndpoint endpoint;
-
- public MongoDbProducer(MongoDbEndpoint endpoint) {
- super(endpoint);
- this.endpoint = endpoint;
- }
-
- public void process(Exchange exchange) throws Exception {
- MongoDbOperation operation = endpoint.getOperation();
- Object header = exchange.getIn().getHeader(MongoDbConstants.OPERATION_HEADER);
- if (header != null) {
- LOG.debug("Overriding default operation with operation specified on header: {}", header);
- try {
- if (header instanceof MongoDbOperation) {
- operation = ObjectHelper.cast(MongoDbOperation.class, header);
- } else {
- // evaluate as a String
- operation = MongoDbOperation.valueOf(exchange.getIn().getHeader(MongoDbConstants.OPERATION_HEADER, String.class));
- }
- } catch (Exception e) {
- throw new CamelMongoDbException("Operation specified on header is not supported. Value: " + header, e);
- }
- }
-
- try {
- invokeOperation(operation, exchange);
- } catch (Exception e) {
- throw MongoDbComponent.wrapInCamelMongoDbException(e);
- }
-
- }
-
- /**
- * Entry method that selects the appropriate MongoDB operation and executes it
- * @param operation
- * @param exchange
- * @throws Exception
- */
- protected void invokeOperation(MongoDbOperation operation, Exchange exchange) throws Exception {
- switch (operation) {
- case count:
- doCount(exchange);
- break;
-
- case findOneByQuery:
- doFindOneByQuery(exchange);
- break;
-
- case findById:
- doFindById(exchange);
- break;
-
- case findAll:
- doFindAll(exchange);
- break;
-
- case insert:
- doInsert(exchange);
- break;
-
- case save:
- doSave(exchange);
- break;
-
- case update:
- doUpdate(exchange);
- break;
-
- case remove:
- doRemove(exchange);
- break;
-
- case getDbStats:
- doGetStats(exchange, 'D');
- break;
-
- case getColStats:
- doGetStats(exchange, 'C');
- break;
-
- default:
- throw new CamelMongoDbException("Operation not supported. Value: " + operation);
- }
- }
-
- // ----------- MongoDB operations ----------------
-
- protected void doGetStats(Exchange exchange, char c) {
- DBObject result = null;
-
- if (c == 'C') {
- result = calculateCollection(exchange).getStats();
- } else if (c == 'D') {
- // if it's a DB, also take into account the dynamicity option and the DB that is used
- result = calculateCollection(exchange).getDB().getStats();
- }
-
- exchange.getOut().setBody(result);
- }
-
- protected void doRemove(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- DBObject removeObj = exchange.getIn().getMandatoryBody(DBObject.class);
-
- WriteConcern wc = extractWriteConcern(exchange);
- WriteResult result = wc == null ? dbCol.remove(removeObj) : dbCol.remove(removeObj, wc);
- processWriteResult(result, exchange);
-
- Message out = exchange.getOut();
- // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
- // obtain the cached CommandResult
- out.setBody(result);
- out.setHeader(MongoDbConstants.RECORDS_AFFECTED, result.getN());
- }
-
- @SuppressWarnings("unchecked")
- protected void doUpdate(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- List<DBObject> saveObj = exchange.getIn().getMandatoryBody((Class<List<DBObject>>) (Class<?>) List.class);
- if (saveObj.size() != 2) {
- throw new CamelMongoDbException("MongoDB operation = insert, failed because body is not a List of DBObject objects with size = 2");
- }
-
- DBObject updateCriteria = saveObj.get(0);
- DBObject objNew = saveObj.get(1);
-
- Boolean multi = exchange.getIn().getHeader(MongoDbConstants.MULTIUPDATE, Boolean.class);
- Boolean upsert = exchange.getIn().getHeader(MongoDbConstants.UPSERT, Boolean.class);
-
- WriteResult result;
- WriteConcern wc = extractWriteConcern(exchange);
- // In API 2.7, the default upsert and multi values of update(DBObject, DBObject) are false, false, so we unconditionally invoke the
- // full-signature method update(DBObject, DBObject, boolean, boolean). However, the default behaviour may change in the future,
- // so it's safer to be explicit at this level for full determinism
- if (multi == null && upsert == null) {
- // for update with no multi nor upsert but with specific WriteConcern there is no update signature without multi and upsert args,
- // so assume defaults
- result = wc == null ? dbCol.update(updateCriteria, objNew) : dbCol.update(updateCriteria, objNew, false, false, wc);
- } else {
- // we calculate the final boolean values so that if any of these parameters is null, it is resolved to false
- result = wc == null ? dbCol.update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi))
- : dbCol.update(updateCriteria, objNew, calculateBooleanValue(upsert), calculateBooleanValue(multi), wc);
- }
-
- processWriteResult(result, exchange);
- Message out = exchange.getOut();
- // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
- // obtain the cached CommandResult
- out.setBody(result);
- out.setHeader(MongoDbConstants.RECORDS_AFFECTED, result.getN());
- }
-
- protected void doSave(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- DBObject saveObj = exchange.getIn().getMandatoryBody(DBObject.class);
-
- WriteConcern wc = extractWriteConcern(exchange);
- WriteResult result = wc == null ? dbCol.save(saveObj) : dbCol.save(saveObj, wc);
- processWriteResult(result, exchange);
- // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
- // obtain the cached CommandResult
- exchange.getOut().setBody(result);
- }
-
- protected void doFindById(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- Object o = exchange.getIn().getMandatoryBody();
- DBObject ret;
-
- DBObject fieldFilter = exchange.getIn().getHeader(MongoDbConstants.FIELDS_FILTER, DBObject.class);
- if (fieldFilter == null) {
- ret = dbCol.findOne(o);
- } else {
- ret = dbCol.findOne(o, fieldFilter);
- }
-
- Message out = exchange.getOut();
- out.setBody(ret);
- out.setHeader(MongoDbConstants.RESULT_TOTAL_SIZE, ret == null ? 0 : 1);
-
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected void doInsert(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- boolean singleInsert = true;
- Object insert = exchange.getIn().getBody(DBObject.class);
- // body could not be converted to DBObject, check to see if it's of type List<DBObject>
- if (insert == null) {
- insert = exchange.getIn().getBody(List.class);
- // if the body of type List was obtained, ensure that all items are of type DBObject and cast the List to List<DBObject>
- if (insert != null) {
- singleInsert = false;
- insert = attemptConvertToList((List) insert, exchange);
- } else {
- throw new CamelMongoDbException("MongoDB operation = insert, Body is not conversible to type DBObject nor List<DBObject>");
- }
- }
-
- WriteResult result;
- WriteConcern wc = extractWriteConcern(exchange);
- if (singleInsert) {
- result = wc == null ? dbCol.insert((DBObject) insert) : dbCol.insert((DBObject) insert, wc);
- } else {
- result = wc == null ? dbCol.insert((List<DBObject>) insert) : dbCol.insert((List<DBObject>) insert, wc);
- }
-
- processWriteResult(result, exchange);
-
- // we always return the WriteResult, because whether the getLastError was called or not, the user will have the means to call it or
- // obtain the cached CommandResult
- exchange.getOut().setBody(result);
- }
-
- protected void doFindAll(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- // do not use getMandatoryBody, because if the body is empty we want to retrieve all objects in the collection
- DBObject query = null;
- // do not run around looking for a type converter unless there is a need for it
- if (exchange.getIn().getBody() != null) {
- query = exchange.getIn().getBody(DBObject.class);
- }
- DBObject fieldFilter = exchange.getIn().getHeader(MongoDbConstants.FIELDS_FILTER, DBObject.class);
-
- // get the batch size and number to skip
- Integer batchSize = exchange.getIn().getHeader(MongoDbConstants.BATCH_SIZE, Integer.class);
- Integer numToSkip = exchange.getIn().getHeader(MongoDbConstants.NUM_TO_SKIP, Integer.class);
- Integer limit = exchange.getIn().getHeader(MongoDbConstants.LIMIT, Integer.class);
- DBObject sortBy = exchange.getIn().getHeader(MongoDbConstants.SORT_BY, DBObject.class);
- DBCursor ret = null;
- try {
- if (query == null && fieldFilter == null) {
- ret = dbCol.find(new BasicDBObject());
- } else if (fieldFilter == null) {
- ret = dbCol.find(query);
- } else {
- ret = dbCol.find(query, fieldFilter);
- }
-
- if (sortBy != null) {
- ret.sort(sortBy);
- }
-
- if (batchSize != null) {
- ret.batchSize(batchSize.intValue());
- }
-
- if (numToSkip != null) {
- ret.skip(numToSkip.intValue());
- }
-
- if (limit != null) {
- ret.limit(limit.intValue());
- }
-
- Message out = exchange.getOut();
- out.setBody(ret.toArray());
- out.setHeader(MongoDbConstants.RESULT_TOTAL_SIZE, ret.count());
- out.setHeader(MongoDbConstants.RESULT_PAGE_SIZE, ret.size());
-
- } catch (Exception e) {
- // rethrow the exception
- throw e;
- } finally {
- // make sure the cursor is closed
- if (ret != null) {
- ret.close();
- }
- }
-
- }
-
- protected void doFindOneByQuery(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- DBObject o = exchange.getIn().getMandatoryBody(DBObject.class);
- DBObject ret;
-
- DBObject fieldFilter = exchange.getIn().getHeader(MongoDbConstants.FIELDS_FILTER, DBObject.class);
- if (fieldFilter == null) {
- ret = dbCol.findOne(o);
- } else {
- ret = dbCol.findOne(o, fieldFilter);
- }
-
- Message out = exchange.getOut();
- out.setBody(ret);
- out.setHeader(MongoDbConstants.RESULT_TOTAL_SIZE, ret == null ? 0 : 1);
- }
-
- protected void doCount(Exchange exchange) throws Exception {
- DBCollection dbCol = calculateCollection(exchange);
- Long answer = Long.valueOf(dbCol.count());
- exchange.getOut().setBody(answer);
- }
-
- // --------- Convenience methods -----------------------
-
- private DBCollection calculateCollection(Exchange exchange) {
- // dynamic calculation is an option. In most cases it won't be used and we should not penalise all users with running this
- // resolution logic on every Exchange if they won't be using this functionality at all
- if (!endpoint.isDynamicity()) {
- return endpoint.getDbCollection();
- }
-
- String dynamicDB = exchange.getIn().getHeader(MongoDbConstants.DATABASE, String.class);
- String dynamicCollection = exchange.getIn().getHeader(MongoDbConstants.COLLECTION, String.class);
-
- if (dynamicDB == null && dynamicCollection == null) {
- return endpoint.getDbCollection();
- }
-
- DB db = endpoint.getDb();
- DBCollection dbCol = null;
-
- if (dynamicDB != null) {
- db = endpoint.getMongoConnection().getDB(dynamicDB);
- }
-
- dbCol = dynamicCollection == null ? db.getCollection(endpoint.getCollection()) : db.getCollection(dynamicCollection);
- LOG.debug("Dynamic database and/or collection selected: {}->{}", dbCol.getDB().getName(), dbCol.getName());
- return dbCol;
- }
-
- private boolean calculateBooleanValue(Boolean b) {
- return b == null ? false : b.booleanValue();
- }
-
- private void processWriteResult(WriteResult result, Exchange exchange) {
- // if invokeGetLastError is set, or a WriteConcern is set which implicitly calls getLastError, then we have the chance to populate
- // the MONGODB_LAST_ERROR header, as well as setting an exception on the Exchange if one occurred at the MongoDB server
- if (endpoint.isInvokeGetLastError() || (endpoint.getWriteConcern() != null ? endpoint.getWriteConcern().callGetLastError() : false)) {
- CommandResult cr = result.getCachedLastError() == null ? result.getLastError() : result.getCachedLastError();
- exchange.getOut().setHeader(MongoDbConstants.LAST_ERROR, cr);
- if (!cr.ok()) {
- exchange.setException(MongoDbComponent.wrapInCamelMongoDbException(cr.getException()));
- }
- }
- }
-
- private WriteConcern extractWriteConcern(Exchange exchange) throws CamelMongoDbException {
- Object o = exchange.getIn().getHeader(MongoDbConstants.WRITECONCERN);
-
- if (o == null) {
- return null;
- } else if (o instanceof WriteConcern) {
- return ObjectHelper.cast(WriteConcern.class, o);
- } else if (o instanceof String) {
- WriteConcern answer = WriteConcern.valueOf(ObjectHelper.cast(String.class, o));
- if (answer == null) {
- throw new CamelMongoDbException("WriteConcern specified in the " + MongoDbConstants.WRITECONCERN
- + " header, with value " + o + " could not be resolved to a WriteConcern type");
- }
- }
-
- // should never get here
- LOG.warn("A problem occurred while resolving the Exchange's Write Concern");
- return null;
- }
-
- @SuppressWarnings("rawtypes")
- private List<DBObject> attemptConvertToList(List insertList, Exchange exchange) throws CamelMongoDbException {
- List<DBObject> dbObjectList = new ArrayList<DBObject>(insertList.size());
- TypeConverter converter = exchange.getContext().getTypeConverter();
- for (Object item : insertList) {
- try {
- DBObject dbObject = converter.mandatoryConvertTo(DBObject.class, item);
- dbObjectList.add(dbObject);
- } catch (Exception e) {
- throw new CamelMongoDbException("MongoDB operation = insert, Assuming List variant of MongoDB insert operation, but List contains non-DBObject items", e);
- }
- }
- return dbObjectList;
- }
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingConfig.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingConfig.java
deleted file mode 100644
index 7b998f5..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingConfig.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-public class MongoDbTailTrackingConfig {
-
- public static final String DEFAULT_COLLECTION = "camelTailTracking";
- public static final String DEFAULT_FIELD = "lastTrackingValue";
-
- /**
- * See {@link MongoDbEndpoint#setTailTrackIncreasingField(String)}
- */
- public final String increasingField;
- /**
- * See {@link MongoDbEndpoint#setPersistentTailTracking(boolean)}
- */
- public final boolean persistent;
- /**
- * See {@link MongoDbEndpoint#setTailTrackDb(String)}
- */
- public final String db;
- /**
- * See {@link MongoDbEndpoint#setTailTrackCollection(String)}
- */
- public final String collection;
- /**
- * See {@link MongoDbEndpoint#setTailTrackField(String)}
- */
- public final String field;
- /**
- * See {@link MongoDbEndpoint#setPersistentId(String)}
- */
- public final String persistentId;
-
- public MongoDbTailTrackingConfig(boolean persistentTailTracking, String tailTrackIncreasingField, String tailTrackDb,
- String tailTrackCollection, String tailTrackField, String persistentId) {
- this.increasingField = tailTrackIncreasingField;
- this.persistent = persistentTailTracking;
- this.db = tailTrackDb;
- this.persistentId = persistentId;
- this.collection = tailTrackCollection == null ? MongoDbTailTrackingConfig.DEFAULT_COLLECTION : tailTrackCollection;
- this.field = tailTrackField == null ? MongoDbTailTrackingConfig.DEFAULT_FIELD : tailTrackField;
- }
-}
\ No newline at end of file
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java
deleted file mode 100644
index a8bf157..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailTrackingManager.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.BasicDBObjectBuilder;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.Mongo;
-import com.mongodb.WriteConcern;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MongoDbTailTrackingManager {
-
- private static final Logger LOG = LoggerFactory.getLogger(MongoDbTailTrackingManager.class);
-
- public Object lastVal;
-
- private final Mongo connection;
- private final MongoDbTailTrackingConfig config;
- private DBCollection dbCol;
- private DBObject trackingObj;
-
- public MongoDbTailTrackingManager(Mongo connection, MongoDbTailTrackingConfig config) {
- this.connection = connection;
- this.config = config;
- }
-
- public void initialize() throws Exception {
- if (!config.persistent) {
- return;
- }
-
- dbCol = connection.getDB(config.db).getCollection(config.collection);
- DBObject filter = new BasicDBObject("persistentId", config.persistentId);
- trackingObj = dbCol.findOne(filter);
- if (trackingObj == null) {
- dbCol.insert(filter, WriteConcern.SAFE);
- trackingObj = dbCol.findOne();
- }
- // keep only the _id, the rest is useless and causes more overhead during update
- trackingObj = new BasicDBObject("_id", trackingObj.get("_id"));
- }
-
- public synchronized void persistToStore() {
- if (!config.persistent || lastVal == null) {
- return;
- }
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Persisting lastVal={} to store, collection: {}", lastVal, config.collection);
- }
-
- DBObject updateObj = BasicDBObjectBuilder.start().add("$set", new BasicDBObject(config.field, lastVal)).get();
- dbCol.update(trackingObj, updateObj, false, false, WriteConcern.SAFE);
- trackingObj = dbCol.findOne();
- }
-
- public synchronized Object recoverFromStore() {
- if (!config.persistent) {
- return null;
- }
-
- lastVal = dbCol.findOne(trackingObj).get(config.field);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Recovered lastVal={} from store, collection: {}", lastVal, config.collection);
- }
-
- return lastVal;
- }
-
- public void setLastVal(DBObject o) {
- if (config.increasingField == null) {
- return;
- }
-
- lastVal = o.get(config.increasingField);
- }
-
- public String getIncreasingFieldName() {
- return config.increasingField;
- }
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java
deleted file mode 100644
index ca72bfc..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.concurrent.ExecutorService;
-
-import org.apache.camel.Processor;
-import org.apache.camel.impl.DefaultConsumer;
-
-/**
- * The MongoDb consumer.
- */
-public class MongoDbTailableCursorConsumer extends DefaultConsumer {
- private final MongoDbEndpoint endpoint;
- private ExecutorService executor;
- private MongoDbTailingProcess tailingProcess;
-
- public MongoDbTailableCursorConsumer(MongoDbEndpoint endpoint, Processor processor) {
- super(endpoint, processor);
- this.endpoint = endpoint;
- }
-
- @Override
- protected void doStop() throws Exception {
- super.doStop();
- if (tailingProcess != null) {
- tailingProcess.stop();
- }
- if (executor != null) {
- executor.shutdown();
- executor = null;
- }
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
- executor = endpoint.getCamelContext().getExecutorServiceManager().newFixedThreadPool(this, endpoint.getEndpointUri(), 1);
- MongoDbTailTrackingManager trackingManager = initTailTracking();
- tailingProcess = new MongoDbTailingProcess(endpoint, this, trackingManager);
- tailingProcess.initializeProcess();
- executor.execute(tailingProcess);
- }
-
- protected MongoDbTailTrackingManager initTailTracking() throws Exception {
- MongoDbTailTrackingManager answer = new MongoDbTailTrackingManager(endpoint.getMongoConnection(), endpoint.getTailTrackingConfig());
- answer.initialize();
- return answer;
- }
-
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
deleted file mode 100644
index 42cb4f1..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbTailingProcess.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * 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.
- */
-
-package org.apache.camel.component.mongodb;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.Bytes;
-import com.mongodb.DBCollection;
-import com.mongodb.DBCursor;
-import com.mongodb.DBObject;
-import com.mongodb.MongoException.CursorNotFound;
-
-import org.apache.camel.Exchange;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MongoDbTailingProcess implements Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(MongoDbTailingProcess.class);
- private static final String CAPPED_KEY = "capped";
-
- public volatile boolean keepRunning = true;
- public volatile boolean stopped; // = false
-
- private final DBCollection dbCol;
- private final MongoDbEndpoint endpoint;
- private final MongoDbTailableCursorConsumer consumer;
-
- // create local, final copies of these variables for increased performance
- private final long cursorRegenerationDelay;
- private final boolean cursorRegenerationDelayEnabled;
-
- private DBCursor cursor;
- private MongoDbTailTrackingManager tailTracking;
-
-
- public MongoDbTailingProcess(MongoDbEndpoint endpoint, MongoDbTailableCursorConsumer consumer, MongoDbTailTrackingManager tailTrack) {
- this.endpoint = endpoint;
- this.consumer = consumer;
- this.dbCol = endpoint.getDbCollection();
- this.tailTracking = tailTrack;
- this.cursorRegenerationDelay = endpoint.getCursorRegenerationDelay();
- this.cursorRegenerationDelayEnabled = !(this.cursorRegenerationDelay == 0);
- }
-
- public DBCursor getCursor() {
- return cursor;
- }
-
- /**
- * Initialise the tailing process, the cursor and if persistent tail tracking is enabled, recover the cursor from the persisted point.
- * As part of the initialisation process, the component will validate that the collection we are targeting is 'capped'.
- * @throws Exception
- */
- public void initializeProcess() throws Exception {
- if (LOG.isInfoEnabled()) {
- LOG.info("Starting MongoDB Tailable Cursor consumer, binding to collection: {}", "db: " + dbCol.getDB() + ", col: " + dbCol.getName());
- }
-
- if (dbCol.getStats().getInt(CAPPED_KEY) != 1) {
- throw new CamelMongoDbException("Tailable cursors are only compatible with capped collections, and collection " + dbCol.getName()
- + " is not capped");
- }
- try {
- // recover the last value from the store if it exists
- tailTracking.recoverFromStore();
- cursor = initializeCursor();
- } catch (Exception e) {
- throw new CamelMongoDbException("Exception ocurred while initializing tailable cursor", e);
- }
-
- if (cursor == null) {
- throw new CamelMongoDbException("Tailable cursor was not initialized, or cursor returned is dead on arrival");
- }
-
- }
-
- /**
- * The heart of the tailing process.
- */
- @Override
- public void run() {
- while (keepRunning) {
- doRun();
- // if the previous call didn't return because we have stopped running, then regenerate the cursor
- if (keepRunning) {
- cursor.close();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Regenerating cursor with lastVal: {}, waiting {}ms first", tailTracking.lastVal, cursorRegenerationDelay);
- }
-
- if (cursorRegenerationDelayEnabled) {
- try {
- Thread.sleep(cursorRegenerationDelay);
- } catch (InterruptedException e) {
- LOG.error("Thread was interrupted", e);
- }
- }
-
- cursor = initializeCursor();
- }
- }
-
- stopped = true;
- }
-
- protected void stop() throws Exception {
- if (LOG.isInfoEnabled()) {
- LOG.info("Stopping MongoDB Tailable Cursor consumer, bound to collection: {}", "db: " + dbCol.getDB() + ", col: " + dbCol.getName());
- }
- keepRunning = false;
- // close the cursor if it's open, so if it is blocked on hasNext() it will return immediately
- if (cursor != null) {
- cursor.close();
- }
- // wait until the main loop acknowledges the stop
- while (!stopped) { }
- if (LOG.isInfoEnabled()) {
- LOG.info("Stopped MongoDB Tailable Cursor consumer, bound to collection: {}", "db: " + dbCol.getDB() + ", col: " + dbCol.getName());
- }
- }
-
- /**
- * The heart of the tailing process.
- */
- private void doRun() {
- // while the cursor has more values, keepRunning is true and the cursorId is not 0, which symbolizes that the cursor is dead
- try {
- while (cursor.hasNext() && cursor.getCursorId() != 0 && keepRunning) {
- DBObject dbObj = cursor.next();
- Exchange exchange = endpoint.createMongoDbExchange(dbObj);
- try {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Sending exchange: {}, ObjectId: {}", exchange, dbObj.get("_id"));
- }
- consumer.getProcessor().process(exchange);
- } catch (Exception e) {
- // do nothing
- }
- tailTracking.setLastVal(dbObj);
- }
- } catch (CursorNotFound e) {
- // we only log the warning if we are not stopping, otherwise it is expected because the stop() method kills the cursor just in case it is blocked
- // waiting for more data to arrive
- if (keepRunning) {
- LOG.debug("Cursor not found exception from MongoDB, will regenerate cursor. This is normal behaviour with tailable cursors.", e);
- }
- }
-
- // the loop finished, persist the lastValue just in case we are shutting down
- // TODO: perhaps add a functionality to persist every N records
- tailTracking.persistToStore();
- }
-
- // no arguments, will ask DB what the last updated Id was (checking persistent storage)
- private DBCursor initializeCursor() {
- Object lastVal = tailTracking.lastVal;
- // lastVal can be null if we are initializing and there is no persistence enabled
- DBCursor answer;
- if (lastVal == null) {
- answer = dbCol.find().addOption(Bytes.QUERYOPTION_TAILABLE).addOption(Bytes.QUERYOPTION_AWAITDATA);
- } else {
- DBObject queryObj = new BasicDBObject(tailTracking.getIncreasingFieldName(), new BasicDBObject("$gt", lastVal));
- answer = dbCol.find(queryObj).addOption(Bytes.QUERYOPTION_TAILABLE).addOption(Bytes.QUERYOPTION_AWAITDATA);
- }
- return answer;
- }
-}
diff --git a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/converters/MongoDbBasicConverters.java b/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/converters/MongoDbBasicConverters.java
deleted file mode 100644
index bdb6b68..0000000
--- a/components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/converters/MongoDbBasicConverters.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb.converters;
-
-import java.util.Map;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBObject;
-import com.mongodb.util.JSON;
-
-import org.apache.camel.Converter;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({"rawtypes"})
-@Converter
-public final class MongoDbBasicConverters {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(MongoDbBasicConverters.class);
-
- // Jackson's ObjectMapper is thread-safe, so no need to create a pool nor synchronize access to it
- private static ObjectMapper objectMapper = new ObjectMapper();
-
- private MongoDbBasicConverters() { }
-
- @Converter
- public static DBObject fromMapToDBObject(Map<?, ?> map) {
- return new BasicDBObject(map);
- }
-
- @Converter
- public static Map<String, Object> fromBasicDBObjectToMap(BasicDBObject basicDbObject) {
- return basicDbObject;
- }
-
- @Converter
- public static DBObject fromStringToDBObject(String s) {
- DBObject answer = null;
- try {
- answer = (DBObject) JSON.parse(s);
- } catch (Exception e) {
- LOG.warn("String -> DBObject conversion selected, but the following exception occurred. Returning null.", e);
- }
-
- return answer;
- }
-
- @Converter
- public static DBObject fromAnyObjectToDBObject(Object value) {
- BasicDBObject answer;
- try {
- Map m = MongoDbBasicConverters.objectMapper.convertValue(value, Map.class);
- answer = new BasicDBObject(m);
- } catch (Exception e) {
- LOG.warn("Conversion has fallen back to generic Object -> DBObject, but unable to convert type {}. Returning null.",
- value.getClass().getCanonicalName());
- return null;
- }
- return answer;
- }
-
-}
diff --git a/components/camel-mongodb/src/main/resources/LICENSE.txt b/components/camel-mongodb/src/main/resources/LICENSE.txt
deleted file mode 100755
index 6b0b127..0000000
--- a/components/camel-mongodb/src/main/resources/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-mongodb/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-mongodb/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
deleted file mode 100644
index ca674e5..0000000
--- a/components/camel-mongodb/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-org.apache.camel.component.mongodb.converters.MongoDbBasicConverters
\ No newline at end of file
diff --git a/components/camel-mongodb/src/main/resources/META-INF/services/org/apache/camel/component/mongodb b/components/camel-mongodb/src/main/resources/META-INF/services/org/apache/camel/component/mongodb
deleted file mode 100644
index 13d523e..0000000
--- a/components/camel-mongodb/src/main/resources/META-INF/services/org/apache/camel/component/mongodb
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.component.mongodb.MongoDbComponent
diff --git a/components/camel-mongodb/src/main/resources/NOTICE.txt b/components/camel-mongodb/src/main/resources/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-mongodb/src/main/resources/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java
deleted file mode 100644
index 3de7212..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/AbstractMongoDbTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Formatter;
-import java.util.Properties;
-
-import com.mongodb.DB;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.Mongo;
-import com.mongodb.MongoURI;
-import com.mongodb.WriteConcern;
-import com.mongodb.util.JSON;
-
-import org.apache.camel.CamelExecutionException;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.ObjectHelper;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.springframework.context.ApplicationContext;
-
-public abstract class AbstractMongoDbTest extends CamelTestSupport {
-
- protected static Mongo mongo;
- protected static DB db;
- protected static DBCollection testCollection;
- protected static DBCollection dynamicCollection;
-
- protected static String dbName;
- protected static String testCollectionName;
- protected static String dynamicCollectionName;
-
- protected static Properties properties;
-
- protected ApplicationContext applicationContext;
-
-
- public AbstractMongoDbTest() {
- super();
- }
-
- /**
- * Checks whether Mongo is running using the connection URI defined in the mongodb.test.properties file
- * @throws IOException
- */
- @BeforeClass
- public static void checkMongoRunning() throws IOException {
- properties = new Properties();
- InputStream is = MongoDbConversionsTest.class.getResourceAsStream("/mongodb.test.properties");
- properties.load(is);
- // ping Mongo and populate db and collection
- try {
- mongo = new Mongo(new MongoURI(properties.getProperty("mongodb.connectionURI")));
- mongo.getDatabaseNames();
- dbName = properties.getProperty("mongodb.testDb");
- db = mongo.getDB(dbName);
- } catch (Exception e) {
- Assume.assumeNoException(e);
- }
-
- }
-
- @Before
- public void initTestCase() {
- // Refresh the test collection - drop it and recreate it. We don't do this for the database because MongoDB would create large
- // store files each time
- testCollectionName = properties.getProperty("mongodb.testCollection");
- testCollection = db.getCollection(testCollectionName);
- testCollection.drop();
- testCollection = db.getCollection(testCollectionName);
-
- dynamicCollectionName = testCollectionName.concat("Dynamic");
- dynamicCollection = db.getCollection(dynamicCollectionName);
- dynamicCollection.drop();
- dynamicCollection = db.getCollection(dynamicCollectionName);
-
- }
-
- @After
- public void cleanup() {
- testCollection.drop();
- dynamicCollection.drop();
- }
-
- protected void pumpDataIntoTestCollection() {
- // there should be 100 of each
- String[] scientists = {"Einstein", "Darwin", "Copernicus", "Pasteur", "Curie", "Faraday", "Newton", "Bohr", "Galilei", "Maxwell"};
- for (int i = 1; i <= 1000; i++) {
- int index = i % scientists.length;
- Formatter f = new Formatter();
- String doc = f.format("{\"_id\":\"%d\", \"scientist\":\"%s\", \"fixedField\": \"fixedValue\"}", i, scientists[index]).toString();
- testCollection.insert((DBObject) JSON.parse(doc), WriteConcern.SAFE);
- }
- assertEquals("Data pumping of 1000 entries did not complete entirely", 1000L, testCollection.count());
- }
-
- protected CamelMongoDbException extractAndAssertCamelMongoDbException(Object result, String message) {
- assertTrue("Result is not an Exception", result instanceof Throwable);
- assertTrue("Result is not an CamelExecutionException", result instanceof CamelExecutionException);
- Throwable exc = ((CamelExecutionException) result).getCause();
- assertTrue("Result is not an CamelMongoDbException", exc instanceof CamelMongoDbException);
- CamelMongoDbException camelExc = ObjectHelper.cast(CamelMongoDbException.class, exc);
- if (message != null) {
- assertTrue("CamelMongoDbException doesn't contain desired message string", camelExc.getMessage().contains(message));
- }
- return camelExc;
- }
-
-}
\ No newline at end of file
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java
deleted file mode 100644
index df22873..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbConversionsTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.HashMap;
-
-import com.mongodb.DBObject;
-import com.mongodb.WriteResult;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbConversionsTest extends AbstractMongoDbTest {
-
- @Test
- public void testInsertMap() throws InterruptedException {
- assertEquals(0, testCollection.count());
-
- HashMap<String, Object> m1 = new HashMap<String, Object>();
- HashMap<String, String> m1Nested = new HashMap<String, String>();
-
- m1Nested.put("nested1", "nestedValue1");
- m1Nested.put("nested2", "nestedValue2");
-
- m1.put("field1", "value1");
- m1.put("field2", "value2");
- m1.put("nestedField", m1Nested);
- m1.put("_id", "testInsertMap");
-
- Object result = template.requestBody("direct:insertMap", m1);
- assertTrue(result instanceof WriteResult);
- DBObject b = testCollection.findOne("testInsertMap");
- assertNotNull("No record with 'testInsertMap' _id", b);
-
- }
-
- @Test
- public void testInsertPojo() {
- assertEquals(0, testCollection.count());
- Object result = template.requestBody("direct:insertPojo", new MyPojoTest());
- assertTrue(result instanceof WriteResult);
- DBObject b = testCollection.findOne("testInsertPojo");
- assertNotNull("No record with 'testInsertPojo' _id", b);
- }
-
- @Test
- public void testInsertJsonString() {
- assertEquals(0, testCollection.count());
- Object result = template.requestBody("direct:insertJsonString", "{\"fruits\": [\"apple\", \"banana\", \"papaya\"], \"veggie\": \"broccoli\", \"_id\": \"testInsertJsonString\"}");
- assertTrue(result instanceof WriteResult);
- DBObject b = testCollection.findOne("testInsertJsonString");
- assertNotNull("No record with 'testInsertJsonString' _id", b);
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
- context.addComponent("properties", pc);
-
- from("direct:insertMap").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert");
- from("direct:insertPojo").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert");
- from("direct:insertJsonString").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert");
- from("direct:insertJsonStringWriteResultInString").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert").convertBodyTo(String.class);
-
- }
- };
- }
-
- @SuppressWarnings("unused")
- private class MyPojoTest {
- public int number = 123;
- public String text = "hello";
- public String[] array = {"daVinci", "copernico", "einstein"};
- // CHECKSTYLE:OFF
- public String _id = "testInsertPojo";
- // CHECKSTYLE:ON
- }
-
-}
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java
deleted file mode 100644
index 284272c..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbDynamicityTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.HashMap;
-
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.WriteResult;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbDynamicityTest extends AbstractMongoDbTest {
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Test
- public void testInsertDynamicityDisabled() {
- assertEquals(0, testCollection.count());
- mongo.getDB("otherDB").dropDatabase();
- assertFalse("The otherDB database should not exist", mongo.getDatabaseNames().contains("otherDB"));
-
- String body = "{\"_id\": \"testInsertDynamicityDisabled\", \"a\" : \"1\"}";
- HashMap<String, Object> headers = new HashMap<String, Object>();
- headers.put(MongoDbConstants.DATABASE, "otherDB");
- headers.put(MongoDbConstants.COLLECTION, "otherCollection");
- Object result = template.requestBodyAndHeaders("direct:noDynamicity", body, headers);
- assertEquals("Response isn't of type WriteResult", WriteResult.class, result.getClass());
-
- DBObject b = testCollection.findOne("testInsertDynamicityDisabled");
- assertNotNull("No record with 'testInsertDynamicityDisabled' _id", b);
-
- body = "{\"_id\": \"testInsertDynamicityDisabledExplicitly\", \"a\" : \"1\"}";
- result = template.requestBodyAndHeaders("direct:noDynamicityExplicit", body, headers);
- assertEquals("Response isn't of type WriteResult", WriteResult.class, result.getClass());
-
- b = testCollection.findOne("testInsertDynamicityDisabledExplicitly");
- assertNotNull("No record with 'testInsertDynamicityDisabledExplicitly' _id", b);
-
- assertFalse("The otherDB database should not exist", mongo.getDatabaseNames().contains("otherDB"));
-
- }
-
- @Test
- public void testInsertDynamicityEnabledDBOnly() {
- assertEquals(0, testCollection.count());
- mongo.getDB("otherDB").dropDatabase();
- assertFalse("The otherDB database should not exist", mongo.getDatabaseNames().contains("otherDB"));
-
- String body = "{\"_id\": \"testInsertDynamicityEnabledDBOnly\", \"a\" : \"1\"}";
- HashMap<String, Object> headers = new HashMap<String, Object>();
- headers.put(MongoDbConstants.DATABASE, "otherDB");
- Object result = template.requestBodyAndHeaders("direct:dynamicityEnabled", body, headers);
-
- assertEquals("Response isn't of type WriteResult", WriteResult.class, result.getClass());
-
- DBCollection dynamicCollection = mongo.getDB("otherDB").getCollection(testCollection.getName());
-
- DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledDBOnly");
- assertNotNull("No record with 'testInsertDynamicityEnabledDBOnly' _id", b);
-
- b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
- assertNull("There is a record with 'testInsertDynamicityEnabledDBOnly' _id in the test collection", b);
-
- assertTrue("The otherDB database should exist", mongo.getDatabaseNames().contains("otherDB"));
-
- }
-
- @Test
- public void testInsertDynamicityEnabledCollectionOnly() {
- assertEquals(0, testCollection.count());
- mongo.getDB("otherDB").dropDatabase();
- assertFalse("The otherDB database should not exist", mongo.getDatabaseNames().contains("otherDB"));
-
- String body = "{\"_id\": \"testInsertDynamicityEnabledCollectionOnly\", \"a\" : \"1\"}";
- HashMap<String, Object> headers = new HashMap<String, Object>();
- headers.put(MongoDbConstants.COLLECTION, "otherCollection");
- Object result = template.requestBodyAndHeaders("direct:dynamicityEnabled", body, headers);
-
- assertEquals("Response isn't of type WriteResult", WriteResult.class, result.getClass());
-
- DBCollection dynamicCollection = db.getCollection("otherCollection");
-
- DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledCollectionOnly");
- assertNotNull("No record with 'testInsertDynamicityEnabledCollectionOnly' _id", b);
-
- b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
- assertNull("There is a record with 'testInsertDynamicityEnabledCollectionOnly' _id in the test collection", b);
-
- assertFalse("The otherDB database should not exist", mongo.getDatabaseNames().contains("otherDB"));
- }
-
- @Test
- public void testInsertDynamicityEnabledDBAndCollection() {
- assertEquals(0, testCollection.count());
- mongo.getDB("otherDB").dropDatabase();
- assertFalse("The otherDB database should not exist", mongo.getDatabaseNames().contains("otherDB"));
-
- String body = "{\"_id\": \"testInsertDynamicityEnabledDBAndCollection\", \"a\" : \"1\"}";
- HashMap<String, Object> headers = new HashMap<String, Object>();
- headers.put(MongoDbConstants.DATABASE, "otherDB");
- headers.put(MongoDbConstants.COLLECTION, "otherCollection");
- Object result = template.requestBodyAndHeaders("direct:dynamicityEnabled", body, headers);
-
- assertEquals("Response isn't of type WriteResult", WriteResult.class, result.getClass());
-
- DBCollection dynamicCollection = mongo.getDB("otherDB").getCollection("otherCollection");
-
- DBObject b = dynamicCollection.findOne("testInsertDynamicityEnabledDBAndCollection");
- assertNotNull("No record with 'testInsertDynamicityEnabledDBAndCollection' _id", b);
-
- b = testCollection.findOne("testInsertDynamicityEnabledDBOnly");
- assertNull("There is a record with 'testInsertDynamicityEnabledDBAndCollection' _id in the test collection", b);
-
- assertTrue("The otherDB database should exist", mongo.getDatabaseNames().contains("otherDB"));
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
- context.addComponent("properties", pc);
-
- from("direct:noDynamicity").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert");
- from("direct:noDynamicityExplicit").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert&dynamicity=false");
- from("direct:dynamicityEnabled").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert&dynamicity=true");
-
- }
- };
- }
-}
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java
deleted file mode 100644
index ec13444..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbExceptionHandlingTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbExceptionHandlingTest extends AbstractMongoDbTest {
-
- @Test
- public void testInduceParseException() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- // notice missing quote at the end of Einstein
- try {
- template.requestBody("direct:findOneByQuery", "{\"scientist\": \"Einstein}");
- } catch (Exception e) {
- extractAndAssertCamelMongoDbException(e, null);
- }
- }
-
- @Test
- public void testErroneousDynamicOperation() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- try {
- template.requestBodyAndHeader("direct:findOneByQuery", "{\"scientist\": \"Einstein\"}", MongoDbConstants.OPERATION_HEADER, "dummyOp");
- } catch (Exception e) {
- extractAndAssertCamelMongoDbException(e, "Operation specified on header is not supported. Value: dummyOp");
- }
-
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
- context.addComponent("properties", pc);
-
- from("direct:findAll")
- .to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findAll&dynamicity=true")
- .to("mock:resultFindAll");
-
- from("direct:findOneByQuery")
- .to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findOneByQuery&dynamicity=true")
- .to("mock:resultFindOneByQuery");
-
- from("direct:findById")
- .to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findById&dynamicity=true")
- .to("mock:resultFindById");
-
- }
- };
- }
-}
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java
deleted file mode 100644
index 8cd6546..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbFindOperationTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.HashMap;
-import java.util.List;
-
-import com.mongodb.BasicDBObjectBuilder;
-import com.mongodb.DBObject;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbFindOperationTest extends AbstractMongoDbTest {
-
-
- @Test
- public void testFindAllNoCriteriaOperation() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- Object result = template.requestBody("direct:findAll", (Object) null);
- assertTrue("Result is not of type List", result instanceof List);
-
- @SuppressWarnings("unchecked")
- List<DBObject> resultList = (List<DBObject>) result;
-
- assertListSize("Result does not contain all entries in collection", resultList, 1000);
-
- // Ensure that all returned documents contain all fields
- for (DBObject dbObject : resultList) {
- assertNotNull("DBObject in returned list should contain all fields", dbObject.get("_id"));
- assertNotNull("DBObject in returned list should contain all fields", dbObject.get("scientist"));
- assertNotNull("DBObject in returned list should contain all fields", dbObject.get("fixedField"));
- }
-
- Exchange resultExchange = getMockEndpoint("mock:resultFindAll").getReceivedExchanges().get(0);
- assertEquals("Result total size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
- assertEquals("Result page size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
-
- }
-
- @Test
- public void testFindAllNoCriteriaWithFilterOperation() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- DBObject fieldFilter = BasicDBObjectBuilder.start().add("_id", 0).add("fixedField", 0).get();
- Object result = template.requestBodyAndHeader("direct:findAll", (Object) null, MongoDbConstants.FIELDS_FILTER, fieldFilter);
- assertTrue("Result is not of type List", result instanceof List);
-
- @SuppressWarnings("unchecked")
- List<DBObject> resultList = (List<DBObject>) result;
-
- assertListSize("Result does not contain all entries in collection", resultList, 1000);
-
- // Ensure that all returned documents contain all fields
- for (DBObject dbObject : resultList) {
- assertNull("DBObject in returned list should not contain field _id", dbObject.get("_id"));
- assertNotNull("DBObject in returned list does not contain field 'scientist'", dbObject.get("scientist"));
- assertNull("DBObject in returned list should not contain field fixedField", dbObject.get("fixedField"));
- }
-
- Exchange resultExchange = getMockEndpoint("mock:resultFindAll").getReceivedExchanges().get(0);
- assertEquals("Result total size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
- assertEquals("Result page size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
-
- }
-
- @Test
- public void testFindAllIterationOperation() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- // Repeat ten times, obtain 10 batches of 100 results each time
- int numToSkip = 0;
- final int limit = 100;
- for (int i = 0; i < 10; i++) {
- HashMap<String, Object> headers = new HashMap<String, Object>();
- headers.put(MongoDbConstants.NUM_TO_SKIP, numToSkip);
- headers.put(MongoDbConstants.LIMIT, 100);
- Object result = template.requestBodyAndHeaders("direct:findAll", (Object) null, headers);
- assertTrue("Result is not of type List", result instanceof List);
-
- @SuppressWarnings("unchecked")
- List<DBObject> resultList = (List<DBObject>) result;
-
- assertListSize("Result does not contain 100 elements", resultList, 100);
- assertEquals("Id of first record is not as expected", numToSkip + 1, Integer.parseInt((String) resultList.get(0).get("_id")));
-
- // Ensure that all returned documents contain all fields
- for (DBObject dbObject : resultList) {
- assertNotNull("DBObject in returned list should contain all fields", dbObject.get("_id"));
- assertNotNull("DBObject in returned list should contain all fields", dbObject.get("scientist"));
- assertNotNull("DBObject in returned list should contain all fields", dbObject.get("fixedField"));
- }
-
- numToSkip = numToSkip + limit;
- }
-
- for (Exchange resultExchange : getMockEndpoint("mock:resultFindAll").getReceivedExchanges()) {
- assertEquals("Result total size header should equal 1000", 1000, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_TOTAL_SIZE));
- assertEquals("Result page size header should equal 100", 100, resultExchange.getIn().getHeader(MongoDbConstants.RESULT_PAGE_SIZE));
- }
- }
-
- @Test
- public void testFindOneByQuery() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- DBObject query = BasicDBObjectBuilder.start("scientist", "Einstein").get();
- DBObject result = template.requestBody("direct:findOneByQuery", query, DBObject.class);
- assertTrue("Result is not of type DBObject", result instanceof DBObject);
-
- assertNotNull("DBObject in returned list should contain all fields", result.get("_id"));
- assertNotNull("DBObject in returned list should contain all fields", result.get("scientist"));
- assertNotNull("DBObject in returned list should contain all fields", result.get("fixedField"));
-
- }
-
- @Test
- public void testFindOneById() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- pumpDataIntoTestCollection();
-
- DBObject result = template.requestBody("direct:findById", "240", DBObject.class);
- assertTrue("Result is not of type DBObject", result instanceof DBObject);
-
- assertEquals("The ID of the retrieved DBObject should equal 240", "240", result.get("_id"));
- assertEquals("The scientist name of the retrieved DBObject should equal Einstein", "Einstein", result.get("scientist"));
-
- assertNotNull("DBObject in returned list should contain all fields", result.get("_id"));
- assertNotNull("DBObject in returned list should contain all fields", result.get("scientist"));
- assertNotNull("DBObject in returned list should contain all fields", result.get("fixedField"));
-
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
- context.addComponent("properties", pc);
-
- from("direct:findAll")
- .to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findAll&dynamicity=true")
- .to("mock:resultFindAll");
-
- from("direct:findOneByQuery")
- .to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findOneByQuery&dynamicity=true")
- .to("mock:resultFindOneByQuery");
-
- from("direct:findById")
- .to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=findById&dynamicity=true")
- .to("mock:resultFindById");
-
- }
- };
- }
-}
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java
deleted file mode 100644
index 3a930aa..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbOperationsTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.Formatter;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBObject;
-import com.mongodb.WriteResult;
-import com.mongodb.util.JSON;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbOperationsTest extends AbstractMongoDbTest {
-
- @Test
- public void testCountOperation() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
- Object result = template.requestBody("direct:count", "irrelevantBody");
- assertTrue("Result is not of type Long", result instanceof Long);
- assertEquals("Test collection should not contain any records", 0L, result);
-
- // Insert a record and test that the endpoint now returns 1
- testCollection.insert((DBObject) JSON.parse("{a:60}"));
- result = template.requestBody("direct:count", "irrelevantBody");
- assertTrue("Result is not of type Long", result instanceof Long);
- assertEquals("Test collection should contain 1 record", 1L, result);
- testCollection.remove(new BasicDBObject());
-
- // test dynamicity
- dynamicCollection.insert((DBObject) JSON.parse("{a:60}"));
- result = template.requestBodyAndHeader("direct:count", "irrelevantBody", MongoDbConstants.COLLECTION, dynamicCollectionName);
- assertTrue("Result is not of type Long", result instanceof Long);
- assertEquals("Dynamic collection should contain 1 record", 1L, result);
-
- }
-
- @Test
- public void testInsertString() throws Exception {
- assertEquals(0, testCollection.count());
- Object result = template.requestBody("direct:insert", "{\"_id\":\"testInsertString\", \"scientist\":\"Einstein\"}");
- assertTrue(result instanceof WriteResult);
- DBObject b = testCollection.findOne("testInsertString");
- assertNotNull("No record with 'testInsertString' _id", b);
- }
-
- @Test
- public void testInsertArrayStrings() throws Exception {
- assertEquals(0, testCollection.count());
- Object[] req = new Object[] {"{\"_id\":\"testInsertArrayStrings\", \"scientist\":\"Einstein\"}", "{\"_id\":\"testInsertArrayStrings2\", \"scientist\":\"Copernicus\"}"};
- Object result = template.requestBody("direct:insert", req);
- assertTrue(result instanceof WriteResult);
- DBObject b = testCollection.findOne("testInsertArrayStrings");
- assertNotNull("No record with 'testInsertArrayStrings' _id", b);
- b = testCollection.findOne("testInsertArrayStrings2");
- assertNotNull("No record with 'testInsertArrayStrings2' _id", b);
- }
-
- @Test
- public void testSave() throws Exception {
- // Prepare test
- assertEquals(0, testCollection.count());
- Object[] req = new Object[] {"{\"_id\":\"testSave1\", \"scientist\":\"Einstein\"}", "{\"_id\":\"testSave2\", \"scientist\":\"Copernicus\"}"};
- Object result = template.requestBody("direct:insert", req);
- assertTrue(result instanceof WriteResult);
- assertEquals("Number of records persisted must be 2", 2, testCollection.count());
-
- // Testing the save logic
- DBObject record1 = testCollection.findOne("testSave1");
- assertEquals("Scientist field of 'testSave1' must equal 'Einstein'", "Einstein", record1.get("scientist"));
- record1.put("scientist", "Darwin");
-
- result = template.requestBody("direct:save", record1);
- assertTrue(result instanceof WriteResult);
-
- record1 = testCollection.findOne("testSave1");
- assertEquals("Scientist field of 'testSave1' must equal 'Darwin' after save operation", "Darwin", record1.get("scientist"));
- record1.put("scientist", "Darwin");
-
- }
-
- @Test
- public void testUpdate() throws Exception {
- // Prepare test
- assertEquals(0, testCollection.count());
- for (int i = 1; i <= 100; i++) {
- String body = null;
- Formatter f = new Formatter();
- if (i % 2 == 0) {
- body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
- } else {
- body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\", \"extraField\": true}", i).toString();
- }
- template.requestBody("direct:insert", body);
- }
- assertEquals(100L, testCollection.count());
-
- // Testing the update logic
- DBObject extraField = new BasicDBObject("extraField", true);
- assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
- assertEquals("Number of records with 'scientist' field = Darwin on must equal 0", 0, testCollection.count(new BasicDBObject("scientist", "Darwin")));
-
- DBObject updateObj = new BasicDBObject("$set", new BasicDBObject("scientist", "Darwin"));
-
- Object result = template.requestBodyAndHeader("direct:update", new Object[] {extraField, updateObj}, MongoDbConstants.MULTIUPDATE, true);
- assertTrue(result instanceof WriteResult);
-
- assertEquals("Number of records with 'scientist' field = Darwin on must equal 50 after update", 50,
- testCollection.count(new BasicDBObject("scientist", "Darwin")));
-
- }
-
- @Test
- public void testRemove() throws Exception {
- // Prepare test
- assertEquals(0, testCollection.count());
- for (int i = 1; i <= 100; i++) {
- String body = null;
- Formatter f = new Formatter();
- if (i % 2 == 0) {
- body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
- } else {
- body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\", \"extraField\": true}", i).toString();
- }
- template.requestBody("direct:insert", body);
- }
- assertEquals(100L, testCollection.count());
-
- // Testing the update logic
- DBObject extraField = new BasicDBObject("extraField", true);
- assertEquals("Number of records with 'extraField' flag on must equal 50", 50L, testCollection.count(extraField));
-
- Object result = template.requestBody("direct:remove", extraField);
- assertTrue(result instanceof WriteResult);
-
- assertEquals("Number of records with 'extraField' flag on must be 0 after remove", 0,
- testCollection.count(extraField));
-
- }
-
- @Test
- public void testDbStats() throws Exception {
- assertEquals(0, testCollection.count());
- Object result = template.requestBody("direct:getDbStats", "irrelevantBody");
- assertTrue("Result is not of type DBObject", result instanceof DBObject);
- assertTrue("The result should contain keys", ((DBObject) result).keySet().size() > 0);
- }
-
- @Test
- public void testColStats() throws Exception {
- assertEquals(0, testCollection.count());
-
- // Add some records to the collection (and do it via camel-mongodb)
- for (int i = 1; i <= 100; i++) {
- String body = null;
- Formatter f = new Formatter();
- body = f.format("{\"_id\":\"testSave%d\", \"scientist\":\"Einstein\"}", i).toString();
- template.requestBody("direct:insert", body);
- }
-
- Object result = template.requestBody("direct:getColStats", "irrelevantBody");
- assertTrue("Result is not of type DBObject", result instanceof DBObject);
- assertTrue("The result should contain keys", ((DBObject) result).keySet().size() > 0);
- }
-
- @Test
- public void testOperationHeader() throws Exception {
- // Test that the collection has 0 documents in it
- assertEquals(0, testCollection.count());
-
- // check that the count operation was invoked instead of the insert operation
- Object result = template.requestBodyAndHeader("direct:insert", "irrelevantBody", MongoDbConstants.OPERATION_HEADER, "count");
- assertTrue("Result is not of type Long", result instanceof Long);
- assertEquals("Test collection should not contain any records", 0L, result);
-
-
- // check that the count operation was invoked instead of the insert operation
- result = template.requestBodyAndHeader("direct:insert", "irrelevantBody", MongoDbConstants.OPERATION_HEADER, MongoDbOperation.count);
- assertTrue("Result is not of type Long", result instanceof Long);
- assertEquals("Test collection should not contain any records", 0L, result);
-
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
- context.addComponent("properties", pc);
-
- from("direct:count").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=count&dynamicity=true");
- from("direct:insert").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=insert");
- from("direct:save").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=save");
- from("direct:update").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=update");
- from("direct:remove").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=remove");
- from("direct:getDbStats").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=getDbStats");
- from("direct:getColStats").to("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.testCollection}}&operation=getColStats");
-
-
- }
- };
- }
-}
-
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java
deleted file mode 100644
index 2bd2448..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbTailableCursorConsumerTest.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import java.util.Calendar;
-
-import com.mongodb.BasicDBObject;
-import com.mongodb.BasicDBObjectBuilder;
-import com.mongodb.DBCollection;
-import com.mongodb.DBObject;
-import com.mongodb.WriteConcern;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ServiceStatus;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.properties.PropertiesComponent;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbTailableCursorConsumerTest extends AbstractMongoDbTest {
-
- private DBCollection cappedTestCollection;
- private String cappedTestCollectionName;
-
- @Test
- public void testThousandRecords() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- MockEndpoint mock = getMockEndpoint("mock:test");
- mock.expectedMessageCount(1000);
-
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
-
- for (int i = 0; i < 1000; i++) {
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- assertEquals(1000, cappedTestCollection.count());
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer1");
- Thread.sleep(1000);
- mock.assertIsSatisfied();
- context.stopRoute("tailableCursorConsumer1");
-
- }
-
- @Test
- public void testNoRecords() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- MockEndpoint mock = getMockEndpoint("mock:test");
- mock.expectedMessageCount(0);
-
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
- assertEquals(0, cappedTestCollection.count());
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer1");
- Thread.sleep(1000);
- mock.assertIsSatisfied();
- context.stopRoute("tailableCursorConsumer1");
-
- }
-
- @Test
- public void testMultipleBursts() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- MockEndpoint mock = getMockEndpoint("mock:test");
- mock.expectedMessageCount(5000);
-
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer1");
-
- // pump 5 bursts of 1000 records each with 500ms pause between burst and burst
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < 5000; i++) {
- if (i % 1000 == 0) {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- return;
- }
- }
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
-
- }
- });
-
- // start the data pumping
- t.start();
- // before we assert, wait for the data pumping to end
- t.join();
-
- mock.assertIsSatisfied();
- context.stopRoute("tailableCursorConsumer1");
-
- }
-
- @Test
- public void testHundredThousandRecords() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- final MockEndpoint mock = getMockEndpoint("mock:test");
- mock.expectedMessageCount(1000);
-
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer1");
-
- // continuous pump of 100000 records, asserting incrementally to reduce overhead on the mock endpoint
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 1; i <= 100000; i++) {
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
-
- // incrementally assert, as the mock endpoint stores all messages and otherwise the test would be sluggish
- if (i % 1000 == 0) {
- try {
- MongoDbTailableCursorConsumerTest.this.assertAndResetMockEndpoint(mock);
- } catch (Exception e) {
- return;
- }
- }
- }
- }
- });
-
- // start the data pumping
- t.start();
- // before we stop the route, wait for the data pumping to end
- t.join();
-
- context.stopRoute("tailableCursorConsumer1");
-
- }
-
- @Test
- public void testPersistentTailTrack() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- final MockEndpoint mock = getMockEndpoint("mock:test");
-
- // drop the tracking collection
- db.getCollection(MongoDbTailTrackingConfig.DEFAULT_COLLECTION).drop();
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
- cappedTestCollection.ensureIndex("increasing");
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer2");
-
- mock.expectedMessageCount(300);
- // pump 300 records
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 1; i <= 300; i++) {
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- }
- });
-
- // start the data pumping
- t.start();
- // before we continue wait for the data pump to end
- t.join();
- mock.assertIsSatisfied();
- mock.reset();
- context.stopRoute("tailableCursorConsumer2");
- while (context.getRouteStatus("tailableCursorConsumer2") != ServiceStatus.Stopped) { }
- context.startRoute("tailableCursorConsumer2");
-
- // expect 300 messages and not 600
- mock.expectedMessageCount(300);
- // pump 300 records
- t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 301; i <= 600; i++) {
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- }
- });
- // start the data pumping
- t.start();
- // before we continue wait for the data pump to end
- t.join();
- mock.assertIsSatisfied();
-
- // check that the first message received in this second batch corresponds to increasing=301
- Object firstBody = mock.getExchanges().get(0).getIn().getBody();
- assertTrue(firstBody instanceof DBObject);
- assertEquals(301, ((DBObject) firstBody).get("increasing"));
-
- // check that the lastVal is persisted at the right time: check before and after stopping the route
- assertEquals(300, db.getCollection(MongoDbTailTrackingConfig.DEFAULT_COLLECTION).findOne(new BasicDBObject("persistentId", "darwin")).get("lastTrackingValue"));
- // stop the route and verify the last value has been updated
- context.stopRoute("tailableCursorConsumer2");
- while (context.getRouteStatus("tailableCursorConsumer2") != ServiceStatus.Stopped) { }
- assertEquals(600, db.getCollection(MongoDbTailTrackingConfig.DEFAULT_COLLECTION).findOne(new BasicDBObject("persistentId", "darwin")).get("lastTrackingValue"));
-
- }
-
- @Test
- public void testPersistentTailTrackIncreasingDateField() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- final MockEndpoint mock = getMockEndpoint("mock:test");
- final Calendar startTimestamp = Calendar.getInstance();
-
- // get default tracking collection
- DBCollection trackingCol = db.getCollection(MongoDbTailTrackingConfig.DEFAULT_COLLECTION);
- trackingCol.drop();
- trackingCol = db.getCollection(MongoDbTailTrackingConfig.DEFAULT_COLLECTION);
-
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer2");
-
- mock.expectedMessageCount(300);
- // pump 300 records
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 1; i <= 300; i++) {
- Calendar c = (Calendar) (startTimestamp.clone());
- c.add(Calendar.MINUTE, i);
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", c.getTime()).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- }
- });
-
- // start the data pumping
- t.start();
- // before we continue wait for the data pump to end
- t.join();
- mock.assertIsSatisfied();
- mock.reset();
- // ensure that the persisted lastVal is startTimestamp + 300min
- Calendar cal300 = (Calendar) startTimestamp.clone();
- cal300.add(Calendar.MINUTE, 300);
- context.stopRoute("tailableCursorConsumer2");
- assertEquals(cal300.getTime(), trackingCol.findOne(new BasicDBObject("persistentId", "darwin")).get(MongoDbTailTrackingConfig.DEFAULT_FIELD));
- context.startRoute("tailableCursorConsumer2");
-
- // expect 300 messages and not 600
- mock.expectedMessageCount(300);
- // pump 300 records
- t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 301; i <= 600; i++) {
- Calendar c = (Calendar) (startTimestamp.clone());
- c.add(Calendar.MINUTE, i);
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", c.getTime()).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- }
- });
- // start the data pumping
- t.start();
- // before we continue wait for the data pump to end
- t.join();
- mock.assertIsSatisfied();
- Object firstBody = mock.getExchanges().get(0).getIn().getBody();
- assertTrue(firstBody instanceof DBObject);
- Calendar cal301 = (Calendar) startTimestamp.clone();
- cal301.add(Calendar.MINUTE, 301);
- assertEquals(cal301.getTime(), ((DBObject) firstBody).get("increasing"));
- // check that the persisted lastVal after stopping the route is startTimestamp + 600min
- context.stopRoute("tailableCursorConsumer2");
- Calendar cal600 = (Calendar) startTimestamp.clone();
- cal600.add(Calendar.MINUTE, 600);
- assertEquals(cal600.getTime(), trackingCol.findOne(new BasicDBObject("persistentId", "darwin")).get(MongoDbTailTrackingConfig.DEFAULT_FIELD));
- }
-
- @Test
- public void testCustomTailTrackLocation() throws Exception {
- assertEquals(0, cappedTestCollection.count());
- final MockEndpoint mock = getMockEndpoint("mock:test");
-
- // get the custom tracking collection and drop it (tailTrackDb=einstein&tailTrackCollection=curie&tailTrackField=newton)
- DBCollection trackingCol = mongo.getDB("einstein").getCollection("curie");
- trackingCol.drop();
- trackingCol = mongo.getDB("einstein").getCollection("curie");
-
- // create a capped collection with max = 1000
- cappedTestCollection = db.createCollection(cappedTestCollectionName,
- BasicDBObjectBuilder.start().add("capped", true).add("size", 1000000000).add("max", 1000).get());
-
- addTestRoutes();
- context.startRoute("tailableCursorConsumer3");
-
- mock.expectedMessageCount(300);
- // pump 300 records
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 1; i <= 300; i++) {
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- }
- });
-
- // start the data pumping
- t.start();
- // before we continue wait for the data pump to end
- t.join();
- mock.assertIsSatisfied();
- mock.reset();
-
- // stop the route to ensure that our lastVal is persisted, and check it
- context.stopRoute("tailableCursorConsumer3");
- // ensure that the persisted lastVal is 300, newton is the name of the trackingField we are using
- assertEquals(300, trackingCol.findOne(new BasicDBObject("persistentId", "darwin")).get("newton"));
- context.startRoute("tailableCursorConsumer3");
-
- // expect 300 messages and not 600
- mock.expectedMessageCount(300);
- // pump 300 records
- t = new Thread(new Runnable() {
- @Override
- public void run() {
- for (int i = 301; i <= 600; i++) {
- cappedTestCollection.insert(BasicDBObjectBuilder.start("increasing", i).add("string", "value" + i).get(), WriteConcern.SAFE);
- }
- }
- });
- // start the data pumping
- t.start();
- // before we continue wait for the data pump to end
- t.join();
- mock.assertIsSatisfied();
- // check that the first received body contains increasing=301 and not increasing=1, i.e. it's not starting from the top
- Object firstBody = mock.getExchanges().get(0).getIn().getBody();
- assertTrue(firstBody instanceof DBObject);
- assertEquals(301, ((DBObject) firstBody).get("increasing"));
- // check that the persisted lastVal after stopping the route is 600, newton is the name of the trackingField we are using
- context.stopRoute("tailableCursorConsumer3");
- assertEquals(600, trackingCol.findOne(new BasicDBObject("persistentId", "darwin")).get("newton"));
-
- }
-
- public void assertAndResetMockEndpoint(MockEndpoint mock) throws Exception {
- mock.assertIsSatisfied();
- mock.reset();
- }
-
- @Override
- public void initTestCase() {
- super.initTestCase();
- // drop the capped collection and let each test create what they need
- cappedTestCollectionName = properties.getProperty("mongodb.cappedTestCollection");
- cappedTestCollection = db.getCollection(cappedTestCollectionName);
- cappedTestCollection.drop();
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
-
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- protected void addTestRoutes() throws Exception {
- context.addRoutes(new RouteBuilder() {
-
- @Override
- public void configure() throws Exception {
- PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties");
- context.addComponent("properties", pc);
-
- from("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.cappedTestCollection}}&tailTrackIncreasingField=increasing")
- .id("tailableCursorConsumer1")
- .autoStartup(false)
- .to("mock:test");
-
- from("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.cappedTestCollection}}&tailTrackIncreasingField=increasing&persistentTailTracking=true&persistentId=darwin")
- .id("tailableCursorConsumer2")
- .autoStartup(false)
- .to("mock:test");
-
- from("mongodb:myDb?database={{mongodb.testDb}}&collection={{mongodb.cappedTestCollection}}&tailTrackIncreasingField=increasing&"
- + "persistentTailTracking=true&persistentId=darwin&tailTrackDb=einstein&tailTrackCollection=curie&tailTrackField=newton")
- .id("tailableCursorConsumer3")
- .autoStartup(false)
- .to("mock:test");
-
- }
- });
- }
-
-}
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbWriteConcernsTest.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbWriteConcernsTest.java
deleted file mode 100644
index 28452d8..0000000
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/MongoDbWriteConcernsTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.mongodb;
-
-import com.mongodb.CommandResult;
-import com.mongodb.WriteConcern;
-import com.mongodb.WriteResult;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.spring.SpringCamelContext;
-import org.junit.Test;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class MongoDbWriteConcernsTest extends AbstractMongoDbTest {
-
- // Test invalid write concern on message header - will it throw the exception?
-
- @Test
- public void testNoWriteConcern() throws Exception {
- assertEquals(0, testCollection.count());
- Object result = template.requestBody("direct:noWriteConcern", "{\"scientist\":\"newton\"}");
- assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
- WriteResult wr = (WriteResult) result;
- WriteConcern wc = wr.getLastConcern();
- // check the WriteConcern's behaviour
- if (wc.callGetLastError()) {
- assertNotNull(wr.getCachedLastError());
- } else {
- assertNull(wr.getCachedLastError());
- }
- CommandResult cr = wr.getLastError();
- assertTrue(cr.ok());
- }
-
- @Test
- public void testDynamicWriteConcernSafe() throws Exception {
- assertEquals(0, testCollection.count());
-
- // test with object first
- Object result = template.requestBodyAndHeader("direct:noWriteConcern", "{\"scientist\":\"newton\"}", MongoDbConstants.WRITECONCERN, WriteConcern.SAFE);
- assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
- WriteResult wr = (WriteResult) result;
- // should not be null because with WriteConcern.SAFE, getLastError was called implicitly by the driver
- assertNotNull(wr.getCachedLastError());
- CommandResult cr = wr.getLastError();
- assertTrue(cr.ok());
-
- // same behaviour should be reproduced with String 'SAFE'
- result = template.requestBodyAndHeader("direct:noWriteConcern", "{\"scientist\":\"newton\"}", MongoDbConstants.WRITECONCERN, "SAFE");
- assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
- wr = (WriteResult) result;
- // should not be null because with WriteConcern.SAFE, getLastError was called implicitly by the driver
- assertNotNull(wr.getCachedLastError());
- cr = wr.getLastError();
- assertTrue(cr.ok());
- }
-
- @Test
- public void testDynamicWriteConcernUnknown() throws Exception {
- assertEquals(0, testCollection.count());
-
- try {
- template.requestBodyAndHeader("direct:noWriteConcern", "{\"scientist\":\"newton\"}", MongoDbConstants.WRITECONCERN, "Random");
- } catch (Exception e) {
- extractAndAssertCamelMongoDbException(e, "WriteConcern specified in the " + MongoDbConstants.WRITECONCERN + " header");
- }
- }
-
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/mongodb/mongoComponentTest.xml");
- return SpringCamelContext.springCamelContext(applicationContext);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- from("direct:noWriteConcern").to("mongodb:myDb?database=test&collection=camelTest&operation=insert");
- from("direct:writeConcernParam").to("mongodb:myDb?database=test&collection=camelTest&operation=insert&writeConcern=SAFE");
- //from("direct:writeConcernRef").to("mongodb:myDb?database=test&collection=camelTest&operation=insert&writeConcernRef=customWriteConcern");
- from("direct:noWriteConcernWithCallGetLastError").to("mongodb:myDb?database=test&collection=camelTest&operation=insert&"
- + "invokeGetLastError=true");
-
-
- }
- };
- }
-}
diff --git a/components/camel-mongodb/src/test/resources/log4j.properties b/components/camel-mongodb/src/test/resources/log4j.properties
deleted file mode 100644
index 77a8e83..0000000
--- a/components/camel-mongodb/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# 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.
-#
-
-log4j.rootLogger=INFO, file
-# change the logging level of this category to increase verbosity of the MongoDB component
-log4j.category.org.apache.camel.component.mongodb=INFO, file
-log4j.additivity.org.apache.camel.component.mongodb=false
-
-# uncomment the following line to turn on Camel debugging
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-mongodb-test.log
\ No newline at end of file
diff --git a/components/camel-mongodb/src/test/resources/mongodb.test.properties b/components/camel-mongodb/src/test/resources/mongodb.test.properties
deleted file mode 100644
index 20c529d..0000000
--- a/components/camel-mongodb/src/test/resources/mongodb.test.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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.
-#
-
-mongodb.connectionURI=mongodb://localhost:27017
-mongodb.testDb=test
-mongodb.testCollection=camelTest
-mongodb.cappedTestCollection=camelTestCapped
\ No newline at end of file
diff --git a/components/camel-mongodb/src/test/resources/org/apache/camel/component/mongodb/mongoComponentTest.xml b/components/camel-mongodb/src/test/resources/org/apache/camel/component/mongodb/mongoComponentTest.xml
deleted file mode 100644
index bf19209..0000000
--- a/components/camel-mongodb/src/test/resources/org/apache/camel/component/mongodb/mongoComponentTest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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">
-
- <bean id="myDb" class="com.mongodb.Mongo">
- <constructor-arg index="0" value="localhost"/>
- </bean>
-
- <!-- <bean id="customWriteConcern" class="com.mongodb.WriteConcern">
- <constructor-arg index="0" value="true" />
- </bean> -->
-
-</beans>
diff --git a/components/camel-msv/pom.xml b/components/camel-msv/pom.xml
index 17f1142..2e8a2b1 100644
--- a/components/camel-msv/pom.xml
+++ b/components/camel-msv/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -74,7 +74,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-mvel/pom.xml b/components/camel-mvel/pom.xml
index ea95d89..5af19f5 100644
--- a/components/camel-mvel/pom.xml
+++ b/components/camel-mvel/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-mybatis/pom.xml b/components/camel-mybatis/pom.xml
index f279ffe..018b4ab 100644
--- a/components/camel-mybatis/pom.xml
+++ b/components/camel-mybatis/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/DefaultMyBatisProcessingStrategy.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/DefaultMyBatisProcessingStrategy.java
index a673752..7d37d45 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/DefaultMyBatisProcessingStrategy.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/DefaultMyBatisProcessingStrategy.java
@@ -40,7 +40,7 @@
}
}
- public List<?> poll(MyBatisConsumer consumer, MyBatisEndpoint endpoint) throws Exception {
+ public List poll(MyBatisConsumer consumer, MyBatisEndpoint endpoint) throws Exception {
SqlSession session = endpoint.getSqlSessionFactory().openSession();
try {
return session.selectList(endpoint.getStatement(), null);
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
index 3bff55e..0d70fdd 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisConsumer.java
@@ -20,12 +20,14 @@
import java.util.List;
import java.util.Queue;
+import org.apache.camel.BatchConsumer;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.ShutdownRunningTask;
-import org.apache.camel.impl.ScheduledBatchPollingConsumer;
+import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.spi.ShutdownAware;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,7 +38,7 @@
*
* @version
*/
-public class MyBatisConsumer extends ScheduledBatchPollingConsumer {
+public class MyBatisConsumer extends ScheduledPollConsumer implements BatchConsumer, ShutdownAware {
private static final Logger LOG = LoggerFactory.getLogger(MyBatisConsumer.class);
@@ -114,6 +116,10 @@
return processBatch(CastUtils.cast(answer));
}
+ public void setMaxMessagesPerPoll(int maxMessagesPerPoll) {
+ this.maxMessagesPerPoll = maxMessagesPerPoll;
+ }
+
public int processBatch(Queue<Object> exchanges) throws Exception {
final MyBatisEndpoint endpoint = getEndpoint();
@@ -155,6 +161,54 @@
return total;
}
+ public boolean deferShutdown(ShutdownRunningTask shutdownRunningTask) {
+ // store a reference what to do in case when shutting down and we have pending messages
+ this.shutdownRunningTask = shutdownRunningTask;
+ // do not defer shutdown
+ return false;
+ }
+
+ public int getPendingExchangesSize() {
+ int answer;
+ // only return the real pending size in case we are configured to complete all tasks
+ if (ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask) {
+ answer = pendingExchanges;
+ } else {
+ answer = 0;
+ }
+
+ if (answer == 0 && isPolling()) {
+ // force at least one pending exchange if we are polling as there is a little gap
+ // in the processBatch method and until an exchange gets enlisted as in-flight
+ // which happens later, so we need to signal back to the shutdown strategy that
+ // there is a pending exchange. When we are no longer polling, then we will return 0
+ log.trace("Currently polling so returning 1 as pending exchanges");
+ answer = 1;
+ }
+
+ return answer;
+ }
+
+ public void prepareShutdown() {
+ // noop
+ }
+
+ public boolean isBatchAllowed() {
+ // stop if we are not running
+ boolean answer = isRunAllowed();
+ if (!answer) {
+ return false;
+ }
+
+ if (shutdownRunningTask == null) {
+ // we are not shutting down so continue to run
+ return true;
+ }
+
+ // we are shutting down so only continue if we are configured to complete all tasks
+ return ShutdownRunningTask.CompleteAllTasks == shutdownRunningTask;
+ }
+
private Exchange createExchange(Object data) {
final MyBatisEndpoint endpoint = getEndpoint();
final Exchange exchange = endpoint.createExchange(ExchangePattern.InOnly);
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProcessingStrategy.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProcessingStrategy.java
index fa975c3..ecfb39a 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProcessingStrategy.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProcessingStrategy.java
@@ -35,7 +35,7 @@
* @return Results of the query as a {@link List}
* @throws Exception can be thrown in case of error
*/
- List<?> poll(MyBatisConsumer consumer, MyBatisEndpoint endpoint) throws Exception;
+ List poll(MyBatisConsumer consumer, MyBatisEndpoint endpoint) throws Exception;
/**
* Commit callback if there are a statements to be run after processing.
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
index 4ec99a1..1529f4f 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java
@@ -108,7 +108,7 @@
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
- Iterator<?> iter = ObjectHelper.createIterator(in);
+ Iterator iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Inserting: {} using statement: {}", value, statement);
@@ -134,7 +134,7 @@
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
- Iterator<?> iter = ObjectHelper.createIterator(in);
+ Iterator iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Updating: {} using statement: {}", value, statement);
@@ -160,7 +160,7 @@
Object in = exchange.getIn().getBody();
if (in != null) {
// lets handle arrays or collections of objects
- Iterator<?> iter = ObjectHelper.createIterator(in);
+ Iterator iter = ObjectHelper.createIterator(in);
while (iter.hasNext()) {
Object value = iter.next();
LOG.trace("Deleting: {} using statement: {}", value, statement);
diff --git a/components/camel-nagios/pom.xml b/components/camel-nagios/pom.xml
index 60ee3ea..16b717b 100644
--- a/components/camel-nagios/pom.xml
+++ b/components/camel-nagios/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-netty/pom.xml b/components/camel-netty/pom.xml
index c4756d8..545a57d 100644
--- a/components/camel-netty/pom.xml
+++ b/components/camel-netty/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-netty</artifactId>
@@ -54,15 +54,15 @@
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
- <version>${netty-version}</version>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.netty</artifactId>
+ <version>${netty-bundle-version}</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
index 9c05030..d034aa1 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
@@ -31,7 +31,6 @@
import org.jboss.netty.channel.ChannelUpstreamHandler;
import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
import org.jboss.netty.handler.codec.frame.Delimiters;
-import org.jboss.netty.handler.codec.serialization.ClassResolvers;
import org.jboss.netty.handler.codec.serialization.ObjectDecoder;
import org.jboss.netty.handler.codec.serialization.ObjectEncoder;
import org.jboss.netty.handler.codec.string.StringDecoder;
@@ -41,6 +40,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@SuppressWarnings("unchecked")
public class NettyConfiguration implements Cloneable {
private static final transient Logger LOG = LoggerFactory.getLogger(NettyConfiguration.class);
@@ -146,7 +146,7 @@
} else {
// object serializable is then used
encoders.add(new ObjectEncoder());
- decoders.add(new ObjectDecoder(ClassResolvers.weakCachingResolver(null)));
+ decoders.add(new ObjectDecoder());
LOG.debug("Using object encoders and decoders");
}
@@ -469,10 +469,10 @@
return host + ":" + port;
}
- private <T> void addToHandlersList(List<T> configured, List<T> handlers, Class<T> handlerType) {
+ private <T> void addToHandlersList(List configured, List handlers, Class<? extends T> handlerType) {
if (handlers != null) {
for (int x = 0; x < handlers.size(); x++) {
- T handler = handlers.get(x);
+ Object handler = handlers.get(x);
if (handlerType.isInstance(handler)) {
configured.add(handler);
}
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java
index 9f40ec8..97c4e7e 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java
@@ -43,11 +43,11 @@
getMockEndpoint("mock:result").expectedMessageCount(files);
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
- Map<Integer, Future<String>> responses = new ConcurrentHashMap<Integer, Future<String>>();
+ Map<Integer, Future> responses = new ConcurrentHashMap<Integer, Future>();
for (int i = 0; i < files; i++) {
final int index = i;
- Future<String> out = executor.submit(new Callable<String>() {
- public String call() throws Exception {
+ Future out = executor.submit(new Callable<Object>() {
+ public Object call() throws Exception {
return template.requestBody("netty:tcp://localhost:{{port}}", index, String.class);
}
});
@@ -59,7 +59,7 @@
// get all responses
Set<Object> unique = new HashSet<Object>();
- for (Future<String> future : responses.values()) {
+ for (Future future : responses.values()) {
unique.add(future.get());
}
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java
index e7cbf6c..e61ae3b 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.netty;
+import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -28,8 +29,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Test;
public class NettyTCPAsyncTest extends BaseNettyTest {
@@ -41,17 +40,18 @@
private void sendFile(String uri) throws Exception {
producerTemplate.send(uri, new Processor() {
public void process(Exchange exchange) throws Exception {
- // Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream("./src/test/resources/test.txt"));
+ // Read from an input stream
+ InputStream is = new BufferedInputStream(
+ new FileInputStream("./src/test/resources/test.txt"));
byte buffer[] = IOConverter.toBytes(is);
is.close();
-
+
// Set the property of the charset encoding
exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
Message in = exchange.getIn();
in.setBody(buffer);
- }
+ }
});
}
diff --git a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java
index 57f4805..b25dd2b 100644
--- a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java
+++ b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.netty;
+import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -28,8 +29,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Test;
public class NettyUDPAsyncTest extends BaseNettyTest {
@@ -42,17 +41,18 @@
private void sendFile(String uri) throws Exception {
producerTemplate.send(uri, new Processor() {
public void process(Exchange exchange) throws Exception {
- // Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream("./src/test/resources/test.txt"));
+ // Read from an input stream
+ InputStream is = new BufferedInputStream(
+ new FileInputStream("./src/test/resources/test.txt"));
byte buffer[] = IOConverter.toBytes(is);
is.close();
-
+
// Set the property of the charset encoding
exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
Message in = exchange.getIn();
in.setBody(buffer);
- }
+ }
});
}
diff --git a/components/camel-ognl/pom.xml b/components/camel-ognl/pom.xml
index c4cdda8..9af5d0a 100644
--- a/components/camel-ognl/pom.xml
+++ b/components/camel-ognl/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-paxlogging/pom.xml b/components/camel-paxlogging/pom.xml
index 831e1d2..abe6225 100644
--- a/components/camel-paxlogging/pom.xml
+++ b/components/camel-paxlogging/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-printer/pom.xml b/components/camel-printer/pom.xml
index 94c5883..b655fae 100644
--- a/components/camel-printer/pom.xml
+++ b/components/camel-printer/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterConfiguration.java b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterConfiguration.java
index b218b94..d684da1 100644
--- a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterConfiguration.java
+++ b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterConfiguration.java
@@ -65,7 +65,7 @@
path = ObjectHelper.removeStartingCharacters(path, '\\');
setPrintername(path);
- Map<String, Object> printSettings = URISupport.parseParameters(uri);
+ Map printSettings = URISupport.parseParameters(uri);
setFlavor((String)printSettings.get("flavor"));
setMimeType((String)printSettings.get("mimeType"));
setDocFlavor(assignDocFlavor(flavor, mimeType));
diff --git a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
index 9483c5c..35a35b9 100644
--- a/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
+++ b/components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterProducer.java
@@ -19,6 +19,7 @@
import java.io.InputStream;
import javax.print.DocFlavor;
+import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
@@ -72,6 +73,10 @@
return printRequestAttributeSet;
}
+ private DocPrintJob assignPrintJob(PrintService printService) {
+ return printService.createPrintJob();
+ }
+
private PrintService assignPrintService() throws PrintException {
PrintService printService;
diff --git a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
index 14a7c1f..c38290d 100644
--- a/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
+++ b/components/camel-printer/src/test/java/org/apache/camel/component/printer/PrinterPrintTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.printer;
+import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -24,8 +25,6 @@
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.IOHelper;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -45,12 +44,13 @@
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
// Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream("./src/test/resources/test.txt"));
+ InputStream is = new BufferedInputStream(
+ new FileInputStream("./src/test/resources/test.txt"));
byte buffer[] = new byte[is.available()];
int n = is.available();
for (int i = 0; i < n; i++) {
- buffer[i] = (byte)is.read();
+ buffer[i] = (byte) is.read();
}
is.close();
@@ -66,12 +66,13 @@
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
// Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream("./src/test/resources/asf-logo.gif"));
+ InputStream is = new BufferedInputStream(
+ new FileInputStream("./src/test/resources/asf-logo.gif"));
byte buffer[] = new byte[is.available()];
int n = is.available();
for (int i = 0; i < n; i++) {
- buffer[i] = (byte)is.read();
+ buffer[i] = (byte) is.read();
}
is.close();
@@ -87,12 +88,13 @@
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
// Read from an input stream
- InputStream is = IOHelper.buffered(new FileInputStream("./src/test/resources/asf-logo.JPG"));
+ InputStream is = new BufferedInputStream(
+ new FileInputStream("./src/test/resources/asf-logo.JPG"));
byte buffer[] = new byte[is.available()];
int n = is.available();
for (int i = 0; i < n; i++) {
- buffer[i] = (byte)is.read();
+ buffer[i] = (byte) is.read();
}
is.close();
diff --git a/components/camel-protobuf/pom.xml b/components/camel-protobuf/pom.xml
index ad4e65b..29e2f20 100755
--- a/components/camel-protobuf/pom.xml
+++ b/components/camel-protobuf/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -48,7 +48,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java
index 0744f1f..32e8960 100755
--- a/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java
+++ b/components/camel-protobuf/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java
@@ -684,7 +684,7 @@
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
- if (!result.phone_.isEmpty()) {
+ if (result.phone_ != java.util.Collections.EMPTY_LIST) {
result.phone_ =
java.util.Collections.unmodifiableList(result.phone_);
}
@@ -1099,7 +1099,7 @@
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
- if (!result.person_.isEmpty()) {
+ if (result.person_ != java.util.Collections.EMPTY_LIST) {
result.person_ =
java.util.Collections.unmodifiableList(result.person_);
}
diff --git a/components/camel-quartz/pom.xml b/components/camel-quartz/pom.xml
index d4eab36..9b9c559 100644
--- a/components/camel-quartz/pom.xml
+++ b/components/camel-quartz/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -67,19 +67,24 @@
</dependency>
<!-- testing -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
index 1cc2770..d228474 100644
--- a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
+++ b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
@@ -16,6 +16,11 @@
*/
package org.apache.camel.component.quartz;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
@@ -29,25 +34,10 @@
@Test
public void testQuartzCronRoute() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(2);
-
- assertMockEndpointsSatisfied();
-
- // restart route
- context().stopRoute("trigger");
- mock.reset();
- mock.expectedMessageCount(0);
-
- // wait a bit
- Thread.sleep(2000);
-
- assertMockEndpointsSatisfied();
-
- // start route, and we got messages again
- mock.reset();
- mock.expectedMessageCount(1);
-
- context().startRoute("trigger");
+ mock.setResultWaitTime(15000);
+ mock.expectedMinimumMessageCount(3);
+ mock.message(0).arrives().between(6, 9).seconds().beforeNext();
+ mock.message(2).arrives().between(3, 5).seconds().afterPrevious();
assertMockEndpointsSatisfied();
}
@@ -56,10 +46,35 @@
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
- from("quartz://groupName/timerName?cron=0/1+*+*+*+*+?").routeId("trigger")
- .to("mock:result");
+ // START SNIPPET: e1
+ from("quartz://groupName/timerName?cron=0/4+*+*+*+*+?").routeId("trigger")
+ .setBody(bean(CurrentTime.class))
+ // .to("log:QUARTZ")
+ .to("seda:control");
+
+ from("seda:control").routeId("control")
+ // .to("log:CONTROL")
+ .to("mock:result")
+ .process(new Processor() {
+ private boolean done;
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ if (!done) {
+ done = true;
+ exchange.getContext().stopRoute("trigger");
+ Thread.sleep(5000);
+ exchange.getContext().startRoute("trigger");
+ }
+ }
+ });
+ // END SNIPPET: e1
}
};
}
+ public static class CurrentTime {
+ public Date get() {
+ return Calendar.getInstance().getTime();
+ }
+ }
}
diff --git a/components/camel-quickfix/pom.xml b/components/camel-quickfix/pom.xml
index 02e1822..6913708 100644
--- a/components/camel-quickfix/pom.xml
+++ b/components/camel-quickfix/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -57,7 +57,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
index 1eeb77f..4801b76 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
@@ -16,12 +16,15 @@
*/
package org.apache.camel.component.quickfixj;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import quickfix.LogFactory;
diff --git a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
index 276d7c5..ffc48e7 100644
--- a/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
+++ b/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
@@ -265,7 +265,7 @@
}
MessageStoreFactory messageStoreFactory;
if (impliedMessageStoreFactories.size() == 1) {
- messageStoreFactory = impliedMessageStoreFactories.iterator().next();
+ messageStoreFactory = (MessageStoreFactory) impliedMessageStoreFactories.iterator().next();
} else {
messageStoreFactory = new MemoryStoreFactory();
}
@@ -302,7 +302,7 @@
}
LogFactory sessionLogFactory;
if (impliedLogFactories.size() == 1) {
- sessionLogFactory = impliedLogFactories.iterator().next();
+ sessionLogFactory = (LogFactory) impliedLogFactories.iterator().next();
} else {
// Default
sessionLogFactory = new ScreenLogFactory(settings);
@@ -345,7 +345,7 @@
Iterator<SessionID> sessionIdItr = settings.sectionIterator();
while (sessionIdItr.hasNext()) {
try {
- if (connectorRole.equals(settings.getString(sessionIdItr.next(),
+ if (connectorRole.equals(settings.getString((SessionID) sessionIdItr.next(),
SessionFactory.SETTING_CONNECTION_TYPE))) {
hasRole = true;
break;
diff --git a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java
index 5d8a81f..fae5f90 100644
--- a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java
+++ b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjConvertersTest.java
@@ -95,7 +95,6 @@
assertThat((SessionID)value, is(new SessionID("FIX.4.0", "FOO", "BAR")));
}
- @SuppressWarnings("deprecation")
@Test
public void convertToExchange() {
SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR");
@@ -114,7 +113,6 @@
assertThat((String)exchange.getIn().getHeader(QuickfixjEndpoint.MESSAGE_TYPE_KEY), is(MsgType.ORDER_SINGLE));
}
- @SuppressWarnings("deprecation")
@Test
public void convertToExchangeWithNullMessage() {
SessionID sessionID = new SessionID("FIX.4.0", "FOO", "BAR");
diff --git a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java
index d6b60d3..9883c16 100644
--- a/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java
+++ b/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/examples/RequestReplyExample.java
@@ -36,8 +36,6 @@
import org.apache.camel.component.quickfixj.examples.transform.QuickfixjMessageJsonTransformer;
import org.apache.camel.component.quickfixj.examples.util.CountDownLatchDecrementer;
import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.util.IOHelper;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -105,7 +103,7 @@
URL orderStatusUrl = new URL(orderStatusServiceUrl + "?sessionID=FIX.4.2:TRADER->MARKET&orderID=abc");
HttpURLConnection connection = (HttpURLConnection) orderStatusUrl.openConnection();
- BufferedReader orderStatusReply = IOHelper.buffered(new InputStreamReader(connection.getInputStream()));
+ BufferedReader orderStatusReply = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line = orderStatusReply.readLine();
if (!line.equals("\"message\": {")) {
throw new Exception("Don't appear to be a JSON response");
diff --git a/components/camel-restlet/pom.xml b/components/camel-restlet/pom.xml
index 835c49d..89327f2 100644
--- a/components/camel-restlet/pom.xml
+++ b/components/camel-restlet/pom.xml
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -61,7 +61,13 @@
<!-- test artifacts -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
index 7be811c..d158072 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
@@ -114,7 +114,7 @@
}
public void connect(RestletConsumer consumer) throws Exception {
- RestletEndpoint endpoint = consumer.getEndpoint();
+ RestletEndpoint endpoint = (RestletEndpoint)consumer.getEndpoint();
addServerIfNecessary(endpoint);
if (endpoint.getUriPattern() != null && endpoint.getUriPattern().length() > 0) {
@@ -129,7 +129,7 @@
}
public void disconnect(RestletConsumer consumer) throws Exception {
- RestletEndpoint endpoint = consumer.getEndpoint();
+ RestletEndpoint endpoint = (RestletEndpoint)consumer.getEndpoint();
List<MethodBasedRouter> routers = new ArrayList<MethodBasedRouter>();
diff --git a/components/camel-rmi/pom.xml b/components/camel-rmi/pom.xml
index cd654b4..4ceda6d 100644
--- a/components/camel-rmi/pom.xml
+++ b/components/camel-rmi/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java b/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java
index a68bb67..9d8957d 100644
--- a/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java
+++ b/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java
@@ -44,10 +44,10 @@
// lookup remote interfaces
List<Class<?>> classes = new ArrayList<Class<?>>();
- Iterator<?> it = getAndRemoveParameter(parameters, "remoteInterfaces", Iterator.class);
+ Iterator it = getAndRemoveParameter(parameters, "remoteInterfaces", Iterator.class);
while (it != null && it.hasNext()) {
Object next = it.next();
- Class<?> clazz = getCamelContext().getTypeConverter().mandatoryConvertTo(Class.class, next);
+ Class clazz = getCamelContext().getTypeConverter().mandatoryConvertTo(Class.class, next);
classes.add(clazz);
}
diff --git a/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java b/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java
index 68ec931..ab4ef19 100644
--- a/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java
+++ b/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java
@@ -48,7 +48,7 @@
@Override
protected void doStart() throws Exception {
- Class<?>[] interfaces = new Class[endpoint.getRemoteInterfaces().size()];
+ Class[] interfaces = new Class[endpoint.getRemoteInterfaces().size()];
endpoint.getRemoteInterfaces().toArray(interfaces);
proxy = (Remote)Proxy.newProxyInstance(endpoint.getClassLoader(), interfaces, this);
stub = UnicastRemoteObject.exportObject(proxy, endpoint.getPort());
diff --git a/components/camel-routebox/pom.xml b/components/camel-routebox/pom.xml
index 538f66c..e20b46c 100644
--- a/components/camel-routebox/pom.xml
+++ b/components/camel-routebox/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>camel-parent</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java
index e9937ee..7043b0e 100644
--- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java
+++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/RouteboxConfiguration.java
@@ -111,7 +111,7 @@
}
if (parameters.containsKey("routeBuilders")) {
- routeBuilders = component.resolveAndRemoveReferenceParameter(parameters, "routeBuilders", List.class);
+ routeBuilders = (List<RouteBuilder>) component.resolveAndRemoveReferenceParameter(parameters, "routeBuilders", List.class);
}
if (parameters.containsKey("innerRegistry")) {
@@ -134,7 +134,7 @@
producerUri = component.resolveAndRemoveReferenceParameter(parameters, "producerUri", URI.class, new URI("routebox:" + getEndpointName()));
dispatchStrategy = component.resolveAndRemoveReferenceParameter(parameters, "dispatchStrategy", RouteboxDispatchStrategy.class, null);
- dispatchMap = component.resolveAndRemoveReferenceParameter(parameters, "dispatchMap", HashMap.class, new HashMap<String, String>());
+ dispatchMap = (HashMap<String, String>) component.resolveAndRemoveReferenceParameter(parameters, "dispatchMap", HashMap.class, new HashMap<String, String>());
if (dispatchStrategy == null && dispatchMap == null) {
LOG.warn("No Routebox Dispatch Map or Strategy has been set. Routebox may not have more than one inner route.");
}
diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
index bee0980..9c723e8 100644
--- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
+++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/direct/RouteboxDirectConsumer.java
@@ -95,8 +95,7 @@
return 0;
}
- @Override
- public void prepareShutdown(boolean forced) {
+ public void prepareShutdown() {
// noop
}
diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
index 9db3a42..6bda05f 100644
--- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
+++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/seda/RouteboxSedaConsumer.java
@@ -122,9 +122,8 @@
// TODO: Get size of queue
return 0;
}
-
- @Override
- public void prepareShutdown(boolean forced) {
+
+ public void prepareShutdown() {
}
public void setProcessor(AsyncProcessor processor) {
diff --git a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/strategy/RouteboxDispatcher.java b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/strategy/RouteboxDispatcher.java
index c761401..6e94f2c 100644
--- a/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/strategy/RouteboxDispatcher.java
+++ b/components/camel-routebox/src/main/java/org/apache/camel/component/routebox/strategy/RouteboxDispatcher.java
@@ -120,8 +120,7 @@
return dispatchUri;
}
-
- @SuppressWarnings("deprecation")
+
protected List<URI> getInnerContextConsumerList(CamelContext context) throws URISyntaxException {
List<URI> consumerList = new ArrayList<URI>();
List<RouteDefinition> routeDefinitions = context.getRouteDefinitions();
diff --git a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDefaultContextAndRouteBuilderTest.java b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDefaultContextAndRouteBuilderTest.java
index dc17ffb..ffdd8ab 100644
--- a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDefaultContextAndRouteBuilderTest.java
+++ b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDefaultContextAndRouteBuilderTest.java
@@ -84,7 +84,7 @@
String response = sendAddToCatalogRequest(template, routeboxUri, "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
- book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
+ book = (Book) sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
diff --git a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectProducerOnlyTest.java b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectProducerOnlyTest.java
index 8735902..7b7ef27 100644
--- a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectProducerOnlyTest.java
+++ b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectProducerOnlyTest.java
@@ -86,7 +86,7 @@
//Thread.sleep(2000);
- book = sendFindBookRequest(template, "direct:start", "findBook", "Sir Arthur Conan Doyle");
+ book = (Book) sendFindBookRequest(template, "direct:start", "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
diff --git a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectTest.java b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectTest.java
index ce2bffd..ec10405 100644
--- a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectTest.java
+++ b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDirectTest.java
@@ -88,7 +88,7 @@
// to allow the earlier request to take effect
//Thread.sleep(2000);
- book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
+ book = (Book) sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
diff --git a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDispatchMapTest.java b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDispatchMapTest.java
index f4fec9d..7cdc016 100644
--- a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDispatchMapTest.java
+++ b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxDispatchMapTest.java
@@ -90,7 +90,7 @@
String response = sendAddToCatalogRequest(template, routeboxUri, "addToCatalog", book);
assertEquals("Book with Author " + book.getAuthor() + " and title " + book.getTitle() + " added to Catalog", response);
- book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
+ book = (Book) sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
diff --git a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxSedaTest.java b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxSedaTest.java
index 4d2f9dc..5491127 100644
--- a/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxSedaTest.java
+++ b/components/camel-routebox/src/test/java/org/apache/camel/component/routebox/RouteboxSedaTest.java
@@ -88,7 +88,7 @@
// to allow the earlier request to take effect
//Thread.sleep(2000);
- book = sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
+ book = (Book) sendFindBookRequest(template, routeboxUri, "findBook", "Sir Arthur Conan Doyle");
LOG.debug("Received book with author {} and title {}", book.getAuthor(), book.getTitle());
assertEquals("The Adventures of Sherlock Holmes", book.getTitle());
diff --git a/components/camel-routebox/src/test/resources/log4j.properties b/components/camel-routebox/src/test/resources/log4j.properties
index b7c75a6..ad390bd 100644
--- a/components/camel-routebox/src/test/resources/log4j.properties
+++ b/components/camel-routebox/src/test/resources/log4j.properties
@@ -1,35 +1,20 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
#
-# The logging properties used during tests..
+# The logging properties used for eclipse testing, We want to see debug output on the console.
#
-log4j.rootLogger=INFO, out
+log4j.rootLogger=INFO, file
-#log4j.logger.org.apache.camel.component.routebox=DEBUG
+log4j.logger.org.springframework=WARN
+#log4j.logger.org.apache.camel=DEBUG
# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/camel-routebox-test.log
-log4j.appender.out.append=true
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
+log4j.appender.file.file=target/camel-routebox.log
diff --git a/components/camel-rss/pom.xml b/components/camel-rss/pom.xml
index 7283887..d08c9bf 100644
--- a/components/camel-rss/pom.xml
+++ b/components/camel-rss/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java
index 01df5e0..fbd8700 100644
--- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java
+++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java
@@ -47,7 +47,7 @@
// for the http feed
String feedUri;
if (!parameters.isEmpty()) {
- Map<String, Object> options = new LinkedHashMap<String, Object>(parameters);
+ Map<Object, Object> options = new LinkedHashMap<Object, Object>(parameters);
String query = URISupport.createQueryString(options);
feedUri = remaining + "?" + query;
} else {
diff --git a/components/camel-ruby/pom.xml b/components/camel-ruby/pom.xml
index 134a10d..9ba5c1d 100644
--- a/components/camel-ruby/pom.xml
+++ b/components/camel-ruby/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-ruby/src/main/java/org/apache/camel/ruby/ScriptRouteBuilder.java b/components/camel-ruby/src/main/java/org/apache/camel/ruby/ScriptRouteBuilder.java
index bf18ff5..60bf27f 100644
--- a/components/camel-ruby/src/main/java/org/apache/camel/ruby/ScriptRouteBuilder.java
+++ b/components/camel-ruby/src/main/java/org/apache/camel/ruby/ScriptRouteBuilder.java
@@ -32,7 +32,7 @@
*/
public abstract class ScriptRouteBuilder extends RouteBuilder {
private static final transient Logger LOG = LoggerFactory.getLogger(ScriptRouteBuilder.class);
- protected ProcessorDefinition<?> node;
+ protected ProcessorDefinition node;
public ScriptRouteBuilder() {
}
@@ -47,24 +47,24 @@
this.node = route;
}
- public ProcessorDefinition<?> to(String uri) {
+ public ProcessorDefinition to(String uri) {
return getNode().to(uri);
}
- public ProcessorDefinition<?> to(Endpoint endpoint) {
+ public ProcessorDefinition to(Endpoint endpoint) {
return getNode().to(endpoint);
}
- public ProcessorDefinition<?> getNode() {
+ public ProcessorDefinition getNode() {
if (node == null) {
throw new IllegalStateException("You must define a route first via the from() method");
}
return node;
}
- public void setNode(ProcessorDefinition<?> node) {
+ public void setNode(ProcessorDefinition node) {
this.node = node;
- LOG.info("Node is now: {}", node);
+ LOG.info("Node is now: " + node);
}
}
diff --git a/components/camel-saxon/pom.xml b/components/camel-saxon/pom.xml
index c0212b7..a97863f 100644
--- a/components/camel-saxon/pom.xml
+++ b/components/camel-saxon/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -53,13 +53,25 @@
<dependency>
<groupId>net.sf.saxon</groupId>
- <artifactId>saxon9he</artifactId>
+ <artifactId>saxon</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-sql</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-xpath</artifactId>
+ </dependency>
+
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
index 761a2c8..2083652 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryAnnotationExpressionFactory.java
@@ -33,9 +33,10 @@
*/
public class XQueryAnnotationExpressionFactory extends DefaultAnnotationExpressionFactory {
+ @SuppressWarnings("unchecked")
@Override
public Expression createExpression(CamelContext camelContext, Annotation annotation,
- LanguageAnnotation languageAnnotation, Class<?> expressionReturnType) {
+ LanguageAnnotation languageAnnotation, Class expressionReturnType) {
String xQuery = getExpressionFromAnnotation(annotation);
XQueryBuilder builder = XQueryBuilder.xquery(xQuery);
if (annotation instanceof XQuery) {
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
index 4ac98fd..edfb683 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryBuilder.java
@@ -43,15 +43,16 @@
import org.w3c.dom.Node;
import net.sf.saxon.Configuration;
-import net.sf.saxon.lib.ModuleURIResolver;
import net.sf.saxon.om.DocumentInfo;
import net.sf.saxon.om.Item;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.query.DynamicQueryContext;
+import net.sf.saxon.query.ModuleURIResolver;
import net.sf.saxon.query.StaticQueryContext;
import net.sf.saxon.query.XQueryExpression;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.value.Whitespace;
+
import org.apache.camel.BytesSource;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
@@ -70,8 +71,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-
/**
* Creates an XQuery builder.
* <p/>
@@ -88,7 +87,7 @@
private Map<String, String> namespacePrefixes = new HashMap<String, String>();
private ResultFormat resultsFormat = ResultFormat.DOM;
private Properties properties = new Properties();
- private Class<?> resultType;
+ private Class resultType;
private final AtomicBoolean initialized = new AtomicBoolean(false);
private boolean stripsAllWhiteSpace = true;
private ModuleURIResolver moduleURIResolver;
@@ -112,6 +111,7 @@
return exchange.getContext().getTypeConverter().convertTo(type, result);
}
+ @SuppressWarnings("unchecked")
public Object evaluate(Exchange exchange) {
try {
LOG.debug("Evaluation: {} for exchange: {}", expression, exchange);
@@ -147,7 +147,7 @@
}
}
- public List<?> evaluateAsList(Exchange exchange) throws Exception {
+ public List evaluateAsList(Exchange exchange) throws Exception {
initialize(exchange);
return getExpression().evaluate(createDynamicContext(exchange));
@@ -205,7 +205,7 @@
public boolean matches(Exchange exchange) {
try {
- List<?> list = evaluateAsList(exchange);
+ List list = evaluateAsList(exchange);
return matches(exchange, list);
} catch (Exception e) {
throw new RuntimeExpressionException(e);
@@ -213,7 +213,7 @@
}
public void assertMatches(String text, Exchange exchange) throws AssertionError {
- List<?> list;
+ List list;
try {
list = evaluateAsList(exchange);
@@ -285,7 +285,7 @@
return this;
}
- public XQueryBuilder resultType(Class<?> resultType) {
+ public XQueryBuilder resultType(Class resultType) {
setResultType(resultType);
return this;
}
@@ -405,11 +405,11 @@
this.resultsFormat = resultsFormat;
}
- public Class<?> getResultType() {
+ public Class getResultType() {
return resultType;
}
- public void setResultType(Class<?> resultType) {
+ public void setResultType(Class resultType) {
this.resultType = resultType;
}
@@ -490,7 +490,7 @@
throw new NoTypeConversionAvailableException(body, Source.class);
}
- DocumentInfo doc = config.buildDocument(source);
+ DocumentInfo doc = getStaticQueryContext().buildDocument(source);
dynamicQueryContext.setContextItem(doc);
} finally {
// can deal if is is null
@@ -597,7 +597,7 @@
}
}
- protected boolean matches(Exchange exchange, List<?> results) {
+ protected boolean matches(Exchange exchange, List results) {
return ObjectHelper.matches(results);
}
@@ -612,7 +612,7 @@
configuration.setHostLanguage(Configuration.XQUERY);
configuration.setStripsWhiteSpace(isStripsAllWhiteSpace() ? Whitespace.ALL : Whitespace.IGNORABLE);
- staticQueryContext = getConfiguration().newStaticQueryContext();
+ staticQueryContext = new StaticQueryContext(getConfiguration());
if (moduleURIResolver != null) {
staticQueryContext.setModuleURIResolver(moduleURIResolver);
}
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
index 9c243d1..c96a04c 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryComponent.java
@@ -19,7 +19,7 @@
import java.net.URL;
import java.util.Map;
-import net.sf.saxon.lib.ModuleURIResolver;
+import net.sf.saxon.query.ModuleURIResolver;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
import org.apache.camel.impl.ProcessorEndpoint;
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryModuleURIResolver.java b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryModuleURIResolver.java
index 4ab217c..cb31cdb 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryModuleURIResolver.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/component/xquery/XQueryModuleURIResolver.java
@@ -18,7 +18,7 @@
import javax.xml.transform.stream.StreamSource;
-import net.sf.saxon.lib.ModuleURIResolver;
+import net.sf.saxon.query.ModuleURIResolver;
import net.sf.saxon.trans.XPathException;
/**
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointTest.java
index 61e330c..fb96b98 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryEndpointTest.java
@@ -50,6 +50,10 @@
assertEquals("bean.subject", "Hey", bean.getSubject());
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected ClassPathXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/xquery/camelContext.xml");
}
diff --git a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java
index 529f84a..6d34db7 100644
--- a/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java
+++ b/components/camel-saxon/src/test/java/org/apache/camel/component/xquery/XQueryPredicateFilterTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.xquery;
+import org.w3c.dom.Document;
+
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
diff --git a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
index aa16576..5de4d14 100644
--- a/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
+++ b/components/camel-saxon/src/test/resources/org/apache/camel/language/xpath/XPathLanguageTest.xml
@@ -33,7 +33,7 @@
<route>
<from uri="seda:testSaxonWithFlag"/>
<setBody>
- <xpath saxon="true" resultType="java.lang.String" logNamespaces="true">tokenize(a, '\|')</xpath>
+ <xpath saxon="true" resultType="java.lang.String" traceNamespaces="true">tokenize(a, '\|')</xpath>
</setBody>
<log message="Test Saxon with flag: ${body}"/>
<to uri="mock:testSaxonWithFlagResult"/>
@@ -42,7 +42,7 @@
<route>
<from uri="seda:testSaxonWithFactory"/>
<setBody>
- <xpath factoryRef="saxonFactory" resultType="java.lang.String" logNamespaces="true">tokenize(a, '\|')</xpath>
+ <xpath factoryRef="saxonFactory" resultType="java.lang.String" traceNamespaces="true">tokenize(a, '\|')</xpath>
</setBody>
<log message="Test Saxon with factory: ${body}"/>
<to uri="mock:testSaxonWithFactoryResult"/>
diff --git a/components/camel-scala/pom.xml b/components/camel-scala/pom.xml
index 1537ce3..44ea548 100644
--- a/components/camel-scala/pom.xml
+++ b/components/camel-scala/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
<artifactId>camel-scala</artifactId>
@@ -69,7 +69,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
index 22858dc..6ceb6f6 100644
--- a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
+++ b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/DSL.scala
@@ -45,7 +45,7 @@
def filter(predicate: Exchange => Any) : SFilterDefinition
- def handle[E <: Throwable](block: => Unit)(implicit manifest: Manifest[E]) : SOnExceptionDefinition[E]
+ def handle[E](block: => Unit)(implicit manifest: Manifest[E]) : SOnExceptionDefinition
def id(id : String): DSL
def idempotentConsumer(expression: Exchange => Any): SIdempotentConsumerDefinition
diff --git a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
index 96d3616..bdba31a 100644
--- a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
+++ b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SAbstractDefinition.scala
@@ -74,7 +74,7 @@
def filter(predicate: Exchange => Any) = SFilterDefinition(target.filter(predicateBuilder(predicate)))
- def handle[E <: Throwable](block: => Unit)(implicit manifest: Manifest[E]) = SOnExceptionDefinition[E](target.onException(manifest.erasure.asInstanceOf[Class[Throwable]])).apply(block)
+ def handle[E](block: => Unit)(implicit manifest: Manifest[E]) = SOnExceptionDefinition(target.onException(manifest.erasure)).apply(block)
def id(id : String) = wrap(target.id(id))
def idempotentConsumer(expression: Exchange => Any) = SIdempotentConsumerDefinition(target.idempotentConsumer(expression, null))
diff --git a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala
index ab15ee6..8c07bff 100644
--- a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala
+++ b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/SOnExceptionDefinition.scala
@@ -25,9 +25,9 @@
/**
* Scala enrichment for Camel's OnExceptionDefinition
*/
-case class SOnExceptionDefinition[E <: Throwable](override val target: OnExceptionDefinition)(implicit val builder: RouteBuilder) extends SAbstractDefinition[OnExceptionDefinition] {
+case class SOnExceptionDefinition(override val target: OnExceptionDefinition)(implicit val builder: RouteBuilder) extends SAbstractDefinition[OnExceptionDefinition] {
- override def apply(block: => Unit) = super.apply(block).asInstanceOf[SOnExceptionDefinition[E]]
+ override def apply(block: => Unit) = super.apply(block).asInstanceOf[SOnExceptionDefinition]
def handled = wrap(target.handled(true))
def handled(predicate: Exchange => Any) = wrap(target.handled(predicateBuilder(predicate)))
@@ -45,6 +45,6 @@
def useOriginalMessage = wrap(target.useOriginalMessage)
- override def wrap(block: => Unit) = super.wrap(block).asInstanceOf[SOnExceptionDefinition[E]]
+ override def wrap(block: => Unit) = super.wrap(block).asInstanceOf[SOnExceptionDefinition]
}
diff --git a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala
index 71de069..3400392 100644
--- a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala
+++ b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/STryDefinition.scala
@@ -26,7 +26,7 @@
override def apply(block: => Unit) : STryDefinition = super.apply(block).asInstanceOf[STryDefinition]
- def handle[E <: Throwable](exception: Class[E]) = {
+ def handle[Target](exception: Class[Target]) = {
target.doCatch(exception)
this
}
diff --git a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
index 8b841fb..27e0d0e 100644
--- a/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
+++ b/components/camel-scala/src/main/scala/org/apache/camel/scala/dsl/builder/RouteBuilder.scala
@@ -82,9 +82,9 @@
* This is done a bit differently - the implicit manifest parameter forces us to define the block in the same
* method definition
*/
- def handle[E <: Throwable](block: => Unit)(implicit manifest: Manifest[E]) = {
+ def handle[E](block: => Unit)(implicit manifest: Manifest[E]) = {
stack.size match {
- case 0 => SOnExceptionDefinition[E](builder.onException(manifest.erasure.asInstanceOf[Class[Throwable]]))(this).apply(block)
+ case 0 => SOnExceptionDefinition(builder.onException(manifest.erasure))(this).apply(block)
case _ => stack.top.handle[E](block)
}
}
diff --git a/components/camel-script/pom.xml b/components/camel-script/pom.xml
index 378da42..2c0db60 100644
--- a/components/camel-script/pom.xml
+++ b/components/camel-script/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -79,7 +79,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-script/src/main/java/org/apache/camel/script/osgi/Activator.java b/components/camel-script/src/main/java/org/apache/camel/script/osgi/Activator.java
index 0eccfea..126220b 100644
--- a/components/camel-script/src/main/java/org/apache/camel/script/osgi/Activator.java
+++ b/components/camel-script/src/main/java/org/apache/camel/script/osgi/Activator.java
@@ -30,8 +30,6 @@
import org.apache.camel.impl.osgi.tracker.BundleTracker;
import org.apache.camel.impl.osgi.tracker.BundleTrackerCustomizer;
-import org.apache.camel.util.IOHelper;
-
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -39,7 +37,6 @@
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -120,7 +117,7 @@
protected void registerScriptEngines(Bundle bundle, List<BundleScriptEngineResolver> resolvers) {
URL configURL = null;
- for (Enumeration<?> e = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); e != null && e.hasMoreElements();) {
+ for (Enumeration e = bundle.findEntries(META_INF_SERVICES_DIR, SCRIPT_ENGINE_SERVICE_FILE, false); e != null && e.hasMoreElements();) {
configURL = (URL) e.nextElement();
}
if (configURL != null) {
@@ -149,10 +146,10 @@
}
public ScriptEngine resolveScriptEngine(String name) {
try {
- BufferedReader in = IOHelper.buffered(new InputStreamReader(configFile.openStream()));
+ BufferedReader in = new BufferedReader(new InputStreamReader(configFile.openStream()));
String className = in.readLine();
in.close();
- Class<?> cls = bundle.loadClass(className);
+ Class cls = bundle.loadClass(className);
if (!ScriptEngineFactory.class.isAssignableFrom(cls)) {
throw new IllegalStateException("Invalid ScriptEngineFactory: " + cls.getName());
}
diff --git a/components/camel-servlet/pom.xml b/components/camel-servlet/pom.xml
index cbe1ecb..c242e17 100644
--- a/components/camel-servlet/pom.xml
+++ b/components/camel-servlet/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -80,11 +80,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/DefaultHttpRegistry.java b/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/DefaultHttpRegistry.java
index 191d574..172820a 100644
--- a/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/DefaultHttpRegistry.java
+++ b/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/DefaultHttpRegistry.java
@@ -73,13 +73,13 @@
@SuppressWarnings("rawtypes")
public void register(CamelServlet provider, Map properties) {
LOG.debug("Registering provider through OSGi service listener {}", properties);
- CamelServlet camelServlet = provider;
+ CamelServlet camelServlet = (CamelServlet)provider;
camelServlet.setServletName((String) properties.get("servlet-name"));
register(camelServlet);
}
public void unregister(CamelServlet provider, Map<String, Object> properties) {
- unregister(provider);
+ unregister((CamelServlet)provider);
}
@Override
diff --git a/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java b/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java
index d16c452..50e34f0 100644
--- a/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java
+++ b/components/camel-servlet/src/main/java/org/apache/camel/component/servlet/ServletComponent.java
@@ -27,6 +27,7 @@
import org.apache.camel.component.http.HttpClientConfigurer;
import org.apache.camel.component.http.HttpComponent;
import org.apache.camel.component.http.HttpConsumer;
+import org.apache.camel.util.CastUtils;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.URISupport;
import org.apache.camel.util.UnsafeUriCharactersEncoder;
@@ -72,7 +73,7 @@
String servletName = getAndRemoveParameter(parameters, "servletName", String.class, getServletName());
// restructure uri to be based on the parameters left as we dont want to include the Camel internal options
- URI httpUri = URISupport.createRemainingURI(new URI(UnsafeUriCharactersEncoder.encode(uri)), parameters);
+ URI httpUri = URISupport.createRemainingURI(new URI(UnsafeUriCharactersEncoder.encode(uri)), CastUtils.cast(parameters));
ServletEndpoint endpoint = createServletEndpoint(uri, this, httpUri, params, getHttpConnectionManager(), configurer);
endpoint.setServletName(servletName);
diff --git a/components/camel-shiro/pom.xml b/components/camel-shiro/pom.xml
index 57549a9..46aa149 100644
--- a/components/camel-shiro/pom.xml
+++ b/components/camel-shiro/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-shiro</artifactId>
@@ -40,9 +40,9 @@
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-core</artifactId>
- <version>${shiro-version}</version>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.shiro</artifactId>
+ <version>${shiro-bundle-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-shiro/src/main/java/org/apache/camel/component/shiro/security/ShiroSecurityPolicy.java b/components/camel-shiro/src/main/java/org/apache/camel/component/shiro/security/ShiroSecurityPolicy.java
index f3ef34a..760f6ab 100644
--- a/components/camel-shiro/src/main/java/org/apache/camel/component/shiro/security/ShiroSecurityPolicy.java
+++ b/components/camel-shiro/src/main/java/org/apache/camel/component/shiro/security/ShiroSecurityPolicy.java
@@ -73,14 +73,14 @@
public ShiroSecurityPolicy(String iniResourcePath) {
this();
Factory<SecurityManager> factory = new IniSecurityManagerFactory(iniResourcePath);
- securityManager = factory.getInstance();
+ securityManager = (SecurityManager) factory.getInstance();
SecurityUtils.setSecurityManager(securityManager);
}
public ShiroSecurityPolicy(Ini ini) {
this();
Factory<SecurityManager> factory = new IniSecurityManagerFactory(ini);
- securityManager = factory.getInstance();
+ securityManager = (SecurityManager) factory.getInstance();
SecurityUtils.setSecurityManager(securityManager);
}
diff --git a/components/camel-sip/pom.xml b/components/camel-sip/pom.xml
index da45e8b..10a255b 100644
--- a/components/camel-sip/pom.xml
+++ b/components/camel-sip/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-sip</artifactId>
diff --git a/components/camel-sip/src/main/java/org/apache/camel/component/sip/SipConfiguration.java b/components/camel-sip/src/main/java/org/apache/camel/component/sip/SipConfiguration.java
index f1c8604..b107959 100644
--- a/components/camel-sip/src/main/java/org/apache/camel/component/sip/SipConfiguration.java
+++ b/components/camel-sip/src/main/java/org/apache/camel/component/sip/SipConfiguration.java
@@ -327,7 +327,7 @@
}
private void createViaHeaders() throws ParseException, InvalidArgumentException {
- viaHeaders = new ArrayList<ViaHeader>();
+ viaHeaders = new ArrayList();
ViaHeader viaHeader = headerFactory.createViaHeader(getFromHost(), getFromPort(),
getTransport(), null);
diff --git a/components/camel-smpp/pom.xml b/components/camel-smpp/pom.xml
index 81bff71..ef93369 100644
--- a/components/camel-smpp/pom.xml
+++ b/components/camel-smpp/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -58,7 +58,12 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-snmp/pom.xml b/components/camel-snmp/pom.xml
index 23973dd..a65e0d1 100644
--- a/components/camel-snmp/pom.xml
+++ b/components/camel-snmp/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpComponent.java b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpComponent.java
index 8579656..c8061d8 100644
--- a/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpComponent.java
+++ b/components/camel-snmp/src/main/java/org/apache/camel/component/snmp/SnmpComponent.java
@@ -28,7 +28,8 @@
public class SnmpComponent extends DefaultComponent {
@Override
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ @SuppressWarnings("unchecked")
+ protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
SnmpEndpoint endpoint = new SnmpEndpoint(uri, this);
setProperties(endpoint, parameters);
endpoint.initiate();
diff --git a/components/camel-soap/pom.xml b/components/camel-soap/pom.xml
index 50e6541..b1b618f 100644
--- a/components/camel-soap/pom.xml
+++ b/components/camel-soap/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/TestUtil.java b/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/TestUtil.java
index 10f43fa..ee1f7cc 100644
--- a/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/TestUtil.java
+++ b/components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/TestUtil.java
@@ -21,8 +21,6 @@
import java.io.InputStream;
import java.io.InputStreamReader;
-import org.apache.camel.util.IOHelper;
-
public final class TestUtil {
private TestUtil() {
}
@@ -30,7 +28,8 @@
public static String readStream(InputStream is) throws IOException {
try {
StringBuilder sb = new StringBuilder();
- BufferedReader reader = IOHelper.buffered(new InputStreamReader(is, "UTF-8"));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ is, "UTF-8"));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
diff --git a/components/camel-solr/pom.xml b/components/camel-solr/pom.xml
index 0919e4d..ecfb5eb 100644
--- a/components/camel-solr/pom.xml
+++ b/components/camel-solr/pom.xml
@@ -17,14 +17,14 @@
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
+
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel</groupId>
@@ -33,92 +33,100 @@
<name>Camel :: Solr</name>
<description>Camel Solr Support</description>
- <properties>
- <camel.osgi.export.pkg>
- org.apache.camel.component.solr.*;${camel.osgi.version}
- </camel.osgi.export.pkg>
- </properties>
+ <properties>
+ <camel.osgi.export.pkg>
+ org.apache.camel.component.solr.*;${camel.osgi.version}
+ </camel.osgi.export.pkg>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-solrj</artifactId>
- <version>${solr-version}</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons-codec-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-solrj</artifactId>
+ <version>${solr-version}</version>
+ </dependency>
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <scope>test</scope>
- </dependency>
+ <!-- testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-core</artifactId>
- <version>${solr-version}</version>
- <scope>test</scope>
- <exclusions>
- <!-- exclude jdk14 as we want to use log4j -->
- <exclusion>
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-core</artifactId>
+ <version>${solr-version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <!-- exclude jdk14 as we want to use log4j -->
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.solr</groupId>
+ <artifactId>solr-cell</artifactId>
+ <version>${solr-version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <!-- exclude netcdf as it has a slf4j binding -->
+ <exclusion>
+ <groupId>edu.ucar</groupId>
+ <artifactId>netcdf</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.24</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jms</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-script</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- logging -->
+ <dependency>
<groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-cell</artifactId>
- <version>${solr-version}</version>
- <scope>test</scope>
- <exclusions>
- <!-- exclude netcdf as it has a slf4j binding -->
- <exclusion>
- <groupId>edu.ucar</groupId>
- <artifactId>netcdf</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.24</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-script</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
</project>
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
index b816c97..34a0933 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrComponent.java
@@ -26,7 +26,7 @@
public class SolrComponent extends DefaultComponent {
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- Endpoint endpoint = new SolrEndpoint(uri, this, remaining, parameters);
+ Endpoint endpoint = new SolrEndpoint(uri, this, remaining);
setProperties(endpoint, parameters);
return endpoint;
}
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
index 11c5623..c234dbf 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrConstants.java
@@ -25,16 +25,10 @@
public static final String OPERATION_ROLLBACK = "ROLLBACK";
public static final String OPERATION_OPTIMIZE = "OPTIMIZE";
public static final String OPERATION_INSERT = "INSERT";
- public static final String OPERATION_INSERT_STREAMING = "INSERT_STREAMING";
public static final String OPERATION_ADD_BEAN = "ADD_BEAN";
public static final String OPERATION_DELETE_BY_ID = "DELETE_BY_ID";
public static final String OPERATION_DELETE_BY_QUERY = "DELETE_BY_QUERY";
- public static final String PARAM_STREAMING_QUEUE_SIZE = "streamingQueueSize";
- public static final String PARAM_STREAMING_THREAD_COUNT = "streamingThreadCount";
- public static final int DEFUALT_STREAMING_QUEUE_SIZE = 10;
- public static final int DEFAULT_STREAMING_THREAD_COUNT = 2;
-
private SolrConstants() {
throw new AssertionError();
}
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
index d8769e7..d4e60c9 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrEndpoint.java
@@ -16,13 +16,11 @@
*/
package org.apache.camel.component.solr;
-import java.util.Map;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
-import org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer;
/**
* Represents a Solr endpoint.
@@ -30,25 +28,22 @@
public class SolrEndpoint extends DefaultEndpoint {
private CommonsHttpSolrServer solrServer;
- private CommonsHttpSolrServer streamingSolrServer;
private String requestHandler;
- private int streamingThreadCount;
- private int streamingQueueSize;
- public SolrEndpoint(String endpointUri, SolrComponent component, String address, Map<String, Object> parameters) throws Exception {
- super(endpointUri, component);
-
- solrServer = new CommonsHttpSolrServer("http://" + address);
- streamingQueueSize = getIntFromString((String) parameters.get(SolrConstants.PARAM_STREAMING_QUEUE_SIZE), SolrConstants.DEFUALT_STREAMING_QUEUE_SIZE);
- streamingThreadCount = getIntFromString((String) parameters.get(SolrConstants.PARAM_STREAMING_THREAD_COUNT), SolrConstants.DEFAULT_STREAMING_THREAD_COUNT);
- streamingSolrServer = new StreamingUpdateSolrServer("http://" + address, streamingQueueSize, streamingThreadCount);
+ public SolrEndpoint() {
}
- public static int getIntFromString(String value, int defaultValue) {
- if (value != null && value.length() > 0) {
- return Integer.parseInt(value);
- }
- return defaultValue;
+ public SolrEndpoint(String uri, SolrComponent component) {
+ super(uri, component);
+ }
+
+ public SolrEndpoint(String endpointUri) {
+ super(endpointUri);
+ }
+
+ public SolrEndpoint(String endpointUri, SolrComponent component, String address) throws Exception {
+ super(endpointUri, component);
+ solrServer = new CommonsHttpSolrServer("http://" + address);
}
@Override
@@ -70,47 +65,32 @@
return solrServer;
}
- public CommonsHttpSolrServer getStreamingSolrServer() {
- return streamingSolrServer;
- }
-
- public void setStreamingSolrServer(CommonsHttpSolrServer streamingSolrServer) {
- this.streamingSolrServer = streamingSolrServer;
- }
-
public void setMaxRetries(int maxRetries) {
solrServer.setMaxRetries(maxRetries);
- streamingSolrServer.setMaxRetries(maxRetries);
}
public void setSoTimeout(int soTimeout) {
solrServer.setSoTimeout(soTimeout);
- streamingSolrServer.setSoTimeout(soTimeout);
}
public void setConnectionTimeout(int connectionTimeout) {
solrServer.setConnectionTimeout(connectionTimeout);
- streamingSolrServer.setConnectionTimeout(connectionTimeout);
}
public void setDefaultMaxConnectionsPerHost(int defaultMaxConnectionsPerHost) {
solrServer.setDefaultMaxConnectionsPerHost(defaultMaxConnectionsPerHost);
- streamingSolrServer.setDefaultMaxConnectionsPerHost(defaultMaxConnectionsPerHost);
}
public void setMaxTotalConnections(int maxTotalConnections) {
solrServer.setMaxTotalConnections(maxTotalConnections);
- streamingSolrServer.setMaxTotalConnections(maxTotalConnections);
}
public void setFollowRedirects(boolean followRedirects) {
solrServer.setFollowRedirects(followRedirects);
- streamingSolrServer.setFollowRedirects(followRedirects);
}
public void setAllowCompression(boolean allowCompression) {
solrServer.setAllowCompression(allowCompression);
- streamingSolrServer.setAllowCompression(allowCompression);
}
public void setRequestHandler(String requestHandler) {
@@ -120,20 +100,4 @@
public String getRequestHandler() {
return requestHandler;
}
-
- public int getStreamingThreadCount() {
- return streamingThreadCount;
- }
-
- public void setStreamingThreadCount(int streamingThreadCount) {
- this.streamingThreadCount = streamingThreadCount;
- }
-
- public int getStreamingQueueSize() {
- return streamingQueueSize;
- }
-
- public void setStreamingQueueSize(int streamingQueueSize) {
- this.streamingQueueSize = streamingQueueSize;
- }
}
diff --git a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
index 7d58d91..2790a77 100644
--- a/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
+++ b/components/camel-solr/src/main/java/org/apache/camel/component/solr/SolrProducer.java
@@ -24,18 +24,19 @@
import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The Solr producer.
*/
public class SolrProducer extends DefaultProducer {
+ private static final transient Logger LOG = LoggerFactory.getLogger(SolrProducer.class);
private SolrServer solrServer;
- private SolrServer streamingSolrServer;
public SolrProducer(SolrEndpoint endpoint) {
super(endpoint);
solrServer = endpoint.getSolrServer();
- streamingSolrServer = endpoint.getStreamingSolrServer();
}
@Override
@@ -48,9 +49,7 @@
}
if (operation.equalsIgnoreCase(SolrConstants.OPERATION_INSERT)) {
- insert(exchange, false);
- } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_INSERT_STREAMING)) {
- insert(exchange, true);
+ insert(exchange);
} else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_ID)) {
solrServer.deleteById(exchange.getIn().getBody(String.class));
} else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_QUERY)) {
@@ -68,7 +67,7 @@
}
}
- private void insert(Exchange exchange, boolean isStreaming) throws Exception {
+ private void insert(Exchange exchange) throws Exception {
Object body = exchange.getIn().getBody();
@@ -83,34 +82,19 @@
}
}
- if (isStreaming) {
- updateRequest.process(streamingSolrServer);
- } else {
- updateRequest.process(solrServer);
- }
-
+ updateRequest.process(solrServer);
} else {
+ SolrInputDocument doc = new SolrInputDocument();
+ for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) {
+ if (entry.getKey().startsWith(SolrConstants.FIELD)) {
+ String fieldName = entry.getKey().substring(SolrConstants.FIELD.length());
+ doc.setField(fieldName, entry.getValue());
+ }
+ }
UpdateRequest updateRequest = new UpdateRequest(getRequestHandler());
-
- if (body instanceof SolrInputDocument) {
- updateRequest.add((SolrInputDocument) body);
- } else {
- SolrInputDocument doc = new SolrInputDocument();
- for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) {
- if (entry.getKey().startsWith(SolrConstants.FIELD)) {
- String fieldName = entry.getKey().substring(SolrConstants.FIELD.length());
- doc.setField(fieldName, entry.getValue());
- }
- }
- updateRequest.add(doc);
- }
-
- if (isStreaming) {
- updateRequest.process(streamingSolrServer);
- } else {
- updateRequest.process(solrServer);
- }
+ updateRequest.add(doc);
+ updateRequest.process(solrServer);
}
}
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/InitSolrEndpointTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/InitSolrEndpointTest.java
index aa4512b..000b8161 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/InitSolrEndpointTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/InitSolrEndpointTest.java
@@ -27,27 +27,16 @@
@Test
public void endpointCreatedCorrectlyWithAllOptions() throws Exception {
SolrEndpoint solrEndpoint = context.getEndpoint(solrUrl + getFullOptions(), SolrEndpoint.class);
- assertEquals("queue size incorrect", 5, solrEndpoint.getStreamingQueueSize());
- assertEquals("thread count incorrect", 1, solrEndpoint.getStreamingThreadCount());
assertNotNull(solrEndpoint);
}
- @Test
- public void streamingEndpointCreatedCorrectly() throws Exception {
- SolrEndpoint solrEndpoint = context.getEndpoint(solrUrl, SolrEndpoint.class);
- assertNotNull(solrEndpoint);
- assertEquals("queue size incorrect", SolrConstants.DEFUALT_STREAMING_QUEUE_SIZE, solrEndpoint.getStreamingQueueSize());
- assertEquals("thread count incorrect", SolrConstants.DEFAULT_STREAMING_THREAD_COUNT, solrEndpoint.getStreamingThreadCount());
- }
-
@Test(expected = ResolveEndpointFailedException.class)
public void wrongURLFormatFailsEndpointCreation() throws Exception {
context.getEndpoint("solr://localhost:-99/solr");
}
private String getFullOptions() {
- return "?streamingQueueSize=5&streamingThreadCount=1"
- + "&maxRetries=1&soTimeout=100&connectionTimeout=100"
+ return "?maxRetries=1&soTimeout=100&connectionTimeout=100"
+ "&defaultMaxConnectionsPerHost=100&maxTotalConnections=100"
+ "&followRedirects=false&allowCompression=true"
+ "&requestHandler=/update";
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrSpringTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrSpringTest.java
index c486942..b63a463 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrSpringTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrSpringTest.java
@@ -48,15 +48,9 @@
@Produce(uri = "direct:xml-start")
protected ProducerTemplate xmlRoute;
- @Produce(uri = "direct:xml-start-streaming")
- protected ProducerTemplate xmlRouteStreaming;
-
@Produce(uri = "direct:pdf-start")
protected ProducerTemplate pdfRoute;
- @Produce(uri = "direct:pdf-start-streaming")
- protected ProducerTemplate pdfRouteStreaming;
-
@DirtiesContext
@Test
public void endToEndIndexXMLDocuments() throws Exception {
@@ -76,26 +70,6 @@
assertEquals(Arrays.asList("Web", "Technology", "Computers"), doc.getFieldValue("cat"));
}
-
- @DirtiesContext
- @Test
- public void endToEndIndexXMLDocumentsStreaming() throws Exception {
- xmlRouteStreaming.sendBody(new File("src/test/resources/data/books.xml"));
-
- // Check things were indexed.
- QueryResponse response = executeSolrQuery("*:*");
-
- assertEquals(0, response.getStatus());
- assertEquals(4, response.getResults().getNumFound());
-
- // Check fields were indexed correctly.
- response = executeSolrQuery("title:Learning XML");
-
- SolrDocument doc = response.getResults().get(0);
- assertEquals("Learning XML", doc.getFieldValue("id"));
- assertEquals(Arrays.asList("Web", "Technology", "Computers"), doc.getFieldValue("cat"));
- }
-
@DirtiesContext
@Test
public void endToEndIndexPDFDocument() throws Exception {
@@ -112,22 +86,6 @@
assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
}
- @DirtiesContext
- @Test
- public void endToEndIndexPDFDocumentStreaming() throws Exception {
- pdfRouteStreaming.sendBody(new File("src/test/resources/data/tutorial.pdf"));
-
- QueryResponse response = executeSolrQuery("*:*");
-
- assertEquals(0, response.getStatus());
- assertEquals(1, response.getResults().getNumFound());
-
- SolrDocument doc = response.getResults().get(0);
- assertEquals("Solr", doc.getFieldValue("subject"));
- assertEquals("tutorial.pdf", doc.getFieldValue("id"));
- assertEquals(Arrays.asList("application/pdf"), doc.getFieldValue("content_type"));
- }
-
@BeforeClass
public static void beforeClass() throws Exception {
// Set appropriate paths for Solr to use.
diff --git a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
index 7b67900..9fbc3d0 100644
--- a/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
+++ b/components/camel-solr/src/test/java/org/apache/camel/component/solr/SolrUpdateTest.java
@@ -19,11 +19,11 @@
import java.io.File;
import java.util.Arrays;
import java.util.List;
+import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrInputDocument;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -40,37 +40,6 @@
}
@Test
- public void testInsertSolrInputDocument() throws Exception {
-
- SolrInputDocument doc = new SolrInputDocument();
- doc.addField("id", "MA147LL/A", 1.0f);
- template.sendBodyAndHeader("direct:start", doc, SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
-
- solrCommit();
-
- QueryResponse response = executeSolrQuery("id:MA147LL/A");
- assertEquals(0, response.getStatus());
- assertEquals(1, response.getResults().getNumFound());
- }
-
- @Test
- public void testInsertStreaming() throws Exception {
-
- Exchange exchange = createExchangeWithBody(null);
- exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT_STREAMING);
- exchange.getIn().setHeader("SolrField.id", "MA147LL/A");
- template.send("direct:start", exchange);
-
- Thread.sleep(500);
-
- solrCommit();
-
- QueryResponse response = executeSolrQuery("id:MA147LL/A");
- assertEquals(0, response.getStatus());
- assertEquals(1, response.getResults().getNumFound());
- }
-
- @Test
public void indexSingleDocumentOnlyWithId() throws Exception {
Exchange exchange = createExchangeWithBody(null);
exchange.getIn().setHeader(SolrConstants.OPERATION, SolrConstants.OPERATION_INSERT);
@@ -136,7 +105,7 @@
assertEquals(1, response.getResults().getNumFound());
SolrDocument doc = response.getResults().get(0);
- assertArrayEquals(categories, ((List<?>) doc.getFieldValue("cat")).toArray());
+ assertArrayEquals(categories, ((List) doc.getFieldValue("cat")).toArray());
}
@Test
diff --git a/components/camel-solr/src/test/resources/SolrSpringTest-context.xml b/components/camel-solr/src/test/resources/SolrSpringTest-context.xml
index cc120d4..f5caf6d 100644
--- a/components/camel-solr/src/test/resources/SolrSpringTest-context.xml
+++ b/components/camel-solr/src/test/resources/SolrSpringTest-context.xml
@@ -35,35 +35,6 @@
<to uri="solr://localhost:{{SolrServer.Port}}/solr"/>
</route>
- <route id="XMLRoute-Streaming">
- <from uri="direct:xml-start-streaming" />
- <split>
- <xpath>/bookstore/book</xpath>
- <convertBodyTo type="java.lang.String"/>
- <setHeader headerName="SolrOperation">
- <constant>INSERT_STREAMING</constant>
- </setHeader>
- <setHeader headerName="SolrField.id">
- <xpath resultType="java.lang.String">//title/text()</xpath>
- </setHeader>
- <setHeader headerName="SolrField.title">
- <xpath resultType="java.lang.String">//title/text()</xpath>
- </setHeader>
- <setHeader headerName="SolrField.cat">
- <groovy>
- def book = new XmlParser().parseText(request.body)
- book.cat.collect{ it.text() } as String[]
- </groovy>
- </setHeader>
- <to uri="solr://localhost:{{SolrServer.Port}}/solr"/>
- </split>
- <delay><constant>500</constant></delay>
- <setHeader headerName="SolrOperation">
- <constant>COMMIT</constant>
- </setHeader>
- <to uri="solr://localhost:{{SolrServer.Port}}/solr"/>
- </route>
-
<route id="PDFRoute">
<from uri="direct:pdf-start" />
<setHeader headerName="SolrOperation">
@@ -78,23 +49,6 @@
</setHeader>
<to uri="solr://localhost:{{SolrServer.Port}}/solr"/>
</route>
-
- <route id="PDFRoute-Streaming">
- <from uri="direct:pdf-start-streaming" />
- <setHeader headerName="SolrOperation">
- <constant>INSERT_STREAMING</constant>
- </setHeader>
- <setHeader headerName="SolrParam.literal.id">
- <simple>${body.name}</simple>
- </setHeader>
- <to uri="solr://localhost:{{SolrServer.Port}}/solr?requestHandler=/update/extract" />
- <delay><constant>500</constant></delay>
- <setHeader headerName="SolrOperation">
- <constant>COMMIT</constant>
- </setHeader>
- <to uri="solr://localhost:{{SolrServer.Port}}/solr"/>
- </route>
-
</camelContext>
</beans>
diff --git a/components/camel-spring-integration/pom.xml b/components/camel-spring-integration/pom.xml
index 5c43f2a..22b5350 100644
--- a/components/camel-spring-integration/pom.xml
+++ b/components/camel-spring-integration/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel</groupId>
@@ -91,7 +91,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
index e62364b..dcfc88a 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationBinding.java
@@ -32,20 +32,22 @@
// Helper class
}
- public static org.springframework.integration.Message<?> createSpringIntegrationMessage(Exchange exchange) {
+ public static org.springframework.integration.Message createSpringIntegrationMessage(Exchange exchange) {
return createSpringIntegrationMessage(exchange, exchange.getIn().getHeaders());
}
- public static org.springframework.integration.Message<?> createSpringIntegrationMessage(Exchange exchange, Map<String, Object> headers) {
+ @SuppressWarnings("unchecked")
+ public static org.springframework.integration.Message createSpringIntegrationMessage(Exchange exchange, Map<String, Object> headers) {
org.apache.camel.Message message = exchange.getIn();
- return new GenericMessage<Object>(message.getBody(), headers);
+ return new GenericMessage(message.getBody(), headers);
}
- public static org.springframework.integration.Message<?> storeToSpringIntegrationMessage(org.apache.camel.Message message) {
- return new GenericMessage<Object>(message.getBody());
+ @SuppressWarnings("unchecked")
+ public static org.springframework.integration.Message storeToSpringIntegrationMessage(org.apache.camel.Message message) {
+ return new GenericMessage(message.getBody());
}
- public static void storeToCamelMessage(org.springframework.integration.Message<?> siMessage, org.apache.camel.Message cMessage) {
+ public static void storeToCamelMessage(org.springframework.integration.Message siMessage, org.apache.camel.Message cMessage) {
cMessage.setBody(siMessage.getPayload());
cMessage.setHeaders(siMessage.getHeaders());
}
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
index 41cac10..9eb0ba4 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
@@ -130,7 +130,7 @@
}
// put the message back the outputChannel if we need
- org.springframework.integration.Message<?> siOutMessage =
+ org.springframework.integration.Message siOutMessage =
SpringIntegrationBinding.storeToSpringIntegrationMessage(exchange.getOut());
// send the message to spring integration
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
index ec9dc16..e7d0873 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationMessage.java
@@ -27,20 +27,20 @@
* @version
*/
public class SpringIntegrationMessage extends DefaultMessage {
- private org.springframework.integration.Message<?> siMessage;
+ private org.springframework.integration.Message siMessage;
public SpringIntegrationMessage() {
}
- public SpringIntegrationMessage(org.springframework.integration.Message<?> message) {
+ public SpringIntegrationMessage(org.springframework.integration.Message message) {
this.siMessage = message;
}
- public void setMessage(org.springframework.integration.Message<?> message) {
+ public void setMessage(org.springframework.integration.Message message) {
this.siMessage = message;
}
- public org.springframework.integration.Message<?> getMessage() {
+ public org.springframework.integration.Message getMessage() {
return siMessage;
}
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
index ee00594..c949535 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
@@ -100,7 +100,7 @@
}
});
}
- org.springframework.integration.Message<?> siOutmessage = SpringIntegrationBinding.createSpringIntegrationMessage(exchange);
+ org.springframework.integration.Message siOutmessage = SpringIntegrationBinding.createSpringIntegrationMessage(exchange);
// send the message to spring integration
log.debug("Sending {} to OutputChannel: {}", siOutmessage, outputChannel);
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelSourceAdapter.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelSourceAdapter.java
index 98f5a1f..c76f4cf 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelSourceAdapter.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelSourceAdapter.java
@@ -62,7 +62,7 @@
protected class ConsumerProcessor implements Processor {
public void process(final Exchange exchange) throws Exception {
- org.springframework.integration.Message<?> request = SpringIntegrationBinding.createSpringIntegrationMessage(exchange);
+ org.springframework.integration.Message request = SpringIntegrationBinding.createSpringIntegrationMessage(exchange);
if (exchange.getPattern().isOutCapable()) {
exchange.getIn().getHeaders().put(MessageHeaders.REPLY_CHANNEL , replyChannel);
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java
index 46671fd..9cc6c24 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapter.java
@@ -77,7 +77,7 @@
result = true;
}
- Message<?> response;
+ Message response;
if (isExpectReply()) {
//Check the message header for the return address
response = SpringIntegrationBinding.storeToSpringIntegrationMessage(outExchange.getOut());
diff --git a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
index 28b2921..e38c61a 100644
--- a/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
+++ b/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/converter/SpringIntegrationConverter.java
@@ -44,11 +44,12 @@
return answer;
}
+ @SuppressWarnings("unchecked")
@Converter
- public static org.springframework.integration.Message<?> toSpringMessage(final org.apache.camel.Message camelMessage) throws Exception {
+ public static org.springframework.integration.Message toSpringMessage(final org.apache.camel.Message camelMessage) throws Exception {
if (camelMessage instanceof SpringIntegrationMessage) {
SpringIntegrationMessage siMessage = (SpringIntegrationMessage)camelMessage;
- org.springframework.integration.Message<?> message = siMessage.getMessage();
+ org.springframework.integration.Message message = siMessage.getMessage();
if (message != null) {
return message;
}
@@ -56,11 +57,11 @@
// Create a new spring message and copy the attributes and body from the camel message
MessageHeaders messageHeaders = new MessageHeaders(camelMessage.getHeaders());
- return new GenericMessage<Object>(camelMessage.getBody(), messageHeaders);
+ return new GenericMessage(camelMessage.getBody(), messageHeaders);
}
@Converter
- public static org.apache.camel.Message toCamelMessage(final org.springframework.integration.Message<?> springMessage) throws Exception {
+ public static org.apache.camel.Message toCamelMessage(final org.springframework.integration.Message springMessage) throws Exception {
return new SpringIntegrationMessage(springMessage);
}
diff --git a/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java b/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java
index 84c702a..5d6ccb1 100644
--- a/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java
+++ b/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/adapter/CamelTargetAdapterTest.java
@@ -46,7 +46,7 @@
public void testSendingTwoWayMessage() throws Exception {
MessageChannel requestChannel = applicationContext.getBean("channelB", MessageChannel.class);
- Message<?> message = new GenericMessage<Object>(MESSAGE_BODY);
+ Message message = new GenericMessage<Object>(MESSAGE_BODY);
//Need to subscribe the responseChannel first
DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("channelC");
responseChannel.subscribe(new MessageHandler() {
diff --git a/components/camel-spring-javaconfig/pom.xml b/components/camel-spring-javaconfig/pom.xml
index 567d248..c13655b 100644
--- a/components/camel-spring-javaconfig/pom.xml
+++ b/components/camel-spring-javaconfig/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel</groupId>
diff --git a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
index 0b6d1e9..8c29816 100644
--- a/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
+++ b/components/camel-spring-javaconfig/src/main/java/org/apache/camel/spring/javaconfig/CamelConfiguration.java
@@ -34,6 +34,8 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+
+
/**
* A useful base class for writing
* <a href="http://www.springsource.org/javaconfig">Spring JavaConfig</a>
@@ -125,8 +127,10 @@
@Bean
public CamelBeanPostProcessor camelBeanPostProcessor() throws Exception {
CamelBeanPostProcessor answer = new CamelBeanPostProcessor();
- answer.setApplicationContext(getApplicationContext());
- // do not set CamelContext as we will lazy evaluate that later
+
+ CamelContext camelContext = getBean(CamelContext.class);
+ // lets lookup a bean
+ answer.setCamelContext(camelContext);
return answer;
}
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/BeanJavaConfigTest.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/BeanJavaConfigTest.java
index 1a48363..3d737fa 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/BeanJavaConfigTest.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/BeanJavaConfigTest.java
@@ -55,6 +55,7 @@
}
public static class SomeBean {
+
@Handler
public String someMethod(String body) {
return "Hello " + body;
@@ -63,6 +64,7 @@
@Configuration
public static class ContextConfig extends SingleRouteCamelConfiguration {
+
@Bean
@Override
public RouteBuilder route() {
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/MainTest.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/MainTest.java
index 0564b98..099bc82 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/MainTest.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/MainTest.java
@@ -25,7 +25,6 @@
import org.springframework.context.ApplicationContext;
public class MainTest extends Assert {
-
@Test
public void testOptions() throws Exception {
CamelContext context = createCamelContext(new String[] {"-cc", "org.apache.camel.spring.javaconfig.config.ContextConfig"});
@@ -40,28 +39,36 @@
context.start();
runTests(context);
context.stop();
+
}
private CamelContext createCamelContext(String[] options) throws Exception {
Main main = new Main();
main.parseArguments(options);
ApplicationContext applicationContext = main.createDefaultApplicationContext();
- CamelContext context = SpringCamelContext.springCamelContext(applicationContext);
+ CamelContext context = SpringCamelContext.springCamelContext(applicationContext);
return context;
}
-
+
+
private void runTests(CamelContext context) throws Exception {
MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
ProducerTemplate template = context.createProducerTemplate();
String expectedBody = "<matched/>";
+
resultEndpoint.expectedBodiesReceived(expectedBody);
+
template.sendBodyAndHeader("direct:start", expectedBody, "foo", "bar");
+
resultEndpoint.assertIsSatisfied();
resultEndpoint.reset();
+
resultEndpoint.expectedMessageCount(0);
+
template.sendBodyAndHeader("direct:start", "<notMatched/>", "foo", "notMatchedHeaderValue");
+
resultEndpoint.assertIsSatisfied();
}
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/config/ContextConfig.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/config/ContextConfig.java
index 356c185..dff14cf 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/config/ContextConfig.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/config/ContextConfig.java
@@ -23,7 +23,6 @@
@Configuration
public class ContextConfig extends SingleRouteCamelConfiguration {
-
@Bean
public RouteBuilder route() {
return new RouteBuilder() {
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithNestedConfigClassTest.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithNestedConfigClassTest.java
index fac3cab..6811026 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithNestedConfigClassTest.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithNestedConfigClassTest.java
@@ -29,6 +29,7 @@
* @version
*/
@ContextConfiguration(locations = "org.apache.camel.spring.javaconfig.test.JavaConfigWithNestedConfigClassTest$ContextConfig", loader = JavaConfigContextLoader.class)
+
@Component
public class JavaConfigWithNestedConfigClassTest extends AbstractJUnit4SpringContextTests implements Cheese {
private boolean doCheeseCalled;
@@ -36,6 +37,7 @@
@Test
public void testPostProcessorInjectsMe() throws Exception {
assertEquals("doCheese() should be called", true, doCheeseCalled);
+
}
public void doCheese() {
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
index 770e764..498178a 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/JavaConfigWithPostProcessorTest.java
@@ -28,6 +28,7 @@
* @version
*/
@ContextConfiguration(locations = "org.apache.camel.spring.javaconfig.test.MyConfig", loader = JavaConfigContextLoader.class)
+
@Component
public class JavaConfigWithPostProcessorTest extends AbstractJUnit4SpringContextTests implements Cheese {
private boolean doCheeseCalled;
@@ -35,6 +36,7 @@
@Test
public void testPostProcessorInjectsMe() throws Exception {
assertEquals("doCheese() should be called", true, doCheeseCalled);
+
}
public void doCheese() {
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
index 9e37ebb..4f07531 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyConfig.java
@@ -24,7 +24,6 @@
*/
@Configuration
public class MyConfig {
-
@Bean
public MyPostProcessor myPostProcessor() {
return new MyPostProcessor();
diff --git a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
index 691de61..fe16f35 100644
--- a/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
+++ b/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/test/MyPostProcessor.java
@@ -27,16 +27,20 @@
public class MyPostProcessor implements BeanPostProcessor {
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
+ System.out.println("Invoked before Initialization on " + bean + " name " + name);
if (bean instanceof Cheese) {
Cheese cheese = (Cheese) bean;
+ System.out.println("Before Initialization Invoking Cheese");
cheese.doCheese();
}
return bean;
}
public Object postProcessAfterInitialization(Object bean, String name) throws BeansException {
+ System.out.println("Invoked after Initialization on " + bean + " name " + name);
if (bean instanceof Cheese) {
Cheese cheese = (Cheese) bean;
+ System.out.println("After Initialization Invoking Cheese");
cheese.doCheese();
}
return bean;
diff --git a/components/camel-spring-security/pom.xml b/components/camel-spring-security/pom.xml
index d23ed51..6c8ed9e 100644
--- a/components/camel-spring-security/pom.xml
+++ b/components/camel-spring-security/pom.xml
@@ -20,7 +20,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-spring-security</artifactId>
@@ -66,15 +66,9 @@
<artifactId>spring-security-config</artifactId>
<version>${spring-security-version}</version>
</dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
-
- <!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -87,7 +81,6 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
-
</dependencies>
<build>
diff --git a/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/SpringSecurityAuthorizationPolicyTest.java b/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/SpringSecurityAuthorizationPolicyTest.java
index 9b2d507..e4d8150 100644
--- a/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/SpringSecurityAuthorizationPolicyTest.java
+++ b/components/camel-spring-security/src/test/java/org/apache/camel/component/spring/security/SpringSecurityAuthorizationPolicyTest.java
@@ -31,7 +31,7 @@
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.context.SecurityContextHolder;
public class SpringSecurityAuthorizationPolicyTest extends CamelSpringTestSupport {
@@ -90,7 +90,7 @@
if (roles != null && roles.length > 0) {
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(roles.length);
for (String role : roles) {
- authorities.add(new SimpleGrantedAuthority(role));
+ authorities.add(new GrantedAuthorityImpl(role));
}
authToken = new UsernamePasswordAuthenticationToken(username, password, authorities);
} else {
diff --git a/components/camel-spring-ws/pom.xml b/components/camel-spring-ws/pom.xml
index 7354407..4c773f4 100644
--- a/components/camel-spring-ws/pom.xml
+++ b/components/camel-spring-ws/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -86,7 +86,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -95,11 +95,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
index f01dc95..50af3c2 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
@@ -31,7 +31,6 @@
private WebServiceTemplate webServiceTemplate;
private String soapAction;
private URI wsAddressingAction;
- private int timeout = -1;
/* Consumer configuration */
private CamelEndpointMapping endpointMapping;
@@ -75,15 +74,7 @@
}
public void setWsAddressingAction(String wsAddressingAction) throws URISyntaxException {
- setWsAddressingAction(new URI(wsAddressingAction));
- }
-
- public int getTimeout() {
- return timeout;
- }
-
- public void setTimeout(int timeout) {
- this.timeout = timeout;
+ this.wsAddressingAction = new URI(wsAddressingAction);
}
public CamelEndpointMapping getEndpointMapping() {
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
index 5b26af5..77b95d8 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceProducer.java
@@ -17,14 +17,7 @@
package org.apache.camel.component.spring.ws;
import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.net.HttpURLConnection;
import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
@@ -33,35 +26,20 @@
import org.apache.camel.TypeConverter;
import org.apache.camel.impl.DefaultProducer;
import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.ReflectionHelper;
-import org.apache.camel.util.ReflectionHelper.FieldCallback;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.client.core.SourceExtractor;
import org.springframework.ws.client.core.WebServiceMessageCallback;
-import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.soap.addressing.client.ActionCallback;
import org.springframework.ws.soap.client.core.SoapActionCallback;
-import org.springframework.ws.transport.WebServiceMessageSender;
-import org.springframework.ws.transport.http.CommonsHttpMessageSender;
-import org.springframework.ws.transport.http.HttpUrlConnectionMessageSender;
-import org.springframework.ws.transport.http.HttpsUrlConnectionMessageSender;
public class SpringWebserviceProducer extends DefaultProducer {
- private static final Logger LOG = LoggerFactory.getLogger(SpringWebserviceProducer.class);
private static final SourceExtractor<Object> SOURCE_EXTRACTOR = new NoopSourceExtractor();
+ private SpringWebserviceEndpoint endpoint;
public SpringWebserviceProducer(Endpoint endpoint) {
super(endpoint);
- }
-
- @Override
- public SpringWebserviceEndpoint getEndpoint() {
- return (SpringWebserviceEndpoint) super.getEndpoint();
+ this.endpoint = (SpringWebserviceEndpoint) endpoint;
}
public void process(Exchange exchange) throws Exception {
@@ -73,15 +51,12 @@
String soapAction = exchange.getIn().getHeader(SpringWebserviceConstants.SPRING_WS_SOAP_ACTION, String.class);
URI wsAddressingAction = exchange.getIn().getHeader(SpringWebserviceConstants.SPRING_WS_ADDRESSING_ACTION, URI.class);
- // Populate the given (read) timeout if any
- populateTimeout(getEndpoint().getConfiguration());
-
- WebServiceMessageCallback callback = new DefaultWebserviceMessageCallback(soapAction, wsAddressingAction, getEndpoint().getConfiguration());
+ WebServiceMessageCallback callback = new DefaultWebserviceMessageCallback(soapAction, wsAddressingAction);
Object body = null;
if (endpointUri != null) {
- body = getEndpoint().getConfiguration().getWebServiceTemplate().sendSourceAndReceive(endpointUri, sourcePayload, callback, SOURCE_EXTRACTOR);
+ body = endpoint.getConfiguration().getWebServiceTemplate().sendSourceAndReceive(endpointUri, sourcePayload, callback, SOURCE_EXTRACTOR);
} else {
- body = getEndpoint().getConfiguration().getWebServiceTemplate().sendSourceAndReceive(sourcePayload, callback, SOURCE_EXTRACTOR);
+ body = endpoint.getConfiguration().getWebServiceTemplate().sendSourceAndReceive(sourcePayload, callback, SOURCE_EXTRACTOR);
}
if (ExchangeHelper.isOutCapable(exchange)) {
exchange.getOut().copyFrom(exchange.getIn());
@@ -89,128 +64,26 @@
}
}
- private static void populateTimeout(SpringWebserviceConfiguration configuration) throws Exception {
- if (!(configuration.getTimeout() > -1)) {
- return;
- }
+ protected class DefaultWebserviceMessageCallback implements WebServiceMessageCallback {
+ private String soapActionHeader;
+ private URI wsAddressingActionHeader;
- WebServiceTemplate webServiceTemplate = configuration.getWebServiceTemplate();
-
- // Can't use java.util.Arrays.asList() as it doesn't support the optional remove() operation which we need here
- List<WebServiceMessageSender> webServiceMessageSenders = new ArrayList<WebServiceMessageSender>(webServiceTemplate.getMessageSenders().length);
- Collections.addAll(webServiceMessageSenders, webServiceTemplate.getMessageSenders());
- for (WebServiceMessageSender webServiceMessageSender : webServiceMessageSenders) {
- if (webServiceMessageSender instanceof CommonsHttpMessageSender) {
- setTimeOut((CommonsHttpMessageSender) webServiceMessageSender, configuration);
- } else if (webServiceMessageSender instanceof HttpsUrlConnectionMessageSender) {
- // Should check HttpsUrlConnectionMessageSender beforehand as it extends HttpUrlConnectionMessageSender
- webServiceMessageSenders.remove(webServiceMessageSender);
- webServiceMessageSenders.add(new CamelHttpsUrlConnectionMessageSender(configuration, (HttpsUrlConnectionMessageSender) webServiceMessageSender));
- } else if (webServiceMessageSender instanceof HttpUrlConnectionMessageSender) {
- webServiceMessageSenders.remove(webServiceMessageSender);
- webServiceMessageSenders.add(new CamelHttpUrlConnectionMessageSender(configuration, (HttpUrlConnectionMessageSender) webServiceMessageSender));
- } else {
- // For example this will be the case during unit-testing with the net.javacrumbs.spring-ws-test API
- LOG.warn("Ignoring the timeout option for {} as there's no provided API available to populate it!", webServiceMessageSender);
- }
- }
-
- webServiceTemplate.setMessageSenders(webServiceMessageSenders.toArray(new WebServiceMessageSender[webServiceMessageSenders.size()]));
- }
-
- private static void setTimeOut(HttpURLConnection connection, SpringWebserviceConfiguration configuration) {
- connection.setReadTimeout(configuration.getTimeout());
- }
-
- private static void setTimeOut(CommonsHttpMessageSender commonsHttpMessageSender, SpringWebserviceConfiguration configuration) {
- commonsHttpMessageSender.setReadTimeout(configuration.getTimeout());
- }
-
- protected static class CamelHttpUrlConnectionMessageSender extends HttpUrlConnectionMessageSender {
-
- private final SpringWebserviceConfiguration configuration;
-
- CamelHttpUrlConnectionMessageSender(SpringWebserviceConfiguration configuration, HttpUrlConnectionMessageSender webServiceMessageSender) {
- this.configuration = configuration;
-
- // Populate the single acceptGzipEncoding property
- setAcceptGzipEncoding(webServiceMessageSender.isAcceptGzipEncoding());
- }
-
- @Override
- protected void prepareConnection(HttpURLConnection connection) throws IOException {
- super.prepareConnection(connection);
-
- setTimeOut(connection, configuration);
- }
-
- }
-
- protected static class CamelHttpsUrlConnectionMessageSender extends HttpsUrlConnectionMessageSender {
-
- private final SpringWebserviceConfiguration configuration;
-
- CamelHttpsUrlConnectionMessageSender(SpringWebserviceConfiguration configuration, final HttpsUrlConnectionMessageSender webServiceMessageSender) throws Exception {
- this.configuration = configuration;
-
- // Populate the single acceptGzipEncoding property beforehand as we have got a proper set/is API for it
- setAcceptGzipEncoding(webServiceMessageSender.isAcceptGzipEncoding());
-
- // Populate the fields not having getXXX available on HttpsUrlConnectionMessageSender
- ReflectionHelper.doWithFields(HttpsUrlConnectionMessageSender.class, new FieldCallback() {
-
- @Override
- public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
- if (Modifier.isStatic(field.getModifiers())) {
- return;
- }
-
- String fieldName = field.getName();
- if ("logger".equals(fieldName) || "acceptGzipEncoding".equals(fieldName)) {
- // skip them
- return;
- }
-
- field.setAccessible(true);
- Object value = field.get(webServiceMessageSender);
- field.set(CamelHttpsUrlConnectionMessageSender.this, value);
- LOG.trace("Populated the field {} with the value {}", fieldName, value);
- }
-
- });
- }
-
- @Override
- protected void prepareConnection(HttpURLConnection connection) throws IOException {
- super.prepareConnection(connection);
-
- setTimeOut(connection, configuration);
- }
-
- }
-
- protected static class DefaultWebserviceMessageCallback implements WebServiceMessageCallback {
- private final String soapActionHeader;
- private final URI wsAddressingActionHeader;
- private final SpringWebserviceConfiguration configuration;
-
- public DefaultWebserviceMessageCallback(String soapAction, URI wsAddressingAction, SpringWebserviceConfiguration configuration) {
+ public DefaultWebserviceMessageCallback(String soapAction, URI wsAddressingAction) {
this.soapActionHeader = soapAction;
this.wsAddressingActionHeader = wsAddressingAction;
- this.configuration = configuration;
}
public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
// Add SoapAction to webservice request. Note that exchange header
// takes precedence over endpoint option
- String soapAction = soapActionHeader != null ? soapActionHeader : configuration.getSoapAction();
+ String soapAction = soapActionHeader != null ? soapActionHeader : endpoint.getConfiguration().getSoapAction();
if (soapAction != null) {
new SoapActionCallback(soapAction).doWithMessage(message);
}
// Add WS-Addressing Action to webservice request (the WS-Addressing
// 'to' header will default to the URL of the connection).
// Note that exchange header takes precedence over endpoint option
- URI wsAddressingAction = wsAddressingActionHeader != null ? wsAddressingActionHeader : configuration.getWsAddressingAction();
+ URI wsAddressingAction = wsAddressingActionHeader != null ? wsAddressingActionHeader : endpoint.getConfiguration().getWsAddressingAction();
if (wsAddressingAction != null) {
new ActionCallback(wsAddressingAction).doWithMessage(message);
}
diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
index a9c3a35..ede089e 100644
--- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
+++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerLocalRouteTest.java
@@ -41,7 +41,7 @@
@EndpointInject(uri = "mock:result")
private MockEndpoint resultEndpoint;
- @Test
+ @Test()
public void consumeStockQuoteWebserviceWithDefaultTemplate() throws Exception {
Object result = template.requestBody("direct:stockQuoteWebserviceWithDefaultTemplate", xmlRequestForGoogleStockQuote);
@@ -49,7 +49,7 @@
assertTrue(result instanceof Source);
}
- @Test
+ @Test()
public void consumeStockQuoteWebserviceAndPreserveHeaders() throws Exception {
resultEndpoint.expectedHeaderReceived("helloHeader", "hello world!");
@@ -59,7 +59,7 @@
resultEndpoint.assertIsSatisfied();
}
- @Test
+ @Test()
public void consumeStockQuoteWebservice() throws Exception {
Object result = template.requestBody("direct:stockQuoteWebservice", xmlRequestForGoogleStockQuote);
@@ -67,7 +67,7 @@
assertTrue(result instanceof Source);
}
- @Test
+ @Test()
public void consumeStockQuoteWebserviceWithCamelStringSourceInput() throws Exception {
Object result = template.requestBody("direct:stockQuoteWebservice", new StringSource(xmlRequestForGoogleStockQuote));
@@ -75,7 +75,7 @@
assertTrue(result instanceof Source);
}
- @Test
+ @Test()
public void consumeStockQuoteWebserviceWithNonDefaultMessageFactory() throws Exception {
Object result = template.requestBody("direct:stockQuoteWebserviceWithNonDefaultMessageFactory", xmlRequestForGoogleStockQuote);
@@ -83,7 +83,7 @@
assertTrue(result instanceof Source);
}
- @Test
+ @Test()
public void consumeStockQuoteWebserviceAndConvertResult() throws Exception {
Object result = template.requestBody("direct:stockQuoteWebserviceAsString", xmlRequestForGoogleStockQuote);
@@ -93,7 +93,7 @@
assertTrue(resultMessage.contains("Google Inc."));
}
- @Test
+ @Test()
public void consumeStockQuoteWebserviceAndProvideEndpointUriByHeader() throws Exception {
Object result = template.requestBodyAndHeader("direct:stockQuoteWebserviceWithoutDefaultUri", xmlRequestForGoogleStockQuote,
SpringWebserviceConstants.SPRING_WS_ENDPOINT_URI, stockQuoteWebserviceUri);
diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java
deleted file mode 100644
index f165add..0000000
--- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.spring.ws;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.net.SocketTimeoutException;
-import java.security.SecureRandom;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.TrustManager;
-
-import org.apache.camel.CamelExecutionException;
-import org.apache.camel.Produce;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.spring.ws.SpringWebserviceProducer.CamelHttpUrlConnectionMessageSender;
-import org.apache.camel.component.spring.ws.SpringWebserviceProducer.CamelHttpsUrlConnectionMessageSender;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.ws.transport.http.HttpUrlConnectionMessageSender;
-import org.springframework.ws.transport.http.HttpsUrlConnectionMessageSender;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-@ContextConfiguration
-public class ProducerRemoteRouteTimeOutTest extends AbstractJUnit4SpringContextTests {
-
- private final String xmlRequestForGoogleStockQuote = "<GetQuote xmlns=\"http://www.webserviceX.NET/\"><symbol>GOOG</symbol></GetQuote>";
-
- @Produce
- private ProducerTemplate template;
-
- @Ignore("Run manually, makes connection to external webservice")
- @Test
- public void callStockQuoteWebserviceCommonsHttpWith3MillSecondsTimeout() throws Exception {
- try {
- template.requestBody("direct:stockQuoteWebserviceCommonsHttpWith3MillSecondsTimeout", xmlRequestForGoogleStockQuote);
- fail("Miss the expected exception in chain");
- } catch (CamelExecutionException cee) {
- assertTrue(hasThrowableInChain(cee, SocketTimeoutException.class));
- }
- }
-
- @Ignore("Run manually, makes connection to external webservice")
- @Test
- public void callStockQuoteWebserviceCommonsHttpWith5000MillSecondsTimeout() throws Exception {
- Object result = template.requestBody("direct:stockQuoteWebserviceCommonsHttpWith5000MillSecondsTimeout", xmlRequestForGoogleStockQuote);
-
- assertNotNull(result);
- assertTrue(result instanceof String);
- String resultMessage = (String) result;
- assertTrue(resultMessage.contains("Google Inc."));
- }
-
- @Ignore("Run manually, makes connection to external webservice")
- @Test
- public void callStockQuoteWebserviceJDKWith3MillSecondsTimeout() throws Exception {
- try {
- template.requestBody("direct:stockQuoteWebserviceJDKWith3MillSecondsTimeout", xmlRequestForGoogleStockQuote);
- fail("Miss the expected exception in chain");
- } catch (CamelExecutionException cee) {
- assertTrue(hasThrowableInChain(cee, SocketTimeoutException.class));
- }
- }
-
- @Ignore("Run manually, makes connection to external webservice")
- @Test
- public void callStockQuoteWebserviceJDKWith5000MillSecondsTimeout() throws Exception {
- Object result = template.requestBody("direct:stockQuoteWebserviceJDKWith5000MillSecondsTimeout", xmlRequestForGoogleStockQuote);
-
- assertNotNull(result);
- assertTrue(result instanceof String);
- String resultMessage = (String) result;
- assertTrue(resultMessage.contains("Google Inc."));
- }
-
- private static boolean hasThrowableInChain(Throwable throwable, Class<? extends Throwable> clazz) {
- if (throwable == null) {
- return false;
- } else if (clazz.isAssignableFrom(throwable.getClass())) {
- return true;
- }
-
- return hasThrowableInChain(throwable.getCause(), clazz);
- }
-
- @Test
- public void verifyTheFieldPopulationFromHttpUrlConnectionMessageSenderToCamelHttpUrlConnectionMessageSender() throws Exception {
- HttpUrlConnectionMessageSender fromMessageSender = new HttpUrlConnectionMessageSender();
- fromMessageSender.setAcceptGzipEncoding(false);
-
- CamelHttpUrlConnectionMessageSender toMessageSender = new CamelHttpUrlConnectionMessageSender(new SpringWebserviceConfiguration(), fromMessageSender);
- assertFalse("acceptGzipEncoding property didn't get populated properly!", toMessageSender.isAcceptGzipEncoding());
-
- fromMessageSender.setAcceptGzipEncoding(true);
- toMessageSender = new CamelHttpUrlConnectionMessageSender(new SpringWebserviceConfiguration(), fromMessageSender);
- assertTrue("acceptGzipEncoding property didn't get populated properly!", toMessageSender.isAcceptGzipEncoding());
- }
-
- @Test
- public void verifyTheFieldPopulationFromHttpsUrlConnectionMessageSenderToCamelHttpsUrlConnectionMessageSender() throws Exception {
- HttpsUrlConnectionMessageSender fromMessageSender = new HttpsUrlConnectionMessageSender();
- fromMessageSender.setAcceptGzipEncoding(false);
- fromMessageSender.setHostnameVerifier(new HostnameVerifier() {
-
- @Override
- public boolean verify(String s, SSLSession sslsession) {
- return false;
- }
-
- });
- fromMessageSender.setKeyManagers(new KeyManager[] {new KeyManager() {
- }});
- fromMessageSender.setSecureRandom(new SecureRandom());
- fromMessageSender.setSslProtocol("sslProtocol");
- fromMessageSender.setSslProvider("sslProvider");
- fromMessageSender.setTrustManagers(new TrustManager[] {new TrustManager() {
- }});
-
- CamelHttpsUrlConnectionMessageSender toMessageSender = new CamelHttpsUrlConnectionMessageSender(new SpringWebserviceConfiguration(), fromMessageSender);
-
- assertFalse("acceptGzipEncoding field didn't get populated properly!", toMessageSender.isAcceptGzipEncoding());
- for (Field field : fromMessageSender.getClass().getDeclaredFields()) {
- if (Modifier.isStatic(field.getModifiers())) {
- continue;
- }
-
- field.setAccessible(true);
- String fieldName = field.getName();
-
- assertSame("The field '" + fieldName + "' didn't get populated properly!", field.get(fromMessageSender), field.get(toMessageSender));
- }
- }
-
-}
diff --git a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/util/FileUtil.java b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/util/FileUtil.java
index b4b3f76a..63845f1 100644
--- a/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/util/FileUtil.java
+++ b/components/camel-spring-ws/src/test/java/org/apache/camel/component/spring/ws/util/FileUtil.java
@@ -16,12 +16,7 @@
*/
package org.apache.camel.component.spring.ws.util;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.camel.util.IOHelper;
+import java.io.*;
public final class FileUtil {
@@ -32,7 +27,7 @@
InputStream is = FileUtil.class.getResourceAsStream(filePath);
try {
StringBuilder sb = new StringBuilder();
- BufferedReader reader = IOHelper.buffered(new InputStreamReader(is, "UTF-8"));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
diff --git a/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest-context.xml b/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest-context.xml
deleted file mode 100644
index a71bf46..0000000
--- a/components/camel-spring-ws/src/test/resources/org/apache/camel/component/spring/ws/ProducerRemoteRouteTimeOutTest-context.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?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">
-
- <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
-
- <bean id="commonsHttpWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
- <constructor-arg ref="messageFactory" />
- <property name="messageSender">
- <bean
- class="org.springframework.ws.transport.http.CommonsHttpMessageSender" />
- </property>
- </bean>
-
- <bean id="jdkHttpWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
- <constructor-arg ref="messageFactory" />
- </bean>
-
- <camelContext xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:stockQuoteWebserviceCommonsHttpWith3MillSecondsTimeout" />
- <to uri="spring-ws:http://www.webservicex.net/stockquote.asmx?timeout=3&webServiceTemplate=#commonsHttpWebServiceTemplate&soapAction=http://www.webserviceX.NET/GetQuote" />
- <convertBodyTo type="java.lang.String"/>
- </route>
-
- <route>
- <from uri="direct:stockQuoteWebserviceCommonsHttpWith5000MillSecondsTimeout" />
- <to uri="spring-ws:http://www.webservicex.net/stockquote.asmx?timeout=5000&webServiceTemplate=#commonsHttpWebServiceTemplate&soapAction=http://www.webserviceX.NET/GetQuote" />
- <convertBodyTo type="java.lang.String"/>
- </route>
-
- <route>
- <from uri="direct:stockQuoteWebserviceJDKWith3MillSecondsTimeout" />
- <to uri="spring-ws:http://www.webservicex.net/stockquote.asmx?timeout=3&webServiceTemplate=#jdkHttpWebServiceTemplate&soapAction=http://www.webserviceX.NET/GetQuote" />
- <convertBodyTo type="java.lang.String"/>
- </route>
-
- <route>
- <from uri="direct:stockQuoteWebserviceJDKWith5000MillSecondsTimeout" />
- <to uri="spring-ws:http://www.webservicex.net/stockquote.asmx?timeout=5000&webServiceTemplate=#jdkHttpWebServiceTemplate&soapAction=http://www.webserviceX.NET/GetQuote" />
- <convertBodyTo type="java.lang.String"/>
- </route>
- </camelContext>
-
-</beans>
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index c5478fd..88411ba 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java b/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
index 3890eea..3c396be 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelNamespaceHandler.java
@@ -27,8 +27,8 @@
}
// It just add the package of the class for initiate the JAXB context
- protected Set<Class<?>> getJaxbPackages() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
+ protected Set<Class> getJaxbPackages() {
+ Set<Class> classes = new HashSet<Class>();
classes.add(CamelContextFactoryBean.class);
classes.add(org.apache.camel.spring.CamelContextFactoryBean.class);
classes.add(org.apache.camel.ExchangePattern.class);
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
index 77221b3..b834a57 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
@@ -16,20 +16,27 @@
*/
package org.apache.camel.spring;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import java.util.LinkedHashSet;
-import java.util.Map;
import java.util.Set;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
import org.apache.camel.Service;
import org.apache.camel.core.xml.CamelJMXAgentDefinition;
import org.apache.camel.impl.CamelPostProcessorHelper;
-import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
+import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spring.util.ReflectionUtils;
+import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,9 +47,23 @@
import org.springframework.context.ApplicationContextAware;
/**
- * Spring specific {@link DefaultCamelBeanPostProcessor} which uses Spring {@link BeanPostProcessor} to post process beans.
+ * A bean post processor which implements the <a href="http://camel.apache.org/bean-integration.html">Bean Integration</a>
+ * features in Camel. Features such as the <a href="http://camel.apache.org/bean-injection.html">Bean Injection</a> of objects like
+ * {@link Endpoint} and
+ * {@link org.apache.camel.ProducerTemplate} together with support for
+ * <a href="http://camel.apache.org/pojo-consuming.html">POJO Consuming</a> via the
+ * {@link org.apache.camel.Consume} annotation along with
+ * <a href="http://camel.apache.org/pojo-producing.html">POJO Producing</a> via the
+ * {@link org.apache.camel.Produce} annotation along with other annotations such as
+ * {@link org.apache.camel.DynamicRouter} for creating <a href="http://camel.apache.org/dynamicrouter-annotation.html">a Dynamic router via annotations</a>.
+ * {@link org.apache.camel.RecipientList} for creating <a href="http://camel.apache.org/recipientlist-annotation.html">a Recipient List router via annotations</a>.
+ * {@link org.apache.camel.RoutingSlip} for creating <a href="http://camel.apache.org/routingslip-annotation.html">a Routing Slip router via annotations</a>.
+ * <p>
+ * If you use the <camelContext> element in your <a href="http://camel.apache.org/spring.html">Spring XML</a>
+ * then one of these bean post processors is implicitly installed and configured for you. So you should never have to
+ * explicitly create or configure one of these instances.
*
- * @see DefaultCamelBeanPostProcessor
+ * @version
*/
@XmlRootElement(name = "beanPostProcessor")
@XmlAccessorType(XmlAccessType.FIELD)
@@ -55,116 +76,51 @@
@XmlTransient
private ApplicationContext applicationContext;
@XmlTransient
- private String camelId;
-
- // must use a delegate, as we cannot extend DefaultCamelBeanPostProcessor, as this will cause the
- // XSD schema generator to include the DefaultCamelBeanPostProcessor as a type, which we do not want to
+ private CamelPostProcessorHelper postProcessor;
@XmlTransient
- private final DefaultCamelBeanPostProcessor delegate = new DefaultCamelBeanPostProcessor() {
- @Override
- public CamelContext getOrLookupCamelContext() {
- if (camelContext == null) {
- if (camelId != null) {
- LOG.trace("Looking up CamelContext by id: {} from Spring ApplicationContext: {}", camelId, applicationContext);
- camelContext = applicationContext.getBean(camelId, CamelContext.class);
- } else {
- // lookup by type and grab the single CamelContext if exists
- LOG.trace("Looking up CamelContext by type from Spring ApplicationContext: {}", applicationContext);
- Map<String, CamelContext> contexts = applicationContext.getBeansOfType(CamelContext.class);
- if (contexts != null && contexts.size() == 1) {
- camelContext = contexts.values().iterator().next();
- }
- }
- }
- return camelContext;
- }
-
- @Override
- public boolean canPostProcessBean(Object bean, String beanName) {
- // the JMXAgent is a bit strange and causes Spring issues if we let it being
- // post processed by this one. It does not need it anyway so we are good to go.
- // We should also avoid to process the null object bean (in Spring 2.5.x)
- if (bean == null || bean instanceof CamelJMXAgentDefinition) {
- return false;
- }
-
- return super.canPostProcessBean(bean, beanName);
- }
-
- @Override
- public CamelPostProcessorHelper getPostProcessorHelper() {
- // lets lazily create the post processor
- if (camelPostProcessorHelper == null) {
- camelPostProcessorHelper = new CamelPostProcessorHelper() {
-
- @Override
- public CamelContext getCamelContext() {
- // lets lazily lookup the camel context here
- // as doing this will cause this context to be started immediately
- // breaking the lifecycle ordering of different camel contexts
- // so we only want to do this on demand
- return delegate.getOrLookupCamelContext();
- }
-
- @Override
- protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e) {
- return new BeanInstantiationException(type, "Could not instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
- }
-
- protected boolean isSingleton(Object bean, String beanName) {
- // no application context has been injected which means the bean
- // has not been enlisted in Spring application context
- if (applicationContext == null || beanName == null) {
- return super.isSingleton(bean, beanName);
- } else {
- return applicationContext.isSingleton(beanName);
- }
- }
-
- protected void startService(Service service, Object bean, String beanName) throws Exception {
- if (isSingleton(bean, beanName)) {
- getCamelContext().addService(service);
- } else {
- // only start service and do not add it to CamelContext
- ServiceHelper.startService(service);
- if (prototypeBeans.add(beanName)) {
- // do not spam the log with WARN so do this only once per bean name
- CamelBeanPostProcessor.LOG.warn("The bean with id [" + beanName + "] is prototype scoped and cannot stop the injected service when bean is destroyed: "
- + service + ". You may want to stop the service manually from the bean.");
- }
- }
- }
- };
- }
- return camelPostProcessorHelper;
- }
- };
+ private String camelId;
public CamelBeanPostProcessor() {
}
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
- try {
- return delegate.postProcessBeforeInitialization(bean, beanName);
- } catch (Exception e) {
- // do not wrap already beans exceptions
- if (e instanceof BeansException) {
- throw (BeansException) e;
- }
- throw new GenericBeansException("Error post processing bean: " + beanName, e);
+ LOG.trace("Camel bean processing before initialization for bean: {}", beanName);
+
+ // some beans cannot be post processed at this given time, so we gotta check beforehand
+ if (!canPostProcessBean(bean, beanName)) {
+ return bean;
}
+
+ injectFields(bean, beanName);
+ injectMethods(bean, beanName);
+
+ if (bean instanceof CamelContextAware && canSetCamelContext(bean, beanName)) {
+ CamelContextAware contextAware = (CamelContextAware)bean;
+ CamelContext context = getOrLookupCamelContext();
+ if (context == null) {
+ LOG.warn("No CamelContext defined yet so cannot inject into bean: " + beanName);
+ } else {
+ contextAware.setCamelContext(context);
+ }
+ }
+
+ return bean;
}
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
- try {
- return delegate.postProcessAfterInitialization(bean, beanName);
- } catch (Exception e) {
- // do not wrap already beans exceptions
- if (e instanceof BeansException) {
- throw (BeansException) e;
- }
- throw new GenericBeansException("Error post processing bean: " + beanName, e);
+ LOG.trace("Camel bean processing after initialization for bean: {}", beanName);
+
+ // some beans cannot be post processed at this given time, so we gotta check beforehand
+ if (!canPostProcessBean(bean, beanName)) {
+ return bean;
}
+
+ if (bean instanceof DefaultEndpoint) {
+ DefaultEndpoint defaultEndpoint = (DefaultEndpoint) bean;
+ defaultEndpoint.setEndpointUriIfNotSpecified(beanName);
+ }
+
+ return bean;
}
// Properties
@@ -190,4 +146,154 @@
this.camelId = camelId;
}
+ // Implementation methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Can we post process the given bean?
+ *
+ * @param bean the bean
+ * @param beanName the bean name
+ * @return true to process it
+ */
+ protected boolean canPostProcessBean(Object bean, String beanName) {
+ // the JMXAgent is a bit strange and causes Spring issues if we let it being
+ // post processed by this one. It does not need it anyway so we are good to go.
+ // We should also avoid to process the null object bean (in Spring 2.5.x)
+ if (bean == null || bean instanceof CamelJMXAgentDefinition) {
+ return false;
+ }
+
+ // all other beans can of course be processed
+ return true;
+ }
+
+
+ protected boolean canSetCamelContext(Object bean, String beanName) {
+ if (bean instanceof CamelContextAware) {
+ CamelContextAware camelContextAware = (CamelContextAware) bean;
+ CamelContext context = camelContextAware.getCamelContext();
+ if (context != null) {
+ LOG.trace("CamelContext already set on bean with id [{}]. Will keep existing CamelContext on bean.", beanName);
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * A strategy method to allow implementations to perform some custom JBI
+ * based injection of the POJO
+ *
+ * @param bean the bean to be injected
+ */
+ protected void injectFields(final Object bean, final String beanName) {
+ ReflectionUtils.doWithFields(bean.getClass(), new ReflectionUtils.FieldCallback() {
+ public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
+ EndpointInject endpointInject = field.getAnnotation(EndpointInject.class);
+ if (endpointInject != null && getPostProcessor().matchContext(endpointInject.context())) {
+ injectField(field, endpointInject.uri(), endpointInject.ref(), bean, beanName);
+ }
+
+ Produce produce = field.getAnnotation(Produce.class);
+ if (produce != null && getPostProcessor().matchContext(produce.context())) {
+ injectField(field, produce.uri(), produce.ref(), bean, beanName);
+ }
+ }
+ });
+ }
+
+ protected void injectField(Field field, String endpointUri, String endpointRef, Object bean, String beanName) {
+ ReflectionUtils.setField(field, bean, getPostProcessor().getInjectionValue(field.getType(), endpointUri, endpointRef, field.getName(), bean, beanName));
+ }
+
+ protected void injectMethods(final Object bean, final String beanName) {
+ ReflectionUtils.doWithMethods(bean.getClass(), new ReflectionUtils.MethodCallback() {
+ public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
+ setterInjection(method, bean, beanName);
+ getPostProcessor().consumerInjection(method, bean, beanName);
+ }
+ });
+ }
+
+ protected void setterInjection(Method method, Object bean, String beanName) {
+ EndpointInject endpointInject = method.getAnnotation(EndpointInject.class);
+ if (endpointInject != null && getPostProcessor().matchContext(endpointInject.context())) {
+ setterInjection(method, bean, beanName, endpointInject.uri(), endpointInject.ref());
+ }
+
+ Produce produce = method.getAnnotation(Produce.class);
+ if (produce != null && getPostProcessor().matchContext(produce.context())) {
+ setterInjection(method, bean, beanName, produce.uri(), produce.ref());
+ }
+ }
+
+ protected void setterInjection(Method method, Object bean, String beanName, String endpointUri, String endpointRef) {
+ Class<?>[] parameterTypes = method.getParameterTypes();
+ if (parameterTypes != null) {
+ if (parameterTypes.length != 1) {
+ LOG.warn("Ignoring badly annotated method for injection due to incorrect number of parameters: " + method);
+ } else {
+ String propertyName = ObjectHelper.getPropertyName(method);
+ Object value = getPostProcessor().getInjectionValue(parameterTypes[0], endpointUri, endpointRef, propertyName, bean, beanName);
+ ObjectHelper.invokeMethod(method, bean, value);
+ }
+ }
+ }
+
+ protected CamelContext getOrLookupCamelContext() {
+ if (camelContext == null && applicationContext.containsBean(camelId)) {
+ camelContext = applicationContext.getBean(camelId, CamelContext.class);
+ }
+ return camelContext;
+ }
+
+ public CamelPostProcessorHelper getPostProcessor() {
+ // lets lazily create the post processor
+ if (postProcessor == null) {
+ postProcessor = new CamelPostProcessorHelper() {
+
+ @Override
+ public CamelContext getCamelContext() {
+ // lets lazily lookup the camel context here
+ // as doing this will cause this context to be started immediately
+ // breaking the lifecycle ordering of different camel contexts
+ // so we only want to do this on demand
+ return getOrLookupCamelContext();
+ }
+
+ @Override
+ protected RuntimeException createProxyInstantiationRuntimeException(Class<?> type, Endpoint endpoint, Exception e) {
+ return new BeanInstantiationException(type, "Could not instantiate proxy of type " + type.getName() + " on endpoint " + endpoint, e);
+ }
+
+ protected boolean isSingleton(Object bean, String beanName) {
+ // no application context has been injected which means the bean
+ // has not been enlisted in Spring application context
+ if (applicationContext == null || beanName == null) {
+ return super.isSingleton(bean, beanName);
+ } else {
+ return applicationContext.isSingleton(beanName);
+ }
+ }
+
+ protected void startService(Service service, Object bean, String beanName) throws Exception {
+ if (isSingleton(bean, beanName)) {
+ getCamelContext().addService(service);
+ } else {
+ // only start service and do not add it to CamelContext
+ ServiceHelper.startService(service);
+ if (prototypeBeans.add(beanName)) {
+ // do not spam the log with WARN so do this only once per bean name
+ LOG.warn("The bean with id [" + beanName + "] is prototype scoped and cannot stop the injected service when bean is destroyed: "
+ + service + ". You may want to stop the service manually from the bean.");
+ }
+ }
+ }
+ };
+ }
+ return postProcessor;
+ }
+
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
index 9f6aafc..3dedd86 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelConsumerTemplateFactoryBean.java
@@ -22,7 +22,6 @@
import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.CamelContext;
-import org.apache.camel.ConsumerTemplate;
import org.apache.camel.core.xml.AbstractCamelConsumerTemplateFactoryBean;
import org.apache.camel.spring.util.CamelContextResolverHelper;
import org.springframework.beans.BeansException;
@@ -40,7 +39,7 @@
*/
@XmlRootElement(name = "consumerTemplate")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CamelConsumerTemplateFactoryBean extends AbstractCamelConsumerTemplateFactoryBean implements FactoryBean<ConsumerTemplate>, InitializingBean, DisposableBean, ApplicationContextAware {
+public class CamelConsumerTemplateFactoryBean extends AbstractCamelConsumerTemplateFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
@XmlTransient
private ApplicationContext applicationContext;
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index 4d33ab8..32173f9 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -77,7 +77,7 @@
@XmlAccessorType(XmlAccessType.FIELD)
@SuppressWarnings("unused")
public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<SpringCamelContext>
- implements FactoryBean<SpringCamelContext>, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ApplicationEvent> {
+ implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener {
private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class);
@XmlAttribute(name = "depends-on", required = false)
@@ -99,13 +99,10 @@
@XmlAttribute(required = false)
private String useBreadcrumb;
@XmlAttribute(required = false)
- private String managementNamePattern;
- @XmlAttribute(required = false)
private ShutdownRoute shutdownRoute;
@XmlAttribute(required = false)
private ShutdownRunningTask shutdownRunningTask;
@XmlAttribute(required = false)
- @Deprecated
private Boolean lazyLoadTypeConverters;
@XmlElement(name = "properties", required = false)
private PropertiesDefinition properties;
@@ -125,7 +122,7 @@
@XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false),
@XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false),
@XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)})
- private List<?> beans;
+ private List beans;
@XmlElement(name = "routeBuilder", required = false)
private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
@XmlElement(name = "routeContextRef", required = false)
@@ -471,20 +468,10 @@
this.useBreadcrumb = useBreadcrumb;
}
- public String getManagementNamePattern() {
- return managementNamePattern;
- }
-
- public void setManagementNamePattern(String managementNamePattern) {
- this.managementNamePattern = managementNamePattern;
- }
-
- @Deprecated
public Boolean getLazyLoadTypeConverters() {
return lazyLoadTypeConverters;
}
- @Deprecated
public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
this.lazyLoadTypeConverters = lazyLoadTypeConverters;
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
index 55cc002..31ff9ff 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelEndpointFactoryBean.java
@@ -37,7 +37,7 @@
*/
@XmlRootElement(name = "endpoint")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CamelEndpointFactoryBean extends AbstractCamelEndpointFactoryBean implements FactoryBean<Endpoint>, ApplicationContextAware {
+public class CamelEndpointFactoryBean extends AbstractCamelEndpointFactoryBean implements FactoryBean, ApplicationContextAware {
@XmlTransient
private ApplicationContext applicationContext;
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
index a9b6251..ea3ad90 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelProducerTemplateFactoryBean.java
@@ -22,7 +22,6 @@
import javax.xml.bind.annotation.XmlTransient;
import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
import org.apache.camel.core.xml.AbstractCamelProducerTemplateFactoryBean;
import org.apache.camel.spring.util.CamelContextResolverHelper;
import org.springframework.beans.BeansException;
@@ -40,7 +39,7 @@
*/
@XmlRootElement(name = "template")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CamelProducerTemplateFactoryBean extends AbstractCamelProducerTemplateFactoryBean implements FactoryBean<ProducerTemplate>, InitializingBean, DisposableBean, ApplicationContextAware {
+public class CamelProducerTemplateFactoryBean extends AbstractCamelProducerTemplateFactoryBean implements FactoryBean, InitializingBean, DisposableBean, ApplicationContextAware {
@XmlTransient
private ApplicationContext applicationContext;
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
index 9b4305c..41d9b00 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRedeliveryPolicyFactoryBean.java
@@ -23,7 +23,6 @@
import org.apache.camel.CamelContext;
import org.apache.camel.core.xml.AbstractCamelRedeliveryPolicyFactoryBean;
-import org.apache.camel.processor.RedeliveryPolicy;
import org.apache.camel.spring.util.CamelContextResolverHelper;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
@@ -36,7 +35,7 @@
*/
@XmlRootElement(name = "redeliveryPolicyProfile")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CamelRedeliveryPolicyFactoryBean extends AbstractCamelRedeliveryPolicyFactoryBean implements FactoryBean<RedeliveryPolicy>, ApplicationContextAware {
+public class CamelRedeliveryPolicyFactoryBean extends AbstractCamelRedeliveryPolicyFactoryBean implements FactoryBean, ApplicationContextAware {
@XmlTransient
private ApplicationContext applicationContext;
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
index 621cced..4823199 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelRouteContextFactoryBean.java
@@ -32,17 +32,17 @@
*/
@XmlRootElement(name = "routeContext")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CamelRouteContextFactoryBean extends IdentifiedType implements FactoryBean<List<RouteDefinition>> {
+public class CamelRouteContextFactoryBean extends IdentifiedType implements FactoryBean {
@XmlElement(name = "route", required = true)
private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
- public List<RouteDefinition> getObject() throws Exception {
+ public Object getObject() throws Exception {
return routes;
}
- public Class<?> getObjectType() {
- return routes.getClass();
+ public Class getObjectType() {
+ return List.class;
}
public boolean isSingleton() {
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
index b82b3f9..e9e18a4 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelThreadPoolFactoryBean.java
@@ -16,8 +16,6 @@
*/
package org.apache.camel.spring;
-import java.util.concurrent.ExecutorService;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@@ -37,7 +35,7 @@
*/
@XmlRootElement(name = "threadPool")
@XmlAccessorType(XmlAccessType.FIELD)
-public class CamelThreadPoolFactoryBean extends AbstractCamelThreadPoolFactoryBean implements FactoryBean<ExecutorService>, ApplicationContextAware {
+public class CamelThreadPoolFactoryBean extends AbstractCamelThreadPoolFactoryBean implements FactoryBean, ApplicationContextAware {
@XmlTransient
private ApplicationContext applicationContext;
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/ContextScanRouteBuilderFinder.java b/components/camel-spring/src/main/java/org/apache/camel/spring/ContextScanRouteBuilderFinder.java
index 0f53882..fc393bd 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/ContextScanRouteBuilderFinder.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/ContextScanRouteBuilderFinder.java
@@ -46,9 +46,10 @@
* Appends all the {@link org.apache.camel.builder.RouteBuilder} instances that can be found in the context
*/
public void appendBuilders(List<RoutesBuilder> list) {
- Map<String, RoutesBuilder> beans = applicationContext.getBeansOfType(RoutesBuilder.class, true, true);
+ Map beans = applicationContext.getBeansOfType(RoutesBuilder.class, true, true);
- for (Entry<String, RoutesBuilder> entry : beans.entrySet()) {
+ for (Object object : beans.entrySet()) {
+ Entry entry = (Entry) object;
Object bean = entry.getValue();
Object key = entry.getKey();
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java b/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
index cd34fc7..8b74bc5 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerType.java
@@ -41,7 +41,7 @@
*
* @return the class which represents the selected type.
*/
- public Class<?> getTypeAsClass() {
+ public Class getTypeAsClass() {
switch (this) {
case DefaultErrorHandler:
return DefaultErrorHandlerBuilder.class;
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/GenericBeansException.java b/components/camel-spring/src/main/java/org/apache/camel/spring/GenericBeansException.java
deleted file mode 100644
index c55f83d..0000000
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/GenericBeansException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spring;
-
-import org.springframework.beans.BeansException;
-
-/**
- * A generic {@link org.springframework.beans.BeansException}.
- */
-public final class GenericBeansException extends BeansException {
-
- private static final long serialVersionUID = 1L;
-
- public GenericBeansException(String msg) {
- super(msg);
- }
-
- public GenericBeansException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/PackageScanRouteBuilderFinder.java b/components/camel-spring/src/main/java/org/apache/camel/spring/PackageScanRouteBuilderFinder.java
index 208d1d6..4b6eeb6 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/PackageScanRouteBuilderFinder.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/PackageScanRouteBuilderFinder.java
@@ -57,7 +57,7 @@
*/
public void appendBuilders(List<RoutesBuilder> list) throws IllegalAccessException, InstantiationException {
Set<Class<?>> classes = resolver.findImplementations(RoutesBuilder.class, packages);
- for (Class<?> aClass : classes) {
+ for (Class aClass : classes) {
LOG.trace("Found RouteBuilder class: {}", aClass);
// certain beans should be ignored
@@ -72,8 +72,7 @@
}
// type is valid so create and instantiate the builder
- @SuppressWarnings("unchecked")
- RoutesBuilder builder = instantiateBuilder((Class<? extends RoutesBuilder>) aClass);
+ RoutesBuilder builder = instantiateBuilder(aClass);
if (beanPostProcessor != null) {
// Inject the annotated resource
beanPostProcessor.postProcessBeforeInitialization(builder, builder.toString());
@@ -87,7 +86,7 @@
* Lets ignore beans that are explicitly configured in the Spring XML files
*/
protected boolean shouldIgnoreBean(Class<?> type) {
- Map<String, ?> beans = applicationContext.getBeansOfType(type, true, true);
+ Map beans = applicationContext.getBeansOfType(type, true, true);
if (beans == null || beans.isEmpty()) {
return false;
}
@@ -97,7 +96,7 @@
/**
* Returns <tt>true</tt>if the class is a public, non-abstract class
*/
- protected boolean isValidClass(Class<?> type) {
+ protected boolean isValidClass(Class type) {
// should skip non public classes
if (!Modifier.isPublic(type.getModifiers())) {
return false;
@@ -109,7 +108,8 @@
return false;
}
- protected RoutesBuilder instantiateBuilder(Class<? extends RoutesBuilder> type) throws IllegalAccessException, InstantiationException {
- return camelContext.getInjector().newInstance(type);
+ @SuppressWarnings("unchecked")
+ protected RoutesBuilder instantiateBuilder(Class type) throws IllegalAccessException, InstantiationException {
+ return (RoutesBuilder) camelContext.getInjector().newInstance(type);
}
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/BeanDefinitionParser.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/BeanDefinitionParser.java
index 59f530b..e6914b7 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/BeanDefinitionParser.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/BeanDefinitionParser.java
@@ -32,7 +32,7 @@
* @version
*/
public class BeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
- private final Class<?> type;
+ private final Class type;
private final boolean assignId;
/**
@@ -42,12 +42,12 @@
* @param assignId whether to allow assigning id from the id attribute on the type
* (there must be getter/setter id on type class).
*/
- public BeanDefinitionParser(Class<?> type, boolean assignId) {
+ public BeanDefinitionParser(Class type, boolean assignId) {
this.type = type;
this.assignId = assignId;
}
- protected Class<?> getBeanClass(Element element) {
+ protected Class getBeanClass(Element element) {
return type;
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
index f050d5d..a8afb97 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
@@ -178,7 +178,7 @@
protected JAXBContext createJaxbContext() throws JAXBException {
StringBuilder packages = new StringBuilder();
- for (Class<?> cl : getJaxbPackages()) {
+ for (Class cl : getJaxbPackages()) {
if (packages.length() > 0) {
packages.append(":");
}
@@ -187,8 +187,8 @@
return JAXBContext.newInstance(packages.toString(), getClass().getClassLoader());
}
- protected Set<Class<?>> getJaxbPackages() {
- Set<Class<?>> classes = new HashSet<Class<?>>();
+ protected Set<Class> getJaxbPackages() {
+ Set<Class> classes = new HashSet<Class>();
classes.add(org.apache.camel.spring.CamelContextFactoryBean.class);
classes.add(CamelJMXAgentDefinition.class);
classes.add(org.apache.camel.ExchangePattern.class);
@@ -275,7 +275,7 @@
protected class CamelContextBeanDefinitionParser extends BeanDefinitionParser {
- public CamelContextBeanDefinitionParser(Class<?> type) {
+ public CamelContextBeanDefinitionParser(Class type) {
super(type, false);
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java
index ca5a106..44e1bcc 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java
@@ -42,7 +42,7 @@
super(null, false);
}
- protected Class<?> getBeanClass(Element element) {
+ protected Class getBeanClass(Element element) {
ErrorHandlerType type = ErrorHandlerType.DefaultErrorHandler;
if (ObjectHelper.isNotEmpty(element.getAttribute("type"))) {
@@ -181,7 +181,7 @@
protected class RedeliveryPolicyDefinitionParser extends BeanDefinitionParser {
- public RedeliveryPolicyDefinitionParser(Class<?> type) {
+ public RedeliveryPolicyDefinitionParser(Class type) {
super(type, false);
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
index a6404c9..3f12f7c 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java
@@ -34,7 +34,7 @@
/**
* A {@link FactoryBean} to create a Proxy to a a Camel Pojo Endpoint.
*/
-public class CamelProxyFactoryBean extends UrlBasedRemoteAccessor implements FactoryBean<Object>, CamelContextAware, DisposableBean, ApplicationContextAware {
+public class CamelProxyFactoryBean extends UrlBasedRemoteAccessor implements FactoryBean, CamelContextAware, DisposableBean, ApplicationContextAware {
private String serviceRef;
private CamelContext camelContext;
private String camelContextId;
@@ -83,7 +83,7 @@
ServiceHelper.stopService(producer);
}
- public Class<?> getServiceInterface() {
+ public Class getServiceInterface() {
return super.getServiceInterface();
}
@@ -95,7 +95,7 @@
return serviceProxy;
}
- public Class<?> getObjectType() {
+ public Class getObjectType() {
return getServiceInterface();
}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/util/MainRunner.java b/components/camel-spring/src/main/java/org/apache/camel/spring/util/MainRunner.java
index a9e0b7a..85ea505 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/util/MainRunner.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/util/MainRunner.java
@@ -92,11 +92,11 @@
this.asyncRun = asyncRun;
}
- public Class<?> getMain() {
+ public Class getMain() {
return main;
}
- public void setMain(Class<?> main) {
+ public void setMain(Class main) {
this.main = main;
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java b/components/camel-spring/src/main/java/org/apache/camel/spring/util/SpringAntPathMatcherFileFilter.java
similarity index 84%
rename from camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java
rename to components/camel-spring/src/main/java/org/apache/camel/spring/util/SpringAntPathMatcherFileFilter.java
index ba85edd..d4dacc4 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/util/SpringAntPathMatcherFileFilter.java
@@ -14,22 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.file;
+package org.apache.camel.spring.util;
import java.io.File;
import java.io.FileFilter;
-import org.apache.camel.util.AntPathMatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.util.AntPathMatcher;
+import org.springframework.util.StringUtils;
/**
- * File filter using {@link AntPathMatcher}.
+ * File filter using Spring's {@link AntPathMatcher}.
* <p/>
* Exclude take precedence over includes. If a file match both exclude and include it will be regarded as excluded.
*/
-public class AntPathMatcherFileFilter implements FileFilter {
- private static final transient Logger LOG = LoggerFactory.getLogger(AntPathMatcherFileFilter.class);
+public class SpringAntPathMatcherFileFilter implements FileFilter {
+ private static final transient Logger LOG = LoggerFactory.getLogger(SpringAntPathMatcherFileFilter.class);
private AntPathMatcher matcher = new AntPathMatcher();
private String[] excludes;
@@ -47,7 +48,7 @@
*/
public boolean acceptPathName(String path) {
// must use single / as path separators
- path = path.replace(File.separatorChar, '/');
+ path = StringUtils.replace(path, File.separator, "/");
LOG.trace("Filtering file: {}", path);
@@ -72,12 +73,7 @@
}
}
- if (excludes != null && includes == null) {
- // if the user specified excludes but no includes, presumably we should include by default
- return true;
- }
-
- // nothing to include so we can't accept it
+ // nothing to include so we cant accept it
return false;
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanBindingTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanBindingTest.java
index 74f9d24..8612edf 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanBindingTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanBindingTest.java
@@ -30,6 +30,11 @@
return new ClassPathXmlApplicationContext("org/apache/camel/component/bean/beanBindingTest.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
public void testBeanBindingUsingBeanExpression() throws Exception {
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(2);
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteTest.java
index 9bb25ac..5ceb7c1 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteTest.java
@@ -54,6 +54,10 @@
}
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/component/bean/camelContext.xml");
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java b/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java
index 06f0bdd..113ece3 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/event/DummyEvent.java
@@ -22,7 +22,6 @@
* @version
*/
public class DummyEvent extends ApplicationEvent {
- private static final long serialVersionUID = 1L;
private final String text;
public DummyEvent(Object source, String text) {
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java
index 78a0d46..4833c63 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextAwareTest.java
@@ -60,4 +60,7 @@
return new ClassPathXmlApplicationContext("org/apache/camel/spring/camelContextAwareBean.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.java
index 187b0f6..84aaad2 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.java
@@ -26,6 +26,11 @@
public class CamelContextLazyLoadTypeConvertersTest extends SpringTestSupport {
@Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.xml");
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/DummyLifecycleStrategy.java b/components/camel-spring/src/test/java/org/apache/camel/spring/DummyLifecycleStrategy.java
index e39e892..0fd6c65 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/DummyLifecycleStrategy.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/DummyLifecycleStrategy.java
@@ -75,7 +75,4 @@
public void onThreadPoolAdd(CamelContext camelContext, ThreadPoolExecutor threadPool, String id,
String sourceId, String routeId, String threadPoolProfileId) {
}
-
- public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool) {
- }
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java
index 33de8e7..b0ba575 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java
@@ -64,4 +64,7 @@
return new ClassPathXmlApplicationContext("org/apache/camel/spring/injectedBean.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
index f81f19b..2df63f3 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java
@@ -24,6 +24,7 @@
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Route;
import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
import org.apache.camel.impl.DefaultPackageScanClassResolver;
import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
@@ -41,7 +42,6 @@
protected AbstractXmlApplicationContext applicationContext;
protected abstract AbstractXmlApplicationContext createApplicationContext();
- @SuppressWarnings("deprecation")
@Override
protected void setUp() throws Exception {
if (isLazyLoadingTypeConverter()) {
@@ -67,7 +67,7 @@
public void setExcludedClasses(Set<Class<?>> excludedClasses) {
if (excludedClasses == null) {
- excludedClasses = Collections.emptySet();
+ excludedClasses = CastUtils.cast(Collections.emptySet());
}
addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(excludedClasses)));
}
@@ -136,7 +136,23 @@
return value;
}
- @SuppressWarnings("deprecation")
+ @Override
+ protected void assertValidContext(CamelContext context) {
+ super.assertValidContext(context);
+
+ List<Route> routes = context.getRoutes();
+ int routeCount = getExpectedRouteCount();
+ if (routeCount > 0) {
+ assertNotNull("Should have some routes defined", routes);
+ assertTrue("Should have at least one route", routes.size() >= routeCount);
+ }
+ log.debug("Camel Routes: " + routes);
+ }
+
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = SpringCamelContext.springCamelContext(applicationContext);
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanAsEndpointTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanAsEndpointTest.java
index 0bbccee..1eb14e1 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanAsEndpointTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/bind/BeanAsEndpointTest.java
@@ -37,6 +37,10 @@
mock.assertIsSatisfied();
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/spring/bind/beanAsEndpoint.xml");
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/bind/ProcessorAsEndpointTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/bind/ProcessorAsEndpointTest.java
index 2d528a7..9844be7 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/bind/ProcessorAsEndpointTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/bind/ProcessorAsEndpointTest.java
@@ -59,4 +59,7 @@
return new ClassPathXmlApplicationContext("org/apache/camel/spring/bind/processorAsEndpoint.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java
index dcc2364..df47445 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/SpringCamelContextThreadPoolProfilesTest.java
@@ -50,7 +50,7 @@
assertEquals(5, tp.getMaximumPoolSize());
// should inherit default options
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.CallerRunsPolicy.class, tp.getRejectedExecutionHandler());
}
public void testBigProfile() throws Exception {
@@ -70,7 +70,7 @@
assertEquals(100, tp.getMaximumPoolSize());
// should inherit default options
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
- assertEquals("DiscardOldest", tp.getRejectedExecutionHandler().toString());
+ assertIsInstanceOf(ThreadPoolExecutor.DiscardOldestPolicy.class, tp.getRejectedExecutionHandler());
}
}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/example/FooEventRouteTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/example/FooEventRouteTest.java
index 2191d12..817be2e 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/example/FooEventRouteTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/example/FooEventRouteTest.java
@@ -40,4 +40,9 @@
return new ClassPathXmlApplicationContext("org/apache/camel/spring/example/fooEventRoute.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java
index cdbe841..a68c5e3 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java
@@ -47,4 +47,7 @@
return new ClassPathXmlApplicationContext("org/apache/camel/spring/example/pojoConsumer.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoSenderTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoSenderTest.java
index 9d53897..89b6999 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoSenderTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoSenderTest.java
@@ -64,6 +64,9 @@
return new ClassPathXmlApplicationContext("org/apache/camel/spring/example/pojoSender.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/ContainerWideInterceptor.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/ContainerWideInterceptor.java
index 3babd41..9e1e02d 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/ContainerWideInterceptor.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/ContainerWideInterceptor.java
@@ -33,7 +33,7 @@
private static final transient Logger LOG = LoggerFactory.getLogger(ContainerWideInterceptor.class);
private static int count;
- public Processor wrapProcessorInInterceptors(final CamelContext context, final ProcessorDefinition<?> definition,
+ public Processor wrapProcessorInInterceptors(final CamelContext context, final ProcessorDefinition definition,
final Processor target, final Processor nextTarget) throws Exception {
// as this is based on an unit test we are a bit lazy and just create an inlined processor
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
index 5adbbed..ee2bed8 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedPropagationTransactedTest.java
@@ -39,6 +39,10 @@
"/org/apache/camel/spring/interceptor/mixedPropagationTransactedTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java
index a7862a3..8b2773d 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.java
@@ -38,6 +38,10 @@
"/org/apache/camel/spring/interceptor/MixedTransactionPropagationTest.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Override
protected void setUp() throws Exception {
this.disableJMX();
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionClientDataSourceSupport.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionClientDataSourceSupport.java
index 3e07d2a..4078a74 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionClientDataSourceSupport.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionClientDataSourceSupport.java
@@ -48,4 +48,8 @@
return useTransactionErrorHandler;
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java
index 94c9568..a5b40b5 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest.java
@@ -27,6 +27,10 @@
*/
public class TransactionalClientDataSourceWithOnExceptionHandledAndRollbackTest extends TransactionalClientDataSourceTest {
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
public void testTransactionRollback() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:error");
mock.expectedMessageCount(1);
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java
index d209e53..17cba3d 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest.java
@@ -25,6 +25,10 @@
*/
public class TransactionalClientDataSourceWithOnExceptionHandledAndRollbackUsingTransactedTest extends TransactionalClientDataSourceTest {
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
public void testTransactionRollback() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:error");
mock.expectedMessageCount(1);
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithSpringRouteBuilderTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithSpringRouteBuilderTest.java
index 3e34e29..94db77d 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithSpringRouteBuilderTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientDataSourceWithSpringRouteBuilderTest.java
@@ -32,5 +32,10 @@
return new ClassPathXmlApplicationContext(
"/org/apache/camel/spring/interceptor/transactionalClientDataSourceWithSpringRouteBuilder.xml");
}
-
+
+ @Override
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithAnnotatedBeanTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithAnnotatedBeanTest.java
index acc842f..4151079 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithAnnotatedBeanTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithAnnotatedBeanTest.java
@@ -56,4 +56,9 @@
"/org/apache/camel/spring/interceptor/transactionalClientWithAnnotatedBeanTest.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java
index 392a497..d781ce5 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/interceptor/TransactionalClientWithRollbackTest.java
@@ -42,6 +42,10 @@
return new ClassPathXmlApplicationContext("/org/apache/camel/spring/interceptor/transactionalClientDataSource.xml");
}
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedTest.java
index c4ffe0ca..882197b 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedTest.java
@@ -34,6 +34,11 @@
return true;
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/spring/management/dualCamelContextManagedTest.xml");
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.java
deleted file mode 100644
index 85c3869..0000000
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spring.management;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.management.ManagedNamePatternFixedTest;
-
-import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
-
-/**
- * @version
- */
-public class SpringManagedNamePatternFixedTest extends ManagedNamePatternFixedTest {
-
- protected CamelContext createCamelContext() throws Exception {
- return createSpringCamelContext(this, "org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.xml");
- }
-
-}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedNamePatternTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedNamePatternTest.java
deleted file mode 100644
index a08226a..0000000
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/management/SpringManagedNamePatternTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spring.management;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.management.ManagedNamePatternTest;
-
-import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
-
-/**
- * @version
- */
-public class SpringManagedNamePatternTest extends ManagedNamePatternTest {
-
- protected CamelContext createCamelContext() throws Exception {
- return createSpringCamelContext(this, "org/apache/camel/spring/management/SpringManagedNamePatternTest.xml");
- }
-
-}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFailOverLoadBalanceAutoStartupFalseTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFailOverLoadBalanceAutoStartupFalseTest.java
deleted file mode 100644
index f967a48..0000000
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringFailOverLoadBalanceAutoStartupFalseTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spring.processor;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.processor.FailOverLoadBalanceAutoStartupFalseTest;
-
-import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
-
-public class SpringFailOverLoadBalanceAutoStartupFalseTest extends FailOverLoadBalanceAutoStartupFalseTest {
-
- protected CamelContext createCamelContext() throws Exception {
- return createSpringCamelContext(this, "org/apache/camel/spring/processor/FailOverLoadBalanceAutoStartupFalseTest.xml");
- }
-
-}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.java
deleted file mode 100644
index 75d52fa..0000000
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.spring.processor;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.FailedToCreateRouteException;
-
-import static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
-
-public class SpringTryCatchMustHaveExceptionConfiguredTest extends ContextTestSupport {
-
- protected CamelContext createCamelContext() throws Exception {
- try {
- createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.xml");
- fail("Should have thrown exception");
- } catch (Exception e) {
- assertIsInstanceOf(FailedToCreateRouteException.class, e.getCause());
- assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
- assertEquals("At least one Exception must be configured to catch", e.getCause().getCause().getMessage());
- }
-
- // return a working context instead, to let this test pass
- return createSpringCamelContext(this, "org/apache/camel/spring/processor/SpringTryProcessorHandledTest.xml");
- }
-
- public void testTryCatchMustHaveExceptionConfigured() {
- // noop
- }
-
-}
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/OrderFailedException.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/OrderFailedException.java
index de92819..1b427a1 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/OrderFailedException.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/onexception/OrderFailedException.java
@@ -21,8 +21,6 @@
*/
public class OrderFailedException extends Exception {
- private static final long serialVersionUID = 1L;
-
public OrderFailedException(String message) {
super(message);
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoPojoDirect.java b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoPojoDirect.java
index 186dc40..6a2d9db 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoPojoDirect.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoPojoDirect.java
@@ -29,7 +29,7 @@
@Consume(uri = "direct:start")
public String onEcho(String name) {
- return service.echo(name);
+ return (String) service.echo(name);
}
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoDirectTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoDirectTest.java
index 032bbf9..0882abb 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoDirectTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoDirectTest.java
@@ -26,6 +26,11 @@
*/
public class EchoSpringRemotingPojoDirectTest extends SpringTestSupport {
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/spring/remoting/echo-pojo-direct.xml");
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoTest.java
index f5e6944..206edba 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/EchoSpringRemotingPojoTest.java
@@ -26,6 +26,11 @@
*/
public class EchoSpringRemotingPojoTest extends SpringTestSupport {
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/spring/remoting/echo-pojo.xml");
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java
index 2e59ea2..b66ac66 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/scan/PatternBasedPackageScanFilterTest.java
@@ -26,7 +26,7 @@
import java.util.Set;
import java.util.jar.JarFile;
-import org.apache.camel.core.xml.PatternBasedPackageScanFilter;
+import org.apache.camel.core.xml.scan.PatternBasedPackageScanFilter;
import org.apache.camel.util.CollectionHelper;
public class PatternBasedPackageScanFilterTest extends org.apache.camel.spring.scan.ScanTestSupport {
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java b/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java
index b037a9a..a38f240 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/scan/ScanTestSupport.java
@@ -20,7 +20,7 @@
import java.util.Set;
import junit.framework.TestCase;
-import org.apache.camel.core.xml.PatternBasedPackageScanFilter;
+import org.apache.camel.core.xml.scan.PatternBasedPackageScanFilter;
public abstract class ScanTestSupport extends TestCase {
@@ -32,7 +32,7 @@
protected void validateMatchingSetContains(Set<Class<?>> scannedClasses, Class<?>... matchingClasses) {
HashSet<Class<?>> expectedSet = new HashSet<Class<?>>();
- for (Class<?> expected : matchingClasses) {
+ for (Class expected : matchingClasses) {
expectedSet.add(expected);
}
validateMatchingSetContains(scannedClasses, expectedSet);
@@ -62,7 +62,7 @@
public Set<Class<?>> getMatchingClasses(Set<Class<?>> scannedClasses, PatternBasedPackageScanFilter filter) {
Set<Class<?>> matching = new HashSet<Class<?>>();
- for (Class<?> candidate : scannedClasses) {
+ for (Class candidate : scannedClasses) {
if (filter.matches(candidate)) {
matching.add(candidate);
}
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java
index b3ebb24..59a2889 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/util/EndpointHelperTest.java
@@ -28,6 +28,11 @@
public class EndpointHelperTest extends SpringTestSupport {
@Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
+ @Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("org/apache/camel/spring/util/EndpointHelperTest.xml");
}
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.xml
deleted file mode 100644
index 41a2fd9..0000000
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedNamePatternFixedTest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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
- ">
-
- <bean id="naming" class="org.apache.camel.management.DefaultManagementNamingStrategy">
- <property name="hostName" value="localhost"/>
- <property name="domainName" value="org.apache.camel"/>
- </bean>
-
- <!-- START SNIPPET: example -->
- <camelContext managementNamePattern="cool" xmlns="http://camel.apache.org/schema/spring">
- <jmxAgent id="agent"/>
-
- <route>
- <from uri="direct:start"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
- <!-- END SNIPPET: example -->
-
-</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedNamePatternTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedNamePatternTest.xml
deleted file mode 100644
index 494c039..0000000
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/management/SpringManagedNamePatternTest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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
- ">
-
- <bean id="naming" class="org.apache.camel.management.DefaultManagementNamingStrategy">
- <property name="hostName" value="localhost"/>
- <property name="domainName" value="org.apache.camel"/>
- </bean>
-
- <!-- START SNIPPET: example -->
- <camelContext managementNamePattern="cool-#name#" xmlns="http://camel.apache.org/schema/spring">
- <jmxAgent id="agent"/>
-
- <route>
- <from uri="direct:start"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
- <!-- END SNIPPET: example -->
-
-</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/FailOverLoadBalanceAutoStartupFalseTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/FailOverLoadBalanceAutoStartupFalseTest.xml
deleted file mode 100644
index b5f3453..0000000
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/FailOverLoadBalanceAutoStartupFalseTest.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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">
-
- <route id="foo" autoStartup="false">
- <from uri="direct:start"/>
- <loadBalance inheritErrorHandler="true">
- <failover maximumFailoverAttempts="3" roundRobin="true"/>
- <to uri="direct:x"/>
- <to uri="direct:y"/>
- <to uri="direct:z"/>
- </loadBalance>
- </route>
-
- <route>
- <from uri="direct:x"/>
- <to uri="mock:x"/>
- <throwException ref="forced"/>
- </route>
- <route>
- <from uri="direct:y"/>
- <to uri="mock:y"/>
- <throwException ref="alsoForced"/>
- </route>
- <route>
- <from uri="direct:z"/>
- <to uri="mock:z"/>
- </route>
-
- </camelContext>
-
- <bean id="forced" class="java.lang.IllegalArgumentException">
- <constructor-arg index="0" value="Forced"/>
- </bean>
-
- <bean id="alsoForced" class="java.lang.IllegalArgumentException">
- <constructor-arg index="0" value="Also Forced"/>
- </bean>
-
-</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator/SpringAggregateForceCompletionOnStopTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator/SpringAggregateForceCompletionOnStopTest.xml
index 05c5068..a2145d0 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator/SpringAggregateForceCompletionOnStopTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/aggregator/SpringAggregateForceCompletionOnStopTest.xml
@@ -23,20 +23,18 @@
">
<camelContext xmlns="http://camel.apache.org/schema/spring">
- <route id="foo">
+ <route>
<from uri="direct:forceCompletionTrue"/>
<aggregate strategyRef="aggregatorStrategy" forceCompletionOnStop="true" completionSize="10">
<correlationExpression><header>id</header></correlationExpression>
- <delay><constant>100</constant></delay>
<process ref="myCompletionProcessor"/>
</aggregate>
</route>
- <route id="bar">
+ <route>
<from uri="direct:forceCompletionFalse"/>
<aggregate strategyRef="aggregatorStrategy" completionSize="10">
<correlationExpression><header>id</header></correlationExpression>
- <delay><constant>100</constant></delay>
<process ref="myCompletionProcessor"/>
</aggregate>
</route>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/delayerperroute.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/delayerperroute.xml
index e4245e3..ea34e8a 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/delayerperroute.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/delayerperroute.xml
@@ -25,8 +25,8 @@
<!-- define a global delayer using 2000 ms -->
<camelContext delayer="2000" xmlns="http://camel.apache.org/schema/spring">
- <!-- this route will inherit the global delayer -->
- <route>
+ <!-- this route uses a 1000 ms delayer -->
+ <route delayer="1000">
<from uri="seda:a"/>
<to uri="mock:result"/>
</route>
@@ -37,6 +37,12 @@
<to uri="mock:result"/>
</route>
+ <!-- this route will inherit the global delayer -->
+ <route>
+ <from uri="seda:c"/>
+ <to uri="mock:result"/>
+ </route>
+
</camelContext>
</beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
index 873a759..ce5a96a 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/xpathFilterWithNamespace.xml
@@ -28,7 +28,7 @@
<route>
<from uri="direct:start"/>
<filter>
- <xpath logNamespaces="true">/foo:person[@name='James']</xpath>
+ <xpath>/foo:person[@name='James']</xpath>
<to uri="mock:result"/>
</filter>
</route>
diff --git a/components/camel-sql/pom.xml b/components/camel-sql/pom.xml
index db7862d..4b5e80a 100644
--- a/components/camel-sql/pom.xml
+++ b/components/camel-sql/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -58,7 +58,7 @@
<!-- test dependencies -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -100,4 +100,5 @@
</plugin>
</plugins>
</build>
+
</project>
diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java
index 10a4aa9..d764041 100755
--- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlRouteTest.java
@@ -160,7 +160,7 @@
template.sendBody("direct:insert", new Object[] {10, "test", "test"});
mock.assertIsSatisfied();
try {
- String projectName = jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
+ String projectName = (String)jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
assertEquals("test", projectName);
} catch (EmptyResultDataAccessException e) {
fail("no row inserted");
diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/AbstractJdbcAggregationTestSupport.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/AbstractJdbcAggregationTestSupport.java
index 686b539..356400f 100644
--- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/AbstractJdbcAggregationTestSupport.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/AbstractJdbcAggregationTestSupport.java
@@ -64,6 +64,11 @@
return new ClassPathXmlApplicationContext("org/apache/camel/processor/aggregate/jdbc/JdbcSpringDataSource.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
public static class MyAggregationStrategy implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
diff --git a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java
index 2607d9c..f563c1c 100644
--- a/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepositoryMultipleRepoTest.java
@@ -100,4 +100,8 @@
return new ClassPathXmlApplicationContext("org/apache/camel/processor/aggregate/jdbc/JdbcSpringDataSource.xml");
}
+ @Override
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
}
\ No newline at end of file
diff --git a/components/camel-ssh/pom.xml b/components/camel-ssh/pom.xml
deleted file mode 100644
index f2309a1..0000000
--- a/components/camel-ssh/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-ssh</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: SSH</name>
- <description>Camel SSH support</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.component.ssh.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>${mina2-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <version>${sshd-version}</version>
- </dependency>
-
- <!-- for testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcpg-jdk16</artifactId>
- <version>${bouncycastle-version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java
deleted file mode 100644
index 719f96f..0000000
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.sshd.common.KeyPairProvider;
-
-/**
- * Represents the component that manages {@link SshEndpoint}.
- */
-public class SshComponent extends DefaultComponent {
- private SshConfiguration configuration;
-
- @Override
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- SshConfiguration newConfig;
-
- if (configuration == null) {
- newConfig = new SshConfiguration(new URI(uri));
- } else {
- newConfig = configuration.copy();
- }
-
- SshEndpoint endpoint = new SshEndpoint(uri, this, newConfig);
- setProperties(endpoint.getConfiguration(), parameters);
- return endpoint;
- }
-
- public SshConfiguration getConfiguration() {
- if (configuration == null) {
- configuration = new SshConfiguration();
- }
- return configuration;
- }
-
- public void setConfiguration(SshConfiguration configuration) {
- this.configuration = configuration;
- }
-
- public String getHost() {
- return getConfiguration().getHost();
- }
-
- public void setHost(String host) {
- getConfiguration().setHost(host);
- }
-
- public int getPort() {
- return getConfiguration().getPort();
- }
-
- public void setPort(int port) {
- getConfiguration().setPort(port);
- }
-
- public String getUsername() {
- return getConfiguration().getUsername();
- }
-
- public void setUsername(String username) {
- getConfiguration().setUsername(username);
- }
-
- public String getPassword() {
- return getConfiguration().getPassword();
- }
-
- public void setPassword(String password) {
- getConfiguration().setPassword(password);
- }
-
- public String getPollCommand() {
- return getConfiguration().getPollCommand();
- }
-
- public void setPollCommand(String pollCommand) {
- getConfiguration().setPollCommand(pollCommand);
- }
-
- public KeyPairProvider getKeyPairProvider() {
- return getConfiguration().getKeyPairProvider();
- }
-
- public void setKeyPairProvider(KeyPairProvider keyPairProvider) {
- getConfiguration().setKeyPairProvider(keyPairProvider);
- }
-
- public String getKeyType() {
- return getConfiguration().getKeyType();
- }
-
- public void setKeyType(String keyType) {
- getConfiguration().setKeyType(keyType);
- }
-
- public long getTimeout() {
- return getConfiguration().getTimeout();
- }
-
- public void setTimeout(long timeout) {
- getConfiguration().setTimeout(timeout);
- }
-
- public String getCertFilename() {
- return getConfiguration().getCertFilename();
- }
-
- public void setCertFilename(String certFilename) {
- getConfiguration().setCertFilename(certFilename);
- }
-}
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
deleted file mode 100644
index 2736024..0000000
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import java.net.URI;
-
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.sshd.common.KeyPairProvider;
-
-public class SshConfiguration implements Cloneable {
- public static final int DEFAULT_SSH_PORT = 22;
-
- private String username;
- private String host;
- private int port = DEFAULT_SSH_PORT;
- private String password;
- private String pollCommand;
- private KeyPairProvider keyPairProvider;
- private String keyType = KeyPairProvider.SSH_RSA;
- private String certFilename;
- private long timeout = 30000;
-
- public SshConfiguration() {
- }
-
- public SshConfiguration(URI uri) {
- configure(uri);
- }
-
- public void configure(URI uri) {
- // UserInfo can contain both username and password as: user:pwd@sshserver
- // see: http://en.wikipedia.org/wiki/URI_scheme
- String username = uri.getUserInfo();
- String pw = null;
- if (username != null && username.contains(":")) {
- pw = ObjectHelper.after(username, ":");
- username = ObjectHelper.before(username, ":");
- }
- if (username != null) {
- setUsername(username);
- }
- if (pw != null) {
- setPassword(pw);
- }
-
- setHost(uri.getHost());
-
- // URI.getPort returns -1 if port not defined, else use default port
- int uriPort = uri.getPort();
- if (uriPort != -1) {
- setPort(uriPort);
- }
- }
-
- public SshConfiguration copy() {
- try {
- return (SshConfiguration) clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeCamelException(e);
- }
- }
-
- public String getUsername() {
- return username;
- }
-
- /**
- * Sets the username to use in logging into the remote SSH server.
- *
- * @param username String representing login username.
- */
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getHost() {
- return host;
- }
-
- /**
- * Sets the hostname of the remote SSH server.
- *
- * @param host String representing hostname of SSH server.
- */
- public void setHost(String host) {
- this.host = host;
- }
-
- public int getPort() {
- return port;
- }
-
- /**
- * Sets the port number for the remote SSH server.
- *
- * @param port int representing port number on remote host. Defaults to 22.
- */
- public void setPort(int port) {
- this.port = port;
- }
-
- public String getPassword() {
- return password;
- }
-
- /**
- * Sets the password to use in connecting to remote SSH server.
- * Requires keyPairProvider to be set to null.
- *
- * @param password String representing password for username at remote host.
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getPollCommand() {
- return pollCommand;
- }
-
- /**
- * Sets the command string to send to the remote SSH server during every poll cycle.
- * Only works with camel-ssh component being used as a consumer, i.e. from("ssh://...")
- *
- * @param pollCommand String representing the command to send.
- */
- public void setPollCommand(String pollCommand) {
- this.pollCommand = pollCommand;
- }
-
- public KeyPairProvider getKeyPairProvider() {
- return keyPairProvider;
- }
-
- /**
- * Sets the KeyPairProvider reference to use when connecting using Certificates to the remote SSH Server.
- *
- * @param keyPairProvider KeyPairProvider reference to use in authenticating. If set to 'null',
- * then will attempt to connect using username/password settings.
- *
- * @see KeyPairProvider
- */
- public void setKeyPairProvider(KeyPairProvider keyPairProvider) {
- this.keyPairProvider = keyPairProvider;
- }
-
- public String getKeyType() {
- return keyType;
- }
-
- /**
- * Sets the key type to pass to the KeyPairProvider as part of authentication.
- * KeyPairProvider.loadKey(...) will be passed this value. Defaults to "ssh-rsa".
- *
- * @param keyType String defining the type of KeyPair to use for authentication.
- *
- * @see KeyPairProvider
- */
- public void setKeyType(String keyType) {
- this.keyType = keyType;
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- /**
- * Sets the timeout in milliseconds to wait in establishing the remote SSH server connection.
- * Defaults to 30000 milliseconds.
- *
- * @param timeout long milliseconds to wait.
- */
- public void setTimeout(long timeout) {
- this.timeout = timeout;
- }
-
- public String getCertFilename() {
- return this.certFilename;
- }
-
- /**
- * Sets the filename of the certificate to use for Authentication.
- * Will use FileKeyPairProvider to resolve file based certificate, and depends on keyType setting.
- *
- * @param certFilename
- */
- public void setCertFilename(String certFilename) {
- this.certFilename = certFilename;
- }
-}
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
deleted file mode 100644
index 36dbc59..0000000
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.impl.ScheduledPollConsumer;
-
-public class SshConsumer extends ScheduledPollConsumer {
- private final SshEndpoint endpoint;
-
- public SshConsumer(SshEndpoint endpoint, Processor processor) {
- super(endpoint, processor);
- this.endpoint = endpoint;
- }
-
- @Override
- protected int poll() throws Exception {
- String command = endpoint.getPollCommand();
- byte[] result = endpoint.sendExecCommand(command);
-
- Exchange exchange = endpoint.createExchange();
- exchange.getIn().setBody(result);
-
- try {
- // send message to next processor in the route
- getProcessor().process(exchange);
- return 1; // number of messages polled
- } finally {
- // log exception if an exception occurred and was not handled
- if (exchange.getException() != null) {
- getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
- }
- }
- }
-}
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
deleted file mode 100644
index 7b53ae8..0000000
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.security.KeyPair;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.impl.ScheduledPollEndpoint;
-import org.apache.sshd.ClientChannel;
-import org.apache.sshd.ClientSession;
-import org.apache.sshd.SshClient;
-import org.apache.sshd.client.future.AuthFuture;
-import org.apache.sshd.client.future.ConnectFuture;
-import org.apache.sshd.client.future.OpenFuture;
-import org.apache.sshd.common.KeyPairProvider;
-import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents an SSH endpoint.
- */
-public class SshEndpoint extends ScheduledPollEndpoint {
- protected final transient Logger log = LoggerFactory.getLogger(getClass());
-
- private SshClient client;
- private SshConfiguration sshConfiguration;
-
- public SshEndpoint() {
- }
-
- public SshEndpoint(String uri, SshComponent component) {
- super(uri, component);
- }
-
- public SshEndpoint(String uri, SshComponent component, SshConfiguration configuration) {
- super(uri, component);
- this.sshConfiguration = configuration;
- }
-
- @Override
- public Producer createProducer() throws Exception {
- return new SshProducer(this);
- }
-
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- SshConsumer consumer = new SshConsumer(this, processor);
- configureConsumer(consumer);
- return consumer;
- }
-
- @Override
- public boolean isSingleton() {
- // SshClient is not thread-safe to be shared
- return false;
- }
-
- public byte[] sendExecCommand(String command) throws Exception {
- byte[] result = null;
-
- if (getConfiguration() == null) {
- throw new IllegalStateException("Configuration must be set");
- }
-
- ConnectFuture connectFuture = client.connect(getHost(), getPort());
-
- // Wait getTimeout milliseconds for connect operation to complete
- connectFuture.await(getTimeout());
-
- if (!connectFuture.isDone() || !connectFuture.isConnected()) {
- final String msg = "Failed to connect to " + getHost() + ":" + getPort() + " within timeout " + getTimeout() + "ms";
- log.debug(msg);
- throw new RuntimeCamelException(msg);
- }
-
- log.debug("Connected to {}:{}", getHost(), getPort());
-
- AuthFuture authResult;
- ClientSession session = connectFuture.getSession();
-
- KeyPairProvider keyPairProvider;
- final String certFilename = getCertFilename();
- if (certFilename != null) {
- log.debug("Attempting to authenticate using FileKey '{}'...", certFilename);
- keyPairProvider = new FileKeyPairProvider(new String[]{certFilename});
- } else {
- keyPairProvider = getKeyPairProvider();
- }
-
- if (keyPairProvider != null) {
- log.debug("Attempting to authenticate username '{}' using Key...", getUsername());
- KeyPair pair = keyPairProvider.loadKey(getKeyType());
- authResult = session.authPublicKey(getUsername(), pair);
- } else {
- log.debug("Attempting to authenticate username '{}' using Password...", getUsername());
- authResult = session.authPassword(getUsername(), getPassword());
- }
-
- authResult.await(getTimeout());
-
- if (!authResult.isDone() || authResult.isFailure()) {
- log.debug("Failed to authenticate");
- throw new RuntimeCamelException("Failed to authenticate username " + getUsername());
- }
-
- ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_EXEC, command);
-
- ByteArrayInputStream in = new ByteArrayInputStream(new byte[]{0});
- channel.setIn(in);
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- channel.setOut(out);
-
- ByteArrayOutputStream err = new ByteArrayOutputStream();
- channel.setErr(err);
-
- OpenFuture openFuture = channel.open();
- openFuture.await(getTimeout());
- if (openFuture.isOpened()) {
- channel.waitFor(ClientChannel.CLOSED, 0);
- result = out.toByteArray();
- }
-
- return result;
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
-
- client = SshClient.setUpDefaultClient();
- client.start();
- }
-
- @Override
- protected void doStop() throws Exception {
- if (client != null) {
- client.stop();
- client = null;
- }
-
- super.doStop();
- }
-
- public SshConfiguration getConfiguration() {
- return sshConfiguration;
- }
-
- public void setConfiguration(SshConfiguration configuration) {
- this.sshConfiguration = configuration;
- }
-
- public String getHost() {
- return getConfiguration().getHost();
- }
-
- public void setHost(String host) {
- getConfiguration().setHost(host);
- }
-
- public int getPort() {
- return getConfiguration().getPort();
- }
-
- public void setPort(int port) {
- getConfiguration().setPort(port);
- }
-
- public String getUsername() {
- return getConfiguration().getUsername();
- }
-
- public void setUsername(String username) {
- getConfiguration().setUsername(username);
- }
-
- public String getPassword() {
- return getConfiguration().getPassword();
- }
-
- public void setPassword(String password) {
- getConfiguration().setPassword(password);
- }
-
- public String getPollCommand() {
- return getConfiguration().getPollCommand();
- }
-
- public void setPollCommand(String pollCommand) {
- getConfiguration().setPollCommand(pollCommand);
- }
-
- public KeyPairProvider getKeyPairProvider() {
- return getConfiguration().getKeyPairProvider();
- }
-
- public void setKeyPairProvider(KeyPairProvider keyPairProvider) {
- getConfiguration().setKeyPairProvider(keyPairProvider);
- }
-
- public String getKeyType() {
- return getConfiguration().getKeyType();
- }
-
- public void setKeyType(String keyType) {
- getConfiguration().setKeyType(keyType);
- }
-
- public long getTimeout() {
- return getConfiguration().getTimeout();
- }
-
- public void setTimeout(long timeout) {
- getConfiguration().setTimeout(timeout);
- }
-
- public String getCertFilename() {
- return getConfiguration().getCertFilename();
- }
-
- public void setCertFilename(String certFilename) {
- getConfiguration().setCertFilename(certFilename);
- }
-}
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java
deleted file mode 100644
index e1b73ed..0000000
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshProducer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.CamelExchangeException;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.impl.DefaultProducer;
-
-public class SshProducer extends DefaultProducer {
- private SshEndpoint endpoint;
-
- public SshProducer(SshEndpoint endpoint) {
- super(endpoint);
- this.endpoint = endpoint;
- }
-
- @Override
- public void process(Exchange exchange) throws Exception {
- final Message in = exchange.getIn();
- String command = in.getMandatoryBody(String.class);
-
- try {
- byte[] result = endpoint.sendExecCommand(command);
- exchange.getOut().setBody(result);
- } catch (Exception e) {
- throw new CamelExchangeException("Cannot execute command: " + command, exchange, e);
- }
-
- // propagate headers and attachments
- exchange.getOut().getHeaders().putAll(in.getHeaders());
- exchange.getOut().setAttachments(in.getAttachments());
- }
-}
\ No newline at end of file
diff --git a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/package.html b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/package.html
deleted file mode 100644
index f24393f..0000000
--- a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/package.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- ~ 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.
- -->
-<html>
-<head>
-</head>
-<body>
-
-Defines the <a href="http://camel.apache.org/ssh.html">SSH Component</a>
-
-</body>
-</html>
diff --git a/components/camel-ssh/src/main/resources/META-INF/services/org/apache/camel/component/ssh b/components/camel-ssh/src/main/resources/META-INF/services/org/apache/camel/component/ssh
deleted file mode 100644
index 1f76f46..0000000
--- a/components/camel-ssh/src/main/resources/META-INF/services/org/apache/camel/component/ssh
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.component.ssh.SshComponent
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/BogusPasswordAuthenticator.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/BogusPasswordAuthenticator.java
deleted file mode 100644
index 958c8ab..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/BogusPasswordAuthenticator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.sshd.server.PasswordAuthenticator;
-import org.apache.sshd.server.session.ServerSession;
-
-public class BogusPasswordAuthenticator implements PasswordAuthenticator {
-
- @Override
- public boolean authenticate(String username, String password, ServerSession session) {
- return username != null && username.equals(password);
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/BogusPublickeyAuthenticator.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/BogusPublickeyAuthenticator.java
deleted file mode 100644
index e4d9222..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/BogusPublickeyAuthenticator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import java.security.PublicKey;
-
-import org.apache.sshd.server.PublickeyAuthenticator;
-import org.apache.sshd.server.session.ServerSession;
-
-public class BogusPublickeyAuthenticator implements PublickeyAuthenticator {
-
- @Override
- public boolean authenticate(String username, PublicKey key, ServerSession session) {
- return true;
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/EchoCommandFactory.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/EchoCommandFactory.java
deleted file mode 100644
index 1757876..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/EchoCommandFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.sshd.server.Command;
-import org.apache.sshd.server.CommandFactory;
-import org.apache.sshd.server.Environment;
-import org.apache.sshd.server.ExitCallback;
-
-public class EchoCommandFactory implements CommandFactory {
-
- @Override
- public Command createCommand(String command) {
- return new EchoCommand(command);
- }
-
- protected static class EchoCommand implements Command, Runnable {
- private String command;
- private OutputStream out;
- private ExitCallback callback;
- private Thread thread;
-
- public EchoCommand(String command) {
- this.command = command;
- }
-
- @Override
- public void setInputStream(InputStream in) {
- }
-
- @Override
- public void setOutputStream(OutputStream out) {
- this.out = out;
- }
-
- @Override
- public void setErrorStream(OutputStream err) {
- }
-
- @Override
- public void setExitCallback(ExitCallback callback) {
- this.callback = callback;
- }
-
- @Override
- public void start(Environment env) throws IOException {
- thread = new Thread(this, "EchoCommand");
- thread.start();
- }
-
- @Override
- public void destroy() {
- thread.interrupt();
- }
-
- @Override
- public void run() {
- boolean succeeded = true;
- String message = null;
- try {
- out.write(command.getBytes());
- out.flush();
- } catch (Exception e) {
- succeeded = false;
- message = e.toString();
- } finally {
- if (succeeded) {
- callback.onExit(0);
- } else {
- callback.onExit(1, message);
- }
- }
- }
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentConsumerTest.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentConsumerTest.java
deleted file mode 100644
index b02b4e0..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentConsumerTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class SshComponentConsumerTest extends SshComponentTestSupport {
-
- @Test
- public void testPollingConsumer() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived("test\r");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() {
- from("ssh://smx:smx@localhost:" + port + "?useFixedDelay=true&delay=5000&pollCommand=test%0D")
- .to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentErrorHandlingTest.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentErrorHandlingTest.java
deleted file mode 100644
index d6808fd..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentErrorHandlingTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-public class SshComponentErrorHandlingTest extends SshComponentTestSupport {
-
- @Test
- public void testRedelivery() throws Exception {
- final String msg = "test\n";
-
- MockEndpoint mockError = getMockEndpoint("mock:error");
- mockError.expectedMinimumMessageCount(0);
-
- MockEndpoint mock = getMockEndpoint("mock:success");
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived(msg);
- mock.expectedHeaderReceived(Exchange.REDELIVERED, true);
-
- sshd.stop();
-
- template.sendBody("direct:redeliver", msg);
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() {
- errorHandler(deadLetterChannel("mock:error")
- .maximumRedeliveries(3)
- .redeliveryDelay(0L) // speedup unit test by not waiting between redeliveries
- .onRedelivery(new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- final Message in = exchange.getIn();
- final int count = in.getHeader(Exchange.REDELIVERY_COUNTER, Integer.class);
- final int maxCount = in.getHeader(Exchange.REDELIVERY_MAX_COUNTER, Integer.class);
-
- log.info("Redelivery count = {}", count);
-
- // Restart the sshd server before the last redelivery attempt
- if (count >= (maxCount - 1)) {
- if (sshd != null) {
- sshd.start();
- log.info("Restarting SSHD");
- }
- }
- }
- }));
-
- from("direct:redeliver")
- .tracing()
- .to("ssh://smx:smx@localhost:" + port)
- .to("mock:success");
- }
- };
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java
deleted file mode 100644
index 0ff1ebe..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-
-import org.junit.Test;
-
-public class SshComponentProducerTest extends SshComponentTestSupport {
-
- @Test
- public void testProducer() throws Exception {
- final String msg = "test\n";
-
- MockEndpoint mock = getMockEndpoint("mock:password");
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived(msg);
-
- template.sendBody("direct:ssh", msg);
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testReconnect() throws Exception {
- final String msg = "test\n";
-
- MockEndpoint mock = getMockEndpoint("mock:password");
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived(msg);
-
- template.sendBody("direct:ssh", msg);
-
- assertMockEndpointsSatisfied();
-
- sshd.stop();
- sshd.start();
-
- mock.reset();
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived(msg);
-
- template.sendBody("direct:ssh", msg);
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testConnectionTimeout() throws Exception {
- final String msg = "test\n";
-
- MockEndpoint mock = getMockEndpoint("mock:password");
- mock.expectedMinimumMessageCount(0);
-
- MockEndpoint mockError = getMockEndpoint("mock:error");
- mockError.expectedMinimumMessageCount(1);
-
- sshd.stop();
- sshd = null;
-
- template.sendBody("direct:ssh", msg);
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() {
- onException(Exception.class)
- .handled(true)
- .to("mock:error");
-
- from("direct:ssh")
- .to("ssh://smx:smx@localhost:" + port + "?timeout=3000")
- .to("mock:password");
- }
- };
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java
deleted file mode 100644
index 4913a32..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.sshd.common.KeyPairProvider;
-import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
-import org.junit.Test;
-
-public class SshComponentSecurityTest extends SshComponentTestSupport {
-
- @Test
- public void testRsa() throws Exception {
- final String msg = "test\n";
-
- MockEndpoint mock = getMockEndpoint("mock:rsa");
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived(msg);
-
- template.sendBody("direct:ssh-rsa", msg);
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testRsaFile() throws Exception {
- final String msg = "test\n";
-
- MockEndpoint mock = getMockEndpoint("mock:rsaFile");
- mock.expectedMinimumMessageCount(1);
- mock.expectedBodiesReceived(msg);
-
- template.sendBody("direct:ssh-rsaFile", msg);
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() {
- onException(Exception.class)
- .handled(true)
- .to("mock:error");
-
- SshComponent sshComponent = new SshComponent();
- sshComponent.setHost("localhost");
- sshComponent.setPort(port);
- sshComponent.setUsername("smx");
- sshComponent.setKeyPairProvider(new FileKeyPairProvider(new String[]{"src/test/resources/hostkey.pem"}));
- sshComponent.setKeyType(KeyPairProvider.SSH_RSA);
-
- getContext().addComponent("ssh-rsa", sshComponent);
-
- from("direct:ssh-rsa")
- .to("ssh-rsa:test")
- .to("mock:rsa");
-
- from("direct:ssh-rsaFile")
- .to("ssh://smx@localhost:" + port + "?certFilename=src/test/resources/hostkey.pem")
- .to("mock:rsaFile");
- }
- };
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentTestSupport.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentTestSupport.java
deleted file mode 100644
index 3a2eb1d..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentTestSupport.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.sshd.SshServer;
-import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
-
-public class SshComponentTestSupport extends CamelTestSupport {
- protected SshServer sshd;
- protected int port;
-
- @Override
- public void setUp() throws Exception {
- port = AvailablePortFinder.getNextAvailable(22000);
-
- sshd = SshServer.setUpDefaultServer();
- sshd.setPort(port);
- sshd.setKeyPairProvider(new FileKeyPairProvider(new String[]{"src/test/resources/hostkey.pem"}));
- sshd.setCommandFactory(new TestEchoCommandFactory());
- sshd.setPasswordAuthenticator(new BogusPasswordAuthenticator());
- sshd.setPublickeyAuthenticator(new BogusPublickeyAuthenticator());
- sshd.start();
-
- super.setUp();
- }
-
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
-
- if (sshd != null) {
- sshd.stop(true);
- Thread.sleep(50);
- }
- }
-}
diff --git a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/TestEchoCommandFactory.java b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/TestEchoCommandFactory.java
deleted file mode 100644
index b8cac98..0000000
--- a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/TestEchoCommandFactory.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.ssh;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.sshd.server.Command;
-
-public class TestEchoCommandFactory extends EchoCommandFactory {
-
- @Override
- public Command createCommand(String command) {
- return new TestEchoCommand(command);
- }
-
- public static class TestEchoCommand extends EchoCommand {
- public static CountDownLatch latch = new CountDownLatch(1);
-
- public TestEchoCommand(String command) {
- super(command);
- }
-
- @Override
- public void destroy() {
- if (latch != null) {
- latch.countDown();
- }
- super.destroy();
- }
- }
-}
\ No newline at end of file
diff --git a/components/camel-ssh/src/test/resources/dsaprivkey.pem b/components/camel-ssh/src/test/resources/dsaprivkey.pem
deleted file mode 100644
index c920b7f..0000000
--- a/components/camel-ssh/src/test/resources/dsaprivkey.pem
+++ /dev/null
@@ -1,12 +0,0 @@
------BEGIN DSA PRIVATE KEY-----
-MIIBuwIBAAKBgQDEA7leYDKyJOFJU3h0uPpWN52iTpJk8+IM53Vc/91k7pBIjjka
-+MP24BMh+sI2SRhxg2AtvwnzRRBVJWzEA4+tuCI6WukgeDQtSNp3YuWzOMefZ6Wb
-SAk1Y4goZb7nyqV9HZSFNSqUFQRZM10L768VURBlerNqR//GqdVd8bp7lwIVAM39
-h6x2DeXbqUM8iOi01bh5jpLFAoGAEi1oFGFMEZXH/hCX+Y2VE5WvR+fBaoS9WuZl
-3E0wsWPzQhbL13yD+6Htxd3XoQvrHnzyrIgi2AiAmr3mLokQbZ3d92IxEBcNB/0p
-nVi020TXSeD/lWkpk5FRvgBiJ82/LeC2Lj6cssznX73aLUhR0tsSoJoXxas0sQKa
-/UJgq5wCgYAtgeY99J0JxplWGSyGY/1DUpgzhdgpLdDA/o/qIjBEeHXN0QX4Ajoa
-vHggJ2SwNtAxbQedBxqmB3mquFRtpfEP5zGzsVx5HHnljSH8u0SqEoLnYKFpluwh
-tZ/Q3F2NHslXw8Hw+pIaPe4PAINQPAu3U+BknNUkGpLg8zU6h5+B+wIVAKRqeps1
-Xl7MxZcSZp7FnmmmMecB
------END DSA PRIVATE KEY-----
diff --git a/components/camel-ssh/src/test/resources/hostkey.pem b/components/camel-ssh/src/test/resources/hostkey.pem
deleted file mode 100644
index 6b6974c..0000000
--- a/components/camel-ssh/src/test/resources/hostkey.pem
+++ /dev/null
@@ -1,15 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDdfIWeSV4o68dRrKSzFd/Bk51E65UTmmSrmW0O1ohtzi6HzsDP
-jXgCtlTt3FqTcfFfI92IlTr4JWqC9UK1QT1ZTeng0MkPQmv68hDANHbt5CpETZHj
-W5q4OOgWhVvj5IyOC2NZHtKlJBkdsMAa15ouOOJLzBvAvbqOR/yUROsEiQIDAQAB
-AoGBANG3JDW6NoP8rF/zXoeLgLCj+tfVUPSczhGFVrQkAk4mWfyRkhN0WlwHFOec
-K89MpkV1ij/XPVzU4MNbQ2yod1KiDylzvweYv+EaEhASCmYNs6LS03punml42SL9
-97tOmWfVJXxlQoLiY6jHPU97vTc65k8gL+gmmrpchsW0aqmZAkEA/c8zfmKvY37T
-cxcLLwzwsqqH7g2KZGTf9aRmx2ebdW+QKviJJhbdluDgl1TNNFj5vCLznFDRHiqJ
-wq0wkZ39cwJBAN9l5v3kdXj21UrurNPdlV0n2GZBt2vblooQC37XHF97r2zM7Ou+
-Lg6MyfJClyguhWL9dxnGbf3btQ0l3KDstxMCQCRaiEqjAfIjWVATzeNIXDWLHXso
-b1kf5cA+cwY+vdKdTy4IeUR+Y/DXdvPWDqpf0C11aCVMohdLCn5a5ikFUycCQDhV
-K/BuAallJNfmY7JxN87r00fF3ojWMJnT/fIYMFFrkQrwifXQWTDWE76BSDibsosJ
-u1TGksnm8zrDh2UVC/0CQFrHTiSl/3DHvWAbOJawGKg46cnlDcAhSyV8Frs8/dlP
-7YGG3eqkw++lsghqmFO6mRUTKsBmiiB2wgLGhL5pyYY=
------END RSA PRIVATE KEY-----
diff --git a/components/camel-ssh/src/test/resources/log4j.properties b/components/camel-ssh/src/test/resources/log4j.properties
deleted file mode 100644
index 3e45535..0000000
--- a/components/camel-ssh/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, out
-
-#log4j.logger.org.apache.camel.component.ssh=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.out=org.apache.log4j.FileAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.out.file=target/camel-ssh-test.log
-log4j.appender.out.append=true
diff --git a/components/camel-stax/pom.xml b/components/camel-stax/pom.xml
index aca95c3..e9a4abc 100644
--- a/components/camel-stax/pom.xml
+++ b/components/camel-stax/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-stax</artifactId>
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<!-- camel-jaxb is used for XPath testing -->
diff --git a/components/camel-stax/src/main/java/org/apache/camel/component/stax/StAXJAXBIteratorExpression.java b/components/camel-stax/src/main/java/org/apache/camel/component/stax/StAXJAXBIteratorExpression.java
index 01e9e2a..132de8d 100644
--- a/components/camel-stax/src/main/java/org/apache/camel/component/stax/StAXJAXBIteratorExpression.java
+++ b/components/camel-stax/src/main/java/org/apache/camel/component/stax/StAXJAXBIteratorExpression.java
@@ -21,6 +21,7 @@
import java.util.Iterator;
import java.util.Map;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.stream.XMLEventReader;
@@ -156,6 +157,7 @@
throw new UnsupportedOperationException();
}
+ @SuppressWarnings("unchecked")
T getNextElement() {
XMLEvent xmlEvent;
boolean found = false;
@@ -176,11 +178,18 @@
return null;
}
+ Object answer;
try {
- return unmarshaller.unmarshal(reader, clazz).getValue();
+ answer = unmarshaller.unmarshal(reader, clazz);
+ if (answer != null && answer.getClass() == JAXBElement.class) {
+ JAXBElement jbe = (JAXBElement) answer;
+ answer = jbe.getValue();
+ }
} catch (JAXBException e) {
throw new RuntimeCamelException(e);
}
+
+ return (T) answer;
}
@Override
diff --git a/components/camel-stream/pom.xml b/components/camel-stream/pom.xml
index a7a3e2d..41bd1bf 100644
--- a/components/camel-stream/pom.xml
+++ b/components/camel-stream/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/DefaultGroupStrategy.java b/components/camel-stream/src/main/java/org/apache/camel/component/stream/DefaultGroupStrategy.java
deleted file mode 100644
index abf9c48..0000000
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/DefaultGroupStrategy.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.stream;
-
-import java.util.List;
-
-
-public class DefaultGroupStrategy implements GroupStrategy {
-
- @Override
- public Object groupLines(List<String> lines) {
- return lines;
- }
-
-}
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/GroupStrategy.java b/components/camel-stream/src/main/java/org/apache/camel/component/stream/GroupStrategy.java
deleted file mode 100644
index 21096a7..0000000
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/GroupStrategy.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.stream;
-
-import java.util.List;
-
-public interface GroupStrategy {
-
- Object groupLines(List<String> lines);
-
-}
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
index 88ce478..115c44f 100644
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
+++ b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
@@ -38,7 +38,6 @@
import org.apache.camel.impl.DefaultMessage;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,7 +56,7 @@
private StreamEndpoint endpoint;
private String uri;
private boolean initialPromptDone;
- private final List<String> lines = new CopyOnWriteArrayList<String>();
+ private final List<Object> lines = new CopyOnWriteArrayList<Object>();
public StreamConsumer(StreamEndpoint endpoint, Processor processor, String uri) throws Exception {
super(endpoint, processor);
@@ -118,7 +117,7 @@
inputStreamToClose = inputStream;
}
Charset charset = endpoint.getCharset();
- return IOHelper.buffered(new InputStreamReader(inputStream, charset));
+ return new BufferedReader(new InputStreamReader(inputStream, charset));
}
private void readFromStream() throws Exception {
@@ -166,7 +165,7 @@
/**
* Strategy method for processing the line
*/
- protected synchronized void processLine(String line) throws Exception {
+ protected synchronized void processLine(Object line) throws Exception {
if (endpoint.getGroupLines() > 0) {
// remember line
lines.add(line);
@@ -178,8 +177,8 @@
// create message with the lines
Message msg = new DefaultMessage();
- List<String> copy = new ArrayList<String>(lines);
- msg.setBody(endpoint.getGroupStrategy().groupLines(copy));
+ List<Object> copy = new ArrayList<Object>(lines);
+ msg.setBody(copy);
exchange.setIn(msg);
// clear lines
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
index d7dfa94..7ba4bce 100644
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
+++ b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamEndpoint.java
@@ -41,7 +41,6 @@
private long initialPromptDelay = 2000;
private int groupLines;
private Charset charset;
- private GroupStrategy groupStrategy = new DefaultGroupStrategy();
public StreamEndpoint(String endpointUri, Component component) throws Exception {
super(endpointUri, component);
@@ -130,14 +129,6 @@
public void setScanStream(boolean scanStream) {
this.scanStream = scanStream;
}
-
- public GroupStrategy getGroupStrategy() {
- return groupStrategy;
- }
-
- public void setGroupStrategy(GroupStrategy strategy) {
- this.groupStrategy = strategy;
- }
public boolean isRetry() {
return retry;
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java
index 02fa686..c22a6ad 100644
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java
+++ b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamProducer.java
@@ -32,9 +32,7 @@
import org.apache.camel.CamelExchangeException;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -127,7 +125,7 @@
String s = exchange.getIn().getMandatoryBody(String.class);
Charset charset = endpoint.getCharset();
Writer writer = new OutputStreamWriter(outputStream, charset);
- BufferedWriter bw = IOHelper.buffered(writer);
+ BufferedWriter bw = new BufferedWriter(writer);
if (LOG.isDebugEnabled()) {
LOG.debug("Writing as text: {} to {} using encoding: {}", new Object[]{body, outputStream, charset});
}
diff --git a/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesStrategyTest.java b/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesStrategyTest.java
deleted file mode 100644
index c782cd0..0000000
--- a/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesStrategyTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.stream;
-
-import java.util.List;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-import org.junit.Test;
-
-public class StreamGroupLinesStrategyTest extends StreamGroupLinesTest {
-
- protected JndiRegistry createRegistry() throws Exception {
- JndiRegistry jndi = super.createRegistry();
- jndi.bind("myGroupStrategy", new MyGroupStrategy());
- return jndi;
- }
-
- class MyGroupStrategy implements GroupStrategy {
-
- @Override
- public Object groupLines(List<String> lines) {
- StringBuffer buffer = new StringBuffer();
- for (String line : lines) {
- buffer.append(line);
- buffer.append("\n");
- }
- return buffer.toString();
- }
- }
-
- @Test
- public void testGroupLines() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMessageCount(2);
-
- assertMockEndpointsSatisfied();
-
- Object result = mock.getExchanges().get(0).getIn().getBody();
- assertEquals("Get a wrong result.", "A\nB\nC\n", result);
-
-
- Object result2 = mock.getExchanges().get(1).getIn().getBody();
- assertEquals("Get a wrong result.", "D\nE\nF\n", result2);
-
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("stream:file?fileName=target/stream/streamfile.txt&groupLines=3&groupStrategy=#myGroupStrategy").to("mock:result");
- }
- };
- }
-
-}
diff --git a/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesTest.java b/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesTest.java
index ba7054f..f386229 100644
--- a/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesTest.java
+++ b/components/camel-stream/src/test/java/org/apache/camel/component/stream/StreamGroupLinesTest.java
@@ -63,13 +63,13 @@
assertMockEndpointsSatisfied();
- List<?> list = mock.getExchanges().get(0).getIn().getBody(List.class);
+ List list = mock.getExchanges().get(0).getIn().getBody(List.class);
assertEquals(3, list.size());
assertEquals("A", list.get(0));
assertEquals("B", list.get(1));
assertEquals("C", list.get(2));
- List<?> list2 = mock.getExchanges().get(1).getIn().getBody(List.class);
+ List list2 = mock.getExchanges().get(1).getIn().getBody(List.class);
assertEquals(3, list2.size());
assertEquals("D", list2.get(0));
assertEquals("E", list2.get(1));
diff --git a/components/camel-stringtemplate/pom.xml b/components/camel-stringtemplate/pom.xml
index 29c09e7..0063562 100644
--- a/components/camel-stringtemplate/pom.xml
+++ b/components/camel-stringtemplate/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-syslog/pom.xml b/components/camel-syslog/pom.xml
index 0841856..8184ebc 100644
--- a/components/camel-syslog/pom.xml
+++ b/components/camel-syslog/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -44,7 +44,12 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-tagsoup/pom.xml b/components/camel-tagsoup/pom.xml
index f4bd74b..8e14263 100644
--- a/components/camel-tagsoup/pom.xml
+++ b/components/camel-tagsoup/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupTestSupport.java b/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupTestSupport.java
index 73fa126..4cbc9a2 100644
--- a/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupTestSupport.java
+++ b/components/camel-tagsoup/src/test/java/org/apache/camel/dataformat/tagsoup/TidyMarkupTestSupport.java
@@ -31,8 +31,6 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import org.apache.camel.util.IOHelper;
-
public final class TidyMarkupTestSupport {
private TidyMarkupTestSupport() {
@@ -41,7 +39,7 @@
public static String loadFileAsString(File file) throws Exception {
StringBuilder fileContent = new StringBuilder();
- BufferedReader input = IOHelper.buffered(new FileReader(file));
+ BufferedReader input = new BufferedReader(new FileReader(file));
try {
String line = null;
while ((line = input.readLine()) != null) {
diff --git a/components/camel-test-blueprint/pom.xml b/components/camel-test-blueprint/pom.xml
deleted file mode 100644
index 9f4efa1..0000000
--- a/components/camel-test-blueprint/pom.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-test-blueprint</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Test Blueprint</name>
- <description>Camel Testing Blueprint Library using JUnit</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.test.blueprint*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-blueprint</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.aries.blueprint</groupId>
- <artifactId>org.apache.aries.blueprint</artifactId>
- <version>${aries-blueprint-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.aries</groupId>
- <artifactId>org.apache.aries.util</artifactId>
- <version>${aries-blueprint-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.proxy</groupId>
- <artifactId>org.apache.aries.proxy.impl</artifactId>
- <version>${aries-blueprint-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.proxy</groupId>
- <artifactId>org.apache.aries.proxy.api</artifactId>
- <version>${aries-blueprint-version}</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.pojosr</groupId>
- <artifactId>de.kalpatec.pojosr.framework</artifactId>
- <version>${pojosr-version}</version>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.swissbox</groupId>
- <artifactId>pax-swissbox-tinybundles</artifactId>
- <version>${pax-tiny-bundle-version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <!-- optional dependencies for running tests -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${slf4j-version}</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <!-- TODO: use per test fork mode as otherwise this component fails -->
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>pertest</forkMode>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
deleted file mode 100644
index 84b0aa8..0000000
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.blueprint;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.JarInputStream;
-
-import de.kalpatec.pojosr.framework.PojoServiceRegistryFactoryImpl;
-import de.kalpatec.pojosr.framework.launch.BundleDescriptor;
-import de.kalpatec.pojosr.framework.launch.ClasspathScanner;
-import de.kalpatec.pojosr.framework.launch.PojoServiceRegistry;
-import de.kalpatec.pojosr.framework.launch.PojoServiceRegistryFactory;
-import org.apache.camel.CamelContext;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.junit.After;
-import org.junit.Before;
-import org.ops4j.pax.swissbox.tinybundles.core.TinyBundle;
-import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Base class for OSGi Blueprint unit tests with Camel.
- */
-public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
-
- public static final long DEFAULT_TIMEOUT = 30000;
-
- private BundleContext bundleContext;
-
- @Before
- @Override
- public void setUp() throws Exception {
- deleteDirectory("target/test-bundle");
- createDirectory("target/test-bundle");
-
- // ensure pojosr stores bundles in an unique target directory
- System.setProperty("org.osgi.framework.storage", "target/bundles/" + System.currentTimeMillis());
- List<BundleDescriptor> bundles = getBundleDescriptors();
- TinyBundle bundle = createTestBundle();
- bundles.add(getBundleDescriptor("target/test-bundle/test-bundle.jar", bundle));
- Map<String, List<BundleDescriptor>> config = new HashMap<String, List<BundleDescriptor>>();
- config.put(PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS, bundles);
- PojoServiceRegistry reg = new PojoServiceRegistryFactoryImpl().newPojoServiceRegistry(config);
- bundleContext = reg.getBundleContext();
-
- super.setUp();
- }
-
- @After
- @Override
- public void tearDown() throws Exception {
- super.tearDown();
- bundleContext.getBundle().stop();
- System.clearProperty("org.osgi.framework.storage");
- }
-
- protected TinyBundle createTestBundle() throws FileNotFoundException {
- TinyBundle bundle = TinyBundles.newBundle();
- for (URL url : getBlueprintDescriptors()) {
- bundle.add("OSGI-INF/blueprint/blueprint-" + url.getFile().replace("/", "-"), url);
- }
- bundle.set("Manifest-Version", "2")
- .set("Bundle-ManifestVersion", "2")
- .set("Bundle-SymbolicName", "test-bundle")
- .set("Bundle-Version", "0.0.0");
- return bundle;
- }
-
- /**
- * Gets list of bundle descriptors. Modify this method if you wish to change
- * default behavior.
- *
- * @return List pointers to OSGi bundles.
- * @throws Exception If looking up the bundles fails.
- */
- protected List<BundleDescriptor> getBundleDescriptors() throws Exception {
- return new ClasspathScanner().scanForBundles("(Bundle-SymbolicName=*)");
- }
-
- /**
- * Gets the bundle descriptors as {@link URL} resources.
- * <p/>
- * It is preferred to override the {@link #getBlueprintDescriptor()} method, and return the
- * location as a String, which is easier to deal with than a {@link Collection} type.
- *
- * @return the bundle descriptors.
- * @throws FileNotFoundException is thrown if a bundle descriptor cannot be found
- */
- protected Collection<URL> getBlueprintDescriptors() throws FileNotFoundException {
- List<URL> answer = new ArrayList<URL>();
- String descriptor = getBlueprintDescriptor();
- if (descriptor != null) {
- // there may be more resources separated by comma
- Iterator<Object> it = ObjectHelper.createIterator(descriptor);
- while (it.hasNext()) {
- String s = (String) it.next();
- // remove leading / to be able to load resource from the classpath
- s = FileUtil.stripLeadingSeparator(s);
- URL url = ObjectHelper.loadResourceAsURL(s);
- if (url == null) {
- throw new FileNotFoundException("Resource " + s + " not found in classpath");
- }
- answer.add(url);
- }
- return answer;
- } else {
- throw new IllegalArgumentException("No bundle descriptor configured. Override getBlueprintDescriptor() or getBlueprintDescriptors() method");
- }
- }
-
- /**
- * Gets the bundle descriptor from the classpath.
- * <p/>
- * Return the location(s) of the bundle descriptors from the classpath.
- * Separate multiple locations by comma, or return a single location.
- * <p/>
- * For example override this method and return <tt>OSGI-INF/blueprint/camel-context.xml</tt>
- *
- * @return the location of the bundle descriptor file.
- */
- protected String getBlueprintDescriptor() {
- return null;
- }
-
- @Override
- protected CamelContext createCamelContext() throws Exception {
- return getOsgiService(CamelContext.class);
- }
-
- protected <T> T getOsgiService(Class<T> type, long timeout) {
- return getOsgiService(type, null, timeout);
- }
-
- protected <T> T getOsgiService(Class<T> type) {
- return getOsgiService(type, null, DEFAULT_TIMEOUT);
- }
-
- protected <T> T getOsgiService(Class<T> type, String filter) {
- return getOsgiService(type, filter, DEFAULT_TIMEOUT);
- }
-
- protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
- ServiceTracker tracker = null;
- try {
- String flt;
- if (filter != null) {
- if (filter.startsWith("(")) {
- flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")";
- } else {
- flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))";
- }
- } else {
- flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
- }
- Filter osgiFilter = FrameworkUtil.createFilter(flt);
- tracker = new ServiceTracker(bundleContext, osgiFilter, null);
- tracker.open(true);
- // Note that the tracker is not closed to keep the reference
- // This is buggy, as the service reference may change i think
- Object svc = tracker.waitForService(timeout);
- if (svc == null) {
- Dictionary<?, ?> dic = bundleContext.getBundle().getHeaders();
- System.err.println("Test bundle headers: " + explode(dic));
-
- for (ServiceReference<?> ref : asCollection(bundleContext.getAllServiceReferences(null, null))) {
- System.err.println("ServiceReference: " + ref);
- }
-
- for (ServiceReference<?> ref : asCollection(bundleContext.getAllServiceReferences(null, flt))) {
- System.err.println("Filtered ServiceReference: " + ref);
- }
-
- throw new RuntimeException("Gave up waiting for service " + flt);
- }
- return type.cast(svc);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException("Invalid filter", e);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Explode the dictionary into a <code>,</code> delimited list of <code>key=value</code> pairs.
- */
- private static String explode(Dictionary<?, ?> dictionary) {
- Enumeration<?> keys = dictionary.keys();
- StringBuffer result = new StringBuffer();
- while (keys.hasMoreElements()) {
- Object key = keys.nextElement();
- result.append(String.format("%s=%s", key, dictionary.get(key)));
- if (keys.hasMoreElements()) {
- result.append(", ");
- }
- }
- return result.toString();
- }
-
- /**
- * Provides an iterable collection of references, even if the original array is <code>null</code>.
- */
- private static Collection<ServiceReference<?>> asCollection(ServiceReference<?>[] references) {
- return references == null ? new ArrayList<ServiceReference<?>>(0) : Arrays.asList(references);
- }
-
- private BundleDescriptor getBundleDescriptor(String path, TinyBundle bundle) throws Exception {
- File file = new File(path);
- FileOutputStream fos = new FileOutputStream(file, true);
- IOHelper.copy(bundle.build(), fos);
- IOHelper.close(fos);
-
- FileInputStream fis = new FileInputStream(file);
- JarInputStream jis = new JarInputStream(fis);
- Map<String, String> headers = new HashMap<String, String>();
- for (Map.Entry<Object, Object> entry : jis.getManifest().getMainAttributes().entrySet()) {
- headers.put(entry.getKey().toString(), entry.getValue().toString());
- }
-
- IOHelper.close(fis, jis);
-
- return new BundleDescriptor(
- getClass().getClassLoader(),
- new URL("jar:" + file.toURI().toString() + "!/"),
- headers);
- }
-
-}
-
-
diff --git a/components/camel-test-blueprint/src/main/resources/META-INF/LICENSE.txt b/components/camel-test-blueprint/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 614c632..0000000
--- a/components/camel-test-blueprint/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed 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.
-
diff --git a/components/camel-test-blueprint/src/main/resources/META-INF/NOTICE.txt b/components/camel-test-blueprint/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 741cb00..0000000
--- a/components/camel-test-blueprint/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-=========================================================================
-== NOTICE file corresponding to the section 4 d of ==
-== the Apache License, Version 2.0, ==
-== in this case for the Apache Camel distribution. ==
-=========================================================================
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-Please read the different LICENSE files present in the licenses directory of
-this distribution.
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java
deleted file mode 100644
index 89421a4..0000000
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.blueprint;
-
-import org.junit.Test;
-
-// START SNIPPET: example
-// to use camel-test-blueprint, then extend the CamelBlueprintTestSupport class,
-// and add your unit tests methods as shown below.
-public class DebugBlueprintTest extends CamelBlueprintTestSupport {
-
- // override this method, and return the location of our Blueprint XML file to be used for testing
- @Override
- protected String getBlueprintDescriptor() {
- return "org/apache/camel/test/blueprint/camelContext.xml";
- }
-
- // here we have regular Junit @Test method
- @Test
- public void testRoute() throws Exception {
- // set mock expectations
- getMockEndpoint("mock:a").expectedMessageCount(1);
-
- // send a message
- template.sendBody("direct:start", "World");
-
- // assert mocks
- assertMockEndpointsSatisfied();
- }
-
-}
-// END SNIPPET: example
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/FilterTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/FilterTest.java
deleted file mode 100644
index a8764dd..0000000
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/FilterTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.blueprint;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Produce;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-
-/**
- * Tests filtering using Camel Blueprint Test
- *
- */
-// START SNIPPET: example
-public class FilterTest extends CamelBlueprintTestSupport {
-
- @EndpointInject(uri = "mock:result")
- protected MockEndpoint resultEndpoint;
-
- @Produce(uri = "direct:start")
- protected ProducerTemplate template;
-
- @Override
- protected String getBlueprintDescriptor() {
- return "org/apache/camel/test/blueprint/filterTest.xml";
- }
-
- @Test
- public void testSendMatchingMessage() throws Exception {
- String expectedBody = "<matched/>";
-
- resultEndpoint.expectedBodiesReceived(expectedBody);
-
- template.sendBodyAndHeader(expectedBody, "foo", "bar");
-
- resultEndpoint.assertIsSatisfied();
- }
-
- @Test
- public void testSendNotMatchingMessage() throws Exception {
- resultEndpoint.expectedMessageCount(0);
-
- template.sendBodyAndHeader("<notMatched/>", "foo", "notMatchedHeaderValue");
-
- resultEndpoint.assertIsSatisfied();
- }
-}
-// END SNIPPET: example
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java
deleted file mode 100644
index 4afbaf8..0000000
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/management/ManagedNamePatternFixedTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.blueprint.management;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
-import org.junit.Test;
-
-public class ManagedNamePatternFixedTest extends CamelBlueprintTestSupport {
-
- @Override
- protected String getBlueprintDescriptor() {
- return "org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml";
- }
-
- @Test
- public void testManagedNamePattern() throws Exception {
- getMockEndpoint("mock:result").expectedMessageCount(1);
- template.sendBody("direct:start", "World");
- assertMockEndpointsSatisfied();
-
- MBeanServer mbeanServer = context.getManagementStrategy().getManagementAgent().getMBeanServer();
-
- assertEquals("cool", context.getManagementName());
-
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + context.getManagementName()
- + ",type=context,name=\"" + context.getName() + "\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
- }
-
-}
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java
deleted file mode 100644
index 23f43aa..0000000
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/xpath/XPathFilterWithNamespaceTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.blueprint.xpath;
-
-import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
-import org.junit.Test;
-
-public class XPathFilterWithNamespaceTest extends CamelBlueprintTestSupport {
-
- protected String matchingBody = "<person name='James' city='London' xmlns='http://example.com/person'/>";
- protected String notMatchingBody = "<person name='Hiram' city='Tampa' xmlns='http://example.com/person'/>";
-
- @Override
- protected String getBlueprintDescriptor() {
- return "org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml";
- }
-
- @Test
- public void testSendMatchingMessage() throws Exception {
- getMockEndpoint("mock:result").expectedBodiesReceived(matchingBody);
-
- sendBody("direct:start", matchingBody);
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testSendNotMatchingMessage() throws Exception {
- getMockEndpoint("mock:result").expectedMessageCount(0);
-
- sendBody("direct:start", notMatchingBody);
-
- assertMockEndpointsSatisfied();
- }
-
-}
diff --git a/components/camel-test-blueprint/src/test/resources/log4j.properties b/components/camel-test-blueprint/src/test/resources/log4j.properties
deleted file mode 100644
index a37186b..0000000
--- a/components/camel-test-blueprint/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,42 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used for testing
-#
-log4j.rootLogger=INFO, file
-
-log4j.logger.org.springframework=WARN
-#log4j.logger.org.apache.camel=DEBUG
-#log4j.logger.org.apache.camel.management=DEBUG
-#log4j.logger.org.apache.camel.test.junit4=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-# MDC
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{breadcrumbId} - %-10.10X{exchangeId} - %-10.10X{correlationId} - %-10.10X{routeId} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.file=target/camel-test-blueprint.log
-log4j.appender.file.append=true
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-# MDC
-#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{breadcrumbId} - %-10.10X{exchangeId} - %-10.10X{correlationId} - %-10.10X{routeId} - %m%n
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml
deleted file mode 100644
index 291f120..0000000
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<!-- START SNIPPET: example -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <camelContext xmlns="http://camel.apache.org/schema/blueprint">
-
- <route>
- <from uri="direct:start"/>
- <transform>
- <simple>Hello ${body}</simple>
- </transform>
- <to uri="mock:a"/>
- </route>
-
- </camelContext>
-
-</blueprint>
-<!-- END SNIPPET: example -->
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/filterTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/filterTest.xml
deleted file mode 100644
index f469081..0000000
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/filterTest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?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.
--->
-<!-- START SNIPPET: example -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <camelContext xmlns="http://camel.apache.org/schema/blueprint">
-
- <route>
- <from uri="direct:start"/>
- <filter>
- <simple>${header.foo} == 'bar'</simple>
- <to uri="mock:result"/>
- </filter>
- </route>
-
- </camelContext>
-
-</blueprint>
-<!-- END SNIPPET: example -->
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml
deleted file mode 100644
index 342ed5f..0000000
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/management/managedNamePatternFixedTest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <bean id="naming" class="org.apache.camel.management.DefaultManagementNamingStrategy">
- <property name="hostName" value="localhost"/>
- <property name="domainName" value="org.apache.camel"/>
- </bean>
-
- <!-- START SNIPPET: example -->
- <camelContext managementNamePattern="cool" xmlns="http://camel.apache.org/schema/blueprint">
- <jmxAgent id="agent"/>
-
- <route>
- <from uri="direct:start"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
-
-</blueprint>
\ No newline at end of file
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml
deleted file mode 100644
index 24ce2e3..0000000
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/xpath/xpathFilterWithNamespaceTest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:foo="http://example.com/person"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <camelContext xmlns="http://camel.apache.org/schema/blueprint">
- <route>
- <from uri="direct:start"/>
- <filter>
- <xpath logNamespaces="true">/foo:person[@name='James']</xpath>
- <to uri="mock:result"/>
- </filter>
- </route>
- </camelContext>
-
-</blueprint>
\ No newline at end of file
diff --git a/components/camel-test-spring/pom.xml b/components/camel-test-spring/pom.xml
deleted file mode 100644
index f888dac..0000000
--- a/components/camel-test-spring/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-test-spring</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Test :: Spring</name>
- <description>Camel Testing Library using JUnit and Spring</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.test.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- </dependency>
-
- <!-- optional dependencies for running tests -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- </dependency>
-
- </dependencies>
-
-</project>
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/ExcludingPackageScanClassResolver.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/ExcludingPackageScanClassResolver.java
deleted file mode 100644
index 452592f..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/ExcludingPackageScanClassResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.apache.camel.impl.DefaultPackageScanClassResolver;
-import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
-import org.apache.camel.impl.scan.InvertingPackageScanFilter;
-
-public class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver {
-
- public void setExcludedClasses(Set<Class<?>> excludedClasses) {
- Set<Class<?>> parents = excludedClasses == null ? Collections.<Class<?>>emptySet() : excludedClasses;
- addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(parents)));
- }
-
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunner.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunner.java
deleted file mode 100644
index 8566b30..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunner.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import org.apache.camel.test.CamelSpringTestSupport;
-import org.apache.camel.test.spring.CamelSpringTestContextLoader;
-import org.apache.camel.test.spring.CamelSpringTestContextLoaderTestExecutionListener;
-import org.apache.camel.test.spring.DisableJmxTestExecutionListener;
-import org.apache.camel.test.spring.StopWatchTestExecutionListener;
-import org.junit.runners.model.InitializationError;
-import org.springframework.test.context.TestContextManager;
-import org.springframework.test.context.TestExecutionListener;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-/**
- * An implementation bringing the functionality of {@link CamelSpringTestSupport} to
- * Spring Test based test cases. This approach allows developers to implement tests
- * for their Spring based applications/routes using the typical Spring Test conventions
- * for test development.
- */
-public class CamelSpringJUnit4ClassRunner extends
- SpringJUnit4ClassRunner {
-
- public CamelSpringJUnit4ClassRunner(Class<?> clazz)
- throws InitializationError {
-
- super(clazz);
- }
-
- /**
- * Returns the specialized manager instance that provides tight integration between Camel testing
- * features and Spring.
- *
- * @return a new instance of {@link CamelTestContextManager}.
- */
- @Override
- protected TestContextManager createTestContextManager(Class<?> clazz) {
- return new CamelTestContextManager(clazz, getDefaultContextLoaderClassName(clazz));
- }
-
- /**
- * Returns the specialized loader for tight integration between Camel testing features
- * and the application context initialization.
- *
- * @return Returns the class name for {@link CamelSpringTestContextLoader}
- */
- @Override
- protected String getDefaultContextLoaderClassName(Class<?> clazz) {
- return CamelSpringTestContextLoader.class.getName();
- }
-
- /**
- * An implementation providing additional integration between Spring Test and Camel
- * testing features.
- */
- public static final class CamelTestContextManager extends TestContextManager {
-
- public CamelTestContextManager(Class<?> testClass,
- String defaultContextLoaderClassName) {
- super(testClass, defaultContextLoaderClassName);
- }
-
- /**
- * Augments the default listeners with additional listeners to provide support
- * for the Camel testing features.
- */
- @Override
- protected Set<Class<? extends TestExecutionListener>>
- getDefaultTestExecutionListenerClasses() {
-
- Set<Class<? extends TestExecutionListener>> classes =
- new LinkedHashSet<Class<? extends TestExecutionListener>>();
-
- classes.add(CamelSpringTestContextLoaderTestExecutionListener.class);
-
- classes.addAll(super.getDefaultTestExecutionListenerClasses());
-
- classes.add(DisableJmxTestExecutionListener.class);
- classes.add(StopWatchTestExecutionListener.class);
- return classes;
- }
- }
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
deleted file mode 100644
index abf70e3..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.impl.DefaultDebugger;
-import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
-import org.apache.camel.management.JmxSystemPropertyKeys;
-import org.apache.camel.spi.Breakpoint;
-import org.apache.camel.spi.Debugger;
-import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.test.ExcludingPackageScanClassResolver;
-import org.apache.camel.test.spring.CamelSpringTestHelper.DoToSpringCamelContextsStrategy;
-import org.apache.camel.util.CastUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.AnnotationConfigUtils;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.annotation.AnnotationUtils;
-import org.springframework.test.context.support.AbstractContextLoader;
-import org.springframework.test.context.support.AbstractGenericContextLoader;
-import org.springframework.test.context.support.GenericXmlContextLoader;
-import org.springframework.util.StringUtils;
-
-/**
- * Replacement for the default {@link GenericXmlContextLoader} that provides hooks for
- * processing some class level Camel related test annotations.
- */
-public class CamelSpringTestContextLoader extends
- AbstractContextLoader {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(CamelSpringTestContextLoader.class);
-
- /**
- * Modeled after the Spring implementation in {@link AbstractGenericContextLoader},
- * this method creates and refreshes the application context while providing for
- * processing of additional Camel specific post-refresh actions. We do not provide the
- * pre-post hooks for customization seen in {@link AbstractGenericContextLoader} because
- * they probably are unnecessary for 90+% of users.
- * <p/>
- * For some functionality, we cannot use {@link TestExecutionListener} because we need
- * to both produce the desired outcome during application context loading, and also cleanup
- * after ourselves even if the test class never executes. Thus the listeners, which
- * only run if the application context is successfully initialized are insufficient to
- * provide the behavior described above.
- */
- @Override
- public ApplicationContext loadContext(String... locations) throws Exception {
-
- Class<?> testClass = getTestClass();
-
- try {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Loading ApplicationContext for locations ["
- + StringUtils.arrayToCommaDelimitedString(locations) + "].");
- }
-
- GenericApplicationContext context = createContext(testClass);
- (new XmlBeanDefinitionReader(context)).loadBeanDefinitions(locations);
- AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
-
- // Pre CamelContext(s) instantiation setup
- handleDisableJmx(context, testClass);
-
- // Temporarily disable CamelContext start while the contexts are instantiated.
- SpringCamelContext.setNoStart(true);
- context.refresh();
- context.registerShutdownHook();
- // Turn CamelContext startup back on since the context's have now been instantiated.
- SpringCamelContext.setNoStart(false);
-
- // Post CamelContext(s) instantiation but pre CamelContext(s) start setup
- handleProvidesBreakpoint(context, testClass);
- handleShutdownTimeout(context, testClass);
- handleMockEndpoints(context, testClass);
- handleLazyLoadTypeConverters(context, testClass);
-
- // CamelContext(s) startup
- handleCamelContextStartup(context, testClass);
-
- return context;
- } finally {
- SpringCamelContext.setNoStart(false);
-
- if (testClass.isAnnotationPresent(DisableJmx.class)) {
- if (CamelSpringTestHelper.getOriginalJmxDisabled() == null) {
- System.clearProperty(JmxSystemPropertyKeys.DISABLED);
- } else {
- System.setProperty(JmxSystemPropertyKeys.DISABLED,
- CamelSpringTestHelper.getOriginalJmxDisabled());
- }
- }
- }
- }
-
- /**
- * Returns "<code>-context.xml</code>".
- */
- @Override
- public String getResourceSuffix() {
- return "-context.xml";
- }
-
- /**
- * Returns all methods defined in {@code clazz} and its superclasses/interfaces.
- */
- protected Collection<Method> getAllMethods(Class<?> clazz) {
-
- Set<Method> methods = new HashSet<Method>();
- Class<?> currentClass = clazz;
-
- while (currentClass != null) {
- methods.addAll(Arrays.asList(clazz.getMethods()));
- currentClass = currentClass.getSuperclass();
- }
-
- return methods;
- }
-
- /**
- * Creates and starts the Spring context while optionally starting any loaded Camel contexts.
- *
- * @param testClass the test class that is being executed
- *
- * @return the loaded Spring context
- */
- protected GenericApplicationContext createContext(Class<?> testClass) {
-
- GenericApplicationContext routeExcludingContext = null;
-
- if (testClass.isAnnotationPresent(ExcludeRoutes.class)) {
- Class<?>[] excludedClasses = testClass.getAnnotation(
- ExcludeRoutes.class).value();
-
- if (excludedClasses.length > 0) {
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Setting up package scanning excluded classes as ExcludeRoutes "
- + "annotation was found. Excluding ["
- + StringUtils.arrayToCommaDelimitedString(excludedClasses) + "].");
- }
-
- routeExcludingContext = new GenericApplicationContext();
- routeExcludingContext.registerBeanDefinition(
- "excludingResolver", new RootBeanDefinition(
- ExcludingPackageScanClassResolver.class));
- routeExcludingContext.refresh();
-
- ExcludingPackageScanClassResolver excludingResolver = routeExcludingContext.getBean("excludingResolver", ExcludingPackageScanClassResolver.class);
- List<Class<?>> excluded = CastUtils.cast(Arrays.asList(excludedClasses));
- excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded));
- } else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Not enabling package scanning excluded classes as ExcludeRoutes "
- + "annotation was found but no classes were excluded.");
- }
- }
- }
-
- GenericApplicationContext context;
-
- if (routeExcludingContext != null) {
- context = new GenericApplicationContext(routeExcludingContext);
- } else {
- context = new GenericApplicationContext();
- }
-
- return context;
- }
-
- /**
- * Handles disabling of JMX on Camel contexts based on {@link DisableJmx}.
- *
- * @param context the initialized Spring context
- * @param testClass the test class being executed
- */
- protected void handleDisableJmx(GenericApplicationContext context, Class<?> testClass) {
- CamelSpringTestHelper.setOriginalJmxDisabledValue(
- System.getProperty(JmxSystemPropertyKeys.DISABLED));
-
- if (testClass.isAnnotationPresent(DisableJmx.class)) {
- if (testClass.getAnnotation(DisableJmx.class).value()) {
- LOG.info("Disabling Camel JMX globally as DisableJmx annotation was found "
- + "and disableJmx is set to true.");
-
- System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
-
- } else {
- LOG.info("Enabling Camel JMX as DisableJmx annotation was found "
- + "and disableJmx is set to false.");
-
- System.clearProperty(JmxSystemPropertyKeys.DISABLED);
- }
- } else {
- LOG.info("Disabling Camel JMX globally for tests by default. Use the DisableJMX annotation to "
- + "override the default setting.");
-
- System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
- }
- }
-
- /**
- * Handles the processing of the {@link ProvidesBreakpoint} annotation on a test class. Exists here
- * as it is needed in
- *
- * @param context the initialized Spring context containing the Camel context(s) to insert breakpoints into
- * @param testClass the test class being processed
- * @param log the logger to use
- * @param statics if static methods or instance methods should be processed
- *
- * @throws Exception if there is an error processing the class
- */
- protected void handleProvidesBreakpoint(GenericApplicationContext context, Class<?> testClass) throws Exception {
-
- Collection<Method> methods = getAllMethods(testClass);
- final List<Breakpoint> breakpoints = new LinkedList<Breakpoint>();
-
- for (Method method : methods) {
-
- if (AnnotationUtils.findAnnotation(method, ProvidesBreakpoint.class) != null) {
- Class<?>[] argTypes = method.getParameterTypes();
- if (argTypes.length != 0) {
- throw new IllegalArgumentException("Method [" + method.getName()
- + "] is annotated with ProvidesBreakpoint but is not a no-argument method.");
- } else if (!Breakpoint.class.isAssignableFrom(method.getReturnType())) {
- throw new IllegalArgumentException("Method [" + method.getName()
- + "] is annotated with ProvidesBreakpoint but does not return a Breakpoint.");
- } else if (!Modifier.isStatic(method.getModifiers())) {
- throw new IllegalArgumentException("Method [" + method.getName()
- + "] is annotated with ProvidesBreakpoint but is not static.");
- } else if (!Modifier.isPublic(method.getModifiers())) {
- throw new IllegalArgumentException("Method [" + method.getName()
- + "] is annotated with ProvidesBreakpoint but is not public.");
- }
-
- try {
- breakpoints.add((Breakpoint) method.invoke(null, new Object[] {}));
- } catch (Exception e) {
- throw new RuntimeException("Method [" + method.getName()
- + "] threw exception during evaluation.", e);
- }
- }
- }
-
- if (breakpoints.size() != 0) {
-
- CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-
- @Override
- public void execute(String contextName, SpringCamelContext camelContext)
- throws Exception {
-
- Debugger debugger = camelContext.getDebugger();
- if (debugger == null) {
- debugger = new DefaultDebugger();
- camelContext.setDebugger(debugger);
- }
-
- for (Breakpoint breakpoint : breakpoints) {
- LOG.info(
- "Adding Breakpoint [{}] to CamelContext with name [{}].",
- breakpoint, contextName);
-
- debugger.addBreakpoint(breakpoint);
- }
- }
- });
- }
- }
-
-
- /**
- * Handles updating shutdown timeouts on Camel contexts based on {@link ShutdownTimeout}.
- *
- * @param context the initialized Spring context
- * @param testClass the test class being executed
- */
- protected void handleShutdownTimeout(GenericApplicationContext context, Class<?> testClass) throws Exception {
-
- final int shutdownTimeout;
- final TimeUnit shutdownTimeUnit;
- if (testClass.isAnnotationPresent(ShutdownTimeout.class)) {
- shutdownTimeout = testClass.getAnnotation(ShutdownTimeout.class).value();
- shutdownTimeUnit = testClass.getAnnotation(ShutdownTimeout.class).timeUnit();
- } else {
- shutdownTimeout = 10;
- shutdownTimeUnit = TimeUnit.SECONDS;
- }
-
- CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-
- @Override
- public void execute(String contextName, SpringCamelContext camelContext)
- throws Exception {
-
- LOG.info(
- "Setting shutdown timeout to [{} {}] on CamelContext with name [{}].",
- new Object[] {shutdownTimeout, shutdownTimeUnit, contextName});
- camelContext.getShutdownStrategy().setTimeout(shutdownTimeout);
- camelContext.getShutdownStrategy().setTimeUnit(shutdownTimeUnit);
- }
- });
- }
-
- /**
- * Handles auto-intercepting of endpoints with mocks based on {@link MockEndpoints}.
- *
- * @param context the initialized Spring context
- * @param testClass the test class being executed
- */
- protected void handleMockEndpoints(GenericApplicationContext context, Class<?> testClass) throws Exception {
- if (testClass.isAnnotationPresent(MockEndpoints.class)) {
-
- final String mockEndpoints = testClass.getAnnotation(
- MockEndpoints.class).value();
- CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-
- @Override
- public void execute(String contextName, SpringCamelContext camelContext)
- throws Exception {
-
- LOG.info("Enabling auto mocking of endpoints matching pattern [{}] on "
- + "CamelContext with name [{}].", mockEndpoints, contextName);
- camelContext.addRegisterEndpointCallback(
- new InterceptSendToMockEndpointStrategy(mockEndpoints));
- }
- });
- }
- }
-
- @SuppressWarnings("deprecation")
- protected void handleLazyLoadTypeConverters(GenericApplicationContext context, Class<?> testClass) throws Exception {
- final boolean lazy;
-
- if (testClass.isAnnotationPresent(LazyLoadTypeConverters.class)) {
- lazy = testClass.getAnnotation(LazyLoadTypeConverters.class).value();
- } else {
- lazy = true;
- }
-
- if (lazy) {
- CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-
- @Override
- public void execute(String contextName, SpringCamelContext camelContext)
- throws Exception {
-
- LOG.info("Enabling lazy loading of type converters on "
- + "CamelContext with name [{}].", contextName);
- camelContext.setLazyLoadTypeConverters(lazy);
- }
- });
- }
- }
-
- /**
- * Handles starting of Camel contexts based on {@link UseAdviceWith} and other state in the JVM.
- *
- * @param context the initialized Spring context
- * @param testClass the test class being executed
- */
- protected void handleCamelContextStartup(GenericApplicationContext context, Class<?> testClass) throws Exception {
- boolean skip = "true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"));
- if (skip) {
- LOG.info("Skipping starting CamelContext(s) as system property "
- + "skipStartingCamelContext is set to be true.");
- } else if (testClass.isAnnotationPresent(UseAdviceWith.class)) {
- if (testClass.getAnnotation(UseAdviceWith.class).value()) {
- LOG.info("Skipping starting CamelContext(s) as UseAdviceWith annotation was found "
- + "and isUseAdviceWith is set to true.");
- skip = true;
- } else {
- LOG.info("Starting CamelContext(s) as UseAdviceWith annotation was found, but "
- + "isUseAdviceWith is set to false.");
- skip = false;
- }
- }
-
- if (!skip) {
- CamelSpringTestHelper.doToSpringCamelContexts(context, new DoToSpringCamelContextsStrategy() {
-
- @Override
- public void execute(String contextName,
- SpringCamelContext camelContext) throws Exception {
- LOG.info("Starting CamelContext with name [{}].", contextName);
- camelContext.start();
- }
- });
- }
- }
-
- /**
- * Returns the class under test in order to enable inspection of annotations while the
- * Spring context is being created.
- *
- * @return the test class that is being executed
- * @see CamelSpringTestHelper
- */
- protected Class<?> getTestClass() {
- return CamelSpringTestHelper.getTestClass();
- }
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java
deleted file mode 100644
index ed594f6..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoaderTestExecutionListener.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import org.springframework.test.context.TestContext;
-import org.springframework.test.context.support.AbstractTestExecutionListener;
-
-/**
- * Helper for {@link CamelSpringTestContextLoader} that sets the test class state
- * in {@link CamelSpringTestHelper} almost immediately before the loader initializes
- * the Spring context.
- * <p/>
- * Implemented as a listener as the state can be set on a {@code ThreadLocal} and we are pretty sure
- * that the same thread will be used to initialize the Spring context.
- */
-public class CamelSpringTestContextLoaderTestExecutionListener
- extends AbstractTestExecutionListener {
-
- @Override
- public void prepareTestInstance(TestContext testContext) throws Exception {
- CamelSpringTestHelper.setTestClass(testContext.getTestClass());
- }
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java
deleted file mode 100644
index cd45178..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.camel.spring.SpringCamelContext;
-
-import org.springframework.context.ApplicationContext;
-
-/**
- * Helper that provides state information across the levels of Spring Test that do not expose the
- * necessary context/state for integration of Camel testing features into Spring test. Also
- * provides utility methods.
- * <p/>
- * Note that this class makes use of {@link ThreadLocal}s to maintain some state. It is imperative
- * that the state setters and getters are accessed within the scope of a single thread in order
- * for this class to work right.
- */
-public final class CamelSpringTestHelper {
-
- private static ThreadLocal<String> originalJmxDisabledValue = new ThreadLocal<String>();
-
- private static ThreadLocal<Class<?>> testClazz = new ThreadLocal<Class<?>>();
-
- private CamelSpringTestHelper() {
- }
-
- public static String getOriginalJmxDisabled() {
- return originalJmxDisabledValue.get();
- }
-
- public static void setOriginalJmxDisabledValue(String originalValue) {
- originalJmxDisabledValue.set(originalValue);
- }
-
- public static Class<?> getTestClass() {
- return testClazz.get();
- }
-
- public static void setTestClass(Class<?> testClass) {
- testClazz.set(testClass);
- }
-
- /**
- * Returns all methods defined in {@code clazz} and its superclasses/interfaces.
- */
- public static Collection<Method> getAllMethods(Class<?> clazz) {
-
- Set<Method> methods = new HashSet<Method>();
- Class<?> currentClass = clazz;
-
- while (currentClass != null) {
- methods.addAll(Arrays.asList(clazz.getMethods()));
- currentClass = currentClass.getSuperclass();
- }
-
- return methods;
- }
-
- /**
- * Executes {@code strategy} against all {@link SpringCamelContext}s found in the Spring context.
- * This method reduces the amount of repeated find and loop code throughout this class.
- *
- * @param context the Spring context to search
- * @param strategy the strategy to execute against the found {@link SpringCamelContext}s
- *
- * @throws Exception if there is an error executing any of the strategies
- */
- public static void doToSpringCamelContexts(ApplicationContext context,
- DoToSpringCamelContextsStrategy strategy) throws Exception {
- Map<String, SpringCamelContext> contexts =
- context.getBeansOfType(SpringCamelContext.class);
-
- for (Entry<String, SpringCamelContext> entry : contexts.entrySet()) {
- strategy.execute(entry.getKey(), entry.getValue());
- }
- }
-
- public interface DoToSpringCamelContextsStrategy {
- void execute(String contextName, SpringCamelContext camelContext) throws Exception;
- }
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/DisableJmx.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/DisableJmx.java
deleted file mode 100644
index 1dd0ab1..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/DisableJmx.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates if JMX should be globally disabled in the {@code CamelContext}s that are bootstrapped
- * during the test through the use of Spring Test loaded application contexts. Note that the
- * presence of this annotation will result in the manipulation of System Properties that
- * will affect Camel contexts constructed outside of the Spring Test loaded application contexts.
- */
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface DisableJmx {
-
- /**
- * Whether the test annotated with this annotation should be run with JMX disabled in Camel.
- * Defaults to {@code true}.
- */
- boolean value() default true;
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/DisableJmxTestExecutionListener.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/DisableJmxTestExecutionListener.java
deleted file mode 100644
index b679503..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/DisableJmxTestExecutionListener.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import org.apache.camel.management.JmxSystemPropertyKeys;
-import org.springframework.test.context.TestContext;
-import org.springframework.test.context.support.AbstractTestExecutionListener;
-
-/**
- * Provides reset to pre-test state behavior for global enable/disable of JMX
- * support in Camel through the use of {@link DisableJmx}. Tries to ensure that
- * the pre-test value is restored.
- */
-public class DisableJmxTestExecutionListener extends
- AbstractTestExecutionListener {
-
- @Override
- public void afterTestClass(TestContext testContext) throws Exception {
- if (CamelSpringTestHelper.getOriginalJmxDisabled() == null) {
- System.clearProperty(JmxSystemPropertyKeys.DISABLED);
- } else {
- System.setProperty(JmxSystemPropertyKeys.DISABLED,
- CamelSpringTestHelper.getOriginalJmxDisabled());
- }
- }
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ExcludeRoutes.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ExcludeRoutes.java
deleted file mode 100644
index ae32420..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ExcludeRoutes.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates if certain route builder classes should be excluded from discovery.
- * Initializes a {@link org.apache.camel.spi.PackageScanClassResolver} to exclude a set of given
- * classes from being resolved. Typically this is used at test time to exclude certain routes,
- * which might otherwise be just noisy, from being discovered and initialized.
- */
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface ExcludeRoutes {
- /**
- * The classes to exlcude from resolution when using package scanning.
- */
- Class<?>[] value() default {};
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/LazyLoadTypeConverters.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/LazyLoadTypeConverters.java
deleted file mode 100644
index 7f95198..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/LazyLoadTypeConverters.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates if the {@code CamelContext}s that are bootstrapped during the test through the use of Spring Test
- * loaded application contexts should use lazy loading of type converters.
- */
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-@Deprecated
-public @interface LazyLoadTypeConverters {
-
- /**
- * Whether the test annotated with this annotation should be run with lazy type converter loading in Camel.
- * Defaults to {@code true}.
- */
- boolean value() default false;
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/MockEndpoints.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/MockEndpoints.java
deleted file mode 100644
index ff3f282..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/MockEndpoints.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
-
-/**
- * Triggers the auto-mocking of endpoints whose URIs match the provided filter. The default
- * filter is "*" which matches all endpoints. See {@link InterceptSendToMockEndpointStrategy} for
- * more details on the registration of the mock endpoints.
- */
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface MockEndpoints {
-
- /**
- * The pattern to use for matching endpoints to enable mocking on.
- */
- String value() default "*";
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ProvidesBreakpoint.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ProvidesBreakpoint.java
deleted file mode 100644
index e34235d..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ProvidesBreakpoint.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * TODO
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
-public @interface ProvidesBreakpoint {
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ShutdownTimeout.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ShutdownTimeout.java
deleted file mode 100644
index 167a907..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/ShutdownTimeout.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Indicates to set the shutdown timeout of all {@code CamelContext}s instantiated through the
- * use of Spring Test loaded application contexts. If no annotation is used, the timeout is
- * automatically reduced to 10 seconds by the test framework. If the annotation is present the
- * shutdown timeout is set based on the value of {@link #value()}.
- */
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface ShutdownTimeout {
- /**
- * The shutdown timeout to set on the {@code CamelContext}(s). Defaults to {@code 10} seconds.
- */
- int value() default 10;
-
- /**
- * The time unit that {@link #value()} is in.
- */
- TimeUnit timeUnit() default TimeUnit.SECONDS;
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java
deleted file mode 100644
index 52fc44a..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import org.apache.camel.test.CamelTestSupport;
-import org.apache.camel.util.StopWatch;
-import org.apache.camel.util.TimeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.test.context.TestContext;
-import org.springframework.test.context.support.AbstractTestExecutionListener;
-
-/**
- * An execution listener that simulates the timing output built in to {@link CamelTestSupport}.
- */
-public class StopWatchTestExecutionListener extends
- AbstractTestExecutionListener {
-
- protected static ThreadLocal<StopWatch> threadStopWatch = new ThreadLocal<StopWatch>();
-
- /**
- * Exists primarily for testing purposes, but allows for access to the underlying stop watch instance
- * for a test.
- */
- public static StopWatch getStopWatch() {
- return threadStopWatch.get();
- }
-
- @Override
- public void beforeTestMethod(TestContext testContext) throws Exception {
- StopWatch stopWatch = new StopWatch();
- threadStopWatch.set(stopWatch);
-
- stopWatch.restart();
- }
-
- @Override
- public void afterTestMethod(TestContext testContext) throws Exception {
- long time = threadStopWatch.get().stop();
- threadStopWatch.remove();
- Logger log = LoggerFactory.getLogger(testContext.getTestClass());
-
- log.info("********************************************************************************");
- log.info("Testing done: " + testContext.getTestMethod().getName() + "(" + testContext.getTestClass().getName() + ")");
- log.info("Took: " + TimeUtils.printDuration(time) + " (" + time + " millis)");
- log.info("********************************************************************************");
- }
-}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java
deleted file mode 100644
index 76b2bf2..0000000
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.spring;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.camel.CamelContext;
-
-/**
- * Indicates the use of {@code adviceWith()} within the test class. If a class is annotated with
- * this annotation and {@link UseAdviceWith#value()} returns true, any
- * {@code CamelContexts} bootstrapped during the test through the use of Spring Test loaded
- * application contexts will not be started automatically. The test author is responsible for
- * injecting the Camel contexts into the test and executing {@link CamelContext#start()} on them
- * at the appropriate time after any advice has been applied to the routes in the Camel context(s).
- */
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface UseAdviceWith {
-
- /**
- * Whether the test annotated with this annotation should be treated as if
- * {@code adviceWith()} is in use in the test and the Camel contexts should not be started
- * automatically. Defaults to {@code true}.
- */
- boolean value() default true;
-}
diff --git a/components/camel-test-spring/src/main/resources/META-INF/LICENSE.txt b/components/camel-test-spring/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100755
index 6b0b127..0000000
--- a/components/camel-test-spring/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-test-spring/src/main/resources/META-INF/NOTICE.txt b/components/camel-test-spring/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-test-spring/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java
deleted file mode 100644
index 0573c34..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.management.DefaultManagementStrategy;
-import org.apache.camel.test.spring.DisableJmx;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-@DisableJmx
-public class CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest
- extends CamelSpringJUnit4ClassRunnerDisableJmxTest {
-
- @Test
- public void testJmx() throws Exception {
- assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java
deleted file mode 100644
index 18ef310..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-public class CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest
- extends CamelSpringJUnit4ClassRunnerDisableJmxTest {
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxTest.java
deleted file mode 100644
index dbcfae1..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerDisableJmxTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.management.ManagedManagementStrategy;
-import org.apache.camel.test.spring.DisableJmx;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-@DisableJmx(false)
-public class CamelSpringJUnit4ClassRunnerDisableJmxTest
- extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- @Test
- @Override
- public void testJmx() throws Exception {
- assertEquals(ManagedManagementStrategy.class, camelContext.getManagementStrategy().getClass());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java
deleted file mode 100644
index ef4cd4b..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.test.spring.ExcludeRoutes;
-
-import static org.junit.Assert.assertNull;
-
-@ExcludeRoutes(TestRouteBuilder.class)
-public class CamelSpringJUnit4ClassRunnerExcludeRoutesTest
- extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- @Override
- public void testExcludedRoute() {
- assertNull(camelContext.getRoute("excludedRoute"));
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java
deleted file mode 100644
index c2a62e1..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.test.spring.LazyLoadTypeConverters;
-
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-
-@SuppressWarnings("deprecation")
-@LazyLoadTypeConverters(true)
-public class CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest
- extends CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest {
-
- @Test
- @Override
- public void testLazyLoadTypeConverters() {
- assertTrue(camelContext.isLazyLoadTypeConverters());
- assertTrue(camelContext2.isLazyLoadTypeConverters());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java
deleted file mode 100644
index 1425e8a..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-public class CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest
- extends CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest {
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java
deleted file mode 100644
index 072321c2..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.test.spring.LazyLoadTypeConverters;
-
-import org.junit.Test;
-import static org.junit.Assert.assertFalse;
-
-@SuppressWarnings("deprecation")
-@LazyLoadTypeConverters(false)
-public class CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest
- extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- @Test
- @Override
- public void testLazyLoadTypeConverters() {
- assertFalse(camelContext.isLazyLoadTypeConverters());
- assertFalse(camelContext2.isLazyLoadTypeConverters());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java
deleted file mode 100644
index 262fcce..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.MockEndpoints;
-import org.junit.Test;
-
-@MockEndpoints("log:*")
-public class CamelSpringJUnit4ClassRunnerMockEndpointsTest
- extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- @EndpointInject(uri = "mock:log:org.apache.camel.test.junit4.spring", context = "camelContext2")
- protected MockEndpoint mockLog;
-
- @Test
- @Override
- public void testPositive() throws Exception {
- mockLog.expectedBodiesReceived("Hell David");
-
- super.testPositive();
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest.java
deleted file mode 100644
index 71e8765..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Produce;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.ServiceStatus;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.management.DefaultManagementStrategy;
-import org.apache.camel.test.spring.StopWatchTestExecutionListener;
-import org.apache.camel.util.StopWatch;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ContextConfiguration;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-@RunWith(CamelSpringJUnit4ClassRunner.class)
-@ContextConfiguration
-// Put here to prevent Spring context caching across tests since some tests inherit from this test and
-// therefore use the same Spring context.
-@DirtiesContext
-public class CamelSpringJUnit4ClassRunnerPlainTest {
-
- @Autowired
- protected CamelContext camelContext;
-
- @Autowired
- protected CamelContext camelContext2;
-
- @EndpointInject(uri = "mock:a", context = "camelContext")
- protected MockEndpoint mockA;
-
- @EndpointInject(uri = "mock:b", context = "camelContext")
- protected MockEndpoint mockB;
-
- @EndpointInject(uri = "mock:c", context = "camelContext2")
- protected MockEndpoint mockC;
-
- @Produce(uri = "direct:start", context = "camelContext")
- protected ProducerTemplate start;
-
- @Produce(uri = "direct:start2", context = "camelContext2")
- protected ProducerTemplate start2;
-
- /**
- * Multiple test methods operate on the same mock endpoint instances since the
- * test methods do not use {@link DirtiesContext}. Reset them
- * between tests.
- */
- @Before
- public void resetMocks() {
- MockEndpoint.resetMocks(camelContext);
- MockEndpoint.resetMocks(camelContext2);
- }
-
- @Test
- public void testPositive() throws Exception {
- assertEquals(ServiceStatus.Started, camelContext.getStatus());
- assertEquals(ServiceStatus.Started, camelContext2.getStatus());
-
- mockA.expectedBodiesReceived("David");
- mockB.expectedBodiesReceived("Hello David");
- mockC.expectedBodiesReceived("David");
-
- start.sendBody("David");
- start2.sendBody("David");
-
- MockEndpoint.assertIsSatisfied(camelContext);
- }
-
- @Test
- public void testJmx() throws Exception {
- assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass());
- }
-
- @Test
- public void testShutdownTimeout() throws Exception {
- assertEquals(10, camelContext.getShutdownStrategy().getTimeout());
- assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit());
- }
-
- @Test
- public void testStopwatch() {
- StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch();
-
- assertNotNull(stopWatch);
- assertTrue(stopWatch.taken() < 100);
- }
-
- @Test
- public void testExcludedRoute() {
- assertNotNull(camelContext.getRoute("excludedRoute"));
- }
-
- @Test
- public void testProvidesBreakpoint() {
- assertNull(camelContext.getDebugger());
- assertNull(camelContext2.getDebugger());
- }
-
- @SuppressWarnings("deprecation")
- @Test
- public void testLazyLoadTypeConverters() {
- assertTrue(camelContext.isLazyLoadTypeConverters());
- assertTrue(camelContext2.isLazyLoadTypeConverters());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java
deleted file mode 100644
index 13128b4..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-public class CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest
- extends CamelSpringJUnit4ClassRunnerProvidesBreakpointTest {
-
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java
deleted file mode 100644
index e82a411..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.impl.BreakpointSupport;
-import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.spi.Breakpoint;
-import org.apache.camel.test.spring.ProvidesBreakpoint;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class CamelSpringJUnit4ClassRunnerProvidesBreakpointTest
- extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- @ProvidesBreakpoint
- public static Breakpoint createBreakpoint() {
- return new TestBreakpoint();
- }
-
- @Test
- @Override
- public void testProvidesBreakpoint() {
- assertNotNull(camelContext.getDebugger());
- assertNotNull(camelContext2.getDebugger());
-
- start.sendBody("David");
-
- assertNotNull(camelContext.getDebugger());
- assertNotNull(camelContext.getDebugger().getBreakpoints());
- assertEquals(1, camelContext.getDebugger().getBreakpoints().size());
-
- assertTrue(camelContext.getDebugger().getBreakpoints().get(0) instanceof TestBreakpoint);
- assertTrue(((TestBreakpoint) camelContext.getDebugger().getBreakpoints().get(0)).isBreakpointHit());
- }
-
- private static final class TestBreakpoint extends BreakpointSupport {
-
- private boolean breakpointHit;
-
- @Override
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
- breakpointHit = true;
- }
-
- public boolean isBreakpointHit() {
- return breakpointHit;
- }
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java
deleted file mode 100644
index 609f1e1..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.test.spring.ShutdownTimeout;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-@ShutdownTimeout
-public class CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest
- extends CamelSpringJUnit4ClassRunnerShutdownTimeoutTest {
-
- @Test
- @Override
- public void testShutdownTimeout() throws Exception {
- assertEquals(10, camelContext.getShutdownStrategy().getTimeout());
- assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java
deleted file mode 100644
index 3960d18..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-public class CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest
- extends CamelSpringJUnit4ClassRunnerShutdownTimeoutTest {
-
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java
deleted file mode 100644
index 70f46e2..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.test.spring.ShutdownTimeout;
-
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-@ShutdownTimeout(value = 11, timeUnit = TimeUnit.MILLISECONDS)
-public class CamelSpringJUnit4ClassRunnerShutdownTimeoutTest
- extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- @Test
- @Override
- public void testShutdownTimeout() throws Exception {
- assertEquals(11, camelContext.getShutdownStrategy().getTimeout());
- assertEquals(TimeUnit.MILLISECONDS, camelContext.getShutdownStrategy().getTimeUnit());
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java
deleted file mode 100644
index 7c47b5e..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.ServiceStatus;
-import org.apache.camel.test.spring.UseAdviceWith;
-
-import org.junit.Before;
-import org.junit.BeforeClass;
-import static org.junit.Assert.assertEquals;
-
-@UseAdviceWith
-public class CamelSpringJUnit4ClassRunnerUseAdviceWithTest extends CamelSpringJUnit4ClassRunnerPlainTest {
-
- protected static boolean checked;
-
- @BeforeClass
- public static void setup() {
- checked = false;
- }
-
- @Before
- public void testContextStarted() throws Exception {
- if (!checked) {
- assertEquals(ServiceStatus.Stopped, camelContext.getStatus());
- camelContext.start();
- camelContext2.start();
-
- Thread.sleep(2000);
-
- checked = true;
- }
- }
-}
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/TestRouteBuilder.java b/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/TestRouteBuilder.java
deleted file mode 100644
index 2204183..0000000
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/TestRouteBuilder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.test.junit4;
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class TestRouteBuilder extends RouteBuilder {
-
- @Override
- public void configure() throws Exception {
-
- from("direct:z")
- .routeId("excludedRoute")
- .to("log:org.apache.camel.test.junit4.spring");
- }
-}
diff --git a/components/camel-test-spring/src/test/resources/jndi.properties b/components/camel-test-spring/src/test/resources/jndi.properties
deleted file mode 100644
index 5961589..0000000
--- a/components/camel-test-spring/src/test/resources/jndi.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-# START SNIPPET: jndi
-
-java.naming.factory.initial = org.apache.camel.util.jndi.CamelInitialContextFactory
-
-# END SNIPPET: jndi
diff --git a/components/camel-test-spring/src/test/resources/log4j.properties b/components/camel-test-spring/src/test/resources/log4j.properties
deleted file mode 100644
index 1eb13a5..0000000
--- a/components/camel-test-spring/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used for testing
-#
-log4j.rootLogger=INFO, file
-
-log4j.logger.org.springframework=WARN
-#log4j.logger.org.apache.camel=DEBUG
-#log4j.logger.org.apache.camel.test.junit4=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
-log4j.appender.file.file=target/camel-spring-test.log
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml b/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
deleted file mode 100644
index 8b2b4f7..0000000
--- a/components/camel-test-spring/src/test/resources/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest-context.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?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"
- xmlns:camel="http://camel.apache.org/schema/spring"
- xsi:schemaLocation="
- http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd ">
-
- <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"
- trace="true" autoStartup="true">
- <packageScan>
- <package>org.apache.camel.test.junit4</package>
- </packageScan>
- <route>
- <from uri="direct:start" />
- <to uri="mock:a" />
- <transform>
- <simple>Hello ${body}</simple>
- </transform>
- <to uri="mock:b" />
- </route>
- </camelContext>
-
- <camelContext id="camelContext2" xmlns="http://camel.apache.org/schema/spring"
- trace="true" autoStartup="true">
- <route>
- <from uri="direct:start2" />
- <to uri="mock:c" />
- <transform>
- <simple>Hello ${body}</simple>
- </transform>
- <to uri="log:org.apache.camel.test.junit4.spring" />
- </route>
- </camelContext>
-
-</beans>
\ No newline at end of file
diff --git a/components/camel-test/pom.xml b/components/camel-test/pom.xml
index 510b560..99444f4 100644
--- a/components/camel-test/pom.xml
+++ b/components/camel-test/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -42,6 +42,10 @@
<artifactId>camel-core</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
similarity index 81%
rename from components/camel-test-spring/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
rename to components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
index 9040bb2..90a178a 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/CamelSpringTestSupport.java
@@ -17,11 +17,16 @@
package org.apache.camel.test;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.apache.camel.CamelContext;
-import org.apache.camel.spring.CamelBeanPostProcessor;
+import org.apache.camel.Route;
+import org.apache.camel.impl.DefaultPackageScanClassResolver;
+import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
+import org.apache.camel.impl.scan.InvertingPackageScanFilter;
import org.apache.camel.spring.SpringCamelContext;
import org.apache.camel.util.CastUtils;
import org.springframework.beans.factory.support.RootBeanDefinition;
@@ -59,14 +64,14 @@
}
}
- @Override
- protected void postProcessTest() throws Exception {
- // use the bean post processor from camel-spring
- CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
- processor.setApplicationContext(applicationContext);
- processor.setCamelContext(context);
- processor.postProcessBeforeInitialization(this, getClass().getName());
- processor.postProcessAfterInitialization(this, getClass().getName());
+ @SuppressWarnings("unchecked")
+ private static class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver {
+
+ public void setExcludedClasses(Set<Class<?>> excludedClasses) {
+ excludedClasses = excludedClasses == null ? Collections.EMPTY_SET : excludedClasses;
+ addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(excludedClasses)));
+ }
+
}
/**
@@ -130,6 +135,23 @@
}
@Override
+ protected void assertValidContext(CamelContext context) {
+ super.assertValidContext(context);
+
+ List<Route> routes = context.getRoutes();
+ int routeCount = getExpectedRouteCount();
+ if (routeCount > 0) {
+ assertNotNull("Should have some routes defined", routes);
+ assertTrue("Should have at least one route", routes.size() >= routeCount);
+ }
+ log.debug("Camel Routes: " + routes);
+ }
+
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
+ @Override
protected CamelContext createCamelContext() throws Exception {
return SpringCamelContext.springCamelContext(applicationContext);
}
diff --git a/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
index cd05ba8..b3b1ed6 100644
--- a/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
@@ -37,7 +37,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.BreakpointSupport;
-import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.DefaultDebugger;
import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
@@ -46,6 +45,7 @@
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.Language;
+import org.apache.camel.spring.CamelBeanPostProcessor;
import org.apache.camel.util.StopWatch;
import org.apache.camel.util.TimeUtils;
@@ -232,12 +232,13 @@
/**
* Whether or not type converters should be lazy loaded (notice core converters is always loaded)
+ * <p/>
+ * We enabled lazy by default as it would speedup unit testing.
*
- * @return <tt>false</tt> by default.
+ * @return <tt>true</tt> by default.
*/
- @Deprecated
protected boolean isLazyLoadingTypeConverter() {
- return false;
+ return true;
}
/**
@@ -245,10 +246,9 @@
* Note that using Spring Test or Guice is a more powerful approach.
*/
protected void postProcessTest() throws Exception {
- // use the default bean post processor from camel-core
- DefaultCamelBeanPostProcessor processor = new DefaultCamelBeanPostProcessor(context);
- processor.postProcessBeforeInitialization(this, getClass().getName());
- processor.postProcessAfterInitialization(this, getClass().getName());
+ CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
+ processor.setCamelContext(context);
+ processor.postProcessBeforeInitialization(this, "this");
}
protected void stopCamelContext() throws Exception {
@@ -276,7 +276,6 @@
}
}
- @SuppressWarnings("deprecation")
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new DefaultCamelContext(createRegistry());
context.setLazyLoadTypeConverters(isLazyLoadingTypeConverter());
@@ -287,6 +286,7 @@
return new JndiRegistry(createJndiContext());
}
+ @SuppressWarnings("unchecked")
protected Context createJndiContext() throws Exception {
Properties properties = new Properties();
@@ -299,7 +299,7 @@
// set the default initial factory
properties.put("java.naming.factory.initial", "org.apache.camel.util.jndi.CamelInitialContextFactory");
}
- return new InitialContext(new Hashtable<Object, Object>(properties));
+ return new InitialContext(new Hashtable(properties));
}
/**
@@ -504,7 +504,7 @@
* @param id the id of the definition
* @param shortName the short name of the definition
*/
- protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition<?> definition,
+ protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition definition,
String id, String shortName) {
}
@@ -518,7 +518,7 @@
* @param shortName the short name of the definition
* @param timeTaken time taken to process the processor in millis
*/
- protected void debugAfter(Exchange exchange, Processor processor, ProcessorDefinition<?> definition,
+ protected void debugAfter(Exchange exchange, Processor processor, ProcessorDefinition definition,
String id, String shortName, long timeTaken) {
}
@@ -528,12 +528,12 @@
private class DebugBreakpoint extends BreakpointSupport {
@Override
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
CamelTestSupport.this.debugBefore(exchange, processor, definition, definition.getId(), definition.getShortName());
}
@Override
- public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
CamelTestSupport.this.debugAfter(exchange, processor, definition, definition.getId(), definition.getShortName(), timeTaken);
}
}
diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
similarity index 83%
rename from components/camel-test-spring/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
rename to components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
index 54f1c90..836ccba 100644
--- a/components/camel-test-spring/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelSpringTestSupport.java
@@ -17,12 +17,16 @@
package org.apache.camel.test.junit4;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.apache.camel.CamelContext;
-import org.apache.camel.spring.CamelBeanPostProcessor;
+import org.apache.camel.Route;
+import org.apache.camel.impl.DefaultPackageScanClassResolver;
+import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
+import org.apache.camel.impl.scan.InvertingPackageScanFilter;
import org.apache.camel.spring.SpringCamelContext;
-import org.apache.camel.test.ExcludingPackageScanClassResolver;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.ObjectHelper;
import org.junit.After;
@@ -44,25 +48,15 @@
protected abstract AbstractApplicationContext createApplicationContext();
- /**
- * Lets post process this test instance to process any Camel annotations.
- * Note that using Spring Test or Guice is a more powerful approach.
- */
@Override
public void postProcessTest() throws Exception {
super.postProcessTest();
if (isCreateCamelContextPerClass()) {
applicationContext = threadAppContext.get();
}
-
- // use the bean post processor from camel-spring
- CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
- processor.setApplicationContext(applicationContext);
- processor.setCamelContext(context);
- processor.postProcessBeforeInitialization(this, getClass().getName());
- processor.postProcessAfterInitialization(this, getClass().getName());
}
+
@Override
public void doPreSetup() throws Exception {
if (!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
@@ -107,7 +101,17 @@
threadAppContext.remove();
}
}
-
+
+ @SuppressWarnings("unchecked")
+ private static class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver {
+
+ public void setExcludedClasses(Set<Class<?>> excludedClasses) {
+ excludedClasses = excludedClasses == null ? Collections.EMPTY_SET : excludedClasses;
+ addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(excludedClasses)));
+ }
+
+ }
+
/**
* Create a parent context that initializes a
* {@link org.apache.camel.spi.PackageScanClassResolver} to exclude a set of given classes from
@@ -176,6 +180,24 @@
}
@Override
+ protected void assertValidContext(CamelContext context) {
+ super.assertValidContext(context);
+ if (!"true".equalsIgnoreCase(System.getProperty("skipStartingCamelContext"))) {
+ List<Route> routes = context.getRoutes();
+ int routeCount = getExpectedRouteCount();
+ if (routeCount > 0) {
+ assertNotNull("Should have some routes defined", routes);
+ assertTrue("Should have at least one route", routes.size() >= routeCount);
+ }
+ log.debug("Camel Routes: " + routes);
+ }
+ }
+
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
+ @Override
protected CamelContext createCamelContext() throws Exception {
// don't start the springCamelContext if we
return SpringCamelContext.springCamelContext(applicationContext, false);
diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
index d8f4582..ae2f26e 100644
--- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
@@ -37,7 +37,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.BreakpointSupport;
-import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.DefaultDebugger;
import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
@@ -46,6 +45,7 @@
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.Language;
+import org.apache.camel.spring.CamelBeanPostProcessor;
import org.apache.camel.util.StopWatch;
import org.apache.camel.util.TimeUtils;
import org.junit.After;
@@ -335,22 +335,27 @@
/**
* Whether or not type converters should be lazy loaded (notice core converters is always loaded)
+ * <p/>
+ * We enabled lazy by default as it would speedup unit testing.
*
- * @return <tt>false</tt> by default.
+ * @return <tt>true</tt> by default.
*/
- @Deprecated
protected boolean isLazyLoadingTypeConverter() {
- return false;
+ return true;
}
+ /**
+ * Lets post process this test instance to process any Camel annotations.
+ * Note that using Spring Test or Guice is a more powerful approach.
+ */
protected void postProcessTest() throws Exception {
context = threadCamelContext.get();
template = threadTemplate.get();
consumer = threadConsumer.get();
camelContextService = threadService.get();
- // use the default bean post processor from camel-core
- DefaultCamelBeanPostProcessor processor = new DefaultCamelBeanPostProcessor(context);
+ CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
+ processor.setCamelContext(context);
processor.postProcessBeforeInitialization(this, "this");
}
@@ -410,7 +415,6 @@
}
}
- @SuppressWarnings("deprecation")
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new DefaultCamelContext(createRegistry());
context.setLazyLoadTypeConverters(isLazyLoadingTypeConverter());
@@ -421,6 +425,7 @@
return new JndiRegistry(createJndiContext());
}
+ @SuppressWarnings("unchecked")
protected Context createJndiContext() throws Exception {
Properties properties = new Properties();
@@ -432,7 +437,7 @@
} else {
properties.put("java.naming.factory.initial", "org.apache.camel.util.jndi.CamelInitialContextFactory");
}
- return new InitialContext(new Hashtable<Object, Object>(properties));
+ return new InitialContext(new Hashtable(properties));
}
/**
@@ -629,14 +634,14 @@
/**
* Single step debugs and Camel invokes this method before entering the given processor
*/
- protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition<?> definition,
+ protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition definition,
String id, String label) {
}
/**
* Single step debugs and Camel invokes this method after processing the given processor
*/
- protected void debugAfter(Exchange exchange, Processor processor, ProcessorDefinition<?> definition,
+ protected void debugAfter(Exchange exchange, Processor processor, ProcessorDefinition definition,
String id, String label, long timeTaken) {
}
@@ -646,12 +651,12 @@
private class DebugBreakpoint extends BreakpointSupport {
@Override
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
CamelTestSupport.this.debugBefore(exchange, processor, definition, definition.getId(), definition.getLabel());
}
@Override
- public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
CamelTestSupport.this.debugAfter(exchange, processor, definition, definition.getId(), definition.getLabel(), timeTaken);
}
}
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugJUnit4Test.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugJUnit4Test.java
index 6a63599..4f1c8d6 100644
--- a/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugJUnit4Test.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugJUnit4Test.java
@@ -37,7 +37,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugNoLazyTypeConverterTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugNoLazyTypeConverterTest.java
index 53bf53d..75f095c 100644
--- a/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugNoLazyTypeConverterTest.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugNoLazyTypeConverterTest.java
@@ -43,7 +43,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java
similarity index 100%
rename from components/camel-test-spring/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java
rename to components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java
diff --git a/components/camel-test-spring/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java
similarity index 96%
rename from components/camel-test-spring/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java
rename to components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java
index c51d3aa..d22b656 100644
--- a/components/camel-test-spring/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java
@@ -36,7 +36,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java
index 528bf6a..2b0215e 100644
--- a/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java
@@ -20,7 +20,9 @@
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.ProcessorDefinition;
-import org.apache.camel.test.CamelTestSupport;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
+import org.junit.Test;
/**
* @version
@@ -36,13 +38,14 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
}
// END SNIPPET: e1
+ @Test
public void testDebugger() throws Exception {
// set mock expectations
getMockEndpoint("mock:a").expectedMessageCount(1);
@@ -55,6 +58,7 @@
assertMockEndpointsSatisfied();
}
+ @Test
public void testTwo() throws Exception {
// set mock expectations
getMockEndpoint("mock:a").expectedMessageCount(2);
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterCreateCamelContextPerClassTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterCreateCamelContextPerClassTest.java
index 4da2f5e..54b0665 100644
--- a/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterCreateCamelContextPerClassTest.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterCreateCamelContextPerClassTest.java
@@ -16,7 +16,11 @@
*/
package org.apache.camel.test.patterns;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
@@ -28,6 +32,12 @@
// START SNIPPET: example
public class FilterCreateCamelContextPerClassTest extends CamelTestSupport {
+ @EndpointInject(uri = "mock:result")
+ protected MockEndpoint resultEndpoint;
+
+ @Produce(uri = "direct:start")
+ protected ProducerTemplate template;
+
@Override
public boolean isCreateCamelContextPerClass() {
// we override this method and return true, to tell Camel test-kit that
@@ -40,20 +50,20 @@
public void testSendMatchingMessage() throws Exception {
String expectedBody = "<matched/>";
- getMockEndpoint("mock:result").expectedBodiesReceived(expectedBody);
+ resultEndpoint.expectedBodiesReceived(expectedBody);
- template.sendBodyAndHeader("direct:start", expectedBody, "foo", "bar");
+ template.sendBodyAndHeader(expectedBody, "foo", "bar");
- assertMockEndpointsSatisfied();
+ resultEndpoint.assertIsSatisfied();
}
@Test
public void testSendNotMatchingMessage() throws Exception {
- getMockEndpoint("mock:result").expectedMessageCount(0);
+ resultEndpoint.expectedMessageCount(0);
- template.sendBodyAndHeader("direct:start", "<notMatched/>", "foo", "notMatchedHeaderValue");
+ template.sendBodyAndHeader("<notMatched/>", "foo", "notMatchedHeaderValue");
- assertMockEndpointsSatisfied();
+ resultEndpoint.assertIsSatisfied();
}
@Override
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterJUnit4Test.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterJUnit4Test.java
index 406978f..802233f 100644
--- a/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterJUnit4Test.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterJUnit4Test.java
@@ -66,6 +66,5 @@
}
};
}
-
}
// END SNIPPET: example
diff --git a/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java b/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java
index 1cef84b..8b42a59 100644
--- a/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java
+++ b/components/camel-test/src/test/java/org/apache/camel/test/patterns/FilterTest.java
@@ -21,7 +21,8 @@
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.CamelTestSupport;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
import org.junit.Test;
/**
diff --git a/components/camel-test-spring/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml b/components/camel-test/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
similarity index 100%
rename from components/camel-test-spring/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
rename to components/camel-test/src/test/resources/org/apache/camel/test/patterns/applicationContext.xml
diff --git a/components/camel-testng/pom.xml b/components/camel-testng/pom.xml
index 563dece..5ff570f 100644
--- a/components/camel-testng/pom.xml
+++ b/components/camel-testng/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
index fffcffa..d535d01 100644
--- a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
+++ b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java
@@ -23,10 +23,10 @@
import java.util.Set;
import org.apache.camel.CamelContext;
+import org.apache.camel.Route;
import org.apache.camel.impl.DefaultPackageScanClassResolver;
import org.apache.camel.impl.scan.AssignableToPackageScanFilter;
import org.apache.camel.impl.scan.InvertingPackageScanFilter;
-import org.apache.camel.spring.CamelBeanPostProcessor;
import org.apache.camel.spring.SpringCamelContext;
import org.apache.camel.util.CastUtils;
import org.springframework.beans.factory.support.RootBeanDefinition;
@@ -36,6 +36,10 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
+
+/**
+ * @version $Revision$
+ */
public abstract class CamelSpringTestSupport extends CamelTestSupport {
protected static ThreadLocal<AbstractApplicationContext> threadAppContext
= new ThreadLocal<AbstractApplicationContext>();
@@ -49,13 +53,6 @@
if (isCreateCamelContextPerClass()) {
applicationContext = threadAppContext.get();
}
-
- // use the bean post processor from camel-spring
- CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
- processor.setApplicationContext(applicationContext);
- processor.setCamelContext(context);
- processor.postProcessBeforeInitialization(this, getClass().getName());
- processor.postProcessAfterInitialization(this, getClass().getName());
}
@Override
@@ -104,11 +101,12 @@
}
}
+ @SuppressWarnings("unchecked")
private static class ExcludingPackageScanClassResolver extends DefaultPackageScanClassResolver {
public void setExcludedClasses(Set<Class<?>> excludedClasses) {
- Set<Class<?>> parents = excludedClasses == null ? Collections.<Class<?>>emptySet() : excludedClasses;
- addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(parents)));
+ excludedClasses = excludedClasses == null ? Collections.EMPTY_SET : excludedClasses;
+ addFilter(new InvertingPackageScanFilter(new AssignableToPackageScanFilter(excludedClasses)));
}
}
@@ -174,6 +172,23 @@
}
@Override
+ protected void assertValidContext(CamelContext context) {
+ super.assertValidContext(context);
+
+ List<Route> routes = context.getRoutes();
+ int routeCount = getExpectedRouteCount();
+ if (routeCount > 0) {
+ assertNotNull(routes, "Should have some routes defined");
+ assertTrue(routes.size() >= routeCount, "Should have at least one route");
+ }
+ log.debug("Camel Routes: " + routes);
+ }
+
+ protected int getExpectedRouteCount() {
+ return 1;
+ }
+
+ @Override
protected CamelContext createCamelContext() throws Exception {
return SpringCamelContext.springCamelContext(applicationContext, false);
}
diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java
index 3526ec7..0bd49be 100644
--- a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java
+++ b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java
@@ -37,7 +37,6 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.BreakpointSupport;
-import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.impl.DefaultDebugger;
import org.apache.camel.impl.InterceptSendToMockEndpointStrategy;
@@ -46,6 +45,7 @@
import org.apache.camel.model.ModelCamelContext;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.Language;
+import org.apache.camel.spring.CamelBeanPostProcessor;
import org.apache.camel.util.StopWatch;
import org.apache.camel.util.TimeUtils;
import org.slf4j.Logger;
@@ -57,6 +57,8 @@
/**
* A useful base class which creates a {@link org.apache.camel.CamelContext} with some routes
* along with a {@link org.apache.camel.ProducerTemplate} for use in the test case
+ *
+ * @version $Revision$
*/
public abstract class CamelTestSupport extends TestSupport {
private static final Logger LOG = LoggerFactory.getLogger(TestSupport.class);
@@ -338,12 +340,13 @@
/**
* Whether or not type converters should be lazy loaded (notice core converters is always loaded)
+ * <p/>
+ * We enabled lazy by default as it would speedup unit testing.
*
- * @return <tt>false</tt> by default.
+ * @return <tt>true</tt> by default.
*/
- @Deprecated
protected boolean isLazyLoadingTypeConverter() {
- return false;
+ return true;
}
/**
@@ -356,10 +359,9 @@
consumer = threadConsumer.get();
camelContextService = threadService.get();
- // use the default bean post processor from camel-core
- DefaultCamelBeanPostProcessor processor = new DefaultCamelBeanPostProcessor(context);
- processor.postProcessBeforeInitialization(this, getClass().getName());
- processor.postProcessAfterInitialization(this, getClass().getName());
+ CamelBeanPostProcessor processor = new CamelBeanPostProcessor();
+ processor.setCamelContext(context);
+ processor.postProcessBeforeInitialization(this, "this");
}
protected void stopCamelContext() throws Exception {
@@ -418,7 +420,6 @@
}
}
- @SuppressWarnings("deprecation")
protected CamelContext createCamelContext() throws Exception {
CamelContext context = new DefaultCamelContext(createRegistry());
context.setLazyLoadTypeConverters(isLazyLoadingTypeConverter());
@@ -429,6 +430,7 @@
return new JndiRegistry(createJndiContext());
}
+ @SuppressWarnings("unchecked")
protected Context createJndiContext() throws Exception {
Properties properties = new Properties();
@@ -440,7 +442,7 @@
} else {
properties.put("java.naming.factory.initial", "org.apache.camel.util.jndi.CamelInitialContextFactory");
}
- return new InitialContext(new Hashtable<Object, Object>(properties));
+ return new InitialContext(new Hashtable(properties));
}
/**
@@ -637,14 +639,14 @@
/**
* Single step debugs and Camel invokes this method before entering the given processor
*/
- protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition<?> definition,
+ protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition definition,
String id, String label) {
}
/**
* Single step debugs and Camel invokes this method after processing the given processor
*/
- protected void debugAfter(Exchange exchange, Processor processor, ProcessorDefinition<?> definition,
+ protected void debugAfter(Exchange exchange, Processor processor, ProcessorDefinition definition,
String id, String label, long timeTaken) {
}
@@ -654,12 +656,12 @@
private class DebugBreakpoint extends BreakpointSupport {
@Override
- public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
+ public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
CamelTestSupport.this.debugBefore(exchange, processor, definition, definition.getId(), definition.getLabel());
}
@Override
- public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
+ public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition definition, long timeTaken) {
CamelTestSupport.this.debugAfter(exchange, processor, definition, definition.getId(), definition.getLabel(), timeTaken);
}
}
diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/ExchangeTestSupport.java b/components/camel-testng/src/main/java/org/apache/camel/testng/ExchangeTestSupport.java
index 058bd83..3af5d07 100644
--- a/components/camel-testng/src/main/java/org/apache/camel/testng/ExchangeTestSupport.java
+++ b/components/camel-testng/src/main/java/org/apache/camel/testng/ExchangeTestSupport.java
@@ -24,6 +24,8 @@
/**
* A base class for a test which requires a {@link org.apache.camel.CamelContext} and
* a populated {@link Exchange}
+ *
+ * @version $Revision$
*/
public abstract class ExchangeTestSupport extends CamelTestSupport {
protected Exchange exchange;
diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/TestSupport.java b/components/camel-testng/src/main/java/org/apache/camel/testng/TestSupport.java
index cad5be2..9f20ebb 100644
--- a/components/camel-testng/src/main/java/org/apache/camel/testng/TestSupport.java
+++ b/components/camel-testng/src/main/java/org/apache/camel/testng/TestSupport.java
@@ -45,6 +45,8 @@
/**
* A bunch of useful testing methods
+ *
+ * @version $Revision$
*/
public abstract class TestSupport extends Assert {
protected static final String LS = System.getProperty("line.separator");
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugNoLazyTypeConverterTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugNoLazyTypeConverterTest.java
index 400a01f..95b900e 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugNoLazyTypeConverterTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugNoLazyTypeConverterTest.java
@@ -23,6 +23,9 @@
import org.apache.camel.testng.CamelTestSupport;
import org.testng.annotations.Test;
+/**
+ * @version $Revision$
+ */
public class DebugNoLazyTypeConverterTest extends CamelTestSupport {
@Override
@@ -38,7 +41,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringCamelContextTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringCamelContextTest.java
index caca63c..d1be84c 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringCamelContextTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringCamelContextTest.java
@@ -20,6 +20,7 @@
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+
public class DebugSpringCamelContextTest extends DebugSpringTest {
@Override
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringTest.java
index 5105e6b..1f4236d 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugSpringTest.java
@@ -38,7 +38,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTest.java
index 4fdee74..440d306 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTest.java
@@ -23,6 +23,9 @@
import org.apache.camel.testng.CamelTestSupport;
import org.testng.annotations.Test;
+/**
+ * @version $Revision$
+ */
public class DebugTest extends CamelTestSupport {
@Override
@@ -33,7 +36,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTestNGTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTestNGTest.java
index c9fcd9c..900cae1 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTestNGTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/DebugTestNGTest.java
@@ -23,6 +23,9 @@
import org.apache.camel.testng.CamelTestSupport;
import org.testng.annotations.Test;
+/**
+ * @version $Revision$
+ */
public class DebugTestNGTest extends CamelTestSupport {
@Override
@@ -33,7 +36,7 @@
@Override
protected void debugBefore(Exchange exchange, Processor processor,
- ProcessorDefinition<?> definition, String id, String shortName) {
+ ProcessorDefinition definition, String id, String shortName) {
// this method is invoked before we are about to enter the given processor
// from your Java editor you can just add a breakpoint in the code line below
log.info("Before " + definition + " with body " + exchange.getIn().getBody());
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterCreateCamelContextPerClassTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterCreateCamelContextPerClassTest.java
index 137c9ad..d2d91bb 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterCreateCamelContextPerClassTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterCreateCamelContextPerClassTest.java
@@ -26,6 +26,8 @@
/**
* Tests filtering using Camel Test
+ *
+ * @version $Revision$
*/
public class FilterCreateCamelContextPerClassTest extends CamelTestSupport {
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTest.java
index 6eeb5d6..e202fb8 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTest.java
@@ -26,6 +26,8 @@
/**
* Tests filtering using Camel Test
+ *
+ * @version $Revision$
*/
public class FilterTest extends CamelTestSupport {
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTestNGTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTestNGTest.java
index b4a6fbd..2797aca 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTestNGTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/FilterTestNGTest.java
@@ -26,6 +26,8 @@
/**
* Tests filtering using Camel Test
+ *
+ * @version $Revision$
*/
public class FilterTestNGTest extends CamelTestSupport {
diff --git a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/IsUseAdviceWithTest.java b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/IsUseAdviceWithTest.java
index a92d26d..a4d10b0 100644
--- a/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/IsUseAdviceWithTest.java
+++ b/components/camel-testng/src/test/java/org/apache/camel/testng/patterns/IsUseAdviceWithTest.java
@@ -21,6 +21,9 @@
import org.apache.camel.testng.CamelTestSupport;
import org.testng.annotations.Test;
+/**
+ *
+ */
public class IsUseAdviceWithTest extends CamelTestSupport {
@Test
diff --git a/components/camel-twitter/pom.xml b/components/camel-twitter/pom.xml
deleted file mode 100644
index 9945a2e..0000000
--- a/components/camel-twitter/pom.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-twitter</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Twitter</name>
- <description>Camel Twitter support</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.component.twitter.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.twitter4j</groupId>
- <artifactId>twitter4j-core</artifactId>
- <version>${twitter4j-version}</version>
- </dependency>
- <dependency>
- <groupId>org.twitter4j</groupId>
- <artifactId>twitter4j-stream</artifactId>
- <version>${twitter4j-version}</version>
- </dependency>
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <childDelegation>false</childDelegation>
- <useFile>true</useFile>
- <forkMode>once</forkMode>
- <includes>
- <!-- Here we only run test of -->
- <include>**/*UriConfigurationTest.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>twitter-test</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <childDelegation>false</childDelegation>
- <useFile>true</useFile>
- <forkMode>once</forkMode>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/Twitter4JFactory.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/Twitter4JFactory.java
deleted file mode 100644
index 31960a2..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/Twitter4JFactory.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.regex.Pattern;
-
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-import org.apache.camel.component.twitter.consumer.directmessage.DirectMessageConsumer;
-import org.apache.camel.component.twitter.consumer.search.SearchConsumer;
-import org.apache.camel.component.twitter.consumer.streaming.FilterConsumer;
-import org.apache.camel.component.twitter.consumer.streaming.SampleConsumer;
-import org.apache.camel.component.twitter.consumer.timeline.HomeConsumer;
-import org.apache.camel.component.twitter.consumer.timeline.MentionsConsumer;
-import org.apache.camel.component.twitter.consumer.timeline.PublicConsumer;
-import org.apache.camel.component.twitter.consumer.timeline.RetweetsConsumer;
-import org.apache.camel.component.twitter.consumer.timeline.UserConsumer;
-import org.apache.camel.component.twitter.data.ConsumerType;
-import org.apache.camel.component.twitter.data.StreamingType;
-import org.apache.camel.component.twitter.data.TimelineType;
-import org.apache.camel.component.twitter.data.TrendsType;
-import org.apache.camel.component.twitter.producer.DirectMessageProducer;
-import org.apache.camel.component.twitter.producer.UserProducer;
-import org.apache.camel.impl.DefaultProducer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Maps the endpoint URI to the respective Twitter4J consumer or producer.
- *
- * URI STRUCTURE:
- *
- * timeline/
- * public
- * home
- * friends
- * user (ALSO A PRODUCER)
- * mentions
- * retweetsofme
- * user/
- * search users (DIRECT ONLY)
- * user suggestions (DIRECT ONLY)
- * trends/
- * daily
- * weekly
- * userlist
- * directmessage (ALSO A PRODUCER)
- * streaming/
- * filter (POLLING ONLY)
- * sample (POLLING ONLY)
- *
- */
-public final class Twitter4JFactory {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(Twitter4JFactory.class);
-
- private Twitter4JFactory() {
- // helper class
- }
-
- public static Twitter4JConsumer getConsumer(TwitterEndpoint te, String uri)
- throws IllegalArgumentException {
- String[] uriSplit = splitUri(uri);
-
- if (uriSplit.length > 0) {
- switch (ConsumerType.fromUri(uriSplit[0])) {
- case DIRECTMESSAGE:
- return new DirectMessageConsumer(te);
- case SEARCH:
- if (te.getProperties().getKeywords() == null
- || te.getProperties().getKeywords().trim().isEmpty()) {
- throw new IllegalArgumentException("Type set to SEARCH but no keywords were provided.");
- } else {
- return new SearchConsumer(te);
- }
- case STREAMING:
- switch (StreamingType.fromUri(uriSplit[1])) {
- case SAMPLE:
- return new SampleConsumer(te);
- case FILTER:
- return new FilterConsumer(te);
- default:
- break;
- }
- break;
- case TIMELINE:
- if (uriSplit.length > 1) {
- switch (TimelineType.fromUri(uriSplit[1])) {
- case HOME:
- return new HomeConsumer(te);
- case MENTIONS:
- return new MentionsConsumer(te);
- case PUBLIC:
- return new PublicConsumer(te);
- case RETWEETSOFME:
- return new RetweetsConsumer(te);
- case USER:
- if (te.getProperties().getUser() == null
- || te.getProperties().getUser().trim().isEmpty()) {
- throw new IllegalArgumentException(
- "Fetch type set to USER TIMELINE but no user was set.");
- } else {
- return new UserConsumer(te);
- }
- default:
- break;
- }
- }
- break;
- case TRENDS:
- if (uriSplit.length > 1) {
- switch (TrendsType.fromUri(uriSplit[1])) {
- case DAILY:
- // TODO
- break;
- case WEEKLY:
- // TODO
- break;
- default:
- break;
- }
- }
- break;
- case USER:
- // TODO
- break;
- case USERLIST:
- // TODO
- break;
- default:
- break;
- }
- }
-
- LOG.warn("A consumer type was not provided (or an incorrect pairing was used). Defaulting to Public Timeline!");
- return new PublicConsumer(te);
- }
-
- public static DefaultProducer getProducer(TwitterEndpoint te, String uri) throws IllegalArgumentException {
- String[] uriSplit = splitUri(uri);
-
- if (uriSplit.length > 0) {
- switch (ConsumerType.fromUri(uriSplit[0])) {
- case DIRECTMESSAGE:
- if (te.getProperties().getUser() == null || te.getProperties().getUser().trim().isEmpty()) {
- throw new IllegalArgumentException("Producer type set to DIRECT MESSAGE but no recipient user was set.");
- } else {
- return new DirectMessageProducer(te);
- }
- case TIMELINE:
- if (uriSplit.length > 1) {
- switch (TimelineType.fromUri(uriSplit[1])) {
- case USER:
- return new UserProducer(te);
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
-
- }
-
- LOG.warn("A producer type was not provided (or an incorrect pairing was used). Defaulting to a MOCK!");
- throw new IllegalArgumentException("Cannot create any producer with uri " + uri
- + "A producer type was not provided (or an incorrect pairing was used).");
- }
-
- private static String[] splitUri(String uri) {
- Pattern p1 = Pattern.compile("twitter:(//)*");
- Pattern p2 = Pattern.compile("\\?.*");
-
- uri = p1.matcher(uri).replaceAll("");
- uri = p2.matcher(uri).replaceAll("");
-
- return uri.split("/");
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
deleted file mode 100644
index ff3b547..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterComponent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.Map;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.component.twitter.data.EndpointType;
-import org.apache.camel.impl.DefaultComponent;
-
-/**
- * Twitter component
- */
-public class TwitterComponent extends DefaultComponent {
-
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters)
- throws Exception {
- TwitterConfiguration properties = new TwitterConfiguration();
- setProperties(properties, parameters);
-
- TwitterEndpoint endpoint;
- switch (EndpointType.fromUri(properties.getType())) {
- case POLLING:
- endpoint = new TwitterEndpointPolling(uri, this, properties);
- break;
- case EVENT:
- endpoint = new TwitterEndpointEvent(uri, this, properties);
- break;
- default:
- endpoint = new TwitterEndpointDirect(uri, this, properties);
- break;
- }
- return endpoint;
- }
-
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
deleted file mode 100644
index 51b54bb..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import twitter4j.Twitter;
-import twitter4j.TwitterFactory;
-import twitter4j.TwitterStream;
-import twitter4j.TwitterStreamFactory;
-import twitter4j.conf.Configuration;
-import twitter4j.conf.ConfigurationBuilder;
-
-public class TwitterConfiguration {
-
- private String consumerKey;
- private String consumerSecret;
- private String accessToken;
- private String accessTokenSecret;
- private String user;
- private String keywords;
- private int delay = 60;
- private String type;
- private String locations;
- private String userIds;
- private Twitter twitter;
- private TwitterStream twitterStream;
-
- public void checkComplete() {
- if (twitter == null && twitterStream == null
- && (consumerKey.isEmpty() || consumerSecret.isEmpty() || accessToken.isEmpty() || accessTokenSecret.isEmpty())) {
- throw new IllegalArgumentException("twitter or twitterStream or all of consumerKey, consumerSecret, accessToken, and accessTokenSecret must be set!");
- }
- }
-
- public Configuration getConfiguration() {
- ConfigurationBuilder confBuilder = new ConfigurationBuilder();
- confBuilder.setOAuthConsumerKey(consumerKey);
- confBuilder.setOAuthConsumerSecret(consumerSecret);
- confBuilder.setOAuthAccessToken(accessToken);
- confBuilder.setOAuthAccessTokenSecret(accessTokenSecret);
- return confBuilder.build();
- }
-
- public String getConsumerKey() {
- return consumerKey;
- }
-
- public void setConsumerKey(String consumerKey) {
- this.consumerKey = consumerKey;
- }
-
- public String getConsumerSecret() {
- return consumerSecret;
- }
-
- public void setConsumerSecret(String consumerSecret) {
- this.consumerSecret = consumerSecret;
- }
-
- public String getAccessToken() {
- return accessToken;
- }
-
- public void setAccessToken(String accessToken) {
- this.accessToken = accessToken;
- }
-
- public String getAccessTokenSecret() {
- return accessTokenSecret;
- }
-
- public void setAccessTokenSecret(String accessTokenSecret) {
- this.accessTokenSecret = accessTokenSecret;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public String getKeywords() {
- return keywords;
- }
-
- public void setKeywords(String keywords) {
- this.keywords = keywords;
- }
-
- public int getDelay() {
- return delay;
- }
-
- public void setDelay(int delay) {
- this.delay = delay;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getLocations() {
- return locations;
- }
-
- public void setLocations(String locations) {
- this.locations = locations;
- }
-
- public String getUserIds() {
- return userIds;
- }
-
- public void setUserIds(String userIds) {
- this.userIds = userIds;
- }
-
- public Twitter getTwitter() {
- return twitter;
- }
-
- public void setTwitter(Twitter twitter) {
- this.twitter = twitter;
- }
-
- public TwitterStream getTwitterStream() {
- return twitterStream;
- }
-
- public void setTwitterStream(TwitterStream twitterStream) {
- this.twitterStream = twitterStream;
- }
-
- public Twitter getTwitterInstance() {
- checkComplete();
- return getTwitter() != null ? getTwitter() : new TwitterFactory(getConfiguration()).getInstance();
- }
-
- public TwitterStream getTwitterStreamInstance() {
- checkComplete();
- return getTwitterStream() != null ? getTwitterStream() : new TwitterStreamFactory(getConfiguration()).getInstance();
- }
-}
-
-
-
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpoint.java
deleted file mode 100644
index bed9e89..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpoint.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import org.apache.camel.Endpoint;
-
-import twitter4j.Twitter;
-
-public interface TwitterEndpoint extends Endpoint {
-
- Twitter getTwitter();
-
- TwitterConfiguration getProperties();
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
deleted file mode 100644
index edbb819..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointDirect.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.component.direct.DirectEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-import org.apache.camel.component.twitter.consumer.TwitterConsumerDirect;
-import twitter4j.Twitter;
-
-/**
- * Twitter direct endpoint
- */
-public class TwitterEndpointDirect extends DirectEndpoint implements TwitterEndpoint {
-
- private Twitter twitter;
- private TwitterConfiguration properties;
-
- public TwitterEndpointDirect(String uri, TwitterComponent component, TwitterConfiguration properties) {
- super(uri, component);
- this.properties = properties;
- }
-
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- Twitter4JConsumer twitter4jConsumer = Twitter4JFactory.getConsumer(this, getEndpointUri());
- return new TwitterConsumerDirect(this, processor, twitter4jConsumer);
- }
-
- @Override
- public Producer createProducer() throws Exception {
- return Twitter4JFactory.getProducer(this, getEndpointUri());
- }
-
- @Override
- protected void doStart() {
- twitter = properties.getTwitterInstance();
- }
-
- public Twitter getTwitter() {
- return twitter;
- }
-
- public TwitterConfiguration getProperties() {
- return properties;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
deleted file mode 100644
index 184ccc3..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointEvent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.component.direct.DirectEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-import org.apache.camel.component.twitter.consumer.TwitterConsumerEvent;
-
-import twitter4j.Twitter;
-
-public class TwitterEndpointEvent extends DirectEndpoint implements TwitterEndpoint {
-
- private Twitter twitter;
- private TwitterConfiguration properties;
-
- public TwitterEndpointEvent(String uri, TwitterComponent component, TwitterConfiguration properties) {
- super(uri, component);
- this.properties = properties;
- }
-
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- Twitter4JConsumer twitter4jConsumer = Twitter4JFactory.getConsumer(this, getEndpointUri());
- return new TwitterConsumerEvent(this, processor, twitter4jConsumer);
- }
-
- @Override
- public Producer createProducer() throws Exception {
- throw new UnsupportedOperationException("Producer not supported");
- }
-
- @Override
- protected void doStart() {
- twitter = properties.getTwitterInstance();
- }
-
- public Twitter getTwitter() {
- return twitter;
- }
-
- public TwitterConfiguration getProperties() {
- return properties;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
deleted file mode 100644
index 7f03cef..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterEndpointPolling.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-import org.apache.camel.component.twitter.consumer.TwitterConsumer;
-import org.apache.camel.component.twitter.consumer.TwitterConsumerPolling;
-import org.apache.camel.impl.DefaultPollingEndpoint;
-import twitter4j.Twitter;
-
-/**
- * Twitter polling endpoint
- */
-public class TwitterEndpointPolling extends DefaultPollingEndpoint implements TwitterEndpoint {
-
- private Twitter twitter;
- private TwitterConfiguration properties;
-
- public TwitterEndpointPolling(String uri, TwitterComponent component, TwitterConfiguration properties) {
- super(uri, component);
- this.properties = properties;
- }
-
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
- Twitter4JConsumer twitter4jConsumer = Twitter4JFactory.getConsumer(this, getEndpointUri());
- TwitterConsumer tc = new TwitterConsumerPolling(this, processor, twitter4jConsumer);
- configureConsumer(tc);
- return tc;
- }
-
- @Override
- public Producer createProducer() throws Exception {
- return Twitter4JFactory.getProducer(this, getEndpointUri());
- }
-
- @Override
- protected void doStart() {
- twitter = properties.getTwitterInstance();
- }
-
- public Twitter getTwitter() {
- return twitter;
- }
-
- public boolean isSingleton() {
- return true;
- }
-
- public TwitterConfiguration getProperties() {
- return properties;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TweeterStatusListener.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TweeterStatusListener.java
deleted file mode 100644
index 0f11c77..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TweeterStatusListener.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer;
-
-import twitter4j.Status;
-
-public interface TweeterStatusListener {
- void onStatus(Status status);
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java
deleted file mode 100644
index 9c791ef..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/Twitter4JConsumer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer;
-
-import java.io.Serializable;
-import java.util.List;
-
-import twitter4j.TwitterException;
-
-
-public abstract class Twitter4JConsumer {
-
- protected long lastId = 1;
-
- // Can't assume that the end of the list will be the most recent ID.
- // The Twitter API sometimes returns them slightly out of order.
- protected void checkLastId(long newId) {
- if (newId > lastId) {
- lastId = newId;
- }
- }
-
- public abstract List<? extends Serializable> pollConsume() throws TwitterException;
-
- public abstract List<? extends Serializable> directConsume() throws TwitterException;
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumer.java
deleted file mode 100644
index a4b3379..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumer.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer;
-
-import org.apache.camel.Consumer;
-
-public interface TwitterConsumer extends Consumer {
-
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerDirect.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerDirect.java
deleted file mode 100644
index f157dcf..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerDirect.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer;
-
-import java.io.Serializable;
-import java.util.Iterator;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.direct.DirectConsumer;
-import org.apache.camel.component.twitter.TwitterEndpoint;
-
-/**
- * Camel DirectConsumer implementation.
- *
- */
-public class TwitterConsumerDirect extends DirectConsumer implements TwitterConsumer {
-
- private Twitter4JConsumer twitter4jConsumer;
-
- public TwitterConsumerDirect(TwitterEndpoint endpoint, Processor processor,
- Twitter4JConsumer twitter4jConsumer) {
- super(endpoint, processor);
-
- this.twitter4jConsumer = twitter4jConsumer;
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
-
- Iterator<? extends Serializable> i = twitter4jConsumer.directConsume().iterator();
- while (i.hasNext()) {
- Exchange e = getEndpoint().createExchange();
- e.getIn().setBody(i.next());
- getProcessor().process(e);
- }
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerEvent.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerEvent.java
deleted file mode 100644
index 13c775a..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerEvent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.direct.DirectConsumer;
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.streaming.StreamingConsumer;
-
-import twitter4j.Status;
-
-public class TwitterConsumerEvent extends DirectConsumer implements TwitterConsumer, TweeterStatusListener {
- private Twitter4JConsumer twitter4jConsumer;
-
- public TwitterConsumerEvent(TwitterEndpoint endpoint, Processor processor,
- Twitter4JConsumer twitter4jConsumer) {
- super(endpoint, processor);
-
- this.twitter4jConsumer = twitter4jConsumer;
- }
-
- @Override
- protected void doStart() throws Exception {
- super.doStart();
- if (twitter4jConsumer instanceof StreamingConsumer) {
- ((StreamingConsumer)twitter4jConsumer).registerTweetListener(this);
- }
- }
-
- @Override
- public void onStatus(Status status) {
- Exchange exchange = getEndpoint().createExchange();
- exchange.getIn().setBody(status);
- try {
- getProcessor().process(exchange);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java
deleted file mode 100644
index aa1da29..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/TwitterConsumerPolling.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer;
-
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.impl.ScheduledPollConsumer;
-
-/**
- * Provides a scheduled polling consumer
- *
- */
-public class TwitterConsumerPolling extends ScheduledPollConsumer implements TwitterConsumer {
-
- private Twitter4JConsumer twitter4jConsumer;
-
- public TwitterConsumerPolling(TwitterEndpoint endpoint, Processor processor,
- Twitter4JConsumer twitter4jConsumer) {
- super(endpoint, processor);
-
- this.twitter4jConsumer = twitter4jConsumer;
-
- int delay = endpoint.getProperties().getDelay();
- setInitialDelay(0);
- setDelay(delay);
- setTimeUnit(TimeUnit.SECONDS);
- }
-
- protected int poll() throws Exception {
- Iterator<? extends Serializable> i = twitter4jConsumer.pollConsume().iterator();
-
- int total = 0;
- while (i.hasNext()) {
- Exchange e = getEndpoint().createExchange();
- e.getIn().setBody(i.next());
- getProcessor().process(e);
-
- total++;
- }
-
- return total;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/directmessage/DirectMessageConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/directmessage/DirectMessageConsumer.java
deleted file mode 100644
index f0571ff..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/directmessage/DirectMessageConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.directmessage;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.DirectMessage;
-import twitter4j.Paging;
-import twitter4j.TwitterException;
-
-/**
- * Consumes a user's direct messages
- */
-public class DirectMessageConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public DirectMessageConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<DirectMessage> pollConsume() throws TwitterException {
- List<DirectMessage> list = te.getTwitter().getDirectMessages(new Paging(lastId));
- for (DirectMessage dm : list) {
- checkLastId(dm.getId());
- }
- return list;
- }
-
- public List<DirectMessage> directConsume() throws TwitterException {
- return te.getTwitter().getDirectMessages();
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/search/SearchConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/search/SearchConsumer.java
deleted file mode 100644
index 6fed25f..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/search/SearchConsumer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.search;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Query;
-import twitter4j.QueryResult;
-import twitter4j.Tweet;
-import twitter4j.TwitterException;
-
-/**
- * Consumes search requests
- *
- */
-public class SearchConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public SearchConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<Tweet> pollConsume() throws TwitterException {
- String keywords = te.getProperties().getKeywords();
- Query query = new Query(keywords);
- query.setSinceId(lastId);
- return search(query);
- }
-
- public List<Tweet> directConsume() throws TwitterException {
- String keywords = te.getProperties().getKeywords();
- return search(new Query(keywords));
- }
-
- private List<Tweet> search(Query query) throws TwitterException {
- QueryResult qr = te.getTwitter().search(query);
- List<Tweet> tweets = qr.getTweets();
-
- for (Tweet t : tweets) {
- checkLastId(t.getId());
- }
- return tweets;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/FilterConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/FilterConsumer.java
deleted file mode 100644
index 1028fd2..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/FilterConsumer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.streaming;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-
-import twitter4j.FilterQuery;
-
-/**
- * Consumes the filter stream
- *
- */
-public class FilterConsumer extends StreamingConsumer {
-
- public FilterConsumer(TwitterEndpoint te) {
- super(te);
- twitterStream.filter(createFilter(te));
- }
-
- private FilterQuery createFilter(TwitterEndpoint te) {
- FilterQuery filterQuery = new FilterQuery();
- String allLocationsString = te.getProperties().getLocations();
- if (allLocationsString != null) {
- String[] locationStrings = allLocationsString.split(";");
- double[][] locations = new double[locationStrings.length][2];
- for (int i = 0; i < locationStrings.length; i++) {
- String[] coords = locationStrings[i].split(",");
- locations[i][0] = Double.valueOf(coords[0]);
- locations[i][1] = Double.valueOf(coords[1]);
- }
- filterQuery.locations(locations);
- }
-
- String keywords = te.getProperties().getKeywords();
- if (keywords != null && keywords.length() > 0) {
- filterQuery.track(keywords.split(","));
- }
-
- String userIds = te.getProperties().getUserIds();
- if (userIds != null) {
- String[] stringUserIds = userIds.split(",");
- long[] longUserIds = new long[stringUserIds.length];
- for (int i = 0; i < stringUserIds.length; i++) {
- longUserIds[i] = Long.valueOf(stringUserIds[i]);
- }
- filterQuery.follow(longUserIds);
- }
-
- if (allLocationsString == null && keywords == null && userIds == null) {
- throw new IllegalArgumentException("At least one filter parameter is required");
- }
-
- filterQuery.setIncludeEntities(true);
- return filterQuery;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/SampleConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/SampleConsumer.java
deleted file mode 100644
index 716790b..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/SampleConsumer.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.streaming;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-
-/**
- * Consumes the sample stream
- *
- */
-public class SampleConsumer extends StreamingConsumer {
-
- public SampleConsumer(TwitterEndpoint te) {
- super(te);
- twitterStream.sample();
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/StreamingConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/StreamingConsumer.java
deleted file mode 100644
index c054be7..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/streaming/StreamingConsumer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.streaming;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.TweeterStatusListener;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Status;
-import twitter4j.StatusDeletionNotice;
-import twitter4j.StatusListener;
-import twitter4j.TwitterException;
-import twitter4j.TwitterStream;
-
-/**
- * Super class providing consuming capabilities for the streaming API.
- *
- */
-public class StreamingConsumer extends Twitter4JConsumer implements StatusListener {
- protected final TwitterStream twitterStream;
- TwitterEndpoint te;
- private final List<Status> receivedStatuses = new ArrayList<Status>();
- private volatile boolean clear;
- private TweeterStatusListener tweeterStatusListener;
-
-
- public StreamingConsumer(TwitterEndpoint te) {
- this.te = te;
- twitterStream = te.getProperties().getTwitterStreamInstance();
- twitterStream.addListener(this);
- }
-
- public List<Status> pollConsume() throws TwitterException {
- clear = true;
- return Collections.unmodifiableList(new ArrayList<Status>(receivedStatuses));
- }
-
- public List<Status> directConsume() throws TwitterException {
- // not used
- return null;
- }
-
- @Override
- public void onException(Exception ex) {
- }
-
- @Override
- public void onStatus(Status status) {
- if (tweeterStatusListener != null) {
- tweeterStatusListener.onStatus(status);
- } else {
- if (clear) {
- receivedStatuses.clear();
- clear = false;
- }
- receivedStatuses.add(status);
- }
- }
-
- @Override
- public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
- }
-
- @Override
- public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
- }
-
- @Override
- public void onScrubGeo(long userId, long upToStatusId) {
- }
-
- public void registerTweetListener(TweeterStatusListener tweeterStatusListener) {
- this.tweeterStatusListener = tweeterStatusListener;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/HomeConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/HomeConsumer.java
deleted file mode 100644
index 281384c..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/HomeConsumer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.timeline;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Paging;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-
-/**
- * Consumes the user's home timeline.
- *
- */
-public class HomeConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public HomeConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<Status> pollConsume() throws TwitterException {
- List<Status> list = te.getTwitter().getHomeTimeline(new Paging(lastId));
- for (Status s : list) {
- checkLastId(s.getId());
- }
- return list;
- }
-
- public List<Status> directConsume() throws TwitterException {
- return te.getTwitter().getHomeTimeline();
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/MentionsConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/MentionsConsumer.java
deleted file mode 100644
index b56df8a..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/MentionsConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.timeline;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Paging;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-
-/**
- * Consumes tweets in which the user has been mentioned.
- */
-public class MentionsConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public MentionsConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<Status> pollConsume() throws TwitterException {
- List<Status> list = te.getTwitter().getMentions(new Paging(lastId));
- for (Status s : list) {
- checkLastId(s.getId());
- }
- return list;
- }
-
- public List<Status> directConsume() throws TwitterException {
- return te.getTwitter().getMentions();
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/PublicConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/PublicConsumer.java
deleted file mode 100644
index 149e96f..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/PublicConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.timeline;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Status;
-import twitter4j.TwitterException;
-
-/**
- * Consumes the public timeline
- *
- */
-public class PublicConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public PublicConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<Status> pollConsume() throws TwitterException {
- return getPublicTimeline();
- }
-
- public List<Status> directConsume() throws TwitterException {
- return getPublicTimeline();
- }
-
- private List<Status> getPublicTimeline() throws TwitterException {
- return te.getTwitter().getPublicTimeline();
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/RetweetsConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/RetweetsConsumer.java
deleted file mode 100644
index 0733a824..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/RetweetsConsumer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.timeline;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Paging;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-
-/**
- * Consumes a user's tweets that have been retweeted
- *
- */
-public class RetweetsConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public RetweetsConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<Status> pollConsume() throws TwitterException {
- List<Status> list = te.getTwitter().getRetweetsOfMe(new Paging(lastId));
- for (Status s : list) {
- checkLastId(s.getId());
- }
- return list;
- }
-
- public List<Status> directConsume() throws TwitterException {
- return te.getTwitter().getRetweetsOfMe();
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/UserConsumer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/UserConsumer.java
deleted file mode 100644
index 4efd546..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/consumer/timeline/UserConsumer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.consumer.timeline;
-
-import java.util.List;
-
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.component.twitter.consumer.Twitter4JConsumer;
-
-import twitter4j.Paging;
-import twitter4j.Status;
-import twitter4j.TwitterException;
-
-/**
- * Consumes the timeline of a given user.
- */
-public class UserConsumer extends Twitter4JConsumer {
-
- TwitterEndpoint te;
-
- public UserConsumer(TwitterEndpoint te) {
- this.te = te;
- }
-
- public List<Status> pollConsume() throws TwitterException {
- List<Status> list = te.getTwitter().getUserTimeline(te.getProperties().getUser(), new Paging(lastId));
- for (Status s : list) {
- checkLastId(s.getId());
- }
- return list;
- }
-
- public List<Status> directConsume() throws TwitterException {
- return te.getTwitter().getUserTimeline(te.getProperties().getUser());
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/ConsumerType.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/ConsumerType.java
deleted file mode 100644
index aa36636..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/ConsumerType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.data;
-
-
-public enum ConsumerType {
-
- TIMELINE, SEARCH, USER, TRENDS, USERLIST, DIRECTMESSAGE, STREAMING, UNKNOWN;
-
- public static ConsumerType fromUri(String uri) {
- for (ConsumerType consumerType : ConsumerType.values()) {
- if (consumerType.name().equalsIgnoreCase(uri)) {
- return consumerType;
- }
- }
- return ConsumerType.UNKNOWN;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/EndpointType.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/EndpointType.java
deleted file mode 100644
index cba0e75..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/EndpointType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.data;
-
-public enum EndpointType {
-
- POLLING, DIRECT, EVENT;
-
- public static EndpointType fromUri(String uri) {
- for (EndpointType endpointType : EndpointType.values()) {
- if (endpointType.name().equalsIgnoreCase(uri)) {
- return endpointType;
- }
- }
- return EndpointType.DIRECT;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/GeoLocation.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/GeoLocation.java
deleted file mode 100644
index e3a46df..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/GeoLocation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.data;
-
-public class GeoLocation {
-
- private double latitude;
- private double longitude;
-
- public GeoLocation(twitter4j.GeoLocation geoLocation) {
- this.latitude = geoLocation.getLatitude();
- this.longitude = geoLocation.getLongitude();
- }
-
- public double getLatitude() {
- return latitude;
- }
-
- public void setLatitude(double latitude) {
- this.latitude = latitude;
- }
-
- public double getLongitude() {
- return longitude;
- }
-
- public void setLongitude(double longitude) {
- this.longitude = longitude;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/StreamingType.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/StreamingType.java
deleted file mode 100644
index 1056a4b..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/StreamingType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.data;
-
-public enum StreamingType {
- SAMPLE, FILTER, UNKNOWN;
-
- public static StreamingType fromUri(String uri) {
- for (StreamingType streamType : StreamingType.values()) {
- if (streamType.name().equalsIgnoreCase(uri)) {
- return streamType;
- }
- }
- return StreamingType.UNKNOWN;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/TimelineType.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/TimelineType.java
deleted file mode 100644
index b6e1e49..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/TimelineType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.data;
-
-public enum TimelineType {
- PUBLIC, HOME, USER, MENTIONS, RETWEETSOFME, UNKNOWN;
-
- public static TimelineType fromUri(String uri) {
- for (TimelineType timelineType : TimelineType.values()) {
- if (timelineType.name().equalsIgnoreCase(uri)) {
- return timelineType;
- }
- }
- return TimelineType.UNKNOWN;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/TrendsType.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/TrendsType.java
deleted file mode 100644
index 88195eb..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/data/TrendsType.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.data;
-
-public enum TrendsType {
- DAILY, WEEKLY, UNKNOWN;
-
- public static TrendsType fromUri(String uri) {
- for (TrendsType trendType : TrendsType.values()) {
- if (trendType.name().equalsIgnoreCase(uri)) {
- return trendType;
- }
- }
- return TrendsType.UNKNOWN;
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/DirectMessageProducer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/DirectMessageProducer.java
deleted file mode 100644
index 1b45262..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/DirectMessageProducer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.producer;
-
-import org.apache.camel.CamelExchangeException;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.impl.DefaultProducer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Produces text as a direct message.
- *
- */
-public class DirectMessageProducer extends DefaultProducer implements Processor {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(DirectMessageProducer.class);
- private TwitterEndpoint te;
-
- public DirectMessageProducer(TwitterEndpoint te) {
- super(te);
- this.te = te;
- }
-
- public void process(Exchange exchange) throws Exception {
- // send direct message
- String toUsername = te.getProperties().getUser();
- String text = exchange.getIn().getBody(String.class);
-
- if (toUsername.isEmpty()) {
- throw new CamelExchangeException("Username not configured on TwitterEndpoint", exchange);
- } else {
- LOG.debug("Sending to: {} message: {}", toUsername, text);
- te.getTwitter().sendDirectMessage(toUsername, text);
- }
- }
-
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/UserProducer.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/UserProducer.java
deleted file mode 100644
index 5f58352..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/producer/UserProducer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.producer;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.component.twitter.TwitterEndpoint;
-import org.apache.camel.impl.DefaultProducer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Produces text as a status update.
- *
- */
-public class UserProducer extends DefaultProducer implements Processor {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(UserProducer.class);
- private TwitterEndpoint te;
-
- public UserProducer(TwitterEndpoint te) {
- super(te);
- this.te = te;
- }
-
- public void process(Exchange exchange) throws Exception {
- // update user's status
- String status = exchange.getIn().getBody(String.class);
-
- if (status.length() > 160) {
- LOG.warn("Message is longer than 160 characters. Message will be truncated!");
- status = status.substring(0, 160);
- }
-
- te.getTwitter().updateStatus(status);
- LOG.debug("Updated status: {}", status);
- }
-}
diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/util/TwitterConverter.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/util/TwitterConverter.java
deleted file mode 100644
index 247e626..0000000
--- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/util/TwitterConverter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.util;
-
-import java.text.ParseException;
-
-import org.apache.camel.Converter;
-
-import twitter4j.DirectMessage;
-import twitter4j.Status;
-import twitter4j.Tweet;
-
-/**
- * Utility for converting between Twitter4J and camel-twitter data layers.
- *
- */
-@Converter
-public final class TwitterConverter {
-
- private TwitterConverter() {
- // Helper class
- }
-
- @Converter
- public static String toString(Status status) throws ParseException {
- StringBuilder s = new StringBuilder();
- s.append(status.getCreatedAt()).append(" (").append(status.getUser().getScreenName()).append(") ");
- s.append(status.getText());
- return s.toString();
- }
-
- @Converter
- public static String toString(Tweet tweet) throws ParseException {
- StringBuilder s = new StringBuilder();
- s.append(tweet.getCreatedAt()).append(" (").append(tweet.getFromUser()).append(") ");
- s.append(tweet.getText());
- return s.toString();
- }
-
- @Converter
- public static String toString(DirectMessage dm) throws ParseException {
- StringBuilder s = new StringBuilder();
- s.append(dm.getCreatedAt()).append(" (").append(dm.getSenderScreenName()).append(") ");
- s.append(dm.getText());
- return s.toString();
- }
-}
diff --git a/components/camel-twitter/src/main/resources/META-INF/LICENSE.txt b/components/camel-twitter/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/components/camel-twitter/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/components/camel-twitter/src/main/resources/META-INF/NOTICE.txt b/components/camel-twitter/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/components/camel-twitter/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/components/camel-twitter/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-twitter/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
deleted file mode 100644
index 1a70579..0000000
--- a/components/camel-twitter/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-org.apache.camel.component.twitter.util.TwitterConverter
\ No newline at end of file
diff --git a/components/camel-twitter/src/main/resources/META-INF/services/org/apache/camel/component/twitter b/components/camel-twitter/src/main/resources/META-INF/services/org/apache/camel/component/twitter
deleted file mode 100644
index f0472a4..0000000
--- a/components/camel-twitter/src/main/resources/META-INF/services/org/apache/camel/component/twitter
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-class=org.apache.camel.component.twitter.TwitterComponent
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/CamelTwitterTestSupport.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/CamelTwitterTestSupport.java
deleted file mode 100644
index 2eb87f9..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/CamelTwitterTestSupport.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
-
-import org.apache.camel.test.junit4.CamelTestSupport;
-
-public class CamelTwitterTestSupport extends CamelTestSupport {
-
- protected String consumerKey;
- protected String consumerSecret;
- protected String accessToken;
- protected String accessTokenSecret;
-
- public CamelTwitterTestSupport() {
- URL url = getClass().getResource("/test-options.properties");
-
- InputStream inStream;
- try {
- inStream = url.openStream();
- } catch (IOException e) {
- e.printStackTrace();
- throw new IllegalAccessError("test-options.properties could not be found");
- }
-
- Properties properties = new Properties();
- try {
- properties.load(inStream);
- } catch (IOException e) {
- e.printStackTrace();
- throw new IllegalAccessError("test-options.properties could not be found");
- }
-
- consumerKey = properties.get("consumer.key").toString();
- consumerSecret = properties.get("consumer.secret").toString();
- accessToken = properties.get("access.token").toString();
- accessTokenSecret = properties.get("access.token.secret").toString();
- }
-
- protected String getUriTokens() {
- return "consumerKey=" + consumerKey + "&consumerSecret=" + consumerSecret + "&accessToken="
- + accessToken + "&accessTokenSecret=" + accessTokenSecret;
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java
deleted file mode 100644
index 5c328a3..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class DirectMessageDirectTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(DirectMessageDirectTest.class);
-
-
- @Test
- public void testReadDirectMessage() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://directmessage?type=direct&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java
deleted file mode 100644
index e088a45..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class DirectMessagePollingTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(DirectMessagePollingTest.class);
-
-
- @Test
- public void testReadDirectMessage() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://directmessage?type=polling&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLineDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLineDirectTest.java
deleted file mode 100644
index 3fa5eb9..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLineDirectTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class HomeTimeLineDirectTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(HomeTimeLineDirectTest.class);
-
-
- @Test
- public void testReadHomeTimeLine() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://timeline/home?type=direct&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java
deleted file mode 100644
index 0260b0c..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/HomeTimeLinePollingTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class HomeTimeLinePollingTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(HomeTimeLinePollingTest.class);
-
- @Test
- public void testReadHomeTimeLine() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://timeline/home?type=polling&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/PublicTimeLineDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/PublicTimeLineDirectTest.java
deleted file mode 100644
index aa79001..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/PublicTimeLineDirectTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class PublicTimeLineDirectTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(PublicTimeLineDirectTest.class);
-
- @Test
- public void testReadPublicTimeline() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://timeline/public?type=direct&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/PublicTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/PublicTimeLinePollingTest.java
deleted file mode 100644
index 09442a0..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/PublicTimeLinePollingTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class PublicTimeLinePollingTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(PublicTimeLinePollingTest.class);
-
- @Test
- public void testReadPublicTimeline() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://timeline/public?type=polling&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java
deleted file mode 100644
index 2b8d528..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchDirectTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class SearchDirectTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(SearchDirectTest.class);
-
- @Test
- public void testSearchTimeline() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://search?type=direct&keywords=java&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java
deleted file mode 100644
index 66fda1d..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchEventTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.twitter.mocks.TwitterStreamMock;
-import org.apache.camel.impl.JndiRegistry;
-import org.junit.Test;
-
-public class SearchEventTest extends CamelTwitterTestSupport {
-
- @EndpointInject(uri = "mock:result")
- protected MockEndpoint resultEndpoint;
-
- private TwitterStreamMock twitterStream;
-
- @Test
- public void testSearchTimeline() throws Exception {
- resultEndpoint.expectedMinimumMessageCount(1);
-
- twitterStream.updateStatus("#cameltest tweet");
- resultEndpoint.assertIsSatisfied();
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://streaming/filter?type=event&twitterStream=#twitterStream&keywords=#cameltest")
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-
- @Override
- protected JndiRegistry createRegistry() throws Exception {
- twitterStream = new TwitterStreamMock();
- JndiRegistry registry = super.createRegistry();
- registry.bind("twitterStream", twitterStream);
- return registry;
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java
deleted file mode 100644
index 6d1a6b7..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchPollingTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class SearchPollingTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(SearchPollingTest.class);
-
- @Test
- public void testSearchTimeline() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://search?type=polling&keywords=java&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
deleted file mode 100644
index b78097d..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UriConfigurationTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UriConfigurationTest extends Assert {
- private CamelContext context = new DefaultCamelContext();
-
- private CamelTwitterTestSupport support = new CamelTwitterTestSupport();
-
- @Test
- public void testBasicAuthentication() throws Exception {
- Endpoint endpoint = context.getEndpoint("twitter:todo/todo?" + support.getUriTokens());
- assertTrue("Endpoint not a TwitterEndpoint: " + endpoint, endpoint instanceof TwitterEndpoint);
- TwitterEndpoint twitterEndpoint = (TwitterEndpoint) endpoint;
-
- Assert.assertTrue(!twitterEndpoint.getProperties().getConsumerKey().isEmpty());
- Assert.assertTrue(!twitterEndpoint.getProperties().getConsumerSecret().isEmpty());
- Assert.assertTrue(!twitterEndpoint.getProperties().getAccessToken().isEmpty());
- Assert.assertTrue(!twitterEndpoint.getProperties().getAccessTokenSecret().isEmpty());
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java
deleted file mode 100644
index ad9edc7..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLineDirectTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class UserTimeLineDirectTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(UserTimeLineDirectTest.class);
-
- @Test
- public void testReadUserTimeline() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://timeline/user?type=direct&user=brettemeyer&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java
deleted file mode 100644
index 066dfbc..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/UserTimeLinePollingTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter;
-
-import java.util.List;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * consumes tweets
- */
-public class UserTimeLinePollingTest extends CamelTwitterTestSupport {
- private static final transient Logger LOG = LoggerFactory.getLogger(UserTimeLinePollingTest.class);
-
- @Test
- public void testReadUserTimeline() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedMinimumMessageCount(1);
- mock.assertIsSatisfied();
- List<Exchange> tweets = mock.getExchanges();
- if (LOG.isInfoEnabled()) {
- for (Exchange e : tweets) {
- LOG.info("Tweet: " + e.getIn().getBody(String.class));
- }
- }
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("twitter://timeline/user?type=polling&user=brettemeyer&" + getUriTokens())
- .transform(body().convertToString()).to("mock:result");
- }
- };
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/StatusMock.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/StatusMock.java
deleted file mode 100644
index c588cd5..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/StatusMock.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.mocks;
-
-import java.util.Date;
-
-import twitter4j.Annotations;
-import twitter4j.GeoLocation;
-import twitter4j.HashtagEntity;
-import twitter4j.MediaEntity;
-import twitter4j.Place;
-import twitter4j.RateLimitStatus;
-import twitter4j.Status;
-import twitter4j.URLEntity;
-import twitter4j.User;
-import twitter4j.UserMentionEntity;
-
-public class StatusMock implements Status {
-
- private static final long serialVersionUID = 1L;
- private final String text;
-
- public StatusMock(String text) {
- this.text = text;
- }
-
- @Override
- public int compareTo(Status status) {
- return 0;
- }
-
- @Override
- public Date getCreatedAt() {
- return null;
- }
-
- @Override
- public long getId() {
- return 0;
- }
-
- @Override
- public String getText() {
- return text;
- }
-
- @Override
- public String getSource() {
- return null;
- }
-
- @Override
- public boolean isTruncated() {
- return false;
- }
-
- @Override
- public long getInReplyToStatusId() {
- return 0;
- }
-
- @Override
- public long getInReplyToUserId() {
- return 0;
- }
-
- @Override
- public String getInReplyToScreenName() {
- return null;
- }
-
- @Override
- public GeoLocation getGeoLocation() {
- return null;
- }
-
- @Override
- public Place getPlace() {
- return null;
- }
-
- @Override
- public boolean isFavorited() {
- return false;
- }
-
- @Override
- public User getUser() {
- return null;
- }
-
- @Override
- public boolean isRetweet() {
- return false;
- }
-
- @Override
- public Status getRetweetedStatus() {
- return null;
- }
-
- @Override
- public long[] getContributors() {
- return new long[0];
- }
-
- @Override
- public long getRetweetCount() {
- return 0;
- }
-
- @Override
- public boolean isRetweetedByMe() {
- return false;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- public Annotations getAnnotations() {
- return null;
- }
-
- @Override
- public UserMentionEntity[] getUserMentionEntities() {
- return new UserMentionEntity[0];
- }
-
- @Override
- public URLEntity[] getURLEntities() {
- return new URLEntity[0];
- }
-
- @Override
- public HashtagEntity[] getHashtagEntities() {
- return new HashtagEntity[0];
- }
-
- @Override
- public MediaEntity[] getMediaEntities() {
- return new MediaEntity[0];
- }
-
- @Override
- public RateLimitStatus getRateLimitStatus() {
- return null;
- }
-
- @Override
- public int getAccessLevel() {
- return 0;
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/TwitterMock.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/TwitterMock.java
deleted file mode 100644
index 349dc4b..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/TwitterMock.java
+++ /dev/null
@@ -1,1024 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.mocks;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Date;
-
-import twitter4j.AccountSettings;
-import twitter4j.AccountTotals;
-import twitter4j.Category;
-import twitter4j.DirectMessage;
-import twitter4j.Friendship;
-import twitter4j.GeoLocation;
-import twitter4j.GeoQuery;
-import twitter4j.IDs;
-import twitter4j.Location;
-import twitter4j.PagableResponseList;
-import twitter4j.Paging;
-import twitter4j.Place;
-import twitter4j.ProfileImage;
-import twitter4j.Query;
-import twitter4j.QueryResult;
-import twitter4j.RateLimitStatus;
-import twitter4j.RateLimitStatusListener;
-import twitter4j.RelatedResults;
-import twitter4j.Relationship;
-import twitter4j.ResponseList;
-import twitter4j.SavedSearch;
-import twitter4j.SimilarPlaces;
-import twitter4j.Status;
-import twitter4j.StatusUpdate;
-import twitter4j.Trends;
-import twitter4j.Twitter;
-import twitter4j.TwitterAPIConfiguration;
-import twitter4j.TwitterException;
-import twitter4j.User;
-import twitter4j.UserList;
-import twitter4j.auth.AccessToken;
-import twitter4j.auth.Authorization;
-import twitter4j.auth.RequestToken;
-import twitter4j.conf.Configuration;
-
-public class TwitterMock implements Twitter {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public String getScreenName() throws TwitterException, IllegalStateException {
- return null;
- }
-
- @Override
- public long getId() throws TwitterException, IllegalStateException {
- return 0;
- }
-
- @Override
- public void addRateLimitStatusListener(RateLimitStatusListener listener) {
-
- }
-
- @Override
- public Authorization getAuthorization() {
- return null;
- }
-
- @Override
- public Configuration getConfiguration() {
- return null;
- }
-
- @Override
- public void shutdown() {
-
- }
-
- @Override
- public User verifyCredentials() throws TwitterException {
- return null;
- }
-
- @Override
- public RateLimitStatus getRateLimitStatus() throws TwitterException {
- return null;
- }
-
- @Override
- public User updateProfileColors(String profileBackgroundColor, String profileTextColor,
- String profileLinkColor, String profileSidebarFillColor,
- String profileSidebarBorderColor) throws TwitterException {
- return null;
- }
-
- @Override
- public User updateProfileImage(File image) throws TwitterException {
- return null;
- }
-
- @Override
- public User updateProfileImage(InputStream image) throws TwitterException {
- return null;
- }
-
- @Override
- public User updateProfileBackgroundImage(File image, boolean tile) throws TwitterException {
- return null;
- }
-
- @Override
- public User updateProfileBackgroundImage(InputStream image, boolean tile) throws TwitterException {
- return null;
- }
-
- @Override
- public User updateProfile(String name, String url, String location, String description)
- throws TwitterException {
- return null;
- }
-
- @Override
- public AccountTotals getAccountTotals() throws TwitterException {
- return null;
- }
-
- @Override
- public AccountSettings getAccountSettings() throws TwitterException {
- return null;
- }
-
- @Override
- public AccountSettings updateAccountSettings(Integer trendLocationWoeid, Boolean sleepTimeEnabled,
- String startSleepTime, String endSleepTime, String timeZone,
- String lang) throws TwitterException {
- return null;
- }
-
- @Override
- public User createBlock(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User createBlock(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public User destroyBlock(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User destroyBlock(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public boolean existsBlock(String screenName) throws TwitterException {
- return false;
- }
-
- @Override
- public boolean existsBlock(long userId) throws TwitterException {
- return false;
- }
-
- @Override
- public ResponseList<User> getBlockingUsers() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> getBlockingUsers(int page) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getBlockingUsersIDs() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<DirectMessage> getDirectMessages() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<DirectMessage> getDirectMessages(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<DirectMessage> getSentDirectMessages() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<DirectMessage> getSentDirectMessages(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public DirectMessage sendDirectMessage(String screenName, String text) throws TwitterException {
- return null;
- }
-
- @Override
- public DirectMessage sendDirectMessage(long userId, String text) throws TwitterException {
- return null;
- }
-
- @Override
- public DirectMessage destroyDirectMessage(long id) throws TwitterException {
- return null;
- }
-
- @Override
- public DirectMessage showDirectMessage(long id) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFavorites() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFavorites(int page) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFavorites(String id) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFavorites(String id, int page) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFavorites(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFavorites(String id, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public Status createFavorite(long id) throws TwitterException {
- return null;
- }
-
- @Override
- public Status destroyFavorite(long id) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getFriendsIDs(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getFriendsIDs(long userId, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getFriendsIDs(String screenName, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getFollowersIDs(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getFollowersIDs(long userId, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getFollowersIDs(String screenName, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public User createFriendship(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User createFriendship(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public User createFriendship(String screenName, boolean follow) throws TwitterException {
- return null;
- }
-
- @Override
- public User createFriendship(long userId, boolean follow) throws TwitterException {
- return null;
- }
-
- @Override
- public User destroyFriendship(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User destroyFriendship(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public boolean existsFriendship(String userA, String userB) throws TwitterException {
- return false;
- }
-
- @Override
- public Relationship showFriendship(String sourceScreenName, String targetScreenName)
- throws TwitterException {
- return null;
- }
-
- @Override
- public Relationship showFriendship(long sourceId, long targetId) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getIncomingFriendships(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getOutgoingFriendships(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Friendship> lookupFriendships(String[] screenNames) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Friendship> lookupFriendships(long[] ids) throws TwitterException {
- return null;
- }
-
- @Override
- public Relationship updateFriendship(String screenName, boolean enableDeviceNotification,
- boolean retweets) throws TwitterException {
- return null;
- }
-
- @Override
- public Relationship updateFriendship(long userId, boolean enableDeviceNotification, boolean retweets)
- throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getNoRetweetIds() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Place> searchPlaces(GeoQuery query) throws TwitterException {
- return null;
- }
-
- @Override
- public SimilarPlaces getSimilarPlaces(GeoLocation location, String name, String containedWithin,
- String streetAddress) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Place> reverseGeoCode(GeoQuery query) throws TwitterException {
- return null;
- }
-
- @Override
- public Place getGeoDetails(String id) throws TwitterException {
- return null;
- }
-
- @Override
- public Place createPlace(String name, String containedWithin, String token, GeoLocation location,
- String streetAddress) throws TwitterException {
- return null;
- }
-
- @Override
- public boolean test() throws TwitterException {
- return false;
- }
-
- @Override
- public TwitterAPIConfiguration getAPIConfiguration() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Language> getLanguages() throws TwitterException {
- return null;
- }
-
- @Override
- public String getTermsOfService() throws TwitterException {
- return null;
- }
-
- @Override
- public String getPrivacyPolicy() throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getUserListMembers(String listOwnerScreenName, int listId, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getUserListMembers(long listOwnerId, int listId, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getUserListMembers(int listId, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList addUserListMember(int listId, long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList addUserListMembers(int listId, long[] userIds) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList addUserListMembers(int listId, String[] screenNames) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList deleteUserListMember(int listId, long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public User checkUserListMembership(String listOwnerScreenName, int listId, long userId)
- throws TwitterException {
- return null;
- }
-
- @Override
- public User showUserListMembership(int listId, long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList createUserList(String listName, boolean isPublicList, String description)
- throws TwitterException {
- return null;
- }
-
- @Override
- public UserList updateUserList(int listId, String newListName, boolean isPublicList,
- String newDescription) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserLists(String listOwnerScreenName, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserLists(long listOwnerUserId, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public UserList showUserList(String listOwnerScreenName, int id) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList showUserList(int listId) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList destroyUserList(int listId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserListStatuses(String listOwnerScreenName, int id, Paging paging)
- throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserListStatuses(long listOwnerId, int id, Paging paging)
- throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserListStatuses(int listId, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserListMemberships(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserListMemberships(long listMemberId, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserListMemberships(String listMemberScreenName, long cursor,
- boolean filterToOwnedLists)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserListMemberships(long listMemberId, long cursor,
- boolean filterToOwnedLists)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<UserList> getUserListSubscriptions(String listOwnerScreenName, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<UserList> getAllUserLists(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<UserList> getAllUserLists(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getUserListSubscribers(String listOwnerScreenName, int listId,
- long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getUserListSubscribers(int listId, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList subscribeUserList(String listOwnerScreenName, int listId) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList createUserListSubscription(int listId) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList unsubscribeUserList(String listOwnerScreenName, int listId) throws TwitterException {
- return null;
- }
-
- @Override
- public UserList destroyUserListSubscription(int listId) throws TwitterException {
- return null;
- }
-
- @Override
- public User checkUserListSubscription(String listOwnerScreenName, int listId, long userId)
- throws TwitterException {
- return null;
- }
-
- @Override
- public User showUserListSubscription(int listId, long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Location> getAvailableTrends() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Location> getAvailableTrends(GeoLocation location) throws TwitterException {
- return null;
- }
-
- @Override
- public Trends getLocationTrends(int woeid) throws TwitterException {
- return null;
- }
-
- @Override
- public RelatedResults getRelatedResults(long statusId) throws TwitterException {
- return null;
- }
-
- @Override
- public User enableNotification(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User enableNotification(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public User disableNotification(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User disableNotification(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public void setOAuthConsumer(String consumerKey, String consumerSecret) {
-
- }
-
- @Override
- public RequestToken getOAuthRequestToken() throws TwitterException {
- return null;
- }
-
- @Override
- public RequestToken getOAuthRequestToken(String callbackURL) throws TwitterException {
- return null;
- }
-
- @Override
- public RequestToken getOAuthRequestToken(String callbackURL, String xAuthAccessType)
- throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken() throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(String oauthVerifier) throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(RequestToken requestToken) throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(RequestToken requestToken, String oauthVerifier)
- throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(String screenName, String password) throws TwitterException {
- return null;
- }
-
- @Override
- public void setOAuthAccessToken(AccessToken accessToken) {
-
- }
-
- @Override
- public ResponseList<SavedSearch> getSavedSearches() throws TwitterException {
- return null;
- }
-
- @Override
- public SavedSearch showSavedSearch(int id) throws TwitterException {
- return null;
- }
-
- @Override
- public SavedSearch createSavedSearch(String query) throws TwitterException {
- return null;
- }
-
- @Override
- public SavedSearch destroySavedSearch(int id) throws TwitterException {
- return null;
- }
-
- @Override
- public QueryResult search(Query query) throws TwitterException {
- return null;
- }
-
- @Override
- public User reportSpam(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public User reportSpam(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public Status showStatus(long id) throws TwitterException {
- return null;
- }
-
- @Override
- public Status updateStatus(String status) throws TwitterException {
- return null;
- }
-
- @Override
- public Status updateStatus(StatusUpdate latestStatus) throws TwitterException {
- return null;
- }
-
- @Override
- public Status destroyStatus(long statusId) throws TwitterException {
- return null;
- }
-
- @Override
- public Status retweetStatus(long statusId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweets(long statusId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> getRetweetedBy(long statusId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> getRetweetedBy(long statusId, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getRetweetedByIDs(long statusId) throws TwitterException {
- return null;
- }
-
- @Override
- public IDs getRetweetedByIDs(long statusId, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getPublicTimeline() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getHomeTimeline() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getHomeTimeline(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFriendsTimeline() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getFriendsTimeline(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserTimeline(String screenName, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserTimeline(long userId, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserTimeline(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserTimeline(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserTimeline() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getUserTimeline(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getMentions() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getMentions(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedByMe() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedByMe(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedToMe() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedToMe(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetsOfMe() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetsOfMe(Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedToUser(String screenName, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedToUser(long userId, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedByUser(String screenName, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Status> getRetweetedByUser(long userId, Paging paging) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Trends> getDailyTrends() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Trends> getDailyTrends(Date date, boolean excludeHashTags) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Trends> getWeeklyTrends() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Trends> getWeeklyTrends(Date date, boolean excludeHashTags) throws TwitterException {
- return null;
- }
-
- @Override
- public User showUser(String screenName) throws TwitterException {
- return null;
- }
-
- @Override
- public User showUser(long userId) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> lookupUsers(String[] screenNames) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> lookupUsers(long[] ids) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> searchUsers(String query, int page) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<Category> getSuggestedUserCategories() throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> getUserSuggestions(String categorySlug) throws TwitterException {
- return null;
- }
-
- @Override
- public ResponseList<User> getMemberSuggestions(String categorySlug) throws TwitterException {
- return null;
- }
-
- @Override
- public ProfileImage getProfileImage(String screenName, ProfileImage.ImageSize size)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getFriendsStatuses(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getFriendsStatuses(String screenName, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getFriendsStatuses(long userId, long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getFollowersStatuses(long cursor) throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getFollowersStatuses(String screenName, long cursor)
- throws TwitterException {
- return null;
- }
-
- @Override
- public PagableResponseList<User> getFollowersStatuses(long userId, long cursor) throws TwitterException {
- return null;
- }
-}
diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/TwitterStreamMock.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/TwitterStreamMock.java
deleted file mode 100644
index 9c2bec2..0000000
--- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/mocks/TwitterStreamMock.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.twitter.mocks;
-
-import twitter4j.ConnectionLifeCycleListener;
-import twitter4j.FilterQuery;
-import twitter4j.RateLimitStatusListener;
-import twitter4j.SiteStreamsListener;
-import twitter4j.StatusListener;
-import twitter4j.StatusStream;
-import twitter4j.TwitterException;
-import twitter4j.TwitterStream;
-import twitter4j.UserStream;
-import twitter4j.UserStreamListener;
-import twitter4j.auth.AccessToken;
-import twitter4j.auth.Authorization;
-import twitter4j.auth.RequestToken;
-import twitter4j.conf.Configuration;
-
-public class TwitterStreamMock implements TwitterStream {
- private StatusListener statusListener;
-
- public void updateStatus(String text) {
- statusListener.onStatus(new StatusMock(text));
- }
-
- @Override
- public void addConnectionLifeCycleListener(ConnectionLifeCycleListener listener) {
-
- }
-
- @Override
- public void addListener(UserStreamListener listener) {
-
- }
-
- @Override
- public void addListener(StatusListener listener) {
- this.statusListener = listener;
- }
-
- @Override
- public void addListener(SiteStreamsListener listener) {
-
- }
-
- @Override
- public void firehose(int count) {
-
- }
-
- @Override
- public StatusStream getFirehoseStream(int count) throws TwitterException {
- return null;
- }
-
- @Override
- public void links(int count) {
-
- }
-
- @Override
- public StatusStream getLinksStream(int count) throws TwitterException {
- return null;
- }
-
- @Override
- public void retweet() {
-
- }
-
- @Override
- public StatusStream getRetweetStream() throws TwitterException {
- return null;
- }
-
- @Override
- public void sample() {
-
- }
-
- @Override
- public StatusStream getSampleStream() throws TwitterException {
- return null;
- }
-
- @Override
- public void user() {
-
- }
-
- @Override
- public void user(String[] track) {
-
- }
-
- @Override
- public UserStream getUserStream() throws TwitterException {
- return null;
- }
-
- @Override
- public UserStream getUserStream(String[] track) throws TwitterException {
- return null;
- }
-
- @Override
- public void site(boolean withFollowings, long[] follow) {
-
- }
-
- @Override
- public void filter(FilterQuery query) {
-
- }
-
- @Override
- public StatusStream getFilterStream(FilterQuery query) throws TwitterException {
- return null;
- }
-
- @Override
- public void cleanUp() {
-
- }
-
- @Override
- public String getScreenName() throws TwitterException, IllegalStateException {
- return null;
- }
-
- @Override
- public long getId() throws TwitterException, IllegalStateException {
- return 0;
- }
-
- @Override
- public void addRateLimitStatusListener(RateLimitStatusListener listener) {
-
- }
-
- @Override
- public Authorization getAuthorization() {
- return null;
- }
-
- @Override
- public Configuration getConfiguration() {
- return null;
- }
-
- @Override
- public void shutdown() {
-
- }
-
- @Override
- public void setOAuthConsumer(String consumerKey, String consumerSecret) {
-
- }
-
- @Override
- public RequestToken getOAuthRequestToken() throws TwitterException {
- return null;
- }
-
- @Override
- public RequestToken getOAuthRequestToken(String callbackURL) throws TwitterException {
- return null;
- }
-
- @Override
- public RequestToken getOAuthRequestToken(String callbackURL, String xAuthAccessType)
- throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken() throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(String oauthVerifier) throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(RequestToken requestToken) throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(RequestToken requestToken, String oauthVerifier)
- throws TwitterException {
- return null;
- }
-
- @Override
- public AccessToken getOAuthAccessToken(String screenName, String password) throws TwitterException {
- return null;
- }
-
- @Override
- public void setOAuthAccessToken(AccessToken accessToken) {
-
- }
-
-}
diff --git a/components/camel-twitter/src/test/resources/log4j.properties b/components/camel-twitter/src/test/resources/log4j.properties
deleted file mode 100644
index 5f943d5..0000000
--- a/components/camel-twitter/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#
-# The logging properties used during tests..
-#
-log4j.rootLogger=INFO, file
-
-#log4j.logger.twitter4j=DEBUG
-#log4j.logger.org.apache.camel.component.twitter=DEBUG
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-twitter-test.log
-log4j.appender.file.append=true
diff --git a/components/camel-twitter/src/test/resources/test-options.properties b/components/camel-twitter/src/test/resources/test-options.properties
deleted file mode 100644
index a4dd8b6..0000000
--- a/components/camel-twitter/src/test/resources/test-options.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-
-#This uses the Twitter 'cameltweet' account for testing purposes.
-consumer.key=NMqaca1bzXsOcZhP2XlwA
-consumer.secret=VxNQiRLwwKVD0K9mmfxlTTbVdgRpriORypnUbHhxeQw
-access.token=26693234-W0YjxL9cMJrC0VZZ4xdgFMymxIQ10LeL1K8YlbBY
-access.token.secret=BZD51BgzbOdFstWZYsqB5p5dbuuDV12vrOdatzhY4E
\ No newline at end of file
diff --git a/components/camel-velocity/pom.xml b/components/camel-velocity/pom.xml
index ee3f074..37d0ba4 100644
--- a/components/camel-velocity/pom.xml
+++ b/components/camel-velocity/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -50,7 +50,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -69,12 +69,6 @@
<version>${commons-io-version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-tools</artifactId>
- <version>2.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
diff --git a/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityMethodInvokationTest.java b/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityMethodInvokationTest.java
deleted file mode 100644
index f26f29c..0000000
--- a/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityMethodInvokationTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.velocity;
-
-import javax.activation.DataHandler;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.velocity.tools.generic.EscapeTool;
-import org.junit.Test;
-
-public class VelocityMethodInvokationTest extends CamelTestSupport {
-
- @Test
- public void testVelocityLetter() throws Exception {
- final DataHandler dataHandler = new DataHandler("my attachment", "text/plain");
- Exchange exchange = template.request("direct:a", new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().addAttachment("item", dataHandler);
- exchange.getIn().setBody("Monday & Tuesday");
- exchange.getIn().setHeader("name", "Christian");
- exchange.setProperty("item", "7");
- }
- });
-
- assertEquals("Dear Christian. You ordered item 7 on Monday & Tuesday.", exchange.getOut().getBody());
- assertEquals("Christian", exchange.getOut().getHeader("name"));
- assertSame(dataHandler, exchange.getOut().getAttachment("item"));
- }
-
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- from("direct:a")
- .setHeader("esc", constant(new EscapeTool()))
- .to("velocity:org/apache/camel/component/velocity/escape.vm");
- }
- };
- }
-}
\ No newline at end of file
diff --git a/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm b/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm
deleted file mode 100644
index 7fa8720..0000000
--- a/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm
+++ /dev/null
@@ -1,17 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-Dear ${headers.name}. You ordered item ${exchange.properties.item} on $headers.esc.xml(${body}).
\ No newline at end of file
diff --git a/components/camel-web-standalone/pom.xml b/components/camel-web-standalone/pom.xml
index 5d9064d..eab3e94 100755
--- a/components/camel-web-standalone/pom.xml
+++ b/components/camel-web-standalone/pom.xml
@@ -20,7 +20,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>camel-web-standalone</artifactId>
diff --git a/components/camel-web/pom.xml b/components/camel-web/pom.xml
index 16ef25f..e675fbb 100644
--- a/components/camel-web/pom.xml
+++ b/components/camel-web/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>camel-web</artifactId>
@@ -251,19 +251,6 @@
</executions>
</plugin>
- <!-- mvn tomcat7:run -->
- <plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <version>2.0-beta-1</version>
- <configuration>
- <path>/</path>
- <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>
- </configuration>
- </plugin>
-
-
- <!-- mvn jetty:run -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
diff --git a/components/camel-web/src/main/java/org/apache/camel/web/resources/RoutesResource.java b/components/camel-web/src/main/java/org/apache/camel/web/resources/RoutesResource.java
index 6cf74e5..0f98b94 100644
--- a/components/camel-web/src/main/java/org/apache/camel/web/resources/RoutesResource.java
+++ b/components/camel-web/src/main/java/org/apache/camel/web/resources/RoutesResource.java
@@ -71,7 +71,6 @@
*/
@GET
@Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @SuppressWarnings("deprecation")
public RoutesDefinition getRouteDefinitions() {
RoutesDefinition answer = new RoutesDefinition();
CamelContext camelContext = getCamelContext();
diff --git a/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolver.java b/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolver.java
index 2b48c07..d194162 100644
--- a/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolver.java
+++ b/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolver.java
@@ -41,7 +41,7 @@
this.context = JAXBContext.newInstance(packages);
}
- public JAXBContext getContext(Class<?> objectType) {
+ public JAXBContext getContext(Class objectType) {
Package aPackage = objectType.getPackage();
if (aPackage != null) {
String name = aPackage.getName();
diff --git a/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java b/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
index 81f3ddb..7951a23 100644
--- a/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
+++ b/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
@@ -40,7 +40,7 @@
}
- public JAXBContext getContext(Class<?> objectType) {
+ public JAXBContext getContext(Class objectType) {
Package aPackage = objectType.getPackage();
if (aPackage != null) {
String name = aPackage.getName();
diff --git a/components/camel-web/src/main/java/org/apache/camel/web/util/JMXRouteStatistics.java b/components/camel-web/src/main/java/org/apache/camel/web/util/JMXRouteStatistics.java
index 08628ad..c169623 100644
--- a/components/camel-web/src/main/java/org/apache/camel/web/util/JMXRouteStatistics.java
+++ b/components/camel-web/src/main/java/org/apache/camel/web/util/JMXRouteStatistics.java
@@ -38,6 +38,7 @@
private static final Logger LOG = LoggerFactory.getLogger(JMXRouteStatistics.class);
+ @SuppressWarnings("unchecked")
public Object getRouteStatistic(CamelContext camelContext, String routeID, String attribute) {
// only possible if JMX is enabled
if (!(camelContext.getManagementStrategy() instanceof ManagedManagementStrategy)) {
@@ -49,7 +50,7 @@
String domain = camelContext.getManagementStrategy().getManagementAgent().getMBeanObjectDomainName();
ObjectName objName = new ObjectName(domain + ":type=routes,*");
- List<ObjectName> cacheList = new LinkedList<ObjectName>(server.queryNames(objName, null));
+ List<ObjectName> cacheList = new LinkedList(server.queryNames(objName, null));
for (Iterator<ObjectName> iter = cacheList.iterator(); iter.hasNext();) {
objName = iter.next();
String keyProps = objName.getCanonicalKeyPropertyListString();
diff --git a/components/camel-websocket/pom.xml b/components/camel-websocket/pom.xml
deleted file mode 100644
index f700a92..0000000
--- a/components/camel-websocket/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>camel-websocket</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: WebSocket</name>
- <description>Camel WebSocket</description>
-
- <properties>
- <camel.osgi.export.pkg>
- org.apache.camel.component.websocket.*;${camel.osgi.version}
- </camel.osgi.export.pkg>
- <camel.osgi.import.pkg>
- !org.apache.camel.component.websocket.*,
- ${camel.osgi.import.defaults},
- *
- </camel.osgi.import.pkg>
- </properties>
-
- <dependencies>
- <!-- Camel -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <!-- Jetty -->
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-websocket</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <!-- Unit test -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>de.roderick</groupId>
- <artifactId>weberknecht</artifactId>
- <version>0.1.1</version>
- <scope>test</scope>
- </dependency>
- <!-- logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>cubeindia</id>
- <url>http://m2.cubeia.com/nexus/content/repositories/thirdparty/</url>
- </repository>
- </repositories>
-</project>
\ No newline at end of file
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/DefaultWebsocket.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/DefaultWebsocket.java
deleted file mode 100644
index 4e5c7d2..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/DefaultWebsocket.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.io.Serializable;
-import java.util.UUID;
-
-import org.eclipse.jetty.websocket.WebSocket;
-import org.eclipse.jetty.websocket.WebSocket.OnTextMessage;
-
-public class DefaultWebsocket implements WebSocket, OnTextMessage, Serializable {
-
- private static final long serialVersionUID = -575701599776801400L;
- private Connection connection;
- private String connectionKey;
- private NodeSynchronization sync;
-
- private transient WebsocketConsumer consumer;
-
- public DefaultWebsocket(NodeSynchronization sync, WebsocketConsumer consumer) {
- this.sync = sync;
- this.consumer = consumer;
- }
-
- @Override
- public void onClose(int closeCode, String message) {
- sync.removeSocket(this);
- }
-
- @Override
- public void onOpen(Connection connection) {
- this.connection = connection;
-
- this.connectionKey = UUID.randomUUID().toString();
- sync.addSocket(this);
- }
-
- @Override
- public void onMessage(String message) {
- if (this.consumer != null) {
- this.consumer.sendExchange(this.connectionKey, message);
- }
- // consumer is not set, this is produce only websocket
- // TODO - 06.06.2011, LK - deliver exchange to dead letter channel
- }
-
- // getters and setters
- public Connection getConnection() {
- return connection;
- }
-
- public void setConnection(Connection connection) {
- this.connection = connection;
- }
-
- public String getConnectionKey() {
- return connectionKey;
- }
-
- public void setConnectionKey(String connectionKey) {
- this.connectionKey = connectionKey;
- }
-
- public void setConsumer(WebsocketConsumer consumer) {
- this.consumer = consumer;
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/MemoryWebsocketStore.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/MemoryWebsocketStore.java
deleted file mode 100644
index 6d7853e..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/MemoryWebsocketStore.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class MemoryWebsocketStore extends ConcurrentHashMap<String, DefaultWebsocket> implements WebsocketStore {
-
- private static final long serialVersionUID = -2826843758230613922L;
-
- @Override
- public void add(DefaultWebsocket ws) {
- super.put(ws.getConnectionKey(), ws);
- }
-
- @Override
- public void remove(DefaultWebsocket ws) {
- super.remove(ws.getConnectionKey());
- }
-
- @Override
- public void remove(String key) {
- super.remove(key);
- }
-
- @Override
- public DefaultWebsocket get(String key) {
- return super.get(key);
- }
-
- @Override
- public Collection<DefaultWebsocket> getAll() {
- return super.values();
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/NodeSynchronization.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/NodeSynchronization.java
deleted file mode 100644
index edec66c..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/NodeSynchronization.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-public interface NodeSynchronization {
-
- /** adds the Websocket to both (always if present) stores */
- void addSocket(DefaultWebsocket socket);
-
- /** deletes the Websocket from both stores */
- void removeSocket(String id);
-
- /** deletes the Websocket from both stores */
- void removeSocket(DefaultWebsocket socket);
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/NodeSynchronizationImpl.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/NodeSynchronizationImpl.java
deleted file mode 100644
index 23e804b..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/NodeSynchronizationImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-public class NodeSynchronizationImpl implements NodeSynchronization {
-
- private WebsocketStore memoryStore;
-
- private WebsocketStore globalStore;
-
- public NodeSynchronizationImpl(WebsocketStore memoryStore, WebsocketStore globalStore) {
- this.memoryStore = memoryStore;
- this.globalStore = globalStore;
- }
-
- public NodeSynchronizationImpl(WebsocketStore memoryStore) {
- this.memoryStore = memoryStore;
- }
-
- @Override
- public void addSocket(DefaultWebsocket socket) {
- memoryStore.add(socket);
- if (this.globalStore != null) {
- globalStore.add(socket);
- }
- }
-
- @Override
- public void removeSocket(String id) {
- memoryStore.remove(id);
- if (this.globalStore != null) {
- globalStore.remove(id);
- }
- }
-
- @Override
- public void removeSocket(DefaultWebsocket socket) {
- memoryStore.remove(socket);
- if (this.globalStore != null) {
- globalStore.remove(socket);
- }
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
deleted file mode 100644
index eca6d80..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.net.InetSocketAddress;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.SessionManager;
-import org.eclipse.jetty.server.session.HashSessionManager;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.servlet.DefaultServlet;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebsocketComponent extends DefaultComponent {
-
- private static final Logger LOG = LoggerFactory.getLogger(WebsocketComponent.class);
-
- private ServletContextHandler context;
- private Server server;
-
- /** Host name for server. */
- private String host = WebsocketConstants.DEFAULT_HOST;
-
- /** Port for server. */
- private int port = WebsocketConstants.DEFAULT_PORT;
-
- /** Server static content location. */
- private String staticResources;
-
- /**
- * Map for storing endpoints. Endpoint is identified by remaining part from endpoint URI. Eg. <tt>ws://foo?bar=123</tt> and <tt>ws://foo</tt> are referring to the same endpoint.
- */
- private Map<String, WebsocketEndpoint> endpoints = new HashMap<String, WebsocketEndpoint>();
-
- /**
- * Map for storing servlets. {@link WebsocketComponentServlet} is identified by pathSpec {@link String}.
- */
- private Map<String, WebsocketComponentServlet> servlets = new HashMap<String, WebsocketComponentServlet>();
-
- public WebsocketComponent() {
- }
-
- @Override
- protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
- WebsocketEndpoint endpoint = endpoints.get(remaining);
- if (endpoint == null) {
- WebsocketConfiguration websocketConfiguration = new WebsocketConfiguration();
- setProperties(websocketConfiguration, parameters);
- endpoint = new WebsocketEndpoint(uri, this, remaining, websocketConfiguration);
- endpoints.put(remaining, endpoint);
- }
- return endpoint;
- }
-
- /**
- * @param host
- * the host to set
- */
- public void setHost(String host) {
- this.host = host;
- }
-
- /**
- * @param port
- * the port to set
- */
- public void setPort(int port) {
- this.port = port;
- }
-
- /**
- * @param staticResources
- * the staticResources to set
- */
- public void setStaticResources(String staticResources) {
- this.staticResources = staticResources;
- }
-
- ServletContextHandler createContext() {
- return new ServletContextHandler(ServletContextHandler.SESSIONS);
- }
-
- protected Server createServer(ServletContextHandler context, String host, int port, String home) {
- InetSocketAddress address = new InetSocketAddress(host, port);
- Server server = new Server(address);
-
- context.setContextPath("/");
-
- SessionManager sm = new HashSessionManager();
- SessionHandler sh = new SessionHandler(sm);
- context.setSessionHandler(sh);
-
- if (home != null) {
- context.setResourceBase(home);
- DefaultServlet defaultServlet = new DefaultServlet();
- ServletHolder holder = new ServletHolder(defaultServlet);
-
- // avoid file locking on windows
- // http://stackoverflow.com/questions/184312/how-to-make-jetty-dynamically-load-static-pages
- holder.setInitParameter("useFileMappedBuffer", "false");
- context.addServlet(holder, "/");
- }
-
- server.setHandler(context);
-
- return server;
- }
-
- public WebsocketComponentServlet addServlet(NodeSynchronization sync, WebsocketConsumer consumer, String remaining) {
-
- String pathSpec = createPathSpec(remaining);
- WebsocketComponentServlet servlet = servlets.get(pathSpec);
- if (servlet == null) {
- servlet = createServlet(sync, pathSpec, servlets, context);
- }
- setServletConsumer(servlet, consumer);
- return servlet;
- }
-
- String createPathSpec(String remaining) {
- return String.format("/%s/*", remaining);
- }
-
- void setServletConsumer(WebsocketComponentServlet servlet, WebsocketConsumer consumer) {
- if (servlet.getConsumer() == null && consumer != null) {
- servlet.setConsumer(consumer);
- }
- }
-
- WebsocketComponentServlet createServlet(NodeSynchronization sync, String pathSpec, Map<String, WebsocketComponentServlet> servlets, ServletContextHandler handler) {
-
- WebsocketComponentServlet servlet = new WebsocketComponentServlet(sync);
- servlets.put(pathSpec, servlet);
- handler.addServlet(new ServletHolder(servlet), pathSpec);
- return servlet;
- }
-
- /**
- * @see org.apache.camel.impl.DefaultComponent#doStart()
- */
- @Override
- protected void doStart() throws Exception {
- super.doStart();
- LOG.info("Starting server {}:{}; static resources: {}", new Object[] {host, port, staticResources});
- context = createContext();
- server = createServer(context, host, port, staticResources);
- server.start();
- }
-
- /**
- * @see org.apache.camel.impl.DefaultComponent#doStop()
- */
- @Override
- public void doStop() throws Exception {
- if (server != null) {
- server.stop();
- }
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java
deleted file mode 100644
index 4e6cb8e..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.eclipse.jetty.websocket.WebSocket;
-import org.eclipse.jetty.websocket.WebSocketServlet;
-
-public class WebsocketComponentServlet extends WebSocketServlet {
-
- private static final long serialVersionUID = 207837507742337364L;
-
- private WebsocketConsumer consumer;
- private NodeSynchronization sync;
-
- public WebsocketComponentServlet(NodeSynchronization sync) {
- this.sync = sync;
- }
-
- /**
- * @return the consumer
- */
- public WebsocketConsumer getConsumer() {
- return consumer;
- }
-
- /**
- * @param consumer
- * the consumer to set
- */
- public void setConsumer(WebsocketConsumer consumer) {
- this.consumer = consumer;
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- getServletContext().getNamedDispatcher("default").forward(request, response);
- }
-
- @Override
- public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) {
- return new DefaultWebsocket(sync, consumer);
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConfiguration.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConfiguration.java
deleted file mode 100644
index 98d73a7..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConfiguration.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-public class WebsocketConfiguration {
-
- private String globalStore;
-
- public String getGlobalStore() {
- return globalStore;
- }
-
- public void setGlobalStore(String globalStore) {
- this.globalStore = globalStore;
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConstants.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConstants.java
deleted file mode 100644
index 91e4e0b..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-public final class WebsocketConstants {
-
- public static final int DEFAULT_PORT = 9292;
- public static final String CONNECTION_KEY = "websocket.connectionKey";
- public static final String SEND_TO_ALL = "websocket.sendToAll";
- public static final String DEFAULT_HOST = "0.0.0.0";
-
- private WebsocketConstants() {
- };
-
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConsumer.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConsumer.java
deleted file mode 100644
index 57a0685..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketConsumer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.impl.DefaultConsumer;
-
-public class WebsocketConsumer extends DefaultConsumer {
-
- public WebsocketConsumer(Endpoint endpoint, Processor processor) {
- super(endpoint, processor);
- }
-
- public void sendExchange(String connectionKey, String message) {
- Exchange exchange = this.getEndpoint().createExchange();
-
- // set header and body
- exchange.getIn().setHeader(WebsocketConstants.CONNECTION_KEY, connectionKey);
- exchange.getIn().setBody(message);
-
- // send exchange
- try {
- this.getProcessor().process(exchange);
- } catch (Exception e) {
- if (exchange.getException() != null) {
- this.getExceptionHandler().handleException(String.format("Error processing exchange for websocket consumer on message '%s'.", message), exchange, exchange.getException());
- }
- }
- }
-
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
deleted file mode 100644
index 24b787a..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketEndpoint.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.util.ObjectHelper;
-
-public class WebsocketEndpoint extends DefaultEndpoint {
-
- // Todo: Change to Options
- private NodeSynchronization sync;
- private String remaining;
-
- private WebsocketStore memoryStore;
- private WebsocketStore globalStore;
-
- private WebsocketConfiguration websocketConfiguration;
-
- public WebsocketEndpoint() {
-
- }
-
- public WebsocketEndpoint(String uri, WebsocketComponent component, String remaining, WebsocketConfiguration websocketConfiguration) throws InstantiationException, IllegalAccessException {
- super(uri, component);
- this.remaining = remaining;
-
- this.memoryStore = new MemoryWebsocketStore();
- // TODO: init globalStore
-
- this.websocketConfiguration = websocketConfiguration;
-
- if (websocketConfiguration.getGlobalStore() != null) {
- this.globalStore = (WebsocketStore) ObjectHelper.loadClass(this.websocketConfiguration.getGlobalStore()).newInstance();
- }
-
- // this.sync = new NodeSynchronizationImpl(this.memoryStore, null);
- this.sync = new NodeSynchronizationImpl(this.memoryStore, this.globalStore);
- }
-
- public WebsocketStore getMemoryStore() {
- return memoryStore;
- }
-
- public WebsocketStore getGlobalStore() {
- return globalStore;
- }
-
- @Override
- public Consumer createConsumer(Processor processor) throws Exception {
-
- // init consumer
- WebsocketConsumer consumer = new WebsocketConsumer(this, processor);
-
- // register servlet
- ((WebsocketComponent) super.getComponent()).addServlet(this.sync, consumer, this.remaining);
-
- return consumer;
- }
-
- @Override
- public Producer createProducer() throws Exception {
-
- // register servlet without consumer
- ((WebsocketComponent) super.getComponent()).addServlet(this.sync, null, this.remaining);
-
- return new WebsocketProducer(this, this.memoryStore);
- }
-
- @Override
- public boolean isSingleton() {
- return true;
- }
-
- // TODO --> implement store factory
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
deleted file mode 100644
index 43e9c43..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketProducer.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.impl.DefaultProducer;
-
-public class WebsocketProducer extends DefaultProducer {
-
- private WebsocketStore store;
-
- public WebsocketProducer(Endpoint endpoint) {
- super(endpoint);
- }
-
- public WebsocketProducer(Endpoint endpoint, WebsocketStore store) {
- super(endpoint);
- this.store = store;
- }
-
- @Override
- public void process(Exchange exchange) throws Exception {
-
- Message in = exchange.getIn();
- String message = in.getBody(String.class);
-
- if (isSendToAllSet(in)) {
- sendToAll(this.store, message);
- } else {
- // look for connection key and get Websocket
- String connectionKey = in.getHeader(WebsocketConstants.CONNECTION_KEY, String.class);
- if (connectionKey != null) {
- DefaultWebsocket websocket = store.get(connectionKey);
- sendMessage(websocket, message);
- } else {
- throw new IllegalArgumentException("Failed to send message to single connection; connetion key not set.");
- }
- }
- }
-
- boolean isSendToAllSet(Message in) {
- // header may be null; have to be careful here
- Object value = in.getHeader(WebsocketConstants.SEND_TO_ALL);
- return value == null ? false : (Boolean) value;
- }
-
- void sendToAll(WebsocketStore store, String message) throws Exception {
- Collection<DefaultWebsocket> websockets = store.getAll();
- Exception exception = null;
- for (DefaultWebsocket websocket : websockets) {
- try {
- sendMessage(websocket, message);
- } catch (Exception e) {
- if (exception == null) {
- exception = new Exception("Failed to deliver message to one or more recipients.", e);
- }
- }
- }
- if (exception != null) {
- throw exception;
- }
- }
-
- void sendMessage(DefaultWebsocket websocket, String message) throws IOException {
- // in case there is web socket and socket connection is open - send
- // message
- if (websocket != null && websocket.getConnection().isOpen()) {
- websocket.getConnection().sendMessage(message);
- }
- }
-}
diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketStore.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketStore.java
deleted file mode 100644
index 14dd985..0000000
--- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketStore.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.util.Collection;
-
-public interface WebsocketStore {
-
- void add(DefaultWebsocket ws);
-
- void remove(DefaultWebsocket ws);
-
- void remove(String key);
-
- DefaultWebsocket get(String key);
-
- Collection<DefaultWebsocket> getAll();
-}
diff --git a/components/camel-websocket/src/main/resources/META-INF/services/org/apache/camel/component/websocket b/components/camel-websocket/src/main/resources/META-INF/services/org/apache/camel/component/websocket
deleted file mode 100644
index 2409722..0000000
--- a/components/camel-websocket/src/main/resources/META-INF/services/org/apache/camel/component/websocket
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# 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.
-#
-class=org.apache.camel.component.websocket.WebsocketComponent
diff --git a/components/camel-websocket/src/test/integration/org/apache/camel/WebsocketComponentTest.java b/components/camel-websocket/src/test/integration/org/apache/camel/WebsocketComponentTest.java
deleted file mode 100644
index 066c042..0000000
--- a/components/camel-websocket/src/test/integration/org/apache/camel/WebsocketComponentTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-
-public class WebsocketComponentTest extends CamelTestSupport {
-
- @Test
- public void testWebsocketCall() throws Exception {
- Thread.sleep(15 * 60 * 1000);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- from("websocket://foo").log("received message: ").log(" --> ${body}").choice().when(body(Integer.class).isGreaterThan(500)).to("seda://greater500")
- .when(body(Integer.class).isLessThan(500)).to("seda://less500").otherwise().setBody(constant("request failed...")).to("websocket://foo");
-
- from("seda://greater500").setBody(constant("forms/c.xml")).log("C --> ${body}").to("websocket://foo");
-
- from("seda://less500").setBody(constant("forms/b.xml")).log("B --> ${body}").to("websocket://foo");
- }
- };
- }
-}
diff --git a/components/camel-websocket/src/test/integration/org/apache/camel/component/websocket/ProducerOnlyTest.java b/components/camel-websocket/src/test/integration/org/apache/camel/component/websocket/ProducerOnlyTest.java
deleted file mode 100644
index 3ce2a9e..0000000
--- a/components/camel-websocket/src/test/integration/org/apache/camel/component/websocket/ProducerOnlyTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- */
-public class ProducerOnlyTest extends CamelTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(WebsocketComponentLiveTest.class);
-
- @Test
- public void liveTest() throws Exception {
- LOG.info("*** open URL http://localhost:1989/producer-only.html ***");
- Thread.sleep(1 * 60 * 1000);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
-
- return new RouteBuilder() {
-
- private Counter counter = new Counter();
-
- public void configure() {
-
- WebsocketComponent component = getContext().getComponent("websocket", WebsocketComponent.class);
- component.setHost("localhost");
- component.setPort(1989);
- component.setStaticResources("src/test/resources");
-
- from("timer://foo?fixedRate=true&period=1000").bean(counter).setHeader(WebsocketConstants.SEND_TO_ALL, constant(true)).to("websocket://counter");
- }
- };
- }
-
- public class Counter {
-
- //private int counter = 0;
-
- private int counter;
-
- public int next() {
- return ++counter;
- }
- }
-}
diff --git a/components/camel-websocket/src/test/integration/org/apache/camel/component/websocket/WebsocketComponentLiveTest.java b/components/camel-websocket/src/test/integration/org/apache/camel/component/websocket/WebsocketComponentLiveTest.java
deleted file mode 100644
index c29052c..0000000
--- a/components/camel-websocket/src/test/integration/org/apache/camel/component/websocket/WebsocketComponentLiveTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- *
- */
-public class WebsocketComponentLiveTest extends CamelTestSupport {
-
- private static final Logger LOG = LoggerFactory.getLogger(WebsocketComponentLiveTest.class);
-
- @Test
- public void liveTest() throws Exception {
- LOG.info("*** open URL http://localhost:1989 and start chating ***");
- Thread.sleep(1 * 60 * 1000);
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
-
- WebsocketComponent component = getContext().getComponent("websocket", WebsocketComponent.class);
- component.setHost("localhost");
- component.setPort(1989);
- component.setStaticResources("src/test/resources");
-
- from("websocket://foo")
- .log("${body}")
- .setHeader(WebsocketConstants.SEND_TO_ALL, constant(true))
- .to("websocket://foo");
- }
- };
- }
-
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/DefaultWebsocketTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/DefaultWebsocketTest.java
deleted file mode 100644
index 07b617e..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/DefaultWebsocketTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.eclipse.jetty.websocket.WebSocket.Connection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class DefaultWebsocketTest {
-
- private static final int CLOSE_CODE = -1;
- private static final String MESSAGE = "message";
- private static final String CONNECTION_KEY = "random-connection-key";
-
- @Mock
- private Connection connection;
-
- @Mock
- private WebsocketConsumer consumer;
-
- @Mock
- private NodeSynchronization sync;
-
- private DefaultWebsocket defaultWebsocket;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- // sync = new NodeSynchronizationImpl(new MemoryWebsocketStore());
- defaultWebsocket = new DefaultWebsocket(sync, consumer);
- defaultWebsocket.setConnectionKey(CONNECTION_KEY);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#onClose(int, String)} .
- */
- @Test
- public void testOnClose() {
- defaultWebsocket.onClose(CLOSE_CODE, MESSAGE);
- InOrder inOrder = inOrder(connection, consumer, sync);
- inOrder.verify(sync, times(1)).removeSocket(defaultWebsocket);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#onOpen(org.eclipse.jetty.websocket.WebSocket.Connection)} .
- */
- @Test
- public void testOnOpen() {
- defaultWebsocket.onOpen(connection);
-
- /*
- * keyCaptor not functional anymore, because addSocket cannot be called with connectionKey
- *
- * InOrder inOrder = inOrder(connection, consumer, sync); ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class); inOrder.verify(sync,
- * times(1)).addSocket((eq(defaultWebsocket))); inOrder.verifyNoMoreInteractions();
- */
-
- assertEquals(connection, defaultWebsocket.getConnection());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#onMessage(String)} .
- */
- @Test
- public void testOnMessage() {
- defaultWebsocket.setConnectionKey(CONNECTION_KEY);
- defaultWebsocket.onMessage(MESSAGE);
- InOrder inOrder = inOrder(connection, consumer, sync);
- inOrder.verify(consumer, times(1)).sendExchange(CONNECTION_KEY, MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#onMessage(String)} .
- */
- @Test
- public void testOnMessageWithNullConsumer() {
- defaultWebsocket = new DefaultWebsocket(sync, null);
- defaultWebsocket.setConnectionKey(CONNECTION_KEY);
- defaultWebsocket.onMessage(MESSAGE);
- InOrder inOrder = inOrder(connection, consumer, sync);
- inOrder.verify(consumer, times(0)).sendExchange(CONNECTION_KEY, MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#getConnection()} .
- */
- @Test
- public void testGetConnection() {
- assertNull(defaultWebsocket.getConnection());
- defaultWebsocket.onOpen(connection);
- assertEquals(connection, defaultWebsocket.getConnection());
- defaultWebsocket.setConnection(null);
- assertNull(defaultWebsocket.getConnection());
- defaultWebsocket.setConnection(connection);
- assertEquals(connection, defaultWebsocket.getConnection());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#setConnection(org.eclipse.jetty.websocket.WebSocket.Connection)} .
- */
- @Test
- public void testSetConnection() {
- testGetConnection();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#getConnectionKey()} .
- */
- @Test
- public void testGetConnectionKey() {
- defaultWebsocket.setConnectionKey(null);
- assertNull(defaultWebsocket.getConnectionKey());
- defaultWebsocket.onOpen(connection);
- assertNotNull(defaultWebsocket.getConnectionKey());
- defaultWebsocket.setConnectionKey(CONNECTION_KEY);
- assertEquals(CONNECTION_KEY, defaultWebsocket.getConnectionKey());
- defaultWebsocket.setConnectionKey(null);
- assertNull(defaultWebsocket.getConnectionKey());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.DefaultWebsocket#setConnectionKey(String)} .
- */
- @Test
- public void testSetConnectionKey() {
- testGetConnectionKey();
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/MemoryWebsocketStoreTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/MemoryWebsocketStoreTest.java
deleted file mode 100644
index 0158eb5..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/MemoryWebsocketStoreTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.util.Collection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class MemoryWebsocketStoreTest {
-
- private static final String KEY_1 = "one";
- private static final String KEY_2 = "two";
-
- @Mock
- private WebsocketConsumer consumer;
-
- @Mock
- private NodeSynchronization sync;
-
- @Mock
- private DefaultWebsocket websocket1 = new DefaultWebsocket(sync, consumer);;
-
- @Mock
- private DefaultWebsocket websocket2 = new DefaultWebsocket(sync, consumer);;
-
- private MemoryWebsocketStore store;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- store = new MemoryWebsocketStore();
- when(websocket1.getConnectionKey()).thenReturn(KEY_1);
- when(websocket2.getConnectionKey()).thenReturn(KEY_2);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#add(String, org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testAdd() {
- assertNotNull(websocket1.getConnectionKey());
-
- store.add(websocket1);
- assertEquals(websocket1, store.get(KEY_1));
-
- store.add(websocket2);
- assertEquals(websocket2, store.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#add(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test(expected = NullPointerException.class)
- public void testAddNullValue() {
- store.add(null);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#remove(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testRemoveDefaultWebsocket() {
- // first call of websocket1.getConnectionKey()
- store.add(websocket1);
- assertEquals(websocket1, store.get(KEY_1));
- // second call of websocket1.getConnectionKey()
- store.remove(websocket1);
- assertNull(store.get(KEY_1));
-
- InOrder inOrder = inOrder(websocket1, websocket2);
- inOrder.verify(websocket1, times(2)).getConnectionKey();
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#remove(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testRemoveDefaultWebsocketKeyNotSet() {
- // first call of websocket1.getConnectionKey()
- store.add(websocket1);
-
- // overload getConnectionKey() after store.add() - otherwise npe
- when(websocket1.getConnectionKey()).thenReturn(null);
-
- assertEquals(websocket1, store.get(KEY_1));
-
- try {
- store.remove(websocket1);
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals(NullPointerException.class, e.getClass());
- }
-
- InOrder inOrder = inOrder(websocket1, websocket2);
- inOrder.verify(websocket1, times(2)).getConnectionKey();
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#remove(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testRemoveNotExisting() {
- websocket1.setConnectionKey(KEY_1);
- store.add(websocket1);
- assertEquals(websocket1, store.get(KEY_1));
- assertNull(store.get(KEY_2));
- store.remove(websocket2);
- assertEquals(websocket1, store.get(KEY_1));
- assertNull(store.get(KEY_2));
-
- InOrder inOrder = inOrder(websocket1, websocket2);
- inOrder.verify(websocket2, times(1)).getConnectionKey();
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#remove(String)} .
- */
- @Test
- public void testRemoveString() {
- websocket1.setConnectionKey(KEY_1);
- store.add(websocket1);
- assertEquals(websocket1, store.get(KEY_1));
- store.remove(KEY_1);
- assertNull(store.get(KEY_1));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#remove(String)} .
- */
- @Test
- public void testRemoveStringNotExisting() {
- websocket1.setConnectionKey(KEY_1);
- store.add(websocket1);
- assertEquals(websocket1, store.get(KEY_1));
- assertNull(store.get(KEY_2));
- store.remove(KEY_2);
- assertEquals(websocket1, store.get(KEY_1));
- assertNull(store.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#get(String)} .
- */
- @Test
- public void testGetString() {
- websocket1.setConnectionKey(KEY_1);
- store.add(websocket1);
- assertEquals(websocket1, store.get(KEY_1));
- assertNull(store.get(KEY_2));
- websocket2.setConnectionKey(KEY_2);
- store.add(websocket2);
- assertEquals(websocket1, store.get(KEY_1));
- assertEquals(websocket2, store.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.MemoryWebsocketStore#getAll()} .
- */
- @Test
- public void testGetAll() {
- Collection<DefaultWebsocket> sockets = store.getAll();
- assertNotNull(sockets);
- assertEquals(0, sockets.size());
-
- websocket1.setConnectionKey(KEY_1);
- store.add(websocket1);
- sockets = store.getAll();
- assertNotNull(sockets);
- assertEquals(1, sockets.size());
- assertTrue(sockets.contains(websocket1));
-
- websocket2.setConnectionKey(KEY_2);
- store.add(websocket2);
- sockets = store.getAll();
- assertNotNull(sockets);
- assertEquals(2, sockets.size());
- assertTrue(sockets.contains(websocket1));
- assertTrue(sockets.contains(websocket2));
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/NodeSynchronizationImplTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/NodeSynchronizationImplTest.java
deleted file mode 100644
index d1f3a58..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/NodeSynchronizationImplTest.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class NodeSynchronizationImplTest {
-
- private static final String KEY_1 = "one";
- private static final String KEY_2 = "two";
- private static final String KEY_3 = "three";
-
- @Mock
- private WebsocketConsumer consumer;
-
- private DefaultWebsocket websocket1;
- private DefaultWebsocket websocket2;
-
- private NodeSynchronization sync;
-
- private MemoryWebsocketStore store1;
- private MemoryWebsocketStore store2;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
-
- store1 = new MemoryWebsocketStore();
- store2 = new MemoryWebsocketStore();
-
- websocket1 = new DefaultWebsocket(sync, consumer);
- websocket1.setConnectionKey(KEY_1);
-
- websocket2 = new DefaultWebsocket(sync, consumer);
- websocket2.setConnectionKey(KEY_2);
-
- // when(websocket1.getConnectionKey()).thenReturn(KEY_1);
- // when(websocket2.getConnectionKey()).thenReturn(KEY_2);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#addSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testAddSocketMemoryAndGlobal() {
- sync = new NodeSynchronizationImpl(store1, store2);
-
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
- assertEquals(store1.get(KEY_1), store2.get(KEY_1));
-
- sync.addSocket(websocket2);
- assertEquals(websocket2, store1.get(KEY_2));
- assertEquals(store1.get(KEY_2), store2.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#addSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testAddSocketMemoryOnly() {
- sync = new NodeSynchronizationImpl(store1);
-
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#addSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testAddSocketMemoryAndNullGlobal() {
- sync = new NodeSynchronizationImpl(store1, null);
-
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#addSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test(expected = NullPointerException.class)
- public void testAddNullValue() {
- sync.addSocket(null);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#removeSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testRemoveDefaultWebsocket() {
- sync = new NodeSynchronizationImpl(store1, store2);
-
- // first call of websocket1.getConnectionKey()
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
- assertEquals(store1.get(KEY_1), store2.get(KEY_1));
-
- sync.addSocket(websocket2);
- assertEquals(websocket2, store1.get(KEY_2));
- assertEquals(store1.get(KEY_2), store2.get(KEY_2));
-
- // second call of websocket1.getConnectionKey()
- sync.removeSocket(websocket1);
- assertNull(store1.get(KEY_1));
- assertNull(store2.get(KEY_1));
-
- assertNotNull(store1.get(KEY_2));
- assertNotNull(store2.get(KEY_2));
-
- sync.removeSocket(websocket2);
- assertNull(store1.get(KEY_2));
- assertNull(store2.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#removeSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testRemoveDefaultWebsocketKeyNotSet() {
- sync = new NodeSynchronizationImpl(store1);
-
- // first call of websocket1.getConnectionKey()
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
-
- // setConnectionKey(null) after sync.addSocket()- otherwise npe
- websocket1.setConnectionKey(null);
-
- try {
- // second call of websocket1.getConnectionKey()
- sync.removeSocket(websocket1);
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals(NullPointerException.class, e.getClass());
- }
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#removeSocket(org.apache.camel.component.websocket.DefaultWebsocket)} .
- */
- @Test
- public void testRemoveNotExisting() {
- sync = new NodeSynchronizationImpl(store1);
-
- // first call of websocket1.getConnectionKey()
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
-
- assertNull(store1.get(KEY_2));
- sync.removeSocket(websocket2);
-
- assertEquals(websocket1, store1.get(KEY_1));
- assertNull(store1.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#removeSocket(String)} .
- */
- @Test
- public void testRemoveString() {
- sync = new NodeSynchronizationImpl(store1, store2);
-
- // first call of websocket1.getConnectionKey()
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
- assertEquals(store1.get(KEY_1), store2.get(KEY_1));
-
- sync.addSocket(websocket2);
- assertEquals(websocket2, store1.get(KEY_2));
- assertEquals(store1.get(KEY_2), store2.get(KEY_2));
-
- // second call of websocket1.getConnectionKey()
- sync.removeSocket(KEY_1);
- assertNull(store1.get(KEY_1));
- assertNull(store2.get(KEY_1));
-
- assertNotNull(store1.get(KEY_2));
- assertNotNull(store2.get(KEY_2));
-
- sync.removeSocket(KEY_2);
- assertNull(store1.get(KEY_2));
- assertNull(store2.get(KEY_2));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.NodeSynchronization#removeSocket(String)} .
- */
- @Test
- public void testRemoveStringNotExisting() {
-
- sync = new NodeSynchronizationImpl(store1);
-
- // first call of websocket1.getConnectionKey()
- sync.addSocket(websocket1);
- assertEquals(websocket1, store1.get(KEY_1));
-
- assertNull(store1.get(KEY_3));
- sync.removeSocket(KEY_3);
-
- assertEquals(websocket1, store1.get(KEY_1));
- assertNull(store1.get(KEY_3));
-
- }
-
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRoute2Test.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRoute2Test.java
deleted file mode 100644
index 09a0a6b..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRoute2Test.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.net.URI;
-
-import de.roderick.weberknecht.WebSocketConnection;
-import de.roderick.weberknecht.WebSocketEventHandler;
-import de.roderick.weberknecht.WebSocketMessage;
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.CamelTestSupport;
-import org.junit.Test;
-
-public class WebsocketClientCamelRoute2Test extends CamelTestSupport {
-
- @Test
- public void testWSHttpCall() throws Exception {
- getMockEndpoint("mock:websocket").expectedBodiesReceived(">> Welcome on board!");
-
- WebSocketConnection webSocketConnection = new WebSocketConnection(new URI("ws://127.0.0.1:9292/test"));
-
- // Register Event Handlers
- webSocketConnection.setEventHandler(new WebSocketEventHandler() {
- public void onOpen() {
- log.info("--open");
- }
-
- public void onMessage(WebSocketMessage message) {
- log.info("--received message: " + message.getText());
- }
-
- public void onClose() {
- log.info("--close");
- }
- });
-
- // Establish WebSocket Connection
- webSocketConnection.connect();
- log.info(">>> Connection established.");
-
- // Send Data
- webSocketConnection.send("Hello from WS Client");
-
- // Close WebSocket Connection
- webSocketConnection.close();
-
- getMockEndpoint("mock:websocket").assertIsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- from("websocket://test")
- .setExchangePattern(ExchangePattern.InOut)
- .log(">>> Message received from WebSocket Client : ${body}")
- .process(new Processor() {
- @Override
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setBody(">> Welcome on board!");
- }
- })
- .to("mock:websocket");
- }
- };
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java
deleted file mode 100644
index 2996bb7..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.net.URI;
-
-import de.roderick.weberknecht.WebSocketConnection;
-import de.roderick.weberknecht.WebSocketEventHandler;
-import de.roderick.weberknecht.WebSocketMessage;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.CamelTestSupport;
-import org.junit.Test;
-
-public class WebsocketClientCamelRouteTest extends CamelTestSupport {
-
- @Test
- public void testWSHttpCall() throws Exception {
- WebSocketConnection webSocketConnection = new WebSocketConnection(new URI("ws://127.0.0.1:9292/test"));
-
- // Register Event Handlers
- webSocketConnection.setEventHandler(new WebSocketEventHandler() {
- public void onOpen() {
- log.info("--open");
- }
-
- public void onMessage(WebSocketMessage message) {
- log.info("--received message: " + message.getText());
- }
-
- public void onClose() {
- log.info("--close");
- }
- });
-
- // Establish WebSocket Connection
- webSocketConnection.connect();
- log.info(">>> Connection established.");
-
- // Send Data
- webSocketConnection.send("Hello from WS Client");
-
- // Close WebSocket Connection
- webSocketConnection.close();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- public void configure() {
- from("websocket://test")
- .log(">>> Message received from WebSocket Client : ${body}")
- .loop(10)
- .setBody().constant(">> Welcome on board!")
- .to("websocket://test");
- }
- };
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java
deleted file mode 100644
index 7ff875c..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.eclipse.jetty.websocket.WebSocket;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class WebsocketComponentServletTest {
-
- private static final String PROTOCOL = "ws";
- private static final String MESSAGE = "message";
- private static final String CONNECTION_KEY = "random-connection-key";
-
- @Mock
- private WebsocketConsumer consumer;
-
- @Mock
- private NodeSynchronization sync;
-
- @Mock
- private HttpServletRequest request;
-
- private WebsocketComponentServlet websocketComponentServlet;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- websocketComponentServlet = new WebsocketComponentServlet(sync);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponentServlet#getConsumer()} .
- */
- @Test
- public void testGetConsumer() {
- assertNull(websocketComponentServlet.getConsumer());
- websocketComponentServlet.setConsumer(consumer);
- assertEquals(consumer, websocketComponentServlet.getConsumer());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponentServlet#setConsumer(org.apache.camel.component.websocket.WebsocketConsumer)} .
- */
- @Test
- public void testSetConsumer() {
- testGetConsumer();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponentServlet#doWebSocketConnect(javax.servlet.http.HttpServletRequest, String)} .
- */
- @Test
- public void testDoWebSocketConnect() {
- websocketComponentServlet.setConsumer(consumer);
- WebSocket webSocket = websocketComponentServlet.doWebSocketConnect(request, PROTOCOL);
- assertNotNull(webSocket);
- assertEquals(DefaultWebsocket.class, webSocket.getClass());
- DefaultWebsocket defaultWebsocket = (DefaultWebsocket) webSocket;
- defaultWebsocket.setConnectionKey(CONNECTION_KEY);
- defaultWebsocket.onMessage(MESSAGE);
- InOrder inOrder = inOrder(consumer, sync, request);
- inOrder.verify(consumer, times(1)).sendExchange(CONNECTION_KEY, MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponentServlet#doWebSocketConnect(javax.servlet.http.HttpServletRequest, String)} .
- */
- @Test
- public void testDoWebSocketConnectConsumerIsNull() {
- WebSocket webSocket = websocketComponentServlet.doWebSocketConnect(request, PROTOCOL);
- assertNotNull(webSocket);
- assertEquals(DefaultWebsocket.class, webSocket.getClass());
- DefaultWebsocket defaultWebsocket = (DefaultWebsocket) webSocket;
- defaultWebsocket.setConnectionKey(CONNECTION_KEY);
- defaultWebsocket.onMessage(MESSAGE);
- InOrder inOrder = inOrder(consumer, sync, request);
- inOrder.verifyNoMoreInteractions();
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java
deleted file mode 100644
index 289eea5..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class WebsocketComponentTest {
-
- private static final String PATH_ONE = "foo";
- private static final String PATH_TWO = "bar";
- private static final String PATH_SPEC_ONE = "/" + PATH_ONE + "/*";
- private static final String PATH_SPEC_TWO = "/" + PATH_TWO + "/*";
-
- @Mock
- private WebsocketConsumer consumer;
-
- @Mock
- private NodeSynchronization sync;
-
- @Mock
- private WebsocketComponentServlet servlet;
-
- @Mock
- private Map<String, WebsocketComponentServlet> servlets;
-
- @Mock
- private ServletContextHandler handler;
-
- @Mock
- private CamelContext camelContext;
-
- private WebsocketComponent component;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- component = new WebsocketComponent();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#createContext()} .
- */
- @Test
- public void testCreateContext() {
- ServletContextHandler handler = component.createContext();
- assertNotNull(handler);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#createServer(org.eclipse.jetty.servlet.ServletContextHandler, String, int, String)} .
- */
- @Test
- public void testCreateServerWithoutStaticContent() {
- ServletContextHandler handler = component.createContext();
- Server server = component.createServer(handler, "localhost", 1988, null);
- assertEquals(1, server.getConnectors().length);
- assertEquals("localhost", server.getConnectors()[0].getHost());
- assertEquals(1988, server.getConnectors()[0].getPort());
- assertFalse(server.getConnectors()[0].isStarted());
- assertEquals(handler, server.getHandler());
- assertEquals(1, server.getHandlers().length);
- assertEquals(handler, server.getHandlers()[0]);
- assertEquals("/", handler.getContextPath());
- assertNotNull(handler.getSessionHandler());
- assertNull(handler.getResourceBase());
- assertNull(handler.getServletHandler().getHolderEntry("/"));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#createServer(org.eclipse.jetty.servlet.ServletContextHandler, String, int, String)} .
- */
- @Test
- public void testCreateServerWithStaticContent() {
- ServletContextHandler handler = component.createContext();
- Server server = component.createServer(handler, "localhost", 1988, "public/");
- assertEquals(1, server.getConnectors().length);
- assertEquals("localhost", server.getConnectors()[0].getHost());
- assertEquals(1988, server.getConnectors()[0].getPort());
- assertFalse(server.getConnectors()[0].isStarted());
- assertEquals(handler, server.getHandler());
- assertEquals(1, server.getHandlers().length);
- assertEquals(handler, server.getHandlers()[0]);
- assertEquals("/", handler.getContextPath());
- assertNotNull(handler.getSessionHandler());
- assertNotNull(handler.getResourceBase());
- assertTrue(handler.getResourceBase().endsWith("public"));
- assertNotNull(handler.getServletHandler().getHolderEntry("/"));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#createEndpoint(String, String, java.util.Map)} .
- */
- @Test
- public void testCreateEndpoint() throws Exception {
- Map<String, Object> parameters = new HashMap<String, Object>();
-
- component.setCamelContext(camelContext);
-
- Endpoint e1 = component.createEndpoint("websocket://foo", "foo", parameters);
- Endpoint e2 = component.createEndpoint("websocket://foo", "foo", parameters);
- Endpoint e3 = component.createEndpoint("websocket://bar", "bar", parameters);
- assertNotNull(e1);
- assertNotNull(e1);
- assertNotNull(e1);
- assertEquals(e1, e2);
- assertNotSame(e1, e3);
- assertNotSame(e2, e3);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#setServletConsumer(WebsocketComponentServlet, WebsocketConsumer)} .
- */
- @Test
- public void testSetServletConsumer() throws Exception {
- when(servlet.getConsumer()).thenReturn(null, null, consumer);
- InOrder inOrder = inOrder(servlet, consumer, sync);
- component.setServletConsumer(servlet, null); // null && null
- inOrder.verify(servlet, times(0)).setConsumer(null);
- component.setServletConsumer(servlet, consumer); // null && not null
- inOrder.verify(servlet, times(1)).setConsumer(consumer);
- component.setServletConsumer(servlet, null); // not null && null
- inOrder.verify(servlet, times(0)).setConsumer(consumer);
- component.setServletConsumer(servlet, consumer); // not null && not null
- inOrder.verify(servlet, times(0)).setConsumer(consumer);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#createServlet(WebsocketStore, String, java.util.Map, ServletContextHandler)} .
- */
- @Test
- public void testCreateServlet() throws Exception {
- component.createServlet(sync, PATH_SPEC_ONE, servlets, handler);
- InOrder inOrder = inOrder(servlet, consumer, sync, servlets, handler);
- ArgumentCaptor<WebsocketComponentServlet> servletCaptor = ArgumentCaptor.forClass(WebsocketComponentServlet.class);
- inOrder.verify(servlets, times(1)).put(eq(PATH_SPEC_ONE), servletCaptor.capture());
- ArgumentCaptor<ServletHolder> holderCaptor = ArgumentCaptor.forClass(ServletHolder.class);
- inOrder.verify(handler, times(1)).addServlet(holderCaptor.capture(), eq(PATH_SPEC_ONE));
- inOrder.verifyNoMoreInteractions();
- assertEquals(servletCaptor.getValue(), holderCaptor.getValue().getServlet());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#createPathSpec(String)} .
- */
- @Test
- public void testCreatePathSpec() {
- assertEquals(PATH_SPEC_ONE, component.createPathSpec(PATH_ONE));
- assertEquals(PATH_SPEC_TWO, component.createPathSpec(PATH_TWO));
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#addServlet(WebsocketStore, WebsocketConsumer, String)} .
- */
- @Test
- public void testAddServletProducersOnly() throws Exception {
- component.setCamelContext(camelContext);
- component.setPort(0);
- component.doStart();
- WebsocketComponentServlet s1 = component.addServlet(sync, null, PATH_ONE);
- WebsocketComponentServlet s2 = component.addServlet(sync, null, PATH_TWO);
- assertNotNull(s1);
- assertNotNull(s2);
- assertNotSame(s1, s2);
- assertNull(s1.getConsumer());
- assertNull(s2.getConsumer());
- component.doStop();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#addServlet(WebsocketStore, WebsocketConsumer, String)} .
- */
- @Test
- public void testAddServletConsumersOnly() throws Exception {
- component.setCamelContext(camelContext);
- component.setPort(0);
- component.doStart();
- WebsocketComponentServlet s1 = component.addServlet(sync, consumer, PATH_ONE);
- WebsocketComponentServlet s2 = component.addServlet(sync, consumer, PATH_TWO);
- assertNotNull(s1);
- assertNotNull(s2);
- assertNotSame(s1, s2);
- assertEquals(consumer, s1.getConsumer());
- assertEquals(consumer, s2.getConsumer());
- component.doStop();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#addServlet(WebsocketStore, WebsocketConsumer, String)} .
- */
- @Test
- public void testAddServletProducerAndConsumer() throws Exception {
- component.setCamelContext(camelContext);
- component.setPort(0);
- component.doStart();
- WebsocketComponentServlet s1 = component.addServlet(sync, null, PATH_ONE);
- WebsocketComponentServlet s2 = component.addServlet(sync, consumer, PATH_ONE);
- assertNotNull(s1);
- assertNotNull(s2);
- assertEquals(s1, s2);
- assertEquals(consumer, s1.getConsumer());
- component.doStop();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketComponent#addServlet(WebsocketStore, WebsocketConsumer, String)} .
- */
- @Test
- public void testAddServletConsumerAndProducer() throws Exception {
- component.setCamelContext(camelContext);
- component.setPort(0);
- component.doStart();
- WebsocketComponentServlet s1 = component.addServlet(sync, consumer, PATH_ONE);
- WebsocketComponentServlet s2 = component.addServlet(sync, null, PATH_ONE);
- assertNotNull(s1);
- assertNotNull(s2);
- assertEquals(s1, s2);
- assertEquals(consumer, s1.getConsumer());
- component.doStop();
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConfigurationTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConfigurationTest.java
deleted file mode 100644
index d542417..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConfigurationTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.CamelContext;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-public class WebsocketConfigurationTest {
-
- private static final String REMAINING = "foo";
- private static final String URI = "websocket://" + REMAINING;
- private static final String PARAMETERS = "org.apache.camel.component.websocket.MemoryWebsocketStore";
-
- @Mock
- private WebsocketComponent component;
-
- @Mock
- private CamelContext camelContext;
-
- private WebsocketEndpoint websocketEndpoint;
-
- private WebsocketConfiguration wsConfig = new WebsocketConfiguration();
-
- @Before
- public void setUp() throws Exception {
- component = new WebsocketComponent();
- component.setCamelContext(camelContext);
- }
-
- @Test
- public void testParameters() throws Exception {
-
- assertNull(wsConfig.getGlobalStore());
-
- wsConfig.setGlobalStore(PARAMETERS);
-
- assertNotNull(wsConfig.getGlobalStore());
-
- websocketEndpoint = new WebsocketEndpoint(URI, component, REMAINING, wsConfig);
-
- assertNotNull(websocketEndpoint);
- assertNotNull(REMAINING);
- assertNotNull(wsConfig.getGlobalStore());
-
- }
-
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerTest.java
deleted file mode 100644
index ebf7b90..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketConsumerTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.spi.ExceptionHandler;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class WebsocketConsumerTest {
-
- private static final String CONNECTION_KEY = "random-connection-key";
- private static final String MESSAGE = "message";
-
- @Mock
- private Endpoint endpoint;
-
- @Mock
- private ExceptionHandler exceptionHandler;
-
- @Mock
- private Processor processor;
-
- @Mock
- private Exchange exchange;
-
- @Mock
- private Message outMessage;
-
- private Exception exception = new Exception("BAD NEWS EVERYONE!");
-
- private WebsocketConsumer websocketConsumer;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- websocketConsumer = new WebsocketConsumer(endpoint, processor);
- websocketConsumer.setExceptionHandler(exceptionHandler);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketConsumer#sendExchange(String, String)} .
- */
- @Test
- public void testSendExchange() throws Exception {
- when(endpoint.createExchange()).thenReturn(exchange);
- when(exchange.getIn()).thenReturn(outMessage);
-
- websocketConsumer.sendExchange(CONNECTION_KEY, MESSAGE);
-
- InOrder inOrder = inOrder(endpoint, exceptionHandler, processor, exchange, outMessage);
- inOrder.verify(endpoint, times(1)).createExchange();
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(outMessage, times(1)).setHeader(WebsocketConstants.CONNECTION_KEY, CONNECTION_KEY);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(outMessage, times(1)).setBody(MESSAGE);
- inOrder.verify(processor, times(1)).process(exchange);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketConsumer#sendExchange(String, String)} .
- */
- @Test
- public void testSendExchangeWithException() throws Exception {
- when(endpoint.createExchange()).thenReturn(exchange);
- when(exchange.getIn()).thenReturn(outMessage);
- doThrow(exception).when(processor).process(exchange);
- when(exchange.getException()).thenReturn(exception);
-
- websocketConsumer.sendExchange(CONNECTION_KEY, MESSAGE);
-
- InOrder inOrder = inOrder(endpoint, exceptionHandler, processor, exchange, outMessage);
- inOrder.verify(endpoint, times(1)).createExchange();
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(outMessage, times(1)).setHeader(WebsocketConstants.CONNECTION_KEY, CONNECTION_KEY);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(outMessage, times(1)).setBody(MESSAGE);
- inOrder.verify(processor, times(1)).process(exchange);
- inOrder.verify(exchange, times(2)).getException();
- inOrder.verify(exceptionHandler, times(1)).handleException(any(String.class), eq(exchange), eq(exception));
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketConsumer#sendExchange(String, String)} .
- */
- @Test
- public void testSendExchangeWithExchangeExceptionIsNull() throws Exception {
- when(endpoint.createExchange()).thenReturn(exchange);
- when(exchange.getIn()).thenReturn(outMessage);
- doThrow(exception).when(processor).process(exchange);
- when(exchange.getException()).thenReturn(null);
-
- websocketConsumer.sendExchange(CONNECTION_KEY, MESSAGE);
-
- InOrder inOrder = inOrder(endpoint, exceptionHandler, processor, exchange, outMessage);
- inOrder.verify(endpoint, times(1)).createExchange();
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(outMessage, times(1)).setHeader(WebsocketConstants.CONNECTION_KEY, CONNECTION_KEY);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(outMessage, times(1)).setBody(MESSAGE);
- inOrder.verify(processor, times(1)).process(exchange);
- inOrder.verify(exchange, times(1)).getException();
- inOrder.verifyNoMoreInteractions();
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointTest.java
deleted file mode 100644
index d6f6f3e..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketEndpointTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isNull;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class WebsocketEndpointTest {
-
- private static final String REMAINING = "foo/bar";
- private static final String URI = "websocket://" + REMAINING;
-
- @Mock
- private WebsocketComponent component;
-
- @Mock
- private Processor processor;
-
- private WebsocketEndpoint websocketEndpoint;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- websocketEndpoint = new WebsocketEndpoint(URI, component, REMAINING, new WebsocketConfiguration());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketEndpoint#createConsumer(org.apache.camel.Processor)} .
- */
- @Test
- public void testCreateConsumer() throws Exception {
- Consumer consumer = websocketEndpoint.createConsumer(processor);
- assertNotNull(consumer);
- assertEquals(WebsocketConsumer.class, consumer.getClass());
- InOrder inOrder = inOrder(component, processor);
- ArgumentCaptor<NodeSynchronization> synchronizationCaptor = ArgumentCaptor.forClass(NodeSynchronization.class);
- ArgumentCaptor<WebsocketConsumer> consumerCaptor = ArgumentCaptor.forClass(WebsocketConsumer.class);
- inOrder.verify(component, times(1)).addServlet(synchronizationCaptor.capture(), consumerCaptor.capture(), eq(REMAINING));
- inOrder.verifyNoMoreInteractions();
-
- assertEquals(NodeSynchronizationImpl.class, synchronizationCaptor.getValue().getClass());
-
- assertEquals(consumer, consumerCaptor.getValue());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketEndpoint#createProducer()} .
- */
- @Test
- public void testCreateProducer() throws Exception {
- Producer producer = websocketEndpoint.createProducer();
- assertNotNull(producer);
- assertEquals(WebsocketProducer.class, producer.getClass());
- InOrder inOrder = inOrder(component, processor);
- ArgumentCaptor<NodeSynchronization> synchronizationCaptor = ArgumentCaptor.forClass(NodeSynchronization.class);
- inOrder.verify(component, times(1)).addServlet(synchronizationCaptor.capture(), (WebsocketConsumer) isNull(), eq(REMAINING));
- inOrder.verifyNoMoreInteractions();
-
- assertEquals(NodeSynchronizationImpl.class, synchronizationCaptor.getValue().getClass());
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketEndpoint#isSingleton()} .
- */
- @Test
- public void testIsSingleton() {
- assertTrue(websocketEndpoint.isSingleton());
- }
-}
diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerTest.java
deleted file mode 100644
index 6692e26..0000000
--- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerTest.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.component.websocket;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.eclipse.jetty.websocket.WebSocket.Connection;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InOrder;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.when;
-
-/**
- *
- */
-@RunWith(MockitoJUnitRunner.class)
-public class WebsocketProducerTest {
-
- private static final String MESSAGE = "MESSAGE";
- private static final String SESSION_KEY = "random-session-key";
-
- @Mock
- private Endpoint endpoint;
-
- @Mock
- private WebsocketStore store;
-
- @Mock
- private Connection connection;
-
- @Mock
- private DefaultWebsocket defaultWebsocket1;
-
- @Mock
- private DefaultWebsocket defaultWebsocket2;
-
- @Mock
- private Exchange exchange;
-
- @Mock
- private Message inMessage;
-
- private IOException exception = new IOException("BAD NEWS EVERYONE!");
-
- private WebsocketProducer websocketProducer;
-
- private Collection<DefaultWebsocket> sockets;
-
- /**
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- websocketProducer = new WebsocketProducer(endpoint, store);
- sockets = Arrays.asList(defaultWebsocket1, defaultWebsocket2);
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#process(org.apache.camel.Exchange)} .
- */
- @Test
- public void testProcessSingleMessage() throws Exception {
- when(exchange.getIn()).thenReturn(inMessage);
- when(inMessage.getBody(String.class)).thenReturn(MESSAGE);
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(null);
- when(inMessage.getHeader(WebsocketConstants.CONNECTION_KEY, String.class)).thenReturn(SESSION_KEY);
- when(store.get(SESSION_KEY)).thenReturn(defaultWebsocket1);
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(true);
-
- websocketProducer.process(exchange);
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(inMessage, times(1)).getBody(String.class);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.CONNECTION_KEY, String.class);
- inOrder.verify(store, times(1)).get(SESSION_KEY);
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#process(org.apache.camel.Exchange)} .
- */
- @Test
- public void testProcessSingleMessageWithException() throws Exception {
- when(exchange.getIn()).thenReturn(inMessage);
- when(inMessage.getBody(String.class)).thenReturn(MESSAGE);
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(false);
- when(inMessage.getHeader(WebsocketConstants.CONNECTION_KEY, String.class)).thenReturn(SESSION_KEY);
- when(store.get(SESSION_KEY)).thenReturn(defaultWebsocket1);
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(true);
- doThrow(exception).when(connection).sendMessage(MESSAGE);
-
- try {
- websocketProducer.process(exchange);
- fail("Exception expected");
- } catch (IOException ioe) {
- assertEquals(exception, ioe);
- }
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(inMessage, times(1)).getBody(String.class);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.CONNECTION_KEY, String.class);
- inOrder.verify(store, times(1)).get(SESSION_KEY);
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#process(org.apache.camel.Exchange)} .
- */
- @Test
- public void testProcessMultipleMessages() throws Exception {
- when(exchange.getIn()).thenReturn(inMessage);
- when(inMessage.getBody(String.class)).thenReturn(MESSAGE);
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(true);
- when(store.getAll()).thenReturn(sockets);
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(defaultWebsocket2.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(true);
-
- websocketProducer.process(exchange);
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(inMessage, times(1)).getBody(String.class);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verify(store, times(1)).getAll();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#process(org.apache.camel.Exchange)} .
- */
- @Test
- public void testProcessMultipleMessagesWithExcpetion() throws Exception {
- when(exchange.getIn()).thenReturn(inMessage);
- when(inMessage.getBody(String.class)).thenReturn(MESSAGE);
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(true);
- when(store.getAll()).thenReturn(sockets);
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(defaultWebsocket2.getConnection()).thenReturn(connection);
- doThrow(exception).when(connection).sendMessage(MESSAGE);
- when(connection.isOpen()).thenReturn(true);
-
- try {
- websocketProducer.process(exchange);
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals(exception, e.getCause());
- }
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(inMessage, times(1)).getBody(String.class);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verify(store, times(1)).getAll();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#process(org.apache.camel.Exchange)} .
- */
- @Test
- public void testProcessSingleMessageNoConnectionKey() throws Exception {
- when(exchange.getIn()).thenReturn(inMessage);
- when(inMessage.getBody(String.class)).thenReturn(MESSAGE);
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(false);
- when(inMessage.getHeader(WebsocketConstants.CONNECTION_KEY, String.class)).thenReturn(null);
-
- try {
- websocketProducer.process(exchange);
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals(IllegalArgumentException.class, e.getClass());
- assertNotNull(e.getMessage());
- assertNull(e.getCause());
- }
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(exchange, times(1)).getIn();
- inOrder.verify(inMessage, times(1)).getBody(String.class);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.CONNECTION_KEY, String.class);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#sendMessage(org.apache.camel.component.websocket.DefaultWebsocket, String)} .
- */
- @Test
- public void testSendMessage() throws Exception {
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(true);
-
- websocketProducer.sendMessage(defaultWebsocket1, MESSAGE);
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#sendMessage(org.apache.camel.component.websocket.DefaultWebsocket, String)} .
- */
- @Test
- public void testSendMessageWebsocketIsNull() throws Exception {
-
- websocketProducer.sendMessage(null, MESSAGE);
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#sendMessage(org.apache.camel.component.websocket.DefaultWebsocket, String)} .
- */
- @Test
- public void testSendMessageConnetionIsClosed() throws Exception {
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(false);
-
- websocketProducer.sendMessage(defaultWebsocket1, MESSAGE);
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#sendMessage(org.apache.camel.component.websocket.DefaultWebsocket, String)} .
- */
- @Test
- public void testSendMessageWithException() throws Exception {
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(true);
- doThrow(exception).when(connection).sendMessage(MESSAGE);
-
- try {
- websocketProducer.sendMessage(defaultWebsocket1, MESSAGE);
- fail("Exception expected");
- } catch (IOException ioe) {
- assertEquals(exception, ioe);
- }
-
- InOrder inOrder = inOrder(endpoint, store, connection, defaultWebsocket1, defaultWebsocket2, exchange, inMessage);
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#isSendToAllSet(Message)} .
- */
- @Test
- public void testIsSendToAllSet() {
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(true, false);
- assertTrue(websocketProducer.isSendToAllSet(inMessage));
- assertFalse(websocketProducer.isSendToAllSet(inMessage));
- InOrder inOrder = inOrder(inMessage);
- inOrder.verify(inMessage, times(2)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#isSendToAllSet(Message)} .
- */
- @Test
- public void testIsSendToAllSetHeaderNull() {
- when(inMessage.getHeader(WebsocketConstants.SEND_TO_ALL)).thenReturn(null);
- assertFalse(websocketProducer.isSendToAllSet(inMessage));
- InOrder inOrder = inOrder(inMessage);
- inOrder.verify(inMessage, times(1)).getHeader(WebsocketConstants.SEND_TO_ALL);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#sendToAll(WebsocketStore, String)} .
- */
- @Test
- public void testSendToAll() throws Exception {
- when(store.getAll()).thenReturn(sockets);
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(defaultWebsocket2.getConnection()).thenReturn(connection);
- when(connection.isOpen()).thenReturn(true);
-
- websocketProducer.sendToAll(store, MESSAGE);
-
- InOrder inOrder = inOrder(store, connection, defaultWebsocket1, defaultWebsocket2);
- inOrder.verify(store, times(1)).getAll();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-
- /**
- * Test method for {@link org.apache.camel.component.websocket.WebsocketProducer#sendToAll(WebsocketStore, String)} .
- */
- @Test
- public void testSendToAllWithExcpetion() throws Exception {
- when(store.getAll()).thenReturn(sockets);
- when(defaultWebsocket1.getConnection()).thenReturn(connection);
- when(defaultWebsocket2.getConnection()).thenReturn(connection);
- doThrow(exception).when(connection).sendMessage(MESSAGE);
- when(connection.isOpen()).thenReturn(true);
-
- try {
- websocketProducer.sendToAll(store, MESSAGE);
- fail("Exception expected");
- } catch (Exception e) {
- assertEquals(exception, e.getCause());
- }
-
- InOrder inOrder = inOrder(store, connection, defaultWebsocket1, defaultWebsocket2);
- inOrder.verify(store, times(1)).getAll();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket1, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).isOpen();
- inOrder.verify(defaultWebsocket2, times(1)).getConnection();
- inOrder.verify(connection, times(1)).sendMessage(MESSAGE);
- inOrder.verifyNoMoreInteractions();
- }
-}
diff --git a/components/camel-websocket/src/test/resources/index.html b/components/camel-websocket/src/test/resources/index.html
deleted file mode 100644
index edf59c4..0000000
--- a/components/camel-websocket/src/test/resources/index.html
+++ /dev/null
@@ -1,109 +0,0 @@
-<html><head>
- <title>WebSocket Chat</title>
- <script type='text/javascript'>
-
- if (!window.WebSocket)
- alert("WebSocket not supported by this browser");
-
- function $() { return document.getElementById(arguments[0]); }
- function $F() { return document.getElementById(arguments[0]).value; }
-
- function getKeyCode(ev) { if (window.event) return window.event.keyCode; return ev.keyCode; }
-
- var room = {
- join: function(name) {
- this._username=name;
- var location = "ws://localhost:1989/foo/";
- this._ws=new WebSocket(location);
- this._ws.onopen=this._onopen;
- this._ws.onmessage=this._onmessage;
- this._ws.onclose=this._onclose;
- },
-
- _onopen: function(){
- $('join').className='hidden';
- $('joined').className='';
- $('phrase').focus();
- room._send(room._username,'has joined!');
- },
-
- _send: function(user,message){
- user=user.replace(':','_');
- if (this._ws)
- this._ws.send(user+':'+message);
- },
-
- chat: function(text) {
- if (text != null && text.length>0 )
- room._send(room._username,text);
- },
-
- _onmessage: function(m) {
- if (m.data){
- var c=m.data.indexOf(':');
- var from=m.data.substring(0,c).replace('<','<').replace('>','>');
- var text=m.data.substring(c+1).replace('<','<').replace('>','>');
-
- var chat=$('chat');
- var spanFrom = document.createElement('span');
- spanFrom.className='from';
- spanFrom.innerHTML=from+': ';
- var spanText = document.createElement('span');
- spanText.className='text';
- spanText.innerHTML=text;
- var lineBreak = document.createElement('br');
- chat.appendChild(spanFrom);
- chat.appendChild(spanText);
- chat.appendChild(lineBreak);
- chat.scrollTop = chat.scrollHeight - chat.clientHeight;
- }
- },
-
- _onclose: function(m) {
- this._ws=null;
- $('join').className='';
- $('joined').className='hidden';
- $('username').focus();
- $('chat').innerHTML='';
- }
-
- };
-
- </script>
- <style type='text/css'>
- div { border: 0px solid black; }
- div#chat { clear: both; width: 40em; height: 20ex; overflow: auto; background-color: #f0f0f0; padding: 4px; border: 1px solid black; }
- div#input { clear: both; width: 40em; padding: 4px; background-color: #e0e0e0; border: 1px solid black; border-top: 0px }
- input#phrase { width:30em; background-color: #e0f0f0; }
- input#username { width:14em; background-color: #e0f0f0; }
- div.hidden { display: none; }
- span.from { font-weight: bold; }
- span.alert { font-style: italic; }
- </style>
-</head><body>
-<div id='chat'></div>
-<div id='input'>
- <div id='join' >
- Username: <input id='username' type='text'/><input id='joinB' class='button' type='submit' name='join' value='Join'/>
- </div>
- <div id='joined' class='hidden'>
- Chat: <input id='phrase' type='text'/>
- <input id='sendB' class='button' type='submit' name='join' value='Send'/>
- </div>
-</div>
-<script type='text/javascript'>
-$('username').setAttribute('autocomplete','OFF');
-$('username').onkeyup = function(ev) { var keyc=getKeyCode(ev); if (keyc==13 || keyc==10) { room.join($F('username')); return false; } return true; } ;
-$('joinB').onclick = function(event) { room.join($F('username')); return false; };
-$('phrase').setAttribute('autocomplete','OFF');
-$('phrase').onkeyup = function(ev) { var keyc=getKeyCode(ev); if (keyc==13 || keyc==10) { room.chat($F('phrase')); $('phrase').value=''; return false; } return true; };
-$('sendB').onclick = function(event) { room.chat($F('phrase')); $('phrase').value=''; return false; };
-</script>
-
-<p>
-This is a demonstration of the Jetty websocket server.
-</p>
-</body></html>
-
-
-
\ No newline at end of file
diff --git a/components/camel-websocket/src/test/resources/log4j.properties b/components/camel-websocket/src/test/resources/log4j.properties
deleted file mode 100644
index ee9cfc2..0000000
--- a/components/camel-websocket/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used for testing
-#
-log4j.rootLogger=INFO, file
-
-# uncomment the following line to turn on Camel debugging
-#log4j.logger.org.apache.camel.component.websocket=DEBUG
-#log4j.logger.org.eclipse.jetty.websocket=DEBUG
-
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-#log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-log4j.appender.file.file=target/camel-netty-test.log
\ No newline at end of file
diff --git a/components/camel-websocket/src/test/resources/producer-only.html b/components/camel-websocket/src/test/resources/producer-only.html
deleted file mode 100644
index d5798a3..0000000
--- a/components/camel-websocket/src/test/resources/producer-only.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<html>
-<head>
- <title>WebSocket Chat</title>
- <script type='text/javascript'>
-
- if (!window.WebSocket) {
- alert("WebSocket not supported by this browser");
- }
-
- function $() { return document.getElementById(arguments[0]); }
-
- var room = {
- join: function(name) {
- this._username=name;
- var location = "ws://localhost:1989/counter/";
- this._ws=new WebSocket(location);
- this._ws.onmessage=this._onmessage;
- this._ws.onclose=this._onclose;
- },
-
- _onmessage: function(m) {
- if (m.data){
- var chat=$('chat');
- var spanText = document.createElement('span');
- spanText.className='text';
- spanText.innerHTML=m.data;
- var lineBreak = document.createElement('br');
- chat.appendChild(spanText);
- chat.appendChild(lineBreak);
- chat.scrollTop = chat.scrollHeight - chat.clientHeight;
- }
- },
-
- _onclose: function(m) {
- this._ws=null;
- }
-
- };
-
- </script>
- <style type='text/css'>
- div { border: 0px solid black; }
- div#chat { clear: both; width: 40em; height: 20ex; overflow: auto; background-color: #f0f0f0; padding: 4px; border: 1px solid black; }
- </style>
-</head>
-<body>
- <div id='chat'></div>
- <script type='text/javascript'>
- room.join("Testbot");
- </script>
-</body>
-</html>
diff --git a/components/camel-xmlbeans/pom.xml b/components/camel-xmlbeans/pom.xml
index 910de33..846f2bc 100644
--- a/components/camel-xmlbeans/pom.xml
+++ b/components/camel-xmlbeans/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-xmlsecurity/pom.xml b/components/camel-xmlsecurity/pom.xml
index a733180..55e6ad1 100755
--- a/components/camel-xmlsecurity/pom.xml
+++ b/components/camel-xmlsecurity/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-xmlsecurity</artifactId>
@@ -52,11 +52,6 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java
index ebff9b6..99f1f34 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java
@@ -29,18 +29,14 @@
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.jaxp.XmlConverter;
-
+import org.apache.log4j.Logger;
import org.apache.xml.security.encryption.XMLCipher;
import org.apache.xml.security.encryption.XMLEncryptionException;
-
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Assert;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class TestHelper {
protected static final String NS_XML_FRAGMENT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
@@ -88,7 +84,7 @@
HAS_3DES = ok;
}
- Logger log = LoggerFactory.getLogger(TestHelper.class);
+ Logger log = Logger.getLogger(TestHelper.class);
protected void sendText(final String fragment, CamelContext context) throws Exception {
ProducerTemplate template = context.createProducerTemplate();
@@ -99,7 +95,7 @@
exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
Message in = exchange.getIn();
in.setBody(fragment);
- log.info("xmlFragment: {}", fragment);
+ log.info("xmlFragment: " + fragment);
}
});
}
diff --git a/components/camel-xmpp/pom.xml b/components/camel-xmpp/pom.xml
index e1da131..636b50d 100644
--- a/components/camel-xmpp/pom.xml
+++ b/components/camel-xmpp/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
index c6d0442..f50ee37 100644
--- a/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
+++ b/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppEndpoint.java
@@ -145,7 +145,7 @@
return true;
}
});
- connection.addPacketSendingListener(new XmppLogger("OUTBOUND"), new PacketFilter() {
+ connection.addPacketWriterListener(new XmppLogger("OUTBOUND"), new PacketFilter() {
public boolean accept(Packet packet) {
return true;
}
diff --git a/components/camel-xstream/pom.xml b/components/camel-xstream/pom.xml
index d7e3ab9..0df1ad6 100644
--- a/components/camel-xstream/pom.xml
+++ b/components/camel-xstream/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
index 76d6ca7..b9b594b 100644
--- a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
+++ b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
@@ -107,14 +107,14 @@
Class<Converter> converterClass = resolver.resolveMandatoryClass(name, Converter.class);
Converter converter;
- Constructor<Converter> con = null;
+ Constructor con = null;
try {
con = converterClass.getDeclaredConstructor(new Class[] {XStream.class});
} catch (Exception e) {
//swallow as we null check in a moment.
}
if (con != null) {
- converter = con.newInstance(xstream);
+ converter = (Converter) con.newInstance(xstream);
} else {
converter = converterClass.newInstance();
try {
diff --git a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
index f78690d..49c8561 100644
--- a/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
+++ b/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
@@ -47,7 +47,7 @@
private final MappedXMLInputFactory mif;
public JsonDataFormat() {
- final Map<?, ?> nstjsons = new HashMap<Object, Object>();
+ final Map nstjsons = new HashMap();
mof = new MappedXMLOutputFactory(nstjsons);
mif = new MappedXMLInputFactory(nstjsons);
}
diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java
index 2992a12..ef11426 100644
--- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java
+++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java
@@ -74,7 +74,7 @@
mock.message(0).body().equals(order);
// we get it back as byte array so type convert it to string
- Object result = template.requestBody("direct:marshal", order);
+ Object result = (Object)template.requestBody("direct:marshal", order);
String body = context.getTypeConverter().convertTo(String.class, result);
template.sendBody("direct:reverse", body);
diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java
index 5a9c641..9a3d0e4 100644
--- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java
+++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamConfigurationTest.java
@@ -177,7 +177,6 @@
public static class PurchaseOrderConverter implements Converter {
- @SuppressWarnings("rawtypes")
public boolean canConvert(Class type) {
return PurchaseOrder.class.isAssignableFrom(type);
}
@@ -214,7 +213,6 @@
return null;
}
- @SuppressWarnings("rawtypes")
public boolean canConvert(Class type) {
return false;
}
@@ -240,7 +238,6 @@
return null;
}
- @SuppressWarnings("rawtypes")
public boolean canConvert(Class type) {
return false;
}
diff --git a/components/camel-zookeeper/pom.xml b/components/camel-zookeeper/pom.xml
index c1ff210..5f6da47 100644
--- a/components/camel-zookeeper/pom.xml
+++ b/components/camel-zookeeper/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>components</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-zookeeper</artifactId>
@@ -48,7 +48,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperMessage.java b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperMessage.java
index 6299527..f223866 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperMessage.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperMessage.java
@@ -43,8 +43,9 @@
public static final String ZOOKEEPER_STATISTICS = "CamelZookeeperStatistics";
+ @SuppressWarnings("unchecked")
public ZooKeeperMessage(String node, Stat statistics) {
- this(node, statistics, Collections.<String, Object>emptyMap());
+ this(node, statistics, Collections.EMPTY_MAP);
}
public ZooKeeperMessage(String node, Stat statistics, Map<String, Object> headers) {
diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperTestSupport.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperTestSupport.java
index 5f7d5c1..889c2b8 100644
--- a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperTestSupport.java
+++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZooKeeperTestSupport.java
@@ -34,8 +34,7 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.IOHelper;
-
+import org.apache.log4j.Logger;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
@@ -47,20 +46,16 @@
import org.apache.zookeeper.server.NIOServerCnxn;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class ZooKeeperTestSupport extends CamelTestSupport {
protected static TestZookeeperServer server;
protected static TestZookeeperClient client;
- private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperTestSupport.class);
+ private static final Logger LOG = Logger.getLogger(ZooKeeperTestSupport.class);
protected String testPayload = "This is a test";
@@ -146,7 +141,7 @@
public static int x;
- private final Logger log = LoggerFactory.getLogger(getClass());
+ private final Logger log = Logger.getLogger(getClass());
private ZooKeeper zk;
@@ -231,7 +226,7 @@
return true;
}
} catch (IOException e) {
- LOG.info("server {} not up {}", hp, e);
+ LOG.info("server " + hp + " not up " + e);
}
if (System.currentTimeMillis() > start + timeout) {
@@ -263,7 +258,7 @@
outstream.write(cmd.getBytes());
outstream.flush();
- reader = IOHelper.buffered(new InputStreamReader(sock.getInputStream()));
+ reader = new BufferedReader(new InputStreamReader(sock.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = reader.readLine()) != null) {
diff --git a/components/pom.xml b/components/pom.xml
index e72ad6a..ca235b5 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
@@ -34,8 +34,6 @@
<!-- we want to test these modules first to catch any errors early as possible -->
<module>camel-test</module>
<module>camel-testng</module>
- <module>camel-test-blueprint</module>
- <module>camel-test-spring</module>
<module>camel-core-osgi</module>
<module>camel-core-xml</module>
<module>camel-blueprint</module>
@@ -57,14 +55,11 @@
<module>camel-amqp</module>
<module>camel-apns</module>
<module>camel-atom</module>
- <module>camel-avro</module>
<module>camel-aws</module>
- <module>camel-beanio</module>
<module>camel-bean-validator</module>
<module>camel-bindy</module>
<module>camel-cache</module>
<module>camel-castor</module>
- <module>camel-cdi</module>
<module>camel-cometd</module>
<module>camel-context</module>
<module>camel-crypto</module>
@@ -79,7 +74,6 @@
<module>camel-freemarker</module>
<module>camel-ftp</module>
<module>camel-gae</module>
- <module>camel-gson</module>
<module>camel-guice</module>
<module>camel-hawtdb</module>
<module>camel-hazelcast</module>
@@ -99,7 +93,6 @@
<module>camel-jmx</module>
<module>camel-josql</module>
<module>camel-jpa</module>
- <module>camel-jsch</module>
<module>camel-jt400</module>
<module>camel-juel</module>
<module>camel-jxpath</module>
@@ -110,7 +103,6 @@
<module>camel-mail</module>
<module>camel-mina</module>
<module>camel-mina2</module>
- <module>camel-mongodb</module>
<module>camel-msv</module>
<module>camel-mvel</module>
<module>camel-mybatis</module>
@@ -141,15 +133,12 @@
<module>camel-spring-security</module>
<module>camel-spring-ws</module>
<module>camel-sql</module>
- <module>camel-ssh</module>
<module>camel-stax</module>
<module>camel-stream</module>
<module>camel-stringtemplate</module>
<module>camel-syslog</module>
<module>camel-tagsoup</module>
- <module>camel-twitter</module>
<module>camel-velocity</module>
- <module>camel-websocket</module>
<module>camel-xmlbeans</module>
<module>camel-xmlsecurity</module>
<module>camel-xmpp</module>
diff --git a/etc/pom.xml b/etc/pom.xml
index d4e89ef..a188ecf 100755
--- a/etc/pom.xml
+++ b/etc/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/examples/camel-example-aggregate/pom.xml b/examples/camel-example-aggregate/pom.xml
index aa4b100..5930aae 100644
--- a/examples/camel-example-aggregate/pom.xml
+++ b/examples/camel-example-aggregate/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-bam/pom.xml b/examples/camel-example-bam/pom.xml
index 571d26e..275f956 100644
--- a/examples/camel-example-bam/pom.xml
+++ b/examples/camel-example-bam/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-cafe/pom.xml b/examples/camel-example-cafe/pom.xml
index 8507a6d..162f718 100755
--- a/examples/camel-example-cafe/pom.xml
+++ b/examples/camel-example-cafe/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-cxf-blueprint/pom.xml b/examples/camel-example-cxf-blueprint/pom.xml
index cdafb0d..d3a7034 100644
--- a/examples/camel-example-cxf-blueprint/pom.xml
+++ b/examples/camel-example-cxf-blueprint/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -58,7 +58,7 @@
<!-- test -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/examples/camel-example-cxf-osgi/pom.xml b/examples/camel-example-cxf-osgi/pom.xml
index ef896a2..bbec8f9 100644
--- a/examples/camel-example-cxf-osgi/pom.xml
+++ b/examples/camel-example-cxf-osgi/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -68,7 +68,7 @@
<!-- test -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/examples/camel-example-cxf-osgi/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesClientTest.java b/examples/camel-example-cxf-osgi/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesClientTest.java
index 3ad0f99..d073390 100755
--- a/examples/camel-example-cxf-osgi/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesClientTest.java
+++ b/examples/camel-example-cxf-osgi/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesClientTest.java
@@ -16,10 +16,12 @@
*/
package org.apache.camel.example.reportincident;
+import java.io.File;
+import java.io.FileOutputStream;
+
import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.test.junit4.CamelSpringTestSupport;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
@@ -31,17 +33,18 @@
public class ReportIncidentRoutesClientTest extends CamelSpringTestSupport {
// should be the same address as we have in our route
- private static final String URL = "http://localhost:%s/cxf/camel-example-cxf-osgi/webservices/incident";
- private static final int PORT = AvailablePortFinder.getNextAvailable();
-
+ private static final String URL = "http://localhost:{{port}}/cxf/camel-example-cxf-osgi/webservices/incident";
+
@BeforeClass
- public static void setUpBeforeClass() {
- System.setProperty("port", String.valueOf(PORT));
- }
-
- @AfterClass
- public static void tearDownBeforeClass() {
- System.clearProperty("port");
+ public static void setupFreePort() throws Exception {
+ // find a free port number from 9100 onwards, and write that in the custom.properties file
+ // which we will use for the unit tests, to avoid port number in use problems
+ int port = AvailablePortFinder.getNextAvailable(9100);
+ String s = "port=" + port;
+ File custom = new File("target/custom.properties");
+ FileOutputStream fos = new FileOutputStream(custom);
+ fos.write(s.getBytes());
+ fos.close();
}
protected static ReportIncidentEndpoint createCXFClient(String url) {
@@ -66,7 +69,8 @@
input.setPhone("0045 2962 7576");
// create the webservice client and send the request
- ReportIncidentEndpoint client = createCXFClient(String.format(URL, PORT));
+ String url = context.resolvePropertyPlaceholders(URL);
+ ReportIncidentEndpoint client = createCXFClient(url);
OutputReportIncident out = client.reportIncident(input);
// assert we got a OK back
@@ -79,9 +83,10 @@
// assert we got a Accept back
assertEquals("Accepted", out.getCode());
}
-
+
@Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext(new String[] {"camel-context.xml"});
}
-}
\ No newline at end of file
+
+}
diff --git a/examples/camel-example-cxf-osgi/src/test/resources/camel-context.xml b/examples/camel-example-cxf-osgi/src/test/resources/camel-context.xml
index 820a8c9..5fe8481 100644
--- a/examples/camel-example-cxf-osgi/src/test/resources/camel-context.xml
+++ b/examples/camel-example-cxf-osgi/src/test/resources/camel-context.xml
@@ -24,12 +24,9 @@
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
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
-
- <!-- resolve dynamicly the port number from a system property -->
- <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
<cxf:cxfEndpoint id="reportIncident"
- address="http://localhost:${port}/cxf/camel-example-cxf-osgi/webservices/incident"
+ address="http://localhost:{{port}}/cxf/camel-example-cxf-osgi/webservices/incident"
wsdlURL="META-INF/wsdl/report_incident.wsdl"
serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint">
</cxf:cxfEndpoint>
@@ -37,6 +34,8 @@
<bean id="reportIncidentRoutes" class="org.apache.camel.example.reportincident.ReportIncidentRoutes" />
<camel:camelContext id="camel">
+ <!-- property which contains port number -->
+ <camel:propertyPlaceholder id="properties" location="file:target/custom.properties"/>
<camel:routeBuilder ref="reportIncidentRoutes"/>
</camel:camelContext>
</beans>
diff --git a/examples/camel-example-cxf-proxy/pom.xml b/examples/camel-example-cxf-proxy/pom.xml
index b26b2b4..1e41c06 100755
--- a/examples/camel-example-cxf-proxy/pom.xml
+++ b/examples/camel-example-cxf-proxy/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-cxf-tomcat/pom.xml b/examples/camel-example-cxf-tomcat/pom.xml
index 05862a1..753f0c4 100755
--- a/examples/camel-example-cxf-tomcat/pom.xml
+++ b/examples/camel-example-cxf-tomcat/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-cxf/pom.xml b/examples/camel-example-cxf/pom.xml
index 13d8e7f..dcb472e 100644
--- a/examples/camel-example-cxf/pom.xml
+++ b/examples/camel-example-cxf/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -144,7 +144,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/jaxrs/JAXRSClient.java b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/jaxrs/JAXRSClient.java
index 8e38bfe..5066705 100644
--- a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/jaxrs/JAXRSClient.java
+++ b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/jaxrs/JAXRSClient.java
@@ -30,7 +30,7 @@
private BookStore bookStore;
public JAXRSClient() {
- bookStore = JAXRSClientFactory.create(
+ bookStore = (BookStore) JAXRSClientFactory.create(
"http://localhost:9002/rest",
BookStore.class,
Collections.singletonList(new TestResponseExceptionMapper()));
diff --git a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/Client.java b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/Client.java
index f87aaa8..25a501b 100644
--- a/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/Client.java
+++ b/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/Client.java
@@ -58,7 +58,7 @@
Service.Mode.MESSAGE);
// Use Dispatch as BindingProvider
- BindingProvider bp = dispatch;
+ BindingProvider bp = (BindingProvider)dispatch;
MessageFactory factory = ((SOAPBinding)bp.getBinding()).getMessageFactory();
diff --git a/examples/camel-example-docs/pom.xml b/examples/camel-example-docs/pom.xml
index b9d56a1..829eab4 100755
--- a/examples/camel-example-docs/pom.xml
+++ b/examples/camel-example-docs/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-etl/pom.xml b/examples/camel-example-etl/pom.xml
index e83375f..04ca991 100755
--- a/examples/camel-example-etl/pom.xml
+++ b/examples/camel-example-etl/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-gae/pom.xml b/examples/camel-example-gae/pom.xml
index 957c3b0..3a26664 100644
--- a/examples/camel-example-gae/pom.xml
+++ b/examples/camel-example-gae/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-gauth/pom.xml b/examples/camel-example-gauth/pom.xml
index 32e2c8f..8d9ddba 100644
--- a/examples/camel-example-gauth/pom.xml
+++ b/examples/camel-example-gauth/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-guice-jms/pom.xml b/examples/camel-example-guice-jms/pom.xml
index 2b69a5d..9132774 100644
--- a/examples/camel-example-guice-jms/pom.xml
+++ b/examples/camel-example-guice-jms/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-jms-file/pom.xml b/examples/camel-example-jms-file/pom.xml
index 124c663..22f8292 100755
--- a/examples/camel-example-jms-file/pom.xml
+++ b/examples/camel-example-jms-file/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-jmx/pom.xml b/examples/camel-example-jmx/pom.xml
index 7c1a6de..cf6c798 100644
--- a/examples/camel-example-jmx/pom.xml
+++ b/examples/camel-example-jmx/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-loadbalancing/pom.xml b/examples/camel-example-loadbalancing/pom.xml
index 67b590c..ad42a2f 100644
--- a/examples/camel-example-loadbalancing/pom.xml
+++ b/examples/camel-example-loadbalancing/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-example-loadbalancing</artifactId>
diff --git a/examples/camel-example-loan-broker/pom.xml b/examples/camel-example-loan-broker/pom.xml
index 67c2c50..dc88e65 100644
--- a/examples/camel-example-loan-broker/pom.xml
+++ b/examples/camel-example-loan-broker/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -102,7 +102,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java
index 657de5c..887983e 100644
--- a/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java
+++ b/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/BankResponseAggregationStrategy.java
@@ -17,6 +17,7 @@
package org.apache.camel.loanbroker.queue.version;
import org.apache.camel.Exchange;
+import org.apache.camel.loanbroker.webservice.version.bank.BankQuote;
import org.apache.camel.processor.aggregate.AggregationStrategy;
//START SNIPPET: aggregation
diff --git a/examples/camel-example-management/pom.xml b/examples/camel-example-management/pom.xml
index 828dccf..f2bc315 100644
--- a/examples/camel-example-management/pom.xml
+++ b/examples/camel-example-management/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -72,7 +72,7 @@
<!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/examples/camel-example-osgi-rmi/pom.xml b/examples/camel-example-osgi-rmi/pom.xml
index 100b7d4..eba3430 100644
--- a/examples/camel-example-osgi-rmi/pom.xml
+++ b/examples/camel-example-osgi-rmi/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-example-osgi-rmi</artifactId>
@@ -53,7 +53,7 @@
<!-- for unit testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/examples/camel-example-osgi/pom.xml b/examples/camel-example-osgi/pom.xml
index 41bc613..927580f 100644
--- a/examples/camel-example-osgi/pom.xml
+++ b/examples/camel-example-osgi/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-pojo-messaging/pom.xml b/examples/camel-example-pojo-messaging/pom.xml
index a0b7910..7e4e91d 100644
--- a/examples/camel-example-pojo-messaging/pom.xml
+++ b/examples/camel-example-pojo-messaging/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -81,7 +81,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/examples/camel-example-pojo-messaging/src/test/java/org/apache/camel/example/pojo_messaging/CamelContextTest.java b/examples/camel-example-pojo-messaging/src/test/java/org/apache/camel/example/pojo_messaging/CamelContextTest.java
index 6537f2d..2781356 100644
--- a/examples/camel-example-pojo-messaging/src/test/java/org/apache/camel/example/pojo_messaging/CamelContextTest.java
+++ b/examples/camel-example-pojo-messaging/src/test/java/org/apache/camel/example/pojo_messaging/CamelContextTest.java
@@ -26,6 +26,10 @@
public class CamelContextTest extends CamelSpringTestSupport {
+ protected int getExpectedRouteCount() {
+ return 0;
+ }
+
@Before
public void setUp() throws Exception {
deleteDirectory("target/messages");
diff --git a/examples/camel-example-reportincident-wssecurity/pom.xml b/examples/camel-example-reportincident-wssecurity/pom.xml
index ae558fc..2dad2bd 100644
--- a/examples/camel-example-reportincident-wssecurity/pom.xml
+++ b/examples/camel-example-reportincident-wssecurity/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -46,7 +46,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/examples/camel-example-reportincident/pom.xml b/examples/camel-example-reportincident/pom.xml
index 4dd741c..3dff9ac 100755
--- a/examples/camel-example-reportincident/pom.xml
+++ b/examples/camel-example-reportincident/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-route-throttling/pom.xml b/examples/camel-example-route-throttling/pom.xml
index 0a62087..e03b440 100644
--- a/examples/camel-example-route-throttling/pom.xml
+++ b/examples/camel-example-route-throttling/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-servlet-tomcat/pom.xml b/examples/camel-example-servlet-tomcat/pom.xml
index 10a7ad1..e002674 100755
--- a/examples/camel-example-servlet-tomcat/pom.xml
+++ b/examples/camel-example-servlet-tomcat/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-example-servlet-tomcat</artifactId>
diff --git a/examples/camel-example-simplejirabot/javadsl/pom.xml b/examples/camel-example-simplejirabot/javadsl/pom.xml
index 16ab43c..4f8b757 100644
--- a/examples/camel-example-simplejirabot/javadsl/pom.xml
+++ b/examples/camel-example-simplejirabot/javadsl/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>camel-example-simplejirabot</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/examples/camel-example-simplejirabot/pom.xml b/examples/camel-example-simplejirabot/pom.xml
index 40c4fb5..16ed981 100644
--- a/examples/camel-example-simplejirabot/pom.xml
+++ b/examples/camel-example-simplejirabot/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-example-simplejirabot</artifactId>
diff --git a/examples/camel-example-simplejirabot/xmlconf/pom.xml b/examples/camel-example-simplejirabot/xmlconf/pom.xml
index 0a6837d..18ea31a 100644
--- a/examples/camel-example-simplejirabot/xmlconf/pom.xml
+++ b/examples/camel-example-simplejirabot/xmlconf/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>camel-example-simplejirabot</artifactId>
<groupId>org.apache.camel</groupId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/examples/camel-example-spring-javaconfig/pom.xml b/examples/camel-example-spring-javaconfig/pom.xml
index ff7f437..284fcb9 100644
--- a/examples/camel-example-spring-javaconfig/pom.xml
+++ b/examples/camel-example-spring-javaconfig/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-spring-jms/pom.xml b/examples/camel-example-spring-jms/pom.xml
index 4f880e8..d0e4454 100644
--- a/examples/camel-example-spring-jms/pom.xml
+++ b/examples/camel-example-spring-jms/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -84,7 +84,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
diff --git a/examples/camel-example-spring-security/pom.xml b/examples/camel-example-spring-security/pom.xml
index b293061..d9cb6b2 100755
--- a/examples/camel-example-spring-security/pom.xml
+++ b/examples/camel-example-spring-security/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -33,27 +33,33 @@
<description>An example showing how to work with Camel and Spring Security</description>
<dependencies>
+
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-security</artifactId>
</dependency>
+
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring-security-version}</version>
</dependency>
+
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
</dependency>
+
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
+
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/examples/camel-example-spring-ws/pom.xml b/examples/camel-example-spring-ws/pom.xml
index 6310e77..c2530dc 100644
--- a/examples/camel-example-spring-ws/pom.xml
+++ b/examples/camel-example-spring-ws/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-example-spring-ws</artifactId>
diff --git a/examples/camel-example-spring-xquery/pom.xml b/examples/camel-example-spring-xquery/pom.xml
index 4dcd07e0..7121a21 100755
--- a/examples/camel-example-spring-xquery/pom.xml
+++ b/examples/camel-example-spring-xquery/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-spring/pom.xml b/examples/camel-example-spring/pom.xml
index ac82337..cac2ea7 100755
--- a/examples/camel-example-spring/pom.xml
+++ b/examples/camel-example-spring/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/camel-example-ssh/README.txt b/examples/camel-example-ssh/README.txt
deleted file mode 100644
index 26e0c61..0000000
--- a/examples/camel-example-ssh/README.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-SSH Example
-=====================
-
-This example shows how use SSH with Camel. It can be run using Maven.
-
-This example is built assuming you have a running Apache ServiceMix container with the default SSH port 8101 and
-username / password of smx/smx.
-
-Running from cmd line outside OSGi container
-============================================
-
-You will need to compile this example first:
- mvn compile
-
-To run the example using Maven type
- mvn camel:run
-
-To stop the example hit ctrl + c
-
-
-
-Running inside OSGi container
-=============================
-
-You will need to compile and install this example first:
- mvn compile install
-
-If using Apache Karaf / Apache ServiceMix you can install this example
-from the shell
-
- > features:addurl mvn:org.apache.camel/camel-example-ssh/<camel version>/xml/features
- > features:install camel-example-ssh
-
-If you hit any problems please let us know on the Camel Forums
- http://camel.apache.org/discussion-forums.html
-
-Please help us make Apache Camel better - we appreciate any feedback you
-may have. Enjoy!
-
-------------------------
-The Camel riders!
-
diff --git a/examples/camel-example-ssh/pom.xml b/examples/camel-example-ssh/pom.xml
deleted file mode 100644
index 5a845f2..0000000
--- a/examples/camel-example-ssh/pom.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?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.
-
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>camel-example-ssh</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Example :: SSH</name>
- <description>A simple SSH example which creates a bundle that can be dropped into any OSGi container</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.example.ssh.*</camel.osgi.export.pkg>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-ssh</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>${mina2-version}</version>
- </dependency>
-
- <!-- used for mvn camel:run -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>${slf4j-version}</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <!-- to generate the MANIFEST-FILE of the bundle -->
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.apache.camel.component.ssh,
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>target/classes/features.xml</file>
- <type>xml</type>
- <classifier>features</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <!-- Allows the routes to be run via 'mvn camel:run' -->
- <plugin>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-maven-plugin</artifactId>
- </plugin>
- </plugins>
-
- </build>
-
-</project>
diff --git a/examples/camel-example-ssh/src/main/resources/META-INF/LICENSE.txt b/examples/camel-example-ssh/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/examples/camel-example-ssh/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
diff --git a/examples/camel-example-ssh/src/main/resources/META-INF/NOTICE.txt b/examples/camel-example-ssh/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 2e215bf..0000000
--- a/examples/camel-example-ssh/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,11 +0,0 @@
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Camel distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
diff --git a/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml b/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml
deleted file mode 100644
index 06054fd..0000000
--- a/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?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"
- xmlns:camel="http://camel.apache.org/schema/spring"
- 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">
-
- <!--
- Note: you need to XMl or URL encode newlines
- XML encoding =
- URL encoding = %0A
- -->
- <camelContext id="camel-example-ssh" xmlns="http://camel.apache.org/schema/spring">
-
- <route id="camel-example-ssh-consumer">
- <from uri="ssh://karaf:karaf@localhost:8101?useFixedDelay=true&delay=5000&pollCommand=features:list%0A"/>
- <to uri="log:ExampleRouter?showAll=true"/>
- </route>
-
- <route id="camel-example-ssh-producer">
- <from uri="direct:exampleSshProducer"/>
- <setBody>
- <constant>features:list </constant>
- </setBody>
- <to uri="ssh://karaf:karaf@localhost:8101"/>
- <to uri="log:ExampleRouter?showAll=true"/>
- </route>
- </camelContext>
-
-</beans>
diff --git a/examples/camel-example-ssh/src/main/resources/features.xml b/examples/camel-example-ssh/src/main/resources/features.xml
deleted file mode 100644
index c905842..0000000
--- a/examples/camel-example-ssh/src/main/resources/features.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-<features>
- <repository>mvn:org.apache.camel.karaf/apache-camel/${project.version}/xml/features</repository>
-
- <feature name='camel-example-ssh' version='${project.version}'>
- <feature version="${project.version}">camel-ssh</feature>
- <bundle>mvn:org.apache.camel/camel-example-ssh/${project.version}</bundle>
- </feature>
-
-</features>
\ No newline at end of file
diff --git a/examples/camel-example-tracer/pom.xml b/examples/camel-example-tracer/pom.xml
index fb157e8..73d9b4f 100644
--- a/examples/camel-example-tracer/pom.xml
+++ b/examples/camel-example-tracer/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/examples/pom.xml b/examples/pom.xml
index 3051cfe..5d76cb0f 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
@@ -63,7 +63,6 @@
<module>camel-example-spring-ws</module>
<module>camel-example-spring-xquery</module>
<module>camel-example-spring-security</module>
- <module>camel-example-ssh</module>
<module>camel-example-tracer</module>
</modules>
diff --git a/parent/pom.xml b/parent/pom.xml
index 7e835c1..8218f38 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -20,14 +20,14 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<packaging>pom</packaging>
<name>Camel :: Parent</name>
<description>Camel Parent POM</description>
@@ -37,20 +37,16 @@
<abdera-version>1.1.2</abdera-version>
<!-- Note that activemq dependency is only used for testing! -->
<activemq-version>5.5.1</activemq-version>
- <ahc-version>1.7.0</ahc-version>
+ <ahc-version>1.6.5</ahc-version>
<apacheds-version>1.5.7</apacheds-version>
<aries-blueprint-version>0.3</aries-blueprint-version>
- <asm-bundle-version>3.3_2</asm-bundle-version>
<atomikos-trascations-version>3.7.0</atomikos-trascations-version>
- <avro-version>1.6.1</avro-version>
- <avro-bundle-version>1.6.1_1</avro-bundle-version>
<axiom-version>1.2.12</axiom-version>
- <beanio-version>1.2.3</beanio-version>
<bouncycastle-version>1.46</bouncycastle-version>
<castor-bundle-version>1.3.1_2</castor-bundle-version>
<cometd-bayeux-version>6.1.11</cometd-bayeux-version>
<cometd-java-server>2.3.1</cometd-java-server>
- <commons-codec-version>1.6</commons-codec-version>
+ <commons-codec-version>1.4</commons-codec-version>
<commons-collections-version>3.2.1</commons-collections-version>
<commons-csv>1.0-r706899_3</commons-csv>
<commons-dbcp-version>1.4</commons-dbcp-version>
@@ -58,7 +54,7 @@
<commons-io-version>1.4</commons-io-version>
<commons-lang-version>2.6</commons-lang-version>
<commons-logging-version>1.1.1</commons-logging-version>
- <commons-net-version>3.0.1</commons-net-version>
+ <commons-net-version>2.2</commons-net-version>
<commons-pool-version>1.5.6</commons-pool-version>
<concurrentlinkedhashmap.version>1.2</concurrentlinkedhashmap.version>
<cxf-version>2.5.2</cxf-version>
@@ -80,15 +76,14 @@
<geronimo-jpa2-spec-version>1.1</geronimo-jpa2-spec-version>
<geronimo-jta-spec-version>1.1.1</geronimo-jta-spec-version>
<geronimo-servlet-spec-version>1.1.2</geronimo-servlet-spec-version>
- <groovy-version>1.8.6</groovy-version>
- <gson-version>2.1</gson-version>
+ <groovy-version>1.8.5</groovy-version>
<guiceyfruit-version>2.0</guiceyfruit-version>
- <hadoop-version>1.0.0</hadoop-version>
+ <hadoop-version>0.20.203.0</hadoop-version>
<hamcrest-version>1.1</hamcrest-version>
<hapi-version>1.2</hapi-version>
<hawtbuf-version>1.7</hawtbuf-version>
<hawtdb-version>1.6</hawtdb-version>
- <hazelcast-version>1.9.4.8</hazelcast-version>
+ <hazelcast-version>1.9.4.6</hazelcast-version>
<hibernate-version>3.2.6.ga</hibernate-version>
<hibernate-entitymanager-version>3.2.1.ga</hibernate-entitymanager-version>
<hsqldb-version>2.2.8</hsqldb-version>
@@ -100,7 +95,7 @@
<jackson-version>1.9.2</jackson-version>
<jackrabbit-version>2.2.4</jackrabbit-version>
<jain-sip-ri-bundle-version>1.2.154_2</jain-sip-ri-bundle-version>
- <jasypt-version>1.8</jasypt-version>
+ <jasypt-version>1.7</jasypt-version>
<java-apns-version>0.1.6</java-apns-version>
<javassist-bundle-version>3.12.1.GA_2</javassist-bundle-version>
<javax-mail-version>1.4.4</javax-mail-version>
@@ -112,7 +107,7 @@
<jettison-version>1.3</jettison-version>
<jexcelapi-version>2.4.2</jexcelapi-version>
<jibx-version>1.2.3</jibx-version>
- <jruby-version>1.6.7</jruby-version>
+ <jruby-version>1.6.6</jruby-version>
<jsmpp-version>2.1.0_3</jsmpp-version>
<jsch-version>0.1.44-1</jsch-version>
<juel-version>2.1.2</juel-version>
@@ -124,51 +119,42 @@
<mina-version>1.1.7</mina-version>
<mina2-version>2.0.4</mina2-version>
<mockito-version>1.8.5</mockito-version>
- <mongo-java-driver-version>2.7.3</mongo-java-driver-version>
<mvel-version>2.0.18</mvel-version>
<mybatis-version>3.0.6</mybatis-version>
- <!-- transitive dependency from avro -->
<netty-bundle-version>3.2.6.Final_1</netty-bundle-version>
- <netty-version>3.3.1.Final</netty-version>
<ode-version>1.3.3</ode-version>
- <openwebbeans-version>1.1.3</openwebbeans-version>
<ognl-version>3.0.2_1</ognl-version>
<osgi-version>4.2.0</osgi-version>
- <paranamer-bundle-version>2.4_1</paranamer-bundle-version>
<pax-exam-version>1.2.4</pax-exam-version>
<pax-runner-version>1.6.1</pax-runner-version>
<pax-tiny-bundle-version>1.3.1</pax-tiny-bundle-version>
<pax-logging-version>1.5.3</pax-logging-version>
- <pojosr-version>0.1.8</pojosr-version>
<protobuf-version>2.3.0</protobuf-version>
<qpid-version>0.12</qpid-version>
<quartz-version>1.8.5</quartz-version>
<quickfix-version>1.5.1</quickfix-version>
<restlet-version>2.0.10</restlet-version>
<rome-version>1.0</rome-version>
- <saxon-version>9.3.0.11</saxon-version>
+ <saxon-version>9.1.0.8</saxon-version>
<scala-version>2.9.1</scala-version>
<scala-plugin-version>2.15.2</scala-plugin-version>
<servicemix-specs-version>1.9.0</servicemix-specs-version>
- <shiro-version>1.2.0</shiro-version>
+ <shiro-bundle-version>1.1.0_2</shiro-bundle-version>
<slf4j-version>1.6.1</slf4j-version>
<smack-version>3.2.1</smack-version>
- <snappy-bundle-version>1.0.4.1_1</snappy-bundle-version>
<snmp4j-version>1.8.1_5</snmp4j-version>
<solr-version>3.5.0</solr-version>
- <spring-integration-version>2.1.0.RELEASE</spring-integration-version>
+ <spring-integration-version>2.0.5.RELEASE</spring-integration-version>
<spring-javaconfig-version>1.0.0-20090215</spring-javaconfig-version>
<spring-version>3.0.7.RELEASE</spring-version>
<spring-osgi-version>1.2.1</spring-osgi-version>
- <spring-security-version>3.1.0.RELEASE</spring-security-version>
+ <spring-security-version>3.0.7.RELEASE</spring-security-version>
<spring-ws-version>2.0.3.RELEASE</spring-ws-version>
<spymemcached-version>2.5</spymemcached-version>
- <sshd-version>0.6.0</sshd-version>
<stax-api-version>1.0.1</stax-api-version>
<stringtemplate-version>3.0</stringtemplate-version>
<tagsoup-version>1.2.1</tagsoup-version>
<testng-version>6.0.1</testng-version>
- <twitter4j-version>2.2.5</twitter4j-version>
<velocity-version>1.7</velocity-version>
<woodstox-version>4.1.1</woodstox-version>
<xbean-spring-version>3.5</xbean-spring-version>
@@ -203,7 +189,6 @@
org.ccil.cowan.tagsoup.*;version="[1.2,2)",
org.mortbay.cometd.*;version="[6.1,7)",
net.sf.flatpack.*;version="[3.1.1,4)",
- net.sf.saxon.*;version="[9.3.0,9.4)",
freemarker.*;version="[2.3.15,3)",
javax.persistence.*;version="[1.1,3)",
</camel.osgi.import.defaults>
@@ -227,6 +212,10 @@
<camel.osgi.dynamic />
<camel.osgi.symbolic.name>${project.groupId}.${project.artifactId}</camel.osgi.symbolic.name>
<camel.osgi.exclude.dependencies>false</camel.osgi.exclude.dependencies>
+
+ <!-- encoding -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
@@ -260,11 +249,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-avro</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-aws</artifactId>
<version>${project.version}</version>
</dependency>
@@ -275,11 +259,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-beanio</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-bean-validator</artifactId>
<version>${project.version}</version>
</dependency>
@@ -305,11 +284,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-cdi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-cometd</artifactId>
<version>${project.version}</version>
</dependency>
@@ -416,11 +390,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-gson</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-hawtdb</artifactId>
<version>${project.version}</version>
</dependency>
@@ -581,11 +550,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-mongodb</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-msv</artifactId>
<version>${project.version}</version>
</dependency>
@@ -746,11 +710,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-ssh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-stax</artifactId>
<version>${project.version}</version>
</dependency>
@@ -781,36 +740,16 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-blueprint</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-testng</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-twitter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-velocity</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-websocket</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-xmlbeans</artifactId>
<version>${project.version}</version>
</dependency>
@@ -1333,7 +1272,22 @@
<!-- optional Saxon support-->
<dependency>
<groupId>net.sf.saxon</groupId>
- <artifactId>saxon9he</artifactId>
+ <artifactId>saxon</artifactId>
+ <version>${saxon-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-dom</artifactId>
+ <version>${saxon-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-sql</artifactId>
+ <version>${saxon-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon-xpath</artifactId>
<version>${saxon-version}</version>
</dependency>
@@ -1490,18 +1444,6 @@
<version>${xerces-version}</version>
</dependency>
- <!-- optional avro -->
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro</artifactId>
- <version>${avro-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.avro</groupId>
- <artifactId>avro-ipc</artifactId>
- <version>${avro-version}</version>
- </dependency>
-
<!-- optional ftpserver -->
<dependency>
<groupId>org.apache.ftpserver</groupId>
diff --git a/platforms/karaf/commands/pom.xml b/platforms/karaf/commands/pom.xml
index 6d578ce..82a0eab 100644
--- a/platforms/karaf/commands/pom.xml
+++ b/platforms/karaf/commands/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>karaf</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStart.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStart.java
index 03edcb4..c7078b8 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStart.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/RouteStart.java
@@ -43,7 +43,6 @@
this.camelController = camelController;
}
- @SuppressWarnings("deprecation")
public Object doExecute() throws Exception {
Route camelRoute = camelController.getRoute(route, context);
if (camelRoute == null) {
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
index 7026e0b..cb815fa 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/CamelContextCompleter.java
@@ -34,7 +34,7 @@
this.camelController = camelController;
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public int complete(String buffer, int cursor, List candidates) {
try {
StringsCompleter delegate = new StringsCompleter();
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
index 92f04ad..26e414c 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/completers/RouteCompleter.java
@@ -34,7 +34,7 @@
this.camelController = camelController;
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings("unchecked")
public int complete(String buffer, int cursor, List candidates) {
try {
StringsCompleter delegate = new StringsCompleter();
diff --git a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
index 94065ea..5bb45be 100644
--- a/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
+++ b/platforms/karaf/commands/src/main/java/org/apache/camel/karaf/commands/internal/CamelControllerImpl.java
@@ -90,7 +90,7 @@
return null;
}
- @SuppressWarnings("deprecation")
+
public List<RouteDefinition> getRouteDefinitions(String camelContextName) {
if (camelContextName != null) {
CamelContext context = this.getCamelContext(camelContextName);
@@ -120,7 +120,6 @@
return null;
}
- @SuppressWarnings("deprecation")
public RouteDefinition getRouteDefinition(String routeId, String camelContextName) {
CamelContext context = this.getCamelContext(camelContextName);
if (context == null) {
diff --git a/platforms/karaf/features/pom.xml b/platforms/karaf/features/pom.xml
index 8fb2639..e95ab97 100644
--- a/platforms/karaf/features/pom.xml
+++ b/platforms/karaf/features/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>karaf</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
@@ -38,7 +38,7 @@
<antlr-bundle-version>2.7.7_2</antlr-bundle-version>
<aopalliance-bundle-version>1.0_5</aopalliance-bundle-version>
<asm2-bundle-version>2.2.3_4</asm2-bundle-version>
- <aws-java-sdk-bundle-version>1.3.0_1</aws-java-sdk-bundle-version>
+ <aws-java-sdk-bundle-version>1.2.12_1</aws-java-sdk-bundle-version>
<bcel-bundle-version>5.2_4</bcel-bundle-version>
<bcpg-jdk16-bundle-version>1.46_1</bcpg-jdk16-bundle-version>
<cglib-version>2.1_3_6</cglib-version>
@@ -51,6 +51,7 @@
<commons-httpclient-bundle-version>3.1_6</commons-httpclient-bundle-version>
<commons-io-bundle-version>1.3.2_3</commons-io-bundle-version>
<commons-jxpath-version>1.3</commons-jxpath-version>
+ <commons-net-version>2.2</commons-net-version>
<commons-math-version>2.2</commons-math-version>
<commons-dbcp-bundle-version>1.4_1</commons-dbcp-bundle-version>
<dom4j-bundle-version>1.6.1_4</dom4j-bundle-version>
@@ -74,8 +75,8 @@
<isorelax-bundle-version>20050913_4</isorelax-bundle-version>
<java-apns-bundle-version>0.1.6_2</java-apns-bundle-version>
<jaxb-bundle-version>2.2.1.1_1</jaxb-bundle-version>
- <jasypt-bundle-version>1.8_1</jasypt-bundle-version>
- <jetty6-bundle-version>6.1.26_3</jetty6-bundle-version>
+ <jasypt-bundle-version>1.7_3</jasypt-bundle-version>
+ <jetty-bundle-version>6.1.26_3</jetty-bundle-version>
<jexcelapi-bundle-version>2.4.2_4</jexcelapi-bundle-version>
<javax.el-bundle-version>2.1.0</javax.el-bundle-version>
<jdom-bundle-version>1.1_4</jdom-bundle-version>
@@ -105,7 +106,7 @@
<regexp-bundle-version>1.3_2</regexp-bundle-version>
<rhino-bundle-version>1.7R2_2</rhino-bundle-version>
<rome-bundle-version>1.0_2</rome-bundle-version>
- <saxon-bundle-version>9.3.0.11_1</saxon-bundle-version>
+ <saxon-bundle-version>9.1.0.8_2</saxon-bundle-version>
<scala-bundle-version>2.9.1_1</scala-bundle-version>
<scriptengines-version>1.1</scriptengines-version>
<servlet-api-2.5-version>1.1.2</servlet-api-2.5-version>
@@ -117,7 +118,6 @@
<spymemcached-bundle-version>2.5_2</spymemcached-bundle-version>
<stringtemplate-bundle-version>3.2_5</stringtemplate-bundle-version>
<tagsoup-bundle-version>1.2_5</tagsoup-bundle-version>
- <twitter4j-bundle-version>2.2.5_2-SNAPSHOT</twitter4j-bundle-version>
<velocity-bundle-version>1.7_3</velocity-bundle-version>
<xalan-bundle-version>2.7.1_4</xalan-bundle-version>
<xerces-bundle-version>2.9.1_5</xerces-bundle-version>
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index c2013c2..b62df6b 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -187,17 +187,6 @@
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-aws/${project.version}</bundle>
</feature>
- <feature name='camel-avro' version='${project.version}' resolver='(obr)' start-level='50'>
- <feature version='${project.version}'>camel-core</feature>
- <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-core-asl/${jackson-version}</bundle>
- <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.snappy-java/${snappy-bundle-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.netty/${netty-bundle-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.paranamer/${paranamer-bundle-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro/${avro-bundle-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro-ipc/${avro-bundle-version}</bundle>
- <bundle>mvn:org.apache.camel/camel-avro/${project.version}</bundle>
- </feature>
<feature name='camel-bam' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='[3,4)'>spring-tx</feature>
<feature version='[3,4)'>spring-web</feature>
@@ -215,11 +204,6 @@
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-bam/${project.version}</bundle>
</feature>
- <feature name='camel-beanio' version='${project.version}' resolver='(obr)' start-level='50'>
- <feature version='${project.version}'>camel-core</feature>
- <bundle dependency='true'>wrap:mvn:org.beanio/beanio/${beanio-version}</bundle>
- <bundle>mvn:org.apache.camel/camel-beanio/${project.version}</bundle>
- </feature>
<feature name='camel-bean-validator' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr303-api-1.0.0/${servicemix-specs-version}</bundle>
@@ -301,11 +285,6 @@
<bundle dependency='true'>mvn:org.codehaus.groovy/groovy-all/${groovy-version}</bundle>
<bundle>mvn:org.apache.camel/camel-groovy/${project.version}</bundle>
</feature>
- <feature name='camel-gson' version='${project.version}' resolver='(obr)' start-level='50'>
- <bundle dependency='true'>mvn:com.google.code.gson/gson/${gson-version}</bundle>
- <feature version='${project.version}'>camel-core</feature>
- <bundle>mvn:org.apache.camel/camel-gson/${project.version}</bundle>
- </feature>
<feature name='camel-hazelcast' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle dependency='true'>mvn:com.hazelcast/hazelcast/${hazelcast-version}</bundle>
@@ -339,7 +318,7 @@
<bundle dependency='true'>mvn:commons-net/commons-net/${commons-net-version}</bundle>
<bundle dependency='true'>mvn:org.codehaus.jackson/jackson-core-asl/${jackson-version}</bundle>
<bundle dependency='true'>mvn:org.codehaus.jackson/jackson-mapper-asl/${jackson-version}</bundle>
- <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty/${jetty6-bundle-version}</bundle>
+ <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty/${jetty-bundle-version}</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hadoop-core/${hadoop-bundle-version}</bundle>
<bundle>mvn:org.apache.camel/camel-hdfs/${project.version}</bundle>
</feature>
@@ -441,7 +420,6 @@
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/${ant-bundle-version}</bundle>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/${serp-bundle-version}</bundle>
<bundle dependency='true'>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/${geronimo-jms-spec-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.asm/${asm-bundle-version}</bundle>
<bundle>mvn:org.apache.openjpa/openjpa/${openjpa-version}</bundle>
<feature version='[3,4)'>spring-orm</feature>
<feature version='${project.version}'>camel-core</feature>
@@ -486,12 +464,6 @@
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-mail/${project.version}</bundle>
</feature>
- <feature name='camel-mongodb' version='${project.version}' resolver='(obr)' start-level='50'>
- <bundle dependency='true'>mvn:org.mongodb/mongo-java-driver/${mongo-java-driver-version}</bundle>
- <bundle>mvn:org.apache.camel/camel-mongodb/${project.version}</bundle>
- <feature version='${project.version}'>camel-core</feature>
- <feature version='${project.version}'>camel-jackson</feature>
- </feature>
<feature name='camel-msv' version='${project.version}' resolver='(obr)' start-level='50'>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/${xmlresolver-bundle-version}</bundle>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xerces/${xerces-bundle-version}</bundle>
@@ -523,7 +495,7 @@
</feature>
<feature name='camel-netty' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
- <bundle dependency='true'>mvn:io.netty/netty/${netty-version}</bundle>
+ <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.netty/${netty-bundle-version}</bundle>
<bundle>mvn:org.apache.camel/camel-netty/${project.version}</bundle>
</feature>
<feature name='camel-ognl' version='${project.version}' resolver='(obr)' start-level='50'>
@@ -624,7 +596,7 @@
<feature name='camel-shiro' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-beanutils/${commons-beanutils-bundle-version}</bundle>
- <bundle dependency='true'>mvn:org.apache.shiro/shiro-core/${shiro-version}</bundle>
+ <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro/${shiro-bundle-version}</bundle>
<bundle>mvn:org.apache.camel/camel-shiro/${project.version}</bundle>
</feature>
<feature name='camel-smpp' version='${project.version}' resolver='(obr)' start-level='50'>
@@ -665,10 +637,8 @@
</feature>
<feature name='camel-spring-security' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-spring</feature>
- <feature version='[3,4)'>spring-web</feature>
<bundle dependency='true'>mvn:org.springframework.security/spring-security-core/${spring-security-version}</bundle>
<bundle dependency='true'>mvn:org.springframework.security/spring-security-config/${spring-security-version}</bundle>
- <bundle dependency='true'>mvn:org.springframework.security/spring-security-web/${spring-security-version}</bundle>
<bundle>mvn:org.apache.camel/camel-spring-security/${project.version}</bundle>
</feature>
<feature name='camel-spring-ws' version='${project.version}' resolver='(obr)' start-level='50'>
@@ -691,12 +661,6 @@
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-sql/${project.version}</bundle>
</feature>
- <feature name='camel-ssh' version='${project.version}' resolver='(obr)' start-level='50'>
- <feature version='${project.version}'>camel-core</feature>
- <bundle dependency="true">mvn:org.apache.mina/mina-core/${mina2-version}</bundle>
- <bundle dependency="true">mvn:org.apache.sshd/sshd-core/${sshd-version}</bundle>
- <bundle>mvn:org.apache.camel/camel-ssh/${project.version}</bundle>
- </feature>
<feature name='camel-stax' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-stax/${project.version}</bundle>
@@ -720,11 +684,6 @@
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-tagsoup/${project.version}</bundle>
</feature>
- <feature name='camel-twitter' version='${project.version}' resolver='(obr)' start-level='50'>
- <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.twitter4j/${twitter4j-bundle-version}</bundle>
- <feature version='${project.version}'>camel-core</feature>
- <bundle>mvn:org.apache.camel/camel-twitter/${project.version}</bundle>
- </feature>
<feature name='camel-velocity' version='${project.version}' resolver='(obr)' start-level='50'>
<!-- the jetty feature provides the geronimo-servlet_2.5_spec -->
<!-- TODO replace the jetty feature by a Karaf spec feature -->
@@ -740,13 +699,6 @@
<feature version='${project.version}'>camel-core</feature>
<bundle>mvn:org.apache.camel/camel-velocity/${project.version}</bundle>
</feature>
- <feature name="camel-websocket" version='${project.version}' resolver='(obr)' start-level='50'>
- <feature>jetty</feature>
- <!-- TODO: remove the dependency to jetty-websocket if KARAF-1153 is resolved and released -->
- <bundle start-level="30">mvn:org.eclipse.jetty/jetty-websocket/7.5.4.v20111024</bundle>
- <feature version='${project.version}'>camel-core</feature>
- <bundle>mvn:org.apache.camel/camel-websocket/${project.version}</bundle>
- </feature>
<feature name='camel-xmlbeans' version='${project.version}' resolver='(obr)' start-level='50'>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/${ant-bundle-version}</bundle>
<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlbeans/${xmlbeans-bundle-version}</bundle>
diff --git a/platforms/karaf/pom.xml b/platforms/karaf/pom.xml
index b8927e8..f5c9c7aa 100644
--- a/platforms/karaf/pom.xml
+++ b/platforms/karaf/pom.xml
@@ -24,14 +24,14 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>platforms</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>..</relativePath>
</parent>
<groupId>org.apache.camel</groupId>
<artifactId>karaf</artifactId>
<packaging>pom</packaging>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<name>Camel :: Platforms :: Apache Karaf</name>
<modules>
diff --git a/platforms/pom.xml b/platforms/pom.xml
index 34498a7..767223d 100644
--- a/platforms/pom.xml
+++ b/platforms/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/pom.xml b/pom.xml
index b028ccf..5eafbe1 100755
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<packaging>pom</packaging>
<name>Camel</name>
<description>Camel build POM</description>
@@ -37,20 +37,16 @@
</prerequisites>
<properties>
- <!-- unify the encoding for all the modules -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-
<site-repo-url>scpexe://people.apache.org/www/camel.apache.org/maven/</site-repo-url>
<jdk.version>1.6</jdk.version>
<compiler.fork>1.6</compiler.fork>
-
<!-- eclipse plugin need the jaxb in this pom.xml file -->
<jaxb-version>2.1.13</jaxb-version>
<jaxb-api-version>2.1</jaxb-api-version>
-
<maven-bundle-version>2.3.4</maven-bundle-version>
- <openjpa-version>2.2.0</openjpa-version>
+
+ <openjpa-version>2.1.1</openjpa-version>
</properties>
<mailingLists>
@@ -124,9 +120,9 @@
</modules>
<scm>
- <connection>scm:svn:https://svn.apache.org/repos/asf/camel/trunk</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/camel/trunk</developerConnection>
- <url>http://svn.apache.org/viewvc/camel/trunk/</url>
+ <connection>scm:svn:https://svn.apache.org/repos/asf/camel/tags/camel-2.9.1</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/camel/tags/camel-2.9.1</developerConnection>
+ <url>http://svn.apache.org/viewvc/camel/tags/camel-2.9.1</url>
</scm>
<build>
@@ -667,62 +663,62 @@
<phase>validate</phase>
<configuration>
<target>
- <path id="ecp.ws.path" location="${eclipse.workspace.dir}"/>
- <property name="full.eclipse.workspace" refid="ecp.ws.path"/>
- <path path="${basedir}/etc" id="etc.path"/>
+ <path id="ecp.ws.path" location="${eclipse.workspace.dir}" />
+ <property name="full.eclipse.workspace" refid="ecp.ws.path" />
+ <path path="${basedir}/etc" id="etc.path" />
- <whichresource resource="/camel-eclipse-pmd" property="pmd.url"/>
- <whichresource resource="/camel-pmd-ruleset.xml" property="pmdruleset.url"/>
- <whichresource resource="/camel-eclipse-checkstyle" property="eclipse.checkstyle.url"/>
- <whichresource resource="/camel-checkstyle.xml" property="checkstyle.url"/>
+ <whichresource resource="/camel-eclipse-pmd" property="pmd.url" />
+ <whichresource resource="/camel-pmd-ruleset.xml" property="pmdruleset.url" />
+ <whichresource resource="/camel-eclipse-checkstyle" property="eclipse.checkstyle.url" />
+ <whichresource resource="/camel-checkstyle.xml" property="checkstyle.url" />
- <mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings"/>
- <mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core"/>
- <mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/net.sourceforge.pmd.eclipse"/>
+ <mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings" />
+ <mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core" />
+ <mkdir dir="${full.eclipse.workspace}/.metadata/.plugins/net.sourceforge.pmd.eclipse" />
- <get src="${checkstyle.url}" dest="${full.eclipse.workspace}/camel-checkstyle.xml"/>
+ <get src="${checkstyle.url}" dest="${full.eclipse.workspace}/camel-checkstyle.xml" />
<!-- Add checkstyle config -->
<copy file="${basedir}/etc/eclipse/template.checkstyle-config.xml" tofile="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml" overwrite="no">
<filterset>
- <filter token="CHECKSTYLE_CONFIG_FILE" value="${full.eclipse.workspace}/camel-checkstyle.xml"/>
- <filter token="APACHE_HEADER_FILE" value="${full.eclipse.workspace}/apache-header.txt"/>
+ <filter token="CHECKSTYLE_CONFIG_FILE" value="${full.eclipse.workspace}/camel-checkstyle.xml" />
+ <filter token="APACHE_HEADER_FILE" value="${full.eclipse.workspace}/apache-header.txt" />
</filterset>
</copy>
<xslt style="${basedir}/etc/eclipse/addcheckstyle.xsl" in="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml" out="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml.new">
- <param name="checkstyleconfig" expression="${full.eclipse.workspace}/camel-checkstyle.xml"/>
+ <param name="checkstyleconfig" expression="${full.eclipse.workspace}/camel-checkstyle.xml" />
</xslt>
- <copy file="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml.new" tofile="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml" overwrite="yes"/>
+ <copy file="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml.new" tofile="${full.eclipse.workspace}/.metadata/.plugins/net.sf.eclipsecs.core/checkstyle-config.xml" overwrite="yes" />
<!-- Add code format rules -->
<concat destfile="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true" fixlastline="true">
- <filelist dir="${basedir}/etc/eclipse" files="org.eclipse.jdt.core.prefs"/>
+ <filelist dir="${basedir}/etc/eclipse" files="org.eclipse.jdt.core.prefs" />
</concat>
- <loadfile property="eclipse.code.format" srcFile="${basedir}/etc/eclipse/CamelCodeFormatter.xml"/>
- <loadfile property="eclipse.code.templates" srcFile="${basedir}/etc/eclipse/codetemplates.xml"/>
- <loadfile property="eclipse.camel.java.code.templates" srcFile="${basedir}/etc/eclipse/camel_java_templates.xml"/>
- <loadfile property="eclipse.camel.xml.code.templates" srcFile="${basedir}/etc/eclipse/camel_xml_templates.xml"/>
+ <loadfile property="eclipse.code.format" srcFile="${basedir}/etc/eclipse/CamelCodeFormatter.xml" />
+ <loadfile property="eclipse.code.templates" srcFile="${basedir}/etc/eclipse/codetemplates.xml" />
+ <loadfile property="eclipse.camel.java.code.templates" srcFile="${basedir}/etc/eclipse/camel_java_templates.xml" />
+ <loadfile property="eclipse.camel.xml.code.templates" srcFile="${basedir}/etc/eclipse/camel_xml_templates.xml" />
<propertyfile file="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs">
- <entry key="formatter_profile" value="Camel Java Conventions"/>
- <entry key="org.eclipse.jdt.ui.formatterprofiles" value="${eclipse.code.format}"/>
- <entry key="org.eclipse.jdt.ui.text.custom_code_templates" value="${eclipse.code.templates}"/>
+ <entry key="formatter_profile" value="Camel Java Conventions" />
+ <entry key="org.eclipse.jdt.ui.formatterprofiles" value="${eclipse.code.format}" />
+ <entry key="org.eclipse.jdt.ui.text.custom_code_templates" value="${eclipse.code.templates}" />
<!-- Add Camel templates for Java DSL -->
- <entry key="org.eclipse.jdt.ui.text.custom_templates" value="${eclipse.camel.java.code.templates}"/>
+ <entry key="org.eclipse.jdt.ui.text.custom_templates" value="${eclipse.camel.java.code.templates}" />
<!-- Add import order -->
- <entry key="org.eclipse.jdt.ui.importorder" value="java;javax;org.w3c;org.xml;w3c;"/>
+ <entry key="org.eclipse.jdt.ui.importorder" value="java;javax;org.w3c;org.xml;w3c;" />
<!-- Sort order -->
- <entry key="org.eclipse.jdt.ui.visibility.order" value="B,R,D,V,"/>
- <entry key="outlinesortoption" value="T,SF,F,SI,I,C,SM,M,"/>
- <entry key="org.eclipse.jdt.ui.enable.visibility.order" value="true"/>
+ <entry key="org.eclipse.jdt.ui.visibility.order" value="B,R,D,V," />
+ <entry key="outlinesortoption" value="T,SF,F,SI,I,C,SM,M," />
+ <entry key="org.eclipse.jdt.ui.enable.visibility.order" value="true" />
</propertyfile>
<propertyfile file="${full.eclipse.workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.xml.ui.prefs">
- <entry key="eclipse.preferences.version" value="1"/>
+ <entry key="eclipse.preferences.version" value="1" />
<!-- Add Camel templates for Spring DSL -->
- <entry key="org.eclipse.wst.sse.ui.custom_templates" value="${eclipse.camel.xml.code.templates}"/>
+ <entry key="org.eclipse.wst.sse.ui.custom_templates" value="${eclipse.camel.xml.code.templates}" />
</propertyfile>
</target>
</configuration>
@@ -871,7 +867,7 @@
<releases>
<enabled>false</enabled>
</releases>
- <snapshots/>
+ <snapshots />
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org/</url>
</repository>
@@ -881,7 +877,7 @@
<releases>
<enabled>false</enabled>
</releases>
- <snapshots/>
+ <snapshots />
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org/</url>
</pluginRepository>
diff --git a/tests/camel-itest-karaf/pom.xml b/tests/camel-itest-karaf/pom.xml
index ac2eb9f..dfb0aec 100644
--- a/tests/camel-itest-karaf/pom.xml
+++ b/tests/camel-itest-karaf/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1-SNAPSHOT</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
deleted file mode 100644
index beff805..0000000
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelBeanioTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.karaf;
-
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.model.dataformat.BeanioDataFormat;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-
-@RunWith(JUnit4TestRunner.class)
-public class CamelBeanioTest extends AbstractFeatureTest {
-
- public static final String COMPONENT = extractName(CamelBeanioTest.class);
-
- protected DataFormatDefinition createDataformatDefinition(String format) {
- return new BeanioDataFormat();
- }
-
- @Test
- public void test() throws Exception {
- testDataFormat(COMPONENT);
- }
-
- @Configuration
- public static Option[] configure() {
- return configure(COMPONENT);
- }
-
-}
\ No newline at end of file
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGsonTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGsonTest.java
deleted file mode 100644
index 21f8c65..0000000
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelGsonTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.karaf;
-
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.model.dataformat.JsonDataFormat;
-import org.apache.camel.model.dataformat.JsonLibrary;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-
-@RunWith(JUnit4TestRunner.class)
-public class CamelGsonTest extends AbstractFeatureTest {
-
- public static final String COMPONENT = extractName(CamelGsonTest.class);
-
- protected DataFormatDefinition createDataformatDefinition(String format) {
- JsonDataFormat answer = new JsonDataFormat();
- answer.setLibrary(JsonLibrary.Gson);
- return answer;
- }
-
- @Test
- public void test() throws Exception {
- testDataFormat(COMPONENT);
- }
-
- @Configuration
- public static Option[] configure() {
- return configure(COMPONENT);
- }
-
-}
\ No newline at end of file
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMongodbTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMongodbTest.java
deleted file mode 100644
index 7b2400c..0000000
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelMongodbTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.karaf;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-
-@RunWith(JUnit4TestRunner.class)
-public class CamelMongodbTest extends AbstractFeatureTest {
-
- public static final String COMPONENT = extractName(CamelMongodbTest.class);
-
- @Test
- public void test() throws Exception {
- testComponent(COMPONENT);
- }
-
- @Configuration
- public static Option[] configure() {
- return configure(COMPONENT);
- }
-
-}
\ No newline at end of file
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSshTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSshTest.java
deleted file mode 100644
index c8184de..0000000
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelSshTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.karaf;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-
-@RunWith(JUnit4TestRunner.class)
-public class CamelSshTest extends AbstractFeatureTest {
-
- public static final String COMPONENT = extractName(CamelSshTest.class);
-
- @Test
- public void test() throws Exception {
- testComponent(COMPONENT);
- }
-
- @Configuration
- public static Option[] configure() {
- return configure(COMPONENT);
- }
-
-}
\ No newline at end of file
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWebsocketTest.java b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWebsocketTest.java
deleted file mode 100644
index 95faf33..0000000
--- a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelWebsocketTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.karaf;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-
-@RunWith(JUnit4TestRunner.class)
-public class CamelWebsocketTest extends AbstractFeatureTest {
-
- public static final String COMPONENT = extractName(CamelWebsocketTest.class);
-
- @Test
- public void test() throws Exception {
- testComponent(COMPONENT);
- }
-
- @Configuration
- public static Option[] configure() {
- return configure(COMPONENT);
- }
-
-}
\ No newline at end of file
diff --git a/tests/camel-itest-osgi/pom.xml b/tests/camel-itest-osgi/pom.xml
index 058f47b..411fd4b 100644
--- a/tests/camel-itest-osgi/pom.xml
+++ b/tests/camel-itest-osgi/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -118,11 +118,6 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-beanio</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<scope>test</scope>
</dependency>
@@ -417,34 +412,61 @@
</execution>
</executions>
</plugin>
+ <!-- lets enhance the classes for OpenJPA (shame it can't do it at runtime!) -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-persistence-jdbc</artifactId>
+ <version>${openjpa-version}</version>
+ </dependency>
+ </dependencies>
- <plugin>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-maven-plugin</artifactId>
- <version>${openjpa-version}</version>
- <configuration>
- <persistenceXmlFile>${project.basedir}/src/test/resources/META-INF/persistence.xml</persistenceXmlFile>
- <includes>org/apache/camel/itest/osgi/jpa/SendEmail.class</includes>
- <addDefaultConstructor>true</addDefaultConstructor>
- <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
- </configuration>
- <executions>
- <execution>
- <id>test enhancer</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>test-enhance</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- <version>${openjpa-version}</version>
- </dependency>
- </dependencies>
- </plugin>
+ <executions>
+ <execution>
+ <phase>process-test-classes</phase>
+ <configuration>
+ <target>
+ <path id="cp">
+ <path refid="maven.test.classpath" />
+ <path refid="maven.compile.classpath" />
+ <path refid="maven.dependency.classpath" />
+ </path>
+ <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
+ <classpath refid="cp" />
+ </taskdef>
+
+ <mkdir dir="${basedir}/target/jpa-test-classes" />
+
+ <openjpac directory="${basedir}/target/jpa-test-classes">
+ <classpath refid="cp" />
+ <fileset dir="${basedir}/target/classes">
+ <include name="org/apache/camel/itest/osgi/jpa/SendEmail.class" />
+ </fileset>
+ <config propertiesFile="${basedir}/src/test/resources/META-INF/persistence.xml" />
+ </openjpac>
+
+ <openjpac directory="${basedir}/target/jpa-test-classes">
+ <classpath refid="cp" />
+ <fileset dir="${basedir}/target/test-classes">
+ <include name="org/apache/camel/examples/*.class" />
+ </fileset>
+ <config propertiesFile="${basedir}/src/test/resources/META-INF/persistence.xml" />
+ </openjpac>
+
+ <copy overwrite="true" todir="${basedir}/target/test-classes">
+ <fileset dir="${basedir}/target/jpa-test-classes" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java
index 0f21683..8e6bc7f 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/dataformat/protobuf/generated/AddressBookProtos.java
@@ -685,7 +685,7 @@
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
- if (!result.phone_.isEmpty()) {
+ if (result.phone_ != java.util.Collections.EMPTY_LIST) {
result.phone_ =
java.util.Collections.unmodifiableList(result.phone_);
}
@@ -1100,7 +1100,7 @@
throw new IllegalStateException(
"build() has already been called on this Builder.");
}
- if (!result.person_.isEmpty()) {
+ if (result.person_ != java.util.Collections.EMPTY_LIST) {
result.person_ =
java.util.Collections.unmodifiableList(result.person_);
}
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java
deleted file mode 100644
index 4fe450d..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/BeanIODataFormatSimpleTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.osgi.beanio;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.dataformat.beanio.BeanIODataFormat;
-import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
-import org.apache.camel.spi.DataFormat;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-
-import static org.ops4j.pax.exam.OptionUtils.combine;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
-
-/**
- *
- */
-@RunWith(JUnit4TestRunner.class)
-public class BeanIODataFormatSimpleTest extends OSGiIntegrationTestSupport {
-
- private static final String FIXED_DATA = "Joe,Smith,Developer,75000,10012009" + LS
- + "Jane,Doe,Architect,80000,01152008" + LS
- + "Jon,Anderson,Manager,85000,03182007" + LS;
-
- @Test
- public void testMarshal() throws Exception {
- List<Employee> employees = getEmployees();
-
- MockEndpoint mock = getMockEndpoint("mock:beanio-marshal");
- mock.expectedBodiesReceived(FIXED_DATA);
-
- template.sendBody("direct:marshal", employees);
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testUnmarshal() throws Exception {
- List<Employee> employees = getEmployees();
-
- MockEndpoint mock = getMockEndpoint("mock:beanio-unmarshal");
- mock.expectedBodiesReceived(employees);
-
- template.sendBody("direct:unmarshal", FIXED_DATA);
-
- mock.assertIsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- DataFormat format = new BeanIODataFormat(
- "org/apache/camel/itest/osgi/beanio/mappings.xml",
- "employeeFile");
-
- from("direct:unmarshal").unmarshal(format)
- .split(simple("body")).to("mock:beanio-unmarshal");
-
- from("direct:marshal").marshal(format)
- .to("mock:beanio-marshal");
- }
- };
- }
-
- private List<Employee> getEmployees() throws ParseException {
- List<Employee> employees = new ArrayList<Employee>();
- Employee one = new Employee();
- one.setFirstName("Joe");
- one.setLastName("Smith");
- one.setTitle("Developer");
- one.setSalary(75000);
- one.setHireDate(new SimpleDateFormat("MMddyyyy").parse("10012009"));
- employees.add(one);
-
- Employee two = new Employee();
- two.setFirstName("Jane");
- two.setLastName("Doe");
- two.setTitle("Architect");
- two.setSalary(80000);
- two.setHireDate(new SimpleDateFormat("MMddyyyy").parse("01152008"));
- employees.add(two);
-
- Employee three = new Employee();
- three.setFirstName("Jon");
- three.setLastName("Anderson");
- three.setTitle("Manager");
- three.setSalary(85000);
- three.setHireDate(new SimpleDateFormat("MMddyyyy").parse("03182007"));
- employees.add(three);
- return employees;
- }
-
- @Configuration
- public static Option[] configure() {
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
- // using the features to install the other camel components
- scanFeatures(getCamelKarafFeatureUrl(), "camel-beanio"));
-
- return options;
- }
-
-}
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java
deleted file mode 100644
index 352c3bc..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/beanio/Employee.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.osgi.beanio;
-
-import java.util.Date;
-
-/**
- *
- */
-public class Employee {
-
- private String firstName;
- private String lastName;
- private String title;
- private int salary;
- private Date hireDate;
-
- public Employee() {
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getSalary() {
- return salary;
- }
-
- public void setSalary(int salary) {
- this.salary = salary;
- }
-
- public Date getHireDate() {
- return hireDate;
- }
-
- public void setHireDate(Date hireDate) {
- this.hireDate = hireDate;
- }
-
- @Override
- public int hashCode() {
- int result = firstName != null ? firstName.hashCode() : 0;
- result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
- result = 31 * result + (title != null ? title.hashCode() : 0);
- result = 31 * result + salary;
- result = 31 * result + (hireDate != null ? hireDate.hashCode() : 0);
- return result;
- }
-
- @Override
- public boolean equals(Object object) {
- if (object == null) {
- return false;
- } else if (object == this) {
- return true;
- } else if (!(object instanceof Employee)) {
- return false;
- }
-
- Employee e = (Employee) object;
-
- return this.getFirstName().equals(e.getFirstName())
- && this.getLastName().equals(e.getLastName())
- && this.getTitle().equals(e.getTitle())
- && this.getSalary() == e.getSalary()
- && this.getHireDate().equals(e.getHireDate());
- }
-
-}
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/AbstractIntegrationTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/AbstractIntegrationTest.java
index c0fd29f..8f2f8a2 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/AbstractIntegrationTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/AbstractIntegrationTest.java
@@ -70,7 +70,6 @@
// This is buggy, as the service reference may change i think
Object svc = type.cast(tracker.waitForService(timeout));
if (svc == null) {
- @SuppressWarnings("rawtypes")
Dictionary dic = bundleContext.getBundle().getHeaders();
System.err.println("Test bundle headers: " + explode(dic));
@@ -112,8 +111,8 @@
/*
* Explode the dictionary into a ,-delimited list of key=value pairs
*/
- private static String explode(Dictionary<?, ?> dictionary) {
- Enumeration<?> keys = dictionary.keys();
+ private static String explode(Dictionary dictionary) {
+ Enumeration keys = dictionary.keys();
StringBuffer result = new StringBuffer();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint2Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint2Test.java
index cb8fdd3..e221401 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint2Test.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint2Test.java
@@ -45,6 +45,7 @@
public void testEndpointInjection() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle10").start();
BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle10)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle10)", 10000);
Object producer = ctn.getComponentInstance("producer");
assertNotNull(producer);
assertEquals(TestProducer.class.getName(), producer.getClass().getName());
@@ -55,6 +56,7 @@
@Test
public void testRouteContext() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle11").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle11)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle11)", 10000);
assertEquals(3, ctx.getRoutes().size());
}
@@ -64,16 +66,17 @@
public void testProxy() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle12").start();
BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle12)", 10000);
+ CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle12)", 10000);
Object proxy = ctn.getComponentInstance("myProxySender");
assertNotNull(proxy);
assertEquals(1, proxy.getClass().getInterfaces().length);
assertEquals(TestProxySender.class.getName(), proxy.getClass().getInterfaces()[0].getName());
}
- @SuppressWarnings("deprecation")
@Test
public void testErrorHandler() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle14").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle14)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle14)", 10000);
assertEquals(1, ctx.getRoutes().size());
RouteDefinition rd = ctx.getRouteDefinitions().get(0);
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java
index 4839316..f0424bc 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint3Test.java
@@ -47,6 +47,7 @@
@Test
public void testRouteWithInterceptStrategy() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle7").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle7)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle7)", 10000);
assertEquals(1, ctx.getRoutes().size());
assertEquals(1, ctx.getInterceptStrategies().size());
@@ -56,6 +57,7 @@
@Test
public void testComponentProperties() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle8").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle8)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle8)", 10000);
assertEquals(1, ctx.getRoutes().size());
assertEquals("direct://start", ctx.getRoutes().get(0).getEndpoint().getEndpointUri());
@@ -64,6 +66,7 @@
@Test
public void testRouteBuilderRef() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle9").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle9)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle9)", 10000);
assertEquals(1, ctx.getRoutes().size());
}
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
index f89a83e..f9f154e 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint4Test.java
@@ -25,6 +25,7 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import static org.ops4j.pax.exam.OptionUtils.combine;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
@@ -40,6 +41,7 @@
@Test
public void testRouteWithXSLT() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle19").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle19)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle19)", 10000);
ProducerTemplate template = ctx.createProducerTemplate();
@@ -57,6 +59,7 @@
@Test
public void testRouteWithVelocity() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle20").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle20)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle20)", 10000);
ProducerTemplate template = ctx.createProducerTemplate();
@@ -68,6 +71,7 @@
@Test
public void testSetHeaderXPathResultType() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle21").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle21)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle21)", 10000);
ProducerTemplate template = ctx.createProducerTemplate();
@@ -88,6 +92,7 @@
@Test
public void testGetApplicationContextClassloader() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle22").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle22)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle22)", 10000);
// test the application context classloader
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint5Test.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint5Test.java
index 735ea8a..12e2b03 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint5Test.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprint5Test.java
@@ -25,6 +25,7 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import static org.ops4j.pax.exam.OptionUtils.combine;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
@@ -39,6 +40,7 @@
@Test
public void testTryCatch() throws Exception {
getInstalledBundle("CamelBlueprintTestBundle23").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle23)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundle23)", 10000);
ProducerTemplate template = ctx.createProducerTemplate();
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintManagedNamePatternFixedTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintManagedNamePatternFixedTest.java
deleted file mode 100644
index 5a06a77c..0000000
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintManagedNamePatternFixedTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.
- */
-package org.apache.camel.itest.osgi.blueprint;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.osgi.framework.Constants;
-
-import static org.ops4j.pax.exam.OptionUtils.combine;
-import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
-
-/**
- * @version
- */
-@RunWith(JUnit4TestRunner.class)
-public class CamelBlueprintManagedNamePatternFixedTest extends OSGiBlueprintTestSupport {
-
- @Test
- public void testManagedNamePatternFixed() throws Exception {
- getInstalledBundle("CamelBlueprintTestBundleFixed").start();
- CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTestBundleFixed)", 10000);
-
- ProducerTemplate template = ctx.createProducerTemplate();
-
- MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
- template.sendBody("direct:start", "World");
- mock.assertIsSatisfied();
-
- MBeanServer mbeanServer = ctx.getManagementStrategy().getManagementAgent().getMBeanServer();
-
- assertEquals("cool", ctx.getManagementName());
-
- ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/" + ctx.getManagementName()
- + ",type=context,name=\"" + ctx.getName() + "\"");
- assertTrue("Should be registered", mbeanServer.isRegistered(on));
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
-
- Option[] options = combine(
- getDefaultCamelKarafOptions(),
-
- bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml", OSGiBlueprintTestSupport.class.getResource("blueprint-fixed.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME, "CamelBlueprintTestBundleFixed")
- .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
- .build()).noStart(),
-
- // using the features to install the camel components
- scanFeatures(getCamelKarafFeatureUrl(),
- "camel-blueprint"));
-
- return options;
- }
-
-}
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintTcclTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintTcclTest.java
index 085342c..dca569d 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintTcclTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/CamelBlueprintTcclTest.java
@@ -30,6 +30,7 @@
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import static org.ops4j.pax.exam.CoreOptions.equinox;
import static org.ops4j.pax.exam.CoreOptions.felix;
@@ -51,6 +52,7 @@
@Test
public void testCorrectTcclSetForRoutes() throws Exception {
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintTcclTestBundle)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintTcclTestBundle)", 10000);
assertBundleDelegatingClassLoader(ctx.getApplicationContextClassLoader());
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/MyException.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/MyException.java
index 5311416..0d0e4f7 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/MyException.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/MyException.java
@@ -21,8 +21,6 @@
*/
public class MyException extends Exception {
- private static final long serialVersionUID = 1L;
-
public MyException() {
}
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
index ebef96b..e011751 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
@@ -84,13 +84,11 @@
return jmsCacheLoader.load(arg0, arg1);
}
- @SuppressWarnings("rawtypes")
@Override
public Map loadAll(Collection arg0) {
return jmsCacheLoader.loadAll(arg0);
}
- @SuppressWarnings("rawtypes")
@Override
public Map loadAll(Collection arg0, Object arg1) {
return jmsCacheLoader.loadAll(arg0, arg1);
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java
index 3a671ba..328fa76 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/BlobStoreBlueprintRouteTest.java
@@ -36,6 +36,7 @@
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import static org.ops4j.pax.exam.CoreOptions.felix;
import static org.ops4j.pax.exam.OptionUtils.combine;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
@@ -65,7 +66,9 @@
@Test
public void testProducerAndConsumer() throws Exception {
+ BlobStore blobStore = getOsgiService(BlobStore.class);
getInstalledBundle("CamelBlueprintJcloudsTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintJcloudsTestBundle)", 20000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintJcloudsTestBundle)", 20000);
MockEndpoint mock = ctx.getEndpoint("mock:results", MockEndpoint.class);
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/SimpleObject.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/SimpleObject.java
index 8bc29c3..342dbe3 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/SimpleObject.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jclouds/SimpleObject.java
@@ -20,8 +20,6 @@
import java.io.Serializable;
public class SimpleObject implements Serializable {
-
- private static final long serialVersionUID = 1L;
private String id;
private String value;
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java
index a90138a..c7194a9 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaBlueprintRouteTest.java
@@ -30,6 +30,7 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
//import static org.ops4j.pax.exam.CoreOptions.equinox;
//import static org.ops4j.pax.exam.CoreOptions.felix;
@@ -44,6 +45,7 @@
@Test
public void testBlueprintRouteJpa() throws Exception {
getInstalledBundle("CamelBlueprintJpaTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintJpaTestBundle)", 30000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintJpaTestBundle)", 20000);
MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
index 2d44133..3b30f1c 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java
@@ -95,7 +95,6 @@
// must type cast with Spring 2.x
jpaTemplate = applicationContext.getBean("jpaTemplate", JpaTemplate.class);
- @SuppressWarnings("rawtypes")
List list = jpaTemplate.find(SELECT_ALL_STRING);
assertEquals(1, list.size());
@@ -110,9 +109,8 @@
transactionTemplate.setTransactionManager(new JpaTransactionManager(jpaTemplate.getEntityManagerFactory()));
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
- transactionTemplate.execute(new TransactionCallback<Boolean>() {
- public Boolean doInTransaction(TransactionStatus arg0) {
- @SuppressWarnings("rawtypes")
+ transactionTemplate.execute(new TransactionCallback() {
+ public Object doInTransaction(TransactionStatus arg0) {
List list = jpaTemplate.find(SELECT_ALL_STRING);
for (Object item : list) {
jpaTemplate.remove(item);
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java
index 2431e73..5c616e1 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/KratiBlueprintRouteTest.java
@@ -32,6 +32,7 @@
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
import static org.ops4j.pax.exam.OptionUtils.combine;
@@ -49,6 +50,7 @@
@Test
public void testProducerConsumerAndIdempotent() throws Exception {
getInstalledBundle("CamelBlueprintKratiTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintKratiTestBundle)", 20000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintKratiTestBundle)", 20000);
MockEndpoint mock = ctx.getEndpoint("mock:results", MockEndpoint.class);
ProducerTemplate template = ctx.createProducerTemplate();
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java
index d772141..be9d95f 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/krati/SomeObject.java
@@ -20,8 +20,6 @@
import java.io.Serializable;
public class SomeObject implements Serializable {
-
- private static final long serialVersionUID = 1L;
private String id;
private String value;
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java
index 40ecd51..515dd7e 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlBlueprintRoute.java
@@ -37,6 +37,7 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -55,6 +56,7 @@
@Test
public void testListBody() throws Exception {
getInstalledBundle("CamelBlueprintSqlTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
@@ -79,8 +81,10 @@
@Test
public void testLowNumberOfParameter() throws Exception {
getInstalledBundle("CamelBlueprintSqlTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
+ MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
try {
ProducerTemplate template = ctx.createProducerTemplate();
template.sendBody("direct:list", "ASF");
@@ -95,6 +99,7 @@
@Test
public void testInsert() throws Exception {
getInstalledBundle("CamelBlueprintSqlTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintSqlTestBundle)", 10000);
DataSource ds = getOsgiService(DataSource.class, 10000);
JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);
@@ -105,7 +110,7 @@
template.sendBody("direct:insert", new Object[]{10, "test", "test"});
mock.assertIsSatisfied();
try {
- String projectName = jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
+ String projectName = (String) jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
assertEquals("test", projectName);
} catch (EmptyResultDataAccessException e) {
fail("no row inserted");
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
index 2747ab3..a022cde 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/sql/SqlRouteTest.java
@@ -114,7 +114,7 @@
template.sendBody("direct:insert", new Object[]{10, "test", "test"});
mock.assertIsSatisfied();
try {
- String projectName = jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
+ String projectName = (String) jdbcTemplate.queryForObject("select project from projects where id = 10", String.class);
assertEquals("test", projectName);
} catch (EmptyResultDataAccessException e) {
fail("no row inserted");
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
index 7314992..e1f3cf4 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
@@ -58,6 +58,7 @@
mock.expectedMessageCount(1);
mock2.expectedMessageCount(1);
mock2.expectedBodiesReceived(message);
+ DatagramSocket ds = new DatagramSocket();
DatagramSocket socket = new DatagramSocket();
try {
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/xstream/XstreamBlueprintRouteTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/xstream/XstreamBlueprintRouteTest.java
index 5d1d023..0bd63f9 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/xstream/XstreamBlueprintRouteTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/xstream/XstreamBlueprintRouteTest.java
@@ -29,6 +29,7 @@
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Constants;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import static org.ops4j.pax.exam.CoreOptions.equinox;
@@ -43,6 +44,7 @@
@Test
public void testUnmarshal() throws Exception {
getInstalledBundle("CamelBlueprintXstreamTestBundle").start();
+ BlueprintContainer ctn = getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=CamelBlueprintXstreamTestBundle)", 10000);
CamelContext ctx = getOsgiService(CamelContext.class, "(camel.context.symbolicname=CamelBlueprintXstreamTestBundle)", 10000);
MockEndpoint mock = ctx.getEndpoint("mock:result", MockEndpoint.class);
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/zookeeper/ZookeeperOSGiTestSupport.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/zookeeper/ZookeeperOSGiTestSupport.java
index 1309559..1a92733 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/zookeeper/ZookeeperOSGiTestSupport.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/zookeeper/ZookeeperOSGiTestSupport.java
@@ -35,8 +35,7 @@
import org.apache.camel.component.zookeeper.ZooKeeperMessage;
import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
import org.apache.camel.util.FileUtil;
-import org.apache.camel.util.IOHelper;
-
+import org.apache.log4j.Logger;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
@@ -48,22 +47,16 @@
import org.apache.zookeeper.server.NIOServerCnxn;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
-
import org.junit.AfterClass;
import org.junit.BeforeClass;
-
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import static org.ops4j.pax.exam.OptionUtils.combine;
import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
public class ZookeeperOSGiTestSupport extends OSGiIntegrationTestSupport {
- protected static final Logger LOG = LoggerFactory.getLogger(ZookeeperOSGiTestSupport.class);
+ protected static final Logger LOG = Logger.getLogger(ZookeeperOSGiTestSupport.class);
protected static TestZookeeperServer server;
protected static TestZookeeperClient client;
@@ -73,7 +66,7 @@
server = new TestZookeeperServer(getServerPort(), clearServerData());
waitForServerUp("localhost:" + getServerPort(), 1000);
client = new TestZookeeperClient(getServerPort(), getTestClientSessionTimeout());
- LOG.info("Started Zookeeper Test Infrastructure on port {}", getServerPort());
+ LOG.info("Started Zookeeper Test Infrastructure on port " + getServerPort());
}
public ZooKeeper getConnection() {
@@ -148,7 +141,7 @@
public static class TestZookeeperClient implements Watcher {
- private final Logger log = LoggerFactory.getLogger(getClass());
+ private final Logger log = Logger.getLogger(getClass());
private final CountDownLatch connected = new CountDownLatch(1);
private ZooKeeper zk;
@@ -229,7 +222,7 @@
return true;
}
} catch (IOException e) {
- LOG.info("server {} not up {}", hp, e);
+ LOG.info("server " + hp + " not up " + e);
}
if (System.currentTimeMillis() > start + timeout) {
@@ -261,7 +254,7 @@
outstream.write(cmd.getBytes());
outstream.flush();
- reader = IOHelper.buffered(new InputStreamReader(sock.getInputStream()));
+ reader = new BufferedReader(new InputStreamReader(sock.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = reader.readLine()) != null) {
diff --git a/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/beanio/mappings.xml b/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/beanio/mappings.xml
deleted file mode 100644
index 8874373..0000000
--- a/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/beanio/mappings.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
- 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.
--->
-<beanio xmlns="http://www.beanio.org/2011/01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.beanio.org/2011/01 http://www.beanio.org/2011/01/mapping.xsd">
-
- <stream name="employeeFile" format="csv">
- <record name="employee" class="org.apache.camel.itest.osgi.beanio.Employee">
- <field name="firstName"/>
- <field name="lastName"/>
- <field name="title"/>
- <field name="salary"/>
- <field name="hireDate" format="MMddyyyy"/>
- </record>
- </stream>
-
-</beanio>
\ No newline at end of file
diff --git a/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-fixed.xml b/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-fixed.xml
deleted file mode 100644
index 372acbd..0000000
--- a/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-fixed.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <bean id="naming" class="org.apache.camel.management.DefaultManagementNamingStrategy">
- <property name="hostName" value="localhost"/>
- <property name="domainName" value="org.apache.camel"/>
- </bean>
-
- <!-- START SNIPPET: example -->
- <camelContext managementNamePattern="cool" xmlns="http://camel.apache.org/schema/blueprint">
- <jmxAgent id="agent"/>
-
- <route>
- <from uri="direct:start"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
-
-</blueprint>
diff --git a/tests/camel-itest-standalone/pom.xml b/tests/camel-itest-standalone/pom.xml
index 4b85d60..2ae37b9 100644
--- a/tests/camel-itest-standalone/pom.xml
+++ b/tests/camel-itest-standalone/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tests/camel-itest/pom.xml b/tests/camel-itest/pom.xml
index 46a47a1..3d159c5 100644
--- a/tests/camel-itest/pom.xml
+++ b/tests/camel-itest/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
@@ -234,7 +234,7 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncTest.java
index e0b9a9d..b3f9321 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncTest.java
@@ -27,6 +27,7 @@
*/
public class HttpAsyncTest extends HttpAsyncTestSupport {
+ @SuppressWarnings("unchecked")
@Test
public void testAsyncAndSyncAtSameTimeWithHttp() throws Exception {
// START SNIPPET: e2
@@ -36,7 +37,7 @@
mock.expectedBodiesReceived("Claus", "Bye World");
// Send a async request/reply message to the http endpoint
- Future<Object> future = template.asyncRequestBody("http://0.0.0.0:" + getPort() + "/myservice", "Hello World");
+ Future future = template.asyncRequestBody("http://0.0.0.0:" + getPort() + "/myservice", "Hello World");
// We got the future so in the meantime we can do other stuff, as this is Camel
// so lets invoke another request/reply route but this time is synchronous
@@ -52,7 +53,7 @@
// This allows us to do this in a single code line instead of using the
// JDK Future API to get hold of it, but you can also use that if you want
// Adding the (String) To make the CS happy
- String response = template.extractFutureBody(future, String.class);
+ String response = (String) template.extractFutureBody(future, String.class);
assertEquals("Bye World", response);
assertMockEndpointsSatisfied();
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
index e27b68f..e1869fc 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
@@ -59,7 +59,7 @@
Object result = template.sendBodyAndHeader("cxf://bean:serviceEndpoint", ExchangePattern.InOut ,
params, CxfConstants.OPERATION_NAME, "greetMe");
assertTrue("Result is a list instance ", result instanceof List);
- assertEquals("Get the wrong response", ((List<?>)result).get(0), "HelloWillem");
+ assertEquals("Get the wrong response", ((List)result).get(0), "HelloWillem");
try {
template.sendBodyAndHeader("cxf://bean:serviceEndpoint", ExchangePattern.InOut ,
params, CxfConstants.OPERATION_NAME, "pingMe");
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/hawtdb/JmsToHawtDBAggregateTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/hawtdb/JmsToHawtDBAggregateTest.java
index 582245b..29f7cff 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/hawtdb/JmsToHawtDBAggregateTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/hawtdb/JmsToHawtDBAggregateTest.java
@@ -43,6 +43,7 @@
}
@Test
+ @SuppressWarnings("unchecked")
public void testJmsToHawtDBAggregateTest() throws Exception {
// number of rounds can be adjusted
int count = 30;
@@ -54,7 +55,7 @@
getMockEndpoint("mock:result").expectsNoDuplicates(header("counter"));
for (int i = 0; i < count; i++) {
- Map<String, Object> map = new HashMap<String, Object>();
+ Map map = new HashMap();
map.put("counter", i);
map.put("group", "foo");
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jetty/JettyFailoverRoundRobinTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jetty/JettyFailoverRoundRobinTest.java
index 9abb826..d4783ba 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jetty/JettyFailoverRoundRobinTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jetty/JettyFailoverRoundRobinTest.java
@@ -21,6 +21,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/InvalidOrderException.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/InvalidOrderException.java
index 5745d88..24057c4 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/InvalidOrderException.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/InvalidOrderException.java
@@ -21,8 +21,6 @@
*/
public class InvalidOrderException extends Exception {
- private static final long serialVersionUID = 1L;
-
public InvalidOrderException(String message) {
super(message);
}
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
index f66f5e7..96a7470 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JMSTransactionIsTransactedRedeliveredTest.java
@@ -45,6 +45,12 @@
}
@Override
+ protected int getExpectedRouteCount() {
+ // have to return 0 because we enable advice with
+ return 0;
+ }
+
+ @Override
public boolean isUseAdviceWith() {
return true;
}
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/test/SpringDebugBeforeTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/test/SpringDebugBeforeTest.java
index f59e1fe..9dd88ed 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/test/SpringDebugBeforeTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/test/SpringDebugBeforeTest.java
@@ -46,7 +46,7 @@
}
@Override
- protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, String id, String label) {
+ protected void debugBefore(Exchange exchange, Processor processor, ProcessorDefinition definition, String id, String label) {
before.add(id);
}
diff --git a/tests/camel-partial-classpath-test/pom.xml b/tests/camel-partial-classpath-test/pom.xml
index bc984ae..e629d40 100644
--- a/tests/camel-partial-classpath-test/pom.xml
+++ b/tests/camel-partial-classpath-test/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tests/camel-typeconverterscan-test/pom.xml b/tests/camel-typeconverterscan-test/pom.xml
index a7fab7a..43a65a2 100644
--- a/tests/camel-typeconverterscan-test/pom.xml
+++ b/tests/camel-typeconverterscan-test/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tests/pom.xml b/tests/pom.xml
index f941504..75955f9 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/tests/test-bundles/mock-javamail_1.7/pom.xml b/tests/test-bundles/mock-javamail_1.7/pom.xml
index 0a35143..1018dc8 100644
--- a/tests/test-bundles/mock-javamail_1.7/pom.xml
+++ b/tests/test-bundles/mock-javamail_1.7/pom.xml
@@ -23,12 +23,12 @@
<parent>
<groupId>org.apache.camel.tests.bundles</groupId>
<artifactId>bundles-pom</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.tests</groupId>
<artifactId>org.apache.camel.tests.mock-javamail_1.7</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<packaging>bundle</packaging>
<name>Camel :: Integration Tests :: Test Bundles: ${pkgArtifactId}-${pkgVersion}</name>
<description>
diff --git a/tests/test-bundles/pom.xml b/tests/test-bundles/pom.xml
index b7bbd00..935d620 100644
--- a/tests/test-bundles/pom.xml
+++ b/tests/test-bundles/pom.xml
@@ -22,14 +22,14 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
<groupId>org.apache.camel.tests.bundles</groupId>
<artifactId>bundles-pom</artifactId>
<packaging>pom</packaging>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<name>Camel :: Integration Tests :: Test Bundles</name>
<properties>
diff --git a/tooling/archetypes/camel-archetype-activemq/pom.xml b/tooling/archetypes/camel-archetype-activemq/pom.xml
index 5e88b9a..e949346 100644
--- a/tooling/archetypes/camel-archetype-activemq/pom.xml
+++ b/tooling/archetypes/camel-archetype-activemq/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -33,7 +33,7 @@
<description>Creates a new Camel project that configures and interacts with ActiveMQ.</description>
<packaging>maven-archetype</packaging>
- <build>
+ <build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-activemq/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-activemq/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index e53c5bf..cda1c9c 100644
--- a/tooling/archetypes/camel-archetype-activemq/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-activemq/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -53,19 +53,8 @@
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
- <include>**/*</include>
- </includes>
- </fileSet>
- <fileSet filtered="true" packaged="true" encoding="UTF-8">
- <directory>src/test/java</directory>
- <includes>
- <include>**/*.java</include>
- </includes>
- </fileSet>
- <fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
+ <include>**/*.xml</include>
+ <include>**/*.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
diff --git a/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/ReadMe.txt
index fdd062c..74c64ad 100644
--- a/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,13 +1,8 @@
-Camel ActiveMQ Project
-======================
+Camel Router Project
+====================
-This project embeds Apache ActiveMQ together with Apache Camel.
-
-To build this project use
-
- mvn install
-
-To run this project use the following maven goal
+To run this router either embed the jar inside Spring
+or to run the route from within maven try
mvn camel:run
diff --git a/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml
index 60a9473..9158138 100644
--- a/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-activemq/src/main/resources/archetype-resources/pom.xml
@@ -26,15 +26,11 @@
<packaging>jar</packaging>
<version>${version}</version>
- <name>ActiveMQ embedded with Camel</name>
+ <name>A Camel Route</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
+
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
@@ -50,6 +46,7 @@
<artifactId>camel-spring</artifactId>
<version>${camel-version}</version>
</dependency>
+
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
@@ -75,26 +72,26 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j-version}</version>
- </dependency>
+ <version>${slf4j-version}</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j-version}</version>
+ <version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j-version}</version>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
</dependency>
-
- <!-- testing -->
+ <!-- for testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
+
</dependencies>
<build>
@@ -117,7 +114,8 @@
<artifactId>camel-maven-plugin</artifactId>
<version>${camel-version}</version>
</plugin>
+
</plugins>
</build>
-
+
</project>
diff --git a/tooling/archetypes/camel-archetype-blueprint/pom.xml b/tooling/archetypes/camel-archetype-blueprint/pom.xml
index 11469a1..59bbb8f 100644
--- a/tooling/archetypes/camel-archetype-blueprint/pom.xml
+++ b/tooling/archetypes/camel-archetype-blueprint/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index 57d73d0..5388104 100644
--- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-blueprint/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -31,10 +31,7 @@
<defaultValue>${maven-compiler-plugin-version}</defaultValue>
</requiredProperty>
<requiredProperty key="maven-bundle-plugin-version">
- <defaultValue>${maven-bundle-version}</defaultValue>
- </requiredProperty>
- <requiredProperty key="maven-surefire-plugin-version">
- <defaultValue>2.11</defaultValue>
+ <defaultValue>2.3.4</defaultValue>
</requiredProperty>
<requiredProperty key="slf4j-version">
<defaultValue>${slf4j-version}</defaultValue>
@@ -60,12 +57,6 @@
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileSet>
- <fileSet filtered="true" encoding="UTF-8">
<directory></directory>
<includes>
<include>ReadMe.txt</include>
diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
index b3d1055..661b28e 100644
--- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,10 +1,6 @@
Camel Router Project for Blueprint (OSGi)
=========================================
-To build this project use
-
- mvn install
-
To deploy the example in OSGi. For example using Apache ServiceMix
or Apache Karaf. You will run the following command from its shell:
diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
index b7949c7..88d433a 100644
--- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/pom.xml
@@ -26,7 +26,7 @@
<packaging>bundle</packaging>
<version>${version}</version>
- <name>A Camel Blueprint Route</name>
+ <name>A Camel Route</name>
<url>http://www.myorganization.org</url>
<properties>
@@ -46,6 +46,13 @@
<version>${camel-version}</version>
</dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -58,23 +65,10 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${slf4j-version}</version>
- </dependency>
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
</dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-blueprint</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -105,17 +99,7 @@
</instructions>
</configuration>
</plugin>
-
- <!-- must use fork mode pertest for unit testing with camel-test-blueprint -->
- <plugin>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${maven-surefire-plugin-version}</version>
- <configuration>
- <forkMode>pertest</forkMode>
- </configuration>
- </plugin>
</plugins>
- </build>
+ </build>
</project>
diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index c33602a..09b8687 100644
--- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -34,7 +34,6 @@
<method ref="helloBean" method="hello"/>
</setBody>
<log message="The message contains ${body}"/>
- <to uri="mock:result"/>
</route>
</camelContext>
diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java
deleted file mode 100644
index d92e2b5f..0000000
--- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/java/RouteTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.
- */
-package ${package};
-
-import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
-
-import org.junit.Test;
-
-public class RouteTest extends CamelBlueprintTestSupport {
-
- @Override
- protected String getBlueprintDescriptor() {
- return "/OSGI-INF/blueprint/blueprint.xml";
- }
-
- @Test
- public void testRoute() throws Exception {
- // the route is timer based, so every 5th second a message is send
- // we should then expect at least one message
- getMockEndpoint("mock:result").expectedMinimumMessageCount(1);
-
- // assert expectations
- assertMockEndpointsSatisfied();
- }
-
-}
diff --git a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties b/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
deleted file mode 100644
index c891aaf..0000000
--- a/tooling/archetypes/camel-archetype-blueprint/src/main/resources/archetype-resources/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used for testing
-#
-log4j.rootLogger=INFO, file
-
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-# File appender
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
-log4j.appender.file.file=target/camel-test.log
diff --git a/tooling/archetypes/camel-archetype-component/pom.xml b/tooling/archetypes/camel-archetype-component/pom.xml
index d597210..8f34083 100644
--- a/tooling/archetypes/camel-archetype-component/pom.xml
+++ b/tooling/archetypes/camel-archetype-component/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -33,7 +33,7 @@
<description>Creates a new Camel component.</description>
<packaging>maven-archetype</packaging>
- <build>
+ <build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-component/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-component/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index bf07e5f..88f01dd 100644
--- a/tooling/archetypes/camel-archetype-component/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-component/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -21,7 +21,9 @@
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requiredProperties>
- <requiredProperty key="name"/>
+ <requiredProperty key="name">
+ <defaultValue>HelloWorld</defaultValue>
+ </requiredProperty>
<requiredProperty key="scheme">
<defaultValue>helloworld</defaultValue>
</requiredProperty>
@@ -57,12 +59,6 @@
<include>**/*.java</include>
</includes>
</fileSet>
- <fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileSet>
<fileSet encoding="UTF-8">
<directory>src/data</directory>
<includes>
diff --git a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/ReadMe.txt
index d199a2e..16825ee 100644
--- a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,16 +1,11 @@
Camel Component Project
====================
-
This Project is a template of a Camel component.
When you create a component project, you need to move the META-INF/services/org/apache/camel/component/${name}
file to META-INF/services/org/apache/camel/component/foo where "foo" is the URI scheme for your component and any
related endpoints created on the fly.
-To build this project use
-
- mvn install
-
For more help see the Apache Camel documentation:
http://camel.apache.org/writing-components.html
diff --git a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
index a9719aa..2f9c845 100644
--- a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/pom.xml
@@ -26,27 +26,29 @@
<packaging>jar</packaging>
<version>${version}</version>
- <name>Camel ${name} Component</name>
+ <name>A Camel Component</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
- </dependency>
+ </dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -54,18 +56,10 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
<version>${log4j-version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
+ <scope>test</scope>
</dependency>
</dependencies>
@@ -84,5 +78,4 @@
</plugin>
</plugins>
</build>
-
</project>
diff --git a/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/test/resources/log4j.properties b/tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/resources/log4j.properties
similarity index 100%
rename from tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/test/resources/log4j.properties
rename to tooling/archetypes/camel-archetype-component/src/main/resources/archetype-resources/src/main/resources/log4j.properties
diff --git a/tooling/archetypes/camel-archetype-dataformat/pom.xml b/tooling/archetypes/camel-archetype-dataformat/pom.xml
index 1b6a639..1fc2080 100644
--- a/tooling/archetypes/camel-archetype-dataformat/pom.xml
+++ b/tooling/archetypes/camel-archetype-dataformat/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -33,7 +33,7 @@
<description>Creates a new Camel data format.</description>
<packaging>maven-archetype</packaging>
- <build>
+ <build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-dataformat/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-dataformat/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index bb234d3..e24b689 100644
--- a/tooling/archetypes/camel-archetype-dataformat/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-dataformat/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -54,11 +54,5 @@
<include>**/*.java</include>
</includes>
</fileSet>
- <fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileSet>
</fileSets>
</archetype-descriptor>
diff --git a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/ReadMe.txt
deleted file mode 100644
index 703a015..0000000
--- a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/ReadMe.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Camel Data Format Project
-====================
-
-This Project is a template of a Camel data format.
-
-When you create a data format project, you need to move the META-INF/services/org/apache/camel/dataformat/${name}
-file to META-INF/services/org/apache/camel/dataformat/foo where "foo" is the URI scheme for your data format.
-
-To build this project use
-
- mvn install
-
-For more help see the Apache Camel documentation:
-
- http://camel.apache.org/
-
diff --git a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml
index 2d345b0..02846a9 100644
--- a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/pom.xml
@@ -26,27 +26,29 @@
<packaging>jar</packaging>
<version>${version}</version>
- <name>Camel ${name} Data format</name>
+ <name>A Camel ${name} Data format</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
- </dependency>
+ </dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -54,18 +56,10 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
<version>${log4j-version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
+ <scope>test</scope>
</dependency>
</dependencies>
@@ -84,5 +78,4 @@
</plugin>
</plugins>
</build>
-
</project>
diff --git a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/test/resources/log4j.properties b/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/test/resources/log4j.properties
deleted file mode 100644
index c71f6a3..0000000
--- a/tooling/archetypes/camel-archetype-dataformat/src/main/resources/archetype-resources/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-## ------------------------------------------------------------------------
-## 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.
-## ------------------------------------------------------------------------
-
-#
-# The logging properties used
-#
-log4j.rootLogger=INFO, out
-
-# uncomment the following line to turn on Camel debugging
-#log4j.logger.org.apache.camel=DEBUG
-
-# CONSOLE appender not used by default
-log4j.appender.out=org.apache.log4j.ConsoleAppender
-log4j.appender.out.layout=org.apache.log4j.PatternLayout
-log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
-
-log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file
diff --git a/tooling/archetypes/camel-archetype-java/pom.xml b/tooling/archetypes/camel-archetype-java/pom.xml
index 78c5afa..2adcc5c 100644
--- a/tooling/archetypes/camel-archetype-java/pom.xml
+++ b/tooling/archetypes/camel-archetype-java/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-java/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-java/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index 5d088ae..3e47c564 100644
--- a/tooling/archetypes/camel-archetype-java/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-java/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -54,13 +54,6 @@
<include>**/*.java</include>
</includes>
</fileSet>
- <fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*.xml</include>
- <include>**/*.properties</include>
- </includes>
- </fileSet>
<fileSet encoding="UTF-8">
<directory>src/data</directory>
<includes>
diff --git a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/ReadMe.txt
index 5ce599d..74c64ad 100644
--- a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,13 +1,10 @@
-Camel Java Router Project
-=========================
+Camel Router Project
+====================
-To build this project use
+To run this router either embed the jar inside Spring
+or to run the route from within maven try
- mvn install
-
-To run this router from within Maven use
-
- mvn exec:java
+ mvn camel:run
For more help see the Apache Camel documentation
diff --git a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml
index cee88c0..5bb1b90 100644
--- a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/pom.xml
@@ -29,40 +29,40 @@
<name>A Camel Route</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ <version>${camel-version}</version>
+ </dependency>
+
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j-version}</version>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
</dependency>
</dependencies>
@@ -86,18 +86,6 @@
<artifactId>camel-maven-plugin</artifactId>
<version>${camel-version}</version>
</plugin>
-
- <!-- Allows the example to be run via 'mvn compile exec:java' -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <configuration>
- <mainClass>${package}.MainApp</mainClass>
- <includePluginDependencies>false</includePluginDependencies>
- </configuration>
- </plugin>
-
</plugins>
</build>
-
</project>
diff --git a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MainApp.java b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MainApp.java
deleted file mode 100644
index cd50cfc..0000000
--- a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MainApp.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.
- */
-package ${package};
-
-import org.apache.camel.main.Main;
-
-/**
- * A Camel Application
- */
-public class MainApp {
-
- /**
- * A main() so we can easily run these routing rules in our IDE
- */
- public static void main(String... args) throws Exception {
- Main main = new Main();
- main.enableHangupSupport();
- main.addRouteBuilder(new MyRouteBuilder());
- main.run(args);
- }
-
-}
-
diff --git a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MyRouteBuilder.java b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MyRouteBuilder.java
index 65ce5605..3af5df9 100644
--- a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MyRouteBuilder.java
+++ b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/java/MyRouteBuilder.java
@@ -17,26 +17,37 @@
package ${package};
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spring.Main;
+
+import static org.apache.camel.builder.xml.XPathBuilder.xpath;
/**
- * A Camel Java DSL Router
+ * A Camel Router
*/
public class MyRouteBuilder extends RouteBuilder {
/**
+ * A main() so we can easily run these routing rules in our IDE
+ */
+ public static void main(String... args) throws Exception {
+ Main.main(args);
+ }
+
+ /**
* Let's configure the Camel routing rules using Java code...
*/
public void configure() {
+ // TODO create Camel routes here.
+
// here is a sample which processes the input files
// (leaving them in place - see the 'noop' flag)
- // then performs content based routing on the message using XPath
- from("file:src/data?noop=true")
- .choice()
- .when(xpath("/person/city = 'London'"))
- .to("file:target/messages/uk")
- .otherwise()
- .to("file:target/messages/others");
- }
+ // then performs content based routing on the message
+ // using XPath
+ from("file:src/data?noop=true").
+ choice().
+ when(xpath("/person/city = 'London'")).to("file:target/messages/uk").
+ otherwise().to("file:target/messages/others");
+ }
}
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.xml b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/META-INF/spring/camel-context.xml
similarity index 75%
rename from components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.xml
rename to tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/META-INF/spring/camel-context.xml
index 1066816..4409506 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringTryCatchMustHaveExceptionConfiguredTest.xml
+++ b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/META-INF/spring/camel-context.xml
@@ -15,23 +15,17 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
+
+<!-- Configures the Camel Context-->
+
<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
- ">
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
- <camelContext xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <doTry>
- <to uri="mock:result"/>
- <doCatch>
- <to uri="mock:fail"/>
- </doCatch>
- </doTry>
- </route>
- </camelContext>
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <package>${package}</package>
+ </camelContext>
</beans>
diff --git a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/log4j.properties b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/log4j.properties
index 581c031..90c6f9f 100644
--- a/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/log4j.properties
+++ b/tooling/archetypes/camel-archetype-java/src/main/resources/archetype-resources/src/main/resources/log4j.properties
@@ -23,6 +23,12 @@
# uncomment the following line to turn on Camel debugging
#log4j.logger.org.apache.camel=DEBUG
+# uncomment the following line to turn on ActiveMQ debugging
+#log4j.logger.org.apache.activemq=DEBUG
+
+log4j.logger.org.springframework=WARN
+
+
# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
diff --git a/tooling/archetypes/camel-archetype-scala/pom.xml b/tooling/archetypes/camel-archetype-scala/pom.xml
index 6e3e2c1..e5c4511 100644
--- a/tooling/archetypes/camel-archetype-scala/pom.xml
+++ b/tooling/archetypes/camel-archetype-scala/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index 76b4f25..019c57f 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -30,12 +30,6 @@
<requiredProperty key="maven-compiler-plugin-version">
<defaultValue>${maven-compiler-plugin-version}</defaultValue>
</requiredProperty>
- <requiredProperty key="maven-eclipse-plugin-version">
- <defaultValue>2.8</defaultValue>
- </requiredProperty>
- <requiredProperty key="exec-maven-plugin-version">
- <defaultValue>1.2.1</defaultValue>
- </requiredProperty>
<requiredProperty key="scala-version">
<defaultValue>${scala-version}</defaultValue>
</requiredProperty>
@@ -59,18 +53,6 @@
<include>**/*</include>
</includes>
</fileSet>
- <fileSet filtered="true" packaged="true" encoding="UTF-8">
- <directory>src/test/scala</directory>
- <includes>
- <include>**/*.scala</include>
- </includes>
- </fileSet>
- <fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<includes>
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/ReadMe.txt
index 61aca91..b434f4f 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,7 +1,7 @@
Camel Router with Scala DSL Project
===================================
-To build this project use
+To compile you run:
mvn install
diff --git a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
index 08eef83..ef07c00 100644
--- a/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-scala/src/main/resources/archetype-resources/pom.xml
@@ -26,14 +26,9 @@
<packaging>jar</packaging>
<version>${version}</version>
- <name>A Camel Scala Route</name>
+ <name>Camel :: A RouteBuilder for the Scala DSL</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -53,11 +48,18 @@
<version>${scala-version}</version>
</dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j-version}</version>
+ <version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -65,27 +67,16 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j-version}</version>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
</dependency>
</dependencies>
<build>
- <defaultGoal>install</defaultGoal>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
-
<plugins>
-
<!-- the Maven compiler plugin will compile Java source files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -96,7 +87,6 @@
<target>1.6</target>
</configuration>
</plugin>
-
<!-- the Maven Scala plugin will compile Scala source files -->
<plugin>
<groupId>org.scala-tools</groupId>
@@ -111,12 +101,11 @@
</execution>
</executions>
</plugin>
-
- <!-- configure the eclipse plugin to generate eclipse project descriptors for a Scala project -->
+
+ <!-- configure the eclipse plugin to generate eclipse project descriptors for a Scala project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
- <version>${maven-eclipse-plugin-version}</version>
<configuration>
<projectnatures>
<projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>
@@ -131,16 +120,16 @@
</classpathContainers>
</configuration>
</plugin>
-
+
<!-- allows the route to be run via 'mvn exec:java' -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>${exec-maven-plugin-version}</version>
<configuration>
<mainClass>${package}.MyRouteMain</mainClass>
</configuration>
</plugin>
+
</plugins>
</build>
diff --git a/tooling/archetypes/camel-archetype-spring-dm/pom.xml b/tooling/archetypes/camel-archetype-spring-dm/pom.xml
index e08ebbb..3d5bd2d 100644
--- a/tooling/archetypes/camel-archetype-spring-dm/pom.xml
+++ b/tooling/archetypes/camel-archetype-spring-dm/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-spring-dm/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-spring-dm/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index 5a63789..5388104 100644
--- a/tooling/archetypes/camel-archetype-spring-dm/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-spring-dm/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -57,12 +57,6 @@
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileSet>
- <fileSet filtered="true" encoding="UTF-8">
<directory></directory>
<includes>
<include>ReadMe.txt</include>
diff --git a/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/ReadMe.txt
index 278efa8..332f82d 100644
--- a/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,10 +1,6 @@
Camel Router Project for Spring-DM (OSGi)
=========================================
-To build this project use
-
- mvn install
-
You can run this example from the command line using
the following maven goal:
diff --git a/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/pom.xml
index af1a9a2..b54c29b 100644
--- a/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-spring-dm/src/main/resources/archetype-resources/pom.xml
@@ -26,14 +26,9 @@
<packaging>bundle</packaging>
<version>${version}</version>
- <name>A Camel Spring-DM Route</name>
+ <name>A Camel Route</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -46,11 +41,18 @@
<version>${camel-version}</version>
</dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j-version}</version>
+ <version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -62,14 +64,6 @@
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
</dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -108,6 +102,6 @@
</configuration>
</plugin>
</plugins>
- </build>
+ </build>
</project>
diff --git a/tooling/archetypes/camel-archetype-spring/pom.xml b/tooling/archetypes/camel-archetype-spring/pom.xml
index 3192359..8847811 100644
--- a/tooling/archetypes/camel-archetype-spring/pom.xml
+++ b/tooling/archetypes/camel-archetype-spring/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-spring/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml b/tooling/archetypes/camel-archetype-spring/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
index ecf4e27..147e9e9a 100644
--- a/tooling/archetypes/camel-archetype-spring/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
+++ b/tooling/archetypes/camel-archetype-spring/src/main/resources-filtered/META-INF/maven/archetype-metadata.xml
@@ -53,12 +53,6 @@
<include>**/*.java</include>
</includes>
</fileSet>
- <fileSet filtered="true" encoding="UTF-8">
- <directory>src/test/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </fileSet>
<fileSet encoding="UTF-8">
<directory>src/data</directory>
<includes>
diff --git a/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/ReadMe.txt
index cba0e6b..74c64ad 100644
--- a/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/ReadMe.txt
@@ -1,10 +1,6 @@
-Camel Router Spring Project
+Camel Router Project
====================
-To build this project use
-
- mvn install
-
To run this router either embed the jar inside Spring
or to run the route from within maven try
diff --git a/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/pom.xml
index 2d644dd..82e4237 100644
--- a/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-spring/src/main/resources/archetype-resources/pom.xml
@@ -26,14 +26,9 @@
<packaging>jar</packaging>
<version>${version}</version>
- <name>A Camel Spring Route</name>
+ <name>A Camel Route</name>
<url>http://www.myorganization.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -46,11 +41,18 @@
<version>${camel-version}</version>
</dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j-version}</version>
+ <version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -58,19 +60,10 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j-version}</version>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
</dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
- </dependency>
-
</dependencies>
<build>
@@ -95,5 +88,4 @@
</plugin>
</plugins>
</build>
-
</project>
diff --git a/tooling/archetypes/camel-archetype-web/pom.xml b/tooling/archetypes/camel-archetype-web/pom.xml
index 90be7f6..a403171 100644
--- a/tooling/archetypes/camel-archetype-web/pom.xml
+++ b/tooling/archetypes/camel-archetype-web/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
@@ -57,5 +57,5 @@
</resource>
</resources>
</build>
-
+
</project>
diff --git a/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/pom.xml
index 7880b47..20b6aed 100644
--- a/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/pom.xml
@@ -25,17 +25,12 @@
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
- <name>Camel Web Application</name>
+ <name>Camel Router Application</name>
<description>Camel project that deploys the Camel routes as a WAR</description>
<url>http://www.myorganization.org</url>
-
+
<packaging>war</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<!-- Camel Dependencies -->
@@ -62,11 +57,18 @@
<version>${spring-version}</version>
</dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j-version}</version>
+ <version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -74,18 +76,11 @@
<version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j-version}</version>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
</dependency>
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
@@ -101,16 +96,18 @@
<target>1.6</target>
</configuration>
</plugin>
-
+
<!-- plugin so you can run mvn jetty:run -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
+
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
+
<systemProperties>
<!-- enable easy JMX connection to JConsole -->
<systemProperty>
@@ -121,7 +118,6 @@
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
-
</plugins>
</build>
diff --git a/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/applicationContext.xml b/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/applicationContext.xml
index f71d335..27d9ca7 100644
--- a/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/applicationContext.xml
@@ -28,13 +28,13 @@
<!--
Simple camel route which send every one minute a message on the console.
-->
- <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <camelContext trace="false" xmlns="http://camel.apache.org/schema/spring">
<route id="timer-to-console">
- <from uri="timer://foo?fixedRate=true&period=10s"/>
+ <from uri="timer://foo?fixedRate=true&period=10s" />
<transform>
<simple>Hello Web Application, how are you?</simple>
</transform>
- <to uri="stream:out"/>
+ <to uri="stream:out" />
</route>
</camelContext>
diff --git a/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
index 9fbe82c..7ed5a4f 100644
--- a/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
+++ b/tooling/archetypes/camel-archetype-web/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -34,4 +34,5 @@
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
+
</web-app>
diff --git a/tooling/archetypes/camel-archetype-webconsole/pom.xml b/tooling/archetypes/camel-archetype-webconsole/pom.xml
index 47f33da..2e2a401 100644
--- a/tooling/archetypes/camel-archetype-webconsole/pom.xml
+++ b/tooling/archetypes/camel-archetype-webconsole/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>archetypes</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<groupId>org.apache.camel.archetypes</groupId>
@@ -47,7 +47,7 @@
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
- </resource>
+ </resource>
<resource>
<directory>src/main/resources-filtered</directory>
<filtering>true</filtering>
diff --git a/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/ReadMe.txt b/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/ReadMe.txt
index dc12213..19a1d19 100644
--- a/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/ReadMe.txt
+++ b/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/ReadMe.txt
@@ -22,7 +22,7 @@
You should be able to do things like
* browse the available endpoints
- * browse the messages on an endpoint if it is a browsable endpoint
+ * browse the messages on an endpoint if it is a BrowsableEndpoint
* send a message to an endpoint
* create new endpoints
diff --git a/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/pom.xml b/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/pom.xml
index 9092f50..25ba3ea 100644
--- a/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/pom.xml
+++ b/tooling/archetypes/camel-archetype-webconsole/src/main/resources/archetype-resources/pom.xml
@@ -25,17 +25,12 @@
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
- <name>Camel Web Console Application</name>
+ <name>Camel Router Application</name>
<description>Camel project that deploys the Camel Web Console, REST API, and your routes as a WAR</description>
<url>http://www.myorganization.org</url>
-
+
<packaging>war</packaging>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -43,8 +38,8 @@
<version>${camel-version}</version>
<type>war</type>
<scope>runtime</scope>
- </dependency>
-
+ </dependency>
+
<!-- Dependencies for using ActiveMQ -->
<dependency>
<groupId>org.apache.activemq</groupId>
@@ -65,46 +60,46 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<version>${camel-version}</version>
- </dependency>
-
- <!-- Dependencies for stream processing in Camel http://camel.apache.org/stream.html -->
+ </dependency>
+
+ <!-- Dependencies for stream processing in Camel
+ http://camel.apache.org/stream.html -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
<version>${camel-version}</version>
</dependency>
+ <!-- for testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${camel-version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j-version}</version>
- </dependency>
+ <version>${slf4j-version}</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j-version}</version>
+ <version>${slf4j-version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j-version}</version>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j-version}</version>
</dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
- <version>${camel-version}</version>
- <scope>test</scope>
- </dependency>
+
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -115,15 +110,22 @@
</configuration>
</plugin>
- <!-- plugin to run using mvn jetty:run -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-maven-plugin</artifactId>
+ <version>${camel-version}</version>
+ </plugin>
+
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
+
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
+
<systemProperties>
<!-- enable easy JMX connection to JConsole -->
<systemProperty>
@@ -134,8 +136,7 @@
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
-
</plugins>
</build>
-
+
</project>
diff --git a/tooling/archetypes/pom.xml b/tooling/archetypes/pom.xml
index a39ca1b..7c7bded 100644
--- a/tooling/archetypes/pom.xml
+++ b/tooling/archetypes/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tooling/camel-manual/pom.xml b/tooling/camel-manual/pom.xml
index 925f948..c71321e 100644
--- a/tooling/camel-manual/pom.xml
+++ b/tooling/camel-manual/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tooling/maven/camel-maven-plugin/pom.xml b/tooling/maven/camel-maven-plugin/pom.xml
index 1a12717..e2e4b96 100644
--- a/tooling/maven/camel-maven-plugin/pom.xml
+++ b/tooling/maven/camel-maven-plugin/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>maven-plugins</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>camel-maven-plugin</artifactId>
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
index 08ad7f5..89749f1 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
@@ -31,8 +31,6 @@
import java.util.ResourceBundle;
import java.util.Set;
-import org.apache.camel.util.IOHelper;
-
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.siterenderer.Renderer;
@@ -41,7 +39,6 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
-
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
@@ -362,7 +359,7 @@
getLog().info("Running Camel embedded to load Spring XML files from default path: META-INF/spring/*.xml");
}
- List<?> list = project.getTestClasspathElements();
+ List list = project.getTestClasspathElements();
getLog().debug("Using classpath: " + list);
EmbeddedMojo mojo = new EmbeddedMojo();
@@ -532,7 +529,7 @@
private void addFileToBuffer(PrintWriter out, File file) throws MojoExecutionException {
BufferedReader reader = null;
try {
- reader = IOHelper.buffered(new FileReader(file));
+ reader = new BufferedReader(new FileReader(file));
while (true) {
String line = reader.readLine();
if (line == null) {
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
index 17283fb..bdd9fea 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/EmbeddedMojo.java
@@ -96,7 +96,7 @@
* @required
* @readonly
*/
- private List<?> classpathElements;
+ private List classpathElements;
/**
* The main class to execute.
@@ -151,11 +151,11 @@
this.outputDirectory = inOutputDirectory;
}
- public List<?> getClasspathElements() {
+ public List getClasspathElements() {
return classpathElements;
}
- public void setClasspathElements(List<?> classpathElements) {
+ public void setClasspathElements(List classpathElements) {
this.classpathElements = classpathElements;
}
@@ -251,7 +251,7 @@
args.add("-duration");
args.add(getDuration());
- return args.toArray(new String[0]);
+ return (String[]) args.toArray(new String[0]);
}
public ClassLoader createClassLoader(ClassLoader parent) throws MalformedURLException {
diff --git a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
index 12d6127..81a09f4 100644
--- a/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
+++ b/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/RunMojo.java
@@ -132,7 +132,7 @@
/**
* @parameter expression="${project.remoteArtifactRepositories}"
*/
- private List<?> remoteRepositories;
+ private List remoteRepositories;
/**
* @component
@@ -619,7 +619,7 @@
this.addRelevantProjectDependenciesToClasspath(classpathURLs);
getLog().info("Classpath = " + classpathURLs);
- return new URLClassLoader(classpathURLs.toArray(new URL[classpathURLs.size()]));
+ return new URLClassLoader((URL[])classpathURLs.toArray(new URL[classpathURLs.size()]));
}
/**
@@ -635,9 +635,9 @@
}
try {
- Iterator<Artifact> iter = this.determineRelevantPluginDependencies().iterator();
+ Iterator iter = this.determineRelevantPluginDependencies().iterator();
while (iter.hasNext()) {
- Artifact classPathElement = iter.next();
+ Artifact classPathElement = (Artifact)iter.next();
getLog().debug("Adding plugin dependency artifact: " + classPathElement.getArtifactId()
+ " to classpath");
path.add(classPathElement.getFile().toURI().toURL());
@@ -670,9 +670,9 @@
// MEXEC-17
dependencies.addAll(getAllNonTestScopedDependencies());
- Iterator<Artifact> iter = dependencies.iterator();
+ Iterator iter = dependencies.iterator();
while (iter.hasNext()) {
- Artifact classPathElement = iter.next();
+ Artifact classPathElement = (Artifact)iter.next();
getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId()
+ " to classpath");
File file = classPathElement.getFile();
@@ -707,7 +707,7 @@
private Collection<Artifact> getAllDependencies() throws MojoExecutionException {
List<Artifact> artifacts = new ArrayList<Artifact>();
- for (Iterator<?> dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
+ for (Iterator dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
Dependency dependency = (Dependency)dependencies.next();
String groupId = dependency.getGroupId();
@@ -739,7 +739,7 @@
}
List<String> exclusions = new ArrayList<String>();
- for (Iterator<?> j = dependency.getExclusions().iterator(); j.hasNext();) {
+ for (Iterator j = dependency.getExclusions().iterator(); j.hasNext();) {
Exclusion e = (Exclusion)j.next();
exclusions.add(e.getGroupId() + ":" + e.getArtifactId());
}
diff --git a/tooling/maven/guice-maven-plugin/pom.xml b/tooling/maven/guice-maven-plugin/pom.xml
index 2804918..e6052c9 100644
--- a/tooling/maven/guice-maven-plugin/pom.xml
+++ b/tooling/maven/guice-maven-plugin/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>maven-plugins</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>guice-maven-plugin</artifactId>
diff --git a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/DotMojo.java b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/DotMojo.java
index 7416d0a..ecd7526 100644
--- a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/DotMojo.java
+++ b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/DotMojo.java
@@ -31,8 +31,6 @@
import java.util.ResourceBundle;
import java.util.Set;
-import org.apache.camel.util.IOHelper;
-
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.siterenderer.Renderer;
@@ -41,7 +39,6 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
-
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
@@ -342,7 +339,7 @@
if (runCamel) {
getLog().info("Running Camel embedded to load jndi.properties file from the classpath");
- List<?> list = project.getTestClasspathElements();
+ List list = project.getTestClasspathElements();
getLog().debug("Using classpath: " + list);
EmbeddedMojo mojo = new EmbeddedMojo();
@@ -494,7 +491,7 @@
private void addFileToBuffer(PrintWriter out, File file) throws MojoExecutionException {
BufferedReader reader = null;
try {
- reader = IOHelper.buffered(new FileReader(file));
+ reader = new BufferedReader(new FileReader(file));
while (true) {
String line = reader.readLine();
if (line == null) {
diff --git a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java
index 0dfb1f5..6606cca 100644
--- a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java
+++ b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/EmbeddedMojo.java
@@ -81,7 +81,7 @@
* @required
* @readonly
*/
- private List<?> classpathElements;
+ private List classpathElements;
/**
* The main class to execute.
@@ -136,11 +136,11 @@
this.outputDirectory = inOutputDirectory;
}
- public List<?> getClasspathElements() {
+ public List getClasspathElements() {
return classpathElements;
}
- public void setClasspathElements(List<?> classpathElements) {
+ public void setClasspathElements(List classpathElements) {
this.classpathElements = classpathElements;
}
diff --git a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java
index e93ec8e..19c934f 100644
--- a/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java
+++ b/tooling/maven/guice-maven-plugin/src/main/java/org/apache/camel/guice/maven/RunMojo.java
@@ -132,7 +132,7 @@
/**
* @parameter expression="${project.remoteArtifactRepositories}"
*/
- private List<?> remoteRepositories;
+ private List remoteRepositories;
/**
* @component
@@ -573,7 +573,7 @@
this.addRelevantProjectDependenciesToClasspath(classpathURLs);
getLog().info("Classpath = " + classpathURLs);
- return new URLClassLoader(classpathURLs.toArray(new URL[classpathURLs.size()]));
+ return new URLClassLoader((URL[])classpathURLs.toArray(new URL[classpathURLs.size()]));
}
/**
@@ -589,9 +589,9 @@
}
try {
- Iterator<Artifact> iter = this.determineRelevantPluginDependencies().iterator();
+ Iterator iter = this.determineRelevantPluginDependencies().iterator();
while (iter.hasNext()) {
- Artifact classPathElement = iter.next();
+ Artifact classPathElement = (Artifact)iter.next();
getLog().debug("Adding plugin dependency artifact: " + classPathElement.getArtifactId()
+ " to classpath");
path.add(classPathElement.getFile().toURI().toURL());
@@ -624,9 +624,9 @@
// MEXEC-17
dependencies.addAll(getAllNonTestScopedDependencies());
- Iterator<Artifact> iter = dependencies.iterator();
+ Iterator iter = dependencies.iterator();
while (iter.hasNext()) {
- Artifact classPathElement = iter.next();
+ Artifact classPathElement = (Artifact)iter.next();
getLog().debug("Adding project dependency artifact: " + classPathElement.getArtifactId()
+ " to classpath");
File file = classPathElement.getFile();
@@ -661,7 +661,7 @@
private Collection<Artifact> getAllDependencies() throws MojoExecutionException {
List<Artifact> artifacts = new ArrayList<Artifact>();
- for (Iterator<?> dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
+ for (Iterator dependencies = project.getDependencies().iterator(); dependencies.hasNext();) {
Dependency dependency = (Dependency)dependencies.next();
String groupId = dependency.getGroupId();
@@ -693,7 +693,7 @@
}
List<String> exclusions = new ArrayList<String>();
- for (Iterator<?> j = dependency.getExclusions().iterator(); j.hasNext();) {
+ for (Iterator j = dependency.getExclusions().iterator(); j.hasNext();) {
Exclusion e = (Exclusion)j.next();
exclusions.add(e.getGroupId() + ":" + e.getArtifactId());
}
@@ -829,4 +829,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/tooling/maven/maven-html-to-pdf/pom.xml b/tooling/maven/maven-html-to-pdf/pom.xml
index cf28e0b..a679d32 100644
--- a/tooling/maven/maven-html-to-pdf/pom.xml
+++ b/tooling/maven/maven-html-to-pdf/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>maven-plugins</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
</parent>
<artifactId>maven-html-to-pdf</artifactId>
diff --git a/tooling/maven/maven-html-to-pdf/src/main/java/org/apache/camel/maven/HtmlToPdfMojo.java b/tooling/maven/maven-html-to-pdf/src/main/java/org/apache/camel/maven/HtmlToPdfMojo.java
index 95fc91b..d9233e6 100644
--- a/tooling/maven/maven-html-to-pdf/src/main/java/org/apache/camel/maven/HtmlToPdfMojo.java
+++ b/tooling/maven/maven-html-to-pdf/src/main/java/org/apache/camel/maven/HtmlToPdfMojo.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.maven;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -31,13 +33,10 @@
import org.apache.camel.converter.jaxp.XmlConverter;
import org.apache.camel.dataformat.tagsoup.TidyMarkupDataFormat;
-import org.apache.camel.util.IOHelper;
-
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
-
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
@@ -252,7 +251,7 @@
}
private void storeDummyFile() throws FileNotFoundException {
- PrintWriter out = new PrintWriter(IOHelper.buffered(new FileOutputStream(getHTMLFileName())));
+ PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(getHTMLFileName())));
out.println("<html>");
out.println("<body>Generation of the offline PDF version of the manual failed, however you could try "
+ "<a href=\"http://camel.apache.org/book-in-one-page.html\">the online HTML version</a>.</body>");
@@ -262,7 +261,7 @@
}
private void storeHTMLFile(String content) throws FileNotFoundException {
- PrintWriter out = new PrintWriter(IOHelper.buffered(new FileOutputStream(getHTMLFileName())));
+ PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(getHTMLFileName())));
out.println("<html>");
out.println("<head>");
out.println(" <base href=\"" + page + "\"/>");
@@ -309,7 +308,7 @@
try {
TidyMarkupDataFormat dataFormat = new TidyMarkupDataFormat();
dataFormat.setMethod("html");
- Node doc = dataFormat.asNodeTidyMarkup(IOHelper.buffered(url.openStream()));
+ Node doc = dataFormat.asNodeTidyMarkup(new BufferedInputStream(url.openStream()));
XPath xpath = XPathFactory.newInstance().newXPath();
Node nd = (Node)xpath.evaluate("//div[@class='" + contentDivClass + "']", doc, XPathConstants.NODE);
if (nd != null) {
diff --git a/tooling/maven/pom.xml b/tooling/maven/pom.xml
index b59517b..2cd6cd1 100644
--- a/tooling/maven/pom.xml
+++ b/tooling/maven/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../../parent</relativePath>
</parent>
diff --git a/tooling/pom.xml b/tooling/pom.xml
index 44e2d1f..8c0bfd6 100644
--- a/tooling/pom.xml
+++ b/tooling/pom.xml
@@ -14,15 +14,14 @@
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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-parent</artifactId>
- <version>2.10-SNAPSHOT</version>
+ <version>2.9.1</version>
<relativePath>../parent</relativePath>
</parent>
@@ -34,7 +33,7 @@
<modules>
<module>maven</module>
<module>archetypes</module>
- <module>camel-manual</module>
+ <module>camel-manual</module>
</modules>
</project>