[jbosscache-commits] JBoss Cache SVN: r5723 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 12 other directories.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Apr 28 10:53:05 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-04-28 10:53:03 -0400 (Mon, 28 Apr 2008)
New Revision: 5723
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainer.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java
core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java
core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java
core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java
core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
Log:
more refactoring
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainer.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainer.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -538,27 +538,6 @@
return new Object[]{result, n};
}
- /**
- * Returns true if a node has all children loaded and initialized.
- * todo - this belongs to NodeSPI, should be moved in 3.x
- */
- public boolean allInitialized(NodeSPI<?, ?> n)
- {
- if (!n.isChildrenLoaded())
- {
- return false;
- }
- for (NodeSPI child : n.getChildrenDirect())
- {
- if (!child.isDataLoaded())
- {
- return false;
- }
- }
- return true;
-
- }
-
public void createNodesLocally(Fqn<?> fqn, Map<?, ?> data) throws CacheException
{
int treeNodeSize;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -1,6 +1,5 @@
package org.jboss.cache.interceptors;
-import org.jboss.cache.DataContainer;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Modification;
@@ -18,8 +17,7 @@
import org.jboss.cache.commands.write.RemoveKeyCommand;
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.loader.CacheLoader;
-import org.jboss.cache.notifications.Notifier;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.TransactionEntry;
@@ -46,6 +44,7 @@
protected TransactionManager txMgr = null;
private long activations = 0;
+ ActivationModificationsBuilder builder;
/**
* List<Transaction> that we have registered for
@@ -65,6 +64,12 @@
this.txMgr = txMgr;
}
+ @Start
+ public void createModificationsBuilder()
+ {
+ builder = new ActivationModificationsBuilder();
+ }
+
@Override
public Object handleRemoveDataCommand(InvocationContext ctx, RemoveDataCommand command) throws Throwable
{
@@ -155,7 +160,7 @@
// node not null and attributes have been loaded?
if (!n.getChildrenDirect().isEmpty())
{
- boolean result = dataContainer.allInitialized(n);
+ boolean result = childrenLoaded(n);
if (result)
{
log.debug("children all initialized");
@@ -170,6 +175,23 @@
}
}
+ private static boolean childrenLoaded(NodeSPI<?, ?> node)
+ {
+ if (!node.isChildrenLoaded())
+ {
+ return false;
+ }
+ for (NodeSPI child : node.getChildrenDirect())
+ {
+ if (!child.isDataLoaded())
+ {
+ return false;
+ }
+ }
+ return true;
+
+ }
+
@Override
public Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command) throws Throwable
{
@@ -258,7 +280,7 @@
throw new Exception("entry for transaction " + gtx + " not found in transaction table");
}
List<Modification> cacheLoaderModifications = new ArrayList<Modification>();
- ActivationModificationsBuilder builder = new ActivationModificationsBuilder(dataContainer, loader, notifier);
+
builder.visitCollection(null, entry.getCacheLoaderModifications());
if (cacheLoaderModifications.size() > 0)
{
@@ -266,22 +288,12 @@
}
}
- public static class ActivationModificationsBuilder extends AbstractVisitor
+ public class ActivationModificationsBuilder extends AbstractVisitor
{
private List<Modification> cacheLoaderModifications = new ArrayList<Modification>();
- private DataContainer dataContainer;
- private CacheLoader loader;
- private Notifier notifier;
private int txActs = 0;
- public ActivationModificationsBuilder(DataContainer dataContainer, CacheLoader loader, Notifier notifier)
- {
- this.dataContainer = dataContainer;
- this.loader = loader;
- this.notifier = notifier;
- }
-
@Override
public Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand removeNodeCommand) throws Throwable
{
@@ -313,7 +325,7 @@
if (n != null && n.isDataLoaded())
{
// has children?
- boolean result = dataContainer.allInitialized(n);
+ boolean result = childrenLoaded(n);
if (!n.getChildrenDirect().isEmpty() && result)
{
// children have been loaded, remove the node
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -5,6 +5,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
+import org.jboss.cache.commands.ReversibleCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
@@ -440,12 +441,14 @@
*/
private boolean wasRemovedInTx(Fqn fqn, GlobalTransaction t)
{
- if (t == null)
+ if (t == null) return false;
+ TransactionEntry entry = txTable.get(t);
+
+ for (ReversibleCommand txCacheCommand : entry.getCacheLoaderModifications())
{
- return false;
+ if (txCacheCommand instanceof RemoveNodeCommand && fqn.isChildOrEquals(txCacheCommand.getFqn())) return true;
}
- TransactionEntry entry = txTable.get(t);
- return entry.wasRemovedInTx(fqn);
+ return false;
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InterceptorChain.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -21,7 +21,6 @@
* @author Mircea.Markus at jboss.com
* @since 2.2
*/
-// TODO: Move to org.jboss.cache.interceptors
public class InterceptorChain
{
/**
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -43,7 +43,6 @@
*
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 2.1.0
- * todo [mmarkus] consider renaming this as it does not look as an Delegate (rather as a facade)
*/
@SuppressWarnings("unchecked")
public class CacheInvocationDelegate<K, V> extends AbstractInvocationDelegate implements CacheSPI<K, V>
Modified: core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/loader/jdbm/JdbmCacheLoader.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -51,8 +51,7 @@
* N represents a node, K represents a key block. k and v represent key/value
* pairs.
* <p/>
- * TODO the browse operations lock the entire tree; eventually the JDBM team
- * plans to fix this.
+ * The browse operations lock the entire tree; eventually the JDBM team plans to fix this.
*
* @author Elias Ross
* @version $Id$
Modified: core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/lock/LockUtil.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -262,7 +262,7 @@
if (gtx == lock.getWriterOwner()
|| lock.getReaderOwners().contains(gtx))
{
- // TODO should we throw an exception??
+ // perhaps we should throw an exception?
lock.release(gtx);
status = TransactionLockStatus.STATUS_BROKEN;
}
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/NodeData.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -14,7 +14,7 @@
* @author Bela Ban
* @version $Id$
*/
-// TODO: In 3.0.0, remove Externalizable and rely on the CacheMarshaller.
+// TODO: 3.0.0: remove Externalizable and rely on the CacheMarshaller.
public class NodeData implements Externalizable
{
private Fqn<?> fqn = null;
@@ -63,7 +63,7 @@
return false;
}
- // TODO: Remove in 3.0.0 and replace with marshallNodeData/unmarshallNodeData methods in the CacheMarshaller so that we can use the same marshalling framework for Fqns.
+ // TODO: 3.0.0: Remove and replace with marshallNodeData/unmarshallNodeData methods in the CacheMarshaller so that we can use the same marshalling framework for Fqns.
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(fqn);
@@ -78,7 +78,7 @@
}
}
- // TODO: Remove in 3.0.0 and replace with marshallNodeData/unmarshallNodeData methods in the CacheMarshaller so that we can use the same marshalling framework for Fqns.
+ // TODO: 3.0.0: Remove in and replace with marshallNodeData/unmarshallNodeData methods in the CacheMarshaller so that we can use the same marshalling framework for Fqns.
@SuppressWarnings("unchecked")
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
Modified: core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/main/java/org/jboss/cache/transaction/TransactionEntry.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -13,7 +13,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
import org.jboss.cache.commands.ReversibleCommand;
-import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Option;
import org.jboss.cache.interceptors.OrderedSynchronizationHandler;
import org.jboss.cache.lock.IdentityLock;
@@ -396,19 +395,6 @@
return !modificationList.isEmpty() || !classLoadeModList.isEmpty();
}
- public boolean wasRemovedInTx(Fqn fqn)
- {
- for (ReversibleCommand txCacheCommand : getCacheLoaderModifications())
- {
- //todo - revisit this as it is ugly. phps add an isRemovred(fqn) somwhere on command hierarchy?
- if (txCacheCommand instanceof RemoveNodeCommand && fqn.isChildOrEquals(((RemoveNodeCommand) txCacheCommand).getFqn()))
- {
- return true;
- }
- }
- return false;
- }
-
/**
* Cleans up internal state
*/
Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -26,7 +26,6 @@
@Test(groups = {"functional"})
public class ResidentNodesTest
{
-
private CacheSPI<Object, Object> cache;
private final String TEST_NODES_ROOT = "residentNodesTest";
Modified: core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/lock/NonBlockingWriterLockTest.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -27,7 +27,7 @@
* @version 1.0
*/
@Test(groups = {"functional"}, enabled = false)
-// TODO: This is not a very good test. There is a lot of timing related stuff with regards to the order of execution of reader and writer threads that is not taken into account, producing variable results. Needs to be rewritten.
+// TODO: 2.2.0: This is not a very good test. There is a lot of timing related stuff with regards to the order of execution of reader and writer threads that is not taken into account, producing variable results. Needs to be rewritten.
public class NonBlockingWriterLockTest
{
static final NonBlockingWriterLock lock_ = new NonBlockingWriterLock();
Modified: core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/lock/pessimistic/ConcurrentPutRemoveTest.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -61,8 +61,8 @@
}
}
- @Test(invocationCount = 500, enabled = false)
- // TODO: This is still a known failure
+ @Test(invocationCount = 500, enabled = true)
+ // TODO: 3.0.0: This is still a known failure. MVCC in 3.0.0 will fix this; enable it in 3.0.0.
public void testLock() throws Exception
{
System.out.println("ConcurrentPutRemoveTest.testLock count = " + (++count));
Modified: core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/manager/CacheManagerTest.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -7,37 +7,35 @@
package org.jboss.cache.manager;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
import org.jboss.cache.Cache;
import org.jboss.cache.CacheManagerImpl;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationRegistry;
import org.jgroups.JChannelFactory;
+import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
/**
* Tests CacheRegistryImpl.
- *
+ *
* @author Brian Stansberry
*/
@Test(groups = {"functional"})
public class CacheManagerTest
{
- /** A file that includes every configuration element I could think of */
+ /**
+ * A file that includes every configuration element I could think of
+ */
public static final String DEFAULT_CONFIGURATION_FILE = "META-INF/jbc2-configs.xml";
-
+
private Set<Cache<Object, Object>> caches = new HashSet<Cache<Object, Object>>();
-
+
@AfterMethod(alwaysRun = true)
public void tearDown() throws Exception
{
@@ -54,14 +52,13 @@
}
}
}
-
+
/**
* A test that instantiates a CacheRegistryImpl and cycles through all its
* configs, creating and releasing each.
- *
- * TODO It's late; I just put a bunch of stuff in one test method.
- * Refactor or something.
- *
+ * <p/>
+ * TODO: 2.2.0: Break this up into more fine-grained tests
+ *
* @throws Exception
*/
public void testBasic() throws Exception
@@ -70,55 +67,55 @@
cf.setMultiplexerConfig("stacks.xml"); // the default stacks in jgroups.jar
CacheManagerImpl registry = new CacheManagerImpl(DEFAULT_CONFIGURATION_FILE, cf);
registry.start();
-
+
ConfigurationRegistry configRegistry = registry.getConfigurationRegistry();
-
+
Set<String> configNames = registry.getConfigurationNames();
assertEquals(7, configNames.size());
Set<String> cacheNames = registry.getCacheNames();
assertEquals(0, cacheNames.size());
-
+
for (String configName : configNames)
{
assertNull(configName + " not created", registry.getCache(configName, false));
- Cache<Object, Object> cache = registry.getCache(configName, true);
+ Cache<Object, Object> cache = registry.getCache(configName, true);
caches.add(cache);
-
+
// Cache shouldn't be started
assertEquals(CacheStatus.INSTANTIATED, cache.getCacheStatus());
cache.create();
cache.start();
-
+
// Config should be a clone
Configuration rawConfig = configRegistry.getConfiguration(configName);
Configuration realConfig = cache.getConfiguration();
assertFalse(rawConfig == realConfig);
assertEquals(rawConfig.getClusterName(), realConfig.getClusterName());
}
-
+
cacheNames = registry.getCacheNames();
assertEquals(configNames, cacheNames);
-
+
// Test basic releasing of caches
for (String configName : configNames)
{
- registry.releaseCache(configName);
+ registry.releaseCache(configName);
}
-
+
cacheNames = registry.getCacheNames();
assertEquals(0, cacheNames.size());
-
+
// We shouldn't have affected configuration set
Set<String> configNames2 = registry.getConfigurationNames();
assertEquals(configNames, configNames2);
-
+
// Releasing only checkout of cache should have destroyed it
for (Iterator<Cache<Object, Object>> it = caches.iterator(); it.hasNext();)
{
assertEquals(CacheStatus.DESTROYED, it.next().getCacheStatus());
it.remove();
}
-
+
// Get cache w/o asking to create returns null
String configName = configNames.iterator().next();
assertNull(configName + " not created", registry.getCache(configName, false));
@@ -126,30 +123,30 @@
Cache<Object, Object> cache = registry.getCache(configName, true);
assertFalse(null == cache);
caches.add(cache);
-
+
cache.create();
cache.start();
-
+
// Test 2 checkouts of the same cache
- Cache<Object, Object> cache2 = registry.getCache(configName, true);
+ Cache<Object, Object> cache2 = registry.getCache(configName, true);
assertTrue(cache == cache2);
-
+
registry.releaseCache(configName);
-
+
// One release does not cause registry to stop cache
assertEquals(CacheStatus.STARTED, cache.getCacheStatus());
-
+
registry.stop();
-
+
// Now it's stopped
assertEquals(CacheStatus.DESTROYED, cache.getCacheStatus());
caches.remove(cache);
-
+
cacheNames = registry.getCacheNames();
assertEquals(0, cacheNames.size());
assertEquals(cacheNames, registry.getConfigurationNames());
}
-
+
public void testNullConfigResource() throws Exception
{
JChannelFactory cf = new JChannelFactory();
@@ -157,7 +154,7 @@
String configResource = null;
CacheManagerImpl registry = new CacheManagerImpl(configResource, cf);
registry.start();
-
+
assertEquals("No configs", 0, registry.getConfigurationNames().size());
}
}
Modified: core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/multiplexer/BadMuxConfigTest.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -57,7 +57,7 @@
public void testValidMuxConfig() throws Exception
{
- //todo this test hangs on forever. Uncomment it and make it work...
+ // TODO: 2.2.0: this test hangs on forever. Uncomment it and make it work...
// muxHelper.configureCacheForMux(cache);
//
// checkStart(false, true);
Modified: core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/passivation/PassivationActivationCallbacksTestCase.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -202,7 +202,6 @@
try
{
- // TODO Can this cause deadlock in the cache level? Should be ok but need review.
Object bean = cache.get(fqn, "bean");
if (bean != null)
{
Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2008-04-28 14:31:25 UTC (rev 5722)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/StateTransfer200Test.java 2008-04-28 14:53:03 UTC (rev 5723)
@@ -14,17 +14,12 @@
import org.jboss.cache.buddyreplication.BuddyFqnTransformer;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.config.BuddyReplicationConfig;
-import org.jboss.cache.factories.XmlConfigurationParser;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.MarshalledValue;
import org.jboss.cache.misc.TestingUtil;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import java.lang.reflect.Method;
/**
@@ -462,18 +457,9 @@
private BuddyReplicationConfig getBuddyConfig() throws Exception
{
- // TODO just build the object and skip the legacy XML step
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.newDocument();
- Element config = doc.createElement("config");
- doc.appendChild(config);
- Element enabled = doc.createElement("buddyReplicationEnabled");
- enabled.appendChild(doc.createTextNode("true"));
- config.appendChild(enabled);
- Element pool = doc.createElement("buddyPoolName");
- pool.appendChild(doc.createTextNode("TEST"));
- config.appendChild(pool);
- return XmlConfigurationParser.parseBuddyReplicationConfig(config);
+ BuddyReplicationConfig brc = new BuddyReplicationConfig();
+ brc.setEnabled(true);
+ brc.setBuddyPoolName("TEST");
+ return brc;
}
}
More information about the jbosscache-commits
mailing list