diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/CompositeArtifactProviderTestBase.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/CompositeArtifactProviderTestBase.java index a5ea5bec56..a8c25ccd7b 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/CompositeArtifactProviderTestBase.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/CompositeArtifactProviderTestBase.java @@ -244,13 +244,13 @@ public void testGetArtifactDescriptorsDoesNotReturnDuplicates() { List result = Arrays.asList(subject.getArtifactDescriptors(BUNDLE_A_KEY)); assertThat(result, hasItem(inCanonicalFormat())); - assertEquals(2, result.size()); // no duplicates + assertEquals(1, result.size()); // no duplicates } @Test public void testContainsArtifactDescriptor() { assertTrue(subject.contains(canonicalDescriptorFor(BUNDLE_A_KEY))); - assertFalse(subject.contains(canonicalDescriptorFor(BUNDLE_B_KEY))); + assertTrue(subject.contains(canonicalDescriptorFor(BUNDLE_B_KEY))); } @Test diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/MirroringArtifactProviderErrorTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/MirroringArtifactProviderErrorTest.java index b383f44afd..ab7a9b9f26 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/MirroringArtifactProviderErrorTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/MirroringArtifactProviderErrorTest.java @@ -16,6 +16,7 @@ import static org.eclipse.tycho.test.util.ProbeArtifactSink.newArtifactSinkFor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThrows; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.metadata.IArtifactKey; @@ -36,7 +37,7 @@ public class MirroringArtifactProviderErrorTest extends TychoPlexusTestCase { - private static final IArtifactKey CORRUPT_ARTIFACT = TestRepositoryContent.BUNDLE_B_KEY; + private static final IArtifactKey CORRUPT_ARTIFACT = TestRepositoryContent.BUNDLE_A_KEY; @Rule public LogVerifier logVerifier = new LogVerifier(); @@ -58,19 +59,15 @@ public void before() throws Exception { new MockMavenContext(null, logVerifier.getLogger())); } - @Test(expected = MirroringFailedException.class) + @Test public void testMirrorCorruptArtifact() throws Exception { logVerifier.expectError(CORRUPT_ARTIFACT.toString()); testSink = newArtifactSinkFor(CORRUPT_ARTIFACT); - try { - // here we expect an exception, an not (!) an error status, to be consistent with other methods that mirror but don't return a status - subject.getArtifact(testSink, null); - - } finally { - assertNotMirrored(CORRUPT_ARTIFACT); - assertFalse(testSink.writeIsStarted()); - } + // here we expect an exception, an not (!) an error status, to be consistent with other methods that mirror but don't return a status + assertThrows(MirroringFailedException.class, () -> subject.getArtifact(testSink, null)); + assertNotMirrored(CORRUPT_ARTIFACT); + assertFalse(testSink.writeIsStarted()); } private void assertNotMirrored(IArtifactKey key) { diff --git a/tycho-core/src/test/java/org/eclipse/tycho/test/util/P2Repositories.java b/tycho-core/src/test/java/org/eclipse/tycho/test/util/P2Repositories.java deleted file mode 100644 index 2175ff4b4e..0000000000 --- a/tycho-core/src/test/java/org/eclipse/tycho/test/util/P2Repositories.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.tycho.test.util; - -import java.net.URI; - -import org.eclipse.tycho.core.test.utils.ResourceUtil; - -/** - * p2 repository resources used for multiple tests. - */ -public enum P2Repositories { - ECLIPSE_342("e342"), PACK_GZ("packgz"); - - private final String path; - - P2Repositories(String path) { - this.path = path; - } - - public URI toURI() { - return ResourceUtil.resourceFile("repositories/" + path).toURI(); - - } - - @Override - public String toString() { - return toURI().toString(); - } - -} diff --git a/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestRepositoryContent.java b/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestRepositoryContent.java index 280652bf7a..b679a3a029 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestRepositoryContent.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/test/util/TestRepositoryContent.java @@ -26,8 +26,8 @@ public final class TestRepositoryContent { public static final IArtifactKey BUNDLE_A_KEY = new ArtifactKey("osgi.bundle", "org.eclipse.osgi", Version.parseVersion("3.4.3.R34x_v20081215-1030")); - public static final IArtifactKey BUNDLE_B_KEY = new ArtifactKey("osgi.bundle", "org.eclipse.ecf", - Version.parseVersion("3.1.300.v20120319-0616")); + public static final IArtifactKey BUNDLE_B_KEY = new ArtifactKey("osgi.bundle", "org.eclipse.core.runtime", + Version.parseVersion("3.4.0.v20080512")); public static final Set BUNDLE_A_FILES = new HashSet<>(Arrays.asList("about_files/", "META-INF/", "META-INF/MANIFEST.MF", "org/", "org/eclipse/", "org/eclipse/core/", "org/eclipse/core/runtime/", @@ -73,13 +73,10 @@ public final class TestRepositoryContent { // repositories (of regular p2 type) containing the test data /** Repository with bundle A */ - public static final URI REPO_BUNDLE_A = P2Repositories.ECLIPSE_342.toURI(); + public static final URI REPO_BUNDLE_A = ResourceUtil.resourceFile("repositories/e342").toURI(); public static final URI REPO2_BUNDLE_A = ResourceUtil.resourceFile("repositories2/e342").toURI(); - /** - * Repository with bundles A and B. Bundle A is available both in packed and canonical format, - * bundle B only in packed format. - */ - public static final URI REPO_BUNDLE_AB = P2Repositories.PACK_GZ.toURI(); + /** Repository with bundles A and B. Both bundles are available in canonical format. */ + public static final URI REPO_BUNDLE_AB = ResourceUtil.resourceFile("repositories/e342_3").toURI(); /** Repository that claims to contain bundle A, but accesses to the artifact file will fail */ public static final URI REPO_BUNDLE_A_CORRUPT = ResourceUtil.resourceFile("repositories/e342_missing_file").toURI(); @@ -88,7 +85,7 @@ public final class TestRepositoryContent { * format, but the artifact is broken. Bundle A is contained in packed format (artifact missing) * and in canonical format (working). */ - public static final URI REPO_BUNLDE_AB_PACK_CORRUPT = ResourceUtil.resourceFile("repositories/packgz_corrupt") + public static final URI REPO_BUNLDE_AB_PACK_CORRUPT = ResourceUtil.resourceFile("repositories/e342_corrupt") .toURI(); } diff --git a/tycho-core/src/test/resources/repositories/e342_3/artifacts.xml b/tycho-core/src/test/resources/repositories/e342_3/artifacts.xml new file mode 100644 index 0000000000..c3beb6a952 --- /dev/null +++ b/tycho-core/src/test/resources/repositories/e342_3/artifacts.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tycho-core/src/test/resources/repositories/packgz/content.xml b/tycho-core/src/test/resources/repositories/e342_3/content.xml similarity index 88% rename from tycho-core/src/test/resources/repositories/packgz/content.xml rename to tycho-core/src/test/resources/repositories/e342_3/content.xml index 7f8263e091..fc2ea272fd 100644 --- a/tycho-core/src/test/resources/repositories/packgz/content.xml +++ b/tycho-core/src/test/resources/repositories/e342_3/content.xml @@ -1,6 +1,6 @@ - + @@ -267,45 +267,43 @@ - - - - - + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + + - + - Import-Package: org.eclipse.core.runtime.jobs,org.eclipse.equinox.concurrent.future;version="1.0.0";resolution:=optional,org.osgi.framework;version="1.3.0",org.osgi.service.log;version="1.3.0",org.osgi.util.tracker;version="1.3.2" Bundle-ManifestVersion: 2 Created-By: 1.5.0_22-b03 (Sun Microsystems Inc.) Manifest-Version: 1.0 Bundle-Name: %plugin.name Bundle-Vendor: %plugin.provider Bundle-ActivationPolicy: lazy Ant-Version: Apache Ant 1.7.1 Bundle-Version: 3.1.300.v20120319-0616 Export-Package: org.eclipse.ecf.core;version="3.0.0",org.eclipse.ecf.core.events,org.eclipse.ecf.core.jobs;version="1.0";x-internal:=true,org.eclipse.ecf.core.provider,org.eclipse.ecf.core.security,org.eclipse.ecf.core.start,org.eclipse.ecf.core.status;version="1.0";x-internal:=true,org.eclipse.ecf.core.user,org.eclipse.ecf.core.util,org.eclipse.ecf.internal.core;x-internal:=true Require-Bundle: org.eclipse.equinox.common,org.eclipse.equinox.registry,org.eclipse.ecf.identity;visibility:=reexport Bundle-Activator: org.eclipse.ecf.internal.core.ECFPlugin Bundle-SymbolicName: org.eclipse.ecf;singleton:=true Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,J2SE-1.4 Bundle-Localization: plugin + Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3 Bundle-Name: %pluginName Bundle-Activator: org.eclipse.core.internal.runtime.PlatformActivator Manifest-Version: 1.0 Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-SymbolicName: org.eclipse.core.runtime; singleton:=true Bundle-ManifestVersion: 2 DynamicImport-Package: org.eclipse.core.internal.runtime.auth Bundle-Version: 3.4.0.v20080512 Bundle-Localization: plugin Export-Package: org.eclipse.core.internal.preferences.legacy;x-internal:=true,org.eclipse.core.internal.runtime;x-friends:="org.eclipse.core.runtime.compatibility",org.eclipse.core.runtime;version="3.4.0" Require-Bundle: org.eclipse.osgi;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,org.eclipse.core.jobs;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,org.eclipse.equinox.registry;bundle-version="[3.4.0,4.0.0)";visibility:=reexport,org.eclipse.equinox.preferences;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,org.eclipse.core.contenttype;bundle-version="[3.3.0,4.0.0)";visibility:=reexport,org.eclipse.core.runtime.compatibility.auth;bundle-version="[3.2.0,4.0.0)";resolution:=optional,org.eclipse.equinox.app;bundle-version="[1.0.0,2.0.0)";visibility:=reexport diff --git a/tycho-core/src/test/resources/repositories/e342_3/plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar b/tycho-core/src/test/resources/repositories/e342_3/plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar new file mode 100644 index 0000000000..7d491ef10a Binary files /dev/null and b/tycho-core/src/test/resources/repositories/e342_3/plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar differ diff --git a/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar b/tycho-core/src/test/resources/repositories/e342_3/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar similarity index 100% rename from tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar rename to tycho-core/src/test/resources/repositories/e342_3/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar diff --git a/tycho-core/src/test/resources/repositories/packgz_corrupt/artifacts.xml b/tycho-core/src/test/resources/repositories/e342_corrupt/artifacts.xml similarity index 54% rename from tycho-core/src/test/resources/repositories/packgz_corrupt/artifacts.xml rename to tycho-core/src/test/resources/repositories/e342_corrupt/artifacts.xml index cad6d3a361..7fdfc84bc4 100644 --- a/tycho-core/src/test/resources/repositories/packgz_corrupt/artifacts.xml +++ b/tycho-core/src/test/resources/repositories/e342_corrupt/artifacts.xml @@ -1,49 +1,31 @@ - - - + + - - + - - - + + - - - - - + - + - - - - - - - - - - - diff --git a/tycho-core/src/test/resources/repositories/packgz_corrupt/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar b/tycho-core/src/test/resources/repositories/e342_corrupt/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar similarity index 100% rename from tycho-core/src/test/resources/repositories/packgz_corrupt/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar rename to tycho-core/src/test/resources/repositories/e342_corrupt/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar diff --git a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.core.runtime/3.4.0.v20080512/org.eclipse.core.runtime-3.4.0.v20080512-p2artifacts.xml b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.core.runtime/3.4.0.v20080512/org.eclipse.core.runtime-3.4.0.v20080512-p2artifacts.xml new file mode 100644 index 0000000000..88efa3a2a1 --- /dev/null +++ b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.core.runtime/3.4.0.v20080512/org.eclipse.core.runtime-3.4.0.v20080512-p2artifacts.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.core.runtime/3.4.0.v20080512/org.eclipse.core.runtime_3.4.0.v20080512.jar b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.core.runtime/3.4.0.v20080512/org.eclipse.core.runtime_3.4.0.v20080512.jar new file mode 100644 index 0000000000..7d491ef10a Binary files /dev/null and b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.core.runtime/3.4.0.v20080512/org.eclipse.core.runtime_3.4.0.v20080512.jar differ diff --git a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.ecf/3.1.300.v20120319-0616/org.eclipse.ecf-3.1.300.v20120319-0616-p2artifacts.xml b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.ecf/3.1.300.v20120319-0616/org.eclipse.ecf-3.1.300.v20120319-0616-p2artifacts.xml deleted file mode 100644 index 9f2978eeea..0000000000 --- a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.ecf/3.1.300.v20120319-0616/org.eclipse.ecf-3.1.300.v20120319-0616-p2artifacts.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.ecf/3.1.300.v20120319-0616/org.eclipse.ecf-3.1.300.v20120319-0616-pack200.jar.pack.gz b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.ecf/3.1.300.v20120319-0616/org.eclipse.ecf-3.1.300.v20120319-0616-pack200.jar.pack.gz deleted file mode 100644 index 4d16ac8cb1..0000000000 Binary files a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.ecf/3.1.300.v20120319-0616/org.eclipse.ecf-3.1.300.v20120319-0616-pack200.jar.pack.gz and /dev/null differ diff --git a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-p2artifacts.xml b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-p2artifacts.xml index adf2f7271c..6093d5397d 100644 --- a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-p2artifacts.xml +++ b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-p2artifacts.xml @@ -1,15 +1,10 @@ - - + - - - - - - - + + + diff --git a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-pack200.jar.pack.gz b/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-pack200.jar.pack.gz deleted file mode 100644 index 079ecba551..0000000000 Binary files a/tycho-core/src/test/resources/repositories/local/p2/osgi/bundle/org.eclipse.osgi/3.4.3.R34x_v20081215-1030/org.eclipse.osgi-3.4.3.R34x_v20081215-1030-pack200.jar.pack.gz and /dev/null differ diff --git a/tycho-core/src/test/resources/repositories/packgz/artifacts.xml b/tycho-core/src/test/resources/repositories/packgz/artifacts.xml deleted file mode 100644 index 6a409338a5..0000000000 --- a/tycho-core/src/test/resources/repositories/packgz/artifacts.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.ecf_3.1.300.v20120319-0616.jar.pack.gz b/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.ecf_3.1.300.v20120319-0616.jar.pack.gz deleted file mode 100644 index 4d16ac8cb1..0000000000 Binary files a/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.ecf_3.1.300.v20120319-0616.jar.pack.gz and /dev/null differ diff --git a/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar.pack.gz b/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar.pack.gz deleted file mode 100644 index 079ecba551..0000000000 Binary files a/tycho-core/src/test/resources/repositories/packgz/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar.pack.gz and /dev/null differ diff --git a/tycho-core/src/test/resources/repositories/packgz_corrupt/plugins/org.eclipse.ecf_3.1.300.v20120319-0616.jar.pack.gz b/tycho-core/src/test/resources/repositories/packgz_corrupt/plugins/org.eclipse.ecf_3.1.300.v20120319-0616.jar.pack.gz deleted file mode 100644 index a792498201..0000000000 Binary files a/tycho-core/src/test/resources/repositories/packgz_corrupt/plugins/org.eclipse.ecf_3.1.300.v20120319-0616.jar.pack.gz and /dev/null differ