Search in sources :

Example 96 with ByteChunk

use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.

the class TestValidator method testTldVersions25.

@Test
public void testTldVersions25() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    File appDir = new File("test/webapp-2.5");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();
    ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/tld-versions.jsp");
    String result = res.toString();
    assertTrue(result.indexOf("<p>00-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>02-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>04-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>06-hello world</p>") > 0);
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) ByteChunk(org.apache.tomcat.util.buf.ByteChunk) File(java.io.File) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 97 with ByteChunk

use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.

the class TestValidator method testTldVersions24.

@Test
public void testTldVersions24() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    File appDir = new File("test/webapp-2.4");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();
    ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/tld-versions.jsp");
    String result = res.toString();
    assertTrue(result.indexOf("<p>00-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>02-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>04-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>06-hello world</p>") > 0);
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) ByteChunk(org.apache.tomcat.util.buf.ByteChunk) File(java.io.File) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 98 with ByteChunk

use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.

the class TestValidator method testTldVersions40.

@Test
public void testTldVersions40() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    File appDir = new File("test/webapp-4.0");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();
    ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/tld-versions.jsp");
    String result = res.toString();
    assertTrue(result.indexOf("<p>00-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>02-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>04-hello world</p>") > 0);
    assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>06-hello world</p>") > 0);
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) ByteChunk(org.apache.tomcat.util.buf.ByteChunk) File(java.io.File) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 99 with ByteChunk

use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.

the class TestValidator method testTldVersions23.

@Test
public void testTldVersions23() throws Exception {
    Tomcat tomcat = getTomcatInstance();
    File appDir = new File("test/webapp-2.3");
    // app dir is relative to server home
    tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
    tomcat.start();
    ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/tld-versions.jsp");
    String result = res.toString();
    assertTrue(result.indexOf("<p>${'00-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>${'02-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>${'04-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0);
    assertTrue(result.indexOf("<p>${'06-hello world'}</p>") > 0);
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) ByteChunk(org.apache.tomcat.util.buf.ByteChunk) File(java.io.File) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Example 100 with ByteChunk

use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.

the class TestJspContextWrapper method testELTagFileELContextListener.

@Test
public void testELTagFileELContextListener() throws Exception {
    getTomcatInstanceTestWebapp(false, true);
    ByteChunk out = new ByteChunk();
    int rc = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug58178c.jsp", out, null);
    Assert.assertEquals(HttpServletResponse.SC_OK, rc);
    String result = out.toString();
    Assert.assertTrue(result, result.contains("JSP count: 1"));
    Assert.assertTrue(result, result.contains("Tag count: 1"));
}
Also used : ByteChunk(org.apache.tomcat.util.buf.ByteChunk) TomcatBaseTest(org.apache.catalina.startup.TomcatBaseTest) Test(org.junit.Test)

Aggregations

ByteChunk (org.apache.tomcat.util.buf.ByteChunk)274 Test (org.junit.Test)201 TomcatBaseTest (org.apache.catalina.startup.TomcatBaseTest)180 Tomcat (org.apache.catalina.startup.Tomcat)129 Context (org.apache.catalina.Context)98 File (java.io.File)49 List (java.util.List)48 AsyncContext (javax.servlet.AsyncContext)40 HashMap (java.util.HashMap)35 Wrapper (org.apache.catalina.Wrapper)22 StandardContext (org.apache.catalina.core.StandardContext)21 ArrayList (java.util.ArrayList)20 TesterContext (org.apache.tomcat.unittest.TesterContext)18 SecurityConstraint (org.apache.tomcat.util.descriptor.web.SecurityConstraint)16 ServletRequestWrapper (javax.servlet.ServletRequestWrapper)13 ServletResponseWrapper (javax.servlet.ServletResponseWrapper)13 ServletContext (javax.servlet.ServletContext)10 WsContextListener (org.apache.tomcat.websocket.server.WsContextListener)10 TesterAccessLogValve (org.apache.catalina.valves.TesterAccessLogValve)9 InitialContext (javax.naming.InitialContext)8