camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] git commit: CAMEL-6749: Mustache should use app CL to better load resources in OSGi etc. Also a number of dependency upgrades as well.
Date Sun, 15 Sep 2013 08:28:28 GMT
CAMEL-6749: Mustache should use app CL to better load resources in OSGi etc. Also a number
of dependency upgrades as well.


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

Branch: refs/heads/master
Commit: bfb4ec2b3dc94aa2077b642cc3b0716e834e55df
Parents: 3ad6c9e
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Sep 15 10:27:36 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Sep 15 10:27:36 2013 +0200

----------------------------------------------------------------------
 .../camel/component/amqp/AMQPRouteTest.java     | 11 ++-
 .../camel-amqp/src/test/resources/config.json   | 27 +++++++
 .../camel-amqp/src/test/resources/config.xml    | 83 --------------------
 .../camel-amqp/src/test/resources/log4j.xml     |  9 ++-
 .../component/mustache/MustacheEndpoint.java    | 19 +++++
 parent/pom.xml                                  | 18 ++---
 6 files changed, 70 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bfb4ec2b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
index 5bbd086..2a67cdb 100644
--- a/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
+++ b/components/camel-amqp/src/test/java/org/apache/camel/component/amqp/AMQPRouteTest.java
@@ -53,8 +53,9 @@ public class AMQPRouteTest extends CamelTestSupport {
     @Before
     public void setUp() throws Exception {
         BrokerOptions options = new BrokerOptions();
-        options.setConfigFile("src/test/resources/config.xml");
-        options.setLogConfigFile("src/test/resources/log4j.xml");
+        options.setConfigurationStoreType("memory");
+        options.setInitialConfigurationLocation("src/test/resources/config.json");
+        options.setLogConfigFileLocation("src/test/resources/log4j.xml");
 
         broker = new Broker();
         broker.startup(options);
@@ -65,8 +66,8 @@ public class AMQPRouteTest extends CamelTestSupport {
 
     @Override
     public void tearDown() throws Exception {
-        broker.shutdown();
         super.tearDown();
+        broker.shutdown();
     }
 
     protected CamelContext createCamelContext() throws Exception {
@@ -78,7 +79,9 @@ public class AMQPRouteTest extends CamelTestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("amqp:queue:ping").to("mock:result");
+                from("amqp:queue:ping")
+                    .to("log:routing")
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/bfb4ec2b/components/camel-amqp/src/test/resources/config.json
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/config.json b/components/camel-amqp/src/test/resources/config.json
new file mode 100644
index 0000000..f15ab94
--- /dev/null
+++ b/components/camel-amqp/src/test/resources/config.json
@@ -0,0 +1,27 @@
+{
+  "name": "Broker",
+  "defaultVirtualHost": "default",
+  "modelVersion": "1.0",
+  "storeVersion": 1,
+  "authenticationproviders": [
+    {
+      "name": "passwordFile",
+      "path": "src/test/resources/passwd",
+      "type": "PlainPasswordFile"
+    }
+  ],
+  "ports": [
+    {
+      "authenticationProvider": "passwordFile",
+      "name": "AMQP",
+      "port": "5672"
+    }
+  ],
+  "virtualhosts": [
+    {
+      "name": "test",
+      "type" : "VirtualHost",
+      "configPath": "src/test/resources/virtualhosts.xml"
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/bfb4ec2b/components/camel-amqp/src/test/resources/config.xml
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/config.xml b/components/camel-amqp/src/test/resources/config.xml
deleted file mode 100644
index ef4e1b8..0000000
--- a/components/camel-amqp/src/test/resources/config.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<broker>
-  <prefix>target</prefix>
-  <work>work</work>
-  <conf>src/test/resources</conf>
-
-  <plugin-directory>target</plugin-directory>
-  <cache-directory>target/cache</cache-directory>
-
-  <connector>
-    <port>5672</port>
-    <socketReceiveBuffer>262144</socketReceiveBuffer>
-    <socketSendBuffer>262144</socketSendBuffer>
-  </connector>
-  <management>
-    <enabled>false</enabled>
-    <jmxport>
-      <registryServer>8999</registryServer>
-      <!--
-       If unspecified, connectorServer defaults to 100 + registryServer port.
-      <connectorServer>9099</connectionServer>
-      -->
-    </jmxport>
-    <ssl>
-      <enabled>false</enabled>
-      <!-- Update below path to your keystore location. -->
-      <keyStorePath>${conf}/qpid.keystore</keyStorePath>
-      <keyStorePassword>password</keyStorePassword>
-    </ssl>
-  </management>
-  <advanced>
-    <framesize>65535</framesize>
-    <locale>en_US</locale>
-  </advanced>
-
-  <security>
-    <pd-auth-manager>
-      <principal-database>
-        <class>org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase</class>
-        <attributes>
-          <attribute>
-            <name>passwordFile</name>
-            <value>${conf}/passwd</value>
-          </attribute>
-        </attributes>
-      </principal-database>
-    </pd-auth-manager>
-
-    <!-- By default, all authenticated users have permissions to perform all actions -->
-
-    <!-- ACL Example
-         This example illustrates securing the both Management (JMX) and Messaging.
-    <acl>${conf}/broker_example.acl</acl>
-    -->
-
-    <msg-auth>false</msg-auth>
-  </security>
-
-  <virtualhosts>${conf}/virtualhosts.xml</virtualhosts>
-
-  <queue>
-    <auto_register>true</auto_register>
-  </queue>
-
-</broker>
-
-

http://git-wip-us.apache.org/repos/asf/camel/blob/bfb4ec2b/components/camel-amqp/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/components/camel-amqp/src/test/resources/log4j.xml b/components/camel-amqp/src/test/resources/log4j.xml
index 7cc888a..688a10b 100644
--- a/components/camel-amqp/src/test/resources/log4j.xml
+++ b/components/camel-amqp/src/test/resources/log4j.xml
@@ -23,8 +23,15 @@
       %5p %c{1} - %m%n"/>
     </layout>
   </appender>
+  <appender name="file" class="org.apache.log4j.FileAppender">
+    <param name="file" value="target/camel-amqp-test.log"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{ABSOLUTE}
+      %5p %c{1} - %m%n"/>
+    </layout>
+  </appender>
   <root>
     <priority value="info"></priority>
-    <appender-ref ref="stdout"/>
+    <appender-ref ref="file"/>
   </root>
 </log4j:configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/bfb4ec2b/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheEndpoint.java
b/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheEndpoint.java
index a82fdd2..21d4402 100644
--- a/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheEndpoint.java
+++ b/components/camel-mustache/src/main/java/org/apache/camel/component/mustache/MustacheEndpoint.java
@@ -116,7 +116,12 @@ public class MustacheEndpoint extends ResourceEndpoint {
      * @return Template
      */
     private Mustache createMustache(Reader resourceReader, String resourceUri) throws IOException
{
+        ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader apcl = getCamelContext().getApplicationContextClassLoader();
+            if (apcl != null) {
+                Thread.currentThread().setContextClassLoader(apcl);
+            }
             Mustache newMustache;
             if (startDelimiter != null && endDelimiter != null && mustacheFactory
instanceof DefaultMustacheFactory) {
                 DefaultMustacheFactory defaultMustacheFactory = (DefaultMustacheFactory)
mustacheFactory;
@@ -127,6 +132,9 @@ public class MustacheEndpoint extends ResourceEndpoint {
             return newMustache;
         } finally {
             resourceReader.close();
+            if (oldcl != null) {
+                Thread.currentThread().setContextClassLoader(oldcl);
+            }
         }
     }
 
@@ -137,6 +145,17 @@ public class MustacheEndpoint extends ResourceEndpoint {
         return mustache;
     }
 
+    @Override
+    public String getResourceUri() {
+        // do not have leading slash as mustache cannot find the resource, as that entails
classpath root
+        String uri = super.getResourceUri();
+        if (uri != null && (uri.startsWith("/") || uri.startsWith("\\"))) {
+            return uri.substring(1);
+        } else {
+            return uri;
+        }
+    }
+
     public MustacheFactory getMustacheFactory() {
         return mustacheFactory;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/bfb4ec2b/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 1592911..30602f9 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -154,8 +154,8 @@
     <geronimo-servlet-spec-version>1.2</geronimo-servlet-spec-version>
     <geronimo-ws-metadata-spec-version>1.1.3</geronimo-ws-metadata-spec-version>
     <gmaven-plugin-version>1.4</gmaven-plugin-version>
-    <google-app-engine-version>1.8.2</google-app-engine-version>
-    <google-app-engine-bundle-version>1.8.2_1</google-app-engine-bundle-version>
+    <google-app-engine-version>1.8.3</google-app-engine-version>
+    <google-app-engine-bundle-version>1.8.3_1</google-app-engine-bundle-version>
     <google-gdata-version>1.41.5.w1</google-gdata-version>
     <google-gdata-bundle-version>1.41.1_1</google-gdata-bundle-version>
     <google-guava-version>14.0.1</google-guava-version>
@@ -191,8 +191,8 @@
     <jackrabbit-version>2.2.12</jackrabbit-version>
     <jain-sip-ri-bundle-version>1.2.154_2</jain-sip-ri-bundle-version>
     <jasper-bundle-version>6.0.36_1</jasper-bundle-version>
-    <jasypt-bundle-version>1.9.0_1</jasypt-bundle-version>
-    <jasypt-version>1.9.0</jasypt-version>
+    <jasypt-bundle-version>1.9.1_1</jasypt-bundle-version>
+    <jasypt-version>1.9.1</jasypt-version>
     <java-apns-bundle-version>0.1.6_3</java-apns-bundle-version>
     <java-apns-version>0.1.6</java-apns-version>
     <javacrumbs-version>0.22</javacrumbs-version>
@@ -292,8 +292,8 @@
     <mongo-java-driver-version>2.11.2</mongo-java-driver-version>
     <mqtt-client-version>1.5</mqtt-client-version>
     <msv-version>20050913</msv-version>
-    <mustache-java-version>0.8.12</mustache-java-version>
-    <mustache-bundle-version>0.8.12_1/</mustache-bundle-version>
+    <mustache-java-version>0.8.13</mustache-java-version>
+    <mustache-bundle-version>0.8.13_1/</mustache-bundle-version>
     <mvel-version>2.1.6.Final</mvel-version>
     <mybatis-version>3.2.2</mybatis-version>
     <neethi-bundle-version>3.0.1</neethi-bundle-version>
@@ -321,8 +321,8 @@
     <pojosr-version>0.2.1</pojosr-version>
     <protobuf-java-bundle-version>2.3.0_3</protobuf-java-bundle-version>
     <protobuf-version>2.3.0</protobuf-version>
-    <qpid-bundle-version>0.20_1</qpid-bundle-version>
-    <qpid-version>0.20</qpid-version>
+    <qpid-bundle-version>0.22_1</qpid-bundle-version>
+    <qpid-version>0.22</qpid-version>
     <quartz-bundle-version>1.8.6_1</quartz-bundle-version>
     <quartz-version>1.8.6</quartz-version>
     <quartz2-version>2.2.0</quartz2-version>
@@ -437,7 +437,7 @@
       org.springframework.*;version="${spring-version-range}",
       org.apache.commons.logging.*;version="[1.1,2)",
       org.apache.cxf.*;version="${cxf-version-range}",
-      org.apache.qpid.*;version="[0.14,1)",
+      org.apache.qpid.*;version="[0.20,1)",
       org.apache.abdera.*;version="[0.4,2)",
       org.apache.commons.httpclient.*;version="[3.1,4.0)",
       org.apache.velocity.*;version="[1.6.2,2)",


Mime
View raw message