[jbosscache-commits] JBoss Cache SVN: r7489 - in core/branches/flat/src/main/java/org/horizon: factories/scopes and 2 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri Jan 16 10:17:37 EST 2009


Author: manik.surtani at jboss.com
Date: 2009-01-16 10:17:37 -0500 (Fri, 16 Jan 2009)
New Revision: 7489

Removed:
   core/branches/flat/src/main/java/org/horizon/atomic/APITest.java
   core/branches/flat/src/main/java/org/horizon/atomic/AtomicHashMapTest.java
   core/branches/flat/src/main/java/org/horizon/factories/scopes/ScopeDetectorTest.java
   core/branches/flat/src/main/java/org/horizon/lock/LockContainerHashingTest.java
   core/branches/flat/src/main/java/org/horizon/manager/CacheManagerComponentRegistryTest.java
   core/branches/flat/src/main/java/org/horizon/manager/CacheManagerTest.java
   core/branches/flat/src/main/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java
Log:
Deleted tests in the main src folder

Deleted: core/branches/flat/src/main/java/org/horizon/atomic/APITest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/atomic/APITest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/atomic/APITest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,254 +0,0 @@
-/*
- * 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.horizon.atomic;
-
-import org.horizon.config.Configuration;
-import org.horizon.config.Configuration.CacheMode;
-import org.horizon.manager.CacheManager;
-import org.horizon.transaction.DummyTransactionManager;
-import org.horizon.transaction.DummyTransactionManagerLookup;
-import org.horizon.util.TestingUtil;
-import org.testng.annotations.Test;
-
-import javax.transaction.Transaction;
-import java.util.Map;
-
- at Test(groups = "functional")
-public class APITest
-{
-
-   private void assertIsEmpty(Map map)
-   {
-      assert map.size() == 0;
-      assert map.get("blah") == null;
-      assert !map.containsKey("blah");
-   }
-
-   private void assertIsEmptyMap(AtomicMapCache cache, Object key)
-   {
-      assertIsEmpty(cache.getAtomicMap(key));
-   }
-
-   public void testAtomicMap()
-   {
-      Configuration c = new Configuration();
-      c.setInvocationBatchingEnabled(true);
-      AtomicMapCache cache = (AtomicMapCache) new CacheManager(c).getCache();
-      try
-      {
-         AtomicMap map = cache.getAtomicMap("map");
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-
-         map.put("blah", "blah");
-         assert map.size() == 1;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-
-         map.clear();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-      }
-      finally
-      {
-         cache.stop();
-      }
-   }
-
-
-   public void testReadSafetyEmptyCache() throws Exception
-   {
-      Configuration c = new Configuration();
-      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      c.setInvocationBatchingEnabled(true);
-      AtomicMapCache cache = (AtomicMapCache) new CacheManager(c).getCache();
-      try
-      {
-         AtomicMap map = cache.getAtomicMap("map");
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-
-         DummyTransactionManager.getInstance().begin();
-         map.put("blah", "blah");
-         assert map.size() == 1;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-         Transaction t = DummyTransactionManager.getInstance().suspend();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-
-         DummyTransactionManager.getInstance().resume(t);
-         DummyTransactionManager.getInstance().commit();
-
-         assert map.size() == 1;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-
-         map.clear();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-      }
-      finally
-      {
-         cache.stop();
-      }
-   }
-
-   public void testReadSafetyNotEmptyCache() throws Exception
-   {
-      Configuration c = new Configuration();
-      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      c.setInvocationBatchingEnabled(true);
-      AtomicMapCache cache = (AtomicMapCache) new CacheManager(c).getCache();
-      try
-      {
-         AtomicMap map = cache.getAtomicMap("map");
-
-         DummyTransactionManager.getInstance().begin();
-         map.put("blah", "blah");
-         assert map.size() == 1;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-         Transaction t = DummyTransactionManager.getInstance().suspend();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-
-         DummyTransactionManager.getInstance().resume(t);
-         DummyTransactionManager.getInstance().commit();
-
-         assert map.size() == 1;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-
-         map.clear();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-      }
-      finally
-      {
-         cache.stop();
-      }
-   }
-
-   public void testReadSafetyRollback() throws Exception
-   {
-      Configuration c = new Configuration();
-      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      c.setInvocationBatchingEnabled(true);
-      AtomicMapCache cache = (AtomicMapCache) new CacheManager(c).getCache();
-      try
-      {
-         AtomicMap map = cache.getAtomicMap("map");
-
-         DummyTransactionManager.getInstance().begin();
-         map.put("blah", "blah");
-         assert map.size() == 1;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-         Transaction t = DummyTransactionManager.getInstance().suspend();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-
-         DummyTransactionManager.getInstance().resume(t);
-         DummyTransactionManager.getInstance().rollback();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache, "map");
-      }
-      finally
-      {
-         cache.stop();
-      }
-   }
-
-   public void testReplicationCommit() throws Exception
-   {
-      Configuration c = new Configuration();
-      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      c.setCacheMode(CacheMode.REPL_SYNC);
-      c.setInvocationBatchingEnabled(true);
-      AtomicMapCache cache1 = (AtomicMapCache) new CacheManager(c).getCache();
-      AtomicMapCache cache2 = (AtomicMapCache) new CacheManager(c).getCache();
-
-      try
-      {
-         TestingUtil.blockUntilViewsReceived(20000, cache1, cache2);
-         AtomicMap map = cache1.getAtomicMap("map");
-
-         DummyTransactionManager.getInstance().begin();
-         map.put("existing", "existing");
-         map.put("blah", "blah");
-         DummyTransactionManager.getInstance().commit();
-
-         assert map.size() == 2;
-         assert map.get("blah").equals("blah");
-         assert map.containsKey("blah");
-
-         System.out.println("Map on cache 2 is " + cache2.getAtomicMap("map"));
-
-         assert cache2.getAtomicMap("map").size() == 2;
-         assert cache2.getAtomicMap("map").get("blah").equals("blah");
-         assert cache2.getAtomicMap("map").containsKey("blah");
-      }
-      finally
-      {
-         TestingUtil.killCaches(cache1, cache2);
-      }
-   }
-
-   public void testReplicationRollback() throws Exception
-   {
-      Configuration c = new Configuration();
-      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      c.setCacheMode(CacheMode.REPL_SYNC);
-      c.setInvocationBatchingEnabled(true);
-      AtomicMapCache cache1 = (AtomicMapCache) new CacheManager(c).getCache();
-      AtomicMapCache cache2 = (AtomicMapCache) new CacheManager(c).getCache();
-
-      try
-      {
-         TestingUtil.blockUntilViewsReceived(20000, cache1, cache2);
-         AtomicMap map = cache1.getAtomicMap("map");
-
-         DummyTransactionManager.getInstance().begin();
-         map.put("existing", "existing");
-         map.put("blah", "blah");
-         DummyTransactionManager.getInstance().rollback();
-
-         assertIsEmpty(map);
-         assertIsEmptyMap(cache1, "map");
-         assertIsEmptyMap(cache2, "map");
-      }
-      finally
-      {
-         TestingUtil.killCaches(cache1, cache2);
-      }
-   }
-}

Deleted: core/branches/flat/src/main/java/org/horizon/atomic/AtomicHashMapTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/atomic/AtomicHashMapTest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/atomic/AtomicHashMapTest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,105 +0,0 @@
-/*
- * 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.horizon.atomic;
-
-import org.easymock.EasyMock;
-import org.testng.annotations.Test;
-
-import java.io.IOException;
-import java.io.ObjectOutput;
-
- at Test(groups = "unit")
-public class AtomicHashMapTest
-{
-   public void testDeltasWithEmptyMap() throws IOException
-   {
-      AtomicHashMap m = new AtomicHashMap();
-      Delta d = m.delta();
-      assert d instanceof NullDelta;
-      ObjectOutput out = EasyMock.createMock(ObjectOutput.class);
-      EasyMock.replay(out);
-      d.writeExternal(out);
-      EasyMock.verify(out);
-
-      AtomicHashMap newMap = new AtomicHashMap();
-      newMap.initForWriting();
-      newMap.put("k", "v");
-      newMap = (AtomicHashMap) d.merge(newMap);
-      assert newMap.containsKey("k");
-      assert newMap.size() == 1;
-
-      newMap = (AtomicHashMap) d.merge(null);
-      assert newMap.isEmpty();
-   }
-
-   public void testDeltasWithNoChanges() throws IOException
-   {
-      AtomicHashMap m = new AtomicHashMap();
-      m.initForWriting();
-      m.put("k1", "v1");
-      m.commit();
-      assert m.size() == 1;
-      Delta d = m.delta();
-      assert d instanceof NullDelta;
-      ObjectOutput out = EasyMock.createMock(ObjectOutput.class);
-      EasyMock.replay(out);
-      d.writeExternal(out);
-      EasyMock.verify(out);
-
-      AtomicHashMap newMap = new AtomicHashMap();
-      newMap.initForWriting();
-      newMap.put("k", "v");
-      newMap = (AtomicHashMap) d.merge(newMap);
-      assert newMap.containsKey("k");
-      assert newMap.size() == 1;
-
-      newMap = (AtomicHashMap) d.merge(null);
-      assert newMap.isEmpty();
-   }
-
-   public void testDeltasWithRepeatedChanges()
-   {
-      AtomicHashMap m = new AtomicHashMap();
-      m.initForWriting();
-      m.put("k1", "v1");
-      m.put("k1", "v2");
-      m.put("k1", "v3");
-      assert m.size() == 1;
-      AtomicHashMapDelta d = (AtomicHashMapDelta) m.delta();
-      assert d.getChangeLogSize() != 0;
-
-      AtomicHashMap newMap = new AtomicHashMap();
-      newMap.initForWriting();
-      newMap.put("k1", "v4");
-      newMap = (AtomicHashMap) d.merge(newMap);
-      assert newMap.containsKey("k1");
-      assert newMap.get("k1").equals("v3");
-      assert newMap.size() == 1;
-
-      newMap = (AtomicHashMap) d.merge(null);
-      assert newMap.containsKey("k1");
-      assert newMap.get("k1").equals("v3");
-      assert newMap.size() == 1;
-   }
-}

Deleted: core/branches/flat/src/main/java/org/horizon/factories/scopes/ScopeDetectorTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/factories/scopes/ScopeDetectorTest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/factories/scopes/ScopeDetectorTest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,91 +0,0 @@
-package org.horizon.factories.scopes;
-
-import org.testng.annotations.Test;
-
-/**
- * @author Manik Surtani
- * @since 1.0
- */
- at Test(groups = "unit")
-public class ScopeDetectorTest
-{
-   public void testScopeOnClass()
-   {
-      testScopes(Test1.class, Scopes.GLOBAL);
-
-   }
-
-   public void testScopeOnInterface()
-   {
-      testScopes(Test2.class, Scopes.GLOBAL);
-   }
-
-   public void testScopeOnSuperClass()
-   {
-      testScopes(Test3.class, Scopes.GLOBAL);
-   }
-
-   public void testScopeOnSuperInterface()
-   {
-      testScopes(Test4.class, Scopes.GLOBAL);
-   }
-
-   public void testNoScopes()
-   {
-      testScopes(Test6.class, Scopes.NAMED_CACHE);
-   }
-
-   private void testScopes(Class clazz, Scopes expected)
-   {
-      Scopes detected = ScopeDetector.detectScope(clazz);
-      assert detected == expected : "Expected " + expected + " but was " + detected;
-   }
-
-   public static interface Unscoped
-   {
-
-   }
-
-   @Scope(Scopes.GLOBAL)
-   public static interface Scoped
-   {
-
-   }
-
-   @Scope(Scopes.GLOBAL)
-   public static class SuperScoped
-   {
-
-   }
-
-   public static class SuperUnScoped
-   {
-
-   }
-
-   @Scope(Scopes.GLOBAL)
-   public static class Test1
-   {
-
-   }
-
-   public static class Test2 implements Scoped
-   {
-
-   }
-
-   public static class Test3 extends SuperScoped
-   {
-
-   }
-
-   public static class Test4 extends Test2
-   {
-
-   }
-
-   public static class Test6 extends SuperUnScoped implements Unscoped
-   {
-
-   }
-}

Deleted: core/branches/flat/src/main/java/org/horizon/lock/LockContainerHashingTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/lock/LockContainerHashingTest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/lock/LockContainerHashingTest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,88 +0,0 @@
-/*
- * 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.horizon.lock;
-
-import org.horizon.util.concurrent.locks.LockContainer;
-import org.horizon.util.concurrent.locks.ReentrantLockContainer;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.*;
-import java.util.concurrent.locks.Lock;
-
- at Test(groups = "unit")
-public class LockContainerHashingTest
-{
-   private LockContainer<String> stripedLock;
-
-   @BeforeMethod(alwaysRun = true)
-   public void setUp()
-   {
-      stripedLock = new ReentrantLockContainer<String>(500);
-   }
-
-   public void testHashingDistribution()
-   {
-      // ensure even bucket distribution of lock stripes
-      List<String> keys = createRandomKeys(1000);
-
-      Map<Lock, Integer> distribution = new HashMap<Lock, Integer>();
-
-      for (String s : keys)
-      {
-         Lock lock = stripedLock.getLock(s);
-         if (distribution.containsKey(lock))
-         {
-            int count = distribution.get(lock) + 1;
-            distribution.put(lock, count);
-         }
-         else
-         {
-            distribution.put(lock, 1);
-         }
-      }
-
-      System.out.println(distribution);
-
-      // cannot be larger than the number of locks
-      System.out.println("dist size: " + distribution.size());
-      System.out.println("num shared locks: " + stripedLock.size());
-      assert distribution.size() <= stripedLock.size();
-      // assume at least a 2/3rd spread
-      assert distribution.size() * 1.5 >= stripedLock.size();
-   }
-
-   private List<String> createRandomKeys(int number)
-   {
-
-      List<String> f = new ArrayList<String>(number);
-      Random r = new Random();
-      int i = number;
-      while (f.size() < number)
-      {
-         String s = i + "baseKey" + (10000 + i++);
-         f.add(s);
-      }
-
-      return f;
-   }
-}

Deleted: core/branches/flat/src/main/java/org/horizon/manager/CacheManagerComponentRegistryTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/manager/CacheManagerComponentRegistryTest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/manager/CacheManagerComponentRegistryTest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,103 +0,0 @@
-package org.horizon.manager;
-
-import org.horizon.Cache;
-import org.horizon.config.CacheLoaderConfig;
-import org.horizon.config.Configuration;
-import org.horizon.interceptors.BatchingInterceptor;
-import org.horizon.interceptors.InterceptorChain;
-import org.horizon.loader.CacheLoaderManager;
-import org.horizon.loader.FileCacheLoaderConfig;
-import org.horizon.remoting.RPCManager;
-import org.horizon.transaction.DummyTransactionManager;
-import org.horizon.transaction.DummyTransactionManagerLookup;
-import org.horizon.util.TestingUtil;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import javax.transaction.TransactionManager;
-
-/**
- * @author Manik Surtani
- * @since 1.0
- */
- at Test(groups = "functional", sequential = true)
-public class CacheManagerComponentRegistryTest
-{
-   CacheManager cm;
-
-   @AfterMethod
-   public void tearDown()
-   {
-      if (cm != null) cm.stop();
-   }
-
-   public void testForceSharedComponents() throws CacheNameExistsException, NamedCacheNotFoundException
-   {
-      Configuration defaultCfg = new Configuration();
-      defaultCfg.setCacheMode(Configuration.CacheMode.REPL_SYNC);
-      // cache manager with default configuration
-      cm = new CacheManager(defaultCfg);
-
-      // default cache with no overrides
-      Cache c = cm.getCache();
-
-      Configuration overrides = new Configuration();
-      overrides.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      cm.defineCache("transactional", overrides);
-      Cache transactional = cm.getCache("transactional");
-
-      // assert components.
-      assert TestingUtil.extractComponent(c, TransactionManager.class) == null;
-      assert TestingUtil.extractComponent(transactional, TransactionManager.class) instanceof DummyTransactionManager;
-
-      // assert force-shared components
-      assert TestingUtil.extractComponent(c, RPCManager.class) != null;
-      assert TestingUtil.extractComponent(transactional, RPCManager.class) != null;
-      assert TestingUtil.extractComponent(c, RPCManager.class) == TestingUtil.extractComponent(transactional, RPCManager.class);
-   }
-
-   public void testForceUnsharedComponents() throws CacheNameExistsException, NamedCacheNotFoundException
-   {
-      CacheLoaderConfig clc = new CacheLoaderConfig();
-      FileCacheLoaderConfig fc = new FileCacheLoaderConfig();
-      fc.setLocation("/tmp");
-      clc.addIndividualCacheLoaderConfig(fc);
-
-      Configuration defaultCfg = new Configuration();
-      defaultCfg.setCacheMode(Configuration.CacheMode.REPL_SYNC);
-      defaultCfg.setCacheLoaderConfig(clc);
-      // cache manager with default configuration
-      cm = new CacheManager(defaultCfg);
-
-      // default cache with no overrides
-      Cache c = cm.getCache();
-
-      Configuration overrides = new Configuration();
-      overrides.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
-      cm.defineCache("transactional", overrides);
-      Cache transactional = cm.getCache("transactional");
-
-      // assert components.
-      assert TestingUtil.extractComponent(c, CacheLoaderManager.class) != null;
-      assert TestingUtil.extractComponent(transactional, CacheLoaderManager.class) != null;
-      assert TestingUtil.extractComponent(c, CacheLoaderManager.class) != TestingUtil.extractComponent(transactional, CacheLoaderManager.class);
-   }
-
-   public void testOverridingComponents() throws CacheNameExistsException, NamedCacheNotFoundException
-   {
-      Configuration defaultCfg = new Configuration();
-      cm = new CacheManager(defaultCfg);
-
-      // default cache with no overrides
-      Cache c = cm.getCache();
-
-      Configuration overrides = new Configuration();
-      overrides.setInvocationBatchingEnabled(true);
-      cm.defineCache("overridden", overrides);
-      Cache overridden = cm.getCache("overridden");
-
-      // assert components.
-      assert !TestingUtil.extractComponent(c, InterceptorChain.class).containsInterceptorType(BatchingInterceptor.class);
-      assert TestingUtil.extractComponent(overridden, InterceptorChain.class).containsInterceptorType(BatchingInterceptor.class);
-   }
-}

Deleted: core/branches/flat/src/main/java/org/horizon/manager/CacheManagerTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/manager/CacheManagerTest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/manager/CacheManagerTest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,69 +0,0 @@
-package org.horizon.manager;
-
-import org.horizon.CacheStatus;
-import org.horizon.Cache;
-import org.horizon.config.Configuration;
-import org.testng.annotations.Test;
-
-/**
- * @author Manik Surtani
- * @since 1.0
- */
- at Test(groups = "functional")
-public class CacheManagerTest
-{
-   public void testDefaultCache() throws CacheNameExistsException
-   {
-      CacheManager cm = new CacheManager();
-
-      assert cm.getCache().getCacheStatus() == CacheStatus.STARTED;
-      assert cm.getCache().getName().equals(CacheManager.DEFAULT_CACHE_NAME);
-
-      try
-      {
-         cm.defineCache(CacheManager.DEFAULT_CACHE_NAME, new Configuration());
-         assert false : "Should fail";
-      }
-      catch (IllegalArgumentException e)
-      {
-         // ok
-         assert true : "Allowed";
-      }
-   }
-
-   public void testClashingNames() throws CacheNameExistsException
-   {
-      CacheManager cm = new CacheManager();
-      Configuration c = new Configuration();
-
-      cm.defineCache("aCache", c);
-      try
-      {
-         cm.defineCache("aCache", c);
-         assert false : "Should fail";
-      }
-      catch (CacheNameExistsException cnee)
-      {
-         // expected
-         assert true : "Expected";
-      }
-   }
-
-   public void testStartAndStop()
-   {
-      CacheManager cm = new CacheManager();
-      Cache c1 = cm.getCache("cache1");
-      Cache c2 = cm.getCache("cache2");
-      Cache c3 = cm.getCache("cache3");
-
-      assert c1.getCacheStatus() == CacheStatus.STARTED;
-      assert c2.getCacheStatus() == CacheStatus.STARTED;
-      assert c3.getCacheStatus() == CacheStatus.STARTED;
-
-      cm.stop();
-
-      assert c1.getCacheStatus() == CacheStatus.STOPPED;
-      assert c2.getCacheStatus() == CacheStatus.STOPPED;
-      assert c3.getCacheStatus() == CacheStatus.STOPPED;
-   }
-}

Deleted: core/branches/flat/src/main/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java	2009-01-16 15:14:23 UTC (rev 7488)
+++ core/branches/flat/src/main/java/org/horizon/manager/CacheManagerXmlConfigurationTest.java	2009-01-16 15:17:37 UTC (rev 7489)
@@ -1,158 +0,0 @@
-package org.horizon.manager;
-
-import org.horizon.Cache;
-import org.horizon.config.Configuration;
-import org.horizon.config.ConfigurationException;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-/**
- * @author Manik Surtani
- * @since 1.0
- */
- at Test(groups = "functional", sequential = true)
-public class CacheManagerXmlConfigurationTest
-{
-   CacheManager cm;
-
-   @AfterMethod
-   public void tearDown()
-   {
-      if (cm != null) cm.stop();
-   }
-
-   public void testNamedCacheXML() throws IOException
-   {
-      String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-            "<jbosscache xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:jboss:starobrno-core:config:1.0\">\n" +
-            "\n" +
-            "    <default>\n" +
-            "        <locking concurrencyLevel=\"100\" lockAcquisitionTimeout=\"1000\" />\n" +
-            "    </default>\n" +
-            "\n" +
-            "    <namedCache name=\"transactional\">\n" +
-            "        <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
-            "    </namedCache>\n" +
-            "\n" +
-            "    <namedCache name=\"syncRepl\">\n" +
-            "        <clustering>\n" +
-            "            <stateRetrieval fetchInMemoryState=\"true\" timeout=\"15000\"/>\n" +
-            "            <jgroupsConfig configFile=\"udp.xml\"/>\n" +
-            "            <sync replTimeout=\"15000\"/>\n" +
-            "        </clustering>\n" +
-            "    </namedCache>\n" +
-            "\n" +
-            "    <namedCache name=\"txSyncRepl\">\n" +
-            "        <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
-            "        <clustering>\n" +
-            "            <stateRetrieval fetchInMemoryState=\"true\" timeout=\"15000\"/>\n" +
-            "            <jgroupsConfig configFile=\"udp.xml\"/>\n" +
-            "            <sync replTimeout=\"15000\"/>\n" +
-            "        </clustering>\n" +
-            "    </namedCache>\n" +
-            "    \n" +
-            "</jbosscache>";
-
-      ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
-      cm = new CacheManager(bais);
-
-      // test default cache
-      Cache c = cm.getCache();
-      assert c.getConfiguration().getConcurrencyLevel() == 100;
-      assert c.getConfiguration().getLockAcquisitionTimeout() == 1000;
-      assert c.getConfiguration().getRuntimeConfig().getTransactionManager() == null;
-      assert c.getConfiguration().getRuntimeConfig().getRPCManager() == null;
-
-      // test the "transactional" cache
-      c = cm.getCache("transactional");
-      assert c.getConfiguration().getConcurrencyLevel() == 100;
-      assert c.getConfiguration().getLockAcquisitionTimeout() == 1000;
-      assert c.getConfiguration().getRuntimeConfig().getTransactionManager() != null;
-      assert c.getConfiguration().getRuntimeConfig().getRPCManager() == null;
-
-      // test the "replicated" cache
-      c = cm.getCache("syncRepl");
-      assert c.getConfiguration().getConcurrencyLevel() == 100;
-      assert c.getConfiguration().getLockAcquisitionTimeout() == 1000;
-      assert c.getConfiguration().getRuntimeConfig().getTransactionManager() == null;
-      assert c.getConfiguration().getRuntimeConfig().getRPCManager() != null;
-
-      // test the "txSyncRepl" cache
-      c = cm.getCache("txSyncRepl");
-      assert c.getConfiguration().getConcurrencyLevel() == 100;
-      assert c.getConfiguration().getLockAcquisitionTimeout() == 1000;
-      assert c.getConfiguration().getRuntimeConfig().getTransactionManager() != null;
-      assert c.getConfiguration().getRuntimeConfig().getRPCManager() != null;
-   }
-
-   public void testNamedCacheXMLClashingNames() throws IOException
-   {
-      String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-            "<jbosscache xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:jboss:starobrno-core:config:1.0\">\n" +
-            "\n" +
-            "    <default>\n" +
-            "        <locking concurrencyLevel=\"100\" lockAcquisitionTimeout=\"1000\" />\n" +
-            "    </default>\n" +
-            "\n" +
-            "    <namedCache name=\"c1\">\n" +
-            "        <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
-            "    </namedCache>\n" +
-            "\n" +
-            "    <namedCache name=\"c1\">\n" +
-            "        <clustering>\n" +
-            "            <stateRetrieval fetchInMemoryState=\"true\" timeout=\"15000\"/>\n" +
-            "            <jgroupsConfig configFile=\"udp.xml\"/>\n" +
-            "            <sync replTimeout=\"15000\"/>\n" +
-            "        </clustering>\n" +
-            "    </namedCache>\n" +
-            "    \n" +
-            "</jbosscache>";
-
-      ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
-      try
-      {
-         cm = new CacheManager(bais);
-         assert false : "Should fail";
-      }
-      catch (ConfigurationException expected)
-      {
-
-      }
-   }
-
-   public void testNamedCacheXMLClashingNamesProgrammatic() throws IOException
-   {
-      String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-            "<jbosscache xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"urn:jboss:starobrno-core:config:1.0\">\n" +
-            "\n" +
-            "    <default>\n" +
-            "        <locking concurrencyLevel=\"100\" lockAcquisitionTimeout=\"1000\" />\n" +
-            "    </default>\n" +
-            "\n" +
-            "    <namedCache name=\"c1\">\n" +
-            "        <transaction transactionManagerLookupClass=\"org.jboss.starobrno.transaction.GenericTransactionManagerLookup\"/>\n" +
-            "    </namedCache>\n" +
-            "\n" +
-            "</jbosscache>";
-
-      ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
-      cm = new CacheManager(bais);
-
-      assert cm.getCache() != null;
-      assert cm.getCache("c1") != null;
-      try
-      {
-         cm.defineCache("c1", new Configuration());
-         assert false : "Should fail";
-      }
-      catch (CacheNameExistsException expected)
-      {
-
-      }
-   }
-}
-
-




More information about the jbosscache-commits mailing list