Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-02-11 01:27:59 +0000
committerAndrew Niefer2010-02-11 01:27:59 +0000
commitb1643fb0dd4cc405c15575ca42415a27bfa710fd (patch)
tree4c7230fe7c2989a4df5c9c347f75bf6b1199450b /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant
parent32c724f43579233028fc48080904606382a4318c (diff)
downloadrt.equinox.p2-b1643fb0dd4cc405c15575ca42415a27bfa710fd.tar.gz
rt.equinox.p2-b1643fb0dd4cc405c15575ca42415a27bfa710fd.tar.xz
rt.equinox.p2-b1643fb0dd4cc405c15575ca42415a27bfa710fd.zip
bug 302283 - exclude artifacts from compare
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
index fd244eb13..0d5416165 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
@@ -15,9 +15,12 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Iterator;
import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.processors.md5.Messages;
import org.eclipse.equinox.internal.p2.director.PermissiveSlicer;
+import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.internal.repository.comparator.MD5ArtifactComparator;
@@ -587,6 +590,51 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
assertArtifactKeyContentEquals("Different ArtifactKeys", result.query(InstallableUnitQuery.ANY, new NullProgressMonitor()), destinationRepo);
}
+ public void testMirrorCompareWithIgnore() throws Exception {
+ File testFolder = getTestFolder("mirrorWithIgnore");
+ File base = new File(testFolder, "base");
+ File source = new File(testFolder, "source");
+ File dest = new File(testFolder, "destination");
+
+ //some content for our fake bundles
+ Properties props = new Properties();
+ props.put("key", "value");
+
+ IArtifactKey key = new ArtifactKey("osgi.bundle", "a", Version.parseVersion("1.0.0"));
+ IArtifactRepository[] repos = new IArtifactRepository[] {createArtifactRepository(base.toURI(), null), createArtifactRepository(source.toURI(), null)};
+ for (int i = 0; i < 2; i++) {
+ ZipOutputStream stream = new ZipOutputStream(repos[i].getOutputStream(repos[i].createArtifactDescriptor(key)));
+ ZipEntry entry = new ZipEntry("file.properties");
+ stream.putNextEntry(entry);
+ props.store(stream, String.valueOf(i));
+ stream.closeEntry();
+ stream.close();
+ }
+ key = new ArtifactKey("osgi.bundle", "b", Version.parseVersion("1.0.0"));
+ for (int i = 0; i < 2; i++) {
+ ZipOutputStream stream = new ZipOutputStream(repos[i].getOutputStream(repos[i].createArtifactDescriptor(key)));
+ ZipEntry entry = new ZipEntry("file.properties");
+ stream.putNextEntry(entry);
+ props.put("boo", String.valueOf(i));
+ props.store(stream, String.valueOf(i));
+ stream.closeEntry();
+ stream.close();
+ }
+
+ AntTaskElement mirror = createMirrorTask(TYPE_ARTIFACT);
+ mirror.addElement(new AntTaskElement("source", new String[] {"location", URIUtil.toUnencodedString(source.toURI()), "kind", "artifact"}));
+ mirror.addElement(new AntTaskElement("destination", new String[] {"location", URIUtil.toUnencodedString(dest.toURI()), "kind", "artifact"}));
+ AntTaskElement comparator = new AntTaskElement("comparator");
+ comparator.addAttribute("comparator", "org.eclipse.equinox.p2.repository.tools.jar.comparator");
+ comparator.addAttribute("comparatorLog", new File(testFolder, "log.txt").getAbsolutePath());
+ comparator.addElement(new AntTaskElement("repository", new String[] {"location", URIUtil.toUnencodedString(base.toURI())}));
+ AntTaskElement exclude = new AntTaskElement("exclude");
+ exclude.addElement(new AntTaskElement("artifact", new String[] {"id", "b"}));
+ comparator.addElement(exclude);
+ mirror.addElement(comparator);
+ runAntTask();
+ }
+
/*
* Test the ability to slice an IU and mirror only the artifacts
*/

Back to the top