aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Oehm2011-10-11 09:13:40 (EDT)
committerTobias Oberlies2011-10-12 11:03:38 (EDT)
commit9b6a4d2db749d0874ebf7942d8285469333f0793 (patch)
tree0310614f23c11f7cbe344750eda1af6db4d78d4e
parente4a88353f4433b2d37729d5f957acd3aa08efaa5 (diff)
downloadorg.eclipse.tycho-9b6a4d2db749d0874ebf7942d8285469333f0793.zip
org.eclipse.tycho-9b6a4d2db749d0874ebf7942d8285469333f0793.tar.gz
org.eclipse.tycho-9b6a4d2db749d0874ebf7942d8285469333f0793.tar.bz2
344691 Report all errors when verifying p2 repositories
Fix behavior in presence of multiple problems: report everything and dont stop reporting after the first error. Bug: 344691 Invalid MD5 sums for signed jars in eclipse-repository
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/verifier/VerifierServiceImpl.java4
-rw-r--r--tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/verfier/VerifierServiceImplTest.java12
2 files changed, 12 insertions, 4 deletions
diff --git a/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/verifier/VerifierServiceImpl.java b/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/verifier/VerifierServiceImpl.java
index 25af8fd..ac5f673 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/verifier/VerifierServiceImpl.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.tools.impl/src/main/java/org/eclipse/tycho/p2/tools/verifier/VerifierServiceImpl.java
@@ -53,7 +53,7 @@ public class VerifierServiceImpl implements VerifierService {
IInstallableUnit iu = iterator.next();
final Collection<IArtifactKey> artifacts = iu.getArtifacts();
for (IArtifactKey key : artifacts) {
- valid = valid && verifySingleArtifact(key, artifactRepository, logger);
+ valid &= verifySingleArtifact(key, artifactRepository, logger);
}
}
if (valid) {
@@ -78,7 +78,7 @@ public class VerifierServiceImpl implements VerifierService {
if (!status.isOK()) {
logErrorStatus(status, "", logger);
}
- valid = valid && status.isOK();
+ valid &= status.isOK();
}
return valid;
}
diff --git a/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/verfier/VerifierServiceImplTest.java b/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/verfier/VerifierServiceImplTest.java
index d6fac3d..1ae20a1 100644
--- a/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/verfier/VerifierServiceImplTest.java
+++ b/tycho-bundles/org.eclipse.tycho.p2.tools.tests/src/main/java/org/eclipse/tycho/p2/tools/verfier/VerifierServiceImplTest.java
@@ -52,8 +52,16 @@ public class VerifierServiceImplTest {
public void testFileRepositoryWithWrongMd5Sum() throws Exception {
final RepositoryReferences repositories = sourceRepos("wrong_checksum");
assertEquals(false, verify(repositories));
- assertTrue(firstErrorLine().contains("jarsigning"));
- assertTrue(remainingErrorText().contains("md5 hash"));
+ // 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"));
}
@Test