01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.tomcat;
17:
18: import java.io.BufferedReader;
19: import java.io.File;
20: import java.io.InputStreamReader;
21: import java.net.HttpURLConnection;
22: import java.net.URL;
23:
24: /**
25: * @version $Rev: 598023 $ $Date: 2007-11-25 10:08:16 -0800 (Sun, 25 Nov 2007) $
26: */
27: public class ApplicationTest extends AbstractWebModuleTest {
28: private File basedir = new File(System.getProperty("basedir"));
29:
30: public void testApplication() throws Exception {
31: setUpInsecureAppContext(
32: new File(basedir,
33: "src/test/resources/deployables/war1/").toURI(),
34: new File(basedir,
35: "src/test/resources/deployables/war1/WEB-INF/web.xml")
36: .toURL(), null, null, null, null);
37:
38: HttpURLConnection connection = (HttpURLConnection) new URL(
39: connector.getConnectUrl() + "/test/hello.txt")
40: .openConnection();
41: BufferedReader reader = new BufferedReader(
42: new InputStreamReader(connection.getInputStream()));
43: assertEquals(HttpURLConnection.HTTP_OK, connection
44: .getResponseCode());
45: assertEquals("Hello World", reader.readLine());
46: connection.disconnect();
47: }
48:
49: protected void setUp() throws Exception {
50: super.setUp();
51: super.init(null);
52: }
53: }
|