geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viol...@apache.org
Subject svn commit: r1080492 - in /geronimo/server/trunk/testsuite/javaee6-testsuite: ./ jndi-infer-test/ jndi-infer-test/src/ jndi-infer-test/src/main/ jndi-infer-test/src/main/java/ jndi-infer-test/src/main/java/org/ jndi-infer-test/src/main/java/org/apache/...
Date Fri, 11 Mar 2011 09:04:41 GMT
Author: violalu
Date: Fri Mar 11 09:04:40 2011
New Revision: 1080492

URL: http://svn.apache.org/viewvc?rev=1080492&view=rev
Log:
GERONIMO-5346 Add a test case for inferring jndi type from injection

Added:
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/pom.xml
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/web/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/web/HelloWorld.java
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/WEB-INF/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/WEB-INF/web.xml
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/test/JndiInferTest.java
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/resources/
    geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/resources/testng.xml
Modified:
    geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/pom.xml?rev=1080492&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/pom.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/pom.xml Fri Mar 11 09:04:40
2011
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>javaee6-testsuite</artifactId>
+    <groupId>org.apache.geronimo.testsuite</groupId>
+    <version>3.0-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>jndi-infer-test</artifactId>
+  
+  <name>Geronimo TestSuite :: Java EE 6 Testsuite :: JNDI Infer Test</name> 
+  <packaging>war</packaging>
+  
+  <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>          
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>  
+  
+    
+    <profiles>
+        <profile>
+            <id>it</id>
+            <activation>
+                <property>
+                    <name>it</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>selenium-maven-plugin</artifactId>
+                    </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}/war</moduleId>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>
+                            <suiteXmlFiles>
+                                <suiteXmlFile>${project.build.testOutputDirectory}/testng.xml</suiteXmlFile>
+                            </suiteXmlFiles>
+                            <systemPropertyVariables>
+                                <appContext>${project.artifactId}</appContext>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/web/HelloWorld.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/web/HelloWorld.java?rev=1080492&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/web/HelloWorld.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/java/org/apache/geronimo/testsuite/javaee6/helloworld/web/HelloWorld.java
Fri Mar 11 09:04:40 2011
@@ -0,0 +1,37 @@
+package org.apache.geronimo.testsuite.javaee6.helloworld.web;
+
+import java.io.*;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletException;
+
+import javax.servlet.http.*;
+
+import javax.servlet.annotation.WebServlet;
+
+@WebServlet("/hello")
+public class HelloWorld extends HttpServlet {
+    private static final long serialVersionUID = 1L;
+    @Resource(name="welcomeMessage")
+    private  String welcomeMessage;
+
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
+        performTask(request, response);
+    }
+    
+    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
+        performTask(request, response);
+    }
+    
+    protected void  performTask(HttpServletRequest request, HttpServletResponse response){
+        PrintWriter out;
+        try {
+            out = response.getWriter();
+            out.println(welcomeMessage);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+       
+    }
+}

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/WEB-INF/web.xml?rev=1080492&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/WEB-INF/web.xml
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/main/webapp/WEB-INF/web.xml
Fri Mar 11 09:04:40 2011
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+version="3.0">
+
+<env-entry>
+    <env-entry-name>welcomeMessage</env-entry-name>
+    <!--<env-entry-type>java.lang.String</env-entry-type>-->
+    <env-entry-value>Hello World from env-entry!</env-entry-value>
+</env-entry>
+
+</web-app>
\ No newline at end of file

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/test/JndiInferTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/test/JndiInferTest.java?rev=1080492&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/test/JndiInferTest.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/java/org/apache/geronimo/testsuite/javaee6/jndiinfer/test/JndiInferTest.java
Fri Mar 11 09:04:40 2011
@@ -0,0 +1,67 @@
+/**
+ *  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.
+ */
+package org.apache.geronimo.testsuite.javaee6.jndiinfer.test;
+
+import org.apache.geronimo.testsupport.TestSupport;
+import org.testng.annotations.Test;
+import org.apache.geronimo.testsupport.HttpUtils;
+
+import java.net.URL;
+import java.io.IOException;
+/**
+ * Unit test for simple App.
+ */
+public class JndiInferTest extends TestSupport{
+    private String baseURL = "http://localhost:8080/";
+
+    @Test
+    public void testServlet() throws Exception {
+        checkReply("/hello");
+    }
+
+
+    private void checkReply(String address)
+        throws Exception {
+        String warName = System.getProperty("webAppName");
+        assertNotNull(warName);
+        URL url = new URL(baseURL + warName + address);
+       
+        String reply = doGET(url, 6, 10 * 1000);
+        assertTrue("JNDI Type Infer", 
+                   reply.contains("Hello World from env-entry!"));
+        
+        
+        
+    }
+  
+    private String doGET(URL url, int repeat, long delay) {
+        for (int i = 0; i < repeat; i++) {
+            try {
+                return HttpUtils.doGET(url); 
+            } catch (IOException e) {
+                // ignore
+                try {
+                    Thread.sleep(delay);
+                } catch (Exception ee) {
+                    break;
+                }
+            }
+        }
+        fail("Did not get servlet response in time");
+        return "";
+    }   
+}

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/resources/testng.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/resources/testng.xml?rev=1080492&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/resources/testng.xml
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/jndi-infer-test/src/test/resources/testng.xml
Fri Mar 11 09:04:40 2011
@@ -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: 1024189 $ $Date: 2010-10-19 17:33:47 +0800 (Tue, 19 Oct 2010) $ -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+
+<suite name="Suite1" verbose="5">
+    <test name="javaee6-testsuite.jndiInfer">
+        <packages>
+            <package name="org.apache.geronimo.javaee6.jndiinfer.test"/>
+        </packages>
+    </test>
+</suite>

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml?rev=1080492&r1=1080491&r2=1080492&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml Fri Mar 11 09:04:40 2011
@@ -16,11 +16,7 @@
     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">
+--><!-- $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>
 
@@ -68,7 +64,8 @@
         <module>ejb3.1-test</module>
         <module>jpa2.0-test</module>
         <!--<module>restful-test</module>-->
-    </modules>
+    <module>jndi-infer-test</module>
+  </modules>
         
     <profiles>
         <profile>
@@ -82,8 +79,9 @@
                 <module>servlet3.0-security-test</module>
                 <module>webbean1.0-test</module>
                 <module>restful-test</module>
+                <module>jndi-infer-test</module>
             </modules>
         </profile>
     </profiles>
 
-</project>
+</project>
\ No newline at end of file



Mime
View raw message