[jbosscache-commits] JBoss Cache SVN: r6762 - core/trunk/src/test/java/org/jboss/cache/marshall.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri Sep 19 10:41:57 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-09-19 10:41:57 -0400 (Fri, 19 Sep 2008)
New Revision: 6762
Added:
core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
Log:
Tests marshalling of arrays
Added: core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java 2008-09-19 14:41:57 UTC (rev 6762)
@@ -0,0 +1,45 @@
+package org.jboss.cache.marshall;
+
+import org.jboss.cache.Cache;
+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.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.util.TestingUtil;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.Random;
+
+ at Test(groups = "functional")
+public class SimpleArrayReplTest
+{
+ public void testArrayRepl() throws CloneNotSupportedException
+ {
+ int streamsize = 11000;
+ byte[] b = new byte[streamsize];
+ new Random().nextBytes(b);
+ Cache<String, byte[]> cache1 = null, cache2 = null;
+
+ try
+ {
+ Configuration c = new Configuration();
+ c.setCacheMode(CacheMode.REPL_SYNC);
+ c.setNodeLockingScheme(NodeLockingScheme.MVCC);
+ cache1 = new DefaultCacheFactory<String, byte[]>().createCache(c.clone());
+ cache2 = new DefaultCacheFactory<String, byte[]>().createCache(c.clone());
+
+ TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
+
+ cache1.put(Fqn.fromString("/a"), "test", b);
+ byte[] bytesBack = cache2.get(Fqn.fromString("/a"), "test");
+
+ assert Arrays.equals(b, bytesBack);
+ }
+ finally
+ {
+ TestingUtil.killCaches(cache1, cache2);
+ }
+ }
+}
More information about the jbosscache-commits
mailing list