You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/11/11 08:24:24 UTC
svn commit: r473659 - in
/incubator/tuscany/java/sca/services/persistence/datasource: ./
src/main/java/org/apache/tuscany/persistence/datasource/
src/test/java/org/apache/tuscany/persistence/datasource/integration/
src/test/resources/META-INF/sca/
Author: jmarino
Date: Fri Nov 10 23:24:23 2006
New Revision: 473659
URL: http://svn.apache.org/viewvc?view=rev&rev=473659
Log:
add integration testing that uses DBCP as a DataSource provider
Added:
incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java (with props)
incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java (contents, props changed)
- copied, changed from r471648, incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/BootstrapTestCase.java
incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl
incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl
- copied, changed from r471648, incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/application.scdl
Removed:
incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/BootstrapTestCase.java
incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/application.scdl
Modified:
incubator/tuscany/java/sca/services/persistence/datasource/pom.xml
incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java
Modified: incubator/tuscany/java/sca/services/persistence/datasource/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/pom.xml?view=diff&rev=473659&r1=473658&r2=473659
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/pom.xml (original)
+++ incubator/tuscany/java/sca/services/persistence/datasource/pom.xml Fri Nov 10 23:24:23 2006
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.tuscany.sca.services.persistence</groupId>
<artifactId>parent</artifactId>
- <version>1.0-incubator-M2-SNAPSHOT</version>
+ <version>1.0-incubator-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-datasource</artifactId>
@@ -51,5 +51,17 @@
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ </dependency>
+
</dependencies>
</project>
Modified: incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java?view=diff&rev=473659&r1=473658&r2=473659
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DSComponentTypeLoader.java Fri Nov 10 23:24:23 2006
@@ -98,8 +98,7 @@
throw new AmbiguousPropertyException(propName);
}
JavaMappedProperty<Type> property =
- new JavaMappedProperty<Type>(propName, info.getQName(),
- type); //SimpleTypeMapperExtension.XSD_STRING
+ new JavaMappedProperty<Type>(propName, info.getQName(), type);
property.setOverride(OverrideOptions.MAY);
property.setMember(method);
componentType.add(property);
Added: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java?view=auto&rev=473659
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java (added)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java Fri Nov 10 23:24:23 2006
@@ -0,0 +1,48 @@
+/*
+ * 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.tuscany.persistence.datasource.integration;
+
+import java.sql.Connection;
+import java.net.URL;
+import javax.sql.DataSource;
+
+import org.apache.tuscany.test.SCATestCase;
+
+/**
+ * Verifies bootstrapping of a datasource implementation using Commons DBCP and HSQLDB
+ *
+ * @version $Rev$ $Date$
+ */
+public class DHCPBootstrapTestCase extends SCATestCase {
+
+ public void testBasicConnection() throws Exception {
+ DataSource ds = (DataSource) component.getSystemChild("TestDS").getServiceInstance();
+ assertNotNull(ds);
+ Connection conn = ds.getConnection();
+ conn.createStatement().execute("CREATE TABLE foo (bar char(20));");
+ }
+
+ protected void setUp() throws Exception {
+ URL url = getClass().getResource("/META-INF/sca/dataSource.scdl");
+ addExtension("DataSourceExtension", url);
+ setApplicationSCDL(getClass().getResource("/META-INF/sca/dbcp.scdl"));
+ super.setUp();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/DHCPBootstrapTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java (from r471648, incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/BootstrapTestCase.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java?view=diff&rev=473659&p1=incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/BootstrapTestCase.java&r1=471648&p2=incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java&r2=473659
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/BootstrapTestCase.java (original)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java Fri Nov 10 23:24:23 2006
@@ -25,13 +25,14 @@
import org.apache.tuscany.test.SCATestCase;
/**
- * Verifies bootstrapping of a datasource implementation as a system service in an application composite
+ * Verifies bootstrapping of a datasource implementation as a system service in an application composite using a mock
+ * Provider
*
* @version $Rev$ $Date$
*/
-public class BootstrapTestCase extends SCATestCase {
+public class ProviderBootstrapTestCase extends SCATestCase {
- public void testBoot() {
+ public void testBoot() throws Exception {
DataSource ds = (DataSource) component.getSystemChild("TestDS").getServiceInstance();
assertNotNull(ds);
assertEquals("value", ((Provider) ds).getTest());
@@ -40,7 +41,7 @@
protected void setUp() throws Exception {
URL url = getClass().getResource("/META-INF/sca/dataSource.scdl");
addExtension("DataSourceExtension", url);
- setApplicationSCDL(getClass().getResource("/META-INF/sca/application.scdl"));
+ setApplicationSCDL(getClass().getResource("/META-INF/sca/provider.scdl"));
super.setUp();
}
Propchange: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/integration/ProviderBootstrapTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl?view=auto&rev=473659
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl (added)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/dbcp.scdl Fri Nov 10 23:24:23 2006
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="bootTest">
+
+ <component name="TestDS">
+ <system:implementation.ds provider="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="driverClassName">org.hsqldb.jdbcDriver</property>
+ <property name="url">jdbc:hsqldb:mem:testdb</property>
+ </component>
+
+</composite>
Copied: incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl (from r471648, incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/application.scdl)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl?view=diff&rev=473659&p1=incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/application.scdl&r1=471648&p2=incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl&r2=473659
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/application.scdl (original)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/test/resources/META-INF/sca/provider.scdl Fri Nov 10 23:24:23 2006
@@ -22,9 +22,7 @@
name="bootTest">
<component name="TestDS">
- <system:implementation.ds provider="org.apache.tuscany.persistence.datasource.integration.mock.Provider">
- <test>value</test>
- </system:implementation.ds>
+ <system:implementation.ds provider="org.apache.tuscany.persistence.datasource.integration.mock.Provider"/>
<property name="test">value</property>
<property name="loginTimeout">1</property>
</component>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org