[jbosscache-commits] JBoss Cache SVN: r4572 - core/trunk/src/test/java/org/jboss/cache/marshall.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Oct 8 12:20:21 EDT 2007
Author: manik.surtani at jboss.com
Date: 2007-10-08 12:20:21 -0400 (Mon, 08 Oct 2007)
New Revision: 4572
Removed:
core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java
Log:
Removed deprecated test
Deleted: core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java 2007-10-08 16:17:04 UTC (rev 4571)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/LocalTest.java 2007-10-08 16:20:21 UTC (rev 4572)
@@ -1,155 +0,0 @@
-package org.jboss.cache.marshall;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import javax.transaction.Transaction;
-
-import org.jboss.cache.CacheImpl;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.lock.IsolationLevel;
-import org.jboss.cache.marshall.data.Debug;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-/**
- * Simple functional tests for LegacyTreeCacheMarshaller
- *
- * @author Ben Wang
- * @version $Id$
- */
- at Test(groups = {"functional"})
-public class LocalTest extends RegionBasedMarshallingTestBase
-{
- CacheImpl<Object, Object> cache = null;
- Transaction tx = null;
- final Fqn FQN = Fqn.fromString("/myNode");
- final String KEY = "key";
- final String VALUE = "value";
- Exception ex;
-
- @BeforeMethod(alwaysRun = true)
- public void setUp() throws Exception
- {
- cache = (CacheImpl<Object, Object>) DefaultCacheFactory.getInstance().createCache(false);
- cache.getConfiguration().setCacheMode(Configuration.CacheMode.LOCAL);
- cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- cache.getConfiguration().setIsolationLevel(IsolationLevel.REPEATABLE_READ);
- cache.create();
- cache.start();
- ex = null;
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown() throws Exception
- {
- if (cache != null)
- {
- cache.stop();
- cache.destroy();
- cache = null;
- }
- if (ex != null)
- {
- throw ex;
- }
- }
-
- @SuppressWarnings("deprecation")
- public void testClassloader() throws Exception
- {
- String jarDir = System.getProperty("test.jar.dir");
- File jar0 = new File(jarDir + "/testMarshall.jar");
- URL[] cp0 = {jar0.toURL()};
- URLClassLoader ucl0 = new URLClassLoader(cp0);
- Thread.currentThread().setContextClassLoader(ucl0);
- Class clasz1 = ucl0.loadClass(PERSON_CLASSNAME);
- StringBuffer buffer = new StringBuffer("Person Info");
- Debug.displayClassInfo(clasz1, buffer, false);
- log(buffer.toString());
- Object ben = clasz1.newInstance();
- Object value;
- try
- {
- {
- Class[] types = {String.class};
- Method setValue = clasz1.getMethod("setName", types);
- Object[] margs = {"Ben"};
- value = setValue.invoke(ben, margs);
- }
- Class[] types = {};
- Object[] margs = {};
- Method getValue = clasz1.getMethod("getLastElementAsString", types);
- value = getValue.invoke(ben, margs);
- buffer.setLength(0);
- buffer.append("main.obj.CodeSource: ");
- Debug.displayClassInfo(value.getClass(), buffer, false);
- log(buffer.toString());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- log("Failed to invoke getLastElementAsString: " + e);
- }
-
- cache.put("/a/b/c", "ben", ben);
- assertNotNull(cache.get("/a/b/c"));
- assertEquals(cache.get("/a/b/c", "ben"), ben);
- Object obj = cache.get("/a/b/c", "ben");
-
- Class claszAddr = ucl0.loadClass(ADDRESS_CLASSNAME);
- buffer = new StringBuffer("Address Info");
- Debug.displayClassInfo(claszAddr, buffer, false);
- log(buffer.toString());
- Object addr = claszAddr.newInstance();
- try
- {
- {
- Class[] types = {String.class};
- Method setValue = claszAddr.getMethod("setCity", types);
- Object[] margs = {"SF"};
- value = setValue.invoke(addr, margs);
- }
-
- {
- Class[] types = {claszAddr};
- Method setValue = clasz1.getMethod("setAddress", types);
- Object[] margs = {addr};
- value = setValue.invoke(obj, margs);
- }
-
- Class[] types = {};
- Object[] margs = {};
- Method getValue = clasz1.getMethod("getAddress", types);
- value = getValue.invoke(obj, margs);
- buffer.setLength(0);
- buffer.append("main.obj.CodeSource: ");
- Debug.displayClassInfo(value.getClass(), buffer, false);
- log(buffer.toString());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- log("Failed to invoke: " + e);
- throw e;
- }
-
- }
-
- void log(String msg)
- {
- System.out.println("-- " + msg);
- }
-
- //public static void main(String[] args) {
- // junit.textui.TestRunner.run(suite());
- //}
-
-}
More information about the jbosscache-commits
mailing list