Search in sources :

Example 1 with BuildPropertiesParserForTesting

use of org.eclipse.tycho.test.util.BuildPropertiesParserForTesting 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 BuildPropertiesParserForTesting

use of org.eclipse.tycho.test.util.BuildPropertiesParserForTesting in project tycho by eclipse.

the class FeatureRootAdviceTest method testFeatureRootAdviceComputePath.

@Test
public void testFeatureRootAdviceComputePath() throws Exception {
    IFeatureRootAdvice rootFileAdvice = FeatureRootAdvice.createRootFileAdvice(createDefaultArtifactMock(), new BuildPropertiesParserForTesting());
    File file1 = new File(FEATURE_PROJECT_TEST_RESOURCE_ROOT, ROOT_FILE_NAME).getCanonicalFile();
    IPath expectedPathFile1 = new Path(ROOT_FILE_NAME);
    IPath actualPathFile1 = rootFileAdvice.getRootFileComputer(GLOBAL_SPEC).computePath(file1);
    assertEquals(expectedPathFile1, actualPathFile1);
    File file2 = new File(FEATURE_PROJECT_TEST_RESOURCE_ROOT, ROOT_FILE2_REL_PATH).getCanonicalFile();
    IPath expectedPathFile2 = new Path(ROOT_FILE2_NAME);
    IPath actualPathFile2 = rootFileAdvice.getRootFileComputer(GLOBAL_SPEC).computePath(file2);
    assertEquals(expectedPathFile2, actualPathFile2);
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) File(java.io.File) BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) Test(org.junit.Test)

Example 3 with BuildPropertiesParserForTesting

use of org.eclipse.tycho.test.util.BuildPropertiesParserForTesting in project tycho by eclipse.

the class P2DependencyGeneratorImplTest method resetTestSubjectAndResultFields.

@Before
public void resetTestSubjectAndResultFields() {
    subject = new P2GeneratorImpl(true);
    subject.setBuildPropertiesParser(new BuildPropertiesParserForTesting());
}
Also used : BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) Before(org.junit.Before)

Example 4 with BuildPropertiesParserForTesting

use of org.eclipse.tycho.test.util.BuildPropertiesParserForTesting 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)

Example 5 with BuildPropertiesParserForTesting

use of org.eclipse.tycho.test.util.BuildPropertiesParserForTesting in project tycho by eclipse.

the class P2MetadataGeneratorImplTest method gav.

@Test
public void gav() throws Exception {
    P2GeneratorImpl impl = new P2GeneratorImpl(false);
    impl.setBuildPropertiesParser(new BuildPropertiesParserForTesting());
    File location = new File("resources/generator/bundle").getCanonicalFile();
    String groupId = "org.eclipse.tycho.p2.impl.test";
    String artifactId = "bundle";
    String version = "1.0.0-SNAPSHOT";
    List<TargetEnvironment> environments = new ArrayList<>();
    DependencyMetadata metadata = impl.generateMetadata(new ArtifactMock(location, groupId, artifactId, version, PackagingType.TYPE_ECLIPSE_PLUGIN), environments);
    List<IInstallableUnit> units = new ArrayList<>(metadata.getInstallableUnits());
    List<IArtifactDescriptor> artifacts = new ArrayList<>(metadata.getArtifactDescriptors());
    Assert.assertEquals(1, units.size());
    IInstallableUnit unit = units.iterator().next();
    Assert.assertEquals("org.eclipse.tycho.p2.impl.test.bundle", unit.getId());
    Assert.assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    Assert.assertEquals(2, unit.getRequirements().size());
    Assert.assertEquals(1, artifacts.size());
    IArtifactDescriptor ad = artifacts.iterator().next();
    Assert.assertEquals("org.eclipse.tycho.p2.impl.test.bundle", ad.getArtifactKey().getId());
    Assert.assertEquals("1.0.0.qualifier", ad.getArtifactKey().getVersion().toString());
    Assert.assertEquals(groupId, ad.getProperties().get(RepositoryLayoutHelper.PROP_GROUP_ID));
    Assert.assertEquals(artifactId, ad.getProperties().get(RepositoryLayoutHelper.PROP_ARTIFACT_ID));
    Assert.assertEquals(version, ad.getProperties().get(RepositoryLayoutHelper.PROP_VERSION));
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArrayList(java.util.ArrayList) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) P2GeneratorImpl(org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl) BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) DependencyMetadata(org.eclipse.tycho.p2.impl.publisher.DependencyMetadata) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) File(java.io.File) Test(org.junit.Test)

Aggregations

BuildPropertiesParserForTesting (org.eclipse.tycho.test.util.BuildPropertiesParserForTesting)5 File (java.io.File)2 DefaultDependencyMetadataGenerator (org.eclipse.tycho.p2.impl.publisher.DefaultDependencyMetadataGenerator)2 P2GeneratorImpl (org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl)2 Before (org.junit.Before)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IFeatureRootAdvice (org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)1 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)1 TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)1 DependencyMetadata (org.eclipse.tycho.p2.impl.publisher.DependencyMetadata)1 TargetPlatformConfigurationStub (org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub)1