summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-23 05:29:43 (EDT)
committerEike Stepper2007-09-23 05:29:43 (EDT)
commitbc1a169a92a5505c82134e0910d6e7e5dc52a6c0 (patch)
treec2b2807efe2601c3eede54d6c72bd8c5d922ac99
parent2565f19ed42bee0a6b94bce2b31234a6a688479d (diff)
downloadcdo-bc1a169a92a5505c82134e0910d6e7e5dc52a6c0.zip
cdo-bc1a169a92a5505c82134e0910d6e7e5dc52a6c0.tar.gz
cdo-bc1a169a92a5505c82134e0910d6e7e5dc52a6c0.tar.bz2
[202418] Provide CDO builds
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202418
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java100
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java115
4 files changed, 218 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index 56f1eb4..f4b066d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -10,9 +10,9 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.3.0,3.0.0)",
- org.eclipse.net4j.tests;bundle-version="[0.8.0,0.9.0)",
org.eclipse.net4j.tcp;bundle-version="[0.8.0,0.9.0)",
org.eclipse.emf.cdo.server;bundle-version="[0.8.0,0.9.0)",
org.eclipse.emf.cdo.server.db;bundle-version="[0.8.0,0.9.0)",
org.eclipse.emf.cdo;bundle-version="[0.8.0,0.9.0)",
- org.eclipse.emf.cdo.tests.model1;bundle-version="[0.8.0,0.9.0)"
+ org.eclipse.emf.cdo.tests.model1;bundle-version="[0.8.0,0.9.0)",
+ org.junit;visibility:=reexport
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
index cb04655..f0edbb4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTests.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
+
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
new file mode 100644
index 0000000..c965af2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/tests/AbstractTransportTest.java
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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.Net4jUtil;
+import org.eclipse.net4j.internal.util.container.ManagedContainer;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.tests.AbstractOMTest;
+
+import org.eclipse.internal.net4j.Acceptor;
+import org.eclipse.internal.net4j.Connector;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractTransportTest extends AbstractOMTest
+{
+ protected static final String HOST = "localhost";
+
+ protected IManagedContainer container;
+
+ private Acceptor acceptor;
+
+ private Connector connector;
+
+ @Override
+ protected void doSetUp() throws Exception
+ {
+ super.doSetUp();
+ container = createContainer();
+ LifecycleUtil.activate(container);
+ }
+
+ @Override
+ protected void doTearDown() throws Exception
+ {
+ try
+ {
+ Thread.sleep(20);
+ LifecycleUtil.deactivate(container);
+ }
+ finally
+ {
+ connector = null;
+ acceptor = null;
+ container = null;
+ super.doTearDown();
+ }
+ }
+
+ protected IManagedContainer createContainer()
+ {
+ IManagedContainer container = new ManagedContainer();
+ Net4jUtil.prepareContainer(container);
+ TCPUtil.prepareContainer(container);
+ return container;
+ }
+
+ protected Acceptor getAcceptor()
+ {
+ if (acceptor == null)
+ {
+ acceptor = (Acceptor)TCPUtil.getAcceptor(container, null);
+ }
+
+ return acceptor;
+ }
+
+ protected Connector getConnector()
+ {
+ if (connector == null)
+ {
+ connector = (Connector)TCPUtil.getConnector(container, HOST);
+ }
+
+ return connector;
+ }
+
+ protected void startTransport() throws Exception
+ {
+ if (container != null)
+ {
+ Acceptor acceptor = getAcceptor();
+ acceptor.activate();
+
+ Connector connector = getConnector();
+ connector.activate();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
new file mode 100644
index 0000000..260b080
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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.util.tests;
+
+import org.eclipse.net4j.internal.util.om.log.PrintLogHandler;
+import org.eclipse.net4j.internal.util.om.trace.PrintTraceHandler;
+import org.eclipse.net4j.util.om.OMPlatform;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractOMTest extends TestCase
+{
+ private static boolean consoleEnabled;
+
+ protected AbstractOMTest()
+ {
+ }
+
+ @Override
+ public final void setUp() throws Exception
+ {
+ super.setUp();
+ System.out.println("************************************************");
+ System.out.println("START " + getName());
+ System.out.println("************************************************");
+
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.setDebugging(true);
+ enableConsole();
+
+ doSetUp();
+ System.out.println();
+ System.out.println("------------------------ START ------------------------");
+ }
+
+ @Override
+ public final void tearDown() throws Exception
+ {
+ Thread.sleep(200);
+ System.out.println("------------------------ END --------------------------");
+ System.out.println();
+
+ doTearDown();
+ super.tearDown();
+ System.out.println();
+ System.out.println();
+ }
+
+ @Override
+ protected void runTest() throws Throwable
+ {
+ try
+ {
+ super.runTest();
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace(System.out);
+ throw t;
+ }
+ }
+
+ protected void enableConsole()
+ {
+ if (!consoleEnabled)
+ {
+ PrintTraceHandler.CONSOLE.setShortContext(true);
+ OMPlatform.INSTANCE.addTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.addLogHandler(PrintLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.setDebugging(true);
+ consoleEnabled = true;
+ }
+ }
+
+ @SuppressWarnings("unused")
+ protected void disableConsole()
+ {
+ if (consoleEnabled)
+ {
+ consoleEnabled = false;
+ OMPlatform.INSTANCE.setDebugging(false);
+ OMPlatform.INSTANCE.removeTraceHandler(PrintTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.removeLogHandler(PrintLogHandler.CONSOLE);
+ }
+ }
+
+ protected void doSetUp() throws Exception
+ {
+ }
+
+ protected void doTearDown() throws Exception
+ {
+ }
+
+ protected static void msg(String m)
+ {
+ if (consoleEnabled)
+ {
+ System.out.println();
+ System.out.println("--> " + m);
+ }
+ }
+} \ No newline at end of file