use of org.eclipse.tycho.DefaultArtifactKey in project tycho by eclipse.
the class DefaultDependencyArtifactsTest method testInstallableUnits.
@Test
public void testInstallableUnits() {
DefaultDependencyArtifacts tp = new DefaultDependencyArtifacts();
ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
File location = new File("location");
tp.addArtifactFile(key, location, asSet("a"));
tp.addNonReactorUnits(asSet("b"));
Assert.assertEquals(asSet("a", "b"), tp.getInstallableUnits());
}
use of org.eclipse.tycho.DefaultArtifactKey in project tycho by eclipse.
the class DefaultDependencyArtifactsTest method testDoNotCacheArtifactsThatRepresentReactorProjects.
@Test
public void testDoNotCacheArtifactsThatRepresentReactorProjects() {
// IInstallableUnit #hashCode and #equals methods only use (version,id) tuple to determine IU equality
// Reactor projects are expected to produce different IUs potentially with the same (version,id) during the build
// This test verifies that different DefaultTargetPlatform can have the same reactor project with different IUs
// even when IUs (version,id) are the same
ReactorProject project = new DefaultReactorProject(new MavenProject());
ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
File location = new File("location");
DefaultDependencyArtifacts tp1 = new DefaultDependencyArtifacts();
tp1.addArtifact(new DefaultArtifactDescriptor(key, location, project, null, asSet(new FunnyEquals("id", "a"))));
DefaultDependencyArtifacts tp2 = new DefaultDependencyArtifacts();
tp2.addArtifact(new DefaultArtifactDescriptor(key, location, project, null, asSet(new FunnyEquals("id", "b"))));
//
Assert.assertEquals(//
"a", ((FunnyEquals) tp1.getArtifact(location).get(null).getInstallableUnits().iterator().next()).getData());
//
Assert.assertEquals(//
"b", ((FunnyEquals) tp2.getArtifact(location).get(null).getInstallableUnits().iterator().next()).getData());
}
use of org.eclipse.tycho.DefaultArtifactKey in project tycho by eclipse.
the class DefaultDependencyArtifactsTest method testMultiEnvironmentMetadataMerge.
@Test
public void testMultiEnvironmentMetadataMerge() {
ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
File location = new File("location");
DefaultDependencyArtifacts tpA = new DefaultDependencyArtifacts();
tpA.addArtifactFile(key, location, asSet("a"));
DefaultDependencyArtifacts tpB = new DefaultDependencyArtifacts();
tpB.addArtifactFile(key, location, asSet("a", "b"));
MultiEnvironmentDependencyArtifacts tp = new MultiEnvironmentDependencyArtifacts();
tp.addPlatform(new TargetEnvironment("a", "a", "a"), tpA);
tp.addPlatform(new TargetEnvironment("b", "b", "b"), tpB);
List<ArtifactDescriptor> artifacts = tp.getArtifacts();
Assert.assertEquals(1, artifacts.size());
Set<Object> units = artifacts.get(0).getInstallableUnits();
Assert.assertEquals(2, units.size());
Assert.assertTrue(units.contains("a"));
Assert.assertTrue(units.contains("b"));
}
use of org.eclipse.tycho.DefaultArtifactKey in project tycho by eclipse.
the class DefaultDependencyArtifactsTest method addArtifact.
private void addArtifact(DefaultDependencyArtifacts tp, String type, String id, String version) {
ArtifactKey key = new DefaultArtifactKey(type, id, version);
tp.addArtifactFile(key, new File(version), null);
}
use of org.eclipse.tycho.DefaultArtifactKey in project tycho by eclipse.
the class DefaultDependencyArtifactsTest method testInconsistentArtifacts.
@Test
public void testInconsistentArtifacts() {
DefaultDependencyArtifacts tp = new DefaultDependencyArtifacts();
ArtifactKey key = new DefaultArtifactKey("type", "id", "version");
File location = new File("location");
tp.addArtifactFile(key, location, asSet("a"));
try {
tp.addArtifactFile(key, location, asSet("b"));
} catch (IllegalStateException e) {
// expected
}
}
Aggregations