Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the 'pde-automatic-manifest' demo as part of integration tests #3856

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading