KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > config > ConfigurationTest


1 /*
2  * JBoss, Home of Professional Open Source
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.cache.config;
8
9
10 import junit.framework.TestCase;
11 import org.jboss.cache.factories.XmlConfigurationParser;
12 import org.jboss.cache.lock.IsolationLevel;
13
14 /**
15  * @author <a HREF="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
16  */

17 public class ConfigurationTest extends TestCase
18 {
19    public void testReplSyncStack() throws Exception JavaDoc
20    {
21       XmlConfigurationParser parser = new XmlConfigurationParser();
22       Configuration conf = parser.parseFile("META-INF/replSync-service.xml");
23
24       //now test that everything has been read in properly.
25
assertEquals(Configuration.CacheMode.REPL_SYNC, conf.getCacheMode());
26       assertEquals("org.jboss.cache.DummyTransactionManagerLookup", conf.getTransactionManagerLookupClass());
27       assertEquals(IsolationLevel.REPEATABLE_READ, conf.getIsolationLevel());
28       assertEquals(false, conf.isUseReplQueue());
29       assertEquals(0, conf.getReplQueueInterval());
30       assertEquals(0, conf.getReplQueueMaxElements());
31       assertEquals("JBossCache-Cluster", conf.getClusterName());
32       assertEquals(true, conf.isFetchInMemoryState());
33       assertEquals(15000, conf.getInitialStateRetrievalTimeout());
34       assertEquals(15000, conf.getSyncReplTimeout());
35       assertEquals(10000, conf.getLockAcquisitionTimeout());
36       assertNull(conf.getEvictionConfig());
37       assertEquals(true, conf.isUseRegionBasedMarshalling());
38
39       // not testing the JGroups configs since JGroups doesn't expose their config as a bean.
40
// comparing an XML block is a PITA.
41
}
42
43    public void testMultiplexerStack() throws Exception JavaDoc
44    {
45       XmlConfigurationParser parser = new XmlConfigurationParser();
46       Configuration conf = parser.parseFile("META-INF/mux-service.xml");
47
48       // test that multiplexer settings have been read in properly.
49
assertEquals("MultiplexerService", "jgroups.mux:name=Multiplexer", conf.getMultiplexerService());
50       assertEquals("MultiplexerStack", "tcp", conf.getMultiplexerStack());
51       assertNull("ClusterConfig", conf.getClusterConfig());
52    }
53
54 }
55
Popular Tags