commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [commons-compress] branch master updated: COMPRESS-498 ensure the bundle name doesn't change without notice
Date Sun, 29 Dec 2019 18:16:30 GMT
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 672fe1d  COMPRESS-498 ensure the bundle name doesn't change without notice
672fe1d is described below

commit 672fe1d006430a1526e4fb81b6b7476c76b7d028
Author: Stefan Bodewig <bodewig@apache.org>
AuthorDate: Sun Dec 29 19:15:41 2019 +0100

    COMPRESS-498 ensure the bundle name doesn't change without notice
---
 .../org/apache/commons/compress/OsgiITest.java     | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/test/java/org/apache/commons/compress/OsgiITest.java b/src/test/java/org/apache/commons/compress/OsgiITest.java
index fe13d71..2e9a07a 100644
--- a/src/test/java/org/apache/commons/compress/OsgiITest.java
+++ b/src/test/java/org/apache/commons/compress/OsgiITest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.commons.compress;
 
+import static org.junit.Assert.assertTrue;
 import static org.ops4j.pax.exam.CoreOptions.bundle;
 import static org.ops4j.pax.exam.CoreOptions.composite;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -28,10 +29,19 @@ import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+import javax.inject.Inject;
 
 @RunWith(PaxExam.class)
 public class OsgiITest {
 
+    private static final String EXPECTED_BUNDLE_NAME = "org.apache.commons.commons-compress";
+
+    @Inject
+    private BundleContext ctx;
+
     @Configuration
     public Option[] config() {
         return new Option[] {
@@ -51,5 +61,18 @@ public class OsgiITest {
 
     @Test
     public void loadBundle() {
+        final StringBuilder bundles = new StringBuilder();
+        boolean foundCompressBundle = false, first = true;
+        for (final Bundle b : ctx.getBundles()) {
+            final String symbolicName = b.getSymbolicName();
+            foundCompressBundle |= EXPECTED_BUNDLE_NAME.equals(symbolicName);
+            if (!first) {
+                bundles.append(", ");
+            }
+            first = false;
+            bundles.append(symbolicName);
+        }
+        assertTrue("Expected to find bundle " + EXPECTED_BUNDLE_NAME + " in " + bundles,
+            foundCompressBundle);
     }
 }


Mime
View raw message