Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3CF29200C55 for ; Thu, 13 Apr 2017 10:49:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3B8B7160B98; Thu, 13 Apr 2017 08:49:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0E696160B8B for ; Thu, 13 Apr 2017 10:48:59 +0200 (CEST) Received: (qmail 92641 invoked by uid 500); 13 Apr 2017 08:48:57 -0000 Mailing-List: contact commits-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list commits@aries.apache.org Received: (qmail 92630 invoked by uid 99); 13 Apr 2017 08:48:57 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 08:48:57 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id AF6173A0C86 for ; Thu, 13 Apr 2017 08:48:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@aries.apache.org From: cschneider@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170413084856.AF6173A0C86@svn01-us-west.apache.org> archived-at: Thu, 13 Apr 2017 08:49:01 -0000 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 @@ org.ops4j.pax.exam + pax-exam-cm + ${exam.version} + test + + + org.ops4j.pax.exam pax-exam ${exam.version} test @@ -383,7 +389,7 @@ org.ops4j.pax.tinybundles tinybundles - 2.0.0 + 2.1.1 org.osgi.core 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 props = new HashMap(); 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 props = new HashMap(); - //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 props = new Hashtable(); - 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 props = new Hashtable(); - 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 @@ Test persistence unit for the JPA Container and Context iTests - osgi:service/javax.sql.DataSource + osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=testds) @@ -43,10 +43,9 @@ Test persistence unit for the JPA Container advanced iTests + + osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=testdsxa) - - - @@ -76,7 +75,8 @@ Test persistence unit for the JPA Container DataSourceFactory iTests - + + 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 @@ 1.14.1_1 2.6.0 2.3.0 - 0.7.0 + 1.1.0