You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2016/10/19 07:32:56 UTC

[1/2] karaf git commit: Improve the way features are installed / uninstalled during integration tests.

Repository: karaf
Updated Branches:
  refs/heads/master f2b5e47cd -> 42ef36477


Improve the way features are installed / uninstalled during integration tests.

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

Branch: refs/heads/master
Commit: d2b8594912f98188d0ba101e2be26d4ce0d40530
Parents: f2b5e47
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Oct 19 08:10:39 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Oct 19 09:22:21 2016 +0200

----------------------------------------------------------------------
 .../apache/karaf/itests/KarafTestSupport.java   | 36 ++++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/d2b85949/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
index 85eb928..861a38e 100644
--- a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
+++ b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
@@ -563,21 +563,21 @@ public class KarafTestSupport {
 
     protected void installAssertAndUninstallFeatures(String... feature) throws Exception {
         boolean success = false;
+        Set<String> features = new HashSet<>(Arrays.asList(feature));
     	try {
+            System.out.println("Installing " + features);
+            featureService.installFeatures(features, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
 			for (String curFeature : feature) {
-				featureService.installFeature(curFeature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
 			    assertFeatureInstalled(curFeature);
 			}
             success = true;
 		} finally {
-            for (String curFeature : feature) {
-                System.out.println("Uninstalling " + curFeature);
-                try {
-                    featureService.uninstallFeature(curFeature, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
-                } catch (Exception e) {
-                    if (success) {
-                        throw e;
-                    }
+            System.out.println("Uninstalling " + features);
+            try {
+                featureService.uninstallFeatures(features, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
+            } catch (Exception e) {
+                if (success) {
+                    throw e;
                 }
             }
 		}
@@ -590,20 +590,20 @@ public class KarafTestSupport {
      * @param featuresBefore
      * @throws Exception
      */
-	protected void uninstallNewFeatures(Set<Feature> featuresBefore)
-			throws Exception {
+	protected void uninstallNewFeatures(Set<Feature> featuresBefore) throws Exception {
 		Feature[] features = featureService.listInstalledFeatures();
+        Set<String> uninstall = new HashSet<>();
         for (Feature curFeature : features) {
 			if (!featuresBefore.contains(curFeature)) {
-				try {
-					System.out.println("Uninstalling " + curFeature.getName());
-					featureService.uninstallFeature(curFeature.getName(), curFeature.getVersion(),
-                                                    EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
-				} catch (Exception e) {
-					LOG.error(e.getMessage(), e);
-				}
+                uninstall.add(curFeature.getId());
 			}
 		}
+        try {
+            System.out.println("Uninstalling " + uninstall);
+            featureService.uninstallFeatures(uninstall, EnumSet.of(FeaturesService.Option.NoAutoRefreshBundles));
+        } catch (Exception e) {
+            LOG.error(e.getMessage(), e);
+        }
 	}
 
     protected void close(Closeable closeAble) {


[2/2] karaf git commit: [KARAF-4746][KARAF-4783] Upgrade to Pax-Web 4.4.0, Pax CDI 1.0.0.RC2

Posted by gn...@apache.org.
[KARAF-4746][KARAF-4783] Upgrade to Pax-Web 4.4.0, Pax CDI 1.0.0.RC2

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/42ef3647
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/42ef3647
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/42ef3647

Branch: refs/heads/master
Commit: 42ef364773376baf616908db6aef38e8dd000ecb
Parents: d2b8594
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Oct 19 09:32:41 2016 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Oct 19 09:32:41 2016 +0200

----------------------------------------------------------------------
 itests/pom.xml                                  | 19 ++++++
 .../itests/features/PaxCdiFeaturesTest.java     | 69 +++++---------------
 pom.xml                                         |  4 +-
 3 files changed, 37 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/42ef3647/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 6d0d4b0..c4d080f 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -54,6 +54,25 @@
             	</exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>apache-karaf-minimal</artifactId>
+            <scope>test</scope>
+            <type>tar.gz</type>
+            <exclusions>
+                <exclusion>
+                    <artifactId>org.apache.karaf.client</artifactId>
+                    <groupId>org.apache.karaf</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.cdi</groupId>
+            <artifactId>pax-cdi-features</artifactId>
+            <version>${pax.cdi.version}</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.felix</groupId>

http://git-wip-us.apache.org/repos/asf/karaf/blob/42ef3647/itests/src/test/java/org/apache/karaf/itests/features/PaxCdiFeaturesTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/features/PaxCdiFeaturesTest.java b/itests/src/test/java/org/apache/karaf/itests/features/PaxCdiFeaturesTest.java
index 6e00d90..c729322 100644
--- a/itests/src/test/java/org/apache/karaf/itests/features/PaxCdiFeaturesTest.java
+++ b/itests/src/test/java/org/apache/karaf/itests/features/PaxCdiFeaturesTest.java
@@ -15,17 +15,22 @@ package org.apache.karaf.itests.features;
 
 import org.apache.karaf.itests.KarafTestSupport;
 import org.apache.karaf.itests.util.RunIfRule;
-import org.apache.karaf.itests.util.RunIfRules.RunIfNotOnJdk8;
 
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
 public class PaxCdiFeaturesTest extends KarafTestSupport {
@@ -40,77 +45,35 @@ public class PaxCdiFeaturesTest extends KarafTestSupport {
     }
 
     @Test
-    public void installPaxCdi11Feature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.1");
-    }
-
-    @Test
-    public void installPaxCdi12Feature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.2");
-    }
-
-    @Test
     public void installPaxCdiWeldFeature() throws Exception {
         installAssertAndUninstallFeatures("pax-cdi-weld");
     }
 
     @Test
-    public void installPaxCdi11WeldFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.1-weld");
-    }
-
-    @Test
-    public void installPaxCdi12WeldFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.2-weld");
-    }
-
-    @Test
-    @Ignore("openwebbeans-spi requires javax.servlet.http in version 2.5.0, this fails")
     public void installPaxCdiOpenwebbeansFeature() throws Exception {
         installAssertAndUninstallFeatures("pax-cdi-openwebbeans");
     }
 
     @Test
-    @RunIfNotOnJdk8
     public void installPaxCdiWebFeature() throws Exception {
         installAssertAndUninstallFeatures("pax-cdi-web");
     }
 
     @Test
-    @RunIfNotOnJdk8
-    public void installPaxCdi11WebFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.1-web");
-    }
-
-    @Test
-    @RunIfNotOnJdk8
-    public void installPaxCdi12WebFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.2-web");
-    }
-
-    @Test
-    @RunIfNotOnJdk8
     public void installPaxCdiWebWeldFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-web-weld");
+        installAssertAndUninstallFeatures("pax-cdi-weld", "pax-cdi-web");
     }
 
     @Test
-    @RunIfNotOnJdk8
-    public void installPaxCdi11WebWeldFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.1-web-weld");
-    }
-
-    @Test
-    @Ignore
-    @RunIfNotOnJdk8
-    public void installPaxCdi12WebWeldFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-1.2-web-weld");
-    }
-
-    @Test
-    @RunIfNotOnJdk8
     public void installPaxCdiWebOpenwebbeansFeature() throws Exception {
-        installAssertAndUninstallFeatures("pax-cdi-web-openwebbeans");
+        installAssertAndUninstallFeatures("pax-cdi-openwebbeans", "pax-cdi-web");
     }
 
+    @Configuration
+    public Option[] config() {
+        return options(composite(
+                super.config()),
+                features(maven().groupId("org.ops4j.pax.cdi").artifactId("pax-cdi-features").versionAsInProject().type("xml").classifier("features"))
+        );
+    }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/42ef3647/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d106c5f..b03ae9d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -262,12 +262,12 @@
         <osgi.compendium.version>5.0.0</osgi.compendium.version>
         <org.json.version>20150729</org.json.version>
 
-        <pax.cdi.version>0.12.0</pax.cdi.version>
+        <pax.cdi.version>1.0.0.RC2</pax.cdi.version>
         <pax.exam.version>4.10.0-SNAPSHOT</pax.exam.version>
         <pax.logging.version>1.9.0</pax.logging.version>
         <pax.base.version>1.5.0</pax.base.version>
         <pax.url.version>2.5.0</pax.url.version>
-        <pax.web.version>4.4.0-SNAPSHOT</pax.web.version>
+        <pax.web.version>4.4.0</pax.web.version>
         <pax.tinybundle.version>2.1.1</pax.tinybundle.version>
         <pax.jdbc.version>0.9.0</pax.jdbc.version>