You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2005/01/05 20:56:10 UTC

svn commit: r124261 - /geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.java /geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java

Author: dain
Date: Wed Jan  5 11:56:08 2005
New Revision: 124261

URL: http://svn.apache.org/viewcvs?view=rev&rev=124261
Log:
Commented out test using listRoots as it doesn't work on windows computers cotaining a floppy drive a:. Removed setting of geronimo.base.dir system property as it stops the ability to start two server info objects in the same vm (even if they are started one after the other). Also no one was getting the property anyway.
Modified:
   geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.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/ServerInfo.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.java?view=diff&rev=124261&p1=geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.java&r1=124260&p2=geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.java&r2=124261
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.java	(original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/serverinfo/ServerInfo.java	Wed Jan  5 11:56:08 2005
@@ -74,13 +74,13 @@
         if (!base.isDirectory()) {
             throw new IllegalArgumentException("Base directory is not a directory: " + baseDirectory);
         }
-        System.setProperty("geronimo.base.dir", base.getAbsolutePath());
+        //System.setProperty("geronimo.base.dir", base.getAbsolutePath());
     }
 
     /**
      * Resolves an abstract pathname to an absolute one.
      *
-     * @param filename a pathname that can either be 
+     * @param filename a pathname that can either be
      * fully-qualified (i.e. starts with a "/") or
      * relative (i.e. starts with any character but "/").  If it's
      * fully-qualified it will be resolved to an absolute pathname
@@ -88,7 +88,7 @@
      * it will be resolved relative to the base directory.
      *
      * @return an absolute pathname
-     * 
+     *
      * @see java.io.File#File(String pathname)
      * @see java.io.File#getAbsolutePath()
      */

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?view=diff&rev=124261&p1=geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java&r1=124260&p2=geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/serverinfo/ServerInfoTest.java&r2=124261
==============================================================================
--- 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	Wed Jan  5 11:56:08 2005
@@ -60,34 +60,38 @@
             fail("ServerInfo ctor threw exception " + e);
         }
 
-        try {
-            String basedir = File.listRoots()[0].getAbsolutePath();
-            si = new ServerInfo(basedir);
-            pathArg = "Documents and Settings/Administrator/Application Data/geronimo";
-            assertEquals(new File(basedir, pathArg).getAbsolutePath(), si.resolvePath(pathArg));
-        } catch (Exception e) {
-            fail("ServerInfo ctor threw exception " + e);
-        }
+        //try {
+        //    String basedir = File.listRoots()[0].getAbsolutePath();
+        //    si = new ServerInfo(basedir);
+        //    pathArg = "Documents and Settings/Administrator/Application Data/geronimo";
+        //    assertEquals(new File(basedir, pathArg).getAbsolutePath(), si.resolvePath(pathArg));
+        //} catch (Exception e) {
+        //    fail("ServerInfo ctor threw exception " + e);
+        //}
     }
 
     public final void testServerInfo() throws Exception {
-        File file;
-        try {
-            file = File.createTempFile("geronimo", null);
-            // a workaround - ServerInfo sets system-wide property
-            System.setProperty("geronimo.base.dir", file.getName());
-            new ServerInfo(file.getName());
-            fail("ServerInfo should throw exception when given non-directory path");
-        } catch (IOException ioe) {
-            fail(ioe.getMessage());
-        } catch (Exception expected) {
-        }
+		try {
+			File file;
+			try {
+				file = File.createTempFile("geronimo", null);
+				// a workaround - ServerInfo sets system-wide property
+				System.setProperty("geronimo.base.dir", file.getName());
+				new ServerInfo(file.getName());
+				fail("ServerInfo should throw exception when given non-directory path");
+			} catch (IOException ioe) {
+				fail(ioe.getMessage());
+			} catch (Exception expected) {
+			}
 
-        String basedir = ".";
-        // a workaround - ServerInfo sets system-wide property
-        System.setProperty("geronimo.base.dir", basedir);
-        ServerInfo si = new ServerInfo(basedir);
-        assertNotNull(System.getProperty("geronimo.base.dir"));
-        assertEquals("base directory is incorrect", basedir, si.getBaseDirectory());
+			String basedir = ".";
+			// a workaround - ServerInfo sets system-wide property
+			System.setProperty("geronimo.base.dir", basedir);
+			ServerInfo si = new ServerInfo(basedir);
+			assertNotNull(System.getProperty("geronimo.base.dir"));
+			assertEquals("base directory is incorrect", basedir, si.getBaseDirectory());
+		} finally {
+			System.getProperties().remove("geronimo.base.dir");
+		}
     }
 }