camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1164334 - in /camel/trunk/components: camel-cache/src/test/java/org/apache/camel/component/cache/ camel-exec/src/main/java/org/apache/camel/component/exec/ camel-exec/src/test/java/org/apache/camel/component/exec/
Date Fri, 02 Sep 2011 02:36:12 GMT
Author: hadrian
Date: Fri Sep  2 02:36:12 2011
New Revision: 1164334

URL: http://svn.apache.org/viewvc?rev=1164334&view=rev
Log:
More URI encoding fixes

Modified:
    camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
    camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java
    camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java

Modified: camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java?rev=1164334&r1=1164333&r2=1164334&view=diff
==============================================================================
--- camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
(original)
+++ camel/trunk/components/camel-cache/src/test/java/org/apache/camel/component/cache/CacheProducerTest.java
Fri Sep  2 02:36:12 2011
@@ -133,7 +133,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -185,7 +185,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -222,7 +222,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -258,7 +258,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -279,7 +279,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -305,7 +305,7 @@ public class CacheProducerTest extends C
                 onException(CacheException.class).
                         handled(true).
                         choice().when(exceptionMessage().isEqualTo(CacheConstants.CACHE_OPERATION
+ " UNKNOWN is not supported.")).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException").end();
 
                 from("direct:a").
@@ -332,7 +332,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -360,7 +360,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").
@@ -388,7 +388,7 @@ public class CacheProducerTest extends C
             public void configure() {
                 onException(CacheException.class).
                         handled(true).
-                        to("log:*** LOGGER").
+                        to("log:LOGGER").
                         to("mock:CacheProducerTest.cacheException");
 
                 from("direct:a").

Modified: camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java?rev=1164334&r1=1164333&r2=1164334&view=diff
==============================================================================
--- camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java
(original)
+++ camel/trunk/components/camel-exec/src/main/java/org/apache/camel/component/exec/ExecComponent.java
Fri Sep  2 02:36:12 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.exec;
 
+import java.net.URLDecoder;
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
@@ -31,7 +32,7 @@ public class ExecComponent extends Defau
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object>
parameters) throws Exception {
         ExecEndpoint endpoint = new ExecEndpoint(uri, this);
         setProperties(endpoint, parameters);
-        endpoint.setExecutable(remaining);
+        endpoint.setExecutable(URLDecoder.decode(remaining, "UTF-8"));
         return endpoint;
     }
 }

Modified: camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java?rev=1164334&r1=1164333&r2=1164334&view=diff
==============================================================================
--- camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java
(original)
+++ camel/trunk/components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java
Fri Sep  2 02:36:12 2011
@@ -18,6 +18,7 @@ package org.apache.camel.component.exec;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
+import org.apache.camel.util.UnsafeUriCharactersEncoder;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -102,7 +103,8 @@ public class ExecEndpointTest extends Ab
     @DirtiesContext
     public void testCreateEndpointWithArgs() throws Exception {
         String args = "arg1 arg2 arg3";
-        ExecEndpoint e = createExecEndpoint("exec:test?args=" + args);
+        // Need to properly encode the URI
+        ExecEndpoint e = createExecEndpoint("exec:test?args=" + args.replaceAll(" ", "+"));
         assertEquals(args, e.getArgs());
     }
 
@@ -110,7 +112,7 @@ public class ExecEndpointTest extends Ab
     @DirtiesContext
     public void testCreateEndpointWithArgs2() throws Exception {
         String args = "arg1 \"arg2 \" arg3";
-        ExecEndpoint e = createExecEndpoint("exec:test?args=" + args);
+        ExecEndpoint e = createExecEndpoint("exec:test?args=" + UnsafeUriCharactersEncoder.encode(args));
         assertEquals(args, e.getArgs());
     }
 
@@ -145,7 +147,7 @@ public class ExecEndpointTest extends Ab
         String dir = "\"c:/program files/wokr/temp\"";
         String uri = "exec:" + cmd + "?workingDir=" + dir;
 
-        ExecEndpoint endpoint = createExecEndpoint(uri);
+        ExecEndpoint endpoint = createExecEndpoint(UnsafeUriCharactersEncoder.encode(uri));
         assertEquals(cmd, endpoint.getExecutable());
         assertNull(endpoint.getArgs());
         assertNotNull(endpoint.getCommandExecutor());
@@ -159,7 +161,7 @@ public class ExecEndpointTest extends Ab
         String executable = "C:/Program Files/test/text.exe";
         String uri = "exec:" + executable;
 
-        ExecEndpoint endpoint = createExecEndpoint(uri);
+        ExecEndpoint endpoint = createExecEndpoint(UnsafeUriCharactersEncoder.encode(uri));
 
         assertNull(endpoint.getArgs());
         assertNull(endpoint.getWorkingDir());
@@ -175,7 +177,8 @@ public class ExecEndpointTest extends Ab
         String argsEscaped = "arg1 arg2 \"arg 3\"";
         long timeout = 10000L;
 
-        ExecEndpoint e = createExecEndpoint("exec:executable.exe?workingDir=" + workingDir
+ "&timeout=" + timeout + "&args=" + argsEscaped);
+        String uri = "exec:executable.exe?workingDir=" + workingDir + "&timeout=" + timeout
+ "&args=" + argsEscaped;
+        ExecEndpoint e = createExecEndpoint(UnsafeUriCharactersEncoder.encode(uri));
         assertEquals(workingDir, e.getWorkingDir());
         assertEquals(argsEscaped, e.getArgs());
         assertEquals(timeout, e.getTimeout());
@@ -192,7 +195,7 @@ public class ExecEndpointTest extends Ab
         builder.append("&outFile=" + outFile);
         builder.append("&commandExecutor=#customExecutor&binding=#customBinding");
 
-        ExecEndpoint e = createExecEndpoint(builder.toString());
+        ExecEndpoint e = createExecEndpoint(UnsafeUriCharactersEncoder.encode(builder.toString()));
         assertEquals(workingDir, e.getWorkingDir());
         assertEquals(timeout, e.getTimeout());
         assertEquals(outFile, e.getOutFile());



Mime
View raw message