[jbosscache-commits] JBoss Cache SVN: r6526 - core/trunk/src/test/java/org/jboss/cache/buddyreplication.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Aug 6 05:22:45 EDT 2008


Author: mircea.markus
Date: 2008-08-06 05:22:45 -0400 (Wed, 06 Aug 2008)
New Revision: 6526

Added:
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java
Log:
added ut for MVCC buddy failure

Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java	                        (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java	2008-08-06 09:22:45 UTC (rev 6526)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Cache;
+import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
+import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.config.Option;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.BuddyReplicationConfig;
+import org.jboss.cache.config.parsing.XmlConfigurationParser;
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.AfterMethod;
+
+import java.util.Properties;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Mircea.Markus at jboss.com
+ * @since 3.0
+ */
+ at Test(groups = "functionl")
+public class MvccBuddyReplicationTest
+{
+   private static final String FILE = "configs/mvcc-repl-sync-br.xml";
+
+   Configuration configuration;
+
+   public void testSimpleFailure() throws InterruptedException
+   {
+      Cache cache1 = createCache();
+      Thread.sleep(1000);
+      Cache cache2 = createCache();
+
+      cache1.put("/test", "key", "value");
+      cache1.stop();
+
+      Option option = cache2.getInvocationContext().getOptionOverrides();
+      option.setForceDataGravitation(true);
+      try
+      {
+         assert cache2.get("/test", "key").equals("value");
+      } finally
+      {
+         cache2.stop();
+      }
+   }
+
+   private Cache createCache()
+   {
+      Configuration fileConfig = new XmlConfigurationParser().parseFile(FILE);
+      DefaultCacheFactory dcf = new DefaultCacheFactory();
+      return dcf.createCache(fileConfig);
+   }
+}




More information about the jbosscache-commits mailing list