diff options
author | Alexander Kurtakov | 2020-04-06 19:59:10 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2020-04-06 20:25:02 +0000 |
commit | 010ec318bdf1484d2e3967558eef188877f48fcb (patch) | |
tree | 0c7135b09ec5ec4a2efe15632cd718103e4133d5 | |
parent | a2c5904abc2b7b414da76814ca2d5c384603ad34 (diff) | |
download | rt.equinox.p2-010ec318bdf1484d2e3967558eef188877f48fcb.tar.gz rt.equinox.p2-010ec318bdf1484d2e3967558eef188877f48fcb.tar.xz rt.equinox.p2-010ec318bdf1484d2e3967558eef188877f48fcb.zip |
Bug 536106 - pack200 is being deprecated in java 11 and removed fromI20200408-0600I20200407-1800I20200407-1210I20200407-0120I20200406-1800
java 14
Fix Pack200ProcessorStep to still return OK if it's not enabled due to
missing pack200 utilities.
Disable some tests that rely on packed content.
Adjust others as on Java 14 packed content is not downloaded thus
results differ.
Change-Id: I65f16d4ebbc41e20ed7d2486ea9109fffa439779
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
5 files changed, 50 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF index c0369a2ab..a0243631d 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.repository;singleton:=true -Bundle-Version: 1.3.400.qualifier +Bundle-Version: 1.3.500.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.repository.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml index 49b7a10a8..df666e639 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml @@ -9,7 +9,7 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.artifact.repository</artifactId> - <version>1.3.400-SNAPSHOT</version> + <version>1.3.500-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <profiles> <profile> diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java index 9d4fd8580..9d85ac7ac 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java @@ -48,10 +48,18 @@ public class Pack200ProcessorStep extends AbstractBufferingStep { @Override public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(agent, descriptor, context); + boolean isJava14 = false; + if (System.getProperty("java.specification.version").compareTo("14") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$ + isJava14 = true; + } + if (!isEnabled()) { IStatus status = null; + // Missing pack200 executable is fine on Java 14+ + int statusCode = isJava14 ? IStatus.OK : IStatus.ERROR; if (detailedResult) { - status = new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpack facility not configured.", null); //$NON-NLS-1$ + status = new Status(statusCode, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, + "Unpack facility not configured.", null); //$NON-NLS-1$ detailedResult = true; } else { String[] locations = Utils.getPack200Commands("unpack200"); //$NON-NLS-1$ @@ -59,7 +67,9 @@ public class Pack200ProcessorStep extends AbstractBufferingStep { for (String location : locations) { locationTried.append(location).append(", "); //$NON-NLS-1$ } - status = new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpack facility not configured. The locations searched for unpack200 are: " + locationTried, null); //$NON-NLS-1$ + status = new Status(statusCode, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, + "Unpack facility not configured. The locations searched for unpack200 are: " + locationTried, //$NON-NLS-1$ + null); } setStatus(status); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java index aafa526ce..57d86ffc0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/MirrorRequestTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2017 IBM Corporation and others. + * Copyright (c) 2005, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -60,6 +60,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { File targetLocation; IArtifactRepository targetRepository, sourceRepository; URI destination, failedOptimized, pakedRepositoryLocation; + boolean isJava14; @Override public void setUp() throws Exception { @@ -74,6 +75,7 @@ public class MirrorRequestTest extends AbstractProvisioningTest { failedOptimized = URIUtil.toJarURI(getTestData("Error loading test data", "testData/mirror/invalidPackedMissingCanonical.zip").toURI(), null); pakedRepositoryLocation = getTestData("Error loading packed repository", "testData/mirror/mirrorPackedRepo").toURI(); destination = getTempFolder().toURI(); + isJava14 = System.getProperty("java.specification.version").compareTo("14") >= 0 ? true : false; //$NON-NLS-1$ //$NON-NLS-2$ } @Override @@ -118,7 +120,12 @@ public class MirrorRequestTest extends AbstractProvisioningTest { assertTrue(request.getResult().toString(), request.getResult().isOK()); assertTrue(String.format("Target does not contain artifact %s", key), targetRepository.contains(key)); - assertEquals("Exact number of downloads", 2, src.downloadCount); + if (isJava14) { + // Pack200 tools are gone in Java14+ thus pack.gz file is not downloaded + assertEquals("Exact number of downloads", 1, src.downloadCount); + } else { + assertEquals("Exact number of downloads", 2, src.downloadCount); + } } /** @@ -192,7 +199,12 @@ public class MirrorRequestTest extends AbstractProvisioningTest { seq.add(new Status(IStatus.WARNING, "Activator", "Message")); req.perform(source, new NullProgressMonitor()); - assertEquals("Expected WARNING status", IStatus.WARNING, req.getResult().getSeverity()); + if (isJava14) { + // packed artifact is ignored as Java 14 removed pack200 + assertEquals("Expected ERROR status", IStatus.ERROR, req.getResult().getSeverity()); + } else { + assertEquals("Expected WARNING status", IStatus.WARNING, req.getResult().getSeverity()); + } // Remove key from repo so the same one can be used targetRepository.removeDescriptor(key, new NullProgressMonitor()); @@ -203,7 +215,12 @@ public class MirrorRequestTest extends AbstractProvisioningTest { seq.add(new Status(IStatus.INFO, "Activator", "Message")); req.perform(source, new NullProgressMonitor()); - assertEquals("Expected INFO status", IStatus.INFO, req.getResult().getSeverity()); + if (isJava14) { + // packed artifact is ignored as Java 14 removed pack200 + assertEquals("Expected WARNING status", IStatus.WARNING, req.getResult().getSeverity()); + } else { + assertEquals("Expected INFO status", IStatus.INFO, req.getResult().getSeverity()); + } // Remove key from repo so the same one can be used targetRepository.removeDescriptor(key, new NullProgressMonitor()); @@ -212,14 +229,22 @@ public class MirrorRequestTest extends AbstractProvisioningTest { seq.add(new Status(IStatus.INFO, "Activator", "Message")); req.perform(source, new NullProgressMonitor()); - - assertEquals("Expected OK status", IStatus.OK, req.getResult().getSeverity()); + if (isJava14) { + // packed artifact is ignored as Java 14 removed pack200 + assertEquals("Expected WARNING status", IStatus.WARNING, req.getResult().getSeverity()); + } else { + assertEquals("Expected OK status", IStatus.OK, req.getResult().getSeverity()); + } } /* * */ public void testFailedOptimizedMissingCanonical() { + if (isJava14) { + // Java 14 doesn't have pack/unpack tools + return; + } try { IArtifactRepository source = new AbstractWrappedArtifactRepository(getArtifactRepositoryManager().loadRepository(failedOptimized, new NullProgressMonitor())) { diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java index 37d2b4927..2acff1940 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationArtifactTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -942,6 +942,10 @@ public class NewMirrorApplicationArtifactTest extends AbstractProvisioningTest { */ @Test public void testArtifactProcessingSteps() { + if (System.getProperty("java.specification.version").compareTo("14") >= 0) { + // Test explicitly uses pack200 artifacts which are not supported on Java 14+ + return; + } //Setup: load the repository containing packed data File packedRepoLocation = getTestData("27.0", "/testData/mirror/mirrorPackedRepo"); IArtifactRepository packedRepo = null; |