diff --git a/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunchTest.java b/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunchTest.java index 80fe0003..c20240e8 100644 --- a/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunchTest.java +++ b/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunchTest.java @@ -26,6 +26,7 @@ import java.net.URL; import java.nio.file.Path; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,11 +49,17 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; import org.osgi.framework.Constants; +import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.framework.Version; import org.osgi.framework.launch.Framework; +import org.osgi.framework.namespace.PackageNamespace; import org.osgi.framework.wiring.BundleWiring; +import org.osgi.framework.wiring.FrameworkWiring; +import org.osgi.resource.Namespace; +import org.osgi.resource.Requirement; +import org.osgi.resource.Resource; public class IndexLaunchTest { @@ -305,6 +312,14 @@ void doTestFindEntries(@TempDir Path storage, String indexPath, } } + @Test + void testEmptyDirectoryPackages(@TempDir Path storage) throws BundleException { + testFramework = getTestFramework(storage, null); + Bundle b3 = FrameworkUtil.getBundle(TestClass.class); + assertNotNull(b3, "no bundle found."); + assertEquals("bundle.3", b3.getSymbolicName(), "Wrong BSN"); + } + private void assertContent(String expected, URL url) throws IOException { try (BufferedReader br = new BufferedReader( diff --git a/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/TestClass.java b/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/TestClass.java new file mode 100644 index 00000000..432ce92f --- /dev/null +++ b/atomos.tests/atomos.tests.index.bundles/src/test/java/org/apache/felix/atomos/tests/index/bundles/TestClass.java @@ -0,0 +1,18 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.felix.atomos.tests.index.bundles; + +public class TestClass { + // nothing needed here; just need a class to load +} diff --git a/atomos.tests/atomos.tests.index.bundles/src/test/resources/atomos/bundles.index b/atomos.tests/atomos.tests.index.bundles/src/test/resources/atomos/bundles.index index cb46df9d..2bc088c6 100644 --- a/atomos.tests/atomos.tests.index.bundles/src/test/resources/atomos/bundles.index +++ b/atomos.tests/atomos.tests.index.bundles/src/test/resources/atomos/bundles.index @@ -53,6 +53,7 @@ org/apache/felix/atomos/ org/apache/felix/atomos/tests/ org/apache/felix/atomos/tests/index/ org/apache/felix/atomos/tests/index/bundles/ +org/apache/felix/atomos/tests/index/bundles/TestClass.java org/apache/felix/atomos/tests/index/bundles/b3/ org/apache/felix/atomos/tests/index/bundles/b3/ActivatorBundle3.class ATOMOS_BUNDLE