You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2015/06/26 22:01:18 UTC

[1/3] camel git commit: CAMEL-8852: Camel JCR doesnt include Connection to a repository workspace except the default one

Repository: camel
Updated Branches:
  refs/heads/master 9d0a01ede -> d00010c68


CAMEL-8852: Camel JCR doesnt include Connection to a repository workspace except the default one


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

Branch: refs/heads/master
Commit: 05210609ffd408a9936c9add86c3359d07563dd2
Parents: 9d0a01e
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri Jun 26 14:01:58 2015 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri Jun 26 14:01:58 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/jcr/JcrComponent.java   |  4 +++-
 .../org/apache/camel/component/jcr/JcrConsumer.java    |  7 ++++++-
 .../org/apache/camel/component/jcr/JcrEndpoint.java    | 13 +++++++++++++
 .../org/apache/camel/component/jcr/JcrProducer.java    |  7 ++++++-
 4 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/05210609/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java
index 7804b65..71da0ff 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java
@@ -37,6 +37,8 @@ public class JcrComponent extends UriEndpointComponent {
 
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> properties) throws Exception {
-        return new JcrEndpoint(uri, this);
+        JcrEndpoint endpoint = new JcrEndpoint(uri, this);
+        setProperties(endpoint, properties);
+        return endpoint;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/05210609/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
index 1c7d4e8..fe53fff 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
@@ -28,6 +28,7 @@ import javax.jcr.observation.EventListener;
 import org.apache.camel.Processor;
 import org.apache.camel.SuspendableService;
 import org.apache.camel.impl.DefaultConsumer;
+import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -82,7 +83,11 @@ public class JcrConsumer extends DefaultConsumer implements SuspendableService {
     private synchronized void createSessionAndRegisterListener() throws RepositoryException {
         LOG.trace("createSessionAndRegisterListener START");
 
-        session = getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials());
+        if (ObjectHelper.isEmpty(getJcrEndpoint().getWorkspaceName())) { 
+            session = getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials());
+        } else {
+            session = getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials(), getJcrEndpoint().getWorkspaceName());
+        }
 
         int eventTypes = getJcrEndpoint().getEventTypes();
         String absPath = getJcrEndpoint().getBase();

http://git-wip-us.apache.org/repos/asf/camel/blob/05210609/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
index ab9e955..b736726 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java
@@ -64,6 +64,8 @@ public class JcrEndpoint extends DefaultEndpoint {
     private long sessionLiveCheckIntervalOnStart = 3000L;
     @UriParam(defaultValue = "60000")
     private long sessionLiveCheckInterval = 60000L;
+    @UriParam
+    private String workspaceName;
 
     protected JcrEndpoint(String endpointUri, JcrComponent component) {
         super(endpointUri, component);
@@ -275,6 +277,17 @@ public class JcrEndpoint extends DefaultEndpoint {
 
         this.sessionLiveCheckInterval = sessionLiveCheckInterval;
     }
+    
+    /**
+     * The workspace to access. If it's not specified then the default one will be used
+     */
+    public String getWorkspaceName() {
+        return workspaceName;
+    }
+
+    public void setWorkspaceName(String workspaceName) {
+        this.workspaceName = workspaceName;
+    }
 
     /**
      * Gets the destination name which was configured from the endpoint uri.

http://git-wip-us.apache.org/repos/asf/camel/blob/05210609/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
index 7c2f141..aca67b6 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java
@@ -34,6 +34,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.util.ObjectHelper;
 import org.apache.jackrabbit.util.Text;
 
 public class JcrProducer extends DefaultProducer {
@@ -160,7 +161,11 @@ public class JcrProducer extends DefaultProducer {
     }
 
     protected Session openSession() throws RepositoryException {
-        return getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials());
+        if (ObjectHelper.isEmpty(getJcrEndpoint().getWorkspaceName())) { 
+            return getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials());
+        } else {
+            return getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials(), getJcrEndpoint().getWorkspaceName());
+        }
     }
 
     private JcrEndpoint getJcrEndpoint() {


[2/3] camel git commit: CAMEL-8852 Added producer test related to different workspace URI param

Posted by ac...@apache.org.
CAMEL-8852 Added producer test related to different workspace URI param


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

Branch: refs/heads/master
Commit: 73640069e8d5368690b2929a3e54e28adc015f05
Parents: 0521060
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri Jun 26 15:37:19 2015 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri Jun 26 21:58:41 2015 +0200

----------------------------------------------------------------------
 .../jcr/JcrConsumerDifferentWorkspaceTest.java  | 141 +++++++++++++++++++
 .../jcr/JcrProducerDifferentWorkspaceTest.java  |  64 +++++++++
 .../JcrRouteDifferentWorkspaceTestSupport.java  |  79 +++++++++++
 3 files changed, 284 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/73640069/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java
new file mode 100644
index 0000000..cef11b8
--- /dev/null
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java
@@ -0,0 +1,141 @@
+/**
+ * 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.jcr;
+
+import java.util.List;
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.observation.Event;
+import javax.jcr.observation.EventIterator;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JcrConsumerDifferentWorkspaceTest extends JcrRouteDifferentWorkspaceTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(JcrConsumerDifferentWorkspaceTest.class);
+
+    private String absPath = "/home/test";
+    private int eventTypes = Event.NODE_ADDED;
+    private boolean deep = true;
+    private boolean noLocal;
+
+    @Test
+    public void testJcrConsumer() throws Exception {
+        // start consumer thread first
+        JcrConsumerThread consumerThread = new JcrConsumerThread();
+        consumerThread.start();
+        // wait until the consumer thread has tried to receive event at least once
+        while (consumerThread.getReceiveTrialTimes() < 1) {
+            Thread.sleep(10L);
+        }
+
+        // now create a node under the specified event node path
+
+        Session session = openSession(CUSTOM_WORKSPACE_NAME);
+
+        try {
+            Node folderNode = session.getRootNode();
+
+            for (String folderNodeName : absPath.split("\\/")) {
+                if (!"".equals(folderNodeName)) {
+                    if (folderNode.hasNode(folderNodeName)) {
+                        folderNode.getNode(folderNodeName).remove();
+                    }
+
+                    folderNode = folderNode.addNode(folderNodeName, "nt:unstructured");
+                }
+            }
+
+            folderNode.addNode("node", "nt:unstructured");
+            session.save();
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }
+
+        // wait until the consumer thread captures an event
+        consumerThread.join();
+
+        Exchange exchange = consumerThread.getExchange();
+        assertNotNull(exchange);
+
+        Message message = exchange.getIn();
+        assertNotNull(message);
+        assertTrue(message instanceof JcrMessage);
+        EventIterator eventIterator = ((JcrMessage)message).getEventIterator();
+        assertNotNull(eventIterator);
+        assertEquals(1, eventIterator.getSize());
+
+        List<?> eventList = message.getBody(List.class);
+        assertEquals(1, eventList.size());
+        Event event = (Event) eventList.get(0);
+        assertEquals(Event.NODE_ADDED, event.getType());
+        assertNotNull(event.getPath());
+        assertTrue(event.getPath().startsWith(absPath));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                String uri = "jcr://user:pass@repository";
+                uri += absPath;
+                uri += "?eventTypes=" + eventTypes;
+                uri += "&deep=" + deep;
+                uri += "&noLocal=" + noLocal;
+                uri += "&workspaceName=" + CUSTOM_WORKSPACE_NAME;
+                from(uri).to("direct:a");
+            }
+        };
+    }
+
+    private class JcrConsumerThread extends Thread {
+
+        private Exchange exchange;
+        private int receiveTrialTimes;
+
+        public void run() {
+            while (exchange == null) {
+                exchange = consumer.receive("direct:a", 10L);
+                ++receiveTrialTimes;
+
+                try {
+                    Thread.sleep(10);
+                } catch (InterruptedException e) {
+                    break;
+                }
+            }
+
+            LOG.debug("JcrConsumerThread receive exchange, {} after {} trials", exchange, receiveTrialTimes);
+        }
+
+        public Exchange getExchange() {
+            return exchange;
+        }
+
+        public int getReceiveTrialTimes() {
+            return receiveTrialTimes;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/73640069/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrProducerDifferentWorkspaceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrProducerDifferentWorkspaceTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrProducerDifferentWorkspaceTest.java
new file mode 100644
index 0000000..a6d0ac6
--- /dev/null
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrProducerDifferentWorkspaceTest.java
@@ -0,0 +1,64 @@
+/**
+ * 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.jcr;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class JcrProducerDifferentWorkspaceTest extends JcrRouteDifferentWorkspaceTestSupport {
+    
+    @Test
+    public void testJcrProducer() throws Exception {
+        Exchange exchange = createExchangeWithBody("<hello>world!</hello>");
+        Exchange out = template.send("direct:a", exchange);
+        assertNotNull(out);
+        String uuid = out.getOut().getBody(String.class);
+        Session session = openSession(CUSTOM_WORKSPACE_NAME);
+        try {
+            Node node = session.getNodeByIdentifier(uuid);
+            Workspace workspace = session.getWorkspace();
+            assertEquals(CUSTOM_WORKSPACE_NAME, workspace.getName());
+            assertNotNull(node);
+            assertEquals("/home/test/node", node.getPath());
+            assertEquals("<hello>world!</hello>", node.getProperty("my.contents.property").getString());
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                // START SNIPPET: jcr-create-node
+                from("direct:a").setHeader(JcrConstants.JCR_NODE_NAME, constant("node"))
+                        .setHeader("my.contents.property", body())
+                        .to("jcr://user:pass@repository/home/test?workspaceName=" + CUSTOM_WORKSPACE_NAME);
+                // END SNIPPET: jcr-create-node
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/73640069/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
new file mode 100644
index 0000000..2f81449
--- /dev/null
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
@@ -0,0 +1,79 @@
+/**
+ * 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.jcr;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.Workspace;
+import javax.naming.Context;
+
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.jackrabbit.core.TransientRepository;
+import org.junit.Before;
+
+/**
+ * JcrRouteDifferentWorkspaceTestSupport
+ * 
+ */
+public abstract class JcrRouteDifferentWorkspaceTestSupport extends CamelTestSupport {
+
+    protected static final String CONFIG_FILE = "target/test-classes/repository-simple-security.xml";
+
+    protected static final String REPO_PATH = "target/repository-simple-diff-workspace";
+    
+    protected static final String CUSTOM_WORKSPACE_NAME = "testWorkspace";
+
+    private Repository repository;
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        deleteDirectory(REPO_PATH);
+        super.setUp();
+        Session session = getRepository().login(new SimpleCredentials("user", "pass".toCharArray()));
+        Workspace workspace = session.getWorkspace();
+        workspace.createWorkspace(CUSTOM_WORKSPACE_NAME);
+        session.save();
+        session.logout();
+    }
+
+    protected Repository getRepository() {
+        return repository;
+    }
+    
+    protected Session openSession(String workspaceName) throws RepositoryException {
+        return getRepository().login(new SimpleCredentials("user", "pass".toCharArray()), workspaceName);
+    }
+
+    @Override
+    protected Context createJndiContext() throws Exception {
+        File config = new File(CONFIG_FILE);
+        if (!config.exists()) {
+            throw new FileNotFoundException("Missing config file: " + config.getPath());
+        }
+        
+        Context context = super.createJndiContext();
+        repository = new TransientRepository(CONFIG_FILE, REPO_PATH);
+        context.bind("repository", repository);
+        return context;
+    }
+}


[3/3] camel git commit: Camel-Jcr updated Maven Surefire configuration, forkMode is deprecated

Posted by ac...@apache.org.
Camel-Jcr updated Maven Surefire configuration, forkMode is deprecated


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

Branch: refs/heads/master
Commit: d00010c68c917a98e672bdd8cf948bda5dfa5270
Parents: 7364006
Author: Andrea Cosentino <an...@gmail.com>
Authored: Fri Jun 26 15:51:09 2015 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Fri Jun 26 21:58:55 2015 +0200

----------------------------------------------------------------------
 components/camel-jcr/pom.xml                    |   3 +-
 .../jcr/JcrConsumerDifferentWorkspaceTest.java  | 141 -------------------
 .../JcrRouteDifferentWorkspaceTestSupport.java  |   2 +-
 3 files changed, 3 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d00010c6/components/camel-jcr/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-jcr/pom.xml b/components/camel-jcr/pom.xml
index 5a13688..3c624bd 100644
--- a/components/camel-jcr/pom.xml
+++ b/components/camel-jcr/pom.xml
@@ -92,7 +92,8 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <forkMode>always</forkMode>
+          <forkCount>1</forkCount>
+          <reuseForks>false</reuseForks>
         </configuration>
       </plugin>
     </plugins>

http://git-wip-us.apache.org/repos/asf/camel/blob/d00010c6/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java
deleted file mode 100644
index cef11b8..0000000
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrConsumerDifferentWorkspaceTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * 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.jcr;
-
-import java.util.List;
-import javax.jcr.Node;
-import javax.jcr.Session;
-import javax.jcr.observation.Event;
-import javax.jcr.observation.EventIterator;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JcrConsumerDifferentWorkspaceTest extends JcrRouteDifferentWorkspaceTestSupport {
-
-    private static final Logger LOG = LoggerFactory.getLogger(JcrConsumerDifferentWorkspaceTest.class);
-
-    private String absPath = "/home/test";
-    private int eventTypes = Event.NODE_ADDED;
-    private boolean deep = true;
-    private boolean noLocal;
-
-    @Test
-    public void testJcrConsumer() throws Exception {
-        // start consumer thread first
-        JcrConsumerThread consumerThread = new JcrConsumerThread();
-        consumerThread.start();
-        // wait until the consumer thread has tried to receive event at least once
-        while (consumerThread.getReceiveTrialTimes() < 1) {
-            Thread.sleep(10L);
-        }
-
-        // now create a node under the specified event node path
-
-        Session session = openSession(CUSTOM_WORKSPACE_NAME);
-
-        try {
-            Node folderNode = session.getRootNode();
-
-            for (String folderNodeName : absPath.split("\\/")) {
-                if (!"".equals(folderNodeName)) {
-                    if (folderNode.hasNode(folderNodeName)) {
-                        folderNode.getNode(folderNodeName).remove();
-                    }
-
-                    folderNode = folderNode.addNode(folderNodeName, "nt:unstructured");
-                }
-            }
-
-            folderNode.addNode("node", "nt:unstructured");
-            session.save();
-        } finally {
-            if (session != null && session.isLive()) {
-                session.logout();
-            }
-        }
-
-        // wait until the consumer thread captures an event
-        consumerThread.join();
-
-        Exchange exchange = consumerThread.getExchange();
-        assertNotNull(exchange);
-
-        Message message = exchange.getIn();
-        assertNotNull(message);
-        assertTrue(message instanceof JcrMessage);
-        EventIterator eventIterator = ((JcrMessage)message).getEventIterator();
-        assertNotNull(eventIterator);
-        assertEquals(1, eventIterator.getSize());
-
-        List<?> eventList = message.getBody(List.class);
-        assertEquals(1, eventList.size());
-        Event event = (Event) eventList.get(0);
-        assertEquals(Event.NODE_ADDED, event.getType());
-        assertNotNull(event.getPath());
-        assertTrue(event.getPath().startsWith(absPath));
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                String uri = "jcr://user:pass@repository";
-                uri += absPath;
-                uri += "?eventTypes=" + eventTypes;
-                uri += "&deep=" + deep;
-                uri += "&noLocal=" + noLocal;
-                uri += "&workspaceName=" + CUSTOM_WORKSPACE_NAME;
-                from(uri).to("direct:a");
-            }
-        };
-    }
-
-    private class JcrConsumerThread extends Thread {
-
-        private Exchange exchange;
-        private int receiveTrialTimes;
-
-        public void run() {
-            while (exchange == null) {
-                exchange = consumer.receive("direct:a", 10L);
-                ++receiveTrialTimes;
-
-                try {
-                    Thread.sleep(10);
-                } catch (InterruptedException e) {
-                    break;
-                }
-            }
-
-            LOG.debug("JcrConsumerThread receive exchange, {} after {} trials", exchange, receiveTrialTimes);
-        }
-
-        public Exchange getExchange() {
-            return exchange;
-        }
-
-        public int getReceiveTrialTimes() {
-            return receiveTrialTimes;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/d00010c6/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
index 2f81449..de9e3d3 100644
--- a/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
+++ b/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteDifferentWorkspaceTestSupport.java
@@ -38,7 +38,7 @@ public abstract class JcrRouteDifferentWorkspaceTestSupport extends CamelTestSup
 
     protected static final String CONFIG_FILE = "target/test-classes/repository-simple-security.xml";
 
-    protected static final String REPO_PATH = "target/repository-simple-diff-workspace";
+    protected static final String REPO_PATH = "target/repository-simple-security";
     
     protected static final String CUSTOM_WORKSPACE_NAME = "testWorkspace";