use of org.eclipse.tycho.p2.impl.test.ReactorProjectStub in project tycho by eclipse.
the class P2ResolverTest method testSourceBundle.
@Test
public void testSourceBundle() throws Exception {
String featureId = "org.eclipse.tycho.p2.impl.resolver.test.feature01";
projectToResolve = createReactorProject(resourceFile("sourcebundles/feature01"), TYPE_ECLIPSE_FEATURE, featureId);
File bundle = resourceFile("sourcebundles/bundle01");
String bundleId = "org.eclipse.tycho.p2.impl.resolver.test.bundle01";
String bundleVersion = "1.0.0-SNAPSHOT";
reactorProjects.add(createReactorProject(bundle, TYPE_ECLIPSE_PLUGIN, bundleId));
ReactorProjectStub sb = new ReactorProjectStub(bundle, bundleId, bundleId, bundleVersion, TYPE_ECLIPSE_PLUGIN);
DependencyMetadata metadata = new SourcesBundleDependencyMetadataGenerator().generateMetadata(new ArtifactMock(sb, "source"), getEnvironments(), null);
sb.setDependencyMetadata(metadata);
reactorProjects.add(sb);
result = singleEnv(impl.resolveDependencies(getTargetPlatform(), projectToResolve));
assertEquals(3, result.getArtifacts().size());
List<P2ResolutionResult.Entry> entries = new ArrayList<>(result.getArtifacts());
Collections.sort(entries, new Comparator<Entry>() {
@Override
public int compare(Entry entry1, Entry entry2) {
return entry1.getId().compareTo(entry2.getId());
}
});
assertEquals("org.eclipse.tycho.p2.impl.resolver.test.bundle01", entries.get(0).getId());
assertEquals("org.eclipse.tycho.p2.impl.resolver.test.bundle01.source", entries.get(1).getId());
assertEquals("org.eclipse.tycho.p2.impl.resolver.test.feature01", entries.get(2).getId());
assertEquals(bundle, entries.get(0).getLocation());
assertEquals(bundle, entries.get(1).getLocation());
assertEquals("sources", entries.get(1).getClassifier());
}
use of org.eclipse.tycho.p2.impl.test.ReactorProjectStub in project tycho by eclipse.
the class ReactorRepositoryManagerTest method testTargetPlatformComputationInIntegration.
@Test
public void testTargetPlatformComputationInIntegration() throws Exception {
subject = getService(ReactorRepositoryManagerFacade.class);
ReactorProject currentProject = new ReactorProjectStub("reactor-artifact");
TargetPlatformConfigurationStub tpConfig = new TargetPlatformConfigurationStub();
tpConfig.addP2Repository(new MavenRepositoryLocation(null, ResourceUtil.resourceFile("repositories/launchers").toURI()));
subject.computePreliminaryTargetPlatform(currentProject, tpConfig, new ExecutionEnvironmentConfigurationStub("JavaSE-1.7"), null, null);
ReactorProjectIdentities upstreamProject = new ReactorProjectIdentitiesStub(ResourceUtil.resourceFile("projectresult"));
subject.computeFinalTargetPlatform(currentProject, Arrays.asList(upstreamProject));
P2TargetPlatform finalTP = (P2TargetPlatform) currentProject.getContextValue("org.eclipse.tycho.core.TychoConstants/targetPlatform");
Collection<IInstallableUnit> units = finalTP.getInstallableUnits();
// units from the p2 repository
assertThat(units, hasItem(unitWithId("org.eclipse.equinox.launcher")));
// units from the upstream project
assertThat(units, hasItem(unitWithId("bundle")));
assertThat(units, hasItem(unitWithId("bundle.source")));
// TODO get artifact
}
use of org.eclipse.tycho.p2.impl.test.ReactorProjectStub in project tycho by eclipse.
the class TargetPlatformFactoryTest method createReactorProject.
private ReactorProject createReactorProject(String artifactId, String[] primaryUnitIds, String[] secondaryUnitIds) {
// not dereferenced in the code under test, so the path doesn't need to exist
File basedir = new File("tychotestdummy");
ReactorProjectStub result = new ReactorProjectStub(basedir, artifactId);
DependencyMetadata dependencyMetadata = new DependencyMetadata();
dependencyMetadata.setMetadata(true, createUnits(primaryUnitIds));
dependencyMetadata.setMetadata(false, createUnits(secondaryUnitIds));
result.setDependencyMetadata(dependencyMetadata);
return result;
}
use of org.eclipse.tycho.p2.impl.test.ReactorProjectStub in project tycho by eclipse.
the class P2ResolverTestBase method createReactorProject.
protected ReactorProject createReactorProject(File projectRoot, String packagingType, String artifactId, OptionalResolutionAction optionalDependencies) {
ReactorProjectStub project = new ReactorProjectStub(projectRoot, DEFAULT_GROUP_ID, artifactId, DEFAULT_VERSION, packagingType);
IDependencyMetadata metadata = dependencyGenerator.generateMetadata(new ArtifactMock(project, null), getEnvironments(), optionalDependencies);
project.setDependencyMetadata(metadata);
return project;
}
Aggregations