Moves System.setProperty into @Before method of test
diff --git a/org.eclipse.virgo.web.enterprise.persistence.openejb.classloading.hook/src/test/java/org/eclipse/virgo/web/enterprise/persistence/openejb/classloading/hook/AppLoaderClasspathExtenderClassLoadingHookTests.java b/org.eclipse.virgo.web.enterprise.persistence.openejb.classloading.hook/src/test/java/org/eclipse/virgo/web/enterprise/persistence/openejb/classloading/hook/AppLoaderClasspathExtenderClassLoadingHookTests.java
index 8b7589b..82fbe35 100755
--- a/org.eclipse.virgo.web.enterprise.persistence.openejb.classloading.hook/src/test/java/org/eclipse/virgo/web/enterprise/persistence/openejb/classloading/hook/AppLoaderClasspathExtenderClassLoadingHookTests.java
+++ b/org.eclipse.virgo.web.enterprise.persistence.openejb.classloading.hook/src/test/java/org/eclipse/virgo/web/enterprise/persistence/openejb/classloading/hook/AppLoaderClasspathExtenderClassLoadingHookTests.java
@@ -24,6 +24,7 @@
 import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;

 import org.junit.After;

 import org.junit.Assert;

+import org.junit.Before;

 import org.junit.Test;

 

 public class AppLoaderClasspathExtenderClassLoadingHookTests {

@@ -52,6 +53,43 @@
 

     private static final String PERSISTENCE_INTEGRATION_JAR1 = "org.apache.openejb.jpa.integration.jar_v1.1";

 

+    @Before

+    public void setUp() {

+        System.setProperty(PERSISTENCE_INTEGRATION_JAR_PROP_NAME, PERSISTENCE_INTEGRATION_JAR_NAME);

+    }

+

+    @After

+    public void cleanUp() {

+        if (System.getProperty(CONFIG_AREA) != null) {

+            System.getProperties().remove(CONFIG_AREA);

+        }

+        File configDir = new File(new File("."), CONFIGURATION_DIR);

+        if (configDir.exists()) {

+            configDir.delete();

+        }

+

+        File libDir = new File(new File("."), LIB_DIR);

+        File libPersistenceDir = new File(libDir, PERSISTENCE_DIR);

+        File jpaIntegrationFile = new File(libPersistenceDir, PERSISTENCE_INTEGRATION_JAR);

+

+        if (jpaIntegrationFile.exists()) {

+            jpaIntegrationFile.delete();

+        }

+

+        File jpaIntegrationFile1 = new File(libDir, PERSISTENCE_INTEGRATION_JAR1);

+        if (jpaIntegrationFile1.exists()) {

+            jpaIntegrationFile1.delete();

+        }

+

+        if (libPersistenceDir.exists()) {

+            libPersistenceDir.delete();

+        }

+

+        if (libDir.exists()) {

+            libDir.delete();

+        }

+    }

+

     @Test

     public void testAddClassPathEntryPositive() throws IOException {

         File jpaIntegrationFile = prepare();

@@ -127,42 +165,9 @@
         jpaIntegrationFile.createNewFile();

         String configurationFilePath = FILE_SCHEME + configDir.getAbsolutePath();

         System.setProperty(CONFIG_AREA, configurationFilePath);

-        System.setProperty(PERSISTENCE_INTEGRATION_JAR_PROP_NAME, PERSISTENCE_INTEGRATION_JAR_NAME);

         return jpaIntegrationFile;

     }

 

-    @After

-    public void cleanUp() {

-        if (System.getProperty(CONFIG_AREA) != null) {

-            System.getProperties().remove(CONFIG_AREA);

-        }

-        File configDir = new File(new File("."), CONFIGURATION_DIR);

-        if (configDir.exists()) {

-            configDir.delete();

-        }

-

-        File libDir = new File(new File("."), LIB_DIR);

-        File libPersistenceDir = new File(libDir, PERSISTENCE_DIR);

-        File jpaIntegrationFile = new File(libPersistenceDir, PERSISTENCE_INTEGRATION_JAR);

-

-        if (jpaIntegrationFile.exists()) {

-            jpaIntegrationFile.delete();

-        }

-

-        File jpaIntegrationFile1 = new File(libDir, PERSISTENCE_INTEGRATION_JAR1);

-        if (jpaIntegrationFile1.exists()) {

-            jpaIntegrationFile1.delete();

-        }

-

-        if (libPersistenceDir.exists()) {

-            libPersistenceDir.delete();

-        }

-

-        if (libDir.exists()) {

-            libDir.delete();

-        }

-    }

-

     @Test

     public void testShouldAddPositive() {

         boolean result = checkForFile(SOME_FAKE_FILE);