camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [23/23] camel git commit: Make it work for OSGi
Date Wed, 23 Mar 2016 18:59:43 GMT
Make it work for OSGi


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/31991b58
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/31991b58
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/31991b58

Branch: refs/heads/master
Commit: 31991b581af5aca1805215c5db45744059129090
Parents: 5851545
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Mar 23 19:53:46 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Mar 23 19:59:05 2016 +0100

----------------------------------------------------------------------
 components/camel-cm-sms/pom.xml                 |  5 ---
 .../apache/camel/component/cm/CMComponent.java  | 11 ++----
 .../apache/camel/component/cm/test/CMTest.java  |  7 ----
 parent/pom.xml                                  |  1 -
 .../features/src/main/resources/features.xml    | 16 ++++----
 .../camel/itest/karaf/CamelCmSmsTest.java       | 39 ++++++++++++++++++++
 6 files changed, 52 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/components/camel-cm-sms/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/pom.xml b/components/camel-cm-sms/pom.xml
index 4200180..a14774e 100644
--- a/components/camel-cm-sms/pom.xml
+++ b/components/camel-cm-sms/pom.xml
@@ -69,11 +69,6 @@
       <artifactId>javax.el-api</artifactId>
       <version>${javax.el-api-version}</version>
     </dependency>
-    <dependency>
-      <groupId>commons-validator</groupId>
-      <artifactId>commons-validator</artifactId>
-      <version>${commons-validator-version}</version>
-    </dependency>
 
     <!-- test dependencies -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
index 73d1250..5844dc9 100644
--- a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
+++ b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMComponent.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.cm;
 
 import java.util.Map;
 import java.util.Set;
-
 import javax.validation.ConstraintViolation;
 import javax.validation.Validator;
 
@@ -28,7 +27,6 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.util.URISupport;
-import org.apache.commons.validator.routines.UrlValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,6 +41,10 @@ public class CMComponent extends UriEndpointComponent {
     @BeanInject
     private Validator validator;
 
+    public CMComponent() {
+        super(CMEndpoint.class);
+    }
+
     public CMComponent(final CamelContext context) {
         super(context, CMEndpoint.class);
     }
@@ -55,11 +57,6 @@ public class CMComponent extends UriEndpointComponent {
 
         LOG.debug("Creating CM Endpoint ... ");
 
-        final String url = CMConstants.DEFAULT_SCHEME + remaining;
-        if (!UrlValidator.getInstance().isValid(url)) {
-            throw new ResolveEndpointFailedException(uri, String.format("HOST provided: %s
seem to be invalid. Remember SCHEME has to be excluded.", url));
-        }
-
         LOG.debug("Uri=[{}], path=[{}], parameters=[{}]", new Object[] {URISupport.sanitizeUri(uri),
URISupport.sanitizePath(remaining), parameters });
 
         // Set configuration based on uri parameters

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
index e151e5a..8e3246d 100644
--- a/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
+++ b/components/camel-cm-sms/src/test/java/org/apache/camel/component/cm/test/CMTest.java
@@ -155,13 +155,6 @@ public class CMTest extends AbstractJUnit4SpringContextTests {
         }
     }
 
-    @Test(expected = ResolveEndpointFailedException.class)
-    public void testInvalidUriEndpoint() throws Throwable {
-        // cm-sms://sgw01.cm.nl/gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true
-        String noHostUri = "cm-sms://gateway.ashx?defaultFrom=MyBusiness&defaultMaxNumberOfParts=8&productToken=ea723fd7-da81-4826-89bc-fa7144e71c40&testConnectionOnStartup=true";
-        camelContext.getEndpoint(noHostUri);
-    }
-
     /*
      * 2. Invalid Payload
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index b19d6d1..63831e7 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -125,7 +125,6 @@
     <commons-net-version>3.3</commons-net-version>
     <commons-pool-version>1.6</commons-pool-version>
     <commons-pool2-version>2.4.2</commons-pool2-version>
-	<commons-validator-version>1.5.0</commons-validator-version>
     <commons-vfs2-version>2.0</commons-vfs2-version>
     <compress-lzf-version>1.0.3</compress-lzf-version>
     <concurrentlinkedhashmap.version>1.4.2</concurrentlinkedhashmap.version>

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 6e19906..df02687 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -289,15 +289,17 @@
     <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.chunk-templates/${chunk-templates-bundle-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-chunk/${project.version}</bundle>
   </feature>
-  <feature name='camel-cm' version='${project.version}' resolver='(obr)' start-level='50'>
+  <feature name='camel-cm-sms' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
     <feature version='${cxf-version-range}'>cxf-specs</feature>
-	<bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
-	<bundle dependency='true'>mvn:org.jsoup/jsoup/${jsoup-version}</bundle>
-	<bundle dependency='true'>mvn:javax.validation/validation-api/${validation-api-version}</bundle>
-	<bundle dependency='true'>mvn:javax.el/javax.el-api/${javax.el-api-version}</bundle>
-	<bundle dependency='true'>mvn:commons-validator/commons-validator/${commons-validator-version}</bundle>
-    <bundle>mvn:org.apache.camel/camel-cm/${project.version}</bundle>
+    <bundle dependency='true'>wrap:mvn:com.googlecode.libphonenumber/libphonenumber/${libphonenumber-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpcore-osgi/${httpcore4-version}</bundle>
+    <bundle dependency='true'>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient4-version}</bundle>
+    <bundle dependency='true'>mvn:javax.servlet/javax.servlet-api/${javax.servlet-api-version}</bundle>
+	  <bundle dependency='true'>mvn:org.jsoup/jsoup/${jsoup-version}</bundle>
+	  <bundle dependency='true'>mvn:javax.validation/validation-api/${validation-api-version}</bundle>
+	  <bundle dependency='true'>mvn:javax.el/javax.el-api/${javax.el-api-version}</bundle>
+    <bundle>mvn:org.apache.camel/camel-cm-sms/${project.version}</bundle>
   </feature>
   <feature name='camel-cmis' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>

http://git-wip-us.apache.org/repos/asf/camel/blob/31991b58/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
new file mode 100644
index 0000000..74d699e
--- /dev/null
+++ b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelCmSmsTest.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+
+@RunWith(PaxExam.class)
+public class CamelCmSmsTest extends AbstractFeatureTest {
+    public static final String COMPONENT = extractName(CamelCmSmsTest.class);
+
+    @Test
+    public void test() throws Exception {
+        testComponent(COMPONENT);
+    }
+
+    @Configuration
+    public static Option[] configure() {
+        return configure(COMPONENT);
+    }
+
+}


Mime
View raw message