You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2017/08/12 07:12:25 UTC
[03/14] karaf git commit: Cleanup test
Cleanup test
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/3b42fb5a
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/3b42fb5a
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/3b42fb5a
Branch: refs/heads/model_features
Commit: 3b42fb5a5b52ce20a7843521d5f41ff157086672
Parents: 05806fd
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Thu Aug 10 19:15:26 2017 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Thu Aug 10 19:15:26 2017 +0200
----------------------------------------------------------------------
features/core/pom.xml | 7 ++++
.../apache/karaf/features/ConditionalTest.java | 36 ++++++++------------
2 files changed, 21 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/3b42fb5a/features/core/pom.xml
----------------------------------------------------------------------
diff --git a/features/core/pom.xml b/features/core/pom.xml
index d4f5944..9e5a272 100644
--- a/features/core/pom.xml
+++ b/features/core/pom.xml
@@ -98,6 +98,13 @@
<artifactId>tinybundles</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-all</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/karaf/blob/3b42fb5a/features/core/src/test/java/org/apache/karaf/features/ConditionalTest.java
----------------------------------------------------------------------
diff --git a/features/core/src/test/java/org/apache/karaf/features/ConditionalTest.java b/features/core/src/test/java/org/apache/karaf/features/ConditionalTest.java
index b103683..aed4b3d 100644
--- a/features/core/src/test/java/org/apache/karaf/features/ConditionalTest.java
+++ b/features/core/src/test/java/org/apache/karaf/features/ConditionalTest.java
@@ -16,39 +16,31 @@
*/
package org.apache.karaf.features;
-import junit.framework.TestCase;
+import static org.hamcrest.Matchers.contains;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
import org.apache.karaf.features.internal.service.RepositoryImpl;
+import org.junit.Test;
-public class ConditionalTest extends TestCase {
+public class ConditionalTest {
+ @Test
public void testLoad() throws Exception {
RepositoryImpl r = new RepositoryImpl(getClass().getResource("internal/service/f06.xml").toURI());
- // Check repo
Feature[] features = r.getFeatures();
- assertNotNull(features);
assertEquals(1, features.length);
Feature feature = features[0];
- assertNotNull(feature.getConditional());
assertEquals(2,feature.getConditional().size());
- Conditional conditional = feature.getConditional().get(0);
- assertNotNull(conditional.getCondition());
- assertEquals(1,conditional.getCondition().size());
- String dependency = conditional.getCondition().get(0);
- assertNotNull(dependency);
- assertEquals("http", dependency);
- assertNotNull(conditional.getBundles());
- assertEquals(1, feature.getConditional().get(0).getBundles().size());
-
- conditional = feature.getConditional().get(1);
- assertNotNull(conditional.getCondition());
- assertEquals(1,conditional.getCondition().size());
- dependency = conditional.getCondition().get(0);
- assertNotNull(dependency);
- assertEquals("req:osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(!(version>=1.7)))\"", dependency);
-
- String wrapperName = "my6/1.5.3-beta-3".replaceAll("[^A-Za-z0-9 ]", "_");
+ Conditional conditional1 = feature.getConditional().get(0);
+ assertThat(conditional1.getCondition(), contains("http"));
+ assertEquals(1, conditional1.getBundles().size());
+
+ Conditional conditional2 = feature.getConditional().get(1);
+ assertThat(conditional2.getCondition(), contains("req:osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(!(version>=1.7)))\""));
}
+
}