Fix TestJettyOSGiAnnotationParser.

This commit is contained in:
Jan Bartel 2020-07-08 16:33:14 +02:00
parent c716edd7a2
commit f4f85fed44
2 changed files with 10 additions and 12 deletions

View File

@ -73,7 +73,6 @@
<groupId>org.ops4j.pax.tinybundles</groupId>
<artifactId>tinybundles</artifactId>
<version>3.0.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>biz.aQute.bnd</groupId>

View File

@ -20,6 +20,7 @@ package org.eclipse.jetty.osgi.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
@ -58,20 +59,13 @@ public class TestJettyOSGiAnnotationParser
BundleContext bundleContext = null;
@Configuration
public static Option[] configure()
public static Option[] configure() throws IOException
{
ArrayList<Option> options = new ArrayList<>();
options.add(TestOSGiUtil.optionalRemoteDebug());
options.add(CoreOptions.junitBundles());
options.addAll(TestOSGiUtil.coreJettyDependencies());
options.add(mavenBundle().groupId("biz.aQute.bnd").artifactId("bndlib").versionAsInProject().start());
options.add(mavenBundle().groupId("org.ops4j.pax.tinybundles").artifactId("tinybundles").version("2.1.1").start());
return options.toArray(new Option[options.size()]);
}
@Test
public void testParse() throws Exception
{
//get a reference to a pre-prepared module-info
Path path = Paths.get("src", "test", "resources", "module-info.clazz");
File moduleInfo = path.toFile();
@ -80,8 +74,13 @@ public class TestJettyOSGiAnnotationParser
TinyBundle bundle = TinyBundles.bundle();
bundle.set(Constants.BUNDLE_SYMBOLICNAME, "bundle.with.module.info");
bundle.add("module-info.class", new FileInputStream(moduleInfo)); //copy it into the fake bundle
InputStream is = bundle.build();
bundleContext.installBundle("dummyLocation", is);
options.add(CoreOptions.streamBundle(bundle.build()).startLevel(1));
return options.toArray(new Option[options.size()]);
}
@Test
public void testParse() throws Exception
{
//test the osgi annotation parser ignore the module-info.class file in the fake bundle
//Get a reference to the deployed fake bundle