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 <anco...@gmail.com> Authored: Fri Jun 26 15:51:09 2015 +0200 Committer: Andrea Cosentino <anco...@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";