From 96df42a0efa4d913b301e8d95e5f889b55268a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Fri, 17 May 2024 14:42:01 +0200 Subject: [PATCH] Run the 'pde-automatic-manifest' demo as part of integration tests --- .../java/org/eclipse/tycho/test/DemoTest.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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(),