Search in sources :

Example 1 with ReactorProjectIdentitiesStub

use of org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub 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 2 with ReactorProjectIdentitiesStub

use of org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub in project tycho by eclipse.

the class PublishProductToolTest method before.

@Before
public void before() throws Exception {
    File projectDirectory = tempManager.newFolder("projectDir");
    outputRepository = new PublishingRepositoryImpl(p2Context.getAgent(), new ReactorProjectIdentitiesStub(projectDirectory));
    interpolatorMock = mock(Interpolator.class);
    when(interpolatorMock.interpolate(anyString())).thenAnswer(new Answer<String>() {

        @Override
        public String answer(InvocationOnMock invocation) throws Throwable {
            // by default don't expand anything
            return (String) invocation.getArguments()[0];
        }
    });
}
Also used : PublishingRepositoryImpl(org.eclipse.tycho.repository.module.PublishingRepositoryImpl) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) Interpolator(org.eclipse.tycho.core.shared.Interpolator) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Matchers.anyString(org.mockito.Matchers.anyString) ResourceUtil.resourceFile(org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile) File(java.io.File) TychoMatchers.isFile(org.eclipse.tycho.test.util.TychoMatchers.isFile) Before(org.junit.Before)

Example 3 with ReactorProjectIdentitiesStub

use of org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub in project tycho by eclipse.

the class PublisherServiceTest method initSubject.

@Before
public void initSubject() throws Exception {
    File projectDirectory = tempManager.newFolder("projectDir");
    LinkedHashSet<IInstallableUnit> installableUnits = new LinkedHashSet<>();
    installableUnits.add(InstallableUnitUtil.createFeatureIU("org.eclipse.example.original_feature", "1.0.0"));
    IMetadataRepository context = new ImmutableInMemoryMetadataRepository(installableUnits);
    // TODO these publishers don't produce artifacts, so we could run without file system
    outputRepository = new PublishingRepositoryImpl(p2Context.getAgent(), new ReactorProjectIdentitiesStub(projectDirectory));
    PublisherActionRunner publisherRunner = new PublisherActionRunner(context, DEFAULT_ENVIRONMENTS, logVerifier.getLogger());
    subject = new PublisherServiceImpl(publisherRunner, DEFAULT_QUALIFIER, outputRepository);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) PublishingRepositoryImpl(org.eclipse.tycho.repository.module.PublishingRepositoryImpl) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository) ResourceUtil.resourceFile(org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile) File(java.io.File) ImmutableInMemoryMetadataRepository(org.eclipse.tycho.repository.p2base.metadata.ImmutableInMemoryMetadataRepository) Before(org.junit.Before)

Example 4 with ReactorProjectIdentitiesStub

use of org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub in project tycho by eclipse.

the class PublishingRepositoryTest method initSubject.

@Before
public void initSubject() throws Exception {
    project = new ReactorProjectIdentitiesStub(tempManager.newFolder("projectDir"));
    subject = new PublishingRepositoryImpl(p2Context.getAgent(), project);
}
Also used : ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) Before(org.junit.Before)

Example 5 with ReactorProjectIdentitiesStub

use of org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub in project tycho by eclipse.

the class MirrorApplicationServiceTest method initTestContext.

@Before
public void initTestContext() throws Exception {
    destinationRepo = new DestinationRepositoryDescriptor(tempFolder.newFolder("dest"), DEFAULT_NAME);
    File projectFolder = tempFolder.getRoot();
    ReactorProjectIdentities currentProject = new ReactorProjectIdentitiesStub(projectFolder);
    context = new BuildContext(currentProject, DEFAULT_QUALIFIER, DEFAULT_ENVIRONMENTS);
    subject = new MirrorApplicationServiceImpl();
    MavenContext mavenContext = new MavenContextImpl(null, logVerifier.getLogger());
    subject.setMavenContext(mavenContext);
}
Also used : MavenContextImpl(org.eclipse.tycho.core.shared.MavenContextImpl) BuildContext(org.eclipse.tycho.p2.tools.BuildContext) MavenContext(org.eclipse.tycho.core.shared.MavenContext) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) ReactorProjectIdentities(org.eclipse.tycho.ReactorProjectIdentities) File(java.io.File) DestinationRepositoryDescriptor(org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor) Before(org.junit.Before)

Aggregations

ReactorProjectIdentitiesStub (org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub)5 Before (org.junit.Before)4 File (java.io.File)3 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)2 ReactorProjectIdentities (org.eclipse.tycho.ReactorProjectIdentities)2 ResourceUtil.resourceFile (org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile)2 PublishingRepositoryImpl (org.eclipse.tycho.repository.module.PublishingRepositoryImpl)2 LinkedHashSet (java.util.LinkedHashSet)1 IMetadataRepository (org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)1 ReactorProject (org.eclipse.tycho.ReactorProject)1 ExecutionEnvironmentConfigurationStub (org.eclipse.tycho.core.ee.shared.ExecutionEnvironmentConfigurationStub)1 MavenRepositoryLocation (org.eclipse.tycho.core.resolver.shared.MavenRepositoryLocation)1 Interpolator (org.eclipse.tycho.core.shared.Interpolator)1 MavenContext (org.eclipse.tycho.core.shared.MavenContext)1 MavenContextImpl (org.eclipse.tycho.core.shared.MavenContextImpl)1 ReactorProjectStub (org.eclipse.tycho.p2.impl.test.ReactorProjectStub)1 P2TargetPlatform (org.eclipse.tycho.p2.target.P2TargetPlatform)1 TargetPlatformConfigurationStub (org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub)1 BuildContext (org.eclipse.tycho.p2.tools.BuildContext)1 DestinationRepositoryDescriptor (org.eclipse.tycho.p2.tools.DestinationRepositoryDescriptor)1