You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by mn...@apache.org on 2010/12/14 18:02:48 UTC

svn commit: r1049162 - in /incubator/aries/trunk/jndi/jndi-url-itest-web: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/aries/ src/main/java/org/apache/aries/jndiurl/ src/main/java/org/apache/ari...

Author: mnuttall
Date: Tue Dec 14 17:02:47 2010
New Revision: 1049162

URL: http://svn.apache.org/viewvc?rev=1049162&view=rev
Log:
ARIES-512: Add web itest

Added:
    incubator/aries/trunk/jndi/jndi-url-itest-web/pom.xml
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/JndiUrlItestServlet.java
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/ConfigBean.java
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/SimpleBean.java
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/blueprint/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/WEB-INF/
    incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/WEB-INF/web.xml
Modified:
    incubator/aries/trunk/jndi/jndi-url-itest-web/   (props changed)

Propchange: incubator/aries/trunk/jndi/jndi-url-itest-web/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Dec 14 17:02:47 2010
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: incubator/aries/trunk/jndi/jndi-url-itest-web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest-web/pom.xml?rev=1049162&view=auto
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest-web/pom.xml (added)
+++ incubator/aries/trunk/jndi/jndi-url-itest-web/pom.xml Tue Dec 14 17:02:47 2010
@@ -0,0 +1,64 @@
+<?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.
+-->
+<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.aries.jndi</groupId>
+        <artifactId>jndi</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+    </parent>
+   
+    <groupId>org.apache.aries.jndi</groupId>
+    <artifactId>org.apache.aries.jndi.url.itest.web</artifactId>
+    <name>Test Bundle for Aries jndi-url iTests</name>
+    <packaging>bundle</packaging>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_2.5_spec</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+              <groupId>org.apache.felix</groupId>
+              <artifactId>maven-bundle-plugin</artifactId>
+              <configuration>
+                <instructions>
+                  <Web-ContextPath>/jndiUrlItest</Web-ContextPath>
+                  <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                  <Private-Package>
+                    org.apache.aries.jndiurl.itest,
+                    org.apache.aries.jndiurl.itest.beans
+                  </Private-Package>
+                  <Import-Package>
+                    javax.servlet*;version=2.5,
+                    *
+                  </Import-Package>
+                </instructions>
+              </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/JndiUrlItestServlet.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/JndiUrlItestServlet.java?rev=1049162&view=auto
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/JndiUrlItestServlet.java (added)
+++ incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/JndiUrlItestServlet.java Tue Dec 14 17:02:47 2010
@@ -0,0 +1,60 @@
+/*
+ * 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 WARRANTIESOR 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.aries.jndiurl.itest;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.aries.jndiurl.itest.beans.ConfigBean;
+
+public class JndiUrlItestServlet extends HttpServlet{
+
+  private static final long serialVersionUID = -4610850218411296469L;
+
+  @Override
+  public void doGet (HttpServletRequest req, HttpServletResponse resp) throws IOException 
+  { 
+    StringBuilder result = new StringBuilder();
+    try { 
+      InitialContext ctx = new InitialContext();
+      ConfigBean cb = (ConfigBean) ctx.lookup("blueprint:comp/config");
+      result.append(cb.getSimple().getOwner());
+      result.append(".");
+      result.append(cb.getVersion());  // Expected output is now "Mark.2.0"
+      
+      // Now lookup and use a service published from another bundle
+      @SuppressWarnings("unchecked")
+      List<String> listService = (List<String>) ctx.lookup("blueprint:comp/listRef");
+      result.append(".");
+      String thirdListEntry = listService.get(2);
+      result.append(thirdListEntry);
+    } catch (NamingException nx) { 
+      throw new IOException (nx);
+    }
+    resp.getWriter().print(result.toString());
+    resp.getWriter().close();
+  }
+}

Added: incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/ConfigBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/ConfigBean.java?rev=1049162&view=auto
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/ConfigBean.java (added)
+++ incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/ConfigBean.java Tue Dec 14 17:02:47 2010
@@ -0,0 +1,42 @@
+/*
+ * 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 WARRANTIESOR 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.aries.jndiurl.itest.beans;
+
+public class ConfigBean {
+  
+  SimpleBean _simple;
+  String _version;
+  
+  public SimpleBean getSimple() { 
+    return _simple;
+  }
+  
+  public void setSimple (SimpleBean s) { 
+    _simple = s;
+  }
+  
+  public String getVersion() { 
+    return _version;
+  }
+  
+  public void setVersion(String v) { 
+    _version = v;
+  }
+}

Added: incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/SimpleBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/SimpleBean.java?rev=1049162&view=auto
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/SimpleBean.java (added)
+++ incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/java/org/apache/aries/jndiurl/itest/beans/SimpleBean.java Tue Dec 14 17:02:47 2010
@@ -0,0 +1,33 @@
+/*
+ * 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 WARRANTIESOR 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.aries.jndiurl.itest.beans;
+
+public class SimpleBean {
+
+  private String _owner;
+  
+  public void setOwner (String s) {
+    _owner = s;
+  }
+  
+  public String getOwner() { 
+    return _owner;
+  }
+}

Added: incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1049162&view=auto
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/blueprint/blueprint.xml (added)
+++ incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/OSGI-INF/blueprint/blueprint.xml Tue Dec 14 17:02:47 2010
@@ -0,0 +1,32 @@
+<?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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <bean id="simpleBean" class="org.apache.aries.jndiurl.itest.beans.SimpleBean">
+    <property name="owner" value="Mark"/>
+  </bean>
+  
+  <bean id="config" class="org.apache.aries.jndiurl.itest.beans.ConfigBean">
+    <property name="simple" ref="simpleBean"/>
+    <property name="version" value="2.0"/>
+  </bean>
+  
+  <reference id="listRef" interface="java.util.List" filter="(itestKey=itestList)"/>
+
+</blueprint>

Added: incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/WEB-INF/web.xml?rev=1049162&view=auto
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/WEB-INF/web.xml (added)
+++ incubator/aries/trunk/jndi/jndi-url-itest-web/src/main/resources/WEB-INF/web.xml Tue Dec 14 17:02:47 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.
+-->
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+   <web-app id="JndiUrlInregrationTest">   
+      <display-name>jndi-url itest servlet</display-name>
+      <description>This is the jndi-url itest</description>
+      <servlet id="Servlet_1">
+         <servlet-name>ITestServlet</servlet-name>
+         <display-name>ITest Servlet World</display-name>
+         <description>iTest Servlet</description>
+         <servlet-class>org.apache.aries.jndiurl.itest.JndiUrlItestServlet</servlet-class>
+      </servlet>
+          
+      <servlet-mapping id="ServletMapping_1">
+         <servlet-name>ITestServlet</servlet-name>
+         <url-pattern>/ITestServlet</url-pattern>
+      </servlet-mapping>
+      
+	  <welcome-file-list>
+	    <welcome-file>index.html</welcome-file>
+	  </welcome-file-list>
+   </web-app>
+