This is an automated email from the ASF dual-hosted git repository.

tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git


The following commit(s) were added to refs/heads/master by this push:
     new 7435020  FELIX-6227 - Add configuration for path to Atomos index
     new 15495d5  Merge pull request #6 from tjwatson/FELIX-6227
7435020 is described below

commit 7435020c0a7752632102e1111b5284398e2a0595
Author: Thomas Watson <[email protected]>
AuthorDate: Thu Mar 5 11:40:40 2020 -0600

    FELIX-6227 - Add configuration for path to Atomos index
    
    Instead of using an atomos.load.index option with FIRST|IGNORE
    this change adds an option atomos.index.path that allows
    the specification of a path to the Atomos index resource.
    If set to IGNORE then no Atomos index is loaded.
    The path may begin with a '/', but is not required
    to.  The value is the path to the index resource
    and the parent path of the resource will be used
    as the relative path for all the bundle indexes
---
 .../impl/runtime/base/AtomosRuntimeBase.java       | 121 +++++++++++----------
 .../runtime/content/ConnectContentIndexed.java     |   3 +-
 .../atomos/tests/index/bundles/IndexLaunch.java    |   5 +-
 .../resources/testIndex/3/META-INF/MANIFEST.MF     |   5 +
 .../resources/testIndex/3/OSGI-INF/bundle.3-1.txt  |   1 +
 .../resources/testIndex/3/OSGI-INF/bundle.3-2.txt  |   1 +
 .../main/resources/testIndex/3/OSGI-INF/common.txt |   1 +
 .../resources/testIndex/4/META-INF/MANIFEST.MF     |   5 +
 .../resources/testIndex/4/OSGI-INF/bundle.4-1.txt  |   1 +
 .../resources/testIndex/4/OSGI-INF/bundle.4-2.txt  |   1 +
 .../main/resources/testIndex/4/OSGI-INF/common.txt |   1 +
 .../src/main/resources/testIndex/test.index        |  18 +++
 .../tests/index/bundles/IndexLaunchTest.java       | 110 ++++++++++++++++---
 13 files changed, 196 insertions(+), 77 deletions(-)

diff --git 
a/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosRuntimeBase.java
 
b/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosRuntimeBase.java
index 8ffe75b..79190e4 100644
--- 
a/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosRuntimeBase.java
+++ 
b/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosRuntimeBase.java
@@ -82,9 +82,9 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
     static final String FILE_PROTOCOL = "file";
     public static final String ATOMOS_PROP_PREFIX = "atomos.";
     public static final String ATOMOS_DEBUG_PROP = ATOMOS_PROP_PREFIX + 
"enable.debug";
-    public static final String ATOMOS_LOAD_INDEX_PROP = ATOMOS_PROP_PREFIX + 
"load.index";
-    public static final String ATOMOS_BUNDLES = "/atomos/";
-    public static final String ATOMOS_BUNDLES_INDEX = ATOMOS_BUNDLES + 
"bundles.index";
+    public static final String ATOMOS_INDEX_PATH_PROP = ATOMOS_PROP_PREFIX + 
"index.path";
+    public static final String ATOMOS_IGNORE_INDEX = "IGNORE";
+    public static final String ATOMOS_BUNDLES_INDEX_DEFAULT = 
"/atomos/bundles.index";
     public static final String ATOMOS_BUNDLE = "ATOMOS_BUNDLE";
     public static final String ATOMOS_LIB_DIR_PROP = ATOMOS_PROP_PREFIX + 
"lib.dir";
     public static final String ATOMOS_RUNTIME_CLASS_PROP = ATOMOS_PROP_PREFIX
@@ -94,7 +94,7 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
     public static final String GRAAL_NATIVE_IMAGE_KIND = 
"org.graalvm.nativeimage.kind";
 
     private final boolean DEBUG;
-    private final Index indexType;
+    private final String indexPath;
 
     private final AtomicReference<BundleContext> context = new 
AtomicReference<>();
     private final AtomicReference<File> storeRoot = new AtomicReference<>();
@@ -181,10 +181,8 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
     {
         saveConfig(config);
         DEBUG = Boolean.parseBoolean(this.config.get(ATOMOS_DEBUG_PROP));
-        String sType = config.get(ATOMOS_LOAD_INDEX_PROP);
-        indexType = sType != null ? Index.valueOf(sType)
-            : (System.getProperty(GRAAL_NATIVE_IMAGE_KIND) != null ? 
Index.FIRST
-                : Index.IGNORE);
+        indexPath = getIndexPath(this.config.get(ATOMOS_INDEX_PATH_PROP));
+
         try
         {
             // substrate native image does not run shutdown hooks on ctrl-c
@@ -197,6 +195,19 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
         }
     }
 
+    private String getIndexPath(String indexPath)
+    {
+        if (indexPath == null)
+        {
+            indexPath = ATOMOS_BUNDLES_INDEX_DEFAULT;
+        }
+        else if (!ATOMOS_IGNORE_INDEX.equals(indexPath) && 
!indexPath.startsWith("/"))
+        {
+            indexPath = "/" + indexPath;
+        }
+        return indexPath;
+    }
+
     protected final void lockWrite()
     {
         lock.writeLock().lock();
@@ -731,9 +742,9 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
 
         private void findAtomosIndexedContents(Set<AtomosContentBase> 
bootBundles)
         {
-            URL index = Index.FIRST == indexType
-                ? getClass().getResource(ATOMOS_BUNDLES_INDEX)
-                : null;
+            URL index = ATOMOS_IGNORE_INDEX.equals(indexPath)
+                ? null
+                : getClass().getResource(indexPath);
             debug("Atomos index url: %s", index);
             if (index != null)
             {
@@ -802,10 +813,24 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
             }
         }
 
+        private AtomosContentIndexed createIndexedContent(String indexRoot,
+            String currentIndex,
+            String currentBSN, Version currentVersion, List<String> 
currentPaths)
+        {
+            String bundleIndexPath = indexRoot + currentIndex;
+            ConnectContentIndexed content = new 
ConnectContentIndexed(bundleIndexPath,
+                currentPaths);
+            debug("Found indexed content: %s %s %s %s", currentIndex, 
currentBSN,
+                currentVersion, currentPaths);
+            return new AtomosContentIndexed(getIndexedLocation(content, 
currentBSN),
+                currentBSN, currentVersion, content);
+        }
+
         private void findAtomosIndexedContent(URL index,
             Set<AtomosContentBase> bootBundles)
         {
-
+            final String indexRoot = indexPath.substring(0,
+                indexPath.lastIndexOf('/') + 1);
             try (BufferedReader reader = new BufferedReader(
                 new InputStreamReader(index.openStream())))
             {
@@ -814,58 +839,42 @@ public abstract class AtomosRuntimeBase implements 
AtomosRuntime, SynchronousBun
                 Version currentVersion = null;
                 List<String> currentPaths = null;
                 String line = reader.readLine();
-                if (line != null)
+                while (ATOMOS_BUNDLE.equals(line))
                 {
-                    do
+                    if (currentIndex != null)
                     {
-                        if (ATOMOS_BUNDLE.equals(line))
+                        bootBundles.add(createIndexedContent(indexRoot, 
currentIndex,
+                            currentBSN, currentVersion, currentPaths));
+                    }
+                    currentIndex = null;
+                    currentBSN = null;
+                    currentVersion = null;
+                    currentPaths = new ArrayList<>();
+                    while ((line = reader.readLine()) != null
+                        && !ATOMOS_BUNDLE.equals(line))
+                    {
+                        if (currentIndex == null)
                         {
-                            if (currentIndex != null)
-                            {
-                                ConnectContentIndexed content = new 
ConnectContentIndexed(
-                                    currentIndex, currentPaths);
-                                bootBundles.add(new AtomosContentIndexed(
-                                    getIndexedLocation(content, currentBSN), 
currentBSN,
-                                    currentVersion, content));
-                                debug("Found indexed content: %s %s %s %s", 
currentIndex,
-                                    currentBSN, currentVersion, currentPaths);
-                            }
-                            currentIndex = null;
-                            currentBSN = null;
-                            currentVersion = null;
-                            currentPaths = new ArrayList<>();
+                            currentIndex = line;
+                        }
+                        else if (currentBSN == null)
+                        {
+                            currentBSN = line;
+                        }
+                        else if (currentVersion == null)
+                        {
+                            currentVersion = Version.valueOf(line);
                         }
                         else
                         {
-                            if (currentIndex == null)
-                            {
-                                currentIndex = line;
-                            }
-                            else if (currentBSN == null)
-                            {
-                                currentBSN = line;
-                            }
-                            else if (currentVersion == null)
-                            {
-                                currentVersion = Version.valueOf(line);
-                            }
-                            else
-                            {
-                                currentPaths.add(line);
-                            }
+                            currentPaths.add(line);
                         }
                     }
-                    while ((line = reader.readLine()) != null);
-                    if (currentIndex != null)
-                    {
-                        ConnectContentIndexed content = new 
ConnectContentIndexed(
-                            currentIndex, currentPaths);
-                        bootBundles.add(new AtomosContentIndexed(
-                            getIndexedLocation(content, currentBSN), 
currentBSN,
-                            currentVersion, content));
-                        debug("Found indexed content: %s %s %s %s", 
currentIndex,
-                            currentBSN, currentVersion, currentPaths);
-                    }
+                }
+                if (currentIndex != null)
+                {
+                    bootBundles.add(createIndexedContent(indexRoot, 
currentIndex,
+                        currentBSN, currentVersion, currentPaths));
                 }
             }
             catch (IOException e)
diff --git 
a/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/content/ConnectContentIndexed.java
 
b/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/content/ConnectContentIndexed.java
index 4f8701a..368284d 100644
--- 
a/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/content/ConnectContentIndexed.java
+++ 
b/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/content/ConnectContentIndexed.java
@@ -23,7 +23,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 
-import org.apache.felix.atomos.impl.runtime.base.AtomosRuntimeBase;
 import org.osgi.framework.connect.ConnectContent;
 
 public class ConnectContentIndexed implements ConnectContent
@@ -106,7 +105,7 @@ public class ConnectContentIndexed implements ConnectContent
         if (entries.contains(name))
         {
             URL resource = getClass().getResource(
-                AtomosRuntimeBase.ATOMOS_BUNDLES + index + '/' + name);
+                index + '/' + name);
             if (resource != null)
             {
                 return Optional.of(new URLConnectEntry(name, resource));
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunch.java
 
b/atomos.tests/atomos.tests.index.bundles/src/main/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunch.java
index 43bd322..406eac4 100644
--- 
a/atomos.tests/atomos.tests.index.bundles/src/main/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunch.java
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/java/org/apache/felix/atomos/tests/index/bundles/IndexLaunch.java
@@ -16,7 +16,6 @@ package org.apache.felix.atomos.tests.index.bundles;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.felix.atomos.impl.runtime.base.AtomosRuntimeBase;
 import org.apache.felix.atomos.launch.AtomosLauncher;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.launch.Framework;
@@ -25,12 +24,10 @@ public class IndexLaunch
 {
     private static volatile Framework framework;
 
-    public static void main(String[] args) throws BundleException
+    public static void main(String... args) throws BundleException
     {
         long start = System.nanoTime();
         Map<String, String> config = AtomosLauncher.getConfiguration(args);
-        config.put(AtomosRuntimeBase.ATOMOS_LOAD_INDEX_PROP,
-            AtomosRuntimeBase.Index.FIRST.toString());
         framework = AtomosLauncher.launch(config);
         long total = System.nanoTime() - start;
         System.out.println("Total time: " + 
TimeUnit.NANOSECONDS.toMillis(total));
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/META-INF/MANIFEST.MF
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..be4e3d3
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: bundle.3
+Bundle-Version: 1.0.0
+Bundle-Activator: 
org.apache.felix.atomos.tests.index.bundles.b3.ActivatorBundle3
+
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/bundle.3-1.txt
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/bundle.3-1.txt
new file mode 100644
index 0000000..e440e5c
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/bundle.3-1.txt
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/bundle.3-2.txt
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/bundle.3-2.txt
new file mode 100644
index 0000000..e440e5c
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/bundle.3-2.txt
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/common.txt
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/common.txt
new file mode 100644
index 0000000..e440e5c
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/3/OSGI-INF/common.txt
@@ -0,0 +1 @@
+3
\ No newline at end of file
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/META-INF/MANIFEST.MF
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..312a37b
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/META-INF/MANIFEST.MF
@@ -0,0 +1,5 @@
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: bundle.4
+Bundle-Version: 1.0.0
+Bundle-Activator: 
org.apache.felix.atomos.tests.index.bundles.b4.ActivatorBundle4
+
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/bundle.4-1.txt
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/bundle.4-1.txt
new file mode 100644
index 0000000..bf0d87a
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/bundle.4-1.txt
@@ -0,0 +1 @@
+4
\ No newline at end of file
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/bundle.4-2.txt
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/bundle.4-2.txt
new file mode 100644
index 0000000..bf0d87a
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/bundle.4-2.txt
@@ -0,0 +1 @@
+4
\ No newline at end of file
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/common.txt
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/common.txt
new file mode 100644
index 0000000..bf0d87a
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/4/OSGI-INF/common.txt
@@ -0,0 +1 @@
+4
\ No newline at end of file
diff --git 
a/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/test.index
 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/test.index
new file mode 100644
index 0000000..3fe7e33
--- /dev/null
+++ 
b/atomos.tests/atomos.tests.index.bundles/src/main/resources/testIndex/test.index
@@ -0,0 +1,18 @@
+ATOMOS_BUNDLE
+3
+bundle.3
+1.0.0
+META-INF/MANIFEST.MF
+OSGI-INF/common.txt
+OSGI-INF/bundle.3-1.txt
+OSGI-INF/bundle.3-2.txt
+org/apache/felix/atomos/tests/index/bundles/b3/
+ATOMOS_BUNDLE
+4
+bundle.4
+1.0.0
+META-INF/MANIFEST.MF
+OSGI-INF/common.txt
+OSGI-INF/bundle.4-1.txt
+OSGI-INF/bundle.4-2.txt
+org/apache/felix/atomos/tests/index/bundles/b4/
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 d00bd33..9070688 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
@@ -24,8 +24,10 @@ import java.io.InputStreamReader;
 import java.net.URL;
 import java.nio.file.Path;
 import java.util.Collection;
+import java.util.List;
 import java.util.Optional;
 
+import org.apache.felix.atomos.impl.runtime.base.AtomosRuntimeBase;
 import org.apache.felix.atomos.runtime.AtomosContent;
 import org.apache.felix.atomos.runtime.AtomosLayer;
 import org.apache.felix.atomos.runtime.AtomosRuntime;
@@ -68,14 +70,28 @@ public class IndexLaunchTest
         return runtime;
     }
 
+    private Framework getTestFramework(Path storage, String indexPath)
+        throws BundleException
+    {
+        if (indexPath == null)
+        {
+            IndexLaunch.main(
+                Constants.FRAMEWORK_STORAGE + '=' + 
storage.toFile().getAbsolutePath());
+        }
+        else
+        {
+            IndexLaunch.main(
+                Constants.FRAMEWORK_STORAGE + '=' + 
storage.toFile().getAbsolutePath(),
+                AtomosRuntimeBase.ATOMOS_INDEX_PATH_PROP + '=' + indexPath);
+        }
+        return IndexLaunch.getFramework();
+    }
+
     @Test
-    void testFindBundle(@TempDir Path storage) throws BundleException
+    void testIgnoreIndex(@TempDir Path storage) throws BundleException
     {
-        IndexLaunch.main(new String[] {
-                Constants.FRAMEWORK_STORAGE + '=' + 
storage.toFile().getAbsolutePath() });
-        testFramework = IndexLaunch.getFramework();
+        testFramework = getTestFramework(storage, 
AtomosRuntimeBase.ATOMOS_IGNORE_INDEX);
         BundleContext bc = testFramework.getBundleContext();
-        assertNotNull(bc, "No context found.");
 
         AtomosRuntime runtime = getRuntime(bc);
         assertFindBundle("java.base", runtime.getBootLayer(), 
runtime.getBootLayer(),
@@ -83,25 +99,78 @@ public class IndexLaunchTest
         assertFindBundle(TESTBUNDLES_SERVICE_IMPL, runtime.getBootLayer(),
             runtime.getBootLayer(), true);
 
+        // the default indexed bundles should not be found
         for (int i = 1; i <= 4; i++)
         {
             assertFindBundle(INDEX_BSN_PREFIX + i, runtime.getBootLayer(),
+                runtime.getBootLayer(), false);
+        }
+    }
+
+    @Test
+    void testFindBundleDefault(@TempDir Path storage) throws BundleException
+    {
+        doTestFindBundle(storage, null, List.of(1, 2, 3, 4), List.of());
+    }
+
+    @Test
+    void testFindBundleTestIndex(@TempDir Path storage) throws BundleException
+    {
+        doTestFindBundle(storage, "/testIndex/test.index", List.of(3, 4), 
List.of(1, 2));
+    }
+
+    void doTestFindBundle(@TempDir Path storage, String indexPath,
+        Collection<Integer> expected,
+        Collection<Integer> unexpected)
+        throws BundleException
+    {
+        testFramework = getTestFramework(storage, indexPath);
+        BundleContext bc = testFramework.getBundleContext();
+        assertNotNull(bc, "No context found.");
+
+        AtomosRuntime runtime = getRuntime(bc);
+        assertFindBundle("java.base", runtime.getBootLayer(), 
runtime.getBootLayer(),
+            true);
+        assertFindBundle(TESTBUNDLES_SERVICE_IMPL, runtime.getBootLayer(),
+            runtime.getBootLayer(), true);
+
+        for (int i : expected)
+        {
+            assertFindBundle(INDEX_BSN_PREFIX + i, runtime.getBootLayer(),
                 runtime.getBootLayer(), true);
         }
+        for (int i : unexpected)
+        {
+            assertFindBundle(INDEX_BSN_PREFIX + i, runtime.getBootLayer(),
+                runtime.getBootLayer(), false);
+        }
         assertFindBundle("not.found", runtime.getBootLayer(), null, false);
     }
 
     @Test
-    void testActivatorService(@TempDir Path storage)
+    void testActivatorServiceDefault(
+        @TempDir Path storage)
+        throws BundleException, InvalidSyntaxException
+    {
+        doTestActivatorService(storage, null, 1, 2, 3, 4);
+    }
+
+    @Test
+    void testActivatorServiceTestIndex(@TempDir Path storage)
         throws BundleException, InvalidSyntaxException
     {
-        IndexLaunch.main(new String[] {
-                Constants.FRAMEWORK_STORAGE + '=' + 
storage.toFile().getAbsolutePath() });
-        testFramework = IndexLaunch.getFramework();
+        doTestActivatorService(storage, "testIndex/test.index", 3, 4);
+    }
+
+    void doTestActivatorService(@TempDir Path storage, String indexPath,
+        int... expected)
+        throws BundleException, InvalidSyntaxException
+    {
+        testFramework = getTestFramework(storage, indexPath);
         BundleContext bc = testFramework.getBundleContext();
         assertNotNull(bc, "No context found.");
 
-        for (int i = 1; i <= 4; i++)
+        for (int i : expected)
         {
             assertFindActivatorService(bc, i);
         }
@@ -118,11 +187,22 @@ public class IndexLaunchTest
     }
 
     @Test
-    void testGetEntry(@TempDir Path storage) throws BundleException, 
IOException
+    void testGetEntryDefault(@TempDir Path storage) throws BundleException, 
IOException
     {
-        IndexLaunch.main(new String[] {
-                Constants.FRAMEWORK_STORAGE + '=' + 
storage.toFile().getAbsolutePath() });
-        testFramework = IndexLaunch.getFramework();
+        doTestGetEntry(storage, null, 1, 2, 3, 4);
+    }
+
+    @Test
+    void testGetEntryTestIndex(@TempDir Path storage) throws BundleException, 
IOException
+    {
+        doTestGetEntry(storage, "testIndex/test.index", 3, 4);
+    }
+
+    void doTestGetEntry(@TempDir Path storage, String indexPath,
+        int... expected)
+        throws BundleException, IOException
+    {
+        testFramework = getTestFramework(storage, indexPath);
         BundleContext bc = testFramework.getBundleContext();
         assertNotNull(bc, "No context found.");
 
@@ -134,7 +214,7 @@ public class IndexLaunchTest
         URL mf = b.getEntry("/META-INF/MANIFEST.MF");
         assertNotNull(mf, "No manifest found.");
 
-        for (int i = 1; i <= 4; i++)
+        for (int i : expected)
         {
             AtomosContent content = runtime.getBootLayer().findAtomosContent(
                 "bundle." + i).get();

Reply via email to