geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r379430 - in /geronimo/trunk/modules/system/src: java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java
Date Tue, 21 Feb 2006 11:36:10 GMT
Author: gdamour
Date: Tue Feb 21 03:36:04 2006
New Revision: 379430

URL: http://svn.apache.org/viewcvs?rev=379430&view=rev
Log:
Fix a regression that I have introduced during my last commit: the setting of org.apache.geronimo.base.dir
was not working as expected.

Modified:
    geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
    geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java

Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java?rev=379430&r1=379429&r2=379430&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/BasicServerInfo.java
Tue Feb 21 03:36:04 2006
@@ -47,11 +47,11 @@
         baseURI = null;
         baseServerURI = null;
     }
-    public BasicServerInfo(String baseDirectory) throws Exception {
+    public BasicServerInfo(String defaultBaseDirectory) throws Exception {
         // Before we try the persistent value, we always check the
         // system properties first.  This lets an admin override this
         // on the command line.
-        this.baseDirectory = System.getProperty(BASE_DIR_SYS_PROP, baseDirectory);
+        this.baseDirectory = System.getProperty(BASE_DIR_SYS_PROP, defaultBaseDirectory);
 
         // force load of server constants
         ServerConstants.getVersion();

Modified: geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java?rev=379430&r1=379429&r2=379430&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java
(original)
+++ geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java
Tue Feb 21 03:36:04 2006
@@ -93,9 +93,7 @@
 			assertNotNull(System.getProperty(BasicServerInfo.BASE_DIR_SYS_PROP));
 			assertEquals("base directory is incorrect", basedir, si.getBaseDirectory());
 		} finally {
-            Properties sysProps = System.getProperties();
-            sysProps.remove(BasicServerInfo.BASE_DIR_SYS_PROP);
-            sysProps.remove(BasicServerInfo.SERVER_DIR_SYS_PROP);
+            resetSysProperties();
 		}
     }
 
@@ -108,13 +106,11 @@
             new BasicServerInfo(basedir.getAbsolutePath());
             assertEquals(serverDir.getAbsolutePath(), System.getProperty(BasicServerInfo.SERVER_DIR_SYS_PROP));
         } finally {
-            Properties sysProps = System.getProperties();
-            sysProps.remove(BasicServerInfo.BASE_DIR_SYS_PROP);
-            sysProps.remove(BasicServerInfo.SERVER_DIR_SYS_PROP);
+            resetSysProperties();
             serverDir.delete();
         }
     }
-    
+
     public void testWithServerDirAbsolute() throws Exception {
         String serverDirName = "./target/serverDir";
         File serverDir = new File(basedir, serverDirName);
@@ -124,13 +120,11 @@
             new BasicServerInfo(basedir.getAbsolutePath());
             assertEquals(serverDir.getAbsolutePath(), System.getProperty(BasicServerInfo.SERVER_DIR_SYS_PROP));
         } finally {
-            Properties sysProps = System.getProperties();
-            sysProps.remove(BasicServerInfo.BASE_DIR_SYS_PROP);
-            sysProps.remove(BasicServerInfo.SERVER_DIR_SYS_PROP);
+            resetSysProperties();
             serverDir.delete();
         }
     }
-    
+
     public void testWithServerDirRelative() throws Exception {
         String serverDirName = "./target/serverDir";
         File serverDir = new File(basedir, serverDirName);
@@ -140,9 +134,14 @@
             new BasicServerInfo(basedir.getAbsolutePath());
             assertEquals(serverDir.getAbsolutePath(), System.getProperty(BasicServerInfo.SERVER_DIR_SYS_PROP));
         } finally {
-            Properties sysProps = System.getProperties();
-            sysProps.remove(BasicServerInfo.BASE_DIR_SYS_PROP);
-            sysProps.remove(BasicServerInfo.SERVER_DIR_SYS_PROP);
+            resetSysProperties();
         }
+    }
+    
+    private void resetSysProperties() {
+        Properties sysProps = System.getProperties();
+        sysProps.remove(BasicServerInfo.BASE_DIR_SYS_PROP);
+        sysProps.remove(BasicServerInfo.SERVER_DIR_SYS_PROP);
+        sysProps.remove(BasicServerInfo.SERVER_NAME_SYS_PROP);
     }
 }



Mime
View raw message