use of org.eclipse.tycho.p2.impl.test.ArtifactMock in project tycho by eclipse.
the class P2DependencyGeneratorImplTest method generateDependencies.
private void generateDependencies(String testProjectId, String packagingType) throws IOException {
File reactorProjectRoot = new File("resources/generator/" + testProjectId).getCanonicalFile();
ArtifactMock reactorProject = new ArtifactMock(reactorProjectRoot, DEFAULT_GROUP_ID, testProjectId, DEFAULT_VERSION, packagingType, DEFAULT_CLASSIFIER);
ArrayList<TargetEnvironment> emptyEnvironments = new ArrayList<>();
DependencyMetadata metadata = subject.generateMetadata(reactorProject, emptyEnvironments);
this.units = new ArrayList<>(metadata.getInstallableUnits());
this.artifacts = new ArrayList<>(metadata.getArtifactDescriptors());
}
use of org.eclipse.tycho.p2.impl.test.ArtifactMock 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));
}
Aggregations