geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r982905 - in /geronimo/server/trunk/testsuite/javaee6-testsuite: ./ interceptors1.1-test/ interceptors1.1-test/src/ interceptors1.1-test/src/main/ interceptors1.1-test/src/main/java/ interceptors1.1-test/src/main/java/org/ interceptors1.1-t...
Date Fri, 06 Aug 2010 08:31:23 GMT
Author: xiaming
Date: Fri Aug  6 08:31:22 2010
New Revision: 982905

URL: http://svn.apache.org/viewvc?rev=982905&view=rev
Log:
GERONIMO-5486 a simple interceptor test case provided by LiWenQin

Added:
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml   (with
props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
  (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/
    geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
  (with props)
Modified:
    geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml Fri Aug
 6 08:31:22 2010
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.testsuite</groupId>
+        <artifactId>javaee6-testsuite</artifactId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>interceptors1.1-test</artifactId>
+    <name>Geronimo TestSuite :: Java EE 6 Testsuite :: Interceptors 1.1</name>
+    <packaging>war</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+		<dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+            <version>1.0</version>
+        </dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-ejb_3.1_spec</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+            <groupId>org.apache.servicemix.bundles</groupId>
+            <artifactId>org.apache.servicemix.bundles.commons-httpclient</artifactId>
+			<version>3.1_4</version>
+        </dependency>
+    </dependencies>
+
+<profiles>
+    <profile>
+        <id>it</id>
+        <activation>
+            <property>
+                <name>it</name>
+            </property>
+        </activation>
+    <build>        
+        <plugins>            		
+		    <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <configuration>
+                    <suiteXmlFiles>
+                        <suiteXmlFile>
+							${project.build.testOutputDirectory}/testng.xml
+						</suiteXmlFile>
+                    </suiteXmlFiles>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.geronimo.buildsupport</groupId>
+                <artifactId>geronimo-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>deploy-wars</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>deploy-module</goal>
+                        </goals>
+                        <configuration>
+                            <moduleArchive>${project.build.directory}/${project.artifactId}-${project.version}.war</moduleArchive>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>undeploy-war-as-moduleId</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                            <goal>undeploy-module</goal>
+                        </goals>
+                        <configuration>
+                            <moduleId>${project.groupId}/${project.artifactId}/${project.version}/car</moduleId>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    </profile>
+</profiles>
+</project>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,30 @@
+/**
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.javaee6.beans;
+
+import javax.ejb.Stateful;
+import javax.interceptor.Interceptors;
+import org.apache.geronimo.testsuite.javaee6.interceptors.ValueIntcpt1;
+import org.apache.geronimo.testsuite.javaee6.interceptors.ValueIntcpt2;
+
+@Stateful
+public class ValueBean {
+
+    @Interceptors({ValueIntcpt1.class, ValueIntcpt2.class})
+    public String[] SayIsValid(double d,String [] intcptArray ) {
+        return  intcptArray;
+    }
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/beans/ValueBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,63 @@
+/**
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.javaee6.interceptors;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+import java.util.Date;
+
+public class ValueIntcpt1 {
+
+    @AroundInvoke
+    public Object checkValid1(InvocationContext ctx)throws Exception {
+        //System.out.println("Value Interceptor 1 invoked!");
+        long start = System.currentTimeMillis();
+        Object param[] = ctx.getParameters();
+        if(param[0]==null)
+           throw new Exception("!!!!input Value is null");
+        else
+        {
+           double dv = Double.valueOf(param[0].toString());
+           //System.out.println("in interceptor 1 ,value obtained is:"+dv);
+           String[] tmp=(String[])param[1];
+           if(dv>=0.0)
+           {
+               tmp[0]="Valid";
+           }
+           else
+           {
+               tmp[0]="Invalid";
+           }
+            
+            long tm=System.currentTimeMillis();
+            tmp[2]=Long.toString(tm);
+            tmp[1]=new Date(tm).toString();
+            param[1]=tmp;
+            
+            ctx.setParameters(param);
+            try{
+            Thread.sleep(1500);//1.5 seconds
+            }catch(Exception e)
+            {
+            }
+            long time = System.currentTimeMillis() - start;
+            //System.out.println("time:"+ time + "ms");
+          }
+            return ctx.proceed();
+
+
+
+    }
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt1.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,60 @@
+/**
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.javaee6.interceptors;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+import java.util.Date;
+
+public class ValueIntcpt2 {
+
+    @AroundInvoke
+    public Object checkValid2(InvocationContext ctx)throws Exception {
+        
+        long start = System.currentTimeMillis();
+        Object param[] = ctx.getParameters();
+        if(param[0]==null)
+        	throw new Exception("!!!!input Value is null");
+        else
+        {
+           double dv = Double.valueOf(param[0].toString());
+           
+           String[] tmp=(String[])param[1];
+           
+           if(dv<0.0)
+           {
+               tmp[3]="Valid";
+           }
+           else
+           {
+               tmp[3]="Invalid";
+           }
+
+            long tm=System.currentTimeMillis();
+            
+            tmp[5]=Long.toString(tm);
+            tmp[4]=new Date(tm).toString();
+            param[1]=tmp;
+            long time = System.currentTimeMillis() - start;
+            
+            //System.out.println("time:"+ time + "ms");
+            ctx.setParameters(param);
+            }
+            return ctx.proceed();
+
+
+
+    }
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/interceptors/ValueIntcpt2.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,70 @@
+/**
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.javaee6.servlets;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import javax.ejb.EJB;
+import org.apache.geronimo.testsuite.javaee6.beans.ValueBean;
+
+public class intcptServlet extends HttpServlet {
+	private static final long serialVersionUID = 1L;
+	
+	@EJB
+	private ValueBean valuebean;
+	
+	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException{
+
+		//System.out.println("start doGet");
+		double d=Double.valueOf(request.getParameter("NumberValue"));
+                String[] arr = new String[6];
+		
+		//try{
+                //  InitialContext ctx = new InitialContext();
+                //  ValueBean valuebean = (ValueBean) ctx.lookup("java:global/interceptor/ValueBean");
+                  
+		arr=valuebean.SayIsValid(d,arr);
+                //System.out.println("in servlet,arr[0]:"+arr[0]);
+                //System.out.println("in servlet,arr[1]:"+arr[1]);
+                //System.out.println("in servlet,arr[2]:"+arr[2]);
+                //System.out.println("in servlet,arr[3]:"+arr[3]);
+                //System.out.println("in servlet,arr[4]:"+arr[4]);
+                //System.out.println("in servlet,arr[5]:"+arr[5]);
+		request.setAttribute("Intcpt1IsValid",arr[0]);
+        request.setAttribute("Intcpt2IsValid",arr[3]);
+        request.setAttribute("date1",arr[1]);
+        request.setAttribute("date2",arr[4]);
+        request.setAttribute("sysmi1",arr[2]);
+        request.setAttribute("sysmi2",arr[5]);
+		getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
+               // }
+               // catch(NamingException ne){
+               // }
+	}
+
+
+	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
+		this.doGet(request, response);
+	}
+    
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/java/org/apache/geronimo/testsuite/javaee6/servlets/intcptServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1"
xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
+    <dep:environment>
+        <dep:moduleId>
+            <dep:groupId>${project.groupId}</dep:groupId>
+            <dep:artifactId>${project.artifactId}</dep:artifactId>
+            <dep:version>${project.version}</dep:version>
+            <dep:type>car</dep:type>
+        </dep:moduleId>
+    </dep:environment>
+    <context-root>/interceptor</context-root>
+</web-app>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <display-name>interceptor</display-name>
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.htm</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+        <welcome-file>default.html</welcome-file>
+        <welcome-file>default.htm</welcome-file>
+        <welcome-file>default.jsp</welcome-file>
+    </welcome-file-list>
+    <servlet>
+        <description/>
+        <display-name>intcptServlet</display-name>
+        <servlet-name>intcptServlet</servlet-name>
+        <servlet-class>org.apache.geronimo.testsuite.javaee6.servlets.intcptServlet</servlet-class>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>intcptServlet</servlet-name>
+        <url-pattern>/intcptServlet</url-pattern>
+    </servlet-mapping>
+</web-app>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,117 @@
+<%-- 
+    Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+    	               "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+  <head>
+    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    	<title>Test Interceptor</title>
+  </head>
+  <body>
+    <h2>An Interceptor Sample</h2>
+    <p>
+      <%
+          String intcpt1 = String.valueOf(request.getAttribute("Intcpt1IsValid"));
+          intcpt1 = (intcpt1.equals("null")||intcpt1.length()<=0) ? "uncheck" : intcpt1;
+          request.setAttribute("Intcpt1IsValid", null);
+          request.removeAttribute("Intcpt1IsValid");
+
+          String intcpt2 = String.valueOf(request.getAttribute("Intcpt2IsValid"));
+          intcpt2 = (intcpt2.equals("null")||intcpt1.length()<=0) ? "uncheck" : intcpt2;
+          request.setAttribute("Intcpt2IsValid", null);
+          request.removeAttribute("Intcpt2IsValid");
+
+          String date1 = String.valueOf(request.getAttribute("date1"));
+          date1 = (date1.equals("null")||date1.length()<=0) ? "uncheck" : date1;
+          request.setAttribute("date1", null);
+          request.removeAttribute("date1");
+
+          String date2 = String.valueOf(request.getAttribute("date2"));
+          date2 = (date2.equals("null")||date2.length()<=0) ? "uncheck" : date2;
+          request.setAttribute("date2", null);
+          request.removeAttribute("date2");
+
+          String sysmi1 = String.valueOf(request.getAttribute("sysmi1"));
+          sysmi1 = (sysmi1.equals("null")||sysmi1.length()<=0) ? "uncheck" : sysmi1;
+          request.setAttribute("sysmi1", null);
+          request.removeAttribute("sysmi1");
+
+          String sysmi2 = String.valueOf(request.getAttribute("sysmi2"));
+          sysmi2 = (sysmi2.equals("null")||sysmi2.length()<=0) ? "uncheck" : sysmi2;
+          request.setAttribute("sysmi2", null);
+          request.removeAttribute("sysmi2");
+      %>
+    </p>
+    <form action="intcptServlet" method="get">
+      <table border="3" cellpadding="1">
+        <tr>
+          <th>Input</th>
+          <th>Operation</th>
+        </tr>
+        <tr>
+          <td class="cell">
+            <input type="text" name="NumberValue" value="0" />
+          </td>
+          <td class="cell">
+            <input type="submit" name="operation" value="check"/>
+          </td>
+        </tr>      
+      </table>
+      <table border="3" cellpadding="1">
+          <tr>
+              <th>Interceptor 1</th>
+              <th>Time 1</th>
+              <th>SystemTimeMillis 1</th>
+          <tr/>
+          <tr>
+              <td class="cell" id="intcpt1"><%=intcpt1 %></td>
+              <td class="cell" id="time1"><%=date1%></td>
+              <td class="cell" id="sys1"><%=sysmi1%></td>
+          </tr>
+      </table>
+      <table border="3" cellpadding="1">
+          <tr>
+          <th>Interceptor 2</th>
+          <th>Time 2</th>
+          <th>SystemTimeMillis 2</th>
+          <tr/>
+          <tr>
+              <td class="cell" id="intcpt2"><%=intcpt2 %></td>
+              <td class="cell" id="time2"><%=date2%></td>
+              <td class="cell" id="sys2"><%=sysmi2%></td>
+          </tr>
+      </table>
+    </form>
+    <p>
+        <br />
+        <b>1.This example checks the input value.</b>
+        <br/>
+        &nbsp&nbsp Interceptor 1 says valid & Interceptor 2 says invalid if the
value is greater than or equal zero.
+        <br/>
+        &nbsp&nbsp Interceptor 1 says invalid & Interceptor 2 says valid if the
value is less than zero.
+        <br/>
+        <b>2.This example also present the invoking sequence of the interceptors.</b>
+        <br/>
+        &nbsp&nbsp It should firstly invoke Interceptor 1 and Interceptor 2 happens
afterwards.
+        <br/>
+         &nbsp&nbsp You can check the invoking sequence through Time and SystemTimeMillis.
+    </p>
+  </body>
+</html> 

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/main/webapp/index.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,69 @@
+/**
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.javaee6.intcptests;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+import org.testng.Assert;
+import org.testng.annotations.*;
+import static org.testng.Assert.*;
+import java.util.regex.Pattern;
+
+
+public class InterceptorTest extends SeleniumTestSupport 
+{
+	/**
+	 * Test 1
+	 */
+	@Test 
+	public void testInterceptorA() throws Exception 
+	{
+		selenium.open("/interceptor/");
+		selenium.type("NumberValue", "1.1");
+		selenium.click("operation");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals("Valid", selenium.getText("//*[@id=\"intcpt1\"]"));
+		Assert.assertEquals("Invalid", selenium.getText("//*[@id=\"intcpt2\"]"));
+		String sysmi1=selenium.getText("//*[@id=\"sys1\"]");
+		long s1 = Long.valueOf(sysmi1);
+		String sysmi2=selenium.getText("//*[@id=\"sys2\"]");
+		long s2 = Long.valueOf(sysmi2);
+		boolean real = (s2-s1>0)?true:false;
+		Assert.assertEquals(true, real);
+		
+	}
+	
+	
+	/**
+	 * Test 2
+	 */
+	@Test 
+	public void testInterceptorB() throws Exception 
+	{
+		selenium.open("/interceptor/");
+		selenium.type("NumberValue", "-0.9");
+		selenium.click("operation");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals("Invalid", selenium.getText("//*[@id=\"intcpt1\"]"));
+		Assert.assertEquals("Valid", selenium.getText("//*[@id=\"intcpt2\"]"));
+		String sysmi1=selenium.getText("//*[@id=\"sys1\"]");
+		long s1 = Long.valueOf(sysmi1);
+		String sysmi2=selenium.getText("//*[@id=\"sys2\"]");
+		long s2 = Long.valueOf(sysmi2);
+		boolean real = (s2-s1>0)?true:false;
+		Assert.assertEquals(true, real);
+		
+	}
+}
+

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/java/org/apache/geronimo/testsuite/javaee6/intcptests/InterceptorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml?rev=982905&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
Fri Aug  6 08:31:22 2010
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+
+<suite name="Suite1" verbose="5">
+    <test name="javaee6-testsuite.interceptors1.1-test">
+        <packages>
+            <package name="org.apache.geronimo.testsuite.javaee6.intcptests"/>
+        </packages>
+    </test>
+</suite>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/interceptors1.1-test/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml?rev=982905&r1=982904&r2=982905&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml Fri Aug  6 08:31:22 2010
@@ -61,6 +61,7 @@
         <module>jsp2.2-test</module>
         <module>managedbean1.0-test</module>
         <module>di1.0-test</module>
+        <module>interceptors1.1-test</module>
 -->
         <module>commonannotation1.1-test</module>
     </modules>



Mime
View raw message