You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/07/15 13:21:39 UTC
[1/2] camel git commit: CAMEL-10142: Fixed using scheduler=spring
without any further configuration would not use spring as the scheduler.
Repository: camel
Updated Branches:
refs/heads/camel-2.17.x d88907a6d -> e6ce94feb
refs/heads/master ee03cec2a -> a80c4ba0a
CAMEL-10142: Fixed using scheduler=spring without any further configuration would not use spring as the scheduler.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a80c4ba0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a80c4ba0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a80c4ba0
Branch: refs/heads/master
Commit: a80c4ba0a84d5c21bb93241a12d4c3b05b4509a2
Parents: ee03cec
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 15 12:44:47 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 15 15:20:48 2016 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/DefaultComponent.java | 22 ++++-----
.../file/FileConsumerSpringSchedulerTest.java | 47 ++++++++++++++++++++
2 files changed, 59 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a80c4ba0/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
index 51ce352..dca1446 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
@@ -114,17 +114,15 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone
return null;
}
- if (!parameters.isEmpty()) {
- endpoint.configureProperties(parameters);
- if (useIntrospectionOnEndpoint()) {
- setProperties(endpoint, parameters);
- }
+ endpoint.configureProperties(parameters);
+ if (useIntrospectionOnEndpoint()) {
+ setProperties(endpoint, parameters);
+ }
- // if endpoint is strict (not lenient) and we have unknown parameters configured then
- // fail if there are parameters that could not be set, then they are probably misspell or not supported at all
- if (!endpoint.isLenientProperties()) {
- validateParameters(uri, parameters, null);
- }
+ // if endpoint is strict (not lenient) and we have unknown parameters configured then
+ // fail if there are parameters that could not be set, then they are probably misspell or not supported at all
+ if (!endpoint.isLenientProperties()) {
+ validateParameters(uri, parameters, null);
}
afterConfiguration(uri, path, endpoint, parameters);
@@ -172,6 +170,10 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone
* @throws ResolveEndpointFailedException should be thrown if the URI validation failed
*/
protected void validateParameters(String uri, Map<String, Object> parameters, String optionPrefix) {
+ if (parameters == null || parameters.isEmpty()) {
+ return;
+ }
+
Map<String, Object> param = parameters;
if (optionPrefix != null) {
param = IntrospectionSupport.extractProperties(parameters, optionPrefix);
http://git-wip-us.apache.org/repos/asf/camel/blob/a80c4ba0/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java
new file mode 100644
index 0000000..08f0b13
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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 org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class FileConsumerSpringSchedulerTest extends ContextTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ public void testSpring() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("file:target/file/custom?scheduler=spring").routeId("foo").noAutoStartup()
+ .to("mock:result");
+ }
+ });
+ try {
+ context.start();
+ fail("Should throw exception");
+ } catch (Exception e) {
+ ClassNotFoundException cnfe = assertIsInstanceOf(ClassNotFoundException.class, e.getCause().getCause().getCause());
+ assertEquals("org.apache.camel.spring.pollingconsumer.SpringScheduledPollConsumerScheduler", cnfe.getMessage());
+ }
+ }
+
+}
+
[2/2] camel git commit: CAMEL-10142: Fixed using scheduler=spring
without any further configuration would not use spring as the scheduler.
Posted by da...@apache.org.
CAMEL-10142: Fixed using scheduler=spring without any further configuration would not use spring as the scheduler.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e6ce94fe
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e6ce94fe
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e6ce94fe
Branch: refs/heads/camel-2.17.x
Commit: e6ce94feb115939fbd86480de58a739270440622
Parents: d88907a
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 15 12:44:47 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 15 15:21:30 2016 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/DefaultComponent.java | 22 ++++-----
.../file/FileConsumerSpringSchedulerTest.java | 47 ++++++++++++++++++++
2 files changed, 59 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e6ce94fe/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
index c6492ea..055df59 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultComponent.java
@@ -116,17 +116,15 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone
return null;
}
- if (!parameters.isEmpty()) {
- endpoint.configureProperties(parameters);
- if (useIntrospectionOnEndpoint()) {
- setProperties(endpoint, parameters);
- }
+ endpoint.configureProperties(parameters);
+ if (useIntrospectionOnEndpoint()) {
+ setProperties(endpoint, parameters);
+ }
- // if endpoint is strict (not lenient) and we have unknown parameters configured then
- // fail if there are parameters that could not be set, then they are probably misspell or not supported at all
- if (!endpoint.isLenientProperties()) {
- validateParameters(uri, parameters, null);
- }
+ // if endpoint is strict (not lenient) and we have unknown parameters configured then
+ // fail if there are parameters that could not be set, then they are probably misspell or not supported at all
+ if (!endpoint.isLenientProperties()) {
+ validateParameters(uri, parameters, null);
}
afterConfiguration(uri, path, endpoint, parameters);
@@ -174,6 +172,10 @@ public abstract class DefaultComponent extends ServiceSupport implements Compone
* @throws ResolveEndpointFailedException should be thrown if the URI validation failed
*/
protected void validateParameters(String uri, Map<String, Object> parameters, String optionPrefix) {
+ if (parameters == null || parameters.isEmpty()) {
+ return;
+ }
+
Map<String, Object> param = parameters;
if (optionPrefix != null) {
param = IntrospectionSupport.extractProperties(parameters, optionPrefix);
http://git-wip-us.apache.org/repos/asf/camel/blob/e6ce94fe/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java
new file mode 100644
index 0000000..08f0b13
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSpringSchedulerTest.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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 org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class FileConsumerSpringSchedulerTest extends ContextTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ public void testSpring() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("file:target/file/custom?scheduler=spring").routeId("foo").noAutoStartup()
+ .to("mock:result");
+ }
+ });
+ try {
+ context.start();
+ fail("Should throw exception");
+ } catch (Exception e) {
+ ClassNotFoundException cnfe = assertIsInstanceOf(ClassNotFoundException.class, e.getCause().getCause().getCause());
+ assertEquals("org.apache.camel.spring.pollingconsumer.SpringScheduledPollConsumerScheduler", cnfe.getMessage());
+ }
+ }
+
+}
+