cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [1/2] cxf git commit: Improve test setup
Date Wed, 26 Apr 2017 07:32:42 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 7298cc60e -> 44b4f1b51


Improve test setup


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/048051f3
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/048051f3
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/048051f3

Branch: refs/heads/master
Commit: 048051f3987838eb9fc7e6b50bc80e3e750b6980
Parents: 7298cc6
Author: Christian Schneider <chris@die-schneider.net>
Authored: Wed Apr 26 09:09:05 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Wed Apr 26 09:09:05 2017 +0200

----------------------------------------------------------------------
 .../osgi/itests/BundlesAndNamespacesTest.java   |  6 +--
 .../cxf/osgi/itests/CXFOSGiTestSupport.java     | 39 +-------------------
 2 files changed, 5 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/048051f3/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
----------------------------------------------------------------------
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
index a93f745..7a85f43 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/BundlesAndNamespacesTest.java
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.osgi.itests;
 
-
+import java.io.File;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -28,11 +28,11 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
+
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.replaceConfigurationFile;
 
-
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
 public class BundlesAndNamespacesTest extends CXFOSGiTestSupport {
@@ -56,7 +56,7 @@ public class BundlesAndNamespacesTest extends CXFOSGiTestSupport {
         return new Option[]{
                 cxfBaseConfig(),
                 replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg",
-                    getConfigFile("/etc/org.ops4j.pax.logging.cfg")),
+                                         new File("src/test/resources/etc/org.ops4j.pax.logging.cfg")),
                 features(cxfUrl, "cxf-core", "cxf-jaxws"),
                 logLevel(LogLevel.INFO)};
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/048051f3/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
----------------------------------------------------------------------
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
index 5ebd000..4a5d107 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
@@ -23,11 +23,8 @@ package org.apache.cxf.osgi.itests;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.DatagramSocket;
 import java.net.ServerSocket;
-import java.net.URL;
-import java.util.Properties;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -35,13 +32,11 @@ import javax.inject.Inject;
 
 import org.apache.karaf.features.FeaturesService;
 import org.junit.Assert;
+import org.ops4j.pax.exam.MavenUtils;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.ProbeBuilder;
-import org.ops4j.pax.exam.TestProbeBuilder;
 import org.ops4j.pax.exam.options.MavenUrlReference;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.util.tracker.ServiceTracker;
 import static org.ops4j.pax.exam.CoreOptions.composite;
@@ -56,7 +51,6 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDist
  *
  */
 public class CXFOSGiTestSupport {
-    private static final String MAVEN_DEPENDENCIES_PROPERTIES = "/META-INF/maven/dependencies.properties";
 
     @Inject
     protected BundleContext bundleContext;
@@ -69,26 +63,8 @@ public class CXFOSGiTestSupport {
     protected MavenUrlReference cxfUrl;
     protected MavenUrlReference karafUrl;
 
-    /**
-     * @param probe
-     * @return
-     */
-    @ProbeBuilder
-    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
-        probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
-        return probe;
-    }
-
-    public File getConfigFile(String path) {
-        URL res = this.getClass().getResource(path);
-        if (res == null) {
-            throw new RuntimeException("Config resource " + path + " not found");
-        }
-        return new File(res.getFile());
-    }
-
     private static String getKarafVersion() {
-        String karafVersion = getVersionFromPom("org.apache.karaf/apache-karaf/version");
+        String karafVersion = MavenUtils.getArtifactVersion("org.apache.karaf", "apache-karaf");
         if (karafVersion == null) {
             karafVersion = System.getProperty("cxf.karaf.version");
         }
@@ -102,17 +78,6 @@ public class CXFOSGiTestSupport {
         return karafVersion;
     }
 
-    private static String getVersionFromPom(String key) {
-        try {
-            InputStream ins = CXFOSGiTestSupport.class.getResourceAsStream(MAVEN_DEPENDENCIES_PROPERTIES);
-            Properties p = new Properties();
-            p.load(ins);
-            return p.getProperty(key);
-        } catch (Throwable t) {
-            throw new IllegalStateException(MAVEN_DEPENDENCIES_PROPERTIES + " can not be
found", t);
-        }
-    }
-
     /**
      * Create an {@link org.ops4j.pax.exam.Option} for using a .
      *


Mime
View raw message