[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/config ...
Manik Surtani
msurtani at jboss.com
Tue Jul 18 13:51:31 EDT 2006
User: msurtani
Date: 06/07/18 13:51:31
Modified: tests/functional/org/jboss/cache/config
ConfigurationImplTest.java
Log:
Make sure configuration impl reads in configs properly
Revision Changes Path
1.2 +77 -2 JBossCache/tests/functional/org/jboss/cache/config/ConfigurationImplTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConfigurationImplTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/config/ConfigurationImplTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ConfigurationImplTest.java 18 Jul 2006 10:50:46 -0000 1.1
+++ ConfigurationImplTest.java 18 Jul 2006 17:51:31 -0000 1.2
@@ -6,7 +6,11 @@
*/
package org.jboss.cache.config;
+
+
import junit.framework.TestCase;
+import org.w3c.dom.Element;
+import org.jboss.cache.xml.XmlHelper;
import java.io.InputStream;
@@ -15,11 +19,82 @@
*/
public class ConfigurationImplTest extends TestCase
{
- public void testReplSyncStack()
+ public void testReplSyncStack() throws Exception
{
ConfigurationImpl conf = new ConfigurationImpl();
- InputStream i = getClass().getClassLoader().getResourceAsStream("etc/META-INF/replSync-service.xml");
+ InputStream i = Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/replSync-service.xml");
+ assertNotNull(i);
conf.readConfiguration(i);
System.out.println(conf);
+
+ //now test that everything has been read in properly.
+
+ assertEquals("REPL_SYNC", conf.getAttribute("CacheMode"));
+ assertEquals("org.jboss.cache.DummyTransactionManagerLookup", conf.getAttribute("TransactionManagerLookupClass"));
+ assertEquals("REPEATABLE_READ", conf.getAttribute("IsolationLevel"));
+ assertEquals(false, conf.getAttributeAsBoolean("UseReplQueue"));
+ assertEquals(0, conf.getAttributeAsInt("ReplQueueInterval"));
+ assertEquals(0, conf.getAttributeAsInt("ReplQueueMaxElements"));
+ assertEquals("TreeCache-Cluster", conf.getAttribute("ClusterName"));
+ assertEquals(true, conf.getAttributeAsBoolean("FetchInMemoryState"));
+ assertEquals(15000, conf.getAttributeAsLong("InitialStateRetrievalTimeout"));
+ assertEquals(15000, conf.getAttributeAsLong("SyncReplTimeout"));
+ assertEquals(10000, conf.getAttributeAsLong("LockAcquisitionTimeout"));
+ assertNull(conf.getAttribute("EvictionPolicyClass"));
+ assertEquals(true, conf.getAttributeAsBoolean("UseRegionBasedMarshalling"));
+
+ // now test the XML block for cluster configs
+ Element e = conf.getAttributeAsXml("ClusterConfig");
+/*
+ <config>
+ <!-- UDP: if you have a multihomed machine,
+ set the bind_addr attribute to the appropriate NIC IP address, e.g bind_addr="192.168.0.2"
+ -->
+ <!-- UDP: On Windows machines, because of the media sense feature
+ being broken with multicast (even after disabling media sense)
+ set the loopback attribute to true -->
+ <UDP mcast_addr="228.1.2.3" mcast_port="48866"
+ ip_ttl="64" ip_mcast="true"
+ mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+ ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+ loopback="false"/>
+ <PING timeout="2000" num_initial_members="3"
+ up_thread="false" down_thread="false"/>
+ <MERGE2 min_interval="10000" max_interval="20000"/>
+ <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
+ <FD_SOCK/>
+ <VERIFY_SUSPECT timeout="1500"
+ up_thread="false" down_thread="false"/>
+ <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+ max_xmit_size="8192" up_thread="false" down_thread="false"/>
+ <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
+ down_thread="false"/>
+ <pbcast.STABLE desired_avg_gossip="20000"
+ up_thread="false" down_thread="false"/>
+ <FRAG frag_size="8192"
+ down_thread="false" up_thread="false"/>
+ <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+ shun="true" print_local_addr="true"/>
+ <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+ </config>
+ */
+
+ assertEquals("228.1.2.3", XmlHelper.getAttributeValue(e, "UDP", "mcast_addr"));
+ assertEquals("48866", XmlHelper.getAttributeValue(e, "UDP", "mcast_port"));
+ assertEquals("64", XmlHelper.getAttributeValue(e, "UDP", "ip_ttl"));
+ assertEquals("true", XmlHelper.getAttributeValue(e, "UDP", "ip_mcast"));
+ assertEquals("150000", XmlHelper.getAttributeValue(e, "UDP", "mcast_send_buf_size"));
+ assertEquals("80000", XmlHelper.getAttributeValue(e, "UDP", "mcast_recv_buf_size"));
+ assertEquals("150000", XmlHelper.getAttributeValue(e, "UDP", "ucast_send_buf_size"));
+ assertEquals("80000", XmlHelper.getAttributeValue(e, "UDP", "ucast_recv_buf_size"));
+ assertEquals("false", XmlHelper.getAttributeValue(e, "UDP", "loopback"));
+
+ assertEquals("2000", XmlHelper.getAttributeValue(e, "PING", "timeout"));
+ assertEquals("3", XmlHelper.getAttributeValue(e, "PING", "num_initial_members"));
+ assertEquals("false", XmlHelper.getAttributeValue(e, "PING", "up_thread"));
+ assertEquals("false", XmlHelper.getAttributeValue(e, "PING", "down_thread"));
+
+ /// ... - etc - ...
}
+
}
More information about the jboss-cvs-commits
mailing list