[jboss-cvs] JBossCache/old/tests/functional/org/jboss/cache/aop/util ...
Ben Wang
bwang at jboss.com
Tue Oct 31 03:01:16 EST 2006
User: bwang
Date: 06/10/31 03:01:16
Added: old/tests/functional/org/jboss/cache/aop/util
ObjectUtilAopTest.java
Log:
Deprecated files moved to old dir.
Revision Changes Path
1.1 date: 2006/10/31 08:01:16; author: bwang; state: Exp;JBossCache/old/tests/functional/org/jboss/cache/aop/util/ObjectUtilAopTest.java
Index: ObjectUtilAopTest.java
===================================================================
package org.jboss.cache.aop.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.aop.PojoCache;
import org.jboss.cache.aop.test.NodeManager;
import org.jboss.cache.aop.test.TestNode;
import org.jboss.cache.factories.XmlConfigurationParser;
/**
* Test case for ObjectUtil
*
* @author Ben Wang
*/
public class ObjectUtilAopTest extends TestCase
{
Log log_=LogFactory.getLog(ObjectUtilAopTest.class);
PojoCache cache_;
public ObjectUtilAopTest(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
log_.info("setUp() ....");
String configFile = "META-INF/local-service.xml";
cache_ = new PojoCache();
cache_.setConfiguration(new XmlConfigurationParser().parseFile(configFile));
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(cache_, kanto, hadanshita));
assertTrue("Hadanshita should also be reachable from Yakahoma! ", ObjectUtil.isReachable(cache_, yakahoma, hadanshita));
assertFalse("Kanto should not be reachable from test! ", ObjectUtil.isReachable(cache_, kanto, test));
}
public static Test suite() throws Exception
{
return new TestSuite(ObjectUtilAopTest.class);
}
public static void main(String[] args) throws Exception
{
junit.textui.TestRunner.run(suite());
}
}
More information about the jboss-cvs-commits
mailing list