Skip to content

Commit

Permalink
Run the 'pde-automatic-manifest' demo as part of integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed May 17, 2024
1 parent f983ce6 commit 96df42a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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<String, String> manifest = (Dictionary<String, String>) 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(),
Expand Down

0 comments on commit 96df42a

Please sign in to comment.