Search in sources :

Example 1 with DefaultDependencyMetadataGenerator

use of org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator in project tycho by eclipse.

the class P2ResolverTestBase method prepare.

@Before
public final void prepare() throws Exception {
    fullGenerator = new P2GeneratorImpl(true);
    BuildPropertiesParserForTesting buildPropertiesReader = new BuildPropertiesParserForTesting();
    fullGenerator.setBuildPropertiesParser(buildPropertiesReader);
    dependencyGenerator = new DefaultDependencyMetadataGenerator();
    dependencyGenerator.setBuildPropertiesParser(buildPropertiesReader);
    tpConfig = new TargetPlatformConfigurationStub();
    tpFactory = resolverFactory.getTargetPlatformFactoryImpl();
}
Also used : TargetPlatformConfigurationStub(org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub) P2GeneratorImpl(org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl) BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) DefaultDependencyMetadataGenerator(org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator) Before(org.junit.Before)

Example 2 with DefaultDependencyMetadataGenerator

use of org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator in project tycho by eclipse.

the class P2GeneratorImplTest method testOptionalImportPackage_REQUIRE.

@Test
public void testOptionalImportPackage_REQUIRE() throws Exception {
    DefaultDependencyMetadataGenerator 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.REQUIRE).getMetadata();
    assertEquals(1, units.size());
    IInstallableUnit iu = getUnit("optional-import-package", 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(PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE, requirement.getNamespace());
    assertEquals("org.osgi.framework", requirement.getName());
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) ArrayList(java.util.ArrayList) IRequiredCapability(org.eclipse.equinox.internal.p2.metadata.IRequiredCapability) ArtifactMock(org.eclipse.tycho.p2.impl.test.ArtifactMock) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) File(java.io.File) DefaultDependencyMetadataGenerator(org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator) Test(org.junit.Test)

Example 3 with DefaultDependencyMetadataGenerator

use of org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator in project tycho by eclipse.

the class P2GeneratorImplTest method createDependencyMetadataGenerator.

private DefaultDependencyMetadataGenerator createDependencyMetadataGenerator() {
    DefaultDependencyMetadataGenerator generator = new DefaultDependencyMetadataGenerator();
    generator.setBuildPropertiesParser(new BuildPropertiesParserForTesting());
    return generator;
}
Also used : BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) DefaultDependencyMetadataGenerator(org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator)

Aggregations

DefaultDependencyMetadataGenerator (org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator)3 BuildPropertiesParserForTesting (org.eclipse.tycho.test.util.BuildPropertiesParserForTesting)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IRequiredCapability (org.eclipse.equinox.internal.p2.metadata.IRequiredCapability)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IRequirement (org.eclipse.equinox.p2.metadata.IRequirement)1 P2GeneratorImpl (org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl)1 ArtifactMock (org.eclipse.tycho.p2.impl.test.ArtifactMock)1 TargetPlatformConfigurationStub (org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub)1 Before (org.junit.Before)1 Test (org.junit.Test)1