Commits

Anonymous committed 8baac10

Added unit tests for JMS 1.0

Comments (0)

Files changed (4)

src/plugins/clustersupport/test/com/opensymphony/oscache/plugins/clustersupport/TestCompleteClustering.java

         TestSuite suite = new TestSuite("Test all OSCache clustering");
         suite.addTest(TestJavaGroupsBroadcastingListener.suite());
         suite.addTest(TestJMSBroadcastingListener.suite());
+        suite.addTest(TestJMS10BroadcastingListener.suite());
 
         return suite;
     }

src/plugins/clustersupport/test/com/opensymphony/oscache/plugins/clustersupport/TestJMS10BroadcastingListener.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
+package com.opensymphony.oscache.plugins.clustersupport;
+
+import com.opensymphony.oscache.base.Config;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import javax.naming.Context;
+
+/**
+ * Test all the public methods of the broadcasting listener and assert the
+ * return values
+ *
+ * @author <a href="&#109;a&#105;&#108;&#116;&#111;:chris&#64;swebtec.&#99;&#111;&#109;">Chris Miller</a>
+ */
+public final class TestJMS10BroadcastingListener extends BaseTestBroadcastingListener {
+    public TestJMS10BroadcastingListener(String str) {
+        super(str);
+    }
+
+    /**
+     * This methods returns the name of this test class to JUnit.
+     *
+     * @return The test for this class
+     */
+    public static Test suite() {
+        return new TestSuite(TestJMS10BroadcastingListener.class);
+    }
+
+    /**
+     * Returns a configured JavaGroupsBroadcastingListener instance
+     * for testing.
+     */
+    public AbstractBroadcastingListener getListener() {
+        return new JMS10BroadcastingListener();
+    }
+
+    /**
+     * Return the configuration for the JMS listener
+     */
+    Config getConfig() {
+        Config config = new Config();
+
+        // There needs to be an application resource file present "jndi.properties" that contains the following
+        // parameters:
+        //        config.set(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
+        //        config.set(Context.PROVIDER_URL, "ormi://localhost:23791/");
+        //        config.set(Context.SECURITY_PRINCIPAL, "admin");
+        //        config.set(Context.SECURITY_CREDENTIALS, "xxxxxx");
+        config.set("cache.cluster.jms.topic.factory", "java:comp/env/jms/TopicConnectionFactory");
+        config.set("cache.cluster.jms.topic.name", "java:comp/env/jms/OSCacheTopic");
+        config.set("cache.cluster.jms.node.name", "cacheNode1");
+
+        return config;
+    }
+}

src/plugins/clustersupport/test/com/opensymphony/oscache/plugins/clustersupport/TestJMSBroadcastingListener.java

         //        config.set(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
         //        config.set(Context.PROVIDER_URL, "ormi://localhost:23791/");
         //        config.set(Context.SECURITY_PRINCIPAL, "admin");
-        //        config.set(Context.SECURITY_CREDENTIALS, "whyx1bu");
+        //        config.set(Context.SECURITY_CREDENTIALS, "xxxxxx");
         config.set("cache.cluster.jms.topic.factory", "java:comp/env/jms/TopicConnectionFactory");
         config.set("cache.cluster.jms.topic.name", "java:comp/env/jms/OSCacheTopic");
         config.set("cache.cluster.jms.node.name", "cacheNode1");

src/plugins/clustersupport/test/oscacheCluster.properties

-# LISTENERS
-cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JavaGroupsBroadcastingListener
-
-# CLUSTER PROPERTIES
-#
-# Configuration properites for the JavaGroups clustering.
-#
-#cache.cluster.properties=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):PING(timeout=2000;num_initial_members=3):MERGE2(min_interval=5000;max_interval=10000):FD_SOCK:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(gc_lag=50;retransmit_timeout=300,600,1200,2400,4800):pbcast.STABLE(desired_avg_gossip=20000):UNICAST(timeout=5000):FRAG(frag_size=8096;down_thread=false;up_thread=false):pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true)
-#cache.cluster.multicast.ip=231.12.21.132