use of org.springsource.loaded.test.infra.SubLoader in project spring-loaded by spring-projects.
the class CrossLoaderTests method cglibProxiesAcrossLoader1.
// TODO unfinished do I have to worry about proxies loaded by sub classloaders or not?
// Avoiding fastclass in this test, one less thing to worry about
@Test
public void cglibProxiesAcrossLoader1() throws Exception {
binLoader = new SubLoader(new String[] {}, new String[] { "../testdata/lib/cglib-nodep-2.2.jar" });
subLoader = (SubLoader) binLoader;
String t = "subpkg.ProxyTestcase";
ReloadableType proxyTestcaseR = subLoader.loadAsReloadableType(t);
result = runUnguarded(proxyTestcaseR.getClazz(), "run");
System.out.println(result);
result = runUnguarded(proxyTestcaseR.getClazz(), "getProxyLoader");
System.out.println(result.returnValue);
result = runUnguarded(proxyTestcaseR.getClazz(), "getSimpleLoader");
System.out.println(result.returnValue);
// Class<?> clazz = binLoader.loadClass(t);
//
// runMethodAndCollectOutput(clazz, "configureTest1");
//
// String output = runMethodAndCollectOutput(clazz, "run");
// // interception should have occurred and original should not have been run
// assertContains("[void example.Simple.moo()]", output);
// assertDoesNotContain("Simple.moo() running", output);
//
// // Check we loaded it as reloadable
// ReloadableType rtype = TypeRegistry.getTypeRegistryFor(binLoader).getReloadableType(toSlash(t), false);
// assertNotNull(rtype);
//
// // Check the incidental types were loaded as reloadable
// ReloadableType rtype2 = TypeRegistry.getTypeRegistryFor(binLoader).getReloadableType(toSlash("example.Simple"), false);
// assertNotNull(rtype2);
//
// rtype.loadNewVersion(retrieveRename(t, t + "2", "example.Simple2:example.Simple"));
// rtype2.loadNewVersion(retrieveRename("example.Simple", "example.Simple2"));
//
// // Now running 'boo()' which did not exist in the original. Remember this is invoked via proxy and so will only work
// // if the proxy was autoregenerated and reloaded!
// output = runMethodAndCollectOutput(clazz, "run");
// assertContains("[void example.Simple.boo()]", output);
// assertDoesNotContain("Simple2.boo running()", output);
}
use of org.springsource.loaded.test.infra.SubLoader in project spring-loaded by spring-projects.
the class CrossLoaderTests method setup.
@Before
public void setup() throws Exception {
super.setup();
binLoader = new SubLoader();
subLoader = (SubLoader) binLoader;
GlobalConfiguration.directlyDefineTypes = false;
}
Aggregations