[jboss-cvs] javassist SVN: r536 - trunk/src/test/test/javassist/proxy.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 21 11:04:11 EDT 2010
Author: adinn
Date: 2010-04-21 11:04:11 -0400 (Wed, 21 Apr 2010)
New Revision: 536
Modified:
trunk/src/test/test/javassist/proxy/ProxyCacheGCTest.java
trunk/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java
trunk/src/test/test/javassist/proxy/ProxySerializationTest.java
Log:
patched tests to use 1.4 compatible synatx and also to allow for the fact that maven install will run them in the same JVM -- fixes for JASSIST-114
Modified: trunk/src/test/test/javassist/proxy/ProxyCacheGCTest.java
===================================================================
--- trunk/src/test/test/javassist/proxy/ProxyCacheGCTest.java 2010-04-21 14:19:44 UTC (rev 535)
+++ trunk/src/test/test/javassist/proxy/ProxyCacheGCTest.java 2010-04-21 15:04:11 UTC (rev 536)
@@ -38,6 +38,7 @@
public void testCacheGC()
{
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
+ try {
ProxyFactory.useCache = false;
for (int i = 0; i < REPETITION_COUNT; i++) {
ClassLoader newCL = new TestLoader();
@@ -48,6 +49,9 @@
Thread.currentThread().setContextClassLoader(oldCL);
}
}
+ } finally {
+ ProxyFactory.useCache = true;
+ }
}
/**
Modified: trunk/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java
===================================================================
--- trunk/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java 2010-04-21 14:19:44 UTC (rev 535)
+++ trunk/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java 2010-04-21 15:04:11 UTC (rev 536)
@@ -41,6 +41,7 @@
public void testFactoryCompatibility() throws Exception
{
+ System.out.println("ProxyFactory.useCache = " + ProxyFactory.useCache);
// create a factory which, by default, uses caching
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(TestClass.class);
Modified: trunk/src/test/test/javassist/proxy/ProxySerializationTest.java
===================================================================
--- trunk/src/test/test/javassist/proxy/ProxySerializationTest.java 2010-04-21 14:19:44 UTC (rev 535)
+++ trunk/src/test/test/javassist/proxy/ProxySerializationTest.java 2010-04-21 15:04:11 UTC (rev 536)
@@ -30,8 +30,8 @@
try {
String name = "proxytest_1";
- Constructor constructor = proxyClass.getConstructor(String.class);
- TestClass proxy = (TestClass)constructor.newInstance(name);
+ Constructor constructor = proxyClass.getConstructor(new Class[] {String.class});
+ TestClass proxy = (TestClass)constructor.newInstance(new Object[] {name});
((ProxyObject)proxy).setHandler(handler);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(bos);
@@ -41,10 +41,10 @@
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream in = new ObjectInputStream(bis);
TestClass newProxy = (TestClass)in.readObject();
- // inherited fields should have been deserialized
- assert(newProxy.getName() == null);
+ // inherited fields should not have been deserialized
+ assertTrue("new name should be null", newProxy.getName() == null);
// since we are reading into the same JVM the new proxy should have the same class as the old proxy
- assert(newProxy.getClass() == proxy.getClass());
+ assertTrue("classes should be equal", newProxy.getClass() == proxy.getClass());
} catch (Exception e) {
e.printStackTrace();
fail();
@@ -57,8 +57,8 @@
try {
String name = "proxytest_2";
- Constructor constructor = proxyClass.getConstructor(String.class);
- TestClass proxy = (TestClass)constructor.newInstance(name);
+ Constructor constructor = proxyClass.getConstructor(new Class[] {String.class});
+ TestClass proxy = (TestClass)constructor.newInstance(new Object[] {name});
((ProxyObject)proxy).setHandler(handler);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ProxyObjectOutputStream out = new ProxyObjectOutputStream(bos);
@@ -69,9 +69,9 @@
ProxyObjectInputStream in = new ProxyObjectInputStream(bis);
TestClass newProxy = (TestClass)in.readObject();
// inherited fields should have been deserialized
- assert(proxy.getName() == newProxy.getName());
+ assertTrue("names should be equal", proxy.getName().equals(newProxy.getName()));
// since we are reading into the same JVM the new proxy should have the same class as the old proxy
- assert(newProxy.getClass() == proxy.getClass());
+ assertTrue("classes should still be equal", newProxy.getClass() == proxy.getClass());
} catch (Exception e) {
e.printStackTrace();
fail();
More information about the jboss-cvs-commits
mailing list