Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremie Bresson2013-04-17 13:10:07 +0000
committerJeremie Bresson2013-04-18 16:11:26 +0000
commit12b821cfb7779b2d43f49011481e855bd1aca923 (patch)
treea320c11940b9dae696fb04f445fb2db074c493ff
parent14b08500881a49ed6684ff3f67b94c2af42cf320 (diff)
downloadorg.eclipse.scout.rt-12b821cfb7779b2d43f49011481e855bd1aca923.tar.gz
org.eclipse.scout.rt-12b821cfb7779b2d43f49011481e855bd1aca923.tar.xz
org.eclipse.scout.rt-12b821cfb7779b2d43f49011481e855bd1aca923.zip
Bug 402301: Migration: UI Independent tests
Create additional fragments and migrate tests: * org.eclipse.scout.jaxws216.test * org.eclipse.scout.rt.testing.client.test * org.eclipse.scout.rt.testing.server.test https://bugs.eclipse.org/bugs/show_bug.cgi?id=402301 Change-Id: Ie88a5c4c920503aa90322cc9e77f064f51c50f1c
-rw-r--r--org.eclipse.scout.jaxws216.test/.classpath7
-rw-r--r--org.eclipse.scout.jaxws216.test/.project71
-rw-r--r--org.eclipse.scout.jaxws216.test/META-INF/MANIFEST.MF12
-rw-r--r--org.eclipse.scout.jaxws216.test/about.html28
-rw-r--r--org.eclipse.scout.jaxws216.test/build.properties12
-rw-r--r--org.eclipse.scout.jaxws216.test/pom.xml23
-rw-r--r--org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/CalendarAdapterTest.java129
-rw-r--r--org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapterTest.java132
-rw-r--r--org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapterTest.java105
-rw-r--r--org.eclipse.scout.rt.parent/pom.xml3
-rw-r--r--org.eclipse.scout.rt.testing.client.test/.classpath7
-rw-r--r--org.eclipse.scout.rt.testing.client.test/.project71
-rw-r--r--org.eclipse.scout.rt.testing.client.test/META-INF/MANIFEST.MF13
-rw-r--r--org.eclipse.scout.rt.testing.client.test/about.html28
-rw-r--r--org.eclipse.scout.rt.testing.client.test/build.properties12
-rw-r--r--org.eclipse.scout.rt.testing.client.test/pom.xml23
-rw-r--r--org.eclipse.scout.rt.testing.client.test/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunnerTest.java220
-rw-r--r--org.eclipse.scout.rt.testing.server.test/.classpath7
-rw-r--r--org.eclipse.scout.rt.testing.server.test/.project71
-rw-r--r--org.eclipse.scout.rt.testing.server.test/META-INF/MANIFEST.MF13
-rw-r--r--org.eclipse.scout.rt.testing.server.test/about.html28
-rw-r--r--org.eclipse.scout.rt.testing.server.test/build.properties12
-rw-r--r--org.eclipse.scout.rt.testing.server.test/pom.xml23
-rw-r--r--org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTransactionTest.java170
-rw-r--r--org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/fixture/TestTransactionMember.java99
25 files changed, 1319 insertions, 0 deletions
diff --git a/org.eclipse.scout.jaxws216.test/.classpath b/org.eclipse.scout.jaxws216.test/.classpath
new file mode 100644
index 0000000000..0b1bcf949f
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.scout.jaxws216.test/.project b/org.eclipse.scout.jaxws216.test/.project
new file mode 100644
index 0000000000..f384834896
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/.project
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.jaxws216.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>.settings/de.loskutov.anyedit.AnyEditTools.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/de.loskutov.anyedit.AnyEditTools.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.core.resources.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.core.resources.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.core.runtime.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.core.runtime.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.jdt.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.jdt.core.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.jdt.ui.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.jdt.ui.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.m2e.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.m2e.core.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.pde.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.pde.core.prefs</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/org.eclipse.scout.jaxws216.test/META-INF/MANIFEST.MF b/org.eclipse.scout.jaxws216.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..1e777db353
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Scout JaxWS Test
+Bundle-SymbolicName: org.eclipse.scout.jaxws216.test
+Bundle-Version: 3.9.0.qualifier
+Bundle-Vendor: Eclipse Scout Project
+Fragment-Host: org.eclipse.scout.jaxws216;bundle-version="2.1.6"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.hamcrest;version="[1.1.0,2.0.0)";core=split;mandatory:=core,
+ org.hamcrest.core;version="[1.1.0,2.0.0)",
+ org.junit;version="[4.3.0,5.0.0)",
+ org.junit.runner;version="[4.3.0,5.0.0)"
diff --git a/org.eclipse.scout.jaxws216.test/about.html b/org.eclipse.scout.jaxws216.test/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.scout.jaxws216.test/build.properties b/org.eclipse.scout.jaxws216.test/build.properties
new file mode 100644
index 0000000000..b0ac311e69
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/build.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2013 BSI Business Systems Integration AG.
+# 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
+###############################################################################
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.jaxws216.test/pom.xml b/org.eclipse.scout.jaxws216.test/pom.xml
new file mode 100644
index 0000000000..d32c1c1c01
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2013 BSI Business Systems Integration AG.
+ 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
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.scout.rt</groupId>
+ <artifactId>org.eclipse.scout.rt.parent</artifactId>
+ <version>3.9.0-SNAPSHOT</version>
+ <relativePath>../org.eclipse.scout.rt.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.scout.jaxws216.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
diff --git a/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/CalendarAdapterTest.java b/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/CalendarAdapterTest.java
new file mode 100644
index 0000000000..681a4d32e4
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/CalendarAdapterTest.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.adapters;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link CalendarAdapter}
+ */
+public class CalendarAdapterTest {
+
+ @Test
+ public void testMarshall() throws Exception {
+ TimeZone defaultTimeZone = TimeZone.getDefault();
+ try {
+ // set default timeZone to UTC+1:00
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT+1:00")); // Berlin, Stockholm, Bern
+
+ CalendarAdapter adapter = new CalendarAdapter();
+ // test default time (UTC+01:00)
+ Calendar calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getDefault());
+ Assert.assertEquals("2011-11-07T12:50:00.000+01:00", adapter.marshal(calendar));
+
+ // test local time (UTC+01:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+1:00"));
+ Assert.assertEquals("2011-11-07T12:50:00.000+01:00", adapter.marshal(calendar));
+
+ // test time from other timezone than local (UTC-05:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT-5:00"));
+ Assert.assertEquals("2011-11-07T12:50:00.000-05:00", adapter.marshal(calendar));
+
+ // test time from other timezone than local (UTC+05:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+5:00"));
+ Assert.assertEquals("2011-11-07T12:50:00.000+05:00", adapter.marshal(calendar));
+
+ // test UTC time
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+0:00"));
+ Assert.assertEquals("2011-11-07T12:50:00.000Z", adapter.marshal(calendar));
+
+ // test UTC time
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("UTC"));
+ Assert.assertEquals("2011-11-07T12:50:00.000Z", adapter.marshal(calendar));
+ }
+ finally {
+ TimeZone.setDefault(defaultTimeZone);
+ }
+ }
+
+ @Test
+ public void testUnmarshall() throws Exception {
+ TimeZone defaultTimeZone = TimeZone.getDefault();
+ try {
+ // set default timeZone to UTC+1:00
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT+1:00")); // Berlin, Stockholm, Bern
+
+ CalendarAdapter adapter = new CalendarAdapter();
+
+ // test UTC time
+ Calendar calendar = adapter.unmarshal("2011-11-07T12:50:00.000Z");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+00:00"));
+
+ calendar = adapter.unmarshal("2011-11-07T12:50:00.000Z");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT-00:00"));
+
+ calendar = adapter.unmarshal("2011-11-07T12:50:00.000Z");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("UTC"));
+
+ // test local time (UTC+01:00)
+ calendar = adapter.unmarshal("2011-11-07T12:50:00.000+01:00");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+1:00"));
+
+ // test local time (UTC+01:00)
+ calendar = adapter.unmarshal("2011-11-07T12:50:00.000");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getDefault());
+
+ // test time from other timezone than local (UTC-05:00)
+ calendar = adapter.unmarshal("2011-11-07T12:50:00.000-05:00");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT-5:00"));
+
+ // test time from other timezone than local (UTC+05:00)
+ calendar = adapter.unmarshal("2011-11-07T12:50:00.000+05:00");
+ assertDateTime(calendar, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+5:00"));
+ }
+ finally {
+ TimeZone.setDefault(defaultTimeZone);
+ }
+ }
+
+ private Calendar toCalendar(int year, int month, int day, int hour, int min, int sec, TimeZone timeZone) {
+ Calendar cal = Calendar.getInstance(timeZone);
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, month - 1); // 0 based
+ cal.set(Calendar.DAY_OF_MONTH, day); // 1 based
+ cal.set(Calendar.HOUR_OF_DAY, hour); // 1 based
+ cal.set(Calendar.MINUTE, min);
+ cal.set(Calendar.SECOND, sec);
+ cal.set(Calendar.MILLISECOND, 0);
+ return cal;
+ }
+
+ private void assertDateTime(Calendar calendar, int expectedYear, int expectedMonth, int expectedDay, int expectedHour, int expectedMinute, int expectedSecond, TimeZone expectedTimeZone) {
+ Calendar expectedCalendar = toCalendar(expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond, expectedTimeZone);
+
+ // assert millis
+ long millisUtc = expectedCalendar.getTimeInMillis();
+ Assert.assertEquals(millisUtc, calendar.getTimeInMillis());
+
+ // assert fields
+ Assert.assertEquals(calendar.get(Calendar.YEAR), expectedYear);
+ Assert.assertEquals(calendar.get(Calendar.MONTH) + 1, expectedMonth); // 0-based
+ Assert.assertEquals(calendar.get(Calendar.DAY_OF_MONTH), expectedDay);
+ Assert.assertEquals(calendar.get(Calendar.HOUR_OF_DAY), expectedHour);
+ Assert.assertEquals(calendar.get(Calendar.MINUTE), expectedMinute);
+ Assert.assertEquals(calendar.get(Calendar.SECOND), expectedSecond);
+ Assert.assertEquals(calendar.getTimeZone().getRawOffset(), expectedTimeZone.getRawOffset());
+ }
+}
diff --git a/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapterTest.java b/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapterTest.java
new file mode 100644
index 0000000000..4c741c01da
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/DefaultTimezoneDateAdapterTest.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.adapters;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link DefaultTimezoneDateAdapter}
+ */
+public class DefaultTimezoneDateAdapterTest {
+
+ @Test
+ public void testMarshall() throws Exception {
+ TimeZone defaultTimeZone = TimeZone.getDefault();
+ try {
+ // set default timeZone to UTC+1:00
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT+1:00")); // Berlin, Stockholm, Bern
+
+ DefaultTimezoneDateAdapter adapter = new DefaultTimezoneDateAdapter();
+ // test default time (UTC+01:00)
+ Calendar calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getDefault());
+ Assert.assertEquals("2011-11-07T12:50:00.000+01:00", adapter.marshal(calendar.getTime()));
+
+ // test local time (UTC+01:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+1:00"));
+ Assert.assertEquals("2011-11-07T12:50:00.000+01:00", adapter.marshal(calendar.getTime()));
+
+ // test time from other timezone than local (UTC-05:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT-5:00"));
+ Assert.assertEquals("2011-11-07T18:50:00.000+01:00", adapter.marshal(calendar.getTime()));
+
+ // test time from other timezone than local (UTC+05:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+5:00"));
+ Assert.assertEquals("2011-11-07T08:50:00.000+01:00", adapter.marshal(calendar.getTime()));
+
+ // test UTC time
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+0:00"));
+ Assert.assertEquals("2011-11-07T13:50:00.000+01:00", adapter.marshal(calendar.getTime()));
+
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("UTC"));
+ Assert.assertEquals("2011-11-07T13:50:00.000+01:00", adapter.marshal(calendar.getTime()));
+ }
+ finally {
+ TimeZone.setDefault(defaultTimeZone);
+ }
+ }
+
+ @Test
+ public void testUnmarshall() throws Exception {
+ TimeZone defaultTimeZone = TimeZone.getDefault();
+ try {
+ // set default timeZone to UTC+1:00
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT+1:00")); // Berlin, Stockholm, Bern
+
+ DefaultTimezoneDateAdapter adapter = new DefaultTimezoneDateAdapter();
+
+ // test UTC time
+ Date date = adapter.unmarshal("2011-11-07T12:50:00.000Z");
+ assertDateTime(date, 2011, 11, 7, 13, 50, 0, TimeZone.getDefault());
+
+ // test local time (UTC+01:00)
+ date = adapter.unmarshal("2011-11-07T12:50:00.000+01:00");
+ assertDateTime(date, 2011, 11, 7, 12, 50, 0, TimeZone.getDefault());
+
+ // test local time (UTC+01:00)
+ date = adapter.unmarshal("2011-11-07T12:50:00.000");
+ assertDateTime(date, 2011, 11, 7, 12, 50, 0, TimeZone.getDefault());
+
+ // test time from other timezone than local (UTC-05:00)
+ date = adapter.unmarshal("2011-11-07T12:50:00.000-05:00");
+ assertDateTime(date, 2011, 11, 7, 18, 50, 0, TimeZone.getDefault());
+
+ // test time from other timezone than local (UTC+05:00)
+ date = adapter.unmarshal("2011-11-07T12:50:00.000+05:00");
+ assertDateTime(date, 2011, 11, 7, 8, 50, 0, TimeZone.getDefault());
+
+ date = adapter.unmarshal("2011-11-07Z");
+ assertDateTime(date, 2011, 11, 7, 1, 0, 0, TimeZone.getDefault());
+
+ date = adapter.unmarshal("2011-11-07");
+ assertDateTime(date, 2011, 11, 7, 0, 0, 0, TimeZone.getDefault());
+ }
+ finally {
+ TimeZone.setDefault(defaultTimeZone);
+ }
+ }
+
+ private Calendar toCalendar(int year, int month, int day, int hour, int min, int sec, TimeZone timeZone) {
+ Calendar cal = Calendar.getInstance(timeZone);
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, month - 1); // 0 based
+ cal.set(Calendar.DAY_OF_MONTH, day); // 1 based
+ cal.set(Calendar.HOUR_OF_DAY, hour); // 1 based
+ cal.set(Calendar.MINUTE, min);
+ cal.set(Calendar.SECOND, sec);
+ cal.set(Calendar.MILLISECOND, 0);
+ return cal;
+ }
+
+ private void assertDateTime(Date date, int expectedYear, int expectedMonth, int expectedDay, int expectedHour, int expectedMinute, int expectedSecond, TimeZone expectedTimeZone) {
+ // assert millis
+ long millisUtc = toCalendar(expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond, expectedTimeZone).getTime().getTime();
+ Assert.assertEquals(millisUtc, date.getTime());
+
+ // assert format
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ format.setTimeZone(expectedTimeZone);
+ format.format(date);
+ Assert.assertEquals(expectedYear + "-" +
+ StringUtility.lpad(expectedMonth + "", "0", 2) + "-" +
+ StringUtility.lpad(expectedDay + "", "0", 2) + " " +
+ StringUtility.lpad(expectedHour + "", "0", 2) + ":" +
+ StringUtility.lpad(expectedMinute + "", "0", 2) + ":" +
+ StringUtility.lpad(expectedSecond + "", "0", 2),
+ format.format(date));
+ }
+}
diff --git a/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapterTest.java b/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapterTest.java
new file mode 100644
index 0000000000..45b8ed4d92
--- /dev/null
+++ b/org.eclipse.scout.jaxws216.test/src/org/eclipse/scout/jaxws/adapters/UtcDateAdapterTest.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.jaxws.adapters;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * JUnit test for {@link UtcDateAdapter}
+ */
+public class UtcDateAdapterTest {
+
+ @Test
+ public void testMarshall() throws Exception {
+ UtcDateAdapter adapter = new UtcDateAdapter();
+ // test UTC time
+ Calendar calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("UTC"));
+ Assert.assertEquals("2011-11-07T12:50:00.000Z", adapter.marshal(calendar.getTime()));
+
+ // test UTC time
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+0:00"));
+ Assert.assertEquals("2011-11-07T12:50:00.000Z", adapter.marshal(calendar.getTime()));
+
+ // test time from other timezone than UTC (UTC-05:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT-5:00"));
+ Assert.assertEquals("2011-11-07T17:50:00.000Z", adapter.marshal(calendar.getTime()));
+
+ // test time from other timezone than UTC (UTC+05:00)
+ calendar = toCalendar(2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("GMT+5:00"));
+ Assert.assertEquals("2011-11-07T07:50:00.000Z", adapter.marshal(calendar.getTime()));
+
+ }
+
+ @Test
+ public void testUnmarshall() throws Exception {
+ UtcDateAdapter adapter = new UtcDateAdapter();
+
+ Date date = adapter.unmarshal("2011-11-07T12:50:00.000Z");
+ assertDateTime(date, 2011, 11, 7, 12, 50, 0, TimeZone.getTimeZone("UTC"));
+
+ date = adapter.unmarshal("2011-11-07T12:50:00.000-05:00");
+ assertDateTime(date, 2011, 11, 7, 17, 50, 0, TimeZone.getTimeZone("UTC"));
+
+ date = adapter.unmarshal("2011-11-07T12:50:00.000+05:00");
+ assertDateTime(date, 2011, 11, 7, 7, 50, 0, TimeZone.getTimeZone("UTC"));
+
+ date = adapter.unmarshal("2011-11-07Z");
+ assertDateTime(date, 2011, 11, 7, 0, 0, 0, TimeZone.getTimeZone("UTC"));
+
+ TimeZone defaultTimeZone = TimeZone.getDefault();
+ try {
+ // set default timeZone to UTC+1:00
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT+1:00")); // Berlin, Stockholm, Bern
+ date = adapter.unmarshal("2011-11-07");
+ assertDateTime(date, 2011, 11, 6, 23, 0, 0, TimeZone.getTimeZone("UTC"));
+ }
+ finally {
+ TimeZone.setDefault(defaultTimeZone);
+ }
+ }
+
+ private Calendar toCalendar(int year, int month, int day, int hour, int min, int sec, TimeZone timeZone) {
+ Calendar cal = Calendar.getInstance(timeZone);
+ cal.set(Calendar.YEAR, year);
+ cal.set(Calendar.MONTH, month - 1); // 0 based
+ cal.set(Calendar.DAY_OF_MONTH, day); // 1 based
+ cal.set(Calendar.HOUR_OF_DAY, hour); // 1 based
+ cal.set(Calendar.MINUTE, min);
+ cal.set(Calendar.SECOND, sec);
+ cal.set(Calendar.MILLISECOND, 0);
+ return cal;
+ }
+
+ private void assertDateTime(Date date, int expectedYear, int expectedMonth, int expectedDay, int expectedHour, int expectedMinute, int expectedSecond, TimeZone expectedTimeZone) {
+ // assert millis
+ long millisUtc = toCalendar(expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond, expectedTimeZone).getTimeInMillis();
+ Assert.assertEquals(millisUtc, date.getTime());
+
+ // assert format
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ format.setTimeZone(expectedTimeZone);
+ format.format(date);
+ Assert.assertEquals(expectedYear + "-" +
+ StringUtility.lpad(expectedMonth + "", "0", 2) + "-" +
+ StringUtility.lpad(expectedDay + "", "0", 2) + " " +
+ StringUtility.lpad(expectedHour + "", "0", 2) + ":" +
+ StringUtility.lpad(expectedMinute + "", "0", 2) + ":" +
+ StringUtility.lpad(expectedSecond + "", "0", 2),
+ format.format(date));
+ }
+}
diff --git a/org.eclipse.scout.rt.parent/pom.xml b/org.eclipse.scout.rt.parent/pom.xml
index 3b1eaebd62..1f40e5734a 100644
--- a/org.eclipse.scout.rt.parent/pom.xml
+++ b/org.eclipse.scout.rt.parent/pom.xml
@@ -75,6 +75,7 @@
</activation>
<modules>
<module>../org.eclipse.scout.commons.test</module>
+ <module>../org.eclipse.scout.jaxws216.test</module>
<module>../org.eclipse.scout.rt.client.test</module>
<module>../org.eclipse.scout.rt.client.testenvironment</module>
<module>../org.eclipse.scout.rt.extension.client.test</module>
@@ -87,9 +88,11 @@
<module>../org.eclipse.scout.service.test</module>
<module>../org.eclipse.scout.rt.testing-feature</module>
<module>../org.eclipse.scout.rt.testing.client</module>
+ <module>../org.eclipse.scout.rt.testing.client.test</module>
<module>../org.eclipse.scout.rt.testing.common.ant.optional.junit.fragment</module>
<module>../org.eclipse.scout.rt.testing.commons</module>
<module>../org.eclipse.scout.rt.testing.server</module>
+ <module>../org.eclipse.scout.rt.testing.server.test</module>
<module>../org.eclipse.scout.rt.testing.shared</module>
<module>../org.eclipse.scout.rt.testing.ui.rap</module>
<module>../org.eclipse.scout.rt.testing.ui.swing</module>
diff --git a/org.eclipse.scout.rt.testing.client.test/.classpath b/org.eclipse.scout.rt.testing.client.test/.classpath
new file mode 100644
index 0000000000..0b1bcf949f
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.scout.rt.testing.client.test/.project b/org.eclipse.scout.rt.testing.client.test/.project
new file mode 100644
index 0000000000..8acc0bafe3
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/.project
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.rt.testing.client.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>.settings/de.loskutov.anyedit.AnyEditTools.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/de.loskutov.anyedit.AnyEditTools.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.core.resources.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.core.resources.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.core.runtime.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.core.runtime.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.jdt.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.jdt.core.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.jdt.ui.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.jdt.ui.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.m2e.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.m2e.core.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.pde.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.pde.core.prefs</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/org.eclipse.scout.rt.testing.client.test/META-INF/MANIFEST.MF b/org.eclipse.scout.rt.testing.client.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..56bd0a936e
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Scout RT Testing Client Test
+Bundle-SymbolicName: org.eclipse.scout.rt.testing.client.test
+Bundle-Version: 3.9.0.qualifier
+Bundle-Vendor: Eclipse Scout Project
+Fragment-Host: org.eclipse.scout.rt.testing.client;bundle-version="3.9.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.hamcrest;version="[1.1.0,2.0.0)";core=split;mandatory:=core,
+ org.hamcrest.core;version="[1.1.0,2.0.0)",
+ org.junit;version="[4.3.0,5.0.0)",
+ org.junit.runner;version="[4.3.0,5.0.0)"
+Require-Bundle: org.eclipse.scout.rt.client.testenvironment;bundle-version="[3.9.0,3.10.0)"
diff --git a/org.eclipse.scout.rt.testing.client.test/about.html b/org.eclipse.scout.rt.testing.client.test/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.scout.rt.testing.client.test/build.properties b/org.eclipse.scout.rt.testing.client.test/build.properties
new file mode 100644
index 0000000000..b0ac311e69
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/build.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2013 BSI Business Systems Integration AG.
+# 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
+###############################################################################
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.rt.testing.client.test/pom.xml b/org.eclipse.scout.rt.testing.client.test/pom.xml
new file mode 100644
index 0000000000..a19ada5e1c
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2013 BSI Business Systems Integration AG.
+ 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
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.scout.rt</groupId>
+ <artifactId>org.eclipse.scout.rt.parent</artifactId>
+ <version>3.9.0-SNAPSHOT</version>
+ <relativePath>../org.eclipse.scout.rt.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.scout.rt.testing.client.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
diff --git a/org.eclipse.scout.rt.testing.client.test/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunnerTest.java b/org.eclipse.scout.rt.testing.client.test/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunnerTest.java
new file mode 100644
index 0000000000..74940c2974
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.client.test/src/org/eclipse/scout/testing/client/runner/ScoutClientTestRunnerTest.java
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.testing.client.runner;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.annotation.Annotation;
+
+import org.eclipse.scout.rt.client.AbstractClientSession;
+import org.eclipse.scout.rt.client.IClientSession;
+import org.eclipse.scout.testing.client.DefaultTestClientSessionProvider;
+import org.eclipse.scout.testing.client.ITestClientSessionProvider;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner.ClientTest;
+import org.eclipse.scout.testing.client.runner.ScoutClientTestRunner.NullTestClientSessionProvider;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * JUnit test for {@link ScoutClientTestRunner}
+ */
+public class ScoutClientTestRunnerTest {
+
+ private ScoutClientTestRunnerEx m_runner;
+ private ClientTest m_allValuesClientTest;
+ private ClientTest m_defaultValuesClientTest;
+
+ @Before
+ public void setUp() throws Exception {
+ m_runner = new ScoutClientTestRunnerEx(TestCase.class);
+ m_allValuesClientTest = new ClientTest() {
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return ClientTest.class;
+ }
+
+ @Override
+ public Class<? extends ITestClientSessionProvider> sessionProvider() {
+ return TestClientSessionProvider.class;
+ }
+
+ @Override
+ public String runAs() {
+ return "otherUser";
+ }
+
+ @Override
+ public boolean forceNewSession() {
+ return true;
+ }
+
+ @Override
+ public Class<? extends IClientSession> clientSessionClass() {
+ return TestClientSession.class;
+ }
+ };
+ m_defaultValuesClientTest = new ClientTest() {
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return ClientTest.class;
+ }
+
+ @Override
+ public Class<? extends ITestClientSessionProvider> sessionProvider() {
+ return NullTestClientSessionProvider.class;
+ }
+
+ @Override
+ public String runAs() {
+ return "";
+ }
+
+ @Override
+ public boolean forceNewSession() {
+ return false;
+ }
+
+ @Override
+ public Class<? extends IClientSession> clientSessionClass() {
+ return IClientSession.class;
+ }
+ };
+ }
+
+ @Test
+ public void testExtractClientSessionClass() throws Exception {
+ // null values
+ assertNull(m_runner.extractClientSessionClass(null, null));
+ assertEquals(IClientSession.class, m_runner.extractClientSessionClass(null, IClientSession.class));
+
+ // default values
+ assertNull(m_runner.extractClientSessionClass(m_defaultValuesClientTest, null));
+ assertEquals(IClientSession.class, m_runner.extractClientSessionClass(m_defaultValuesClientTest, IClientSession.class));
+
+ // overridden values
+ assertEquals(TestClientSession.class, m_runner.extractClientSessionClass(m_allValuesClientTest, null));
+ assertEquals(TestClientSession.class, m_runner.extractClientSessionClass(m_allValuesClientTest, IClientSession.class));
+ }
+
+ @Test
+ public void testExtractSessionProvider() throws Exception {
+ DefaultTestClientSessionProvider defaultValue = new DefaultTestClientSessionProvider();
+
+ // null values
+ assertNull(m_runner.extractSessionProvider(null, null));
+ assertEquals(defaultValue, m_runner.extractSessionProvider(null, defaultValue));
+
+ // default values
+ assertNull(m_runner.extractSessionProvider(m_defaultValuesClientTest, null));
+ assertEquals(defaultValue, m_runner.extractSessionProvider(m_defaultValuesClientTest, defaultValue));
+
+ // overridden values
+ assertTrue(m_runner.extractSessionProvider(m_allValuesClientTest, null) instanceof TestClientSessionProvider);
+ assertTrue(m_runner.extractSessionProvider(m_allValuesClientTest, defaultValue) instanceof TestClientSessionProvider);
+ }
+
+ @Test
+ public void testExtractRunAs() throws Exception {
+ String defaultValue = "defaultValue";
+
+ // null values
+ assertNull(m_runner.extractRunAs(null, null));
+ assertEquals(defaultValue, m_runner.extractRunAs(null, defaultValue));
+
+ // default values
+ assertNull(m_runner.extractRunAs(m_defaultValuesClientTest, null));
+ assertEquals(defaultValue, m_runner.extractRunAs(m_defaultValuesClientTest, defaultValue));
+
+ // overridden values
+ assertEquals("otherUser", m_runner.extractRunAs(m_allValuesClientTest, null));
+ assertEquals("otherUser", m_runner.extractRunAs(m_allValuesClientTest, defaultValue));
+ }
+
+ @Test
+ public void testExtractForceNewSession() throws Exception {
+
+ // null values
+ assertFalse(m_runner.extractForceNewSession(null, false));
+ assertTrue(m_runner.extractForceNewSession(null, true));
+
+ // default values
+ assertFalse(m_runner.extractForceNewSession(m_defaultValuesClientTest, true));
+ assertFalse(m_runner.extractForceNewSession(m_defaultValuesClientTest, false));
+
+ // overridden values
+ assertTrue(m_runner.extractForceNewSession(m_allValuesClientTest, false));
+ assertTrue(m_runner.extractForceNewSession(m_allValuesClientTest, true));
+ }
+
+ private static class ScoutClientTestRunnerEx extends ScoutClientTestRunner {
+
+ /**
+ * @param klass
+ * @throws InitializationError
+ */
+ public ScoutClientTestRunnerEx(Class<?> klass) throws InitializationError {
+ super(klass);
+ }
+
+ @Override
+ protected IClientSession getOrCreateClientSession(ClientTest classLevelClientTest, ClientTest methodLevelClientTest) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Class<? extends IClientSession> extractClientSessionClass(ClientTest methodLevelClientTest, Class<? extends IClientSession> defaultValue) {
+ return super.extractClientSessionClass(methodLevelClientTest, defaultValue);
+ }
+
+ @Override
+ public ITestClientSessionProvider extractSessionProvider(ClientTest methodLevelClientTest, ITestClientSessionProvider defaultValue) throws Exception {
+ return super.extractSessionProvider(methodLevelClientTest, defaultValue);
+ }
+
+ @Override
+ public String extractRunAs(ClientTest methodLevelClientTest, String defaultValue) {
+ return super.extractRunAs(methodLevelClientTest, defaultValue);
+ }
+
+ @Override
+ public boolean extractForceNewSession(ClientTest clientTest, boolean defaultValue) {
+ return super.extractForceNewSession(clientTest, defaultValue);
+ }
+ }
+
+ public static class TestCase {
+ @Test
+ public void test() {
+
+ }
+ }
+
+ public static class TestClientSession extends AbstractClientSession {
+
+ public TestClientSession() {
+ super(true);
+ }
+ }
+
+ public static class TestClientSessionProvider implements ITestClientSessionProvider {
+
+ @Override
+ public <T extends IClientSession> T getOrCreateClientSession(Class<T> clazz, String user, boolean forceNewSession) {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.rt.testing.server.test/.classpath b/org.eclipse.scout.rt.testing.server.test/.classpath
new file mode 100644
index 0000000000..0b1bcf949f
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.scout.rt.testing.server.test/.project b/org.eclipse.scout.rt.testing.server.test/.project
new file mode 100644
index 0000000000..dca095eab6
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/.project
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.rt.testing.server.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>.settings/de.loskutov.anyedit.AnyEditTools.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/de.loskutov.anyedit.AnyEditTools.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.core.resources.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.core.resources.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.core.runtime.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.core.runtime.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.jdt.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.jdt.core.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.jdt.ui.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.jdt.ui.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.m2e.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.m2e.core.prefs</locationURI>
+ </link>
+ <link>
+ <name>.settings/org.eclipse.pde.core.prefs</name>
+ <type>1</type>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.scout.rt-feature/.settings/org.eclipse.pde.core.prefs</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/org.eclipse.scout.rt.testing.server.test/META-INF/MANIFEST.MF b/org.eclipse.scout.rt.testing.server.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..e46e6f7734
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Scout RT Testing Server Test
+Bundle-SymbolicName: org.eclipse.scout.rt.testing.server.test
+Bundle-Version: 3.9.0.qualifier
+Bundle-Vendor: Eclipse Scout Project
+Fragment-Host: org.eclipse.scout.rt.testing.server;bundle-version="3.9.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.hamcrest;version="[1.1.0,2.0.0)";core=split;mandatory:=core,
+ org.hamcrest.core;version="[1.1.0,2.0.0)",
+ org.junit;version="[4.3.0,5.0.0)",
+ org.junit.runner;version="[4.3.0,5.0.0)"
+Require-Bundle: org.eclipse.scout.rt.server.testenvironment;bundle-version="[3.9.0,3.10.0)"
diff --git a/org.eclipse.scout.rt.testing.server.test/about.html b/org.eclipse.scout.rt.testing.server.test/about.html
new file mode 100644
index 0000000000..c258ef55d8
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/org.eclipse.scout.rt.testing.server.test/build.properties b/org.eclipse.scout.rt.testing.server.test/build.properties
new file mode 100644
index 0000000000..b0ac311e69
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/build.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2013 BSI Business Systems Integration AG.
+# 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
+###############################################################################
+source.. = src/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.rt.testing.server.test/pom.xml b/org.eclipse.scout.rt.testing.server.test/pom.xml
new file mode 100644
index 0000000000..ef1fd7afd9
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2013 BSI Business Systems Integration AG.
+ 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
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.scout.rt</groupId>
+ <artifactId>org.eclipse.scout.rt.parent</artifactId>
+ <version>3.9.0-SNAPSHOT</version>
+ <relativePath>../org.eclipse.scout.rt.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.scout.rt.testing.server.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
diff --git a/org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTransactionTest.java b/org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTransactionTest.java
new file mode 100644
index 0000000000..1253b3a90b
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/ScoutServerTransactionTest.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.server.runner;
+
+import static org.junit.Assert.assertEquals;
+
+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.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.rt.server.ServerJob;
+import org.eclipse.scout.rt.server.ThreadContext;
+import org.eclipse.scout.rt.server.transaction.ITransaction;
+import org.eclipse.scout.rt.testing.server.runner.fixture.TestTransactionMember;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * JUnit test for {@link ScoutServerTestRunner}
+ */
+@RunWith(ScoutServerTestRunner.class)
+public class ScoutServerTransactionTest {
+
+ @Test
+ public void testValidTransactionMember() {
+ final TestTransactionMember transactionMember = new TestTransactionMember("01");
+ ServerJob job = new ServerJob("", ServerJob.getCurrentSession()) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ITransaction transaction = ThreadContext.getTransaction();
+ transaction.registerMember(transactionMember);
+ return Status.OK_STATUS;
+ }
+ };
+ job.runNow(new NullProgressMonitor());
+ assertEquals("CommitPhase1MethodCallCount", 1, transactionMember.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 1, transactionMember.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 0, transactionMember.getRollbackMethodCallCount());
+ }
+
+ @Test
+ public void testTransactionWithoutParticipationOfAMember() {
+ final TestTransactionMember transactionMember1 = new TestTransactionMember("01");
+ final TestTransactionMember transactionMember2 = new TestTransactionMember("02") {
+ @Override
+ protected boolean execNeedsCommit() {
+
+ return false;
+ }
+ };
+ ServerJob job = new ServerJob("", ServerJob.getCurrentSession()) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ITransaction transaction = ThreadContext.getTransaction();
+ transaction.registerMember(transactionMember1);
+ transaction.registerMember(transactionMember2);
+ return Status.OK_STATUS;
+ }
+ };
+ job.runNow(new NullProgressMonitor());
+ assertEquals("CommitPhase1MethodCallCount", 1, transactionMember1.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 1, transactionMember1.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember1.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 0, transactionMember1.getRollbackMethodCallCount());
+ assertEquals("CommitPhase1MethodCallCount", 0, transactionMember2.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember2.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember2.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 0, transactionMember2.getRollbackMethodCallCount());
+ }
+
+ @Test
+ public void testTransactionWithFailureInMember2() {
+ final TestTransactionMember transactionMember1 = new TestTransactionMember("01");
+ final TestTransactionMember transactionMember2 = new TestTransactionMember("02") {
+ @Override
+ protected boolean execCommitPhase1() {
+ return false;
+ }
+
+ };
+ ServerJob job = new ServerJob("", ServerJob.getCurrentSession()) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ITransaction transaction = ThreadContext.getTransaction();
+ transaction.registerMember(transactionMember1);
+ transaction.registerMember(transactionMember2);
+ return Status.OK_STATUS;
+ }
+ };
+ job.runNow(new NullProgressMonitor());
+ assertEquals("CommitPhase1MethodCallCount", 1, transactionMember1.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember1.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember1.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 1, transactionMember1.getRollbackMethodCallCount());
+ assertEquals("CommitPhase1MethodCallCount", 1, transactionMember2.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember2.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember2.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 1, transactionMember2.getRollbackMethodCallCount());
+ }
+
+ @Test
+ public void testTransactionWithExceptionInTransactionMember2() {
+ final TestTransactionMember transactionMember1 = new TestTransactionMember("01");
+ final TestTransactionMember transactionMember2 = new TestTransactionMember("02") {
+ @Override
+ protected boolean execCommitPhase1() {
+ throw new NullPointerException();
+ }
+
+ };
+ ServerJob job = new ServerJob("", ServerJob.getCurrentSession()) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ITransaction transaction = ThreadContext.getTransaction();
+ transaction.registerMember(transactionMember1);
+ transaction.registerMember(transactionMember2);
+ return Status.OK_STATUS;
+ }
+ };
+ job.runNow(new NullProgressMonitor());
+ assertEquals("CommitPhase1MethodCallCount", 1, transactionMember1.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember1.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember1.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 1, transactionMember1.getRollbackMethodCallCount());
+ assertEquals("CommitPhase1MethodCallCount", 1, transactionMember2.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember2.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember2.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 1, transactionMember2.getRollbackMethodCallCount());
+ }
+
+ @Test
+ public void testTransactionWithException() {
+ final TestTransactionMember transactionMember1 = new TestTransactionMember("01");
+ final TestTransactionMember transactionMember2 = new TestTransactionMember("02");
+ ServerJob job = new ServerJob("", ServerJob.getCurrentSession()) {
+
+ @Override
+ protected IStatus runTransaction(IProgressMonitor monitor) throws Exception {
+ ITransaction transaction = ThreadContext.getTransaction();
+ transaction.registerMember(transactionMember1);
+ transaction.registerMember(transactionMember2);
+ throw new ProcessingException("Blubber");
+ }
+ };
+ job.runNow(new NullProgressMonitor());
+ assertEquals("CommitPhase1MethodCallCount", 0, transactionMember1.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember1.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember1.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 1, transactionMember1.getRollbackMethodCallCount());
+ assertEquals("CommitPhase1MethodCallCount", 0, transactionMember2.getCommitPhase1MethodCallCount());
+ assertEquals("CommitPhase2MethodCallCount", 0, transactionMember2.getCommitPhase2MethodCallCount());
+ assertEquals("ReleaseMethodCallCount", 1, transactionMember2.getReleaseMethodCallCount());
+ assertEquals("RollbackMethodCallCount", 1, transactionMember2.getRollbackMethodCallCount());
+ }
+
+}
diff --git a/org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/fixture/TestTransactionMember.java b/org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/fixture/TestTransactionMember.java
new file mode 100644
index 0000000000..56cb788e5e
--- /dev/null
+++ b/org.eclipse.scout.rt.testing.server.test/src/org/eclipse/scout/rt/testing/server/runner/fixture/TestTransactionMember.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BSI Business Systems Integration AG.
+ * 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:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.rt.testing.server.runner.fixture;
+
+import org.eclipse.scout.rt.server.transaction.AbstractTransactionMember;
+
+/**
+ * fixture implementation of {@link AbstractTransactionMember}
+ */
+public class TestTransactionMember extends AbstractTransactionMember {
+
+ private int m_needsCommitMethodCallCount = 0;
+ private int m_commitPhase1MethodCallCount = 0;
+ private int m_commitPhase2MethodCallCount = 0;
+ private int m_rollbackMethodCallCount = 0;
+ private int m_releaseMethodCallCount = 0;
+
+ /**
+ * @param transactionMemberId
+ */
+ public TestTransactionMember(String transactionMemberId) {
+ super(transactionMemberId);
+ }
+
+ @Override
+ public final boolean needsCommit() {
+ m_needsCommitMethodCallCount++;
+ return execNeedsCommit();
+ }
+
+ protected boolean execNeedsCommit() {
+ return true;
+ }
+
+ public int getNeedsCommitMethodCallCount() {
+ return m_needsCommitMethodCallCount;
+ }
+
+ @Override
+ public final boolean commitPhase1() {
+ m_commitPhase1MethodCallCount++;
+ return execCommitPhase1();
+ }
+
+ protected boolean execCommitPhase1() {
+ return true;
+ }
+
+ public int getCommitPhase1MethodCallCount() {
+ return m_commitPhase1MethodCallCount;
+ }
+
+ @Override
+ public final void commitPhase2() {
+ m_commitPhase2MethodCallCount++;
+ execCommitPhase2();
+ }
+
+ protected void execCommitPhase2() {
+ }
+
+ public int getCommitPhase2MethodCallCount() {
+ return m_commitPhase2MethodCallCount;
+ }
+
+ @Override
+ public final void rollback() {
+ m_rollbackMethodCallCount++;
+ execRollback();
+ }
+
+ protected void execRollback() {
+ }
+
+ public int getRollbackMethodCallCount() {
+ return m_rollbackMethodCallCount;
+ }
+
+ @Override
+ public void release() {
+ m_releaseMethodCallCount++;
+ execRelease();
+ }
+
+ protected void execRelease() {
+ }
+
+ public int getReleaseMethodCallCount() {
+ return m_releaseMethodCallCount;
+ }
+}

Back to the top