You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2007/06/19 16:10:31 UTC
svn commit: r548734 - in
/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests: ./
manifestcp-ear/ manifestcp-ear/src/main/resources/META-INF/ manifestcp-ejb/
manifestcp-jar/ manifestcp-jar2/ manifestcp-war-jar/ manifestcp-war/
manifestcp...
Author: djencks
Date: Tue Jun 19 07:10:30 2007
New Revision: 548734
URL: http://svn.apache.org/viewvc?view=rev&rev=548734
Log:
GERONIMO-3083 beginnings of test app for j2ca container managed security
Added:
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/
- copied from r548492, geronimo/server/trunk/testsuite/deployment-testsuite/manifestcp-tests/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java (with props)
Removed:
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ejb/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-jar/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-jar2/
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war-jar/
Modified:
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/pom.xml
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/src/main/resources/META-INF/geronimo-application.xml
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/pom.xml
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/webapp/WEB-INF/web.xml
geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/pom.xml
Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/pom.xml?view=diff&rev=548734&r1=548492&r2=548734
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/pom.xml (original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/pom.xml Tue Jun 19 07:10:30 2007
@@ -24,30 +24,19 @@
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>manifestcp-ear</artifactId>
+ <artifactId>jca-cms-ear</artifactId>
<name>Geronimo TestSuite :: Deployment Testsuite :: Manifest Classpath EAR</name>
<packaging>ear</packaging>
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-jar</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-war-jar</artifactId>
- <version>${version}</version>
+ <groupId>org.tranql</groupId>
+ <artifactId>tranql-connector-derby-embed-xa</artifactId>
+ <type>rar</type>
</dependency>
<dependency>
<groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-ejb</artifactId>
- <version>${version}</version>
- <type>ejb</type>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-war</artifactId>
+ <artifactId>jca-cms-war</artifactId>
<version>${version}</version>
<type>war</type>
</dependency>
@@ -86,15 +75,15 @@
<modules>
<webModule>
<groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-war</artifactId>
- <contextRoot>/manifestcp</contextRoot>
+ <artifactId>jca-cms-war</artifactId>
+ <contextRoot>/jca-cms</contextRoot>
<bundleFileName>web.war</bundleFileName>
</webModule>
- <ejbModule>
- <groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-ejb</artifactId>
- <bundleFileName>ejb.jar</bundleFileName>
- </ejbModule>
+ <rarModule>
+ <groupId>org.tranql</groupId>
+ <artifactId>tranql-connector-derby-embed-xa</artifactId>
+ <bundleFileName>tranql.rar</bundleFileName>
+ </rarModule>
</modules>
</configuration>
</plugin>
Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/src/main/resources/META-INF/geronimo-application.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/src/main/resources/META-INF/geronimo-application.xml?view=diff&rev=548734&r1=548492&r2=548734
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/src/main/resources/META-INF/geronimo-application.xml (original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-ear/src/main/resources/META-INF/geronimo-application.xml Tue Jun 19 07:10:30 2007
@@ -20,15 +20,113 @@
<!-- $Rev$ $Date$ -->
-<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
- <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+ <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
<moduleId>
<groupId>${pom.groupId}</groupId>
<artifactId>${pom.artifactId}</artifactId>
<version>${version}</version>
<type>ear</type>
</moduleId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.configs</groupId>
+ <artifactId>system-database</artifactId>
+ <type>car</type>
+ </dependency>
+ </dependencies>
</environment>
+ <module>
+ <connector>tranql.rar</connector>
+ <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>cmsds</name>
+ <!--<config-property-setting name="UserName"></config-property-setting>-->
+ <!--<config-property-setting name="Password"></config-property-setting>-->
+ <config-property-setting name="DatabaseName">TestDatabase</config-property-setting>
+ <config-property-setting name="CreateDatabase">false</config-property-setting>
+ <connectionmanager>
+ <container-managed-security/>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <single-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <select-one-assume-match/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ <connectiondefinition-instance>
+ <name>configuredsecurityds</name>
+ <config-property-setting name="UserName">system</config-property-setting>
+ <config-property-setting name="Password">manager</config-property-setting>
+ <config-property-setting name="DatabaseName">TestDatabase</config-property-setting>
+ <config-property-setting name="CreateDatabase">true</config-property-setting>
+ <connectionmanager>
+ <xa-transaction>
+ <transaction-caching/>
+ </xa-transaction>
+ <single-pool>
+ <max-size>10</max-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <select-one-assume-match/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ </resourceadapter>
+ <gbean name="test-cms-realm"
+ class="org.apache.geronimo.security.realm.GenericSecurityRealm">
+ <attribute name="realmName">test-cms-realm</attribute>
+ <xml-reference name="LoginModuleConfiguration">
+ <lc:login-config xmlns:lc="http://geronimo.apache.org/xml/ns/loginconfig-1.1">
+ <lc:login-module-ref control-flag="REQUIRED">
+ <lc:pattern>
+ <name xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">test-cms-credentials
+ </name>
+ </lc:pattern>
+ </lc:login-module-ref>
+ </lc:login-config>
+ </xml-reference>
+ <reference name="ServerInfo">
+ <name>ServerInfo</name>
+ </reference>
+ <reference name="LoginService">
+ <name>JaasLoginService</name>
+ </reference>
+ </gbean>
+ <gbean name="test-cms-credentials"
+ class="org.apache.geronimo.connector.outbound.security.PasswordCredentialLoginModuleWrapperGBean">
+ <attribute name="loginModuleClass">
+ org.apache.geronimo.connector.outbound.security.CallerIdentityPasswordCredentialLoginModule
+ </attribute>
+ <attribute name="serverSide">true</attribute>
+ <reference name="ManagedConnectionFactoryWrapper">
+ <name>cmsds</name>
+ </reference>
+ <attribute name="loginDomainName">test-cms-credentials</attribute>
+ </gbean>
+ </connector>
+ </module>
+ <module>
+ <web>web.war</web>
+ <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2">
+ <security-realm-name>test-cms-realm</security-realm-name>
+ </web-app>
+ </module>
+ <security>
+ <role-mappings>
+ <role role-name="test">
+ <principal class="org.apache.geronimo.connector.outbound.security.ResourcePrincipal" name="system"/>
+ </role>
+ </role-mappings>
+ </security>
</application>
Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/pom.xml?view=diff&rev=548734&r1=548492&r2=548734
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/pom.xml (original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/pom.xml Tue Jun 19 07:10:30 2007
@@ -20,13 +20,13 @@
<parent>
<groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-tests</artifactId>
+ <artifactId>jca-cms-tests</artifactId>
<version>2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>manifestcp-war</artifactId>
- <name>Geronimo TestSuite :: Deployment Testsuite :: Manifest Classpath WAR</name>
+ <artifactId>jca-cms-war</artifactId>
+ <name>Geronimo TestSuite :: Deployment Testsuite :: j2ca cms WAR</name>
<packaging>war</packaging>
<build>
@@ -36,11 +36,6 @@
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${pom.basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- </manifest>
- </archive>
</configuration>
</plugin>
</plugins>
@@ -48,10 +43,14 @@
<dependencies>
<dependency>
- <groupId>org.apache.geronimo.testsuite</groupId>
- <artifactId>manifestcp-war-jar</artifactId>
- <version>${version}</version>
- <optional>true</optional>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
</project>
Added: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java?view=auto&rev=548734
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java (added)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java Tue Jun 19 07:10:30 2007
@@ -0,0 +1,77 @@
+/**
+ * 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.itest;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.sql.DataSource;
+import javax.annotation.Resource;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TestServlet extends HttpServlet {
+
+ @Resource(name="configuredsecurityds")
+ private DataSource csds;
+ @Resource(name="cmsds")
+ private DataSource cmsds;
+
+ public void init() {
+ System.out.println("Test Servlet init");
+ }
+
+ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ PrintWriter out = response.getWriter();
+ //this should create the database
+ if (csds == null) {
+ out.println("No configured datasource found");
+ return;
+ }
+ try {
+ Connection con = csds.getConnection();
+ con.close();
+ out.println("Successfully got configured connection\n");
+ } catch (SQLException e) {
+ out.println("Could not get configured connection");
+ e.printStackTrace(out);
+ }
+ //now get a connection through the configured default subject
+ if (cmsds == null) {
+ out.println("No container managed datasource found");
+ return;
+ }
+ try {
+ Connection con = cmsds.getConnection();
+ con.close();
+ out.println("Successfully got container managed connection");
+ } catch (SQLException e) {
+ out.println("Could not get container managed connection");
+ e.printStackTrace(out);
+ }
+ }
+
+
+}
Propchange: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/java/org/apache/geronimo/itest/TestServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/webapp/WEB-INF/web.xml?view=diff&rev=548734&r1=548492&r2=548734
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/webapp/WEB-INF/web.xml (original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/manifestcp-war/src/main/webapp/WEB-INF/web.xml Tue Jun 19 07:10:30 2007
@@ -25,7 +25,7 @@
<display-name>Geronimo Manifest Classpath Itest War</display-name>
<servlet>
- <display-name>Manifest ClassPath itest servlet</display-name>
+ <display-name>J2CA container managed security itest servlet</display-name>
<servlet-name>servlet</servlet-name>
<servlet-class>org.apache.geronimo.itest.TestServlet</servlet-class>
<load-on-startup>0</load-on-startup>
@@ -35,5 +35,24 @@
<servlet-name>servlet</servlet-name>
<url-pattern>/servlet</url-pattern>
</servlet-mapping>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>j2ca cms</realm-name>
+ </login-config>
+
+ <security-role>
+ <role-name>test</role-name>
+ </security-role>
+
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>All</web-resource-name>
+ <url-pattern>/servlet</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>test</role-name>
+ </auth-constraint>
+ </security-constraint>
</web-app>
Modified: geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/pom.xml?view=diff&rev=548734&r1=548492&r2=548734
==============================================================================
--- geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/pom.xml (original)
+++ geronimo/server/trunk/testsuite/deployment-testsuite/jca-cms-tests/pom.xml Tue Jun 19 07:10:30 2007
@@ -23,18 +23,14 @@
<version>2.0-SNAPSHOT</version>
</parent>
- <artifactId>manifestcp-tests</artifactId>
+ <artifactId>jca-cms-tests</artifactId>
<packaging>pom</packaging>
- <name>Geronimo TestSuite :: Deployment Testsuite :: Manifest Classpath Test</name>
+ <name>Geronimo TestSuite :: Deployment Testsuite :: J2CA Container Managed Security Test</name>
<profiles>
<profile>
<id>child</id>
<modules>
- <module>manifestcp-jar2</module>
- <module>manifestcp-jar</module>
- <module>manifestcp-war-jar</module>
- <module>manifestcp-ejb</module>
<module>manifestcp-war</module>
<module>manifestcp-ear</module>
</modules>