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 2014/06/10 14:28:21 UTC
[1/4] git commit: Fix for CAMEL-7486
Repository: camel
Updated Branches:
refs/heads/master dbc6dcce9 -> bd1045705
Fix for CAMEL-7486
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/30f18e3f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/30f18e3f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/30f18e3f
Branch: refs/heads/master
Commit: 30f18e3f4c3211768b365c86a3b0f8c5be38e4b9
Parents: 86797a3
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Tue Jun 10 13:53:38 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Tue Jun 10 13:54:23 2014 +0200
----------------------------------------------------------------------
.../component/mybatis/MyBatisComponent.java | 9 +++-
.../component/mybatis/MyBatisEndpoint.java | 5 ++
...ponentConfigurationAndDocumentationTest.java | 57 ++++++++++++++++++++
3 files changed, 69 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/30f18e3f/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
index 3650d7e..4a8585f 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisComponent.java
@@ -20,8 +20,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
+import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.ResourceHelper;
@@ -31,11 +32,15 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
/**
* @version
*/
-public class MyBatisComponent extends DefaultComponent {
+public class MyBatisComponent extends UriEndpointComponent {
private SqlSessionFactory sqlSessionFactory;
private String configurationUri = "SqlMapConfig.xml";
+ public MyBatisComponent() {
+ super(MyBatisEndpoint.class);
+ }
+
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
MyBatisEndpoint answer = new MyBatisEndpoint(uri, this, remaining);
http://git-wip-us.apache.org/repos/asf/camel/blob/30f18e3f/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
index f9a82e9..ae8511d 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
@@ -23,6 +23,8 @@ import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultPollingEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
import org.apache.camel.util.ObjectHelper;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSessionFactory;
@@ -30,12 +32,15 @@ import org.apache.ibatis.session.SqlSessionFactory;
/**
* @version
*/
+@UriEndpoint(scheme = "mybatis", consumerClass = MyBatisConsumer.class)
public class MyBatisEndpoint extends DefaultPollingEndpoint {
private MyBatisProcessingStrategy processingStrategy;
+ @UriParam
private String statement;
private StatementType statementType;
private ExecutorType executorType;
+ @UriParam
private int maxMessagesPerPoll;
public MyBatisEndpoint() {
http://git-wip-us.apache.org/repos/asf/camel/blob/30f18e3f/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..0133b97
--- /dev/null
+++ b/components/camel-mybatis/src/test/java/org/apache/camel/component/mybatis/MyBatisComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.mybatis;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class MyBatisComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+ private static final String COMPONENT_NAME = "mybatis";
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ MyBatisComponent comp = context.getComponent(COMPONENT_NAME, MyBatisComponent.class);
+ EndpointConfiguration conf = comp.createConfiguration("mybatis:insertAccount?statementType=Insert&maxMessagesPerPoll=5");
+
+ assertEquals("Insert", conf.getParameter("statementType"));
+ assertEquals("5", conf.getParameter("maxMessagesPerPoll"));
+
+ ComponentConfiguration compConf = comp.createComponentConfiguration();
+ String json = compConf.createParameterJsonSchema();
+ assertNotNull(json);
+
+ assertTrue(json.contains("\"maxMessagesPerPoll\": { \"type\": \"int\" }"));
+ assertTrue(json.contains("\"statement\": { \"type\": \"java.lang.String\" }"));
+ }
+
+ @Test
+ public void testComponentDocumentation() throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ String html = context.getComponentDocumentation(COMPONENT_NAME);
+ assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+ }
+
+}
[3/4] git commit: Polished
Posted by da...@apache.org.
Polished
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fc23b55b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fc23b55b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fc23b55b
Branch: refs/heads/master
Commit: fc23b55bcc7817bef08e20a584094f53300ae137
Parents: f6fe643
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jun 10 14:19:03 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jun 10 14:19:03 2014 +0200
----------------------------------------------------------------------
.../org/apache/camel/component/mybatis/MyBatisEndpoint.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/fc23b55b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
index ae8511d..ea944ce 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
@@ -35,7 +35,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
@UriEndpoint(scheme = "mybatis", consumerClass = MyBatisConsumer.class)
public class MyBatisEndpoint extends DefaultPollingEndpoint {
- private MyBatisProcessingStrategy processingStrategy;
+ private MyBatisProcessingStrategy processingStrategy = new DefaultMyBatisProcessingStrategy();
@UriParam
private String statement;
private StatementType statementType;
@@ -106,10 +106,7 @@ public class MyBatisEndpoint extends DefaultPollingEndpoint {
this.executorType = ExecutorType.valueOf(executorType.toUpperCase());
}
- public synchronized MyBatisProcessingStrategy getProcessingStrategy() {
- if (processingStrategy == null) {
- processingStrategy = new DefaultMyBatisProcessingStrategy();
- }
+ public MyBatisProcessingStrategy getProcessingStrategy() {
return processingStrategy;
}
[2/4] git commit: Merge branch 'CAMEL-7482' of
https://github.com/kevinearls/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7482' of https://github.com/kevinearls/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f6fe6434
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f6fe6434
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f6fe6434
Branch: refs/heads/master
Commit: f6fe64343b447655dbd7dfbc633c523e3d9a9196
Parents: dbc6dcc 30f18e3
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jun 10 14:15:52 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jun 10 14:15:52 2014 +0200
----------------------------------------------------------------------
.../component/mybatis/MyBatisComponent.java | 9 +++-
.../component/mybatis/MyBatisEndpoint.java | 5 ++
...ponentConfigurationAndDocumentationTest.java | 57 ++++++++++++++++++++
3 files changed, 69 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[4/4] git commit: CAMEL-7486: add statement type as uri param
Posted by da...@apache.org.
CAMEL-7486: add statement type as uri param
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bd104570
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bd104570
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bd104570
Branch: refs/heads/master
Commit: bd104570520861002a9d25c61c01781b62ce3c79
Parents: fc23b55
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jun 10 14:21:24 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Jun 10 14:21:24 2014 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/mybatis/MyBatisEndpoint.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/bd104570/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
index ea944ce..e11c8ca 100644
--- a/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
+++ b/components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisEndpoint.java
@@ -36,10 +36,11 @@ import org.apache.ibatis.session.SqlSessionFactory;
public class MyBatisEndpoint extends DefaultPollingEndpoint {
private MyBatisProcessingStrategy processingStrategy = new DefaultMyBatisProcessingStrategy();
+ private ExecutorType executorType;
@UriParam
private String statement;
+ @UriParam
private StatementType statementType;
- private ExecutorType executorType;
@UriParam
private int maxMessagesPerPoll;