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/04/23 19:38:27 UTC
svn commit: r937441 - in /geronimo/server/trunk/testsuite: ./
enterprise-testsuite/ enterprise-testsuite/datasource-test/
enterprise-testsuite/datasource-test/src/
enterprise-testsuite/datasource-test/src/main/
enterprise-testsuite/datasource-test/src/...
Author: gawor
Date: Fri Apr 23 17:38:27 2010
New Revision: 937441
URL: http://svn.apache.org/viewvc?rev=937441&view=rev
Log:
GERONIMO-5113: Added tests for @DataSourceDefinition
Added:
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html (with props)
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/
geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java (with props)
Modified:
geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml
geronimo/server/trunk/testsuite/pom.xml
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml?rev=937441&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml Fri Apr 23 17:38:27 2010
@@ -0,0 +1,98 @@
+<?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>enterprise-testsuite</artifactId>
+ <version>3.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>datasource-test</artifactId>
+ <name>Geronimo TestSuite :: Enterprise Testsuite :: DataSource 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>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>webAppName</name>
+ <value>datasource</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <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}/${artifactId}-${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>${groupId}/${artifactId}/${version}/war</moduleId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java?rev=937441&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java Fri Apr 23 17:38:27 2010
@@ -0,0 +1,158 @@
+/**
+ * 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.test.datasource;
+
+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.annotation.Resource;
+import javax.annotation.sql.DataSourceDefinition;
+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;
+
+@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 DataSourceServlet extends HttpServlet {
+
+ @Resource(lookup="java:app/MyDataSource")
+ DataSource dataSource1;
+
+ @Resource(lookup="osgi:service/mydatasource")
+ DataSource dataSource2;
+
+ 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>Sample DataSourceDefinition Application</title></head></html>");
+ out.println("<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 = dataSource1.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 = dataSource2.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 = dataSource1.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/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/java/org/apache/geronimo/test/datasource/DataSourceServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml?rev=937441&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml Fri Apr 23 17:38:27 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>/datasource</context-root>
+
+</web-app>
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml?rev=937441&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml Fri Apr 23 17:38:27 2010
@@ -0,0 +1,40 @@
+<?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">
+
+ <display-name>DataSourceServletTest</display-name>
+
+ <servlet>
+ <display-name>DataSourceServlet</display-name>
+ <servlet-name>DataSourceServlet</servlet-name>
+ <servlet-class>org.apache.geronimo.test.datasource.DataSourceServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>DataSourceServlet</servlet-name>
+ <url-pattern>/DataSourceServlet</url-pattern>
+ <url-pattern>/DataSourceServlet/*</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/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html?rev=937441&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html Fri Apr 23 17:38:27 2010
@@ -0,0 +1,19 @@
+<!--
+ 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="DataSourceServlet">DataSourceServlet</a>
+</ul>
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/main/webapp/index.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java?rev=937441&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java (added)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java Fri Apr 23 17:38:27 2010
@@ -0,0 +1,69 @@
+/**
+ * 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.datasource;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.apache.geronimo.testsupport.TestSupport;
+import org.testng.annotations.Test;
+
+public class TestDataSource extends TestSupport {
+
+ private String baseURL = "http://localhost:8080/";
+
+ @Test
+ public void testDataSource() throws Exception {
+ checkReply("/DataSourceServlet");
+ }
+
+ private void checkReply(String address) throws Exception {
+ String warName = System.getProperty("webAppName");
+ assertNotNull(warName);
+ URL url = new URL(baseURL + warName + address);
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setConnectTimeout(30 * 1000);
+ connection.setReadTimeout(30 * 1000);
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection
+ .getInputStream()));
+ assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
+ assertTrue("Contact1", find(reader, "Joe Smith 111 111-"));
+ assertTrue("Contact2", find(reader, "Jane Doe 222 222-"));
+ } finally {
+ connection.disconnect();
+ }
+ }
+
+ private boolean find(BufferedReader reader, String text) throws IOException {
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ System.out.println(line);
+ if (line.indexOf(text) != -1) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/testsuite/enterprise-testsuite/datasource-test/src/test/java/org/apache/geronimo/testsuite/datasource/TestDataSource.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml?rev=937441&r1=937440&r2=937441&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/enterprise-testsuite/pom.xml Fri Apr 23 17:38:27 2010
@@ -54,6 +54,7 @@
-->
<module>jpa-tests</module>
<module>sec-client-tests</module>
+ <module>datasource-test</module>
</modules>
</project>
Modified: geronimo/server/trunk/testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/pom.xml?rev=937441&r1=937440&r2=937441&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/pom.xml Fri Apr 23 17:38:27 2010
@@ -136,6 +136,40 @@
<skip>true</skip>
</configuration>
</plugin>
+
+ <!--
+ geronimo-property-plugin sets bootClassPath property
+ which is used by maven-compiler-plugin and
+ maven-surefire-plugin.
+ -->
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>geronimo-property-plugin</artifactId>
+ <configuration>
+ <propertyName>bootClassPath</propertyName>
+ <propertyValuePrefix>-Xbootclasspath/p:</propertyValuePrefix>
+ <classpath>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.1_spec</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxws_2.2_spec</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </classpath>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgument>${bootClassPath}</compilerArgument>
+ </configuration>
+ </plugin>
</plugins>
</build>