[jboss-cvs] JBossCache/tests/perf/org/jboss/cache/aop ...
Manik Surtani
msurtani at jboss.com
Thu Jul 20 02:04:57 EDT 2006
User: msurtani
Date: 06/07/20 02:04:57
Modified: tests/perf/org/jboss/cache/aop
ReplicatedAsyncMapPerfAopTest.java Server.java
StudentMetrics.java
Log:
Fixed some broken UTs to use the new xml parsers, cache factories, etc.
Revision Changes Path
1.3 +12 -11 JBossCache/tests/perf/org/jboss/cache/aop/ReplicatedAsyncMapPerfAopTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedAsyncMapPerfAopTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/aop/ReplicatedAsyncMapPerfAopTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ReplicatedAsyncMapPerfAopTest.java 9 Apr 2006 12:33:50 -0000 1.2
+++ ReplicatedAsyncMapPerfAopTest.java 20 Jul 2006 06:04:57 -0000 1.3
@@ -12,9 +12,8 @@
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.aop.PojoCache;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.LockStrategyFactory;
import org.jboss.cache.transaction.DummyTransactionManager;
@@ -32,13 +31,13 @@
/**
* Local mode performance test for TreeCache.
*
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @author<a href="mailto:bwang at jboss.org">Ben Wang</a> May 20 2003
*/
public class ReplicatedAsyncMapPerfAopTest extends TestCase
{
PojoCache cache_;
- int cachingMode_ = TreeCache.LOCAL;
+ Configuration.CacheMode cachingMode_ = Configuration.CacheMode.LOCAL;
final static Properties p_;
// final static Log log_=LogFactory.getLog(LocalPerfAopTest.class);
String oldFactory_ = null;
@@ -73,7 +72,7 @@
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
DummyTransactionManager.getInstance();
- initCaches(TreeCache.LOCAL);
+ initCaches(Configuration.CacheMode.LOCAL);
tm_ = new DummyTransactionManager();
originalStrBuf_ = new StringBuffer();
@@ -146,15 +145,17 @@
proxyMaps_ = null;
}
- void initCaches(int caching_mode) throws Exception
+ void initCaches(Configuration.CacheMode caching_mode) throws Exception
{
cachingMode_ = caching_mode;
cache_ = new PojoCache();
- PropertyConfigurator config = new PropertyConfigurator();
- config.configure(cache_, "META-INF/replAsync-service.xml"); // read in generic replAsync xml
- cache_.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+ //PropertyConfigurator config = new PropertyConfigurator();
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ Configuration c = parser.parseFile("META-INF/replAsync-service.xml");
+ //config.configure(cache_, ); // read in generic replAsync xml
+ c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+ cache_.setConfiguration(c);
cache_.startService();
-// org.jgroups.log.Trace.init();
}
void destroyCaches() throws Exception
1.4 +8 -5 JBossCache/tests/perf/org/jboss/cache/aop/Server.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Server.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/aop/Server.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Server.java 18 May 2006 12:46:54 -0000 1.3
+++ Server.java 20 Jul 2006 06:04:57 -0000 1.4
@@ -9,8 +9,8 @@
package org.jboss.cache.aop;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.aop.PojoCache;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.XmlConfigurationParser;
import java.io.InputStreamReader;
@@ -25,9 +25,12 @@
void initCach() throws Exception
{
cache_ = new PojoCache();
- PropertyConfigurator config = new PropertyConfigurator();
- config.configure(cache_, "META-INF/replSync-service.xml"); // read in generic replAsync xml
- cache_.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
+
+ //config.configure(cache_, "META-INF/replSync-service.xml"); // read in generic replAsync xml
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ Configuration c = parser.parseFile("META-INF/replSync-service.xml");
+ cache_.setConfiguration(c);
+ c.setTransactionManagerLookupClass("org.jboss.cache.DummyTransactionManagerLookup");
cache_.startService();
}
1.3 +10 -7 JBossCache/tests/perf/org/jboss/cache/aop/StudentMetrics.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StudentMetrics.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/perf/org/jboss/cache/aop/StudentMetrics.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- StudentMetrics.java 9 Apr 2006 12:33:50 -0000 1.2
+++ StudentMetrics.java 20 Jul 2006 06:04:57 -0000 1.3
@@ -9,10 +9,10 @@
package org.jboss.cache.aop;
import junit.framework.TestCase;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.aop.PojoCache;
-import org.jboss.cache.aop.test.Student;
import org.jboss.cache.aop.test.Address;
+import org.jboss.cache.aop.test.Student;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.factories.XmlConfigurationParser;
import java.util.Hashtable;
import java.util.Random;
@@ -47,11 +47,14 @@
private PojoCache createCache(String name) throws Exception {
PojoCache tree = new PojoCache();
- PropertyConfigurator config = new PropertyConfigurator(); // configure the cache through injection
// read in the replSync xml. Here we use synchronous mode replication.
- config.configure(tree, "META-INF/replSync-service.xml");
-// config.configure(tree, "META-INF/local-service.xml");
- tree.setClusterName(name); // We can set a different cluster group.
+ //config.configure(tree, "META-INF/replSync-service.xml");
+
+ XmlConfigurationParser parser = new XmlConfigurationParser();
+ Configuration c = parser.parseFile("META-INF/replSync-service.xml");
+ c.setClusterName(name);
+ tree.setConfiguration(c);
+
tree.start(); // kick start the cache
return tree;
}
More information about the jboss-cvs-commits
mailing list