Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-02-17 08:50:21 +0000
committerEike Stepper2010-02-17 08:50:21 +0000
commit7ec7a04e603779770972c46a0f848a2a205f88e0 (patch)
tree0a62f289511db78ecf7cf213bb10e4d0fc80bad5
parentb42fb831e1c2229e5387e39bb176739b9cb49da6 (diff)
downloadcdo-7ec7a04e603779770972c46a0f848a2a205f88e0.tar.gz
cdo-7ec7a04e603779770972c46a0f848a2a205f88e0.tar.xz
cdo-7ec7a04e603779770972c46a0f848a2a205f88e0.zip
*** empty log message ***
-rw-r--r--features/org.eclipse.emf.cdo.sdk-feature/feature.xml83
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla262875_Test.java506
2 files changed, 322 insertions, 267 deletions
diff --git a/features/org.eclipse.emf.cdo.sdk-feature/feature.xml b/features/org.eclipse.emf.cdo.sdk-feature/feature.xml
index 9f0a4e72d1..047d9ead15 100644
--- a/features/org.eclipse.emf.cdo.sdk-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.sdk-feature/feature.xml
@@ -61,19 +61,74 @@
version="0.0.0"
unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.common.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.defs.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.edit.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.examples.company.edit.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.examples.company.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.examples.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.migrator.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.net4j.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.server.db.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.server.net4j.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.server.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.ui.defs.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
- <plugin id="org.eclipse.emf.cdo.ui.source" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
+ <plugin
+ id="org.eclipse.emf.cdo.common.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.defs.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.edit.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.examples.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.migrator.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.server.db.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.server.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.ui.defs.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.emf.cdo.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
</feature>
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla262875_Test.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla262875_Test.java
index 495da25076..e7bb32b622 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla262875_Test.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/bugzilla/Bugzilla262875_Test.java
@@ -1,253 +1,253 @@
-/**
- * Copyright (c) 2004 - 2009 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:
- * David Bonneau - initial API and implementation
- * Andre Dietisheim - maintenance
- */
-package org.eclipse.net4j.tests.bugzilla;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.connector.IConnector;
-import org.eclipse.net4j.jvm.JVMUtil;
-import org.eclipse.net4j.signal.IndicationWithResponse;
-import org.eclipse.net4j.signal.RequestWithConfirmation;
-import org.eclipse.net4j.signal.SignalProtocol;
-import org.eclipse.net4j.signal.SignalReactor;
-import org.eclipse.net4j.util.IErrorHandler;
-import org.eclipse.net4j.util.concurrent.Worker;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.factory.ProductCreationException;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.tests.AbstractOMTest;
-
-import org.eclipse.spi.net4j.ServerProtocolFactory;
-
-import java.nio.BufferUnderflowException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * @author David Bonneau
- */
-public class Bugzilla262875_Test extends AbstractOMTest
-{
- /** the length of the metadata sent in a buffer: channelID, correlationID */
- private static final short BUFFER_METADATA_LENTGH = 10;
-
- private static final long DEFAULT_TIMEOUT_EXPECTED = 2 * 1000;
-
- private IManagedContainer container;
-
- private IConnector connector;
-
- @Override
- protected void doSetUp() throws Exception
- {
- super.doSetUp();
- container = ContainerUtil.createContainer();
- Net4jUtil.prepareContainer(container);
- JVMUtil.prepareContainer(container);
- container.registerFactory(new TestProtocol.Factory());
- container.activate();
-
- JVMUtil.getAcceptor(container, "default");
- connector = JVMUtil.getConnector(container, "default");
- }
-
- @Override
- protected void doTearDown() throws Exception
- {
- connector.close();
- container.deactivate();
- super.doTearDown();
- }
-
- /**
- * Tests if a buffer underflow exception occurs if the data sent in a request exactly matches the capacity of a
- * buffer.
- *
- * @throws Exception
- * the exception
- */
- public void testGivenDataMatchesBufferLengthThenBufferUnderflowException() throws Exception
- {
- final AtomicBoolean failed = new AtomicBoolean(false);
- final CountDownLatch latch = new CountDownLatch(1);
- IErrorHandler oldErrorHandler = Worker.setGlobalErrorHandler(new IErrorHandler()
- {
- public void handleError(Throwable t)
- {
- t.printStackTrace();
- if (t instanceof BufferUnderflowException)
- {
- failed.set(true);
- }
-
- latch.countDown();
- }
- });
-
- try
- {
- TestProtocol protocol = new TestProtocol();
- protocol.open(connector);
-
- short bufferCapacity = protocol.getBufferProvider().getBufferCapacity();
- new TestProtocol.Request(protocol, bufferCapacity - BUFFER_METADATA_LENTGH).send();
-
- latch.await(DEFAULT_TIMEOUT_EXPECTED, TimeUnit.MILLISECONDS);
- assertEquals(false, failed.get());
- }
- finally
- {
- Worker.setGlobalErrorHandler(oldErrorHandler);
- }
- }
-
- /**
- * Tests if an illegal argument exception occurs if the data sent in a request's larger than the capacity of a buffer.
- *
- * @throws Exception
- * the exception
- */
- public void _testGivenDataIsLargerThanBufferLengthThenIllegalArgumentException() throws Exception
- {
- final AtomicBoolean failed = new AtomicBoolean(false);
- final CountDownLatch latch = new CountDownLatch(1);
- IErrorHandler oldErrorHandler = Worker.setGlobalErrorHandler(new IErrorHandler()
- {
- public void handleError(Throwable t)
- {
- t.printStackTrace();
- if (t instanceof IllegalArgumentException)
- {
- failed.set(true);
- }
-
- latch.countDown();
- }
- });
-
- try
- {
- TestProtocol protocol = new TestProtocol();
- protocol.open(connector);
-
- short bufferCapacity = protocol.getBufferProvider().getBufferCapacity();
- new TestProtocol.Request(protocol, bufferCapacity + 10).send();
-
- latch.await(DEFAULT_TIMEOUT_EXPECTED, TimeUnit.MILLISECONDS);
- assertEquals(false, failed.get());
- }
- finally
- {
- Worker.setGlobalErrorHandler(oldErrorHandler);
- }
- }
-
- /**
- * @author David Bonneau
- */
- private static final class TestProtocol extends SignalProtocol<Object>
- {
- private static final String NAME = "TEST_PROTOCOL";
-
- private static final short SIGNAL_ID = 10;
-
- public TestProtocol()
- {
- super(NAME);
- }
-
- @Override
- protected SignalReactor createSignalReactor(short signalID)
- {
- switch (signalID)
- {
- case SIGNAL_ID:
- return new Indication(this);
- }
-
- return super.createSignalReactor(signalID);
- }
-
- /**
- * @author David Bonneau
- */
- private static final class Request extends RequestWithConfirmation<Boolean>
- {
- private int requestNumOfBytes;
-
- public Request(SignalProtocol<?> protocol, int requestNumOfBytes)
- {
- super(protocol, SIGNAL_ID);
- this.requestNumOfBytes = requestNumOfBytes;
- }
-
- @Override
- protected void requesting(ExtendedDataOutputStream out) throws Exception
- {
- for (int i = 0; i < requestNumOfBytes; ++i)
- {
- out.writeByte(i);
- }
-
- // delay completion
- Thread.sleep(100);
- }
-
- @Override
- protected Boolean confirming(ExtendedDataInputStream in) throws Exception
- {
- return in.readBoolean();
- }
- }
-
- /**
- * @author David Bonneau
- */
- private static final class Indication extends IndicationWithResponse
- {
- public Indication(SignalProtocol<?> protocol)
- {
- super(protocol, SIGNAL_ID);
- }
-
- @Override
- protected void indicating(ExtendedDataInputStream in) throws Exception
- {
- System.out.println("indicating");
- }
-
- @Override
- protected void responding(ExtendedDataOutputStream out) throws Exception
- {
- out.writeBoolean(true);
- }
- }
-
- /**
- * @author David Bonneau
- */
- private static final class Factory extends ServerProtocolFactory
- {
- public Factory()
- {
- super(NAME);
- }
-
- public Object create(String description) throws ProductCreationException
- {
- return new TestProtocol();
- }
- }
- }
-}
+/**
+ * Copyright (c) 2004 - 2009 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:
+ * David Bonneau - initial API and implementation
+ * Andre Dietisheim - maintenance
+ */
+package org.eclipse.net4j.tests.bugzilla;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.jvm.JVMUtil;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.signal.RequestWithConfirmation;
+import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.signal.SignalReactor;
+import org.eclipse.net4j.util.IErrorHandler;
+import org.eclipse.net4j.util.concurrent.Worker;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.factory.ProductCreationException;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.tests.AbstractOMTest;
+
+import org.eclipse.spi.net4j.ServerProtocolFactory;
+
+import java.nio.BufferUnderflowException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * @author David Bonneau
+ */
+public class Bugzilla262875_Test extends AbstractOMTest
+{
+ /** the length of the metadata sent in a buffer: channelID, correlationID */
+ private static final short BUFFER_METADATA_LENTGH = 10;
+
+ private static final long DEFAULT_TIMEOUT_EXPECTED = 2 * 1000;
+
+ private IManagedContainer container;
+
+ private IConnector connector;
+
+ @Override
+ protected void doSetUp() throws Exception
+ {
+ super.doSetUp();
+ container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container);
+ JVMUtil.prepareContainer(container);
+ container.registerFactory(new TestProtocol.Factory());
+ container.activate();
+
+ JVMUtil.getAcceptor(container, "default");
+ connector = JVMUtil.getConnector(container, "default");
+ }
+
+ @Override
+ protected void doTearDown() throws Exception
+ {
+ connector.close();
+ container.deactivate();
+ super.doTearDown();
+ }
+
+ /**
+ * Tests if a buffer underflow exception occurs if the data sent in a request exactly matches the capacity of a
+ * buffer.
+ *
+ * @throws Exception
+ * the exception
+ */
+ public void testGivenDataMatchesBufferLengthThenBufferUnderflowException() throws Exception
+ {
+ final AtomicBoolean failed = new AtomicBoolean(false);
+ final CountDownLatch latch = new CountDownLatch(1);
+ IErrorHandler oldErrorHandler = Worker.setGlobalErrorHandler(new IErrorHandler()
+ {
+ public void handleError(Throwable t)
+ {
+ t.printStackTrace();
+ if (t instanceof BufferUnderflowException)
+ {
+ failed.set(true);
+ }
+
+ latch.countDown();
+ }
+ });
+
+ try
+ {
+ TestProtocol protocol = new TestProtocol();
+ protocol.open(connector);
+
+ short bufferCapacity = protocol.getBufferProvider().getBufferCapacity();
+ new TestProtocol.Request(protocol, bufferCapacity - BUFFER_METADATA_LENTGH).send();
+
+ latch.await(DEFAULT_TIMEOUT_EXPECTED, TimeUnit.MILLISECONDS);
+ assertEquals(false, failed.get());
+ }
+ finally
+ {
+ Worker.setGlobalErrorHandler(oldErrorHandler);
+ }
+ }
+
+ /**
+ * Tests if an illegal argument exception occurs if the data sent in a request's larger than the capacity of a buffer.
+ *
+ * @throws Exception
+ * the exception
+ */
+ public void _testGivenDataIsLargerThanBufferLengthThenIllegalArgumentException() throws Exception
+ {
+ final AtomicBoolean failed = new AtomicBoolean(false);
+ final CountDownLatch latch = new CountDownLatch(1);
+ IErrorHandler oldErrorHandler = Worker.setGlobalErrorHandler(new IErrorHandler()
+ {
+ public void handleError(Throwable t)
+ {
+ t.printStackTrace();
+ if (t instanceof IllegalArgumentException)
+ {
+ failed.set(true);
+ }
+
+ latch.countDown();
+ }
+ });
+
+ try
+ {
+ TestProtocol protocol = new TestProtocol();
+ protocol.open(connector);
+
+ short bufferCapacity = protocol.getBufferProvider().getBufferCapacity();
+ new TestProtocol.Request(protocol, bufferCapacity + 10).send();
+
+ latch.await(DEFAULT_TIMEOUT_EXPECTED, TimeUnit.MILLISECONDS);
+ assertEquals(false, failed.get());
+ }
+ finally
+ {
+ Worker.setGlobalErrorHandler(oldErrorHandler);
+ }
+ }
+
+ /**
+ * @author David Bonneau
+ */
+ private static final class TestProtocol extends SignalProtocol<Object>
+ {
+ private static final String NAME = "TEST_PROTOCOL";
+
+ private static final short SIGNAL_ID = 10;
+
+ public TestProtocol()
+ {
+ super(NAME);
+ }
+
+ @Override
+ protected SignalReactor createSignalReactor(short signalID)
+ {
+ switch (signalID)
+ {
+ case SIGNAL_ID:
+ return new Indication(this);
+ }
+
+ return super.createSignalReactor(signalID);
+ }
+
+ /**
+ * @author David Bonneau
+ */
+ private static final class Request extends RequestWithConfirmation<Boolean>
+ {
+ private int requestNumOfBytes;
+
+ public Request(SignalProtocol<?> protocol, int requestNumOfBytes)
+ {
+ super(protocol, SIGNAL_ID);
+ this.requestNumOfBytes = requestNumOfBytes;
+ }
+
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws Exception
+ {
+ for (int i = 0; i < requestNumOfBytes; ++i)
+ {
+ out.writeByte(i);
+ }
+
+ // delay completion
+ Thread.sleep(100);
+ }
+
+ @Override
+ protected Boolean confirming(ExtendedDataInputStream in) throws Exception
+ {
+ return in.readBoolean();
+ }
+ }
+
+ /**
+ * @author David Bonneau
+ */
+ private static final class Indication extends IndicationWithResponse
+ {
+ public Indication(SignalProtocol<?> protocol)
+ {
+ super(protocol, SIGNAL_ID);
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws Exception
+ {
+ System.out.println("indicating");
+ }
+
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws Exception
+ {
+ out.writeBoolean(true);
+ }
+ }
+
+ /**
+ * @author David Bonneau
+ */
+ private static final class Factory extends ServerProtocolFactory
+ {
+ public Factory()
+ {
+ super(NAME);
+ }
+
+ public Object create(String description) throws ProductCreationException
+ {
+ return new TestProtocol();
+ }
+ }
+ }
+}

Back to the top