[jboss-cvs] JBossAS SVN: r87736 - in projects/bootstrap/trunk/impl-as/src: main/java/org/jboss/bootstrap/impl/as/server and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 23 15:47:26 EDT 2009
Author: ALRubinger
Date: 2009-04-23 15:47:25 -0400 (Thu, 23 Apr 2009)
New Revision: 87736
Modified:
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializer.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
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/JBossASServerConfig.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java
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/JBossASConfigurationValidationTestCase.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializationTestCase.java
Log:
[JBBOOT-31] Add support for jboss.server.base.url and jboss.server.base.dir
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/BasicJBossASServerConfig.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -73,6 +73,11 @@
*/
private URL bootLibraryLocation;
+ /**
+ * The Location frmo which server homes, by default, decend
+ */
+ private URL serverBaseLocation;
+
//-------------------------------------------------------------------------------||
// Constructor ------------------------------------------------------------------||
//-------------------------------------------------------------------------------||
@@ -152,29 +157,9 @@
// Set
this.jbossHome = jbossHome;
- // Set properties
- this.setPropertyForUrl(PROP_KEY_JBOSSAS_HOME_URL, jbossHome);
- if (jbossHome == null)
- {
- this.setPropertyForString(PROP_KEY_JBOSSAS_HOME, null);
- this.setPropertyForString(PROP_KEY_JBOSSAS_HOME_DIR, null);
- }
- else
- {
- URI jbossHomeUri;
- try
- {
- jbossHomeUri = jbossHome.toURI();
- }
- catch (URISyntaxException e)
- {
- throw new RuntimeException("Error in format of JBOSS_HOME: " + jbossHome, e);
- }
- final File jbossHomeFile = new File(jbossHomeUri);
- final String jbossHomeLocation = jbossHomeFile.getAbsolutePath();
- this.setPropertyForString(PROP_KEY_JBOSSAS_HOME, jbossHomeLocation);
- this.setPropertyForString(PROP_KEY_JBOSSAS_HOME_DIR, jbossHomeLocation);
- }
+ // Set properties
+ this.setPropertyForUrlAndDir(PROP_KEY_JBOSSAS_HOME_URL, PROP_KEY_JBOSSAS_HOME, jbossHome);
+ this.setPropertyForUrlAndDir(PROP_KEY_JBOSSAS_HOME_URL, PROP_KEY_JBOSSAS_HOME_DIR, jbossHome);
// Return
return this.covarientReturn();
@@ -253,4 +238,110 @@
return this.bootLibraryLocation;
}
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#getServerBaseLocation()
+ */
+ public URL getServerBaseLocation()
+ {
+ return this.serverBaseLocation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#serverBaseLocation(java.lang.String)
+ */
+ public JBossASServerConfig serverBaseLocation(String serverBaseLocation) throws IllegalArgumentException
+ {
+ // If null, just pass along
+ if (serverBaseLocation == null)
+ {
+ return this.serverBaseLocation((URL) null);
+ }
+
+ // Convert this String into a URL via File
+ final File file = new File(serverBaseLocation);
+ URL url = null;
+ try
+ {
+ url = file.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Cannot construct URL given: " + serverBaseLocation, e);
+ }
+
+ // Return
+ return this.serverBaseLocation(url);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.config.JBossASServerConfig#serverBaseLocation(java.net.URL)
+ */
+ public JBossASServerConfig serverBaseLocation(URL serverBaseLocation)
+ {
+ // Set
+ this.serverBaseLocation = serverBaseLocation;
+
+ // Set properties
+ this.setPropertyForUrlAndDir(PROP_KEY_JBOSSAS_SERVER_BASE_URL, PROP_KEY_JBOSSAS_SERVER_BASE_DIR,
+ serverBaseLocation);
+
+ // Return
+ return this.covarientReturn();
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Sets the specified URL's value upon the specified URL Property name and
+ * Directory property name, using appropriate syntax for each (ie. URLs use
+ * a protocol, Directories have just an absolute path)
+ *
+ * @param urlPropName
+ * @param dirPropName
+ * @param url
+ * @throws IllegalArgumentException If either the urlPropName or dirPropName are not
+ * specified
+ */
+ private void setPropertyForUrlAndDir(final String urlPropName, final String dirPropName, final URL url)
+ throws IllegalArgumentException
+ {
+ // Precondition checks
+ if (urlPropName == null || urlPropName.length() == 0)
+ {
+ throw new IllegalArgumentException("urlPropName is required");
+ }
+ if (dirPropName == null || dirPropName.length() == 0)
+ {
+ throw new IllegalArgumentException("dirPropName is required");
+ }
+
+ // Set property for the URL
+ this.setPropertyForUrl(urlPropName, url);
+
+ // If null
+ if (url == null)
+ {
+ // Set the dir property to null
+ this.setPropertyForString(dirPropName, null);
+ }
+ // Convert the dir property to strip the protocol, and set
+ else
+ {
+ URI uri;
+ try
+ {
+ uri = url.toURI();
+ }
+ catch (URISyntaxException e)
+ {
+ throw new RuntimeException("Error in format of " + urlPropName + ": + url", e);
+ }
+ final File file = new File(uri);
+ final String location = file.getAbsolutePath();
+ this.setPropertyForString(dirPropName, location);
+ }
+ }
+
}
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializer.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializer.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializer.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -64,8 +64,16 @@
String DEFAULT_VALUE_SERVER_NAME = "default";
/**
- * The suffix used when generating the default value for {@link #PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL},
- * {@link #PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL} and {@link #PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL}.
+ * The suffix used when generating the default value for
+ * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL},
+ * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL} and
+ * {@link #PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL}.
*/
String DEFAULT_VALUE_LIBRARY_URL_SUFFIX = "lib/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_BASE_URL}.
+ */
+ String DEFAULT_VALUE_SERVER_BASE_URL_SUFFIX = "server/";
}
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -109,6 +109,19 @@
}
config.bootLibraryLocation(resolvedBootLibLocation);
+ // ${jboss.server.base.url} / ${jboss.server.base.dir}
+ final URL serverBaseLocation = config.getServerBaseLocation();
+ final String serverBaseDefault = jbossHome + JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_BASE_URL_SUFFIX;
+ final String currentServerBaseLocation = serverBaseLocation != null ? serverBaseLocation.toExternalForm() : null;
+ String resolvedServerBaseLocation = this.resolvePropertyValue(
+ JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL, currentServerBaseLocation, serverBaseDefault,
+ configProps);
+ if (!resolvedServerBaseLocation.endsWith(trailingSlash))
+ {
+ resolvedServerBaseLocation = resolvedServerBaseLocation + trailingSlash;
+ }
+ config.serverBaseLocation(resolvedServerBaseLocation);
+
}
//-------------------------------------------------------------------------------||
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-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -81,6 +81,8 @@
this.require(config.getServerName(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
// jboss.lib.url
this.require(config.getBootLibraryLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL);
+ // jboss.server.base.url
+ this.require(config.getServerBaseLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL);
// Log
log.debug("Configuration is valid: " + config);
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfig.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -86,6 +86,20 @@
*/
String PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL = "jboss.lib.url";
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the base directory for calculating server
+ * home directories.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_BASE_DIR = "jboss.server.base.dir";
+
+ /**
+ * Constant that holds the name of the environment property
+ * for specifying the base URL for calculating server
+ * home URLs.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_BASE_URL = "jboss.server.base.url";
+
//-------------------------------------------------------------------------------||
// Contracts --------------------------------------------------------------------||
//-------------------------------------------------------------------------------||
@@ -176,4 +190,34 @@
* is non-null and cannot be constructed into a URL
*/
JBossASServerConfig bootLibraryLocation(String bootLibraryLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location of the server base, from
+ * which server homes (by default) decend
+ *
+ * @return
+ */
+ URL getServerBaseLocation();
+
+ /**
+ * Sets the location of the server
+ * base, from which server homes (by default)
+ * decend
+ *
+ * @param serverBaseLocation
+ * @return
+ */
+ JBossASServerConfig serverBaseLocation(URL serverBaseLocation);
+
+ /**
+ * Sets the location of the server
+ * base, from which server homes (by default)
+ * decend
+ *
+ * @param serverBaseLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ JBossASServerConfig serverBaseLocation(String serverBaseLocation) throws IllegalArgumentException;
}
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASServerConfigLegacy.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -80,15 +80,8 @@
*/
String PROP_KEY_JBOSSAS_PATCH_URL = "jboss.patch.url";
- /**
- * Constant that holds the name of the environment property
- * for specifying the base directory for calculating server
- * home directories.
- *
- * <p>Defaults to <tt><em>HOME_DIR</em>/server</tt>.
- */
- String PROP_KEY_JBOSSAS_SERVER_BASE_DIR = "jboss.server.base.dir";
+
/**
* Constant that holds the name of the environment property
* for specifying the server home directory for JBoss.
@@ -125,15 +118,6 @@
/**
* Constant that holds the name of the environment property
- * for specifying the base URL for calculating server
- * home URLs.
- *
- * <p>Defaults to <tt><em>HOME_URL</em>/server</tt>.
- */
- String PROP_KEY_JBOSSAS_SERVER_BASE_URL = "jboss.server.base.url";
-
- /**
- * Constant that holds the name of the environment property
* for specifying the server home URL for JBoss.
*
* <p>Defaults to <tt><em>SERVER_BASE_URL</em>/<em>SERVER_NAME</em></tt>.
@@ -234,16 +218,6 @@
String DEFAULT_VALUE_SERVER_CONFIG_URL_SUFFIX = "conf/";
/**
- * The suffix used when generating the default value for {@link #PROP_KEY_JBOSSAS_SERVER_BASE_DIR}.
- */
- String DEFAULT_VALUE_SERVER_BASE_DIR_SUFFIX = "server";
-
- /**
- * The suffix used when generating the default value for {@link #PROP_KEY_JBOSSAS_SERVER_BASE_URL}.
- */
- String DEFAULT_VALUE_SERVER_BASE_URL_SUFFIX = "server/";
-
- /**
* The suffix used when generating the default value for {@link #PROP_KEY_JBOSSAS_SERVER_DATA_DIR}.
*/
String DEFAULT_VALUE_SERVER_DATA_DIR_SUFFIX = "data";
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -102,6 +102,19 @@
final String jbossHomeDir = jbossHomeFile.getAbsolutePath();
final URL bootLibraryUrl = configuration.getBootLibraryLocation();
final String bootLibraryString = bootLibraryUrl == null ? null : bootLibraryUrl.toExternalForm();
+ final URL serverBaseUrl = configuration.getServerBaseLocation();
+ URI serverBaseUri = null;
+ try
+ {
+ serverBaseUri = serverBaseUrl.toURI();
+ }
+ catch (URISyntaxException e1)
+ {
+ throw new RuntimeException("Server Base could not be made into URI, formatting "
+ + "error should have been caught by config validation", e1);
+ }
+ final File serverBaseFile = new File(serverBaseUri);
+ final String serverBaseDir = serverBaseFile.getAbsolutePath();
// Set our system properties
this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_HOME, jbossHomeDir);
@@ -110,6 +123,8 @@
this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS, configuration.getBindAddress());
this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME, configuration.getServerName());
this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL, bootLibraryString);
+ this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL, serverBaseUrl);
+ this.setSystemProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_DIR, serverBaseDir);
}
}
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-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -58,6 +58,22 @@
*/
private static JBossASConfigurationInitializer initializer;
+ /**
+ * JBOSS_HOME for our tests
+ */
+ private static final URL JBOSS_HOME;
+ static
+ {
+ try
+ {
+ JBOSS_HOME = TestUtils.getJBossHome();
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException("Error in test setup creating JBOSS_HOME", t);
+ }
+ }
+
//-------------------------------------------------------------------------------||
// Instance Members -------------------------------------------------------------||
//-------------------------------------------------------------------------------||
@@ -84,9 +100,12 @@
* Creates and sets a new config
*/
@Before
- public void preTest()
+ public void preTest() throws Throwable
{
+ // Create new config
config = new BasicJBossASServerConfig();
+ // Initialize the config, giving it a proper JBOSS_HOME
+ initializer.initialize(config.jbossHome(JBOSS_HOME));
}
/**
@@ -113,9 +132,6 @@
// Log
log.info("testBindAddressDefaultsToLocalhost");
- // Initialize the blank config
- initializer.initialize(config);
-
// Get out the bind address
final String bindAddress = config.getBindAddress();
@@ -137,9 +153,6 @@
// Log
log.info("testServerNameDefaultsToDefault");
- // Initialize the blank config
- initializer.initialize(config);
-
// Get out the server name
final String serverName = config.getServerName();
@@ -152,7 +165,7 @@
}
/**
- * Ensures that jboss.lib.url defaults to $JBOSS_HOME/lib
+ * Ensures that jboss.lib.url defaults to $JBOSS_HOME/lib/
* @throws Throwable
*/
@Test
@@ -161,16 +174,11 @@
// Log
log.info("testBootLibDefault");
- // Initialize the config, giving it a proper jboss home
- final URL jbossHome = TestUtils.getJBossHome();
- config.jbossHome(jbossHome);
- initializer.initialize(config);
-
// Get out the boot library location
final String actual = config.getBootLibraryLocation().toExternalForm();
// Get expected value
- final String expected = jbossHome.toExternalForm()
+ final String expected = JBOSS_HOME.toExternalForm()
+ JBossASConfigurationInitializer.DEFAULT_VALUE_LIBRARY_URL_SUFFIX;
// Test
@@ -178,4 +186,26 @@
log.info("Got expected: " + expected);
}
+ /**
+ * Ensures that the server base defaults to $JBOSS_HOME/server/
+ * @throws Throwable
+ */
+ @Test
+ public void testServerBaseDefault() throws Throwable
+ {
+ // Log
+ log.info("testServerBaseDefault");
+
+ // Get out server base location
+ final String actual = config.getServerBaseLocation().toExternalForm();
+
+ // Get expected value
+ final String expected = JBOSS_HOME.toExternalForm()
+ + JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_BASE_URL_SUFFIX;
+
+ // Test
+ TestCase.assertEquals("Server base location was not defaulted as expected", expected, actual);
+ log.info("Got expected: " + expected);
+ }
+
}
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -311,6 +311,39 @@
TestCase.assertTrue("Validation on no boot library location should have failed", failed);
}
+ /**
+ * Ensures that an empty/null Server Base location fails
+ */
+ @Test
+ public void testServerBaseFails()
+ {
+ // Log
+ log.info("testNoBootLibFails");
+
+ // Initialize
+ boolean failed = false;
+
+ // Get config
+ final JBossASServerConfig config = this.config;
+
+ // Clear out
+ config.serverBaseLocation((URL) null);
+
+ // Validate
+ try
+ {
+ validator.validate(config);
+
+ }
+ catch (InvalidConfigurationException ice)
+ {
+ failed = true;
+ }
+
+ // Test
+ TestCase.assertTrue("Validation on no server base location should have failed", failed);
+ }
+
//-------------------------------------------------------------------------------||
// Internal Helper Methods ------------------------------------------------------||
//-------------------------------------------------------------------------------||
@@ -333,10 +366,11 @@
final String bindAddress = JBossASConfigurationInitializer.DEFAULT_VALUE_BIND_ADDRESS;
final String serverName = JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_NAME;
final String bootLib = jbossHome + JBossASConfigurationInitializer.DEFAULT_VALUE_LIBRARY_URL_SUFFIX;
+ final String serverBase = jbossHome + JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_BASE_URL_SUFFIX;
// Populate
config.jbossHome(jbossHome).bootstrapHome(bootstrapHome).bootstrapName(bootstrapName).bindAddress(bindAddress)
- .serverName(serverName).bootLibraryLocation(bootLib);
+ .serverName(serverName).bootLibraryLocation(bootLib).serverBaseLocation(serverBase);
// Return
return config;
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializationTestCase.java 2009-04-23 17:32:03 UTC (rev 87735)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializationTestCase.java 2009-04-23 19:47:25 UTC (rev 87736)
@@ -122,6 +122,8 @@
final String bindAddressPropKey = JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS;
final String serverNamePropKey = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME;
final String bootLibPropKey = JBossASServerConfig.PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL;
+ final String serverBaseUrlPropKey = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL;
+ final String serverBaseDirPropKey = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_DIR;
// Get Properties from Configuration
final Map<String, String> properties = configuration.getProperties();
@@ -131,6 +133,8 @@
final String bindAddressFromConfProp = properties.get(bindAddressPropKey);
final String serverNameFromConfProp = properties.get(serverNamePropKey);
final String bootLibFromConfProp = properties.get(bootLibPropKey);
+ final String serverBaseUrlFromConfProp = properties.get(serverBaseUrlPropKey);
+ final String serverBaseDirFromConfProp = properties.get(serverBaseDirPropKey);
// Get Properties from System
final String jbossHomeFromSystem = System.getProperty(jbossHomePropKey);
@@ -139,6 +143,8 @@
final String bindAddressFromSystem = System.getProperty(bindAddressPropKey);
final String serverNameFromSystem = System.getProperty(serverNamePropKey);
final String bootLibFromSystem = System.getProperty(bootLibPropKey);
+ final String serverBaseUrlFromSystem = System.getProperty(serverBaseUrlPropKey);
+ final String serverBaseDirFromSystem = System.getProperty(serverBaseDirPropKey);
// Get Expected Values
final URL jbossHomeFromConf = configuration.getJBossHome();
@@ -148,6 +154,10 @@
final String bindAddressFromConf = configuration.getBindAddress();
final String serverNameFromConf = configuration.getServerName();
final String bootLibFromConf = configuration.getBootLibraryLocation().toExternalForm();
+ final URL serverBaseFromConf = configuration.getServerBaseLocation();
+ final File serverBaseFile = new File(serverBaseFromConf.toURI());
+ final String serverBaseUrlFromConf = serverBaseFromConf.toExternalForm();
+ final String serverBaseDirFromConf = serverBaseFile.getAbsolutePath();
// Ensure all equal
TestCase.assertEquals("JBoss Home in configuration must match the config property", jbossHomeDirFromConf,
@@ -174,6 +184,14 @@
bootLibFromConfProp);
TestCase.assertEquals("Boot library location in configuration must match the system property", bootLibFromConf,
bootLibFromSystem);
+ TestCase.assertEquals("Server Base Dir in configuration must match the config property", serverBaseDirFromConf,
+ serverBaseDirFromConfProp);
+ TestCase.assertEquals("Server Base Dir in configuration must match the system property", serverBaseDirFromConf,
+ serverBaseDirFromSystem);
+ TestCase.assertEquals("Server Base URL in configuration must match the config property", serverBaseUrlFromConf,
+ serverBaseUrlFromConfProp);
+ TestCase.assertEquals("Server Base URL in configuration must match the system property", serverBaseUrlFromConf,
+ serverBaseUrlFromSystem);
// Cleanup
server.shutdown();
More information about the jboss-cvs-commits
mailing list