camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1099713 - in /camel/trunk/tests/camel-itest-osgi: ./ src/test/java/org/apache/camel/itest/osgi/cache/replication/ src/test/resources/org/apache/camel/itest/osgi/cache/replication/
Date Thu, 05 May 2011 08:29:03 GMT
Author: ningjiang
Date: Thu May  5 08:29:02 2011
New Revision: 1099713

URL: http://svn.apache.org/viewvc?rev=1099713&view=rev
Log:
CAMEL-3880 JMS cache replication OSGi unit test

Added:
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
  (with props)
    camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
  (with props)
Modified:
    camel/trunk/tests/camel-itest-osgi/pom.xml

Modified: camel/trunk/tests/camel-itest-osgi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/pom.xml?rev=1099713&r1=1099712&r2=1099713&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/pom.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/pom.xml Thu May  5 08:29:02 2011
@@ -105,6 +105,11 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.camel.karaf</groupId>
       <artifactId>apache-camel</artifactId>
       <version>${project.version}</version>

Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java
Thu May  5 08:29:02 2011
@@ -0,0 +1,88 @@
+/**
+ * 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.itest.osgi.cache.replication;
+
+import org.apache.camel.itest.osgi.OSGiIntegrationSpringTestSupport;
+import org.apache.karaf.testing.Helper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
+
+
+import static org.ops4j.pax.exam.CoreOptions.felix;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
+
+
+@RunWith(JUnit4TestRunner.class)
+public class CacheReplicationTest extends OSGiIntegrationSpringTestSupport {
+
+    @Override
+    protected OsgiBundleXmlApplicationContext createApplicationContext() {
+        return new OsgiBundleXmlApplicationContext(new String[]{
+            "org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml"});
+    }
+
+
+    @Test
+    public void testCache() throws Exception {
+        getMockEndpoint("mock:result1").expectedBodiesReceived("Am I replicated?");
+        getMockEndpoint("mock:result2").expectedBodiesReceived("Am I replicated?");
+
+        // do some routes to let everything be initialized
+        template.sendBody("direct:getRoute1", "Let initialize the route");
+        template.sendBody("direct:getRoute2", "Let initialize the route");
+        template.sendBody("direct:addRoute", "Am I replicated?");
+
+        // give some time to make replication
+        Thread.sleep(200);
+
+        template.sendBody("direct:getRoute1", "Will I get replicated cache");
+        template.sendBody("direct:getRoute2", "Will I get replicated cache");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Configuration
+    public static Option[] configure() throws Exception {
+        Option[] options = combine(
+        // Default karaf environment
+                Helper.getDefaultOptions(
+                    // this is how you set the default log level when using pax
+                    // logging (logProfile)
+                    Helper.setLogLevel("WARN")),
+
+                    // using the features to install AMQ
+                    scanFeatures("mvn:org.apache.activemq/activemq-karaf/5.5.0/xml/features",
+                            "activemq"),
+
+                    // using the features to install the camel components
+                    scanFeatures(getCamelKarafFeatureUrl(),
+                            "camel-core", "camel-spring", "camel-test", "camel-jms", "camel-cache"),
+
+                workingDirectory("target/paxrunner/"),
+
+                felix());
+
+        return options;
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/CacheReplicationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java
Thu May  5 08:29:02 2011
@@ -0,0 +1,84 @@
+/**
+ * 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.itest.osgi.cache.replication;
+
+import java.io.InputStream;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.Topic;
+import javax.jms.TopicConnection;
+
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.distribution.jms.AcknowledgementMode;
+import net.sf.ehcache.distribution.jms.JMSCacheManagerPeerProvider;
+
+import org.apache.camel.component.cache.CacheManagerFactory;
+
+public class TestingCacheManagerFactory extends CacheManagerFactory {
+    private String xmlName;
+
+    //Only for testing purpose, normally not needed
+    private CacheManager cacheManager;
+
+    private Topic replicationTopic;
+
+    private Queue getQueue;
+
+    private TopicConnection replicationTopicConnection;
+
+    private QueueConnection getQueueConnection;
+
+    public TestingCacheManagerFactory(String xmlName, 
+            TopicConnection replicationTopicConnection, Topic replicationTopic, 
+            QueueConnection getQueueConnection, Queue getQueue) {
+        this.xmlName = xmlName;
+        this.replicationTopicConnection = replicationTopicConnection;
+        this.replicationTopic = replicationTopic;
+        this.getQueue = getQueue;
+        this.getQueueConnection = getQueueConnection;
+    }
+
+    @Override
+    protected synchronized CacheManager createCacheManagerInstance() {
+        //Singleton- only for testing purpose, normally not needed
+        if (cacheManager == null) {
+            cacheManager = new WrappedCacheManager(getClass().getResourceAsStream(xmlName));
+        }
+
+        return cacheManager;
+    }
+
+    public CacheManager getCacheManager() {
+        return cacheManager;
+    }
+
+    public class WrappedCacheManager extends CacheManager {
+        public WrappedCacheManager(InputStream xmlConfig) {
+            super(xmlConfig);
+            JMSCacheManagerPeerProvider jmsCMPP = new JMSCacheManagerPeerProvider(this,
+                            replicationTopicConnection,
+                            replicationTopic,
+                            getQueueConnection,
+                            getQueue,
+                            AcknowledgementMode.AUTO_ACKNOWLEDGE,
+                            true);
+            cacheManagerPeerProviders.put(jmsCMPP.getScheme(), jmsCMPP);
+            jmsCMPP.init();
+        }
+    }
+}
\ No newline at end of file

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/TestingCacheManagerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
Thu May  5 08:29:02 2011
@@ -0,0 +1,104 @@
+/**
+ * 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.itest.osgi.cache.replication;
+
+import java.util.Collection;
+import java.util.Map;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Status;
+import net.sf.ehcache.distribution.jms.AcknowledgementMode;
+import net.sf.ehcache.distribution.jms.JMSCacheLoader;
+import net.sf.ehcache.loader.CacheLoader;
+
+import org.apache.camel.component.cache.CacheLoaderWrapper;
+
+public class WrappedJMSCacheLoader implements CacheLoaderWrapper {
+
+    private JMSCacheLoader jmsCacheLoader;
+    private String defaultLoaderArgument = "";
+    private QueueConnection getQueueConnection;
+    private Queue getQueue;
+    private AcknowledgementMode acknowledgementMode;
+    private int timeoutMillis;
+
+    public WrappedJMSCacheLoader(QueueConnection getQueueConnection,
+            Queue getQueue, AcknowledgementMode acknowledgementMode,
+            int timeoutMillis) {
+        this.getQueueConnection = getQueueConnection;
+        this.getQueue = getQueue;
+        this.acknowledgementMode = acknowledgementMode;
+        this.timeoutMillis = timeoutMillis;
+    }
+
+    @Override
+    public CacheLoader clone(Ehcache arg0) throws CloneNotSupportedException {
+        return jmsCacheLoader.clone(arg0);
+    }
+
+    @Override
+    public void dispose() throws CacheException {
+        jmsCacheLoader.dispose();
+    }
+
+    @Override
+    public String getName() {
+        return jmsCacheLoader.getName();
+    }
+
+    @Override
+    public Status getStatus() {
+        return jmsCacheLoader.getStatus();
+    }
+
+    @Override
+    public void init() {
+        jmsCacheLoader.init();
+    }
+
+    @Override
+    public Object load(Object arg0) throws CacheException {
+        return jmsCacheLoader.load(arg0);
+    }
+
+    @Override
+    public Object load(Object arg0, Object arg1) {
+        return jmsCacheLoader.load(arg0, arg1);
+    }
+
+    @Override
+    public Map loadAll(Collection arg0) {
+        return jmsCacheLoader.loadAll(arg0);
+    }
+
+    @Override
+    public Map loadAll(Collection arg0, Object arg1) {
+        return jmsCacheLoader.loadAll(arg0, arg1);
+    }
+
+    @Override
+    public void init(Ehcache cache) {
+        jmsCacheLoader = new JMSCacheLoader(cache, defaultLoaderArgument,
+                getQueueConnection, getQueue, acknowledgementMode,
+                timeoutMillis);
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cache/replication/WrappedJMSCacheLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
Thu May  5 08:29:02 2011
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <bean id="queueConnection1" factory-bean="amqCF" factory-method="createQueueConnection"
class="javax.jms.QueueConnection" />
+    <bean id="topicConnection1" factory-bean="amqCF" factory-method="createTopicConnection"
class="javax.jms.TopicConnection" />
+    <bean id="queue1" class="org.apache.activemq.command.ActiveMQQueue">
+        <constructor-arg ref="getQueue" />
+    </bean>
+    <bean id="topic1" class="org.apache.activemq.command.ActiveMQTopic">
+        <constructor-arg ref="getTopic" />
+    </bean>
+
+    <bean id="jmsListener1" class="net.sf.ehcache.distribution.jms.JMSCacheReplicator">
+        <constructor-arg index="0" value="true" />
+        <constructor-arg index="1" value="true" />
+        <constructor-arg index="2" value="true" />
+        <constructor-arg index="3" value="true" />
+        <constructor-arg index="4" value="false" />
+        <constructor-arg index="5" value="0" />
+    </bean>
+
+    <bean id="jmsLoader1" class="org.apache.camel.itest.osgi.cache.replication.WrappedJMSCacheLoader">
+        <constructor-arg index="0" ref="queueConnection1" />
+        <constructor-arg index="1" ref="queue1" />
+        <constructor-arg index="2" value="AUTO_ACKNOWLEDGE" />
+        <constructor-arg index="3" value="30000" />
+    </bean>
+
+    <bean id="cacheManagerFactory1" class="org.apache.camel.itest.osgi.cache.replication.TestingCacheManagerFactory">
+        <constructor-arg index="0" value="ehcache_jms_test.xml" />
+        <constructor-arg index="1" ref="topicConnection1" />
+        <constructor-arg index="2" ref="topic1" />
+        <constructor-arg index="3" ref="queueConnection1" />
+        <constructor-arg index="4" ref="queue1" />
+    </bean>
+
+    <bean id="eventListenerRegistry1" class="org.apache.camel.component.cache.CacheEventListenerRegistry">
+        <constructor-arg>
+            <list>
+                <ref bean="jmsListener1" />
+            </list>
+        </constructor-arg>
+    </bean>
+
+    <bean id="cacheLoaderRegistry1" class="org.apache.camel.component.cache.CacheLoaderRegistry">
+        <constructor-arg>
+            <list>
+                <ref bean="jmsLoader1"/>
+            </list>
+        </constructor-arg>
+    </bean>
+
+</beans>

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache1.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
Thu May  5 08:29:02 2011
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <bean id="queueConnection2" factory-bean="amqCF" factory-method="createQueueConnection"
class="javax.jms.QueueConnection" />
+    <bean id="topicConnection2" factory-bean="amqCF" factory-method="createTopicConnection"
class="javax.jms.TopicConnection" />
+    <bean id="queue2" class="org.apache.activemq.command.ActiveMQQueue">
+        <constructor-arg ref="getQueue" />
+    </bean>
+    <bean id="topic2" class="org.apache.activemq.command.ActiveMQTopic">
+        <constructor-arg ref="getTopic" />
+    </bean>
+
+    <bean id="jmsListener2" class="net.sf.ehcache.distribution.jms.JMSCacheReplicator">
+        <constructor-arg index="0" value="true" />
+        <constructor-arg index="1" value="true" />
+        <constructor-arg index="2" value="true" />
+        <constructor-arg index="3" value="true" />
+        <constructor-arg index="4" value="false" />
+        <constructor-arg index="5" value="0" />
+    </bean>
+
+    <bean id="jmsLoader2" class="org.apache.camel.itest.osgi.cache.replication.WrappedJMSCacheLoader">
+        <constructor-arg index="0" ref="queueConnection2" />
+        <constructor-arg index="1" ref="queue2" />
+        <constructor-arg index="2" value="AUTO_ACKNOWLEDGE" />
+        <constructor-arg index="3" value="30000" />
+    </bean>
+
+    <bean id="cacheManagerFactory2" class="org.apache.camel.itest.osgi.cache.replication.TestingCacheManagerFactory">
+        <constructor-arg index="0" value="ehcache_jms_test.xml" />
+        <constructor-arg index="1" ref="topicConnection2" />
+        <constructor-arg index="2" ref="topic2" />
+        <constructor-arg index="3" ref="queueConnection2" />
+        <constructor-arg index="4" ref="queue2" />
+    </bean>
+
+    <bean id="eventListenerRegistry2" class="org.apache.camel.component.cache.CacheEventListenerRegistry">
+        <constructor-arg>
+            <list>
+                <ref bean="jmsListener2" />
+            </list>
+        </constructor-arg>
+    </bean>
+
+    <bean id="cacheLoaderRegistry2" class="org.apache.camel.component.cache.CacheLoaderRegistry">
+        <constructor-arg>
+            <list>
+                <ref bean="jmsLoader2"/>
+            </list>
+        </constructor-arg>
+    </bean>
+
+</beans>

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache2.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
Thu May  5 08:29:02 2011
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <bean id="queueConnection3" factory-bean="amqCF" factory-method="createQueueConnection"
class="javax.jms.QueueConnection" />
+    <bean id="topicConnection3" factory-bean="amqCF" factory-method="createTopicConnection"
class="javax.jms.TopicConnection" />
+    <bean id="queue3" class="org.apache.activemq.command.ActiveMQQueue">
+        <constructor-arg ref="getQueue" />
+    </bean>
+    <bean id="topic3" class="org.apache.activemq.command.ActiveMQTopic">
+        <constructor-arg ref="getTopic" />
+    </bean>
+
+    <bean id="jmsListener3" class="net.sf.ehcache.distribution.jms.JMSCacheReplicator">
+        <constructor-arg index="0" value="true" />
+        <constructor-arg index="1" value="true" />
+        <constructor-arg index="2" value="true" />
+        <constructor-arg index="3" value="true" />
+        <constructor-arg index="4" value="false" />
+        <constructor-arg index="5" value="0" />
+    </bean>
+
+    <bean id="jmsLoader3" class="org.apache.camel.itest.osgi.cache.replication.WrappedJMSCacheLoader">
+        <constructor-arg index="0" ref="queueConnection3" />
+        <constructor-arg index="1" ref="queue3" />
+        <constructor-arg index="2" value="AUTO_ACKNOWLEDGE" />
+        <constructor-arg index="3" value="30000" />
+    </bean>
+
+    <bean id="cacheManagerFactory3" class="org.apache.camel.itest.osgi.cache.replication.TestingCacheManagerFactory">
+        <constructor-arg index="0" value="ehcache_jms_test.xml" />
+        <constructor-arg index="1" ref="topicConnection3" />
+        <constructor-arg index="2" ref="topic3" />
+        <constructor-arg index="3" ref="queueConnection3" />
+        <constructor-arg index="4" ref="queue3" />
+    </bean>
+
+    <bean id="eventListenerRegistry3" class="org.apache.camel.component.cache.CacheEventListenerRegistry">
+        <constructor-arg>
+            <list>
+                <ref bean="jmsListener3" />
+            </list>
+        </constructor-arg>
+    </bean>
+
+    <bean id="cacheLoaderRegistry3" class="org.apache.camel.component.cache.CacheLoaderRegistry">
+        <constructor-arg>
+            <list>
+                <ref bean="jmsLoader3"/>
+            </list>
+        </constructor-arg>
+    </bean>
+
+</beans>

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCache3.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
Thu May  5 08:29:02 2011
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+    <bean id="getQueue" class="java.lang.String">
+        <constructor-arg value="replicationGetQueue" />
+    </bean>
+
+    <bean id="getTopic" class="java.lang.String">
+        <constructor-arg value="replicationTopic" />
+    </bean>
+
+    <import resource="JMSReplicationCache1.xml"/>
+    <import resource="JMSReplicationCache2.xml"/>
+    <import resource="JMSReplicationCache3.xml"/>
+
+    <camelContext xmlns="http://camel.apache.org/schema/spring">
+        <camel:endpoint id="fooCache1" uri="cache:foo?cacheManagerFactory=#cacheManagerFactory1&amp;eventListenerRegistry=#eventListenerRegistry1&amp;cacheLoaderRegistry=#cacheLoaderRegistry1"/>
+        <camel:endpoint id="fooCache2" uri="cache:foo?cacheManagerFactory=#cacheManagerFactory2&amp;eventListenerRegistry=#eventListenerRegistry2&amp;cacheLoaderRegistry=#cacheLoaderRegistry2"/>
+        <camel:endpoint id="fooCache3" uri="cache:foo?cacheManagerFactory=#cacheManagerFactory3&amp;eventListenerRegistry=#eventListenerRegistry3&amp;cacheLoaderRegistry=#cacheLoaderRegistry3"/>
+
+        <camel:route>
+            <camel:from uri="direct:addRoute"/>
+            <camel:setHeader headerName="CamelCacheOperation">
+                <camel:constant>CamelCacheAdd</camel:constant>
+            </camel:setHeader>
+            <camel:setHeader headerName="CamelCacheKey">
+                <camel:constant>foo</camel:constant>
+            </camel:setHeader>
+            <camel:to ref="fooCache1"/>
+        </camel:route>
+
+        <camel:route>
+            <camel:from uri="direct:getRoute1"/>
+            <camel:setHeader headerName="CamelCacheOperation">
+                <camel:constant>CamelCacheGet</camel:constant>
+            </camel:setHeader>
+            <camel:setHeader headerName="CamelCacheKey">
+                <camel:constant>foo</camel:constant>
+            </camel:setHeader>
+            <camel:to ref="fooCache2"/>
+            <camel:choice>
+                <camel:when>
+                    <camel:simple>${in.header.CamelCacheElementWasFound} != null</camel:simple>
+                    <camel:to uri="mock:result1" />
+                </camel:when>
+            </camel:choice>
+        </camel:route>
+
+        <camel:route>
+            <camel:from uri="direct:getRoute2"/>
+            <camel:setHeader headerName="CamelCacheOperation">
+                <camel:constant>CamelCacheGet</camel:constant>
+            </camel:setHeader>
+            <camel:setHeader headerName="CamelCacheKey">
+                <camel:constant>foo</camel:constant>
+            </camel:setHeader>
+            <camel:to ref="fooCache3"/>
+            <camel:choice>
+                <camel:when>
+                    <camel:simple>${in.header.CamelCacheElementWasFound} != null</camel:simple>
+                    <camel:to uri="mock:result2" />
+                </camel:when>
+            </camel:choice>
+        </camel:route>
+
+    </camelContext>
+
+    <bean id="amqCF" class="org.apache.activemq.ActiveMQConnectionFactory">
+        <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
+    </bean>
+
+    <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
+        <property name="connectionFactory">
+            <ref bean="amqCF"/>
+        </property>
+    </bean>
+
+</beans>

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/JMSReplicationCamelContext.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml?rev=1099713&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
(added)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
Thu May  5 08:29:02 2011
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="ehcache.xsd" >
+
+    <diskStore path="java.io.tmpdir"/>
+
+    <cacheManagerEventListenerFactory class="" properties=""/>
+
+    <!--
+    Mandatory Default Cache configuration. These settings will be applied to caches
+    created programmtically using CacheManager.add(String cacheName).
+
+    The defaultCache has an implicit name "default" which is a reserved cache name.
+    -->
+    <defaultCache
+            maxElementsInMemory="10000"
+            eternal="false"
+            timeToIdleSeconds="120"
+            timeToLiveSeconds="120"
+            overflowToDisk="true"
+            diskSpoolBufferSizeMB="30"
+            maxElementsOnDisk="10000000"
+            diskPersistent="false"
+            diskExpiryThreadIntervalSeconds="120"
+            memoryStoreEvictionPolicy="LRU"
+            />
+
+</ehcache>

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cache/replication/ehcache_jms_test.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message