[jboss-cvs] JBossCache/tests-50/functional/org/jboss/cache/pojo/util ...
Ben Wang
bwang at jboss.com
Mon Jul 17 10:41:28 EDT 2006
User: bwang
Date: 06/07/17 10:41:28
Added: tests-50/functional/org/jboss/cache/pojo/util
ObjectUtilTest.java
Removed: tests-50/functional/org/jboss/cache/pojo/util
ObjectUtilAopTest.java
Log:
Name changes
Revision Changes Path
1.1 date: 2006/07/17 14:41:28; author: bwang; state: Exp;JBossCache/tests-50/functional/org/jboss/cache/pojo/util/ObjectUtilTest.java
Index: ObjectUtilTest.java
===================================================================
package org.jboss.cache.pojo.util;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.PropertyConfigurator;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.pojo.impl.PojoCacheImpl;
import org.jboss.cache.pojo.test.NodeManager;
import org.jboss.cache.pojo.test.TestNode;
/**
* Test case for ObjectUtil
*
* @author Ben Wang
*/
public class ObjectUtilTest extends TestCase
{
Log log_ = LogFactory.getLog(ObjectUtilTest.class);
PojoCache cache_;
public ObjectUtilTest(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
log_.info("setUp() ....");
String configFile = "META-INF/local-service.xml";
cache_ = PojoCacheFactory.createInstance(configFile);
PropertyConfigurator config = new PropertyConfigurator();
config.configure(cache_, configFile); // read in generic replSync xml
cache_.start();
}
protected void tearDown() throws Exception
{
super.tearDown();
cache_.stop();
}
// public void testDummy() {}
public void testIsReachable() throws Exception
{
log_.info("testIsReachable() ....");
NodeManager pm_ = new NodeManager();
pm_.setRootNode("root");
pm_.addNode("root", "kanto");
pm_.addNode("root.kanto", "tokyo");
pm_.addNode("root.kanto", "yakahoma");
pm_.addNode("root.kanto.tokyo", "handanshita");
TestNode kanto = pm_.findNode("root.kanto");
TestNode yakahoma = pm_.findNode("root.kanto.yakahoma");
TestNode hadanshita = pm_.findNode("root.kanto.tokyo.handanshita");
pm_ = new NodeManager();
pm_.setRootNode("rt");
pm_.addNode("rt", "test");
TestNode test = pm_.findNode("rt.test");
// cache_.putObject("/pm", pm_);
assertTrue("Hadanshita should be reachable from Kanto ",
ObjectUtil.isReachable((PojoCacheImpl)cache_, kanto, hadanshita));
assertTrue("Hadanshita should also be reachable from Yakahoma! ",
ObjectUtil.isReachable((PojoCacheImpl) cache_, yakahoma, hadanshita));
assertFalse("Kanto should not be reachable from test! ",
ObjectUtil.isReachable((PojoCacheImpl) cache_, kanto, test));
}
public static Test suite() throws Exception
{
return new TestSuite(ObjectUtilTest.class);
}
public static void main(String[] args) throws Exception
{
junit.textui.TestRunner.run(suite());
}
}
More information about the jboss-cvs-commits
mailing list