use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class GAVArtifactDescriptorTest method testDeserialization.
@Test
public void testDeserialization() {
// parsing to p2's implementation of IArtifactDescriptor is done elsewhere, so assume this is the input
ArtifactDescriptor input = createP2Descriptor();
input.setProperty("maven-groupId", TEST_GAV.getGroupId());
input.setProperty("maven-artifactId", TEST_GAV.getArtifactId());
input.setProperty("maven-version", TEST_GAV.getVersion());
subject = new GAVArtifactDescriptor(input);
assertThat(subject.getArtifactKey(), is(TEST_KEY));
assertThat(subject.getMavenCoordinates(), is(new MavenRepositoryCoordinates(TEST_GAV, DEFAULT_CLASSIFIER, DEFAULT_EXTENSION)));
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class LocalMetadataRepositoryTest method testOutdatedIndex.
@Test
public void testOutdatedIndex() throws CoreException {
// create and fill repo
File location = new File("target/indexmetadataRepo");
LocalMetadataRepository repository = createRepository(location);
InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
iud.setId("test");
iud.setVersion(Version.parseVersion("1.0.0"));
iud.setProperty(RepositoryLayoutHelper.PROP_GROUP_ID, "group");
iud.setProperty(RepositoryLayoutHelper.PROP_ARTIFACT_ID, "artifact");
iud.setProperty(RepositoryLayoutHelper.PROP_VERSION, "version");
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
repository.addInstallableUnits(Arrays.asList(iu));
repository = (LocalMetadataRepository) loadRepository(location);
// check: the artifact is in the index
TychoRepositoryIndex metaIndex = createMetadataIndex(location);
Assert.assertFalse(metaIndex.getProjectGAVs().isEmpty());
// delete artifact from file system
deleteDir(new File(location, "group"));
// create a new repo and check that the reference was gracefully removed from the index
repository = (LocalMetadataRepository) loadRepository(location);
repository.save();
metaIndex = createMetadataIndex(location);
Assert.assertTrue(metaIndex.getProjectGAVs().isEmpty());
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitUtil method createProductIU.
public static IInstallableUnit createProductIU(String productId, String version) {
InstallableUnitDescription description = createIuDescription(productId, version);
description.setProperty(PRODUCT_TYPE_PROPERTY, Boolean.toString(true));
return MetadataFactory.createInstallableUnit(description);
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitUtil method createIURequirement.
public static IInstallableUnit createIURequirement(String id, String version, String requiredId, String requiredVersionRange) {
InstallableUnitDescription description = createIuDescription(id, version);
final IRequirement requiredCapability = createRequirement(requiredId, requiredVersionRange);
description.addRequirements(Arrays.asList(requiredCapability));
return MetadataFactory.createInstallableUnit(description);
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitUtil method createBundleIU.
public static IInstallableUnit createBundleIU(String bundleId, String version) {
InstallableUnitDescription description = createIuDescription(bundleId, version);
description.addProvidedCapabilities(createProvidedCapability(BUNDLE_CAPABILITY_NS, bundleId, version));
return MetadataFactory.createInstallableUnit(description);
}
Aggregations