[jboss-svn-commits] JBL Code SVN: r36427 - in labs/jbosstm/trunk/txbridge/tests: src/org/jboss/jbossts/txbridge/tests and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Dec 16 09:08:30 EST 2010


Author: istudens at redhat.com
Date: 2010-12-16 09:08:29 -0500 (Thu, 16 Dec 2010)
New Revision: 36427

Added:
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java
Modified:
   labs/jbosstm/trunk/txbridge/tests/build.xml
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/BasicTests.java
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/CrashRecoveryTests.java
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/BasicTests.java
   labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/CrashRecoveryTests.java
Log:
removing the redundancy in automation of server config+startup in tx bridge tests, JBQA-3924

Modified: labs/jbosstm/trunk/txbridge/tests/build.xml
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/build.xml	2010-12-16 13:29:03 UTC (rev 36426)
+++ labs/jbosstm/trunk/txbridge/tests/build.xml	2010-12-16 14:08:29 UTC (rev 36427)
@@ -192,7 +192,7 @@
 
         <mkdir dir="${build.dir}/testresults"/>
         <junit printsummary="yes" fork="yes" dir="${build.dir}" showoutput="@{showoutput}" includeantruntime="true">
-            <formatter type="plain"/>
+            <formatter type="xml"/>
             <classpath>
                 <path refid="build-prereqs"/>
                 <pathelement location="${build.dir}/classes"/>
@@ -206,6 +206,7 @@
             <jvmarg value="-DJAVA_HOME=${java.home}"/>
             <jvmarg value="-DJBOSS_HOME=${jboss.home}"/>
             <jvmarg value="-DBYTEMAN_HOME=${byteman.home}"/>
+            <jvmarg value="-DSERVER_NAME=${jbossas.server}"/>
 
             <jvmarg value="-Djava.rmi.server.codebase=file://build/classes/"/>
             <!--<jvmarg value="-Xdebug"/>-->

Added: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java	                        (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractBasicTests.java	2010-12-16 14:08:29 UTC (rev 36427)
@@ -0,0 +1,207 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.common;
+
+import com.arjuna.qa.junit.HttpUtils;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.jboss.byteman.agent.submit.Submit;
+import org.jboss.byteman.contrib.dtest.BytemanTestHelper;
+import org.jboss.byteman.contrib.dtest.Instrumentor;
+import org.jboss.jbossas.servermanager.Argument;
+import org.jboss.jbossas.servermanager.Property;
+import org.jboss.jbossas.servermanager.Server;
+import org.jboss.jbossas.servermanager.ServerManager;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.net.ConnectException;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Common methods for tx bridge test cases.
+ * TODO: make server name ('default', ...) configurable
+ */
+public abstract class AbstractBasicTests {
+
+    protected static Instrumentor instrumentor;
+
+    protected static final ServerManager manager = new ServerManager(); // ASTestConfig.java/ServerTask.java
+    protected static final Argument bytemanArgument = new Argument();    
+
+    protected static String jboss_home;
+    protected static String java_home;
+    protected static String byteman_home;
+    
+    protected static String serverName = "default";
+
+    /*
+-Xdebug
+-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006
+-Xmx1024m
+-javaagent:/home/jhalli/IdeaProjects/jboss/byteman_trunk/install/lib/byteman.jar=port:9091,listener:true
+-Dorg.jboss.byteman.debug=true
+-Dorg.jboss.byteman.verbose=true
+-Dorg.jboss.byteman.dump.generated.classes=true
+-Dorg.jboss.byteman.dump.generated.classes.dir=dump
+-Demma.exit.delay=10
+     */
+    
+    @BeforeClass
+    public static void beforeClass() throws Exception {
+        
+        instrumentor = new Instrumentor(new Submit(), 1199);
+        
+        jboss_home = System.getProperty("JBOSS_HOME");
+        if(jboss_home == null) {
+            throw new IllegalStateException("no JBOSS_HOME defined");
+        }
+        File jbossHomeDirectory = new File(jboss_home);
+        if(!jbossHomeDirectory.exists() || !jbossHomeDirectory.isDirectory()) {
+            throw new IllegalStateException("invalid JBOSS_HOME");
+        }
+        manager.setJbossHome(jboss_home);
+
+        java_home = System.getProperty("JAVA_HOME");
+        if(java_home == null) {
+            throw new IllegalStateException("no JAVA_HOME defined");
+        }
+        File javaHomeDir = new File(java_home);
+        if(!javaHomeDir.exists() || !javaHomeDir.isDirectory()) {
+            throw new IllegalStateException("invalid JAVA_HOME");
+        }
+        manager.setJavaHome(java_home);
+
+        byteman_home = System.getProperty("BYTEMAN_HOME");
+        if(byteman_home == null) {
+            throw new IllegalStateException("no BYTEMAN_HOME defined");
+        }
+        File bytemanHomeDir = new File(byteman_home);
+        if(!bytemanHomeDir.exists() || !bytemanHomeDir.isDirectory()) {
+            throw new IllegalStateException("invalid BYTEMAN_HOME");
+        }
+
+        String _serverName = System.getProperty("SERVER_NAME");
+        if (_serverName != null && _serverName.length() > 0) {
+            serverName = _serverName;
+        }
+
+        Server server = new Server();
+        server.setName(serverName);
+
+        server.addJvmArg(bytemanArgument);
+        Argument arg2 = new Argument();
+        arg2.setValue("-Xmx1024m");
+        server.addJvmArg(arg2);
+
+        Argument arg3 = new Argument();
+        arg3.setValue("-Xdebug");
+        server.addJvmArg(arg3);
+        Argument arg4 = new Argument();
+        arg4.setValue("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006");
+        server.addJvmArg(arg4);
+
+        Argument arg5 = new Argument();
+        arg5.setValue("-XX:MaxPermSize=256m"); // caution: JVM specific
+        server.addJvmArg(arg5);
+
+        Property property1 = new Property();
+        property1.setKey("org.jboss.byteman.debug");
+        property1.setValue("true");
+        server.addSysProperty(property1);
+        Property property2 = new Property();
+        property2.setKey(BytemanTestHelper.RMIREGISTRY_PORT_PROPERTY_NAME);
+        property2.setValue("1199");
+        server.addSysProperty(property2);
+
+        Property property3 = new Property();
+        property3.setKey("emma.exit.delay");
+        property3.setValue("10");
+        server.addSysProperty(property3);
+
+        manager.addServer(server);
+    }
+
+    @AfterClass
+    public static void afterClass() throws Exception {
+        Server server = manager.getServer(serverName);
+        if (server.isRunning()) {
+            manager.stopServer(serverName);
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+
+        bytemanArgument.setValue("-javaagent:"+byteman_home+"/byteman.jar=port:9091,listener:true,sys:"+byteman_home+"/byteman-dtest.jar");
+
+        Server server = manager.getServer(serverName);
+        // TODO: fix JMXAdapter leak.
+        server.setServerConnection(null);
+        if (!server.isRunning()) {
+            manager.startServer(serverName);
+        }
+
+        //instrumentor.installHelperJar("/home/jhalli/IdeaProjects/jboss/byteman_trunk/contrib/dtest/build/lib/byteman-dtest.jar");
+        instrumentor.setRedirectedSubmissionsFile(null);
+        
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        instrumentor.removeAllInstrumentation();
+
+        if (restartServerForEachTest()) {
+            manager.stopServer(serverName);
+        }
+    }
+
+    protected boolean restartServerForEachTest() {
+        return false;
+    }
+
+    protected void execute(String baseURL) throws Exception {
+        execute(baseURL, true);
+    }
+    
+    protected void execute(String baseURL, boolean expectResponse) throws Exception {
+
+        HttpMethodBase request = null;
+
+        try {
+            request = HttpUtils.accessURL(new URL(baseURL));
+        } catch(ConnectException e) {
+            if(expectResponse) {
+                throw e;
+            }
+        }
+
+        if(expectResponse) {
+            String response = request.getResponseBodyAsString().trim();
+            assertEquals("finished", response);
+        }
+    }
+
+}

Added: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java	                        (rev 0)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/common/AbstractCrashRecoveryTests.java	2010-12-16 14:08:29 UTC (rev 36427)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package org.jboss.jbossts.txbridge.tests.common;
+
+import com.arjuna.ats.arjuna.common.recoveryPropertyManager;
+import org.junit.Before;
+
+import java.io.*;
+import java.net.Socket;
+
+/**
+ * Common methods for crash recovery test cases.
+ */
+public abstract class AbstractCrashRecoveryTests extends AbstractBasicTests {
+
+    @Before
+    @Override
+    public void setUp() throws Exception {
+        removeContents(new File(jboss_home, "server/default/data/tx-object-store/"));
+        super.setUp();
+    }
+
+    @Override
+    protected boolean restartServerForEachTest() {
+        return true;
+    }
+
+    protected void rebootServer() throws Exception {
+
+        instrumentor.removeLocalState();
+        File rulesFile = new File("/tmp/bar3");
+        rulesFile.delete();
+        instrumentor.setRedirectedSubmissionsFile(rulesFile);
+        bytemanArgument.setValue(bytemanArgument.getValue()+",script:"+rulesFile.getCanonicalPath());
+
+//        instrumentedTestSynchronization = instrumentor.instrumentClass(TestSynchronization.class);
+//        instrumentedTestXAResource = instrumentor.instrumentClass(TestXAResourceRecovered.class);
+        instrumentationOnServerReboot();
+
+        manager.getServer("default").setServerConnection(null);
+        Thread.sleep(2000);
+        manager.startServer("default");
+    }
+
+    protected abstract void instrumentationOnServerReboot() throws Exception;
+
+
+    /////////////////
+
+    // stolen from CrashRecoveryDelays - should probably just add that to the classpath?
+    // prod the recovery manager via its socket. This avoid any sleep delay.
+    protected static void doRecovery() throws InterruptedException
+    {
+        int port = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryPort();
+        String host = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryAddress();
+
+        BufferedReader in = null;
+        PrintStream out = null;
+        Socket sckt = null;
+
+        try
+        {
+            sckt = new Socket(host,port);
+
+            in = new BufferedReader(new InputStreamReader(sckt.getInputStream()));
+            out = new PrintStream(sckt.getOutputStream());
+
+            // Output ping message
+            out.println("SCAN");
+            out.flush();
+
+            // Receive pong message
+            String inMessage = in.readLine();
+
+            if(!inMessage.equals("DONE")) {
+                System.err.println("Recovery failed with message: "+inMessage);
+            }
+        }
+        catch (Exception ex)
+        {
+            ex.printStackTrace();
+        }
+        finally
+        {
+            try {
+                if ( in != null )
+                {
+                    in.close();
+                }
+
+                if ( out != null )
+                {
+                    out.close();
+                }
+
+                sckt.close();
+            } catch(Exception e) {}
+        }
+   }
+
+    // stolen from EmptyObjectStore.java
+    protected static void removeContents(File directory)
+    {
+        if ((directory != null) &&
+                directory.isDirectory() &&
+                (!directory.getName().equals("")) &&
+                (!directory.getName().equals("/")) &&
+                (!directory.getName().equals("\\")) &&
+                (!directory.getName().equals(".")) &&
+                (!directory.getName().equals("..")))
+        {
+            File[] contents = directory.listFiles();
+
+            for (int index = 0; index < contents.length; index++)
+            {
+                if (contents[index].isDirectory())
+                {
+                    removeContents(contents[index]);
+
+                    //System.err.println("Deleted: " + contents[index]);
+                    contents[index].delete();
+                }
+                else
+                {
+                    System.err.println("Deleted: " + contents[index]);
+                    contents[index].delete();
+                }
+            }
+        }
+    }
+
+}

Modified: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/BasicTests.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/BasicTests.java	2010-12-16 13:29:03 UTC (rev 36426)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/BasicTests.java	2010-12-16 14:08:29 UTC (rev 36427)
@@ -20,66 +20,45 @@
  */
 package org.jboss.jbossts.txbridge.tests.inbound.junit;
 
-import org.apache.commons.httpclient.HttpMethodBase;
+import org.jboss.jbossts.txbridge.tests.common.AbstractBasicTests;
 import org.jboss.jbossts.txbridge.tests.inbound.client.TestClient;
 import org.jboss.jbossts.txbridge.tests.inbound.service.TestServiceImpl;
 import org.jboss.jbossts.txbridge.tests.inbound.utility.TestSynchronization;
 import org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResource;
 
 import org.junit.*;
-import static org.junit.Assert.*;
 
-import org.jboss.byteman.agent.submit.Submit;
 import org.jboss.byteman.contrib.dtest.*;
 
-import com.arjuna.qa.junit.HttpUtils;
-
 import javax.transaction.xa.XAException;
 import javax.transaction.xa.XAResource;
-import java.net.URL;
 
 /**
  * Basic (i.e. non-crashrec) test cases for the inbound side of the transaction bridge.
  *
  * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-05
  */
-public class BasicTests
+public class BasicTests extends AbstractBasicTests
 {
     private static final String baseURL = "http://localhost:8080/txbridge-inbound-tests-client/testclient";
 
-    private static Instrumentor instrumentor;
     private InstrumentedClass instrumentedTestSynchronization;
     private InstrumentedClass instrumentedTestXAResource;
 
-    @BeforeClass
-    public static void beforeClass() throws Exception {
-        instrumentor = new Instrumentor(new Submit(), 1199);
-        //instrumentor.installHelperJar("/home/jhalli/IdeaProjects/jboss/byteman_trunk/contrib/dtest/build/lib/byteman-dtest.jar");
-    }
-
     @Before
     public void setUp() throws Exception {
+        super.setUp();
+        
         instrumentedTestSynchronization = instrumentor.instrumentClass(TestSynchronization.class);
         instrumentedTestXAResource = instrumentor.instrumentClass(TestXAResource.class);
 
         instrumentor.injectOnCall(TestServiceImpl.class, "doNothing", "$0.enlistSynchronization(1), $0.enlistXAResource(1)");
     }
 
-    @After
-    public void tearDown() throws Exception {
-        instrumentor.removeAllInstrumentation();
-    }
-
-    private void execute() throws Exception {
-        HttpMethodBase request = HttpUtils.accessURL(new URL(baseURL));
-        String response = request.getResponseBodyAsString().trim();
-        assertEquals("finished", response);
-    }
-
     @Test
     public void testRollback() throws Exception {
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestSynchronization.assertKnownInstances(1);
         instrumentedTestSynchronization.assertMethodNotCalled("beforeCompletion");
@@ -95,7 +74,7 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestSynchronization.assertKnownInstances(1);
         instrumentedTestSynchronization.assertMethodCalled("beforeCompletion");
@@ -113,7 +92,7 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestSynchronization.assertKnownInstances(1);
         instrumentedTestSynchronization.assertMethodCalled("beforeCompletion");
@@ -131,7 +110,7 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestSynchronization.assertKnownInstances(1);
         instrumentedTestSynchronization.assertMethodCalled("beforeCompletion");
@@ -149,7 +128,7 @@
         
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestSynchronization.assertKnownInstances(1);
         instrumentedTestSynchronization.assertMethodCalled("beforeCompletion");

Modified: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/CrashRecoveryTests.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/CrashRecoveryTests.java	2010-12-16 13:29:03 UTC (rev 36426)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/inbound/junit/CrashRecoveryTests.java	2010-12-16 14:08:29 UTC (rev 36427)
@@ -20,13 +20,8 @@
  */
 package org.jboss.jbossts.txbridge.tests.inbound.junit;
 
-import com.arjuna.ats.arjuna.common.recoveryPropertyManager;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.jboss.jbossas.servermanager.Argument;
-import org.jboss.jbossas.servermanager.Property;
-import org.jboss.jbossas.servermanager.Server;
-import org.jboss.jbossas.servermanager.ServerManager;
 import org.jboss.jbossts.txbridge.inbound.BridgeDurableParticipant;
+import org.jboss.jbossts.txbridge.tests.common.AbstractCrashRecoveryTests;
 import org.jboss.jbossts.txbridge.tests.inbound.client.TestClient;
 import org.jboss.jbossts.txbridge.tests.inbound.service.TestServiceImpl;
 import org.jboss.jbossts.txbridge.tests.inbound.utility.TestSynchronization;
@@ -34,182 +29,39 @@
 
 import org.jboss.jbossts.txbridge.tests.inbound.utility.TestXAResourceRecovered;
 import org.junit.*;
-import static org.junit.Assert.*;
 
-import org.jboss.byteman.agent.submit.Submit;
 import org.jboss.byteman.contrib.dtest.*;
 
-import com.arjuna.qa.junit.HttpUtils;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.net.Socket;
-import java.net.URL;
-import java.net.ConnectException;
-
 /**
  * Crash Recovery test cases for the inbound side of the transaction bridge.
  *
  * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-05
  */
-public class CrashRecoveryTests
+public class CrashRecoveryTests extends AbstractCrashRecoveryTests
 {
     private static final String baseURL = "http://localhost:8080/txbridge-inbound-tests-client/testclient";
 
-    private static Instrumentor instrumentor;
     private InstrumentedClass instrumentedTestSynchronization;
     private InstrumentedClass instrumentedTestXAResource;
     
-    private static final ServerManager manager = new ServerManager(); // ASTestConfig.java/ServerTask.java
-    private static final Argument bytemanArgument = new Argument();
 
-    private static String jboss_home;
-    private static String java_home;
-    private static String byteman_home;
-
-    /*
--Xdebug
--Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006
--Xmx1024m
--javaagent:/home/jhalli/IdeaProjects/jboss/byteman_trunk/install/lib/byteman.jar=port:9091,listener:true
--Dorg.jboss.byteman.debug=true
--Dorg.jboss.byteman.verbose=true
--Dorg.jboss.byteman.dump.generated.classes=true
--Dorg.jboss.byteman.dump.generated.classes.dir=dump
--Demma.exit.delay=10
-     */
-
-    @BeforeClass
-    public static void beforeClass() throws Exception {
-        instrumentor = new Instrumentor(new Submit(), 1199);
-
-        jboss_home = System.getProperty("JBOSS_HOME");
-        if(jboss_home == null) {
-            throw new IllegalStateException("no JBOSS_HOME defined");
-        }
-        File jbossHomeDirectory = new File(jboss_home);
-        if(!jbossHomeDirectory.exists() || !jbossHomeDirectory.isDirectory()) {
-            throw new IllegalStateException("invalid JBOSS_HOME");
-        }
-        manager.setJbossHome(jboss_home);
-
-        java_home = System.getProperty("JAVA_HOME");
-        if(java_home == null) {
-            throw new IllegalStateException("no JAVA_HOME defined");
-        }
-        File javaHomeDir = new File(java_home);
-        if(!javaHomeDir.exists() || !javaHomeDir.isDirectory()) {
-            throw new IllegalStateException("invalid JAVA_HOME");
-        }
-        manager.setJavaHome(java_home);
-
-        byteman_home = System.getProperty("BYTEMAN_HOME");
-        if(byteman_home == null) {
-            throw new IllegalStateException("no BYTEMAN_HOME defined");
-        }
-        File bytemanHomeDir = new File(byteman_home);
-        if(!bytemanHomeDir.exists() || !bytemanHomeDir.isDirectory()) {
-            throw new IllegalStateException("invalid BYTEMAN_HOME");
-        }
-
-        
-        Server server = new Server();
-        server.setName("default");
-
-        server.addJvmArg(bytemanArgument);
-        Argument arg2 = new Argument();
-        arg2.setValue("-Xmx1024m");
-        server.addJvmArg(arg2);
-
-        Argument arg3 = new Argument();
-        arg3.setValue("-Xdebug");
-        server.addJvmArg(arg3);
-        Argument arg4 = new Argument();
-        arg4.setValue("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006");
-        server.addJvmArg(arg4);
-
-        Argument arg5 = new Argument();
-        arg5.setValue("-XX:MaxPermSize=256m"); // caution: JVM specific
-        server.addJvmArg(arg5);
-
-        Property property1 = new Property();
-        property1.setKey("org.jboss.byteman.debug");
-        property1.setValue("true");
-        server.addSysProperty(property1);
-        Property property2 = new Property();
-        property2.setKey(BytemanTestHelper.RMIREGISTRY_PORT_PROPERTY_NAME);
-        property2.setValue("1199");
-        server.addSysProperty(property2);
-
-        Property property3 = new Property();
-        property3.setKey("emma.exit.delay");
-        property3.setValue("10");
-        server.addSysProperty(property3);
-
-        manager.addServer(server);
-    }
-
     @Before
+    @Override
     public void setUp() throws Exception {
+        super.setUp();
 
-        bytemanArgument.setValue("-javaagent:"+byteman_home+"/byteman.jar=port:9091,listener:true,sys:"+byteman_home+"/byteman-dtest.jar");
-        removeContents(new File(jboss_home, "server/default/data/tx-object-store/"));
-
-
-        // TODO: fix JMXAdapter leak.
-        manager.getServer("default").setServerConnection(null);
-        manager.startServer("default");
-        
-        //instrumentor.installHelperJar("/home/jhalli/IdeaProjects/jboss/byteman_trunk/contrib/dtest/build/lib/byteman-dtest.jar");
-        instrumentor.setRedirectedSubmissionsFile(null);
-
         instrumentedTestSynchronization = instrumentor.instrumentClass(TestSynchronization.class);
         instrumentedTestXAResource = instrumentor.instrumentClass(TestXAResource.class);
 
         instrumentor.injectOnCall(TestServiceImpl.class, "doNothing", "$0.enlistSynchronization(1), $0.enlistXAResource(1)");
     }
 
-    @After
-    public void tearDown() throws Exception {
-        instrumentor.removeAllInstrumentation();
-
-        manager.stopServer("default");
-    }
-
-    private void execute(boolean expectResponse) throws Exception {
-
-        HttpMethodBase request = null;
-
-        try {
-            request = HttpUtils.accessURL(new URL(baseURL));
-        } catch(ConnectException e) {
-            if(expectResponse) {
-                throw e;
-            }
-        }
-
-        if(expectResponse) {
-            String response = request.getResponseBodyAsString().trim();
-            assertEquals("finished", response);
-        }
-    }
-
-    private void rebootServer() throws Exception {
-        
-        instrumentor.removeLocalState();
-        File rulesFile = new File("/tmp/bar3");
-        rulesFile.delete();
-        instrumentor.setRedirectedSubmissionsFile(rulesFile);
-        bytemanArgument.setValue(bytemanArgument.getValue()+",script:"+rulesFile.getCanonicalPath());
-
+    @Override
+    protected void instrumentationOnServerReboot() throws Exception
+    {
         instrumentedTestSynchronization = instrumentor.instrumentClass(TestSynchronization.class);
         instrumentedTestXAResource = instrumentor.instrumentClass(TestXAResourceRecovered.class);
-
-        manager.getServer("default").setServerConnection(null);        
-        Thread.sleep(2000);
-        manager.startServer("default");
     }
 
     @Test
@@ -218,7 +70,7 @@
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
         instrumentor.crashAtMethodExit(TestXAResource.class, "prepare");
         
-        execute(false);
+        execute(baseURL, false);
 
         instrumentedTestSynchronization.assertKnownInstances(1);
         instrumentedTestSynchronization.assertMethodCalled("beforeCompletion");
@@ -248,7 +100,7 @@
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
         instrumentor.crashAtMethodExit(BridgeDurableParticipant.class, "prepare");
 
-        execute(false);
+        execute(baseURL, false);
 
         durableParticipant.assertMethodCalled("prepare");
         durableParticipant.assertMethodNotCalled("rollback");
@@ -282,7 +134,7 @@
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$2 = true"); // shouldCommit=true
         instrumentor.crashAtMethodExit("^XTSATRecoveryManager", "writeParticipantRecoveryRecord");
 
-        execute(false);
+        execute(baseURL, false);
 
         durableParticipant.assertMethodCalled("prepare");
         durableParticipant.assertMethodNotCalled("rollback");
@@ -310,87 +162,4 @@
 
     // TODO: add test for 4log case i.e. commit
 
-    /////////////////
-
-    // stolen from CrashRecoveryDelays - should probably just add that to the classpath?
-    // prod the recovery manager via its socket. This avoid any sleep delay.
-    private static void doRecovery() throws InterruptedException
-    {
-        int port = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryPort();
-        String host = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryAddress();
-
-        BufferedReader in = null;
-        PrintStream out = null;
-        Socket sckt = null;
-
-        try
-        {
-            sckt = new Socket(host,port);
-
-            in = new BufferedReader(new InputStreamReader(sckt.getInputStream()));
-            out = new PrintStream(sckt.getOutputStream());
-
-            // Output ping message
-            out.println("SCAN");
-            out.flush();
-
-            // Receive pong message
-            String inMessage = in.readLine();
-
-            if(!inMessage.equals("DONE")) {
-                System.err.println("Recovery failed with message: "+inMessage);
-            }
-        }
-        catch (Exception ex)
-        {
-            ex.printStackTrace();
-        }
-        finally
-        {
-            try {
-                if ( in != null )
-                {
-                    in.close();
-                }
-
-                if ( out != null )
-                {
-                    out.close();
-                }
-
-                sckt.close();
-            } catch(Exception e) {}
-        }
-   }
-
-    // stolen from EmptyObjectStore.java
-    public static void removeContents(File directory)
-    {
-        if ((directory != null) &&
-                directory.isDirectory() &&
-                (!directory.getName().equals("")) &&
-                (!directory.getName().equals("/")) &&
-                (!directory.getName().equals("\\")) &&
-                (!directory.getName().equals(".")) &&
-                (!directory.getName().equals("..")))
-        {
-            File[] contents = directory.listFiles();
-
-            for (int index = 0; index < contents.length; index++)
-            {
-                if (contents[index].isDirectory())
-                {
-                    removeContents(contents[index]);
-
-                    //System.err.println("Deleted: " + contents[index]);
-                    contents[index].delete();
-                }
-                else
-                {
-                    System.err.println("Deleted: " + contents[index]);
-                    contents[index].delete();
-                }
-            }
-        }
-    }
 }

Modified: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/BasicTests.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/BasicTests.java	2010-12-16 13:29:03 UTC (rev 36426)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/BasicTests.java	2010-12-16 14:08:29 UTC (rev 36427)
@@ -20,64 +20,41 @@
  */
 package org.jboss.jbossts.txbridge.tests.outbound.junit;
 
-import org.apache.commons.httpclient.HttpMethodBase;
-
+import org.jboss.jbossts.txbridge.tests.common.AbstractBasicTests;
 import org.jboss.jbossts.txbridge.tests.outbound.client.TestClient;
 import org.jboss.jbossts.txbridge.tests.outbound.service.TestServiceImpl;
 import org.jboss.jbossts.txbridge.tests.outbound.utility.TestDurableParticipant;
 import org.jboss.jbossts.txbridge.tests.outbound.utility.TestVolatileParticipant;
 import org.junit.*;
-import static org.junit.Assert.*;
 
-import org.jboss.byteman.agent.submit.Submit;
 import org.jboss.byteman.contrib.dtest.*;
 
-import com.arjuna.qa.junit.HttpUtils;
-
-import java.net.URL;
-
 /**
  * Basic (i.e. non-crashrec) test cases for the outbound side of the transaction bridge.
  *
  * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-05
  */
-public class BasicTests
+public class BasicTests extends AbstractBasicTests
 {
     private static final String baseURL = "http://localhost:8080/txbridge-outbound-tests-client/testclient";
 
-    private static Instrumentor instrumentor;
     private InstrumentedClass instrumentedTestVolatileParticipant;
     private InstrumentedClass instrumentedTestDurableParticipant;
 
-    @BeforeClass
-    public static void beforeClass() throws Exception {
-        instrumentor = new Instrumentor(new Submit(), 1199);
-        //instrumentor.installHelperJar("/home/jhalli/IdeaProjects/jboss/byteman_trunk/contrib/dtest/build/lib/byteman-dtest.jar");
-    }
-
     @Before
     public void setUp() throws Exception {
+        super.setUp();
+        
         instrumentedTestVolatileParticipant = instrumentor.instrumentClass(TestVolatileParticipant.class);
         instrumentedTestDurableParticipant = instrumentor.instrumentClass(TestDurableParticipant.class);
 
         instrumentor.injectOnCall(TestServiceImpl.class, "doNothing", "$0.enlistVolatileParticipant(1), $0.enlistDurableParticipant(1)");
     }
 
-    @After
-    public void tearDown() throws Exception {
-        instrumentor.removeAllInstrumentation();
-    }
-
-    private void execute() throws Exception {
-        HttpMethodBase request = HttpUtils.accessURL(new URL(baseURL));
-        String response = request.getResponseBodyAsString().trim();
-        assertEquals("finished", response);
-    }
-
     @Test
     public void testRollback() throws Exception {
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodNotCalled("prepare");
@@ -95,7 +72,7 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$1 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodCalled("prepare");
@@ -115,7 +92,7 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$1 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodNotCalled("rollback");
@@ -134,7 +111,7 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$1 = true"); // shouldCommit=true
 
-        execute();
+        execute(baseURL);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodCalled("prepare");
@@ -153,8 +130,9 @@
 
         instrumentor.injectOnCall(TestClient.class,  "terminateTransaction", "$1 = true"); // shouldCommit=true
 
-        HttpMethodBase request = HttpUtils.accessURL(new URL(baseURL));
-        String response = request.getResponseBodyAsString().trim();
+//        HttpMethodBase request = HttpUtils.accessURL(new URL(baseURL));
+//        String response = request.getResponseBodyAsString().trim();
+        execute(baseURL);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodCalled("prepare");

Modified: labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/CrashRecoveryTests.java
===================================================================
--- labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/CrashRecoveryTests.java	2010-12-16 13:29:03 UTC (rev 36426)
+++ labs/jbosstm/trunk/txbridge/tests/src/org/jboss/jbossts/txbridge/tests/outbound/junit/CrashRecoveryTests.java	2010-12-16 14:08:29 UTC (rev 36427)
@@ -20,200 +20,44 @@
  */
 package org.jboss.jbossts.txbridge.tests.outbound.junit;
 
-import com.arjuna.ats.arjuna.common.recoveryPropertyManager;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.jboss.jbossas.servermanager.Argument;
-import org.jboss.jbossas.servermanager.Property;
-import org.jboss.jbossas.servermanager.Server;
-import org.jboss.jbossas.servermanager.ServerManager;
 import org.jboss.jbossts.txbridge.outbound.BridgeXAResource;
+import org.jboss.jbossts.txbridge.tests.common.AbstractCrashRecoveryTests;
 import org.jboss.jbossts.txbridge.tests.outbound.client.TestClient;
 import org.jboss.jbossts.txbridge.tests.outbound.service.TestServiceImpl;
 import org.jboss.jbossts.txbridge.tests.outbound.utility.TestDurableParticipant;
 import org.jboss.jbossts.txbridge.tests.outbound.utility.TestVolatileParticipant;
 import org.junit.*;
-import static org.junit.Assert.*;
 
-import org.jboss.byteman.agent.submit.Submit;
 import org.jboss.byteman.contrib.dtest.*;
 
-import com.arjuna.qa.junit.HttpUtils;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.net.Socket;
-import java.net.SocketException;
-import java.net.URL;
-import java.net.ConnectException;
-
 /**
  * Crash Recovery test cases for the outbound side of the transaction bridge.
  *
  * @author Jonathan Halliday (jonathan.halliday at redhat.com) 2010-05
  */
 
-public class CrashRecoveryTests
+public class CrashRecoveryTests extends AbstractCrashRecoveryTests
 {
     private static final String baseURL = "http://localhost:8080/txbridge-outbound-tests-client/testclient";
 
-    private static Instrumentor instrumentor;
     private InstrumentedClass instrumentedTestVolatileParticipant;
     private InstrumentedClass instrumentedTestDurableParticipant;
 
-    private static final ServerManager manager = new ServerManager(); // ASTestConfig.java/ServerTask.java
-    private static final Argument bytemanArgument = new Argument();
-
-    private static String jboss_home;
-    private static String java_home;
-    private static String byteman_home;
-
-    /*
--Xdebug
--Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006
--Xmx1024m
--javaagent:/home/jhalli/IdeaProjects/jboss/byteman_trunk/install/lib/byteman.jar=port:9091,listener:true
--Dorg.jboss.byteman.debug=true
--Dorg.jboss.byteman.verbose=true
--Dorg.jboss.byteman.dump.generated.classes=true
--Dorg.jboss.byteman.dump.generated.classes.dir=dump
--Demma.exit.delay=10
-     */
-
-    @BeforeClass
-    public static void beforeClass() throws Exception {
-        instrumentor = new Instrumentor(new Submit(), 1199);
-
-        jboss_home = System.getProperty("JBOSS_HOME");
-        if(jboss_home == null) {
-            throw new IllegalStateException("no JBOSS_HOME defined");
-        }
-        File jbossHomeDirectory = new File(jboss_home);
-        if(!jbossHomeDirectory.exists() || !jbossHomeDirectory.isDirectory()) {
-            throw new IllegalStateException("invalid JBOSS_HOME");
-        }
-        manager.setJbossHome(jboss_home);
-
-        java_home = System.getProperty("JAVA_HOME");
-        if(java_home == null) {
-            throw new IllegalStateException("no JAVA_HOME defined");
-        }
-        File javaHomeDir = new File(java_home);
-        if(!javaHomeDir.exists() || !javaHomeDir.isDirectory()) {
-            throw new IllegalStateException("invalid JAVA_HOME");
-        }
-        manager.setJavaHome(java_home);
-
-        byteman_home = System.getProperty("BYTEMAN_HOME");
-        if(byteman_home == null) {
-            throw new IllegalStateException("no BYTEMAN_HOME defined");
-        }
-        File bytemanHomeDir = new File(byteman_home);
-        if(!bytemanHomeDir.exists() || !bytemanHomeDir.isDirectory()) {
-            throw new IllegalStateException("invalid BYTEMAN_HOME");
-        }
-        
-
-        Server server = new Server();
-        server.setName("default");
-
-        server.addJvmArg(bytemanArgument);
-        Argument arg2 = new Argument();
-        arg2.setValue("-Xmx1024m");
-        server.addJvmArg(arg2);
-
-        Argument arg3 = new Argument();
-        arg3.setValue("-Xdebug");
-        server.addJvmArg(arg3);
-        Argument arg4 = new Argument();
-        arg4.setValue("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006");
-        server.addJvmArg(arg4);
-
-        Argument arg5 = new Argument();
-        arg5.setValue("-XX:MaxPermSize=256m"); // caution: JVM specific
-        server.addJvmArg(arg5);
-
-        Property property1 = new Property();
-        property1.setKey("org.jboss.byteman.debug");
-        property1.setValue("true");
-        server.addSysProperty(property1);
-        Property property2 = new Property();
-        property2.setKey(BytemanTestHelper.RMIREGISTRY_PORT_PROPERTY_NAME);
-        property2.setValue("1199");
-        server.addSysProperty(property2);
-
-        Property property3 = new Property();
-        property3.setKey("emma.exit.delay");
-        property3.setValue("10");
-        server.addSysProperty(property3);
-
-        manager.addServer(server);
-    }
-
     @Before
     public void setUp() throws Exception {
+        super.setUp();
 
-        bytemanArgument.setValue("-javaagent:"+byteman_home+"/byteman.jar=port:9091,listener:true,sys:"+byteman_home+"/byteman-dtest.jar");
-        removeContents(new File(jboss_home, "server/default/data/tx-object-store/"));
-
-
-        // TODO: fix JMXAdapter leak.
-        manager.getServer("default").setServerConnection(null);
-        manager.startServer("default");
-
-        //instrumentor.installHelperJar("/home/jhalli/IdeaProjects/jboss/byteman_trunk/contrib/dtest/build/lib/byteman-dtest.jar");
-        instrumentor.setRedirectedSubmissionsFile(null);
-
         instrumentedTestVolatileParticipant = instrumentor.instrumentClass(TestVolatileParticipant.class);
         instrumentedTestDurableParticipant = instrumentor.instrumentClass(TestDurableParticipant.class);
 
         instrumentor.injectOnCall(TestServiceImpl.class, "doNothing", "$0.enlistVolatileParticipant(1), $0.enlistDurableParticipant(1)");
     }
 
-    @After
-    public void tearDown() throws Exception {
-        instrumentor.removeAllInstrumentation();
-
-        manager.stopServer("default");
-    }
-
-    private void execute(boolean expectResponse) throws Exception {
-
-        HttpMethodBase request = null;
-
-        try {
-            request = HttpUtils.accessURL(new URL(baseURL));
-        } catch(ConnectException e) {
-            if(expectResponse) {
-                throw e;
-            }
-        } catch(SocketException e) {
-            if(expectResponse) {
-                throw e;
-            }
-        }
-
-        if(expectResponse) {
-            String response = request.getResponseBodyAsString().trim();
-            assertEquals("finished", response);
-        }
-    }
-
-    private void rebootServer() throws Exception {
-
-        instrumentor.removeLocalState();
-        File rulesFile = new File("/tmp/bar3");
-        rulesFile.delete();
-        instrumentor.setRedirectedSubmissionsFile(rulesFile);
-        bytemanArgument.setValue(bytemanArgument.getValue()+",script:"+rulesFile.getCanonicalPath());
-
+    @Override
+    protected void instrumentationOnServerReboot() throws Exception
+    {
         instrumentedTestVolatileParticipant = instrumentor.instrumentClass(TestVolatileParticipant.class);
         instrumentedTestDurableParticipant = instrumentor.instrumentClass(TestDurableParticipant.class);
-
-        manager.getServer("default").setServerConnection(null);
-        Thread.sleep(2000);
-        manager.startServer("default");
     }
 
     @Test
@@ -223,7 +67,7 @@
 
         instrumentor.crashAtMethodExit("^XTSATRecoveryManager", "writeParticipantRecoveryRecord");
 
-        execute(false);
+        execute(baseURL, false);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodCalled("prepare");
@@ -253,7 +97,7 @@
 
         instrumentor.crashAtMethodExit(BridgeXAResource.class, "prepare");
 
-        execute(false);
+        execute(baseURL, false);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodCalled("prepare");
@@ -284,7 +128,7 @@
 
         instrumentor.crashAtMethodEntry(BridgeXAResource.class, "commit");
 
-        execute(false);
+        execute(baseURL, false);
 
         instrumentedTestVolatileParticipant.assertKnownInstances(1);
         instrumentedTestVolatileParticipant.assertMethodCalled("prepare");
@@ -307,87 +151,4 @@
         instrumentedTestDurableParticipant.assertMethodCalled("commit");
     }
 
-    /////////////////
-
-    // stolen from CrashRecoveryDelays - should probably just add that to the classpath?
-    // prod the recovery manager via its socket. This avoid any sleep delay.
-    private static void doRecovery() throws InterruptedException
-    {
-        int port = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryPort();
-        String host = recoveryPropertyManager.getRecoveryEnvironmentBean().getRecoveryAddress();
-
-        BufferedReader in = null;
-        PrintStream out = null;
-        Socket sckt = null;
-
-        try
-        {
-            sckt = new Socket(host,port);
-
-            in = new BufferedReader(new InputStreamReader(sckt.getInputStream()));
-            out = new PrintStream(sckt.getOutputStream());
-
-            // Output ping message
-            out.println("SCAN");
-            out.flush();
-
-            // Receive pong message
-            String inMessage = in.readLine();
-
-            if(!inMessage.equals("DONE")) {
-                System.err.println("Recovery failed with message: "+inMessage);
-            }
-        }
-        catch (Exception ex)
-        {
-            ex.printStackTrace();
-        }
-        finally
-        {
-            try {
-                if ( in != null )
-                {
-                    in.close();
-                }
-
-                if ( out != null )
-                {
-                    out.close();
-                }
-
-                sckt.close();
-            } catch(Exception e) {}
-        }
-   }
-
-    // stolen from EmptyObjectStore.java
-    public static void removeContents(File directory)
-    {
-        if ((directory != null) &&
-                directory.isDirectory() &&
-                (!directory.getName().equals("")) &&
-                (!directory.getName().equals("/")) &&
-                (!directory.getName().equals("\\")) &&
-                (!directory.getName().equals(".")) &&
-                (!directory.getName().equals("..")))
-        {
-            File[] contents = directory.listFiles();
-
-            for (int index = 0; index < contents.length; index++)
-            {
-                if (contents[index].isDirectory())
-                {
-                    removeContents(contents[index]);
-
-                    //System.err.println("Deleted: " + contents[index]);
-                    contents[index].delete();
-                }
-                else
-                {
-                    System.err.println("Deleted: " + contents[index]);
-                    contents[index].delete();
-                }
-            }
-        }
-    }
 }



More information about the jboss-svn-commits mailing list