#TOMEE-1523 - @BeforeClass

Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/536d1c56
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/536d1c56
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/536d1c56

Branch: refs/heads/master
Commit: 536d1c56952d29620ca2ae460b8bf3957f4633b9
Parents: f692db1
Author: AndyGee <andy...@gmx.de>
Authored: Fri Mar 6 12:40:56 2015 +0100
Committer: AndyGee <andy...@gmx.de>
Committed: Fri Mar 6 12:40:56 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/536d1c56/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();

Reply via email to