diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers')
7 files changed, 71 insertions, 275 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java index 6c28f5203..49c2074df 100644 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/AllTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,20 +11,14 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.optimizers; -import junit.framework.*; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; /** * Performs all automated director tests. */ -public class AllTests extends TestCase { - - public static Test suite() { - TestSuite suite = new TestSuite(AllTests.class.getName()); - suite.addTestSuite(JBDiffStepTest.class); - suite.addTestSuite(JBDiffZipStepTest.class); - suite.addTestSuite(Pack200OptimizerTest.class); - suite.addTestSuite(JarDeltaOptimizerTest.class); - suite.addTestSuite(Bug209233Test.class); - return suite; - } +@RunWith(Suite.class) +@Suite.SuiteClasses({Pack200OptimizerTest.class, JarDeltaOptimizerTest.class}) +public class AllTests { + //test suite } diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java deleted file mode 100644 index 4c3ac6ac8..000000000 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Bug209233Test.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 compeople AG and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * compeople AG (Stefan Liebig) - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.artifact.optimizers; - -import ie.wombat.jbdiff.JBDiff; -import java.io.*; -import java.util.Arrays; -import junit.framework.TestCase; -import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; -import org.eclipse.equinox.p2.tests.optimizers.TestData; - -/** - * ... <code>Bug209233Test</code> ... - */ -public class Bug209233Test extends TestCase { - - // public void testGenerateTestDataDiff() throws IOException { - // File predecessor = TestData.getTempFile("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar"); - // File current = TestData.getTempFile("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar"); - // File diff = File.createTempFile("org.eclipse.jdt_3.2.0-3.3.0~", ".jbdiff"); - // JBDiff.bsdiff(predecessor, current, diff); - // } - - public void testDiffJdt32SarToJdt33Sar() throws IOException { - - InputStream current = TestData.get("sar", "org.eclipse.jdt_3.3.0.v20070607-1300.sar"); - ByteArrayOutputStream currentBS = new ByteArrayOutputStream(); - FileUtils.copyStream(current, true, currentBS, true); - byte[] currentBytes = currentBS.toByteArray(); - - InputStream predecessor = TestData.get("sar", "org.eclipse.jdt_3.2.0.v20060605-1400.sar"); - ByteArrayOutputStream predecessorBS = new ByteArrayOutputStream(); - FileUtils.copyStream(predecessor, true, predecessorBS, true); - byte[] predecessorBytes = predecessorBS.toByteArray(); - - byte[] actualBytes = JBDiff.bsdiff(predecessorBytes, predecessorBytes.length, currentBytes, currentBytes.length); - - InputStream expected = TestData.get("optimizers", "org.eclipse.jdt_3.2.0-3.3.0.jbdiff"); - ByteArrayOutputStream expectedBS = new ByteArrayOutputStream(); - FileUtils.copyStream(expected, true, expectedBS, true); - byte[] expectedBytes = expectedBS.toByteArray(); - - assertEquals("Different lengths.", expectedBytes.length, actualBytes.length); - assertTrue("Different bytes.", Arrays.equals(expectedBytes, actualBytes)); - } -} diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java deleted file mode 100644 index 3fb34e15d..000000000 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffStepTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * compeople AG (Stefan Liebig) - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.artifact.optimizers; - -import java.io.*; -import java.util.Arrays; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff.JBDiffStep; -import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; -import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; -import org.eclipse.equinox.p2.metadata.IArtifactKey; -import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; -import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor; -import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; -import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; -import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock; -import org.eclipse.equinox.p2.tests.optimizers.TestData; - -/** - * Test the <code>JBDiffStepTest</code> processing step. - */ -public class JBDiffStepTest extends OptimizerTest { - - // public void testGenerateTestDataExe32To33() throws IOException { - // File exe32 = TestData.getTempFile("optimizers", "eclipse-3.2.exe"); - // File exe33 = TestData.getTempFile("optimizers", "eclipse-3.3.exe"); - // File diff = File.createTempFile("eclipse-3.2-3.3~", ".jbdiff"); - // JBDiff.bsdiff(exe32, exe33, diff); - // } - - /** - * Test diffing the launcher. - * - * @throws IOException - */ - public void testDiffEclipseExe32to33() throws IOException { - - IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/eclipse-3.2.exe"); - MockableJBDiffStep differ = new MockableJBDiffStep(repoMock); - IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true); - IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1")); - ArtifactDescriptor descriptor = new ArtifactDescriptor(key); - differ.initialize(getAgent(), stepDescriptor, descriptor); - - ByteArrayOutputStream destination = new ByteArrayOutputStream(); - differ.link(destination, new NullProgressMonitor()); - - InputStream inputStream = TestData.get("optimizers", "eclipse-3.3.exe"); - FileUtils.copyStream(inputStream, true, differ, true); - - inputStream = TestData.get("optimizers", "eclipse-3.2-3.3.jbdiff"); - ByteArrayOutputStream expected = new ByteArrayOutputStream(); - FileUtils.copyStream(inputStream, true, expected, true); - assertTrue(Arrays.equals(expected.toByteArray(), destination.toByteArray())); - } - - /** - * Need to inject a repository! - */ - private static class MockableJBDiffStep extends JBDiffStep { - public MockableJBDiffStep(IArtifactRepository repository) { - super(repository); - } - } - -} diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java deleted file mode 100644 index f7edd45cb..000000000 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JBDiffZipStepTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * compeople AG (Stefan Liebig) - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.p2.tests.artifact.optimizers; - -import java.io.*; -import java.util.Arrays; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff.JBDiffZipStep; -import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; -import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; -import org.eclipse.equinox.p2.metadata.IArtifactKey; -import org.eclipse.equinox.p2.metadata.Version; -import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; -import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor; -import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; -import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; -import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock; -import org.eclipse.equinox.p2.tests.optimizers.TestData; - -/** - * Test the <code>JBDiffZipTest</code> processing step. - */ -public class JBDiffZipStepTest extends OptimizerTest { - - /** - * Test diffing the <b>normalized</b> jars. This is indicated by the extension ".njar". - * - * @throws IOException - */ - public void testDiffJdt32to33() throws IOException { - IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/org.eclipse.jdt_3.2.0.v20060605-1400.njar"); - MockableJBDiffZipStep differ = new MockableJBDiffZipStep(repoMock); - IProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0", true); - IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.1")); - ArtifactDescriptor descriptor = new ArtifactDescriptor(key); - differ.initialize(getAgent(), stepDescriptor, descriptor); - - ByteArrayOutputStream destination = new ByteArrayOutputStream(); - differ.link(destination, new NullProgressMonitor()); - - InputStream inputStream = TestData.get("optimizers", "org.eclipse.jdt_3.3.0.v20070607-1300.njar"); - FileUtils.copyStream(inputStream, true, differ, true); - - inputStream = TestData.get("optimizers", "org.eclipse.jdt_3.2.0-3.3.0.jbdiff"); - ByteArrayOutputStream expected = new ByteArrayOutputStream(); - FileUtils.copyStream(inputStream, true, expected, true); - - assertTrue("Different diff bytes.", Arrays.equals(expected.toByteArray(), destination.toByteArray())); - } - - /** - * Need to inject a repository! - */ - private static class MockableJBDiffZipStep extends JBDiffZipStep { - public MockableJBDiffZipStep(IArtifactRepository repository) { - super(repository); - } - } -} diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java index 3f9faf65a..c682ef5d9 100644 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/JarDeltaOptimizerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,31 +26,37 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; import org.eclipse.equinox.p2.tests.artifact.processors.ArtifactRepositoryMock; import org.eclipse.equinox.p2.tests.optimizers.TestData; +import org.junit.Test; /** * Test the <code>JarDelta</code> processing step. */ public class JarDeltaOptimizerTest extends OptimizerTest { - // public void testPrepare() throws IOException { - // IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar"); - // ProcessingStep step = new MockableJarDeltaOptimizerStep(repoMock); - // ProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", "ns,cl,id1,1.0.0.1", true); - // IArtifactKey key = new ArtifactKey("ns", "cl", "id1", Version.create("1.0.0.2")); - // ArtifactDescriptor descriptor = new ArtifactDescriptor(key); - // step.initialize(stepDescriptor, descriptor); - // ByteArrayOutputStream destination = new ByteArrayOutputStream(); - // step.link(destination, new NullProgressMonitor()); + // public void testPrepare() throws IOException { + // IArtifactRepository repoMock = + // ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar"); + // ProcessingStep step = new MockableJarDeltaOptimizerStep(repoMock); + // ProcessingStepDescriptor stepDescriptor = new ProcessingStepDescriptor("id", + // "ns,cl,id1,1.0.0.1", true); + // IArtifactKey key = new ArtifactKey("ns", "cl", "id1", + // Version.create("1.0.0.2")); + // ArtifactDescriptor descriptor = new ArtifactDescriptor(key); + // step.initialize(stepDescriptor, descriptor); + // ByteArrayOutputStream destination = new ByteArrayOutputStream(); + // step.link(destination, new NullProgressMonitor()); // - // InputStream inputStream = TestActivator.getContext().getBundle().getEntry("testData/optimizers/testdata_1.0.0.2.jar").openStream(); - // FileUtils.copyStream(inputStream, true, step, true); - // destination.close(); + // InputStream inputStream = + // TestActivator.getContext().getBundle().getEntry("testData/optimizers/testdata_1.0.0.2.jar").openStream(); + // FileUtils.copyStream(inputStream, true, step, true); + // destination.close(); // - // inputStream = new ByteArrayInputStream(destination.toByteArray()); - // FileOutputStream file = new FileOutputStream("d:/jardelta.jar"); - // FileUtils.copyStream(inputStream, true, file, true); - // } + // inputStream = new ByteArrayInputStream(destination.toByteArray()); + // FileOutputStream file = new FileOutputStream("d:/jardelta.jar"); + // FileUtils.copyStream(inputStream, true, file, true); + // } + @Test public void testOptimization() throws IOException { IArtifactRepository repoMock = ArtifactRepositoryMock.getMock("testData/optimizers/testdata_1.0.0.1.jar"); ProcessingStep step = new MockableJarDeltaOptimizerStep(repoMock); @@ -58,22 +64,22 @@ public class JarDeltaOptimizerTest extends OptimizerTest { IArtifactKey key = new ArtifactKey("cl", "id1", Version.create("1.0.0.2")); ArtifactDescriptor descriptor = new ArtifactDescriptor(key); step.initialize(getAgent(), stepDescriptor, descriptor); - ByteArrayOutputStream destination = new ByteArrayOutputStream(); - step.link(destination, new NullProgressMonitor()); + try (ByteArrayOutputStream destination = new ByteArrayOutputStream()) { + step.link(destination, new NullProgressMonitor()); - InputStream inputStream = TestData.get("optimizers", "testdata_1.0.0.2.jar"); - FileUtils.copyStream(inputStream, true, step, true); - destination.close(); + InputStream inputStream = TestData.get("optimizers", "testdata_1.0.0.2.jar"); + FileUtils.copyStream(inputStream, true, step, true); + destination.close(); - inputStream = TestData.get("optimizers", "testdata_1.0.0.1-2.jar"); - ByteArrayOutputStream expected = new ByteArrayOutputStream(); - FileUtils.copyStream(inputStream, true, expected, true); + inputStream = TestData.get("optimizers", "testdata_1.0.0.1-2.jar"); + ByteArrayOutputStream expected = new ByteArrayOutputStream(); + FileUtils.copyStream(inputStream, true, expected, true); - ZipInputStream expectedJar = new ZipInputStream(new ByteArrayInputStream(expected.toByteArray())); - ZipInputStream testJar = new ZipInputStream(new ByteArrayInputStream(destination.toByteArray())); - TestData.assertEquals(expectedJar, testJar); - expectedJar.close(); - testJar.close(); + try (ZipInputStream expectedJar = new ZipInputStream(new ByteArrayInputStream(expected.toByteArray())); + ZipInputStream testJar = new ZipInputStream(new ByteArrayInputStream(destination.toByteArray()))) { + TestData.assertEquals(expectedJar, testJar); + } + } } /** diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java index 887ed8499..7df22600f 100644 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/OptimizerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,22 +11,14 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.optimizers; -import junit.framework.TestCase; import org.eclipse.equinox.internal.p2.artifact.optimizers.Activator; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.p2.core.IProvisioningAgent; -public abstract class OptimizerTest extends TestCase { - public OptimizerTest(String name) { - super(name); - } - - public OptimizerTest() { - super(); - } +public abstract class OptimizerTest { protected static IProvisioningAgent getAgent() { - //get the global agent for the currently running system + // get the global agent for the currently running system return ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.class); } diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java index 2401e14c3..9a12a4163 100644 --- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java +++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/artifact/optimizers/Pack200OptimizerTest.java @@ -10,40 +10,36 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.optimizers; +import static org.junit.Assert.assertTrue; + import java.io.*; import java.util.Arrays; -import junit.framework.TestCase; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.artifact.optimizers.pack200.Pack200OptimizerStep; import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep; import org.eclipse.equinox.p2.tests.optimizers.TestActivator; +import org.junit.Test; import org.osgi.framework.Bundle; -public class Pack200OptimizerTest extends TestCase { - - public Pack200OptimizerTest(String name) { - super(name); - } - - public Pack200OptimizerTest() { - super(""); - } +public class Pack200OptimizerTest { - // public void testPrepare() throws IOException { - // // Setup the step - // ProcessingStep step = new Pack200OptimizerStep(); - // FileOutputStream destination = new FileOutputStream("c:/packed.pack.gz"); - // step.link(destination, new NullProgressMonitor()); + // public void testPrepare() throws IOException { + // // Setup the step + // ProcessingStep step = new Pack200OptimizerStep(); + // FileOutputStream destination = new FileOutputStream("c:/packed.pack.gz"); + // step.link(destination, new NullProgressMonitor()); // - // // drive the source data through the step - // Bundle bundle = TestActivator.getContext().getBundle(); - // InputStream inputStream = bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar").openStream(); - // FileUtils.copyStream(inputStream, true, step, true); + // // drive the source data through the step + // Bundle bundle = TestActivator.getContext().getBundle(); + // InputStream inputStream = + // bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar").openStream(); + // FileUtils.copyStream(inputStream, true, step, true); // - // destination.close(); - // } + // destination.close(); + // } + @Test public void testPack() throws IOException { // Setup the step ProcessingStep step = new Pack200OptimizerStep(); @@ -52,7 +48,8 @@ public class Pack200OptimizerTest extends TestCase { // drive the source data through the step Bundle bundle = TestActivator.getContext().getBundle(); - InputStream inputStream = bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar").openStream(); + InputStream inputStream = bundle.getEntry("testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar") + .openStream(); FileUtils.copyStream(inputStream, true, step, true); assertTrue("Failure: " + step.getStatus().getMessage(), step.getStatus().isOK()); @@ -60,12 +57,15 @@ public class Pack200OptimizerTest extends TestCase { // Get the test data. The Sun 1.6.0_01 JRE produces a different packed file // then the IBM V5 JRE, so both versions of the test data are maintained. // TODO: investigate this? Is the difference spurious? Are there differences - // in the pack200 results for other JREs? Do we need a more general - // solution to the problem? + // in the pack200 results for other JREs? Do we need a more general + // solution to the problem? String javaVersion = System.getProperty("java.version"); boolean is1_6 = javaVersion.compareTo("1.6") > 0; - inputStream = bundle.getEntry(is1_6 ? "testData/optimizers/1_6/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz" : "testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz").openStream(); + inputStream = bundle + .getEntry(is1_6 ? "testData/optimizers/1_6/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz" + : "testData/optimizers/org.eclipse.equinox.app_1.0.100.v20071015.jar.pack.gz") + .openStream(); ByteArrayOutputStream expected = new ByteArrayOutputStream(); FileUtils.copyStream(inputStream, true, expected, true); |