valveWithParams/0000755000076500007650000000000011142135044014154 5ustar rittmeyrittmeyvalveWithParams/lib/0000755000076500007650000000000011142133362014723 5ustar rittmeyrittmeyvalveWithParams/lib/valve2.jar0000644000076500007650000000423111142134151016615 0ustar rittmeyrittmeyPK MC: META-INF/PK LC:^3GMETA-INF/MANIFEST.MFManifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 11.0-b16 (Sun Microsystems Inc.) X-COMMENT: Main-Class will be added automatically by build PK LC:valves/PK LC:=33valves/TestValve2.class1U + ,- ./ 0 1234 567 89:;< = >?@A testPropertyLjava/lang/String;()VCodeLineNumberTableLocalVariableTablethisLvalves/TestValve2;getInfo()Ljava/lang/String;invokeR(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)Vrequest'Lorg/apache/catalina/connector/Request;response(Lorg/apache/catalina/connector/Response; ExceptionsBCsetTestProperty(Ljava/lang/String;)Vval SourceFileTestValve2.java D EFG H I JKvalve6 null_valueL MNO PQvalve5 empty_valuevalve4 RST valves/TestValve2$org/apache/catalina/valves/ValveBasejava/io/IOExceptionjavax/servlet/ServletExceptionjava/lang/ObjectgetClass()Ljava/lang/Class;java/lang/ClassgetName%org/apache/catalina/connector/Request getRequest)()Ljavax/servlet/http/HttpServletRequest;%javax/servlet/http/HttpServletRequest setAttribute'(Ljava/lang/String;Ljava/lang/Object;)Vjava/lang/Stringequals(Ljava/lang/Object;)ZgetNext()Lorg/apache/catalina/Valve;org/apache/catalina/Valve!/*  2* N*+. * +  + **+,#3BM NN N!"#$%&'>*+ "#()*PK MC: AMETA-INF/PK LC:^3G+META-INF/MANIFEST.MFPK LC:Avalves/PK LC:=33$valves/TestValve2.classPKvalveWithParams/lib/valve1.jar0000644000076500007650000000642311142130424016620 0ustar rittmeyrittmeyPK FC: META-INF/PK EC:^3GMETA-INF/MANIFEST.MFManifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 11.0-b16 (Sun Microsystems Inc.) X-COMMENT: Main-Class will be added automatically by build PK EC:valves/PK EC: T66valves/TestValve1.class1O , - . /0 1234 567 89:;<=>? testPropertyLjava/lang/String;()VCodeLineNumberTableLocalVariableTablethisLvalves/TestValve1;getInfo()Ljava/lang/String;invoke>(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)IreqLorg/apache/catalina/Request;respLorg/apache/catalina/Response; Exceptions@A postInvoke>(Lorg/apache/catalina/Request;Lorg/apache/catalina/Response;)VsetTestProperty(Ljava/lang/String;)Vval SourceFileTestValve1.java   BCD EF GHvalve3 null_valueI JKL MNvalve2 empty_valuevalve1valves/TestValve1java/lang/Object&org/glassfish/web/valve/GlassFishValvejava/io/IOExceptionjavax/servlet/ServletExceptiongetClass()Ljava/lang/Class;java/lang/ClassgetNameorg/apache/catalina/Request getRequest ()Ljavax/servlet/ServletRequest;javax/servlet/ServletRequest setAttribute'(Ljava/lang/String;Ljava/lang/Object;)Vjava/lang/Stringequals(Ljava/lang/Object;)Z!8 **     2* J*+2 * +  + *%7H JJJ !"#$%&?  !"#$'(>*+ "#)*+PK EC:HGvalves/TestValve1.javapackage valves; import java.io.IOException; import javax.servlet.ServletException; import org.apache.catalina.Request; import org.apache.catalina.Response; import org.glassfish.web.valve.GlassFishValve; public class TestValve1 implements GlassFishValve { private String testProperty = null; public String getInfo() { return getClass().getName(); } public int invoke(Request req, Response resp) throws IOException, ServletException { if (testProperty == null) { req.getRequest().setAttribute("valve3", "null_value"); } else if ("".equals(testProperty)) { req.getRequest().setAttribute("valve2", "empty_value"); } else { req.getRequest().setAttribute("valve1", testProperty); } return GlassFishValve.INVOKE_NEXT; } public void postInvoke(Request req, Response resp) throws IOException, ServletException { } public void setTestProperty(String val) { testProperty = val; } } PK FC: AMETA-INF/PK EC:^3G+META-INF/MANIFEST.MFPK EC:Avalves/PK EC: T66$valves/TestValve1.classPK EC:HGvalves/TestValve1.javaPK; valveWithParams/build.xml0000644000076500007650000000377011141406052016003 0ustar rittmeyrittmey ]> &commonSetup; &commonBuild; &testproperties; valveWithParams/docroot/0000755000076500007650000000000011141406074015630 5ustar rittmeyrittmeyvalveWithParams/WebTest.class0000644000076500007650000000440111142134364016563 0ustar rittmeyrittmey2 2M N O P QR /ST U VW XY /Z /[ /\]^ M_ `ab c d efg c hi jk l m eno p qrs 't &u &vw xy /z{|} /d~ TEST_NAMELjava/lang/String; ConstantValueEXPECTED_RESPONSEstat1Lcom/sun/ejte/ccl/reporter/SimpleReporterAdapter;hostport contextRoot([Ljava/lang/String;)VCodemain StackMapTableTWdoTest()V]kr Exceptions <E 94 :4 ;4 78)Unit test for valves that take properties WebTest <= DEjava/lang/Exception Evalve-with-params 4 E java/net/URLjava/lang/StringBuilderhttp:// :/test < Connecting to:  java/net/HttpURLConnection E Unexpected return code: java/io/BufferedReaderjava/io/InputStreamReader < < true 4*Wrong response. Expected: true, received: /com/sun/ejte/ccl/reporter/SimpleReporterAdapter appserv-testsjava/lang/Object[Ljava/lang/String;java/io/InputStreamjava/lang/StringaddDescription(Ljava/lang/String;)VprintStackTraceFAIL addStatus'(Ljava/lang/String;Ljava/lang/String;)V printSummaryappend-(Ljava/lang/String;)Ljava/lang/StringBuilder;toString()Ljava/lang/String;java/lang/SystemoutLjava/io/PrintStream;java/io/PrintStreamprintlnopenConnection()Ljava/net/URLConnection;connectgetResponseCode()Ierr(I)Ljava/lang/StringBuilder;getInputStream()Ljava/io/InputStream;(Ljava/io/InputStream;)V(Ljava/io/Reader;)VreadLineequals(Ljava/lang/Object;)ZPASS!2345 645+ 7894:4;4<=>&**+2*+2*+2 ?=>`3Y* L+ M,  W @ABCDE>'YY***LY++M, ,!>ȟ."Y#$ Wg,%:&Y'Y():*:+, W-,"Y. W@FG:HIJ(K LE> /Y01valveWithParams/descriptor/0000755000076500007650000000000011145372143016340 5ustar rittmeyrittmeyvalveWithParams/descriptor/web.xml0000644000076500007650000000100711141406052017626 0ustar rittmeyrittmey TestServlet TestServlet TestServlet /test valveWithParams/descriptor/sun-web.xml0000644000076500007650000000165511145120117020441 0ustar rittmeyrittmey valveWithParams/servlet/0000755000076500007650000000000011145372143015646 5ustar rittmeyrittmeyvalveWithParams/servlet/TestServlet.java0000644000076500007650000000145611145105572021003 0ustar rittmeyrittmeyimport java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TestServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { if (!"testValue".equals(req.getAttribute("valve1")) || !"empty_value".equals(req.getAttribute("valve2")) || !"null_value".equals(req.getAttribute("valve3")) || !"testValue".equals(req.getAttribute("valve4")) || !"empty_value".equals(req.getAttribute("valve5")) || !"null_value".equals(req.getAttribute("valve6"))) { throw new ServletException("request attributes do not equal expected values"); } else { res.getWriter().print(true); } } } valveWithParams/WebTest.java0000644000076500007650000000504111141635553016405 0ustar rittmeyrittmeyimport java.io.*; import java.net.*; import com.sun.ejte.ccl.reporter.*; /* * Unit test for testing support for valves that take properties. * * This test deploys a webapp that specifies 3 valves in its sun-web.xml: * 2 Tomcat-style valves, and 1 GlassFish-style valve. The GlassFish-style * valve is added in between the two Tomcat-style valves, causing it to be * wrapped (by the container) inside a TomcatValveAdapter. * * Each of the valves adds an attribute to the request. * * When the test accesses the webapp's servlet, it checks for the presence * of these attributes in the request, and will cause the test to fail if * any of them are missing. */ public class WebTest { private static final String TEST_NAME = "valve-with-params"; private static final String EXPECTED_RESPONSE = "true"; private static SimpleReporterAdapter stat = new SimpleReporterAdapter("appserv-tests"); private String host; private String port; private String contextRoot; public WebTest(String[] args) { host = args[0]; port = args[1]; contextRoot = args[2]; } public static void main(String[] args) { stat.addDescription("Unit test for valves that take properties"); WebTest webTest = new WebTest(args); try { webTest.doTest(); } catch (Exception ex) { ex.printStackTrace(); stat.addStatus(TEST_NAME, stat.FAIL); } stat.printSummary(); } public void doTest() throws Exception { URL url = new URL("http://" + host + ":" + port + contextRoot + "/test"); System.out.println("Connecting to: " + url.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); int responseCode = conn.getResponseCode(); if (responseCode != 200) { System.err.println("Unexpected return code: " + responseCode); stat.addStatus(TEST_NAME, stat.FAIL); } else { InputStream is = conn.getInputStream(); BufferedReader input = new BufferedReader(new InputStreamReader(is)); String line = input.readLine(); if (EXPECTED_RESPONSE.equals(line)) { stat.addStatus(TEST_NAME, stat.PASS); } else { System.err.println("Wrong response. Expected: " + EXPECTED_RESPONSE + ", received: " + line); stat.addStatus(TEST_NAME, stat.FAIL); } } } } valveWithParams/RepRunConf.txt0000644000076500007650000000002611145120134016731 0ustar rittmeyrittmeyTest has been reportedvalveWithParams/build.properties0000644000076500007650000000052111141635603017374 0ustar rittmeyrittmey