01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tctest.server.appserver.unit;
06:
07: import com.meterware.httpunit.WebConversation;
08: import com.meterware.httpunit.WebResponse;
09: import com.tc.test.server.appserver.deployment.AbstractOneServerDeploymentTest;
10: import com.tc.test.server.appserver.deployment.DeploymentBuilder;
11: import com.tc.test.server.util.TcConfigBuilder;
12: import com.tctest.webapp.servlets.SessionObjectIdentityTestServlet;
13:
14: import junit.framework.Test;
15:
16: public class SessionObjectIdentityTest extends
17: AbstractOneServerDeploymentTest {
18: private static final String CONTEXT = "SessionObjectIdentityTest";
19: private static final String SERVLET = "SessionObjectIdentityTestServlet";
20:
21: public static Test suite() {
22: return new SessionObjectIdentityTestSetup();
23: }
24:
25: public final void testSessions() throws Exception {
26: WebConversation wc = new WebConversation();
27: String url = "/" + CONTEXT + "/" + SERVLET;
28: WebResponse response = server0.ping(url, wc);
29: assertEquals("OK", response.getText().trim());
30: response = server0.ping(url, wc);
31: assertEquals("OK", response.getText().trim());
32: }
33:
34: private static class SessionObjectIdentityTestSetup extends
35: OneServerTestSetup {
36: public SessionObjectIdentityTestSetup() {
37: super (SessionObjectIdentityTest.class, CONTEXT);
38: }
39:
40: protected void configureWar(DeploymentBuilder builder) {
41: builder
42: .addServlet(SERVLET, "/" + SERVLET + "/*",
43: SessionObjectIdentityTestServlet.class,
44: null, false);
45: }
46:
47: protected void configureTcConfig(TcConfigBuilder clientConfig) {
48: clientConfig.addWebApplication(CONTEXT);
49: }
50: }
51: }
|