Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java29
1 files changed, 22 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java
index b2b8f93b3..5bbcc5996 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/processors/Pack200ProcessorTest.java
@@ -12,16 +12,16 @@ package org.eclipse.equinox.p2.tests.artifact.processors;
import java.io.*;
import java.util.Arrays;
-import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.artifact.processors.pack200.Pack200ProcessorStep;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.jarprocessor.PackStep;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
import org.eclipse.equinox.p2.tests.TestActivator;
import org.osgi.framework.Bundle;
-public class Pack200ProcessorTest extends TestCase {
+public class Pack200ProcessorTest extends AbstractProvisioningTest {
public Pack200ProcessorTest(String name) {
super(name);
@@ -68,6 +68,20 @@ public class Pack200ProcessorTest extends TestCase {
assertFalse(step.getStatus().isOK());
}
+ private File tempFolder;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ tempFolder = getTempFolder();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ delete(tempFolder);
+ }
+
/**
* Tests the case where we are unpacking a file that was not packed by
* our own pack step. In this case the eclipse.inf may not be present
@@ -80,21 +94,22 @@ public class Pack200ProcessorTest extends TestCase {
return;
// Setup the processor
ProcessingStep step = new Pack200ProcessorStep();
- ByteArrayOutputStream destination = new ByteArrayOutputStream();
+
+ File destinationFile = new File(tempFolder, "testUnpackFileNotPackedByJarProcessor.jar");
+ OutputStream destination = new BufferedOutputStream(new FileOutputStream(destinationFile));
step.link(destination, new NullProgressMonitor());
// drive the source data through the step
Bundle bundle = TestActivator.getContext().getBundle();
InputStream inputStream = bundle.getEntry("testData/optimizers/bug387557.bundle_1.0.0.201208200951.jar.pack.gz").openStream();
FileUtils.copyStream(inputStream, true, step, true);
+ destination.close();
// Get the expected result
- inputStream = bundle.getEntry("testData/optimizers/bug387557.bundle_1.0.0.201208200951.jar").openStream();
- ByteArrayOutputStream expected = new ByteArrayOutputStream();
- FileUtils.copyStream(inputStream, true, expected, true);
+ File expected = getTestData("Missing test data", "testData/optimizers/bug387557.bundle_1.0.0.201208200951.jar");
// Compare
- assertTrue(Arrays.equals(expected.toByteArray(), destination.toByteArray()));
+ assertEqualJars(expected, destinationFile);
}
}

Back to the top