karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [2/2] git commit: Fix FeatureTest itest
Date Sun, 24 Aug 2014 06:48:04 GMT
Fix FeatureTest itest


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

Branch: refs/heads/karaf-3.0.x
Commit: 31ace2b75e424d7a521e78f1f020779da9496542
Parents: ca2feb2
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Sun Aug 24 08:47:44 2014 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Sun Aug 24 08:47:44 2014 +0200

----------------------------------------------------------------------
 .../test/java/org/apache/karaf/itests/FeatureTest.java  | 12 +++---------
 .../java/org/apache/karaf/itests/KarafTestSupport.java  | 10 ++++++++++
 2 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/31ace2b7/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java b/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
index bb42d41..4e03220 100644
--- a/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
+++ b/itests/src/test/java/org/apache/karaf/itests/FeatureTest.java
@@ -63,16 +63,10 @@ public class FeatureTest extends KarafTestSupport {
 
     @Test
     public void installUninstallCommand() throws Exception {
-        String featureInstallOutput = executeCommand("feature:install -v eventadmin", new
RolePrincipal("admin"));
-        System.out.println(featureInstallOutput);
-        assertFalse(featureInstallOutput.isEmpty());
-        String featureListOutput = executeCommand("feature:list -i | grep eventadmin");
-        System.out.println(featureListOutput);
-        assertFalse(featureListOutput.isEmpty());
+        System.out.println(executeCommand("feature:install eventadmin", new RolePrincipal("admin")));
+        assertFeatureInstalled("eventadmin");
         System.out.println(executeCommand("feature:uninstall eventadmin", new RolePrincipal("admin")));
-        featureListOutput = executeCommand("feature:list -i | grep eventadmin");
-        System.out.println(featureListOutput);
-        assertTrue(featureListOutput.isEmpty());
+        assertFeatureNotInstalled("eventadmin");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/karaf/blob/31ace2b7/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 7636afa..e7595a1 100644
--- a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
+++ b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
@@ -355,6 +355,16 @@ public class KarafTestSupport {
         Assert.fail("Feature " + featureName + " should be installed but is not");
     }
 
+    public void assertFeatureNotInstalled(String featureName) {
+        Feature[] features = featureService.listInstalledFeatures();
+        for (Feature feature : features) {
+            if (featureName.equals(feature.getName())) {
+                Assert.fail("Feature " + featureName + " is installed whereas it should not
be");
+                return;
+            }
+        }
+    }
+
     public void assertFeaturesInstalled(String ... expectedFeatures) {
         Set<String> expectedFeaturesSet = new HashSet<String>(Arrays.asList(expectedFeatures));
         Feature[] features = featureService.listInstalledFeatures();


Mime
View raw message