Repository: tomee
Updated Branches:
refs/heads/tomee-1.7.x a25837dbb -> 525eedc65
#TOMEE-1523 - @BeforeClass init
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/79f5bfab
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/79f5bfab
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/79f5bfab
Branch: refs/heads/tomee-1.7.x
Commit: 79f5bfabbdf2c598af52ab660f7220aef522072c
Parents: 69dcf61
Author: andygumbrecht <andygumbrecht@apache.org>
Authored: Fri Mar 6 12:29:08 2015 +0100
Committer: andygumbrecht <andygumbrecht@apache.org>
Committed: Fri Mar 6 12:29:08 2015 +0100
----------------------------------------------------------------------
.../openejb/itest/legacy/LegacyClientTest.java | 50 +++++++++++---------
1 file changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/79f5bfab/itests/legacy-client/src/test/java/org/apache/openejb/itest/legacy/LegacyClientTest.java
----------------------------------------------------------------------
diff --git a/itests/legacy-client/src/test/java/org/apache/openejb/itest/legacy/LegacyClientTest.java
b/itests/legacy-client/src/test/java/org/apache/openejb/itest/legacy/LegacyClientTest.java
index 266c6ab..a4a047f 100644
--- a/itests/legacy-client/src/test/java/org/apache/openejb/itest/legacy/LegacyClientTest.java
+++ b/itests/legacy-client/src/test/java/org/apache/openejb/itest/legacy/LegacyClientTest.java
@@ -28,6 +28,7 @@ import org.apache.openejb.loader.Zips;
import org.apache.openejb.server.control.StandaloneServer;
import org.junit.AfterClass;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
import javax.ejb.EJBException;
@@ -56,6 +57,10 @@ public class LegacyClientTest {
private static final Map<String, StandaloneServer> servers = new HashMap<String,
StandaloneServer>();
private static StandaloneServer root = null;
+ private static final String rootname = "root";
+ private static final File dir = Files.tmpdir();
+ private static File zip = null;
+ private static File app = null;
private static final Logger logger = Logger.getLogger("org.apache.openejb.client");
static {
@@ -66,6 +71,27 @@ public class LegacyClientTest {
logger.setUseParentHandlers(false);
}
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ logger.info("Retrieving standalone server: " + Repository.guessVersion("org.apache.openejb",
"openejb-standalone") + " - This may take a while...");
+
+ zip = Repository.getArtifact("org.apache.openejb", "openejb-standalone", "zip");
+ app = Repository.getArtifact("org.apache.openejb.itests", "failover-ejb", "jar");
+
+ final File roothome = new File(dir, rootname);
+
+ Files.mkdir(roothome);
+ Zips.unzip(zip, roothome, true);
+
+ root = new StandaloneServer(roothome, roothome);
+
+ root.killOnExit();
+ root.getJvmOpts().add("-Dopenejb.classloader.forced-load=org.apache.openejb");
+ root.ignoreOut();
+ root.setProperty("name", rootname);
+ root.setProperty("openejb.extract.configuration", "false");
+ }
+
@AfterClass
public static void afterClass() {
@@ -94,26 +120,6 @@ public class LegacyClientTest {
// System.setProperty("version", OpenEjbVersion.get().getVersion());
System.setProperty("openejb.client.connection.strategy", "roundrobin");
- logger.info("Retrieving standalone server: " + Repository.guessVersion("org.apache.openejb",
"openejb-standalone") + " - This may take a while...");
- final File zip = Repository.getArtifact("org.apache.openejb", "openejb-standalone",
"zip");
- final File app = Repository.getArtifact("org.apache.openejb.itests", "failover-ejb",
"jar");
-
- final File dir = Files.tmpdir();
-
- final String rootname = "root";
- final File roothome = new File(dir, rootname);
-
- Files.mkdir(roothome);
- Zips.unzip(zip, roothome, true);
-
- root = new StandaloneServer(roothome, roothome);
-
- root.killOnExit();
- root.getJvmOpts().add("-Dopenejb.classloader.forced-load=org.apache.openejb");
- root.ignoreOut();
- root.setProperty("name", rootname);
- root.setProperty("openejb.extract.configuration", "false");
-
StandaloneServer.ServerService multipoint = root.getServerService("multipoint");
multipoint.setBind("localhost");
multipoint.setPort(getNextAvailablePort());
@@ -226,7 +232,7 @@ public class LegacyClientTest {
}
}
- private void assertBalance(final Calculator bean, final int size) {
+ private static void assertBalance(final Calculator bean, final int size) {
final int expectedInvocations = 1000;
final double percent = 0.10;
final int totalInvocations = size * expectedInvocations;
@@ -245,7 +251,7 @@ public class LegacyClientTest {
}
}
- private Map<String, AtomicInteger> invoke(final Calculator bean, final int max)
{
+ private static Map<String, AtomicInteger> invoke(final Calculator bean, final int
max) {
final Map<String, AtomicInteger> invocations = new HashMap<String, AtomicInteger>();
for (int i = 0; i < max; i++) {
final String name = bean.name();
|