You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/09/26 22:26:00 UTC

svn commit: r1390716 - in /karaf/trunk/itests/src/test/java/org/apache/karaf/itests: EnterpriseFeaturesTest.java KarafTestSupport.java SpringFeaturesTest.java

Author: jbonofre
Date: Wed Sep 26 20:25:59 2012
New Revision: 1390716

URL: http://svn.apache.org/viewvc?rev=1390716&view=rev
Log:
[KARAF-1876] Use FeaturesService in Standard, Spring and Enterprises features itests

Modified:
    karaf/trunk/itests/src/test/java/org/apache/karaf/itests/EnterpriseFeaturesTest.java
    karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
    karaf/trunk/itests/src/test/java/org/apache/karaf/itests/SpringFeaturesTest.java

Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/EnterpriseFeaturesTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/EnterpriseFeaturesTest.java?rev=1390716&r1=1390715&r2=1390716&view=diff
==============================================================================
--- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/EnterpriseFeaturesTest.java (original)
+++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/EnterpriseFeaturesTest.java Wed Sep 26 20:25:59 2012
@@ -25,32 +25,29 @@ import static org.junit.Assert.assertFal
 @ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
 public class EnterpriseFeaturesTest extends KarafTestSupport {
 
+    private void installAndAssertFeature(String feature) throws Exception {
+        featureService.installFeature(feature);
+        assertFeatureInstalled(feature);
+    }
+
     @Test
     public void installTransactionFeature() throws Exception {
-        executeCommand("feature:install transaction");
-        String transactionFeatureStatus = executeCommand("feature:list -i | grep transaction");
-        assertFalse("transaction feature is not installed", transactionFeatureStatus.isEmpty());
+        installAndAssertFeature("transaction");
     }
 
     @Test
     public void installJpaFeature() throws Exception {
-        executeCommand("feature:install jpa");
-        String jpaFeatureStatus = executeCommand("feature:list -i | grep jpa");
-        assertFalse("jpa feature is not installed", jpaFeatureStatus.isEmpty());
+        installAndAssertFeature("jpa");
     }
 
     @Test
     public void installJndiFeature() throws Exception {
-        executeCommand("feature:install jndi");
-        String jndiFeatureStatus = executeCommand("feature:list -i | grep jndi");
-        assertFalse("jndi feature is not installed", jndiFeatureStatus.isEmpty());
+        installAndAssertFeature("jndi");
     }
 
     @Test
     public void installApplicationWithoutIsolationFeature() throws Exception {
-        executeCommand("feature:install application-without-isolation");
-        String applicationWithoutIsolationFeatureStatus = executeCommand("feature:list -i | grep application-without-isolation");
-        assertFalse("application-without-isolation feature is not installed", applicationWithoutIsolationFeatureStatus.isEmpty());
+        installAndAssertFeature("application-without-isolation");
     }
 
 }

Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java?rev=1390716&r1=1390715&r2=1390716&view=diff
==============================================================================
--- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java (original)
+++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java Wed Sep 26 20:25:59 2012
@@ -66,7 +66,7 @@ public class KarafTestSupport {
     @Configuration
     public Option[] config() {
         return new Option[]{
-            karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("zip"))
+            karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz"))
                     .name("Apache Karaf").unpackDirectory(new File("target/exam")),
                 keepRuntimeFolder(),
                 logLevel(LogLevelOption.LogLevel.ERROR) };

Modified: karaf/trunk/itests/src/test/java/org/apache/karaf/itests/SpringFeaturesTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/itests/src/test/java/org/apache/karaf/itests/SpringFeaturesTest.java?rev=1390716&r1=1390715&r2=1390716&view=diff
==============================================================================
--- karaf/trunk/itests/src/test/java/org/apache/karaf/itests/SpringFeaturesTest.java (original)
+++ karaf/trunk/itests/src/test/java/org/apache/karaf/itests/SpringFeaturesTest.java Wed Sep 26 20:25:59 2012
@@ -26,109 +26,84 @@ import static org.junit.Assert.assertFal
 @ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
 public class SpringFeaturesTest extends KarafTestSupport {
 
+    private void installAndAssertFeature(String feature) throws Exception {
+        featureService.installFeature(feature);
+        assertFeatureInstalled(feature);
+    }
+
     @Test
     public void installSpringFeature() throws Exception {
-        executeCommand("feature:install spring");
-        String springFeatureStatus = executeCommand("feature:list -i | grep spring");
-        assertFalse("spring feature is not installed", springFeatureStatus.isEmpty());
+        installAndAssertFeature("spring");
     }
 
     @Test
     public void installSpringAspectsFeature() throws Exception {
-        executeCommand("feature:install spring-aspects");
-        String springAspectsFeatureStatus = executeCommand("feature:list -i | grep spring-aspects");
-        assertFalse("spring-aspects feature is not installed", springAspectsFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-aspects");
     }
 
     @Test
     public void installSpringDmFeature() throws Exception {
-        executeCommand("feature:install spring-dm");
-        String springDmFeatureStatus = executeCommand("feature:list -i | grep spring-dm");
-        assertFalse("spring-dm feature is not installed", springDmFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-dm");
     }
 
     @Test
     public void installSpringDmWebFeature() throws Exception {
-        executeCommand("feature:install spring-dm-web");
-        String springDmWebFeatureStatus = executeCommand("feature:list -i | grep spring-dm-web");
-        assertFalse("spring-dm-web feature is not installed", springDmWebFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-dm-web");
     }
 
     @Test
     public void installSpringInstrumentFeature() throws Exception {
-        executeCommand("feature:install spring-instrument");
-        String springInstrumentFeatureStatus = executeCommand("feature:list -i | grep spring-instrument");
-        assertFalse("spring-instrument feature is not installed", springInstrumentFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-instrument");
     }
 
     @Test
     public void installSpringJdbcFeature() throws Exception {
-        executeCommand("feature:install spring-jdbc");
-        String springJdbcFeatureStatus = executeCommand("feature:list -i | grep spring-jdbc");
-        assertFalse("spring-jdbc feature is not installed", springJdbcFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-jdbc");
     }
 
     @Test
     public void installSpringJmsFeature() throws Exception {
-        executeCommand("feature:install spring-jms");
-        String springJmsFeatureStatus = executeCommand("feature:list -i | grep spring-jms");
-        assertFalse("spring-jms feature is not installed", springJmsFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-jms");
     }
 
     @Test
     public void installSpringStrutsFeature() throws Exception {
-        executeCommand("feature:install spring-struts");
-        String springStrutsFeatureStatus = executeCommand("feature:list -i | grep spring-struts");
-        assertFalse("spring-struts feature is not installed", springStrutsFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-struts");
     }
 
     @Test
     public void installSpringTestFeature() throws Exception {
-        executeCommand("feature:install spring-test");
-        String springTestFeatureStatus = executeCommand("feature:list -i | grep spring-test");
-        assertFalse("spring-test feature is not installed", springTestFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-test");
     }
 
     @Test
     public void installSpringOrmFeature() throws Exception {
-        executeCommand("feature:install spring-orm");
-        String springOrmFeatureStatus = executeCommand("feature:list -i | grep spring-orm");
-        assertFalse("spring-orm feature is not installed", springOrmFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-orm");
     }
 
     @Test
     public void installSpringOxmFeature() throws Exception {
-        executeCommand("feature:install spring-oxm");
-        String springOxmFeatureStatus = executeCommand("feature:list -i | grep spring-oxm");
-        assertFalse("spring-oxm feature is not installed", springOxmFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-oxm");
     }
 
     @Test
     public void installSpringTxFeature() throws Exception {
-        executeCommand("feature:install spring-tx");
-        String springTxFeatureStatus = executeCommand("feature:list -i | grep spring-tx");
-        assertFalse("spring-tx feature is not installed", springTxFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-tx");
     }
 
     @Test
     public void installSpringWebFeature() throws Exception {
-        executeCommand("feature:install spring-web");
-        String springWebFeatureStatus = executeCommand("feature:list -i | grep spring-web");
-        assertFalse("spring-web feature is not installed", springWebFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-web");
     }
 
     @Test
     public void installSpringWebPortletFeature() throws Exception {
-        executeCommand("feature:install spring-web-portlet");
-        String springWebPortletFeatureStatus = executeCommand("feature:list -i | grep spring-web-portlet");
-        assertFalse("spring-web-portlet feature is not installed", springWebPortletFeatureStatus.isEmpty());
+        installAndAssertFeature("spring-web-portlet");
     }
 
     @Test
     public void installGeminiBlueprintFeature() throws Exception {
-        executeCommand("feature:install gemini-blueprint");
-        String geminiBlueprintFeatureStatus = executeCommand("feature:list -i | grep gemini-blueprint");
-        assertFalse("gemini-blueprint feature is not installed", geminiBlueprintFeatureStatus.isEmpty());
+        installAndAssertFeature("gemini-blueprint");
     }
 
 }