aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1776938 - in /aries/trunk/jpa/itests: ./ jpa-container-itest-karaf/ jpa-container-itest-karaf/src/test/java/org/apache/aries/jpa/itest/karaf/ jpa-container-itest-karaf/src/test/resources/
Date Mon, 02 Jan 2017 14:31:00 GMT
Author: cschneider
Date: Mon Jan  2 14:31:00 2017
New Revision: 1776938

URL: http://svn.apache.org/viewvc?rev=1776938&view=rev
Log:
[ARIES-1497] Update to new versions. Simpler config handling

Added:
    aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/resources/org.ops4j.pax.logging.cfg
Modified:
    aries/trunk/jpa/itests/jpa-container-itest-karaf/pom.xml
    aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/java/org/apache/aries/jpa/itest/karaf/AbstractJPAItest.java
    aries/trunk/jpa/itests/pom.xml

Modified: aries/trunk/jpa/itests/jpa-container-itest-karaf/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest-karaf/pom.xml?rev=1776938&r1=1776937&r2=1776938&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest-karaf/pom.xml (original)
+++ aries/trunk/jpa/itests/jpa-container-itest-karaf/pom.xml Mon Jan  2 14:31:00 2017
@@ -34,6 +34,7 @@
     
     <properties>
         <baseline.skip>true</baseline.skip>
+        <karaf.version>4.0.8</karaf.version>
     </properties>
 
     <dependencies>
@@ -55,7 +56,6 @@
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-atinject_1.0_spec</artifactId>
-            <version>1.0</version>
             <scope>test</scope>
         </dependency>  
 
@@ -82,7 +82,7 @@
         <dependency>
             <groupId>org.apache.karaf.features</groupId>
             <artifactId>enterprise</artifactId>
-            <version>4.0.1</version>
+            <version>${karaf.version}</version>
             <type>xml</type>
             <classifier>features</classifier>
             <scope>test</scope>

Modified: aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/java/org/apache/aries/jpa/itest/karaf/AbstractJPAItest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/java/org/apache/aries/jpa/itest/karaf/AbstractJPAItest.java?rev=1776938&r1=1776937&r2=1776938&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/java/org/apache/aries/jpa/itest/karaf/AbstractJPAItest.java
(original)
+++ aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/java/org/apache/aries/jpa/itest/karaf/AbstractJPAItest.java
Mon Jan  2 14:31:00 2017
@@ -17,22 +17,21 @@ package org.apache.aries.jpa.itest.karaf
 
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+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.karaf.options.KarafDistributionOption.configureSecurity;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.replaceConfigurationFile;
 
 import java.io.File;
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
 
 import javax.inject.Inject;
 
-import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
@@ -49,30 +48,16 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
-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);
+    private static final String DS_CONFIG = "etc/org.ops4j.datasource-tasklist.cfg";
 
-    /*
-     *  The @Inject annotations below currently do not work as the transaction-api/1.2 feature
installs an atinject bundle that 
-     *  confuses pax exam. As a workaround the services are set below in the @Before method
-     */
-    
-    @Inject
-    BundleContext bundleContext;
-    
     @Inject
-    ConfigurationAdmin configAdmin;
-    
-    private static Configuration config;
+    private BundleContext bundleContext;
     
     /**
      * Helps to diagnose bundles that are not resolved as it will throw a detailed exception
@@ -137,7 +122,7 @@ public abstract class AbstractJPAItest {
         if (localRepo == null) {
             localRepo = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
         }
-        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").version("4.0.1").type("tar.gz");
+        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").version("4.0.8").type("tar.gz");
         UrlReference enterpriseFeatureUrl = maven().groupId("org.apache.karaf.features").artifactId("enterprise").versionAsInProject().type("xml").classifier("features");
         UrlReference jpaFeatureUrl = maven().groupId("org.apache.aries.jpa").artifactId("jpa-features").versionAsInProject().type("xml").classifier("features");
         UrlReference paxJdbcFeatureUrl = maven().groupId("org.ops4j.pax.jdbc").artifactId("pax-jdbc-features").version("0.7.0").type("xml").classifier("features");
@@ -145,50 +130,20 @@ public abstract class AbstractJPAItest {
             //KarafDistributionOption.debugConfiguration("8000", true),
             karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new
File("target/exam")).useDeployFolder(false),
             configureSecurity().disableKarafMBeanServerBuilder(),
+            systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
             keepRuntimeFolder(),
             logLevel(LogLevel.INFO),
             when(localRepo != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository="
+ localRepo)),
             features(paxJdbcFeatureUrl, "pax-jdbc-config", "pax-jdbc-h2", "pax-jdbc-pool-dbcp2"),
             features(enterpriseFeatureUrl, "transaction", "http-whiteboard", "hibernate/4.3.6.Final",
"scr"),
             features(jpaFeatureUrl, "jpa"),
-            mavenBundle("org.apache.aries.jpa.example", "org.apache.aries.jpa.example.tasklist.model").versionAsInProject()
+            mavenBundle("org.apache.aries.jpa.example", "org.apache.aries.jpa.example.tasklist.model").versionAsInProject(),
+            editConfigurationFilePut(DS_CONFIG, DataSourceFactory.OSGI_JDBC_DRIVER_NAME,
"H2-pool-xa"),
+            editConfigurationFilePut(DS_CONFIG, DataSourceFactory.JDBC_DATABASE_NAME, "tasklist;create=true"),
+            editConfigurationFilePut(DS_CONFIG, DataSourceFactory.JDBC_DATASOURCE_NAME, "tasklist"),
+            replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", new File("src/test/resources/org.ops4j.pax.logging.cfg"))
 //            replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", getConfigFile("/etc/org.ops4j.pax.logging.cfg")),
         );
-
-    }
-
-    @Before
-    public void createConfigs() throws Exception {
-        if (config == null) {
-            bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
-            configAdmin = getService(ConfigurationAdmin.class, null);
-            createConfigForLogging();
-            createConfigForDS();
-
-        }
-    }
-
-    private void createConfigForDS() throws IOException {
-        config = configAdmin.createFactoryConfiguration("org.ops4j.datasource", null);
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put(DataSourceFactory.OSGI_JDBC_DRIVER_NAME, "H2-pool-xa");
-        props.put(DataSourceFactory.JDBC_DATABASE_NAME, "tasklist;create=true");
-        props.put(DataSourceFactory.JDBC_DATASOURCE_NAME, "tasklist");
-        config.update(props);
-        LOG.info("Created DataSource config tasklist");
-    }
-    
-    private 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-karaf/src/test/resources/org.ops4j.pax.logging.cfg
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/resources/org.ops4j.pax.logging.cfg?rev=1776938&view=auto
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/resources/org.ops4j.pax.logging.cfg
(added)
+++ aries/trunk/jpa/itests/jpa-container-itest-karaf/src/test/resources/org.ops4j.pax.logging.cfg
Mon Jan  2 14:31:00 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/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/pom.xml?rev=1776938&r1=1776937&r2=1776938&view=diff
==============================================================================
--- aries/trunk/jpa/itests/pom.xml (original)
+++ aries/trunk/jpa/itests/pom.xml Mon Jan  2 14:31:00 2017
@@ -35,10 +35,10 @@
     
     <properties>
         <paxlogging.version>1.7.3</paxlogging.version>
-        <exam.version>4.6.0</exam.version>
+        <exam.version>4.9.1</exam.version>
         <url.version>1.6.0</url.version>
         <hibernate42.version>4.2.15.Final</hibernate42.version>
-        <hibernate43.version>4.2.15.Final</hibernate43.version>
+        <hibernate43.version>4.4.9</hibernate43.version>
         <ant.bundle.version>1.8.2_2</ant.bundle.version>
         <antlr.bundle.version>2.7.7_5</antlr.bundle.version>
         <dom4j.bundle.version>1.6.1_5</dom4j.bundle.version>



Mime
View raw message