fix tests
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
parent
7a28563bcc
commit
dd72e844a3
|
@ -18,6 +18,7 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.resource.FileSystemPool;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
@ -152,17 +153,26 @@ public class MetaInfConfigurationTest
|
|||
{
|
||||
MetaInfConfiguration config = new MetaInfConfiguration();
|
||||
WebAppContext context = new WebAppContext();
|
||||
context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*servlet-api-[^/]*\\.jar$|.*/foo-bar-janb.jar");
|
||||
WebAppClassLoader loader = new WebAppClassLoader(context);
|
||||
context.setClassLoader(loader);
|
||||
config.findAndFilterContainerPaths(context);
|
||||
List<Resource> containerResources = context.getMetaData().getContainerResources();
|
||||
|
||||
assertEquals(2, containerResources.size());
|
||||
for (Resource r : containerResources)
|
||||
context.setServer(new Server());
|
||||
config.preConfigure(context);
|
||||
try
|
||||
{
|
||||
String s = r.toString();
|
||||
assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("servlet-api"));
|
||||
context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*servlet-api-[^/]*\\.jar$|.*/foo-bar-janb.jar");
|
||||
WebAppClassLoader loader = new WebAppClassLoader(context);
|
||||
context.setClassLoader(loader);
|
||||
config.findAndFilterContainerPaths(context);
|
||||
List<Resource> containerResources = context.getMetaData().getContainerResources();
|
||||
|
||||
assertEquals(2, containerResources.size());
|
||||
for (Resource r : containerResources)
|
||||
{
|
||||
String s = r.toString();
|
||||
assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("servlet-api"));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
config.postConfigure(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class TestMetaData
|
|||
nonFragFile = new File(jarDir, "sigma.jar");
|
||||
nonFragResource = resourceFactory.newResource(nonFragFile.toPath());
|
||||
assertTrue(nonFragFile.exists());
|
||||
webfragxml = resourceFactory.newResource(fragFile.toPath()).resolve("/META-INF/web-fragment.xml");
|
||||
webfragxml = resourceFactory.newJarFileResource(fragFile.toPath().toUri()).resolve("/META-INF/web-fragment.xml");
|
||||
containerDir = resourceFactory.newResource(MavenTestingUtils.getTargetTestingDir("container").toPath());
|
||||
webInfClassesDir = resourceFactory.newResource(MavenTestingUtils.getTargetTestingDir("webinfclasses").toPath());
|
||||
wac = new WebAppContext();
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.resource.FileSystemPool;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
|
@ -152,16 +153,25 @@ public class MetaInfConfigurationTest
|
|||
{
|
||||
MetaInfConfiguration config = new MetaInfConfiguration();
|
||||
WebAppContext context = new WebAppContext();
|
||||
context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*servlet-api-[^/]*\\.jar$|.*/foo-bar-janb.jar");
|
||||
WebAppClassLoader loader = new WebAppClassLoader(context);
|
||||
context.setClassLoader(loader);
|
||||
config.findAndFilterContainerPaths(context);
|
||||
List<Resource> containerResources = context.getMetaData().getContainerResources();
|
||||
assertEquals(2, containerResources.size());
|
||||
for (Resource r : containerResources)
|
||||
context.setServer(new Server());
|
||||
config.preConfigure(context);
|
||||
try
|
||||
{
|
||||
String s = r.toString();
|
||||
assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("servlet-api"));
|
||||
context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*servlet-api-[^/]*\\.jar$|.*/foo-bar-janb.jar");
|
||||
WebAppClassLoader loader = new WebAppClassLoader(context);
|
||||
context.setClassLoader(loader);
|
||||
config.findAndFilterContainerPaths(context);
|
||||
List<Resource> containerResources = context.getMetaData().getContainerResources();
|
||||
assertEquals(2, containerResources.size());
|
||||
for (Resource r : containerResources)
|
||||
{
|
||||
String s = r.toString();
|
||||
assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("servlet-api"));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
config.postConfigure(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class TestMetaData
|
|||
nonFragFile = new File(jarDir, "sigma.jar");
|
||||
nonFragResource = resourceFactory.newResource(nonFragFile.toPath());
|
||||
assertTrue(nonFragFile.exists());
|
||||
webfragxml = resourceFactory.newResource(fragFile.toPath()).resolve("/META-INF/web-fragment.xml");
|
||||
webfragxml = resourceFactory.newJarFileResource(fragFile.toPath().toUri()).resolve("/META-INF/web-fragment.xml");
|
||||
containerDir = resourceFactory.newResource(MavenTestingUtils.getTargetTestingDir("container").toPath());
|
||||
webInfClassesDir = resourceFactory.newResource(MavenTestingUtils.getTargetTestingDir("webinfclasses").toPath());
|
||||
wac = new WebAppContext();
|
||||
|
|
Loading…
Reference in New Issue