1 17 package org.apache.geronimo.tomcat; 18 19 import java.io.BufferedReader ; 20 import java.io.File ; 21 import java.io.InputStreamReader ; 22 import java.net.HttpURLConnection ; 23 import java.net.URL ; 24 25 26 29 public class ApplicationTest extends AbstractWebModuleTest { 30 private File basedir = new File (System.getProperty("basedir")); 31 32 public void testApplication() throws Exception { 33 setUpInsecureAppContext(new File (basedir, "target/var/catalina/webapps/war1/").toURI(), 34 new File (basedir, "target/var/catalina/webapps/war1/WEB-INF/web.xml").toURL(), 35 null, 36 null, 37 null); 38 39 HttpURLConnection connection = (HttpURLConnection ) new URL ("http://localhost:8181/test/hello.txt").openConnection(); 40 BufferedReader reader = new BufferedReader (new InputStreamReader (connection.getInputStream())); 41 assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode()); 42 assertEquals("Hello World", reader.readLine()); 43 connection.disconnect(); 44 } 45 46 protected void setUp() throws Exception { 47 super.setUp(); 48 super.init(null); 49 } 50 } 51 | Popular Tags |