use of org.eclipse.tycho.p2.impl.test.ArtifactMock in project tycho by eclipse.
the class P2GeneratorImplTest method generateSourceBundleMetadataForProjectWithP2Inf.
@Test
public void generateSourceBundleMetadataForProjectWithP2Inf() throws Exception {
// p2.inf must not leak into sources bundle
DependencyMetadataGenerator p2GeneratorImpl = new SourcesBundleDependencyMetadataGenerator();
File location = new File("resources/generator/bundle-p2-inf").getCanonicalFile();
ArtifactMock artifactMock = new ArtifactMock(location, "org.acme", "foo", "0.0.1", "eclipse-plugin");
Set<Object> units = p2GeneratorImpl.generateMetadata(artifactMock, getEnvironments(), null).getMetadata();
assertEquals(1, units.size());
IInstallableUnit unit = getUnit("foo.source", units);
assertEquals(0, unit.getRequirements().size());
}
use of org.eclipse.tycho.p2.impl.test.ArtifactMock in project tycho by eclipse.
the class P2GeneratorImplTest method testOptionalRequireBundle_REQUIRE.
@Test
public void testOptionalRequireBundle_REQUIRE() throws Exception {
DependencyMetadataGenerator generator = createDependencyMetadataGenerator();
File location = new File("resources/generator/optional-require-bundle").getCanonicalFile();
ArtifactMock artifactMock = new ArtifactMock(location, "optional-require-bundle", "optional-require-bundle", "0.0.1", "eclipse-plugin");
Set<Object> units = generator.generateMetadata(artifactMock, getEnvironments(), OptionalResolutionAction.REQUIRE).getMetadata();
assertEquals(1, units.size());
IInstallableUnit iu = getUnit("optional-require-bundle", units);
assertNotNull(iu);
List<IRequirement> requirements = new ArrayList<>(iu.getRequirements());
assertEquals(1, requirements.size());
IRequiredCapability requirement = (IRequiredCapability) requirements.get(0);
assertTrue(requirement.isGreedy());
assertEquals(1, requirement.getMin());
assertEquals(1, requirement.getMax());
assertEquals(BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, requirement.getNamespace());
assertEquals("org.eclipse.osgi", requirement.getName());
}
use of org.eclipse.tycho.p2.impl.test.ArtifactMock in project tycho by eclipse.
the class P2GeneratorImplTest method testOptionalImportPackage_IGNORE.
@Test
public void testOptionalImportPackage_IGNORE() throws Exception {
DependencyMetadataGenerator generator = createDependencyMetadataGenerator();
File location = new File("resources/generator/optional-import-package").getCanonicalFile();
ArtifactMock artifactMock = new ArtifactMock(location, "optional-import-package", "optional-import-package", "0.0.1", "eclipse-plugin");
Set<Object> units = generator.generateMetadata(artifactMock, getEnvironments(), OptionalResolutionAction.IGNORE).getMetadata();
assertEquals(1, units.size());
IInstallableUnit iu = getUnit("optional-import-package", units);
assertNotNull(iu);
List<IRequirement> requirements = new ArrayList<>(iu.getRequirements());
assertEquals(0, requirements.size());
}
use of org.eclipse.tycho.p2.impl.test.ArtifactMock in project tycho by eclipse.
the class P2GeneratorImplTest method testOptionalRequireBundle_OPTIONAL.
@Test
public void testOptionalRequireBundle_OPTIONAL() throws Exception {
DependencyMetadataGenerator generator = createDependencyMetadataGenerator();
File location = new File("resources/generator/optional-require-bundle").getCanonicalFile();
ArtifactMock artifactMock = new ArtifactMock(location, "optional-require-bundle", "optional-require-bundle", "0.0.1", "eclipse-plugin");
Set<Object> units = generator.generateMetadata(artifactMock, getEnvironments(), OptionalResolutionAction.OPTIONAL).getMetadata();
assertEquals(1, units.size());
IInstallableUnit iu = getUnit("optional-require-bundle", units);
assertNotNull(iu);
List<IRequirement> requirements = new ArrayList<>(iu.getRequirements());
assertEquals(1, requirements.size());
IRequiredCapability requirement = (IRequiredCapability) requirements.get(0);
assertFalse(requirement.isGreedy());
assertEquals(0, requirement.getMin());
assertEquals(1, requirement.getMax());
assertEquals(BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, requirement.getNamespace());
assertEquals("org.eclipse.osgi", requirement.getName());
}
use of org.eclipse.tycho.p2.impl.test.ArtifactMock in project tycho by eclipse.
the class P2GeneratorImplTest method testOptionalRequireBundleP2inf_REQUIRE.
@Test
public void testOptionalRequireBundleP2inf_REQUIRE() throws Exception {
DependencyMetadataGenerator generator = createDependencyMetadataGenerator();
File location = new File("resources/generator/optional-reqiure-bundle-p2inf").getCanonicalFile();
ArtifactMock artifactMock = new ArtifactMock(location, "optional-reqiure-bundle-p2inf", "optional-reqiure-bundle-p2inf", "0.0.1", "eclipse-plugin");
Set<Object> units = generator.generateMetadata(artifactMock, getEnvironments(), OptionalResolutionAction.REQUIRE).getMetadata();
assertEquals(1, units.size());
IInstallableUnit iu = getUnit("optional-reqiure-bundle-p2inf", units);
assertNotNull(iu);
List<IRequirement> requirements = new ArrayList<>(iu.getRequirements());
assertEquals(1, requirements.size());
IRequiredCapability requirement = (IRequiredCapability) requirements.get(0);
assertTrue(requirement.isGreedy());
assertEquals(1, requirement.getMin());
assertEquals(1, requirement.getMax());
assertEquals(BundlesAction.CAPABILITY_NS_OSGI_BUNDLE, requirement.getNamespace());
assertEquals("org.eclipse.osgi", requirement.getName());
}
Aggregations