[jbosscache-commits] JBoss Cache SVN: r7709 - core/branches/flat/src/test/java/org/horizon/marshall.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Feb 17 13:26:06 EST 2009


Author: mircea.markus
Date: 2009-02-17 13:26:06 -0500 (Tue, 17 Feb 2009)
New Revision: 7709

Modified:
   core/branches/flat/src/test/java/org/horizon/marshall/MarshalledValueTest.java
Log:
enforce a test execution order

Modified: core/branches/flat/src/test/java/org/horizon/marshall/MarshalledValueTest.java
===================================================================
--- core/branches/flat/src/test/java/org/horizon/marshall/MarshalledValueTest.java	2009-02-17 17:28:23 UTC (rev 7708)
+++ core/branches/flat/src/test/java/org/horizon/marshall/MarshalledValueTest.java	2009-02-17 18:26:06 UTC (rev 7709)
@@ -3,16 +3,16 @@
 import org.horizon.AdvancedCache;
 import org.horizon.Cache;
 import org.horizon.CacheException;
+import org.horizon.loader.dummy.DummyInMemoryCacheLoader;
+import org.horizon.loader.CacheLoaderConfig;
 import org.horizon.commands.write.PutKeyValueCommand;
+import org.horizon.config.Configuration;
 import org.horizon.config.CacheLoaderManagerConfig;
-import org.horizon.config.Configuration;
 import org.horizon.container.DataContainer;
 import org.horizon.context.InvocationContext;
 import org.horizon.interceptors.InterceptorChain;
 import org.horizon.interceptors.MarshalledValueInterceptor;
 import org.horizon.interceptors.base.CommandInterceptor;
-import org.horizon.loader.CacheLoaderConfig;
-import org.horizon.loader.dummy.DummyInMemoryCacheLoader;
 import org.horizon.notifications.Listener;
 import org.horizon.notifications.cachelistener.annotation.CacheEntryModified;
 import org.horizon.notifications.cachelistener.event.CacheEntryModifiedEvent;
@@ -151,6 +151,7 @@
    }
 
    public void testNodeReleaseObjectKeyReferences() throws IOException, ClassNotFoundException {
+      assertSerializationCounts(0,0);
       Pojo key = new Pojo();
       cache1.put(key, "value");
 
@@ -179,6 +180,8 @@
       assert o instanceof MarshalledValue;
       mv = (MarshalledValue) o;
       assertSerialized(mv);
+
+      assertSerializationCounts(2, 0);
       assert cache2.get(key).equals("value");
       assertSerializationCounts(2, 1);
       assertDeserialized(mv);
@@ -248,6 +251,36 @@
       assertOnlyOneRepresentationExists(recreated);
    }
 
+   public void testCallbackValues() {
+      MockListener l = new MockListener();
+      cache1.addListener(l);
+      Pojo pojo = new Pojo();
+      cache1.put("key", pojo);
+
+      assert l.newValue != null;
+      assert l.newValue instanceof MarshalledValue;
+      MarshalledValue mv = (MarshalledValue) l.newValue;
+      assert mv.instance instanceof Pojo;
+      assertSerializationCounts(1, 0);
+   }
+
+   public void testRemoteCallbackValues() throws Exception {
+      MockListener l = new MockListener();
+      cache2.addListener(l);
+      Pojo pojo = new Pojo();
+      cache1.put("key", pojo);
+
+      assert l.newValue != null;
+      assert l.newValue instanceof MarshalledValue;
+      MarshalledValue mv = (MarshalledValue) l.newValue;
+      assert mv.get() instanceof Pojo;
+      assertSerializationCounts(1, 1);
+   }
+
+   /**
+    * Run this as last method as it creates and stops cache loaders, which might affect other tests.
+    */
+   @Test(dependsOnMethods = "org.horizon.marshall.MarshalledValueTest.test(?!CacheLoaders)[a-zA-Z]*")
    public void testCacheLoaders() throws CloneNotSupportedException {
       tearDown();
 
@@ -276,32 +309,7 @@
       assertSerializationCounts(1, 1);
    }
 
-   public void testCallbackValues() {
-      MockListener l = new MockListener();
-      cache1.addListener(l);
-      Pojo pojo = new Pojo();
-      cache1.put("key", pojo);
 
-      assert l.newValue != null;
-      assert l.newValue instanceof MarshalledValue;
-      MarshalledValue mv = (MarshalledValue) l.newValue;
-      assert mv.instance instanceof Pojo;
-      assertSerializationCounts(1, 0);
-   }
-
-   public void testRemoteCallbackValues() throws Exception {
-      MockListener l = new MockListener();
-      cache2.addListener(l);
-      Pojo pojo = new Pojo();
-      cache1.put("key", pojo);
-
-      assert l.newValue != null;
-      assert l.newValue instanceof MarshalledValue;
-      MarshalledValue mv = (MarshalledValue) l.newValue;
-      assert mv.get() instanceof Pojo;
-      assertSerializationCounts(1, 1);
-   }
-
    @Listener
    public static class MockListener {
       Object newValue;




More information about the jbosscache-commits mailing list