You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ha...@apache.org on 2012/01/25 03:25:33 UTC

svn commit: r1235600 - in /camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr: JcrAuthTestBase.java JcrAuthTokenWithLoginTest.java JcrConverterTest.java

Author: hadrian
Date: Wed Jan 25 02:25:33 2012
New Revision: 1235600

URL: http://svn.apache.org/viewvc?rev=1235600&view=rev
Log:
Fix unit tests in camel-jcr

Modified:
    camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java
    camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTokenWithLoginTest.java
    camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java

Modified: camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java?rev=1235600&r1=1235599&r2=1235600&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java (original)
+++ camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTestBase.java Wed Jan 25 02:25:33 2012
@@ -61,8 +61,7 @@ public abstract class JcrAuthTestBase ex
         if (!config.exists()) {
             throw new Exception("missing config file: " + config.getPath());
         }
-        repository = new TransientRepository(CONFIG_FILE,
-                "target/repository_with_auth");
+        repository = new TransientRepository(CONFIG_FILE, "target/repository");
 
         // set up a user to authenticate
         SessionImpl session = (SessionImpl) repository
@@ -85,8 +84,7 @@ public abstract class JcrAuthTestBase ex
                     .getSupportedPrivileges(permissionsPath), true);
             accessControlManager.setPolicy(permissionsPath, acl);
         } else {
-            throw new Exception("could not set access control for path "
-                    + permissionsPath);
+            throw new Exception("could not set access control for path " + permissionsPath);
         }
 
         session.save();

Modified: camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTokenWithLoginTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTokenWithLoginTest.java?rev=1235600&r1=1235599&r2=1235600&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTokenWithLoginTest.java (original)
+++ camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrAuthTokenWithLoginTest.java Wed Jan 25 02:25:33 2012
@@ -16,21 +16,20 @@
  */
 package org.apache.camel.component.jcr;
 
+import javax.jcr.LoginException;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class JcrAuthTokenWithLoginTest extends JcrAuthTestBase {
 
     @Test
-    @Ignore("Fails with some error")
     public void testCreateNodeWithAuthentication() throws Exception {
         Exchange exchange = createExchangeWithBody("<message>hello!</message>");
         Exchange out = template.send("direct:a", exchange);
         assertNotNull(out);
-        String uuid = out.getOut().getBody(String.class);
-        assertNull("Expected body to be null, found JCR node UUID", uuid);
+        assertNotNull(out.getException(LoginException.class));
     }
 
     @Override
@@ -40,9 +39,8 @@ public class JcrAuthTokenWithLoginTest e
             public void configure() throws Exception {
                 // START SNIPPET: jcr
                 from("direct:a").setProperty(JcrConstants.JCR_NODE_NAME,
-                        constant("node")).setProperty("my.contents.property",
-                        body()).to(
-                        "jcr://not-a-user:nonexisting-password@repository" + BASE_REPO_PATH);
+                    constant("node")).setProperty("my.contents.property",
+                    body()).to("jcr://not-a-user:nonexisting-password@repository" + BASE_REPO_PATH);
                 // END SNIPPET: jcr
             }
         };

Modified: camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java?rev=1235600&r1=1235599&r2=1235600&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java (original)
+++ camel/branches/camel-2.8.x/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConverterTest.java Wed Jan 25 02:25:33 2012
@@ -69,11 +69,9 @@ public class JcrConverterTest extends As
         assertJcrConverterAvailable(StringValue.class, "plain text");
     }
 
-    @SuppressWarnings("unchecked")
-    private void assertJcrConverterAvailable(Class expected, Object object) {
+    private void assertJcrConverterAvailable(Class<?> expected, Object object) {
         Value value = converter.convertTo(Value.class, object);
         assertNotNull(value);
         assertTrue(expected.isAssignableFrom(value.getClass()));
     }
-
 }