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..3f7c9c3d8b 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/packgz").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(); diff --git a/tycho-core/src/test/resources/repositories/packgz/artifacts.xml b/tycho-core/src/test/resources/repositories/packgz/artifacts.xml index 6a409338a5..a478f0ec21 100644 --- a/tycho-core/src/test/resources/repositories/packgz/artifacts.xml +++ b/tycho-core/src/test/resources/repositories/packgz/artifacts.xml @@ -1,27 +1,21 @@ - - + - - + - - - - - - + + - - - + + + @@ -32,15 +26,5 @@ - - - - - - - - - - diff --git a/tycho-core/src/test/resources/repositories/packgz/content.xml b/tycho-core/src/test/resources/repositories/packgz/content.xml index 7f8263e091..cadb4f3adf 100644 --- a/tycho-core/src/test/resources/repositories/packgz/content.xml +++ b/tycho-core/src/test/resources/repositories/packgz/content.xml @@ -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/packgz/plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar b/tycho-core/src/test/resources/repositories/packgz/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/packgz/plugins/org.eclipse.core.runtime_3.4.0.v20080512.jar differ 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/artifacts.xml b/tycho-core/src/test/resources/repositories/packgz_corrupt/artifacts.xml index cad6d3a361..5d327c3e56 100644 --- a/tycho-core/src/test/resources/repositories/packgz_corrupt/artifacts.xml +++ b/tycho-core/src/test/resources/repositories/packgz_corrupt/artifacts.xml @@ -1,49 +1,31 @@ - - + - - + - - - + + - - - - - + - + - - - - - - - - - - - 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