diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java index 78edecb9ee..306829f841 100644 --- a/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java +++ b/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java @@ -12,10 +12,19 @@ *******************************************************************************/ package org.eclipse.tycho.test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.io.File; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Dictionary; import java.util.List; import org.apache.maven.it.Verifier; +import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; +import org.eclipse.osgi.service.resolver.BundleDescription; import org.junit.Test; /** @@ -24,6 +33,21 @@ */ public class DemoTest extends AbstractTychoIntegrationTest { + @Test + public void testAutomaticManifest() throws Exception { + Verifier verifier = runDemo("pde-automatic-manifest"); + BundleDescription description = BundlesAction.createBundleDescription(Path + .of(verifier.getBasedir(), "tycho.demo.service.impl/target/tycho.demo.service.impl-1.0.0-SNAPSHOT.jar") + .toFile()); + assertNotNull("demo bundle was not packed", description); + @SuppressWarnings("unchecked") + Dictionary manifest = (Dictionary) description.getUserObject(); + assertEquals("Service component not found", "OSGI-INF/tycho.demo.service.impl.InverterServiceImpl.xml", + manifest.get("Service-Component")); + assertTrue("tycho.demo.service.api package not imported", Arrays.stream(description.getImportPackages()) + .anyMatch(pkg -> "tycho.demo.service.api".equals(pkg.getName()))); + } + @Test public void testTychoJustJDemo() throws Exception { assertIncludesJustJ(new File(runDemo("justj", "-f", "product").getBasedir(),