Java Code Examples for org.apache.catalina.core.StandardContext#resourcesStart()
The following examples show how to use
org.apache.catalina.core.StandardContext#resourcesStart() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestVirtualWebappLoader.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Test public void testStartInternal() throws Exception { Tomcat tomcat = getTomcatInstance(); File appDir = new File("test/webapp"); StandardContext ctx = (StandardContext) tomcat.addContext("", appDir.getAbsolutePath()); WebappLoader loader = new WebappLoader(); loader.setContext(ctx); ctx.setLoader(loader); ctx.setResources(new StandardRoot(ctx)); ctx.resourcesStart(); File f1 = new File("test/webapp-fragments/WEB-INF/lib"); ctx.getResources().createWebResourceSet( WebResourceRoot.ResourceSetType.POST, "/WEB-INF/lib", f1.getAbsolutePath(), null, "/"); loader.start(); String[] repos = loader.getLoaderRepositories(); Assert.assertEquals(4,repos.length); loader.stop(); repos = loader.getLoaderRepositories(); Assert.assertEquals(0, repos.length); // no leak loader.start(); repos = loader.getLoaderRepositories(); Assert.assertEquals(4,repos.length); // clear loader ctx.setLoader(null); // see tearDown()! tomcat.start(); }
Example 2
Source File: TestVirtualWebappLoader.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Test public void testStartInternal() throws Exception { Tomcat tomcat = getTomcatInstance(); File appDir = new File("test/webapp-3.0"); // Must have a real docBase - just use temp StandardContext ctx = (StandardContext)tomcat.addContext("", appDir.getAbsolutePath()); VirtualWebappLoader loader = new VirtualWebappLoader(); loader.setContainer(ctx); ctx.setLoader(loader); ctx.setResources(new FileDirContext()); ctx.resourcesStart(); File dir = new File("test/webapp-3.0-fragments/WEB-INF/lib"); loader.setVirtualClasspath(dir.getAbsolutePath() + "/*.jar"); loader.start(); String[] repos = loader.getRepositories(); assertEquals(2,repos.length); loader.stop(); // ToDo: Why doesn't remove repositories? repos = loader.getRepositories(); assertEquals(2, repos.length); // no leak loader.start(); repos = loader.getRepositories(); assertEquals(2,repos.length); // clear loader ctx.setLoader(null); // see tearDown()! tomcat.start(); }
Example 3
Source File: TestVirtualWebappLoader.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Test public void testStartInternal() throws Exception { Tomcat tomcat = getTomcatInstance(); File appDir = new File("test/webapp-3.0"); // Must have a real docBase - just use temp StandardContext ctx = (StandardContext)tomcat.addContext("", appDir.getAbsolutePath()); VirtualWebappLoader loader = new VirtualWebappLoader(); loader.setContainer(ctx); ctx.setLoader(loader); ctx.setResources(new FileDirContext()); ctx.resourcesStart(); File dir = new File("test/webapp-3.0-fragments/WEB-INF/lib"); loader.setVirtualClasspath(dir.getAbsolutePath() + "/*.jar"); loader.start(); String[] repos = loader.getRepositories(); assertEquals(2,repos.length); loader.stop(); // ToDo: Why doesn't remove repositories? repos = loader.getRepositories(); assertEquals(2, repos.length); // no leak loader.start(); repos = loader.getRepositories(); assertEquals(2,repos.length); // clear loader ctx.setLoader(null); // see tearDown()! tomcat.start(); }