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 2018/10/09 07:13:30 UTC

[karaf-cellar] branch master updated: [KARAF-5515] Add a test about wildcard

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é <jb...@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);
+    }
+
 }