[jboss-cvs] JBossAS SVN: r88582 - in projects/bootstrap/trunk/impl-as/src: test/java/org/jboss/bootstrap/impl/as/config and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun May 10 01:12:25 EDT 2009


Author: ALRubinger
Date: 2009-05-10 01:12:25 -0400 (Sun, 10 May 2009)
New Revision: 88582

Removed:
   projects/bootstrap/trunk/impl-as/src/test/resources/jbossas/server/default/data/
   projects/bootstrap/trunk/impl-as/src/test/resources/jbossas/server/default/log/
   projects/bootstrap/trunk/impl-as/src/test/resources/jbossas/server/default/tmp/
Modified:
   projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java
   projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java
Log:
[JBBOOT-66] Relax checking for existence of tmp, data, native, and log server dirs

Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java	2009-05-10 03:32:07 UTC (rev 88581)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java	2009-05-10 05:12:25 UTC (rev 88582)
@@ -91,21 +91,21 @@
       // jboss.common.lib.url
       this.require(config.getCommonLibLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL);
       // jboss.server.log.dir
-      this.require(config.getServerLogLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR);
+      this.require(config.getServerLogLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR, false);
       // jboss.server.conf.url
       this.require(config.getServerConfLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_CONF_URL);
       // jboss.server.lib.url
       this.require(config.getServerLibLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL);
       // jboss.server.data.dir
-      this.require(config.getServerDataLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_DATA_DIR);
+      this.require(config.getServerDataLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_DATA_DIR, false);
       // jboss.server.tmp.dir
-      this.require(config.getServerTempLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_TEMP_DIR);
+      this.require(config.getServerTempLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_TEMP_DIR, false);
       // jboss.partition.name
       this.require(config.getPartitionName(), JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_NAME);
       // jboss.native.load
       this.require(config.isLoadNative(), JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_LOAD);
-      // jboss.native.load
-      this.require(config.getNativeLibraryLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_DIR);
+      // jboss.native.lib
+      this.require(config.getNativeLibraryLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_DIR, false);
       // jboss.platform.mbeanserver
       this.require(config.isUsePlatformMBeanServer(), JBossASServerConfig.PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER);
 
@@ -160,6 +160,19 @@
     */
    protected void require(final URL arg, final String propertyName) throws InvalidConfigurationException
    {
+      this.require(arg, propertyName, true);
+   }
+
+   /**
+    * Requires that the specified argument is both non-null and, optionally,
+    * pointing to an existent location
+    * 
+    * @throws InvalidConfigurationException If the specified argument is 
+    *   either null or nonexistent
+    */
+   protected void require(final URL arg, final String propertyName, final boolean exists)
+         throws InvalidConfigurationException
+   {
       // If not specified
       if (arg == null)
       {
@@ -168,17 +181,19 @@
       }
 
       // Try to open a connection, to see if exists
-      try
+      if (exists)
       {
-         final URLConnection connection = arg.openConnection();
-         connection.connect();
+         try
+         {
+            final URLConnection connection = arg.openConnection();
+            connection.connect();
+         }
+         catch (IOException ioe)
+         {
+            throw new InvalidConfigurationException("Could not get a connection to the " + propertyName + ": "
+                  + arg.toExternalForm(), ioe);
+         }
       }
-      catch (IOException ioe)
-      {
-         throw new InvalidConfigurationException("Could not get a connection to the " + propertyName + ": "
-               + arg.toExternalForm(), ioe);
-      }
-
    }
 
 }

Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java	2009-05-10 03:32:07 UTC (rev 88581)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java	2009-05-10 05:12:25 UTC (rev 88582)
@@ -296,8 +296,8 @@
       final String expected = this.getServerHomeLocation()
             + JBossASConfigurationInitializer.VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT;
 
-      // Test
-      TestCase.assertEquals("Server log location was not defaulted as expected", expected, actual);
+      // Test, using the trailing slash because the URL location doesn't actually exist
+      TestCase.assertEquals("Server log location was not defaulted as expected", expected, actual + TRAILING_SLASH);
       log.info("Got expected: " + expected);
    }
 
@@ -362,8 +362,8 @@
       final String expected = this.getServerHomeLocation()
             + JBossASConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
 
-      // Test
-      TestCase.assertEquals("Server data location was not defaulted as expected", expected, actual);
+      // Test, using the trailing slash because the URL location doesn't actually exist
+      TestCase.assertEquals("Server data location was not defaulted as expected", expected, actual + TRAILING_SLASH);
       log.info("Got expected: " + expected);
    }
 
@@ -384,8 +384,8 @@
       final String expected = this.getServerHomeLocation()
             + JBossASConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
 
-      // Test
-      TestCase.assertEquals("Server temp location was not defaulted as expected", expected, actual);
+      // Test, using the trailing slash because the URL location doesn't actually exist
+      TestCase.assertEquals("Server temp location was not defaulted as expected", expected, actual + TRAILING_SLASH);
       log.info("Got expected: " + expected);
    }
 
@@ -499,8 +499,8 @@
       final String expected = this.getServerTempLocation()
             + JBossASConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
 
-      // Test 
-      TestCase.assertEquals("Native Lib URL for AS was not defaulted as expected", expected, actual);
+      // Test, using the trailing slash because the URL location doesn't actually exist
+      TestCase.assertEquals("Native Lib URL for AS was not defaulted as expected", expected, actual + TRAILING_SLASH);
       log.info("Got expected: " + expected);
    }
 




More information about the jboss-cvs-commits mailing list