assertNotNull(Reflections.get(beforeLoader, "parent"));
}
loader.internalStop();
server.undeploy(new AssemblerBeforeApplicationDestroyed(info, context));
{
final URLClassLoader afterLoader = URLClassLoader.class.cast(SystemInstance.get().getComponent(ContainerSystem.class).getWebContext("test").getClassLoader());
assertSame(loader, afterLoader);
assertNotNull(afterLoader);
assertEquals(0, afterLoader.getURLs().length);
assertEquals(LifecycleState.STOPPED, loader.getState());
}
final StandardRoot resources = new StandardRoot();
loader.setResources(resources);
resources.setContext(new StandardContext() {
@Override
public String getDocBase() {
final File file = new File("target/foo");
file.mkdirs();
return file.getAbsolutePath();
}
@Override
public String getMBeanKeyProperties() {
return "foo";
}
{}});
resources.start();
loader.start();
// TomcatWebAppBuilder ill catch start event from StandardCo1ntext and force a classloader
Reflections.set(loader, "parent", ParentClassLoaderFinder.Helper.get());
server.afterApplicationCreated(new AssemblerAfterApplicationCreated(info, context, Collections.<BeanContext>emptyList()));
{
final ClassLoader afterLoader = SystemInstance.get().getComponent(ContainerSystem.class).getWebContext("test").getClassLoader();
assertSame(loader, afterLoader);
assertNotNull(afterLoader);
assertNotNull(Reflections.get(afterLoader, "parent"));
}
server.undeploy(new AssemblerBeforeApplicationDestroyed(info, context));
} finally {
server.stop();
}
}