Author: manik.surtani(a)jboss.com
Date: 2008-01-02 06:28:08 -0500 (Wed, 02 Jan 2008)
New Revision: 4934
Modified:
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java
core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java
Log:
Fixed a bunch of unit tests
Modified:
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2008-01-02
01:55:51 UTC (rev 4933)
+++
core/trunk/src/test/java/org/jboss/cache/factories/ComponentRegistryFunctionalTest.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -95,6 +95,7 @@
Marshaller m = cr.getOrCreateComponent(null, componentToTest);
assert m instanceof VersionAwareMarshaller;
VersionAwareMarshaller vam = (VersionAwareMarshaller) m;
+ vam.initReplicationVersions();
m = (Marshaller) TestingUtil.extractField(vam, "defaultMarshaller");
assert m instanceof CacheMarshaller210;
}
@@ -147,6 +148,7 @@
Marshaller m = cr.getOrCreateComponent(null, componentToTest);
assert m instanceof VersionAwareMarshaller;
VersionAwareMarshaller vam = (VersionAwareMarshaller) m;
+ vam.initReplicationVersions();
m = (Marshaller) TestingUtil.extractField(vam, "defaultMarshaller");
assert m instanceof CacheMarshaller200;
}
Modified:
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-01-02
01:55:51 UTC (rev 4933)
+++
core/trunk/src/test/java/org/jboss/cache/invalidation/VersionInconsistencyTest.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -1,7 +1,7 @@
package org.jboss.cache.invalidation;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.NodeSPI;
@@ -91,7 +91,7 @@
assert val.equals("v-newer");
// test node versions
- NodeSPI n = ((CacheImpl) cache1).peek(node, true, true);
+ NodeSPI n = ((CacheSPI) cache1).peek(node, true, true);
assert ((DefaultDataVersion) n.getVersion()).getRawVersion() == 1 : "Version
should be 1";
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2008-01-02
01:55:51 UTC (rev 4933)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -1,17 +1,5 @@
package org.jboss.cache.jmx;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertSame;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.AssertJUnit.fail;
-
-import java.util.List;
-
-import javax.management.ObjectName;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheStatus;
@@ -26,13 +14,20 @@
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jgroups.Address;
import org.jgroups.stack.IpAddress;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Test;
+import javax.management.ObjectName;
+import javax.transaction.TransactionManager;
+import java.util.List;
+
/**
* Tests the JMX wrapper class around the cache.
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @author Brian Stansberry
*/
+@Test(groups = "functional")
public class CacheJmxWrapperTest extends CacheJmxWrapperTestBase
{
public void testCacheMBeanBinding() throws Exception
Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java 2008-01-02
01:55:51 UTC (rev 4933)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTestBase.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -22,7 +22,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
* @author Brian Stansberry
*/
-@Test(groups = {"functional"})
+@Test(groups = "functional")
public abstract class CacheJmxWrapperTestBase
{
public static final String CLUSTER_NAME = "CacheMBeanTest";
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-01-02
01:55:51 UTC (rev 4933)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/ExceptionTest.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -3,7 +3,6 @@
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
-import org.jboss.cache.ReplicationException;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.lock.TimeoutException;
@@ -53,7 +52,7 @@
if (cache2 != null) cache2.stop();
}
- @Test(groups = {"functional"}, expectedExceptions =
{ReplicationException.class})
+ @Test(groups = {"functional"}, expectedExceptions =
{TimeoutException.class})
public void testSyncReplTimeout()
{
cache1.getConfiguration().setSyncReplTimeout(1); // 1ms. this is *bound* to fail.
Modified:
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2008-01-02
01:55:51 UTC (rev 4933)
+++
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -7,7 +7,6 @@
package org.jboss.cache.statetransfer;
-import org.jboss.cache.CacheImpl;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
@@ -83,9 +82,6 @@
// Pause to give caches time to see each other
TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
- System.out.println("C1: " + ((CacheImpl) cache1).printLockInfo());
- System.out.println("C2: " + ((CacheImpl) cache2).printLockInfo());
-
// now peek into cache 2 to check that this state has been transferred into the
backup subtree
Fqn test = BuddyManager.getBackupFqn(cache1.getLocalAddress(), A_B);
assertEquals("/a/b state should have integrated in backup region " +
test, JOE, cache2.get(test, "name"));
Modified: core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java 2008-01-02
01:55:51 UTC (rev 4933)
+++ core/trunk/src/test/java/org/jboss/cache/transaction/StatusUnknownTest.java 2008-01-02
11:28:08 UTC (rev 4934)
@@ -1,7 +1,7 @@
package org.jboss.cache.transaction;
import org.jboss.cache.Cache;
-import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import static org.testng.AssertJUnit.*;
@@ -29,7 +29,7 @@
* @author <a href="mailto:manik@jboss.org">Manik Surtani</a>
*/
@SuppressWarnings("unchecked")
-@Test(groups = {"functional"})
+@Test(groups = "functional")
public class StatusUnknownTest
{
private Cache cache;
@@ -56,11 +56,11 @@
Fqn<String> fqn = Fqn.fromString("/a/b/c");
cache.put(fqn, "k", "v");
- assertEquals(4, ((CacheImpl) cache).getNumberOfLocksHeld());
+ assertEquals(4, ((CacheSPI) cache).getNumberOfLocksHeld());
assertTrue(cache.getRoot().hasChild(fqn));
tm.commit();
- assertEquals(0, ((CacheImpl) cache).getNumberOfLocksHeld());
+ assertEquals(0, ((CacheSPI) cache).getNumberOfLocksHeld());
assertFalse(cache.getRoot().hasChild(fqn));
}