aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1791222 - in /aries/trunk/jpa/itests: ./ jpa-container-itest/ jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/ jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/ jpa-container-itest/src/test/resources/conf...
Date Thu, 13 Apr 2017 08:48:56 GMT
Author: cschneider
Date: Thu Apr 13 08:48:55 2017
New Revision: 1791222

URL: http://svn.apache.org/viewvc?rev=1791222&view=rev
Log:
[ARIES-1716] Upgrade to pax-jdbc 1.1.0

Added:
    aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/
    aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testds.cfg
    aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testdsxa.cfg
    aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.pax.logging.cfg
Modified:
    aries/trunk/jpa/itests/jpa-container-itest/pom.xml
    aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java
    aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
    aries/trunk/jpa/itests/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml
    aries/trunk/jpa/itests/pom.xml

Modified: aries/trunk/jpa/itests/jpa-container-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/pom.xml?rev=1791222&r1=1791221&r2=1791222&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/pom.xml (original)
+++ aries/trunk/jpa/itests/jpa-container-itest/pom.xml Thu Apr 13 08:48:55 2017
@@ -352,6 +352,12 @@
         <!-- pax exam -->
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-cm</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam</artifactId>
             <version>${exam.version}</version>
             <scope>test</scope>
@@ -383,7 +389,7 @@
         <dependency>
             <groupId>org.ops4j.pax.tinybundles</groupId>
             <artifactId>tinybundles</artifactId>
-            <version>2.0.0</version>
+            <version>2.1.1</version>
             <exclusions>
                 <exclusion>
                     <artifactId>org.osgi.core</artifactId>

Modified: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java?rev=1791222&r1=1791221&r2=1791222&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java
(original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/container/itest/JPAContainerTest.java
Thu Apr 13 08:48:55 2017
@@ -30,7 +30,6 @@ import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.Query;
 import javax.persistence.TypedQuery;
-import javax.sql.DataSource;
 
 import org.apache.aries.jpa.container.itest.entities.Car;
 import org.apache.aries.jpa.itest.AbstractCarJPAITest;
@@ -167,25 +166,14 @@ public abstract class JPAContainerTest e
 
     @Test
     public void testCarEMFBuilderExternalDSXA() throws Exception {
-    	DataSource ds = getService(DataSource.class, 
-    			"(" + OSGI_JDBC_DRIVER_CLASS + "=org.apache.derby.jdbc.EmbeddedDriver-pool-xa)");
-    	
     	EntityManagerFactoryBuilder emfBuilder = getService(EntityManagerFactoryBuilder.class,
     			"(osgi.unit.name=" + EXTERNAL_TEST_UNIT + ")");
-    	
-    	
+
     	Map<String, Object> props = new HashMap<String, Object>();
     	props.put("javax.persistence.jtaDataSource", ds);
     	props.put("javax.persistence.transactionType", JTA.name());
-    	
     	//EclipseLink also needs a non-jta-datasource
-    	DataSourceFactory dsf = getService(DataSourceFactory.class, 
-    			"(" + OSGI_JDBC_DRIVER_CLASS + "=org.apache.derby.jdbc.EmbeddedDriver)");
-    	Properties jdbcProps = new Properties();
-    	jdbcProps.setProperty("url", "jdbc:derby:memory:TEST1;create=true");
-    	props.put("javax.persistence.nonJtaDataSource", dsf.createDataSource(jdbcProps));
-
-    	
+    	props.put("javax.persistence.nonJtaDataSource", ds);
     	EntityManagerFactory emf = emfBuilder.createEntityManagerFactory(props);
     	carLifecycleXA(ut, emf.createEntityManager());
     }
@@ -195,15 +183,10 @@ public abstract class JPAContainerTest e
         EntityManagerFactoryBuilder emfBuilder = getService(EntityManagerFactoryBuilder.class,
                         "(osgi.unit.name=" + EXTERNAL_TEST_UNIT + ")");
         
-        
         Map<String, Object> props = new HashMap<String, Object>();
-        //EclipseLink also needs a non-jta-datasource
-        DataSourceFactory dsf = getService(DataSourceFactory.class, 
-                        "(" + OSGI_JDBC_DRIVER_CLASS + "=org.apache.derby.jdbc.EmbeddedDriver)");
         Properties jdbcProps = new Properties();
         jdbcProps.setProperty("url", "jdbc:derby:memory:TESTNOJTA;create=true");
         props.put("javax.persistence.dataSource", dsf.createDataSource(jdbcProps));
-
         
         EntityManagerFactory emf = emfBuilder.createEntityManagerFactory(props);
         carLifecycleRL(emf.createEntityManager());

Modified: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java?rev=1791222&r1=1791221&r2=1791222&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
(original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/itest/AbstractJPAItest.java
Thu Apr 13 08:48:55 2017
@@ -22,16 +22,15 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
 import static org.ops4j.pax.exam.CoreOptions.when;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.configurationFolder;
 
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
+import java.io.File;
 
 import javax.inject.Inject;
 import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
 import javax.transaction.UserTransaction;
 
-import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
@@ -47,18 +46,12 @@ import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.jdbc.DataSourceFactory;
 import org.osgi.util.tracker.ServiceTracker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
 public abstract class AbstractJPAItest {
-    private static Logger LOG = LoggerFactory.getLogger(AbstractJPAItest.class);
-
     protected static final String TEST_UNIT = "test-unit";
     protected static final String XA_TEST_UNIT = "xa-test-unit";
     protected static final String DSF_TEST_UNIT = "dsf-test-unit";
@@ -67,18 +60,23 @@ public abstract class AbstractJPAItest {
 
     protected static final String TEST_BUNDLE_NAME = "org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle";
     
-    protected static final String BLUE_CAR_PLATE = "A1AAA";
-    protected static final String GREEN_CAR_PLATE = "B2BBB";
-
     @Inject
     protected BundleContext bundleContext;
     
     @Inject
     protected UserTransaction ut;
-
+    
     @Inject
-    protected ConfigurationAdmin configAdmin;
-    private static Configuration config;
+    @org.ops4j.pax.exam.util.Filter("(osgi.jndi.service.name=testds)")
+    protected DataSource ds;
+    
+    @Inject
+    @org.ops4j.pax.exam.util.Filter("(osgi.jndi.service.name=testdsxa)")
+    protected DataSource dsXa;
+    
+    @Inject
+    @org.ops4j.pax.exam.util.Filter("(osgi.jdbc.driver.class=org.apache.derby.jdbc.EmbeddedDriver)")
+    protected DataSourceFactory dsf;
 
     /**
      * TODO check calls to this. Eventually switch to EmSupplier 
@@ -119,7 +117,7 @@ public abstract class AbstractJPAItest {
         }
     }
 
-    public String sanitizeFilter(String filter) {
+    private String sanitizeFilter(String filter) {
         return filter.startsWith("(") ? filter : "(" + filter + ")";
     }
 
@@ -158,22 +156,26 @@ public abstract class AbstractJPAItest {
     }
 
     protected Option baseOptions() {
-        String localRepo = System.getProperty("maven.repo.local");
-
-        if (localRepo == null) {
-            localRepo = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
-        }
+        String localRepo = getLocalRepo();
         return composite(junitBundles(),
                          mavenBundle("org.ops4j.pax.logging", "pax-logging-api", "1.7.2"),
                          mavenBundle("org.ops4j.pax.logging", "pax-logging-service", "1.7.2"),
-                         // this is how you set the default log level when using pax
-                         // logging (logProfile)
                          systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
-                         when(localRepo != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository="
+ localRepo))
-                         //,
+                         //systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
+                         when(localRepo != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository="
+ localRepo)),
+                         configurationFolder(new File("src/test/resources/config"))
             );
     }
 
+    private String getLocalRepo() {
+        String localRepo = System.getProperty("maven.repo.local");
+
+        if (localRepo == null) {
+            localRepo = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
+        }
+        return localRepo;
+    }
+
     protected Option debug() {
         return vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
     }
@@ -278,6 +280,7 @@ public abstract class AbstractJPAItest {
                          mvnBundle("org.apache.commons", "commons-dbcp2"), //
                          mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-pool-common"), //
                          mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-pool-dbcp2"), //
+                         mvnBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.jasypt"),
//
                          mvnBundle("org.ops4j.pax.jdbc", "pax-jdbc-config")
             );
     }
@@ -310,31 +313,4 @@ public abstract class AbstractJPAItest {
         return mvnBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container.itest.bundle.eclipselink");
     }
 
-    @Before
-    public void createConfigForDataSource() throws Exception {
-        if (config == null) {
-            createConfigForLogging();
-            config = configAdmin.createFactoryConfiguration("org.ops4j.datasource", null);
-            Dictionary<String, String> props = new Hashtable<String, String>();
-            props.put(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS, "org.apache.derby.jdbc.EmbeddedDriver-pool-xa");
-            props.put(DataSourceFactory.JDBC_URL, "jdbc:derby:memory:TEST1;create=true");
-            props.put("dataSourceName", "testds");
-            config.update(props);
-            LOG.info("Created DataSource config testds");
-        }
-    }
-    
-    public void createConfigForLogging() throws IOException {
-        Configuration logConfig = configAdmin.getConfiguration("org.ops4j.pax.logging", null);
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put("log4j.rootLogger", "INFO, stdout");
-        props.put("log4j.logger.org.apache.aries.transaction", "DEBUG");
-        props.put("log4j.logger.org.apache.aries.transaction.parsing", "DEBUG");
-        props.put("log4j.logger.org.apache.aries.jpa.blueprint.impl", "DEBUG");
-        props.put("log4j.appender.stdout", "org.apache.log4j.ConsoleAppender");
-        props.put("log4j.appender.stdout.layout", "org.apache.log4j.PatternLayout");
-        props.put("log4j.appender.stdout.layout.ConversionPattern", "%d{ISO8601} | %-5.5p
| %-16.16t | %c | %m%n");
-        logConfig.update(props);
-    }
-
 }

Added: aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testds.cfg
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testds.cfg?rev=1791222&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testds.cfg
(added)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testds.cfg
Thu Apr 13 08:48:55 2017
@@ -0,0 +1,3 @@
+osgi.jdbc.driver.class=org.apache.derby.jdbc.EmbeddedDriver
+url=jdbc:derby:memory:TEST1;create=true
+dataSourceName=testds

Added: aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testdsxa.cfg
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testdsxa.cfg?rev=1791222&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testdsxa.cfg
(added)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.datasource-testdsxa.cfg
Thu Apr 13 08:48:55 2017
@@ -0,0 +1,5 @@
+osgi.jdbc.driver.class=org.apache.derby.jdbc.EmbeddedDriver
+pool=dbcp2
+xa=true
+url=jdbc:derby:memory:TESTXA;create=true
+dataSourceName=testdsxa

Added: aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.pax.logging.cfg
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.pax.logging.cfg?rev=1791222&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.pax.logging.cfg
(added)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/resources/config/org.ops4j.pax.logging.cfg
Thu Apr 13 08:48:55 2017
@@ -0,0 +1,7 @@
+log4j.rootLogger=INFO, stdout
+#log4j.logger.org.apache.aries.transaction=DEBUG
+#log4j.logger.org.apache.aries.transaction.parsing=DEBUG
+#log4j.logger.org.apache.aries.jpa.blueprint.impl=DEBUG
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %c | %m%n

Modified: aries/trunk/jpa/itests/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml?rev=1791222&r1=1791221&r2=1791222&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml
(original)
+++ aries/trunk/jpa/itests/jpa-container-testbundle/src/main/resources/META-INF/persistence.xml
Thu Apr 13 08:48:55 2017
@@ -25,7 +25,7 @@
   <persistence-unit name="test-unit" transaction-type="RESOURCE_LOCAL">
     <description>Test persistence unit for the JPA Container and Context iTests</description>
     
-    <non-jta-data-source>osgi:service/javax.sql.DataSource</non-jta-data-source>
+    <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=testds)</non-jta-data-source>
     <properties>
         <!-- This is to avoid compile time enhancement which would conflict with hibernate
-->
         <property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>
@@ -43,10 +43,9 @@
   
    <persistence-unit name="xa-test-unit" transaction-type="JTA">
      <description>Test persistence unit for the JPA Container advanced iTests</description>
+     
+     <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=testdsxa)</jta-data-source>
      <properties>
-       <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver-pool-xa"
/>
-       <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:XATEST;create=true"
/>
-
         <!-- These properties are creating the database on the fly. We are using them
to avoid the tests having to create a database -->
         <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"
/>
         <property name="openjpa.jdbc.DBDictionary" value="derby" />
@@ -76,7 +75,8 @@
   <persistence-unit name="dsf-xa-test-unit" transaction-type="JTA">
     <description>Test persistence unit for the JPA Container DataSourceFactory iTests</description>
     <properties>
-      <!-- These properties are creating the database on the fly. We are using them to
avoid the tests having to create a database  -->     <property name="javax.persistence.jdbc.driver"
value="org.apache.derby.jdbc.EmbeddedDriver-pool-xa"/>
+      <!-- These properties are creating the database on the fly. We are using them to
avoid the tests having to create a database  -->
+      <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
       <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:DSFXATEST;create=true"/>
 
       <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>

Modified: aries/trunk/jpa/itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/pom.xml?rev=1791222&r1=1791221&r2=1791222&view=diff
==============================================================================
--- aries/trunk/jpa/itests/pom.xml (original)
+++ aries/trunk/jpa/itests/pom.xml Thu Apr 13 08:48:55 2017
@@ -45,7 +45,7 @@
         <serp.bundle.version>1.14.1_1</serp.bundle.version>
         <eclipselink.version>2.6.0</eclipselink.version>
         <openjpa.version>2.3.0</openjpa.version>
-        <paxjdbc.version>0.7.0</paxjdbc.version>
+        <paxjdbc.version>1.1.0</paxjdbc.version>
     </properties>
 
     <modules>



Mime
View raw message