Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-11-03 22:29:52 +0000
committerMykola Nikishov2018-11-05 21:14:04 +0000
commit15a87510cc5744d65e0cc31b59cea479125f8429 (patch)
tree88ac00f28a4e08ce9c53bbb9a186da3e4ecdf4df
parentc842f0afec8d423f3b9e4e8dcd71371ad3b483ea (diff)
downloadrt.equinox.p2-15a87510cc5744d65e0cc31b59cea479125f8429.tar.gz
rt.equinox.p2-15a87510cc5744d65e0cc31b59cea479125f8429.tar.xz
rt.equinox.p2-15a87510cc5744d65e0cc31b59cea479125f8429.zip
Uncomment tests in ProcessingStepHandlerTestI20181106-0125
Change-Id: I2230fdcddca784467c307f25194f532b069df6a9 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java119
1 files changed, 63 insertions, 56 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
index b686ccd63..04216eb73 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/processing/ProcessingStepHandlerTest.java
@@ -14,9 +14,16 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.artifact.repository.processing;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.equinox.internal.p2.artifact.processors.md5.MD5Verifier;
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;
@@ -61,53 +68,53 @@ public class ProcessingStepHandlerTest extends AbstractProvisioningTest {
assertTrue(Arrays.equals(new byte[] {8}, result.toByteArray()));
}
- // public void testExecuteOneMD5VerifierPSOk() throws IOException {
- // ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("0cbc6611f5540bd0809a388dc95a615b")};
- // ByteArrayOutputStream result = new ByteArrayOutputStream(10);
- // OutputStream testStream = handler.link(steps, result, monitor);
- // testStream.write("Test".getBytes());
- // testStream.close();
- // assertEquals("Test", result.toString());
- // }
- //
- // public void testExecuteOneMD5VerifierPSFails() throws IOException {
- // ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("9cbc6611f5540bd0809a388dc95a615b")};
- // ByteArrayOutputStream result = new ByteArrayOutputStream(10);
- // OutputStream testStream = handler.link(steps, result, monitor);
- // testStream.write("Test".getBytes());
- // try {
- // testStream.close();
- // assertEquals("Test", result.toString());
- // assertTrue((ProcessingStepHandler.checkStatus(testStream).getSeverity() == IStatus.ERROR));
- // } catch (IOException e) {
- // assertTrue(true);
- // }
- // }
- //
- // public void testExecuteOneByteShifterAndOneMD5VerifierPSOk() throws IOException {
- // // Order of PSs is important!!
- // ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1), new MD5Verifier("ceeee507e8db83294600218b4e198897")};
- // ByteArrayOutputStream result = new ByteArrayOutputStream(10);
- // OutputStream testStream = handler.link(steps, result, monitor);
- // testStream.write(new byte[] {1, 2, 3, 4, 5});
- // testStream.close();
- // assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
- // }
- //
- // public void testExecuteOneByteShifterAndOneMD5VerifierPSFailWrongOrder() throws IOException {
- // // Order of PSs is important - here it wrong!!
- // ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("af476bbaf152a4c39ca4e5c498a88aa0"), new ByteShifter(1)};
- // ByteArrayOutputStream result = new ByteArrayOutputStream(10);
- // OutputStream testStream = handler.link(steps, result, monitor);
- // testStream.write(new byte[] {1, 2, 3, 4, 5});
- // try {
- // testStream.close();
- // assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
- // assertTrue((ProcessingStepHandler.checkStatus(testStream).getSeverity() == IStatus.ERROR));
- // } catch (IOException e) {
- // assertTrue(true);
- // }
- // }
+ public void testExecuteOneMD5VerifierPSOk() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("0cbc6611f5540bd0809a388dc95a615b")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write("Test".getBytes());
+ testStream.close();
+ assertEquals("Test", result.toString());
+ }
+
+ public void testExecuteOneMD5VerifierPSFails() throws IOException {
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("9cbc6611f5540bd0809a388dc95a615b")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write("Test".getBytes());
+ try {
+ testStream.close();
+ assertEquals("Test", result.toString());
+ assertTrue((ProcessingStepHandler.checkStatus(testStream).getSeverity() == IStatus.ERROR));
+ } catch (IOException e) {
+ assertTrue(true);
+ }
+ }
+
+ public void testExecuteOneByteShifterAndOneMD5VerifierPSOk() throws IOException {
+ // Order of PSs is important!!
+ ProcessingStep[] steps = new ProcessingStep[] {new ByteShifter(1), new MD5Verifier("ceeee507e8db83294600218b4e198897")};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
+ }
+
+ public void testExecuteOneByteShifterAndOneMD5VerifierPSFailWrongOrder() throws IOException {
+ // Order of PSs is important - here it wrong!!
+ ProcessingStep[] steps = new ProcessingStep[] {new MD5Verifier("af476bbaf152a4c39ca4e5c498a88aa0"), new ByteShifter(1)};
+ ByteArrayOutputStream result = new ByteArrayOutputStream(10);
+ OutputStream testStream = handler.link(steps, result, monitor);
+ testStream.write(new byte[] {1, 2, 3, 4, 5});
+ try {
+ testStream.close();
+ assertTrue(Arrays.equals(new byte[] {2, 4, 6, 8, 10}, result.toByteArray()));
+ assertTrue((ProcessingStepHandler.checkStatus(testStream).getSeverity() == IStatus.ERROR));
+ } catch (IOException e) {
+ assertTrue(true);
+ }
+ }
public void testAssureOrderingOfPSs1() throws IOException {
ProcessingStep[] steps = new ProcessingStep[] {new Adder(1), new Multiplier(2)};
@@ -153,13 +160,13 @@ public class ProcessingStepHandlerTest extends AbstractProvisioningTest {
assertEquals(ByteShifter.class, steps[0].getClass());
}
- // public void testCreateMD5VerifierPS() {
- // ProcessingStepDescriptor[] descriptors = new ProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.MD5Verifier", "1", true)};
- // ProcessingStep[] steps = handler.create(descriptors, null);
- // assertNotNull(steps);
- // assertEquals(1, steps.length);
- // assertEquals(MD5Verifier.class, steps[0].getClass());
- // }
+ public void testCreateMD5VerifierPS() {
+ ProcessingStepDescriptor[] descriptors = new ProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.MD5Verifier", "1", true)};
+ ProcessingStep[] steps = handler.create(getAgent(), descriptors, null);
+ assertNotNull(steps);
+ assertEquals(1, steps.length);
+ assertEquals(MD5Verifier.class, steps[0].getClass());
+ }
public void testCreateAdderPS() {
IProcessingStepDescriptor[] descriptors = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Adder", "1", true)};

Back to the top