use of org.eclipse.tycho.p2.tools.RepositoryReferences in project tycho by eclipse.
the class MirrorApplicationServiceTest method sourceRepos.
public static RepositoryReferences sourceRepos(String... repoIds) {
RepositoryReferences result = new RepositoryReferences();
for (String repoId : repoIds) {
result.addMetadataRepository(ResourceUtil.resourceFile("repositories/" + repoId));
result.addArtifactRepository(ResourceUtil.resourceFile("repositories/" + repoId));
}
return result;
}
use of org.eclipse.tycho.p2.tools.RepositoryReferences in project tycho by eclipse.
the class VerifierServiceImplTest method testFileRepositoryWithTamperedArtifact.
@Test
public void testFileRepositoryWithTamperedArtifact() throws Exception {
final RepositoryReferences repositories = sourceRepos("invalid/tampered_file");
assertEquals(false, verify(repositories));
assertTrue(firstErrorLine().contains("osgi.bundle"));
assertTrue(firstErrorLine().contains("jarsigning"));
assertTrue(remainingErrorText().contains("dummy.class"));
assertTrue(remainingErrorText().contains("has been tampered"));
}
use of org.eclipse.tycho.p2.tools.RepositoryReferences in project tycho by eclipse.
the class VerifierServiceImplTest method testFileRepositoryWithWrongMd5Sum.
@Test
public void testFileRepositoryWithWrongMd5Sum() throws Exception {
final RepositoryReferences repositories = sourceRepos("invalid/wrong_checksum");
assertEquals(false, verify(repositories));
// we expect two errors to be reported: the feature "jarsinging.feature" has a wrong md5 hash and
// the osgi.bundle "jarsigning" has also a wrong md5 hash.
// As each error is reported on two lines, we have 4 lines of error messages:
assertEquals(logger.errors.size(), 4);
// The first and third line contain the names of the units in error:
String unitsInError = logger.errors.get(0) + logger.errors.get(2);
assertTrue(unitsInError.contains("jarsigning.feature") && unitsInError.contains("osgi.bundle"));
// The second and fourth line contain the type of error: md5 hash
assertTrue(logger.errors.get(1).toLowerCase(Locale.ENGLISH).contains("md5 hash"));
assertTrue(logger.errors.get(3).toLowerCase(Locale.ENGLISH).contains("md5 hash"));
}
use of org.eclipse.tycho.p2.tools.RepositoryReferences in project tycho by eclipse.
the class VerifierServiceImplTest method testValidFileRepository.
@Test
public void testValidFileRepository() throws Exception {
final RepositoryReferences repositories = sourceRepos("selfsigned");
assertEquals(true, verify(repositories));
}
use of org.eclipse.tycho.p2.tools.RepositoryReferences 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();
}
}
Aggregations