}
public void testContextClassLoader() throws Exception
{
TestDummyClassLoader dummy = new TestDummyClassLoader();
VFSStructuralDeployersImpl structuralDeployers = new VFSStructuralDeployersImpl();
VFSStructureBuilder builder = new VFSStructureBuilder();
structuralDeployers.setStructureBuilder(builder);
structuralDeployers.addDeployer(new JARStructure());
structuralDeployers.addDeployer(new FileStructure());
ClassLoader previous = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(dummy);
try
{
TestDummyClassLoaderStructureDeployer deployer = new TestDummyClassLoaderStructureDeployer();
structuralDeployers.addDeployer(deployer);
}
finally
{
Thread.currentThread().setContextClassLoader(previous);
}
VFSDeployment deployment = createDeployment("/structure/file", "simple");
structuralDeployers.determineStructure(deployment);
assertEquals(dummy, TestDummyClassLoaderStructureDeployer.getAndResetClassLoader());
}