karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf-cellar] branch master updated: [KARAF-5515] Add a test about wildcard
Date Tue, 09 Oct 2018 07:13:30 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cellar.git


The following commit(s) were added to refs/heads/master by this push:
     new d583bbe  [KARAF-5515] Add a test about wildcard
d583bbe is described below

commit d583bbe1b346bba186a8fc0e4cb0e4e7d41b4b35
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
AuthorDate: Tue Oct 9 09:13:12 2018 +0200

    [KARAF-5515] Add a test about wildcard
---
 .../apache/karaf/cellar/core/CellarSupportTest.java   | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java b/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
index 80d85b4..0c5a52c 100644
--- a/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
+++ b/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
@@ -25,11 +25,13 @@ import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
 
+import static junit.framework.TestCase.assertTrue;
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 
 public class CellarSupportTest {
 
@@ -79,4 +81,21 @@ public class CellarSupportTest {
         assertEquals("Instance config should be allowed",expectedResult,result);
     }
 
+    @Test
+    public void testBundleWildcard() {
+        CellarSupport support = new CellarSupport();
+
+        boolean test = support.wildCardMatch("this_is_a_test/1.0", "*");
+        assertTrue(test);
+
+        test = support.wildCardMatch("foo_bar", "foo*");
+        assertTrue(test);
+
+        test = support.wildCardMatch("foo_bar", "*bar");
+        assertTrue(test);
+
+        test = support.wildCardMatch("foo_bar", "hell*");
+        assertFalse(test);
+    }
+
 }


Mime
View raw message