Search in sources :

Example 1 with MirrorOptions

use of org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions in project tycho by eclipse.

the class MirrorStandaloneTest method testIgnoreErrorShouldNotThrowException.

@Test
public void testIgnoreErrorShouldNotThrowException() throws FacadeException {
    MirrorOptions mirrorOptions = new MirrorOptions();
    mirrorOptions.setIgnoreErrors(true);
    subject.mirrorStandalone(sourceRepos("invalid/wrong_checksum"), destinationRepo, Collections.singletonList(new IUDescription("jarsigning", "0.0.1.201109191414")), mirrorOptions, targetFolder);
}
Also used : IUDescription(org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription) MirrorOptions(org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions) Test(org.junit.Test)

Example 2 with MirrorOptions

use of org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions in project tycho by eclipse.

the class MirrorApplicationServiceImpl method mirrorStandalone.

@Override
public void mirrorStandalone(RepositoryReferences sources, DestinationRepositoryDescriptor destination, Collection<IUDescription> seedIUs, MirrorOptions mirrorOptions, BuildOutputDirectory tempDirectory) throws FacadeException {
    IProvisioningAgent agent = Activator.createProvisioningAgent(tempDirectory);
    try {
        final MirrorApplication mirrorApp = createMirrorApplication(sources, destination, agent, mirrorOptions.isIncludePacked());
        mirrorApp.setSlicingOptions(createSlicingOptions(mirrorOptions));
        mirrorApp.setIgnoreErrors(mirrorOptions.isIgnoreErrors());
        try {
            // we want to see mirror progress as this is a possibly long-running operation
            mirrorApp.setVerbose(true);
            mirrorApp.setLog(new LogListener(mavenContext.getLogger()));
            mirrorApp.setSourceIUs(querySourceIus(seedIUs, mirrorApp.getCompositeMetadataRepository(), sources));
            IStatus returnStatus = mirrorApp.run(null);
            checkStatus(returnStatus, mirrorOptions.isIgnoreErrors());
        } catch (ProvisionException e) {
            throw new FacadeException(MIRROR_FAILURE_MESSAGE + ": " + StatusTool.collectProblems(e.getStatus()), e);
        }
    } finally {
        agent.stop();
    }
}
Also used : FacadeException(org.eclipse.tycho.p2.tools.FacadeException) IStatus(org.eclipse.core.runtime.IStatus) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) IProvisioningAgent(org.eclipse.equinox.p2.core.IProvisioningAgent)

Example 3 with MirrorOptions

use of org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions in project tycho by eclipse.

the class MirrorStandaloneTest method testMirrorLatestOnly.

@Test
public void testMirrorLatestOnly() throws Exception {
    MirrorOptions mirrorOptions = new MirrorOptions();
    mirrorOptions.setLatestVersionOnly(true);
    subject.mirrorStandalone(sourceRepos("e342", "e352"), destinationRepo, null, mirrorOptions, targetFolder);
    File[] runtimeBundles = new File(destinationRepo.getLocation(), "plugins").listFiles(new FileFilter() {

        @Override
        public boolean accept(File file) {
            return file.getName().startsWith("org.eclipse.core.runtime");
        }
    });
    assertEquals(1, runtimeBundles.length);
}
Also used : FileFilter(java.io.FileFilter) MirrorOptions(org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions) File(java.io.File) MirrorApplicationServiceTest.repoFile(org.eclipse.tycho.p2.tools.mirroring.MirrorApplicationServiceTest.repoFile) Test(org.junit.Test)

Example 4 with MirrorOptions

use of org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions in project tycho by eclipse.

the class MirrorStandaloneTest method testMirrorAllUnits.

@Test
public void testMirrorAllUnits() throws Exception {
    subject.mirrorStandalone(e342PlusFragmentsRepo(), destinationRepo, null, new MirrorOptions(), targetFolder);
    assertEquals(3, getMirroredBundleFiles().length);
    assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar").exists());
    assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.0.101.R34x_v20080731.jar").exists());
    assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731.jar").exists());
}
Also used : MirrorOptions(org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions) Test(org.junit.Test)

Example 5 with MirrorOptions

use of org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions in project tycho by eclipse.

the class MirrorStandaloneTest method testMirrorMatchExpression.

@Test
public void testMirrorMatchExpression() throws Exception {
    subject.mirrorStandalone(e342PlusFragmentsRepo(), destinationRepo, Collections.singletonList(new IUDescription(null, null, "id == $0 && version == $1", new String[] { "org.eclipse.core.runtime", "3.4.0.v20080512" })), new MirrorOptions(), targetFolder);
    assertEquals(1, getMirroredBundleFiles().length);
    assertTrue(repoFile(destinationRepo, "plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar").exists());
}
Also used : IUDescription(org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription) MirrorOptions(org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions) Test(org.junit.Test)

Aggregations

MirrorOptions (org.eclipse.tycho.p2.tools.mirroring.facade.MirrorOptions)5 Test (org.junit.Test)5 IUDescription (org.eclipse.tycho.p2.tools.mirroring.facade.IUDescription)3 File (java.io.File)1 FileFilter (java.io.FileFilter)1 IStatus (org.eclipse.core.runtime.IStatus)1 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)1 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)1 FacadeException (org.eclipse.tycho.p2.tools.FacadeException)1 MirrorApplicationServiceTest.repoFile (org.eclipse.tycho.p2.tools.mirroring.MirrorApplicationServiceTest.repoFile)1