Search in sources :

Example 1 with ReactorProjectStub

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());
}
Also used : Entry(org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry) ReactorProjectStub(org.eclipse.tycho.p2.impl.test.ReactorProjectStub) ArrayList(java.util.ArrayList) DependencyMetadata(org.eclipse.tycho.p2.impl.publisher.DependencyMetadata) ArtifactMock(org.eclipse.tycho.p2.impl.test.ArtifactMock) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ResourceUtil.resourceFile(org.eclipse.tycho.p2.impl.test.ResourceUtil.resourceFile) File(java.io.File) SourcesBundleDependencyMetadataGenerator(org.eclipse.tycho.p2.impl.publisher.SourcesBundleDependencyMetadataGenerator) Test(org.junit.Test)

Example 2 with ReactorProjectStub

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
}
Also used : ReactorRepositoryManagerFacade(org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManagerFacade) TargetPlatformConfigurationStub(org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub) ExecutionEnvironmentConfigurationStub(org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub) MavenRepositoryLocation(org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) ReactorProject(org.eclipse.tycho.ReactorProject) ReactorProjectStub(org.eclipse.tycho.p2.impl.test.ReactorProjectStub) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 3 with ReactorProjectStub

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;
}
Also used : ReactorProjectStub(org.eclipse.tycho.p2.impl.test.ReactorProjectStub) DependencyMetadata(org.eclipse.tycho.p2.impl.publisher.DependencyMetadata) File(java.io.File)

Example 4 with ReactorProjectStub

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;
}
Also used : ReactorProjectStub(org.eclipse.tycho.p2.impl.test.ReactorProjectStub) IDependencyMetadata(org.eclipse.tycho.p2.metadata.IDependencyMetadata) ArtifactMock(org.eclipse.tycho.p2.impl.test.ArtifactMock)

Aggregations

ReactorProjectStub (org.eclipse.tycho.p2.impl.test.ReactorProjectStub)4 File (java.io.File)2 DependencyMetadata (org.eclipse.tycho.p2.impl.publisher.DependencyMetadata)2 ArtifactMock (org.eclipse.tycho.p2.impl.test.ArtifactMock)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 ReactorProject (org.eclipse.tycho.ReactorProject)1 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)1 ExecutionEnvironmentConfigurationStub (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub)1 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)1 SourcesBundleDependencyMetadataGenerator (org.eclipse.tycho.p2.impl.publisher.SourcesBundleDependencyMetadataGenerator)1 ResourceUtil.resourceFile (org.eclipse.tycho.p2.impl.test.ResourceUtil.resourceFile)1 IDependencyMetadata (org.eclipse.tycho.p2.metadata.IDependencyMetadata)1 Entry (org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult.Entry)1 P2TargetPlatform (org.eclipse.tycho.p2.target.P2TargetPlatform)1 TargetPlatformConfigurationStub (org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub)1 ReactorRepositoryManagerFacade (org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManagerFacade)1 ReactorProjectIdentitiesStub (org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1