use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class P2GeneratorImpl method persistMetadata.
@Override
public void persistMetadata(Map<String, IP2Artifact> metadata, File unitsXml, File artifactsXml) throws IOException {
Set<IInstallableUnit> units = new LinkedHashSet<>();
Set<IArtifactDescriptor> artifactDescriptors = new LinkedHashSet<>();
for (IP2Artifact artifact : metadata.values()) {
for (Object unit : artifact.getInstallableUnits()) {
units.add((IInstallableUnit) unit);
}
artifactDescriptors.add((IArtifactDescriptor) artifact.getArtifactDescriptor());
}
new MetadataIO().writeXML(units, unitsXml);
new ArtifactsIO().writeXML(artifactDescriptors, artifactsXml);
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class FeatureRootfileArtifactRepositoryTest method testRepoForNonBinaryArtifacts.
@Test
public void testRepoForNonBinaryArtifacts() throws Exception {
FeatureRootfileArtifactRepository subject = new FeatureRootfileArtifactRepository(createPublisherInfo(true), tempFolder.newFolder("testrootfiles"));
IArtifactDescriptor artifactDescriptor = createArtifactDescriptor("non-binary-classifier", "org.eclipse.tycho.test.p2");
subject.getOutputStream(artifactDescriptor).close();
Map<String, IP2Artifact> attachedArtifacts = subject.getPublishedArtifacts();
Assert.assertEquals(0, attachedArtifacts.size());
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor 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));
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class ModuleArtifactRepositoryTest method artifactSizeOf.
private static int artifactSizeOf(IArtifactKey artifactKey, IArtifactRepository subject) {
IArtifactDescriptor[] artifactDescriptors = subject.getArtifactDescriptors(artifactKey);
assertEquals(1, artifactDescriptors.length);
ByteArrayOutputStream artifactContent = new ByteArrayOutputStream();
subject.getArtifact(artifactDescriptors[0], artifactContent, null);
return artifactContent.size();
}
use of org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor in project tycho by eclipse.
the class PublishingRepositoryTest method testArtifactDescriptor.
@Test
public void testArtifactDescriptor() throws Exception {
// simulate that AttachedTestArtifact is the build output
insertTestArtifact(subject);
IArtifactRepository artifactRepo = subject.getArtifactRepository();
assertThat(allKeysIn(artifactRepo), hasItem(AttachedTestArtifact.key));
IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(AttachedTestArtifact.key);
assertThat(descriptors.length, is(1));
Map<String, String> props = descriptors[0].getProperties();
assertThat(props.get(RepositoryLayoutHelper.PROP_GROUP_ID), is(project.getGroupId()));
assertThat(props.get(RepositoryLayoutHelper.PROP_ARTIFACT_ID), is(project.getArtifactId()));
assertThat(props.get(RepositoryLayoutHelper.PROP_VERSION), is(project.getVersion()));
assertThat(props.get(RepositoryLayoutHelper.PROP_CLASSIFIER), is(AttachedTestArtifact.classifier));
}
Aggregations