[jboss-cvs] JBossAS SVN: r87759 - 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
Fri Apr 24 01:17:51 EDT 2009
Author: ALRubinger
Date: 2009-04-24 01:17:51 -0400 (Fri, 24 Apr 2009)
New Revision: 87759
Modified:
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationInitializer.java
Log:
[JBBOOT-31] Set bootstrap Home, URL, Conf for impl-as
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-24 04:56:18 UTC (rev 87758)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2009-04-24 05:17:51 UTC (rev 87759)
@@ -74,9 +74,6 @@
// Log
log.debug("Initializing: " + config);
- // Init the super config
- super.initialize(config);
-
// Get the configuration properties
final Map<String, String> configProps = config.getProperties();
@@ -169,6 +166,10 @@
resolvedServerConfLocation = this.adjustToTrailingSlash(resolvedServerConfLocation);
config.serverConfLocation(resolvedServerConfLocation);
+ // Init the super config, must be done after we set jboss.server.conf.url
+ // so that bootstrap configs are set properly
+ super.initialize(config);
+
// ${jboss.server.lib.url}
final URL serverLibLocation = config.getServerLibLocation();
final String serverLibDefault = resolvedServerHomeLocation
@@ -202,12 +203,32 @@
resolvedServerTempLocation = this.adjustToTrailingSlash(resolvedServerTempLocation);
config.serverTempLocation(resolvedServerTempLocation);
+ // Bootstrap Home for AS
+ final String bootstrapName = config.getBootstrapName();
+ assert bootstrapName != null && bootstrapName.length() > 0 : "Bootstrap name is not supplied, perhaps the super impl was not yet initialized?";
+ final String bootstrapHomeDefault = resolvedServerConfLocation + bootstrapName;
+ // Resolve, ignoring the current value
+ String resolvedBootstrapHome = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_BOOTSTRAP_HOME_URL, null,
+ bootstrapHomeDefault, configProps);
+ resolvedBootstrapHome = this.adjustToTrailingSlash(resolvedBootstrapHome);
+ config.bootstrapHome(resolvedBootstrapHome);
+
}
//-------------------------------------------------------------------------------||
// Functional Methods -----------------------------------------------------------||
//-------------------------------------------------------------------------------||
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationInitializer#getDefaultBootstrapHome()
+ */
+ @Override
+ protected URL getDefaultBootstrapHome(JBossASServerConfig config)
+ {
+ // For AS, the bootstrap home is the server conf location
+ return config.getServerConfLocation();
+ }
+
/**
* Returns the value of the specified String, appending a trailing
* slash "/", if not found. Otherwise returns the argument.
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-24 04:56:18 UTC (rev 87758)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java 2009-04-24 05:17:51 UTC (rev 87759)
@@ -27,6 +27,7 @@
import junit.framework.TestCase;
import org.jboss.bootstrap.impl.as.common.TestUtils;
+import org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationInitializer;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Before;
@@ -386,6 +387,76 @@
log.info("Got expected: " + expected);
}
+ /**
+ * Ensures that the default AS Bootstrap Home is set to:
+ * $JBOSS_HOME/server/$serverName/conf
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testBootstrapHomeDefault() throws Throwable
+ {
+ // Log
+ log.info("testBootstrapHomeDefault");
+
+ // Get out the bootstrap Home
+ final String actual = config.getBootstrapHome().toExternalForm();
+
+ // Get expected value
+ final String expected = this.getBootstrapHome();
+
+ // Test
+ TestCase.assertEquals("Bootstrap Home for AS was not defaulted as expected", expected, actual);
+ log.info("Got expected: " + expected);
+ }
+
+ /**
+ * Ensures that the default AS Bootstrap URL is set to:
+ * $JBOSS_HOME/server/$serverName/conf/bootstrap.xml
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testBootstrapUrlDefault() throws Throwable
+ {
+ // Log
+ log.info("testBootstrapUrlDefault");
+
+ // Get out the bootstrap URL
+ final String actual = config.getBootstrapUrl().toExternalForm();
+
+ // Get expected value
+ final String expected = this.getBootstrapHome()
+ + AbstractBasicConfigurationInitializer.DEFAULT_VALUE_BOOTSTRAP_NAME;
+
+ // Test
+ TestCase.assertEquals("Bootstrap URL for AS was not defaulted as expected", expected, actual);
+ log.info("Got expected: " + expected);
+ }
+
+ /**
+ * Ensures that the default AS Bootstrap Conf is set to:
+ * $JBOSS_HOME/server/$serverName/conf
+ *
+ * @throws Throwable
+ */
+ @Test
+ public void testBootstrapConfDefault() throws Throwable
+ {
+ // Log
+ log.info("testBootstrapConfDefault");
+
+ // Get out the bootstrap URL
+ final String actual = config.getBootstrapConfLocation().toExternalForm();
+
+ // Get expected value
+ final String expected = this.getBootstrapHome(); // For AS, the Conf is the home
+
+ // Test
+ TestCase.assertEquals("Bootstrap Conf for AS was not defaulted as expected", expected, actual);
+ log.info("Got expected: " + expected);
+ }
+
//-------------------------------------------------------------------------------||
// Internal Helper Methods ------------------------------------------------------||
//-------------------------------------------------------------------------------||
@@ -398,4 +469,9 @@
return JBOSS_HOME.toExternalForm() + JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_BASE_URL_SUFFIX
+ JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_NAME + TRAILING_SLASH;
}
+
+ private String getBootstrapHome()
+ {
+ return this.getServerHomeLocation() + JBossASConfigurationInitializer.DEFAULT_VALUE_SERVER_CONFIG_URL_SUFFIX;
+ }
}
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationInitializer.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationInitializer.java 2009-04-24 04:56:18 UTC (rev 87758)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationInitializer.java 2009-04-24 05:17:51 UTC (rev 87759)
@@ -178,14 +178,14 @@
// default other properties if necessary
if (name == null || name.length() == 0)
{
- config.bootstrapName(ConfigurationInitializer.DEFAULT_VALUE_BOOTSTRAP_NAME);
+ config.bootstrapName(this.getDefaultBootstrapName(config));
this._initialize(config);
}
// If there's no home, default it, then run this config again
if (home == null)
{
- final URL newHome = SecurityActions.getCodeSourceLocation(this.getClass());
+ final URL newHome = this.getDefaultBootstrapHome(config);
config.bootstrapHome(newHome);
this._initialize(config);
}
@@ -196,6 +196,26 @@
//-------------------------------------------------------------------------------------||
/**
+ * Returns the default bootstrap name
+ * @param config A configuration which may be used in determining the default value
+ * @return
+ */
+ protected String getDefaultBootstrapName(final T config)
+ {
+ return ConfigurationInitializer.DEFAULT_VALUE_BOOTSTRAP_NAME;
+ }
+
+ /**
+ * Returns the default bootstrap home
+ * @param config A configuration which may be used in determining the default value
+ * @return
+ */
+ protected URL getDefaultBootstrapHome(final T config)
+ {
+ return SecurityActions.getCodeSourceLocation(this.getClass());
+ }
+
+ /**
* Sets the values of contracted system properties upon the supplied configuration
*
* @throws IllegalArgumentException If the config was not specified
More information about the jboss-cvs-commits
mailing list