Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2016-11-04 21:17:11 +0000
committerThomas Watson2016-11-07 20:39:10 +0000
commit61729b60464bdfbdbfef9eed015b66bce7285782 (patch)
tree1c211f1596fda5582281a0b1c9f91c96306f2c1a
parentb85882be2121b5eb9667277da75604f4b2b797d0 (diff)
downloadrt.equinox.p2-61729b60464bdfbdbfef9eed015b66bce7285782.tar.gz
rt.equinox.p2-61729b60464bdfbdbfef9eed015b66bce7285782.tar.xz
rt.equinox.p2-61729b60464bdfbdbfef9eed015b66bce7285782.zip
Add tests for IPublisherInfo.A_NO_MD5 contractI20161108-0800
When creating an artifact descriptor with PublisherHelper, createArtifactDescriptor(IPublisherInfo, IArtifactRepository, IArtifactKey, File) will generate MD5 hash if (info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0) is true. As current tests cover only 1 out of 4 this condition's branches, add tests for missing branches that assert IPublisherInfo.A_NO_MD5 contract. Change-Id: I9912f01294cee8288a61520086d590f62524fff9 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MD5GenerationTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MD5GenerationTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MD5GenerationTest.java
index 4f93ecc7a..50aa5f472 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MD5GenerationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/MD5GenerationTest.java
@@ -12,6 +12,8 @@ package org.eclipse.equinox.p2.tests.publisher.actions;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.publisher.IPublisherInfo;
+import org.eclipse.equinox.p2.publisher.PublisherInfo;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
@@ -22,6 +24,21 @@ public class MD5GenerationTest extends AbstractProvisioningTest {
assertEquals("50d4ea58b02706ab373a908338877e02", ad.getProperty(IArtifactDescriptor.DOWNLOAD_MD5));
}
+ public void testGenerationFile_emptyPublisherInfo() {
+ ArtifactKey key = new ArtifactKey("classifierTest", "idTest", Version.createOSGi(1, 0, 0));
+ IPublisherInfo publisherInfo = new PublisherInfo();
+ IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(publisherInfo, key, getTestData("Artifact to generate from", "testData/artifactRepo/simpleWithMD5/plugins/aaPlugin_1.0.0.jar"));
+ assertEquals("50d4ea58b02706ab373a908338877e02", ad.getProperty(IArtifactDescriptor.DOWNLOAD_MD5));
+ }
+
+ public void testGenerationFile_noMd5() {
+ ArtifactKey key = new ArtifactKey("classifierTest", "idTest", Version.createOSGi(1, 0, 0));
+ PublisherInfo publisherInfo = new PublisherInfo();
+ publisherInfo.setArtifactOptions(IPublisherInfo.A_NO_MD5);
+ IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(publisherInfo, key, getTestData("Artifact to generate from", "testData/artifactRepo/simpleWithMD5/plugins/aaPlugin_1.0.0.jar"));
+ assertNull(ad.getProperty(IArtifactDescriptor.DOWNLOAD_MD5));
+ }
+
public void testGenerationFolder() {
IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(new ArtifactKey("classifierTest", "idTest", Version.createOSGi(1, 0, 0)), getTestData("Artifact to generate from", "testData/artifactRepo/simpleWithMD5/plugins/"));
assertNull(ad.getProperty(IArtifactDescriptor.DOWNLOAD_MD5));

Back to the top