You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2010/08/04 19:27:55 UTC
svn commit: r982339 - in /geronimo/server/trunk/testsuite:
enterprise-testsuite/ enterprise-testsuite/datasource-test/
javaee6-testsuite/ javaee6-testsuite/commonannotation1.1-test/
javaee6-testsuite/commonannotation1.1-test/src/ javaee6-testsuite/comm...
Author: gawor
Date: Wed Aug 4 17:27:53 2010
New Revision: 982339
URL: http://svn.apache.org/viewvc?rev=982339&view=rev
Log:
GERONIMO-5497: Combined testsuite for DataSourceDefinition annotations. Based on patch from Janel Zhang
Added:
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html (with props)
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/
geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java (with props)
Removed:
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/
Modified:
geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml
geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml?rev=982339&r1=982338&r2=982339&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml Wed Aug 4 17:27:53 2010
@@ -54,7 +54,6 @@
-->
<module>jpa-tests</module>
<module>sec-client-tests</module>
- <module>datasource-test</module>
<module>appname-tests</module>
</modules>
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml Wed Aug 4 17:27:53 2010
@@ -0,0 +1,104 @@
+<?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>commonannotation1.1-test</artifactId>
+ <name>Geronimo TestSuite :: Java EE 6 Testsuite :: commonannotation1.1-test</name>
+ <description>
+ The test case includes tests for these new features in commonannotation1.1:
+ 1.javax.annotation.sql.DataSourceDefinition
+ 2.javax.annotation.sql.DataSourceDefinitions
+ </description>
+ <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-annotation_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>it</id>
+ <activation>
+ <property>
+ <name>it</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <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>
+ <systemPropertyVariables>
+ <appContext>${project.artifactId}</appContext>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java Wed Aug 4 17:27:53 2010
@@ -0,0 +1,151 @@
+/**
+ * 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.sample.servlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.sql.DataSource;
+
+public abstract class BaseServlet extends HttpServlet {
+
+ abstract DataSource getDataSourceA();
+
+ abstract DataSource getDataSourceB();
+
+ String getTitle() {
+ return getClass().getName();
+ }
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ doPost(request,response);
+ }
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ PrintWriter out = response.getWriter();
+ out.println("<html><head><title>");
+ out.println(getTitle());
+ out.println("</title></head></html><body>");
+
+ try {
+ initDB();
+ } catch (SQLException e) {
+ throw new ServletException("Error creating database", e);
+ }
+
+ List<Contact> contacts;
+
+ try {
+ contacts = getContacts();
+ } catch (SQLException e) {
+ throw new ServletException("Error accessing database", e);
+ }
+
+ for (Contact c : contacts) {
+ out.println(c.firstName + " " + c.lastName + " " + c.phone + "<br>");
+ }
+
+ out.println("</body></html>");
+
+ }
+
+ public void init(ServletConfig config) {
+ System.out.println("Initializing servlet");
+ }
+
+ public void initDB() throws SQLException {
+ Connection con = getDataSourceA().getConnection();
+ Statement stmt = con.createStatement();
+
+ try {
+ stmt.executeUpdate("DROP TABLE CONTACTS");
+ } catch (SQLException e) {
+ // ignore
+ }
+
+ try {
+ stmt.executeUpdate("CREATE TABLE CONTACTS (ID INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, FIRSTNAME VARCHAR(25), LASTNAME VARCHAR(25), PHONE VARCHAR(25))");
+ } finally {
+ stmt.close();
+ con.close();
+ }
+
+ String ts = String.format("%1$tM%1$tS", Calendar.getInstance());
+ addContact("Joe", "Smith", "111 111-" + ts);
+ addContact("Jane", "Doe", "222 222-" + ts);
+ }
+
+ public List<Contact> getContacts() throws SQLException {
+ List<Contact> contacts = new ArrayList<Contact>();
+ Connection con = getDataSourceB().getConnection();
+ Statement stmt = con.createStatement();
+ try {
+ ResultSet rs = stmt.executeQuery(
+ "SELECT ID, FIRSTNAME, LASTNAME, PHONE FROM CONTACTS");
+ while (rs.next()) {
+ Contact c = new Contact();
+ c.id = rs.getLong(1);
+ c.firstName = rs.getString(2);
+ c.lastName = rs.getString(3);
+ c.phone = rs.getString(4);
+ contacts.add(c);
+ }
+ } finally {
+ stmt.close();
+ con.close();
+ }
+
+ return contacts;
+ }
+
+ public void addContact(String firstName, String lastName, String phone) throws SQLException {
+ Connection con = getDataSourceA().getConnection();
+ PreparedStatement pstmt = con.prepareStatement(
+ "INSERT INTO CONTACTS (FIRSTNAME, LASTNAME, PHONE) VALUES (?, ?, ?)");
+ try {
+ pstmt.setString(1, firstName);
+ pstmt.setString(2, lastName);
+ pstmt.setString(3, phone);
+ pstmt.executeUpdate();
+ } finally {
+ pstmt.close();
+ con.close();
+ }
+ }
+
+ private static class Contact {
+ long id;
+ String firstName;
+ String lastName;
+ String phone;
+ }
+}
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/BaseServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java Wed Aug 4 17:27:53 2010
@@ -0,0 +1,49 @@
+/**
+ * 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.sample.servlet;
+
+import javax.annotation.Resource;
+import javax.annotation.sql.DataSourceDefinition;
+import javax.sql.DataSource;
+
+@DataSourceDefinition(name="java:app/MyDataSource",
+ className="org.apache.derby.jdbc.ClientDataSource",
+ portNumber=1527,
+ description="this is my data source",
+ user="system",
+ databaseName="MyDatabase",
+ properties = { "osgi.jndi.service.name = mydatasource", "createDatabase = create" },
+ serverName="localhost")
+public class DataSourceDefinitionServlet extends BaseServlet {
+
+ @Resource(lookup="java:app/MyDataSource")
+ DataSource dataSource1;
+
+ @Resource(lookup="osgi:service/mydatasource")
+ DataSource dataSource2;
+
+ DataSource getDataSourceA() {
+ return dataSource1;
+ }
+
+ @Override
+ DataSource getDataSourceB() {
+ return dataSource2;
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java Wed Aug 4 17:27:53 2010
@@ -0,0 +1,46 @@
+/**
+ * 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.sample.servlet;
+
+import javax.annotation.Resource;
+import javax.annotation.sql.DataSourceDefinition;
+import javax.sql.DataSource;
+
+@DataSourceDefinition(name="java:app/MyDataSourceDefinitionUrl",
+ className="org.apache.derby.jdbc.ClientDataSource",
+ url="jdbc:derby://localhost:1527/MyDatabase2",
+ user="system",
+ databaseName="MyDatabase2",
+ properties = {"createDatabase = create" }
+)
+public class DataSourceDefinitionUrlServlet extends BaseServlet {
+
+ @Resource(lookup="java:app/MyDataSourceDefinitionUrl")
+ DataSource dataSource;
+
+ @Override
+ DataSource getDataSourceA() {
+ return dataSource;
+ }
+
+ @Override
+ DataSource getDataSourceB() {
+ return dataSource;
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionUrlServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java Wed Aug 4 17:27:53 2010
@@ -0,0 +1,59 @@
+/**
+ * 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.sample.servlet;
+
+import javax.annotation.Resource;
+import javax.annotation.sql.DataSourceDefinition;
+import javax.annotation.sql.DataSourceDefinitions;
+import javax.sql.DataSource;
+
+@DataSourceDefinitions({
+ @DataSourceDefinition(name="java:app/MyDataSourceDefinitions1",
+ className="org.apache.derby.jdbc.ClientDataSource",
+ portNumber=1527,
+ user="system",
+ databaseName="MyDatabase3",
+ serverName="localhost",
+ properties = {"createDatabase = create" }),
+ @DataSourceDefinition(name="java:app/MyDataSourceDefinitions2",
+ className="org.apache.derby.jdbc.ClientDataSource",
+ portNumber=1527,
+ user="system",
+ databaseName="MyDatabase3",
+ serverName="localhost",
+ properties = {"createDatabase = create" })
+})
+public class DataSourceDefinitionsServlet extends BaseServlet {
+
+ @Resource(lookup="java:app/MyDataSourceDefinitions1")
+ DataSource dataSource1;
+
+ @Resource(lookup="java:app/MyDataSourceDefinitions2")
+ DataSource dataSource2;
+
+ @Override
+ DataSource getDataSourceA() {
+ return dataSource1;
+ }
+
+ @Override
+ DataSource getDataSourceB() {
+ return dataSource2;
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/java/org/apache/geronimo/sample/servlet/DataSourceDefinitionsServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml Wed Aug 4 17:27:53 2010
@@ -0,0 +1,30 @@
+<?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>${pom.groupId}</dep:groupId>
+ <dep:artifactId>${pom.artifactId}</dep:artifactId>
+ <dep:version>${version}</dep:version>
+ <dep:type>war</dep:type>
+ </dep:moduleId>
+ </dep:environment>
+
+ <context-root>/${pom.artifactId}</context-root>
+
+</web-app>
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml Wed Aug 4 17:27:53 2010
@@ -0,0 +1,56 @@
+<?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://java.sun.com/xml/ns/javaee" version="2.5">
+
+ <servlet>
+ <display-name>DataSourceDefinitionsServlet</display-name>
+ <servlet-name>DataSourceDefinitionsServlet</servlet-name>
+ <servlet-class>org.apache.geronimo.sample.servlet.DataSourceDefinitionsServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>DataSourceDefinitionsServlet</servlet-name>
+ <url-pattern>/DataSourceDefinitionsServlet</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <display-name>DataSourceDefinitionUrlServlet</display-name>
+ <servlet-name>DataSourceDefinitionUrlServlet</servlet-name>
+ <servlet-class>org.apache.geronimo.sample.servlet.DataSourceDefinitionUrlServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>DataSourceDefinitionUrlServlet</servlet-name>
+ <url-pattern>/DataSourceDefinitionUrlServlet</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <display-name>DataSourceDefinitionServlet</display-name>
+ <servlet-name>DataSourceDefinitionServlet</servlet-name>
+ <servlet-class>org.apache.geronimo.sample.servlet.DataSourceDefinitionServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>DataSourceDefinitionServlet</servlet-name>
+ <url-pattern>/DataSourceDefinitionServlet</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html Wed Aug 4 17:27:53 2010
@@ -0,0 +1,24 @@
+<!--
+ 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.
+-->
+<ul>
+<li><a href="DataSourceDefinitionsServlet">DataSourceDefinitionsServlet</a>
+
+<li><a href="DataSourceDefinitionServlet">DataSourceDefinitionServlet</a>
+
+<li><a href="DataSourceDefinitionUrlServlet">DataSourceDefinitionUrlServlet</a>
+
+</ul>
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java?rev=982339&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java Wed Aug 4 17:27:53 2010
@@ -0,0 +1,53 @@
+/**
+ * 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.sample.dataSourceDefinition.test;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+import org.apache.geronimo.testsupport.HttpUtils;
+import org.apache.geronimo.testsupport.TestSupport;
+
+public class DataSourceDefinitionTest extends TestSupport {
+
+ @Test
+ public void testDataSourceDefinitions() throws Exception {
+ checkResponse("/DataSourceDefinitionsServlet");
+ }
+
+ @Test
+ public void testDataSourceDefinitionURL() throws Exception {
+ checkResponse("/DataSourceDefinitionUrlServlet");
+ }
+
+ @Test
+ public void testDataSourceDefinition() throws Exception {
+ checkResponse("/DataSourceDefinitionServlet");
+ }
+
+ private void checkResponse(String address) throws Exception {
+ String baseURL = "http://localhost:8080/";
+ String appContextStr = System.getProperty("appContext");
+ URL url = new URL(baseURL + appContextStr + address);
+ String response = HttpUtils.doGET(url);
+ assertTrue("Contact1", response.contains("Joe Smith 111 111-"));
+ assertTrue("Contact2", response.contains("Jane Doe 222 222-"));
+ }
+}
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/commonannotation1.1-test/src/test/java/org/apache/geronimo/sample/dataSourceDefinition/test/DataSourceDefinitionTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml?rev=982339&r1=982338&r2=982339&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml Wed Aug 4 17:27:53 2010
@@ -47,7 +47,7 @@
9. Managed Beans 1.0
10. Web Beans 1.0
11. Dependency Injection for Java 1.0
- 12. Common Annotations for theJava Platform (JSR-250) 1.1
+ 12. Common Annotations for the Java Platform (JSR-250) 1.1
13. Interceptors 1.1
</description>
@@ -60,6 +60,7 @@
<module>jsp2.2-test</module>
<module>managedbean1.0-test</module>
<module>di1.0-test</module>
+ <module>commonannotation1.1-test</module>
</modules>
</project>