[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/mgmt ...
Manik Surtani
msurtani at jboss.com
Thu Jan 11 08:49:06 EST 2007
User: msurtani
Date: 07/01/11 08:49:06
Modified: tests/functional/org/jboss/cache/mgmt
InvalidationTest.java NotificationTest.java
MgmtCoreTest.java CacheLoaderTest.java TxTest.java
PassivationTest.java
Log:
Changed CacheImpl ctor to be protected, and changed cache factories accordingly
Revision Changes Path
1.12 +7 -3 JBossCache/tests/functional/org/jboss/cache/mgmt/InvalidationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvalidationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/mgmt/InvalidationTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- InvalidationTest.java 10 Jan 2007 19:09:28 -0000 1.11
+++ InvalidationTest.java 11 Jan 2007 13:49:05 -0000 1.12
@@ -4,11 +4,11 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheFactory;
-import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.interceptors.InvalidationInterceptor;
import java.util.HashMap;
@@ -18,7 +18,7 @@
* Simple functional tests for InvalidationInterceptor statistics
*
* @author Jerry Gauthier
- * @version $Id: InvalidationTest.java,v 1.11 2007/01/10 19:09:28 vblagojevic Exp $
+ * @version $Id: InvalidationTest.java,v 1.12 2007/01/11 13:49:05 msurtani Exp $
*/
public class InvalidationTest extends TestCase
{
@@ -146,7 +146,7 @@
private CacheImpl createCache(String clusterName) throws Exception
{
- CacheImpl cache = new CacheImpl();
+ CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
Configuration c = UnitTestCacheFactory.createConfiguration(CacheMode.INVALIDATION_SYNC);
cache.setConfiguration(c);
c.setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
@@ -161,14 +161,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof InvalidationInterceptor)
+ {
return (InvalidationInterceptor) o;
}
+ }
return null;
}
1.19 +3 -2 JBossCache/tests/functional/org/jboss/cache/mgmt/NotificationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NotificationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/mgmt/NotificationTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- NotificationTest.java 10 Jan 2007 15:39:51 -0000 1.18
+++ NotificationTest.java 11 Jan 2007 13:49:05 -0000 1.19
@@ -2,6 +2,7 @@
import junit.framework.TestCase;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
@@ -26,7 +27,7 @@
* Functional tests for CacheMgmtInterceptor broadcast of cache event notifications
*
* @author Jerry Gauthier
- * @version $Id: NotificationTest.java,v 1.18 2007/01/10 15:39:51 vblagojevic Exp $
+ * @version $Id: NotificationTest.java,v 1.19 2007/01/11 13:49:05 msurtani Exp $
*/
public class NotificationTest extends TestCase
{
@@ -160,7 +161,7 @@
private CacheImpl createCache(String clusterName) throws Exception
{
- CacheImpl cache = new CacheImpl();
+ CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
cache.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig("location=" + getTempDir()));
1.10 +16 -3 JBossCache/tests/functional/org/jboss/cache/mgmt/MgmtCoreTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MgmtCoreTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/mgmt/MgmtCoreTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- MgmtCoreTest.java 30 Dec 2006 19:48:46 -0000 1.9
+++ MgmtCoreTest.java 11 Jan 2007 13:49:05 -0000 1.10
@@ -4,6 +4,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.interceptors.CacheMgmtInterceptor;
@@ -15,7 +16,7 @@
* Simple functional tests for CacheMgmtInterceptor
*
* @author Jerry Gauthier
- * @version $Id: MgmtCoreTest.java,v 1.9 2006/12/30 19:48:46 msurtani Exp $
+ * @version $Id: MgmtCoreTest.java,v 1.10 2007/01/11 13:49:05 msurtani Exp $
*/
public class MgmtCoreTest extends TestCase
{
@@ -29,7 +30,7 @@
protected void setUp() throws Exception
{
super.setUp();
- cache = new CacheImpl();
+ cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setExposeManagementStatistics(true);
cache.create();
@@ -122,10 +123,14 @@
Thread.sleep(1000);
long t1 = mgmt.getElapsedTime();
if (t1 < 1)
+ {
fail("ElapsedTime should be greater than 0 seconds.");
+ }
t1 = mgmt.getTimeSinceReset();
if (t1 < 1)
+ {
fail("TimeSinceReset should be greater than 0 seconds.");
+ }
Thread.sleep(1000);
// now reset the statistics (node count and attribute count aren't affected)
@@ -134,10 +139,14 @@
// check times again
t1 = mgmt.getElapsedTime();
if (t1 < 2)
+ {
fail("ElapsedTime after reset should be greater than 1 second.");
+ }
t1 = mgmt.getTimeSinceReset();
- if (t1 > 1) // assumes that reset takes less than 2 seconds
+ if (t1 > 1)// assumes that reset takes less than 2 seconds
+ {
fail("TimeSinceReset after reset should be less than 2 seconds.");
+ }
// check other statistics
assertEquals("NumberOfNodes count error after reset: ", new Integer(11), new Integer(mgmt.getNumberOfNodes()));
@@ -221,14 +230,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof CacheMgmtInterceptor)
+ {
return (CacheMgmtInterceptor) o;
}
+ }
return null;
}
1.12 +11 -2 JBossCache/tests/functional/org/jboss/cache/mgmt/CacheLoaderTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/mgmt/CacheLoaderTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- CacheLoaderTest.java 30 Dec 2006 19:48:46 -0000 1.11
+++ CacheLoaderTest.java 11 Jan 2007 13:49:05 -0000 1.12
@@ -4,6 +4,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
@@ -21,7 +22,7 @@
* Simple functional tests for CacheLoaderInterceptor and CacheStoreInterceptor statistics
*
* @author Jerry Gauthier
- * @version $Id: CacheLoaderTest.java,v 1.11 2006/12/30 19:48:46 msurtani Exp $
+ * @version $Id: CacheLoaderTest.java,v 1.12 2007/01/11 13:49:05 msurtani Exp $
*/
public class CacheLoaderTest extends TestCase
{
@@ -202,7 +203,7 @@
private CacheImpl createCache() throws Exception
{
- CacheImpl cache = new CacheImpl();
+ CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig("location=" + getTempDir()));
cache.getConfiguration().setExposeManagementStatistics(true);
@@ -215,14 +216,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof CacheLoaderInterceptor)
+ {
return (CacheLoaderInterceptor) o;
}
+ }
return null;
}
@@ -230,14 +235,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof CacheStoreInterceptor)
+ {
return (CacheStoreInterceptor) o;
}
+ }
return null;
}
1.12 +7 -3 JBossCache/tests/functional/org/jboss/cache/mgmt/TxTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TxTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/mgmt/TxTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- TxTest.java 10 Jan 2007 15:39:51 -0000 1.11
+++ TxTest.java 11 Jan 2007 13:49:05 -0000 1.12
@@ -4,11 +4,11 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheFactory;
-import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.interceptors.TxInterceptor;
import javax.transaction.TransactionManager;
@@ -19,7 +19,7 @@
* Simple functional tests for TxInterceptor statistics
*
* @author Jerry Gauthier
- * @version $Id: TxTest.java,v 1.11 2007/01/10 15:39:51 vblagojevic Exp $
+ * @version $Id: TxTest.java,v 1.12 2007/01/11 13:49:05 msurtani Exp $
*/
public class TxTest extends TestCase
{
@@ -209,7 +209,7 @@
private CacheImpl createCache(String clusterName) throws Exception
{
- CacheImpl cache = new CacheImpl();
+ CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
cache.setConfiguration(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC));
cache.getConfiguration().setUseRegionBasedMarshalling(false);
cache.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
@@ -224,14 +224,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof TxInterceptor)
+ {
return (TxInterceptor) o;
}
+ }
return null;
}
1.10 +11 -2 JBossCache/tests/functional/org/jboss/cache/mgmt/PassivationTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PassivationTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/mgmt/PassivationTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- PassivationTest.java 30 Dec 2006 19:48:46 -0000 1.9
+++ PassivationTest.java 11 Jan 2007 13:49:05 -0000 1.10
@@ -4,6 +4,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
@@ -21,7 +22,7 @@
* Simple functional tests for ActivationInterceptor and PassivationInterceptor statistics
*
* @author Jerry Gauthier
- * @version $Id: PassivationTest.java,v 1.9 2006/12/30 19:48:46 msurtani Exp $
+ * @version $Id: PassivationTest.java,v 1.10 2007/01/11 13:49:05 msurtani Exp $
*/
public class PassivationTest extends TestCase
{
@@ -226,7 +227,7 @@
private CacheImpl createCache() throws Exception
{
- CacheImpl cache = new CacheImpl();
+ CacheImpl cache = (CacheImpl) DefaultCacheFactory.getInstance().createCache(false);
Configuration c = new Configuration();
c.setCacheMode("LOCAL");
c.setCacheLoaderConfig(getCacheLoaderConfig("location=" + getTempDir()));
@@ -241,14 +242,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof ActivationInterceptor)
+ {
return (ActivationInterceptor) o;
}
+ }
return null;
}
@@ -256,14 +261,18 @@
{
List interceptors = cache.getInterceptors();
if (interceptors.isEmpty())
+ {
return null;
+ }
for (int i = 0; i < interceptors.size(); i++)
{
Object o = interceptors.get(i);
if (o instanceof PassivationInterceptor)
+ {
return (PassivationInterceptor) o;
}
+ }
return null;
}
More information about the jboss-cvs-commits
mailing list