Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-04-21 15:21:18 +0000
committerEike Stepper2010-04-21 15:21:18 +0000
commit32d593ec3c237baecf0501b82f76bca597909824 (patch)
tree40f2ea2b8e9b966abc3579d851de6b5159dd42f6
parent74c29c47dd8c7180f5d9d2e341342de39fed01fb (diff)
downloadcdo-32d593ec3c237baecf0501b82f76bca597909824.tar.gz
cdo-32d593ec3c237baecf0501b82f76bca597909824.tar.xz
cdo-32d593ec3c237baecf0501b82f76bca597909824.zip
[256936] Support for Offline Mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalStreamWrappingTest.java88
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java4
2 files changed, 88 insertions, 4 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalStreamWrappingTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalStreamWrappingTest.java
new file mode 100644
index 0000000000..7b97799a19
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalStreamWrappingTest.java
@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.tests;
+
+import org.eclipse.net4j.signal.wrapping.XORStreamWrapperInjector;
+import org.eclipse.net4j.tests.data.HugeData;
+import org.eclipse.net4j.tests.data.TinyData;
+import org.eclipse.net4j.tests.signal.ArrayRequest;
+import org.eclipse.net4j.tests.signal.TestSignalProtocol;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.io.XORStreamWrapper;
+
+import java.util.Arrays;
+
+/**
+ * @author Eike Stepper
+ */
+public class SignalStreamWrappingTest extends AbstractProtocolTest
+{
+ private static final int[] KEY = { 1, 2, 3, 4, 5 };
+
+ @Override
+ protected IManagedContainer createContainer()
+ {
+ IManagedContainer container = super.createContainer();
+ container.addPostProcessor(new XORStreamWrapperInjector(TestSignalProtocol.PROTOCOL_NAME, KEY));
+ return container;
+ }
+
+ public void testXORStreamWrapping() throws Exception
+ {
+ TestSignalProtocol protocol = null;
+
+ try
+ {
+ startTransport();
+ protocol = new TestSignalProtocol(getConnector());
+ protocol.setStreamWrapper(new XORStreamWrapper(KEY));
+ protocol.setTimeout(1000000L);
+
+ byte[] data = HugeData.getBytes();
+ byte[] result = new ArrayRequest(protocol, data).send();
+ assertEquals(true, Arrays.equals(data, result));
+ }
+ finally
+ {
+ if (protocol != null)
+ {
+ protocol.close();
+ }
+ }
+ }
+
+ public void testXORStreamWrappingWithMultipleSignals() throws Exception
+ {
+ TestSignalProtocol protocol = null;
+
+ try
+ {
+ startTransport();
+ protocol = new TestSignalProtocol(getConnector());
+ protocol.setStreamWrapper(new XORStreamWrapper(KEY));
+ protocol.setTimeout(1000000L);
+
+ for (int i = 0; i < 20; i++)
+ {
+ byte[] data = TinyData.getBytes();
+ byte[] result = new ArrayRequest(protocol, data).send();
+ assertEquals(true, Arrays.equals(data, result));
+ }
+ }
+ finally
+ {
+ if (protocol != null)
+ {
+ protocol.close();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
index 5fe0cbf6ef..1e738d47e8 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/SignalTest.java
@@ -31,10 +31,6 @@ import java.util.Arrays;
*/
public class SignalTest extends AbstractProtocolTest
{
- public SignalTest()
- {
- }
-
public void testInteger() throws Exception
{
TestSignalProtocol protocol = null;

Back to the top