[rhq] Branch 'release/jon3.0.x' - 3 commits - modules/core modules/plugins
by lkrejci
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 7 +++++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java | 2 ++
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit c69f86e8c6d6674db90419751eb4daeaa62eac49
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 3 13:13:18 2012 +0100
[BZ 773661] - Reporting invalid plugin configuration if the resource starts
failing startup after upgrade and after manual add of a resource.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 98310a1..eaee690 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -795,6 +795,7 @@ public class InventoryManager extends AgentService implements ContainerService,
performServiceScan(resource.getId());
if (null != startError) {
+ handleInvalidPluginConfigurationResourceError(resource, startError);
throw new PluginContainerException("The resource [" + resource
+ "] has been added but could not be started. Verify the supplied configuration values: ",
startError);
@@ -1657,7 +1658,7 @@ public class InventoryManager extends AgentService implements ContainerService,
* @param t the exception that indicates the problem with the plugin configuration
* @return true if the error was sent successfully, or false otherwise
*/
- private boolean handleInvalidPluginConfigurationResourceError(Resource resource, Throwable t) {
+ public boolean handleInvalidPluginConfigurationResourceError(Resource resource, Throwable t) {
resource.setConnected(false); // invalid plugin configuration infers the resource component is disconnected
// Give the server-side an error message describing the connection failure that can be
// displayed on the resource's Inventory page.
@@ -2872,4 +2873,4 @@ public class InventoryManager extends AgentService implements ContainerService,
// nothing to do
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
index c32ca97..ffd2065 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
@@ -217,8 +217,10 @@ public class ResourceUpgradeDelegate {
inventoryManager.activateResource(resource, container, true);
} catch (InvalidPluginConfigurationException e) {
log.debug("Resource [" + resource + "] failed to start up after upgrade.", e);
+ inventoryManager.handleInvalidPluginConfigurationResourceError(resource, e);
} catch (Throwable t) {
log.error("Failed to activate the resource [" + resource + "] after upgrade.", t);
+ inventoryManager.handleInvalidPluginConfigurationResourceError(resource, t);
}
}
}
commit c5622ffb62e3f568d01975aa7eba6d1bfee301fe
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 3 13:15:05 2012 +0100
[BZ 773661] - The security exception is thrown directly if the principal is
null but wrapped in another exception if the principal is non-null.
Report both instances as InvalidPluginConfigurationExceptions while
connecting to profile service.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
index 299bdcd..804657c 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
@@ -371,6 +371,7 @@ public class ApplicationServerComponent<T extends ResourceComponent<?>> implemen
this.connection = connectionProvider.connect();
} catch (RuntimeException e) {
Throwable rootCause = ExceptionUtils.getRootCause(e);
+ rootCause = rootCause == null ? e : rootCause;
if (rootCause instanceof SecurityException) {
if (log.isDebugEnabled()) {
log.debug("Failed to connect to Profile Service.", e);
commit 458626ace44e55ebe9c88c00cdacadb6856a8dec
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 3 13:34:21 2012 +0100
[BZ 773661] - Invalid plugin configuration errors are now reported also
during the InventoryManager start up.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 51ad1b7..98310a1 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -2831,8 +2831,10 @@ public class InventoryManager extends AgentService implements ContainerService,
}
} catch (InvalidPluginConfigurationException e) {
log.debug("Failed to activate resource [" + resource + "] due to invalid plugin configuration.", e);
+ handleInvalidPluginConfigurationResourceError(resource, e);
} catch (Throwable t) {
log.error("Exception thrown while activating [" + resource + "].", t);
+ handleInvalidPluginConfigurationResourceError(resource, t);
}
}
}
12 years, 3 months
[rhq] 2 commits - modules/core modules/plugins
by lkrejci
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 3 ++-
modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java | 2 ++
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 9e6d06064faf01d9380fad64c91525e7b228c3bf
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 3 13:15:05 2012 +0100
[BZ 773661] - The security exception is thrown directly if the principal is
null but wrapped in another exception if the principal is non-null.
Report both instances as InvalidPluginConfigurationExceptions while
connecting to profile service.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
index 299bdcd..804657c 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
@@ -371,6 +371,7 @@ public class ApplicationServerComponent<T extends ResourceComponent<?>> implemen
this.connection = connectionProvider.connect();
} catch (RuntimeException e) {
Throwable rootCause = ExceptionUtils.getRootCause(e);
+ rootCause = rootCause == null ? e : rootCause;
if (rootCause instanceof SecurityException) {
if (log.isDebugEnabled()) {
log.debug("Failed to connect to Profile Service.", e);
commit e732f44351125a591582dbd2ee59f983eb7eb300
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 3 13:13:18 2012 +0100
[BZ 773661] - Reporting invalid plugin configuration if the resource starts
failing startup after upgrade and after manual add of a resource.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index ab4ecbc..c39f6f2 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -797,6 +797,7 @@ public class InventoryManager extends AgentService implements ContainerService,
performServiceScan(resource.getId());
if (null != startError) {
+ handleInvalidPluginConfigurationResourceError(resource, startError);
throw new PluginContainerException("The resource [" + resource
+ "] has been added but could not be started. Verify the supplied configuration values: ",
startError);
@@ -1684,7 +1685,7 @@ public class InventoryManager extends AgentService implements ContainerService,
* @param t the exception that indicates the problem with the plugin configuration
* @return true if the error was sent successfully, or false otherwise
*/
- private boolean handleInvalidPluginConfigurationResourceError(Resource resource, Throwable t) {
+ public boolean handleInvalidPluginConfigurationResourceError(Resource resource, Throwable t) {
resource.setConnected(false); // invalid plugin configuration infers the resource component is disconnected
// Give the server-side an error message describing the connection failure that can be
// displayed on the resource's Inventory page.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
index c32ca97..ffd2065 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/upgrade/ResourceUpgradeDelegate.java
@@ -217,8 +217,10 @@ public class ResourceUpgradeDelegate {
inventoryManager.activateResource(resource, container, true);
} catch (InvalidPluginConfigurationException e) {
log.debug("Resource [" + resource + "] failed to start up after upgrade.", e);
+ inventoryManager.handleInvalidPluginConfigurationResourceError(resource, e);
} catch (Throwable t) {
log.error("Failed to activate the resource [" + resource + "] after upgrade.", t);
+ inventoryManager.handleInvalidPluginConfigurationResourceError(resource, t);
}
}
}
12 years, 3 months
[rhq] Changes to 'gwt-logging'
by mike thompson
New branch 'gwt-logging' available with the following commits:
commit 1bcc7b0bb0004c80f06ef3591f6c8e78f1a37426
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Thu Feb 2 08:41:13 2012 -0800
[BZ786184 Remove gwt-log logging mechanism and replace with standard GWT logging] Using Log adapter to make GWT logging look like gwt-log
12 years, 3 months
[rhq] 2 commits - modules/enterprise
by Simeon Pinder
modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java | 193 +++++-----
modules/enterprise/gui/installer-war/src/main/webapp/header.jsp | 8
modules/enterprise/gui/installer-war/src/main/webapp/welcome.jsp | 1
3 files changed, 106 insertions(+), 96 deletions(-)
New commits:
commit 58bf2d23ab26790dcb019e0e0a28530b97c4c2f4
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Feb 2 22:09:23 2012 -0500
[BZ 751447] add plugin pack reminder to installer.
i)Add new i18n property for plugin reminder.
ii)Tweak the header and welcome.jsp files to update to display plugin pack reminder.
diff --git a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java
index 0eca4ba..e9f1511 100644
--- a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java
+++ b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java
@@ -181,6 +181,9 @@ public interface InstallerI18NResourceKeys {
@I18NMessage(locale = "en", value = "${product.name} will be installed!")
String ALREADY_INSTALLED = "alreadyInstalled";
+ @I18NMessage(locale = "en", value = "Note: Remember to install the plugin packs for the ${product.name} server to begin properly monitoring you environment.")
+ String ALREADY_INSTALLED_REMINDER = "alreadyInstalledReminder";
+
@I18NMessage(locale = "en", value = "Done! Click here to get started!")
String ALREADY_INSTALLED_STARTED_LINK = "alreadyInstalledStartedLink";
diff --git a/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp b/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
index 7c04d9d..78a33a9 100644
--- a/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
+++ b/modules/enterprise/gui/installer-war/src/main/webapp/header.jsp
@@ -62,8 +62,14 @@
if (xmlRequest.status == 200 || xmlRequest.status == 401)
{
linkText = "${bundle.alreadyInstalledStartedLink}";
+ reminderText = "${bundle.alreadyInstalledReminder}";
+ productInstalled = "${bundle.alreadyInstalled}";
+ reminderContent ='';
+ if(productInstalled.indexOf("RHQ")==-1){
+ reminderContent = '<br/><br/><b>'+reminderText+'</b><br/>';
+ }
document.getElementById('pleasewait-image').src="/images/finished.gif";
- document.getElementById('progressBarMessage').innerHTML='<a class="small" href="/coregui">' + linkText + '<\/a>';
+ document.getElementById('progressBarMessage').innerHTML='<a class="small" href="/coregui">' + linkText + '<\/a>'+reminderContent;
// this will immediately forward to the start page, uncomment if we want that functionality
// window.location.replace( startPage );
}
diff --git a/modules/enterprise/gui/installer-war/src/main/webapp/welcome.jsp b/modules/enterprise/gui/installer-war/src/main/webapp/welcome.jsp
index dc4e01d..94328ad 100644
--- a/modules/enterprise/gui/installer-war/src/main/webapp/welcome.jsp
+++ b/modules/enterprise/gui/installer-war/src/main/webapp/welcome.jsp
@@ -43,6 +43,7 @@
<br/>
</c:if>
+ <br/><br/>
<hr align="left" style="width: 30%">
<br/>
commit 945da047765c484f75a6c703dfcd410c022877c9
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Feb 2 22:05:49 2012 -0500
[BZ 759137] fix installer to say JBoss ON instead of JON.
diff --git a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java
index 83e5d73..0eca4ba 100644
--- a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java
+++ b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/i18n/InstallerI18NResourceKeys.java
@@ -48,13 +48,13 @@ public interface InstallerI18NResourceKeys {
String PRODUCT_SUPPORT_EMAIL = "product.support.email";
// as we translate our documentation - point to each language's root doc location
- @I18NMessages( { @I18NMessage(locale = "en", value = "${product.help.doc.root}") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "${product.help.doc.root}") })
String HELP_DOC_ROOT = "helpDocRoot";
@I18NMessage(locale = "en", value = "Create Database/User")
String CREATE_DATABASE_USER_TITLE = "createDatabaseUserTitle";
- @I18NMessage(locale = "en", value = "Enter your database administrator's information here and press the button to create a database and user.")
+ @I18NMessage(locale = "en", value = "Enter your database administrator's information here and press the button to create a database and user.")
String CREATE_DATABASE_USER_HELP = "createDatabaseUserHelp";
@I18NMessage(locale = "en", value = "DB Connection URL")
@@ -112,20 +112,20 @@ public interface InstallerI18NResourceKeys {
String SAVE_ERROR = "saveError";
@I18NMessage(locale = "en", value = "Could not connect to the database with the given database settings. \\n\\\n"
- + "Please check the database settings and make sure your database is running.")
+ + "Please check the database settings and make sure your database is running.")
String INVALID_DATABASE_SETTINGS = "invalidDatabaseSettings";
- @I18NMessage(locale = "en", value = "These are the configuration settings for this ${product.shortName} Server installation. \\n\\\n"
- + "You may customize some, all or none as required. Click on the setting name for setting-specific help. Changes to settings marked as \"Restart Required\" \\n\\\n"
- + "will not take effect until after restarting the server. In this case restart the server immediately after successful installation.")
+ @I18NMessage(locale = "en", value = "These are the configuration settings for this ${product.name} Server installation. \\n\\\n"
+ + "You may customize some, all or none as required. Click on the setting name for setting-specific help. Changes to settings marked as \"Restart Required\" \\n\\\n"
+ + "will not take effect until after restarting the server. In this case restart the server immediately after successful installation.")
String SET_PROPERTIES_INSTRUCTIONS = "setPropertiesInstructions";
@I18NMessage(locale = "en", value = "Click this checkbox to see both standard and advanced configuration settings.")
String ADVANCED_SETTINGS_INSTRUCTIONS = "advancedSettingsInstructions";
@I18NMessage(locale = "en", value = "Press the 'Production Installation' button for a normal installation.\\n\\\n"
- + "Press the 'Embedded Installation' button to quickly create a complete environment with the help of the embedded database and embedded agent. "
- + "The embedded installation is for demonstration and evaluation purposes ONLY!")
+ + "Press the 'Embedded Installation' button to quickly create a complete environment with the help of the embedded database and embedded agent. "
+ + "The embedded installation is for demonstration and evaluation purposes ONLY!")
String INSTALL_BUTTONS_TEXT = "installButtonsText";
@I18NMessage(locale = "en", value = "-- or --")
@@ -167,18 +167,18 @@ public interface InstallerI18NResourceKeys {
@I18NMessage(locale = "en", value = "Requires Restart?")
String REQUIRES_RESTART = "requiresRestart";
- @I18NMessage(locale = "en", value = "Welcome to ${product.shortName}!")
+ @I18NMessage(locale = "en", value = "Welcome to ${product.name}!")
String WELCOME_TITLE = "welcomeTitle";
- @I18NMessage(locale = "en", value = "You have reached the ${product.shortName} Installer. Use this page \\n\\\n"
- + "to install and configure the ${product.shortName} Server. \\n\\\n"
- + "Once complete you will be able to log on and use ${product.shortName}.")
+ @I18NMessage(locale = "en", value = "You have reached the ${product.name} Installer. Use this page \\n\\\n"
+ + "to install and configure the ${product.name} Server. \\n\\\n"
+ + "Once complete you will be able to log on and use ${product.name}.")
String WELCOME_MESSAGE = "welcomeMessage";
@I18NMessage(locale = "en", value = "Starting up, please wait...")
String STARTING = "starting";
- @I18NMessage(locale = "en", value = "${product.shortName} will be installed!")
+ @I18NMessage(locale = "en", value = "${product.name} will be installed!")
String ALREADY_INSTALLED = "alreadyInstalled";
@I18NMessage(locale = "en", value = "Done! Click here to get started!")
@@ -231,7 +231,7 @@ public interface InstallerI18NResourceKeys {
@I18NMessage("-ServerBindAddress")
String PROP_SERVER_BIND_ADDRESS_HELP = "propertyBindAddressHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "HTTP Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "HTTP Port") })
String PROP_HTTP_PORT = "propertyHttpPort";
@I18NMessage("-HTTPPort")
String PROP_HTTP_PORT_HELP = "propertyHttpPortHelp";
@@ -241,252 +241,252 @@ public interface InstallerI18NResourceKeys {
@I18NMessage("-SecureHTTPSPort")
String PROP_HTTPS_PORT_HELP = "propertyHttpsPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Web Service Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Web Service Port") })
String PROP_WEB_SERVICE_PORT = "propertyWebServicePort";
@I18NMessage("-WebServicePort")
String PROP_WEB_SERVICE_PORT_HELP = "propertyWebServicePortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Naming Service Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Naming Service Port") })
String PROP_NAMING_SERVICE_PORT = "propertyNamingServicePort";
@I18NMessage("-NamingServicePort")
String PROP_NAMING_SERVICE_PORT_HELP = "propertyNamingServicePortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Naming Service RMI Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Naming Service RMI Port") })
String PROP_NAMING_SERVICE_RMI_PORT = "propertyNamingServiceRmiPort";
@I18NMessage("-NamingServiceRMIPort")
String PROP_NAMING_SERVICE_RMI_PORT_HELP = "propertyNamingServiceRmiPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "JRMP Invoker RMI Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "JRMP Invoker RMI Port") })
String PROP_JRMP_INVOKER_RMI_PORT = "propertyJrmpInvokerRmiPort";
@I18NMessage("-JRMPInvokerRMIPort")
String PROP_JRMP_INVOKER_RMI_PORT_HELP = "propertyJrmpInvokerRmiPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Pooled Invoker RMI Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Pooled Invoker RMI Port") })
String PROP_POOLED_INVOKER_RMI_PORT = "propertyPooledInvokerRmiPort";
@I18NMessage("-PooledInvokerRMIPort")
String PROP_POOLED_INVOKER_RMI_PORT_HELP = "propertyPooledInvokerRmiPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "AJP Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "AJP Port") })
String PROP_AJP_PORT = "propertyAjpPort";
@I18NMessage("-AJPPort")
String PROP_AJP_PORT_HELP = "propertyAjpPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Unified Invoker Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Unified Invoker Port") })
String PROP_UNIFIED_INVOKER_PORT = "propertyUnifiedInvokerPort";
@I18NMessage("-UnifiedInvokerPort")
String PROP_UNIFIED_INVOKER_PORT_HELP = "propertyUnifiedInvokerPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Aspect Deployer Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Aspect Deployer Port") })
String PROP_ASPECT_DEPLOYER_PORT = "propertyAspectDeployerPort";
@I18NMessage("-AspectDeployerPort")
String PROP_ASPECT_DEPLOYER_PORT_HELP = "propertyAspectDeployerPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Client Auth Mode") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Client Auth Mode") })
String PROP_TOMCAT_SECURITY_CLIENT_AUTH_MOD = "propertyTomcatClientAuthMode";
@I18NMessage("-TomcatClientAuthMode")
String PROP_TOMCAT_SECURITY_CLIENT_AUTH_MOD_HELP = "propertyTomcatClientAuthModeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Keystore/Truststore Algorithm") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Keystore/Truststore Algorithm") })
String PROP_TOMCAT_SECURITY_ALGORITHM = "propertyTomcatAlgorithm";
@I18NMessage("-TomcatAlgorithm")
String PROP_TOMCAT_SECURITY_ALGORITHM_HELP = "propertyTomcatAlgorithmHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Keystore") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Keystore") })
String PROP_TOMCAT_SECURITY_KEYSTORE_FILENAME = "propertyTomcatKeystoreFilename";
@I18NMessage("-TomcatKeystore")
String PROP_TOMCAT_SECURITY_KEYSTORE_FILENAME_HELP = "propertyTomcatKeystoreFilenameHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Keystore Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Keystore Password") })
String PROP_TOMCAT_SECURITY_KEYSTORE_PASSWORD = "propertyTomcatKeystorePassword";
@I18NMessage("-TomcatKeystorePassword")
String PROP_TOMCAT_SECURITY_KEYSTORE_PASSWORD_HELP = "propertyTomcatKeystorePasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Keystore Type") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Keystore Type") })
String PROP_TOMCAT_SECURITY_KEYSTORE_TYPE = "propertyTomcatKeystoreType";
@I18NMessage("-TomcatKeystoreType")
String PROP_TOMCAT_SECURITY_KEYSTORE_TYPE_HELP = "propertyTomcatKeystoreTypeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Keystore Alias") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Keystore Alias") })
String PROP_TOMCAT_SECURITY_KEYSTORE_ALIAS = "propertyTomcatKeystoreAlias";
@I18NMessage("-TomcatKeystoreAlias")
String PROP_TOMCAT_SECURITY_KEYSTORE_ALIAS_HELP = "propertyTomcatKeystoreAliasHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Truststore") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Truststore") })
String PROP_TOMCAT_SECURITY_TRUSTSTORE_FILENAME = "propertyTomcatTruststoreFilename";
@I18NMessage("-TomcatTruststore")
String PROP_TOMCAT_SECURITY_TRUSTSTORE_FILENAME_HELP = "propertyTomcatTruststoreFilenameHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Truststore Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Truststore Password") })
String PROP_TOMCAT_SECURITY_TRUSTSTORE_PASSWORD = "propertyTomcatTruststorePassword";
@I18NMessage("-TomcatTruststorePassword")
String PROP_TOMCAT_SECURITY_TRUSTSTORE_PASSWORD_HELP = "propertyTomcatTruststorePasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat Truststore Type") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat Truststore Type") })
String PROP_TOMCAT_SECURITY_TRUSTSTORE_TYPE = "propertyTomcatTruststoreType";
@I18NMessage("-TomcatTruststoreType")
String PROP_TOMCAT_SECURITY_TRUSTSTORE_TYPE_HELP = "propertyTomcatTruststoreTypeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Tomcat SSL Protocol") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Tomcat SSL Protocol") })
String PROP_TOMCAT_SECURITY_SSL_PROTOCOL = "propertyTomcatSslProtocol";
@I18NMessage("-TomcatSSLProtocol")
String PROP_TOMCAT_SECURITY_SSL_PROTOCOL_HELP = "propertyTomcatSslProtocolHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Agent Communications Transport") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Agent Communications Transport") })
String PROP_CONNECTOR_TRANSPORT = "propertyConnectorTransport";
@I18NMessage("-IncomingAgentCommunicationsTransport")
String PROP_CONNECTOR_TRANSPORT_HELP = "propertyConnectorTransportHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Agent Communications Bind Address") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Agent Communications Bind Address") })
String PROP_CONNECTOR_BIND_ADDRESS = "propertyConnectorBindAddress";
@I18NMessage("-IncomingAgentCommunicationsBindAddress")
String PROP_CONNECTOR_BIND_ADDRESS_HELP = "propertyConnectorBindAddressHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Agent Communications Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Agent Communications Port") })
String PROP_CONNECTOR_BIND_PORT = "propertyConnectorBindPort";
@I18NMessage("-IncomingAgentCommunicationsPort")
String PROP_CONNECTOR_BIND_PORT_HELP = "propertyConnectorBindPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Agent Communications Transport Parameters") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Agent Communications Transport Parameters") })
String PROP_CONNECTOR_TRANSPORT_PARAMS = "propertyConnectorTransportParams";
@I18NMessage("-IncomingAgentCommunicationsTransportParameters")
String PROP_CONNECTOR_TRANSPORT_PARAMS_HELP = "propertyConnectorTransportParamsHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Agent Multicast Detector Enabled") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Agent Multicast Detector Enabled") })
String PROP_AGENT_MULTICAST_DETECTOR_ENABLED = "propertyAgentMulticastDetectorEnabled";
@I18NMessage("-AgentMulticastDetectorEnabled")
String PROP_AGENT_MULTICAST_DETECTOR_ENABLED_HELP = "propertyAgentMulticastDetectorEnabledHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Agent Multicast Detector Bind Address") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Agent Multicast Detector Bind Address") })
String PROP_AGENT_MULTICAST_DETECTOR_BIND_ADDRESS = "propertyAgentMulticastDetectorBindAddress";
@I18NMessage("-AgentMulticastDetectorBindAddress")
String PROP_AGENT_MULTICAST_DETECTOR_BIND_ADDRESS_HELP = "propertyAgentMulticastDetectorBindAddressHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Agent Multicast Detector Multicast Address") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Agent Multicast Detector Multicast Address") })
String PROP_AGENT_MULTICAST_DETECTOR_MULTICAST_ADDRESS = "propertyAgentMulticastDetectorMulticastAddress";
@I18NMessage("-AgentMulticastDetectorMulticastAddress")
String PROP_AGENT_MULTICAST_DETECTOR_MULTICAST_ADDRESS_HELP = "propertyAgentMulticastDetectorMulticastAddressHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Agent Multicast Detector Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Agent Multicast Detector Port") })
String PROP_AGENT_MULTICAST_DETECTOR_PORT = "propertyAgentMulticastDetectorPort";
@I18NMessage("-AgentMulticastDetectorPort")
String PROP_AGENT_MULTICAST_DETECTOR_PORT_HELP = "propertyAgentMulticastDetectorPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Secure Socket Protocol") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Secure Socket Protocol") })
String PROP_SECURITY_SERVER_SECURE_SOCKET_PROTOCOL = "propertySecurityServerSecureSocketProtocol";
@I18NMessage("-IncomingSecureSocketProtocol")
String PROP_SECURITY_SERVER_SECURE_SOCKET_PROTOCOL_HELP = "propertySecurityServerSecureSocketProtocolHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Keystore File") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Keystore File") })
String PROP_SECURITY_SERVER_KEYSTORE_FILE = "propertySecurityServerKeystoreFile";
@I18NMessage("-IncomingKeystoreFile")
String PROP_SECURITY_SERVER_KEYSTORE_FILE_HELP = "propertySecurityServerKeystoreFileHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Keystore Algorithm") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Keystore Algorithm") })
String PROP_SECURITY_SERVER_KEYSTORE_ALGORITHM = "propertySecurityServerKeystoreAlgorithm";
@I18NMessage("-IncomingKeystoreAlgorithm")
String PROP_SECURITY_SERVER_KEYSTORE_ALGORITHM_HELP = "propertySecurityServerKeystoreAlgorithmHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Keystore Type") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Keystore Type") })
String PROP_SECURITY_SERVER_KEYSTORE_TYPE = "propertySecurityServerKeystoreType";
@I18NMessage("-IncomingKeystoreType")
String PROP_SECURITY_SERVER_KEYSTORE_TYPE_HELP = "propertySecurityServerKeystoreTypeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Keystore Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Keystore Password") })
String PROP_SECURITY_SERVER_KEYSTORE_PASSWORD = "propertySecurityServerKeystorePassword";
@I18NMessage("-IncomingKeystorePassword")
String PROP_SECURITY_SERVER_KEYSTORE_PASSWORD_HELP = "propertySecurityServerKeystorePasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Keystore Key Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Keystore Key Password") })
String PROP_SECURITY_SERVER_KEYSTORE_KEY_PASSWORD = "propertySecurityServerKeystoreKeyPassword";
@I18NMessage("-IncomingKeystoreKeyPassword")
String PROP_SECURITY_SERVER_KEYSTORE_KEY_PASSWORD_HELP = "propertySecurityServerKeystoreKeyPasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Keystore Alias") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Keystore Alias") })
String PROP_SECURITY_SERVER_KEYSTORE_ALIAS = "propertySecurityServerKeystoreAlias";
@I18NMessage("-IncomingKeystoreAlias")
String PROP_SECURITY_SERVER_KEYSTORE_ALIAS_HELP = "propertySecurityServerKeystoreAliasHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Truststore File") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Truststore File") })
String PROP_SECURITY_SERVER_TRUSTSTORE_FILE = "propertySecurityServerTruststoreFile";
@I18NMessage("-IncomingTruststoreFile")
String PROP_SECURITY_SERVER_TRUSTSTORE_FILE_HELP = "propertySecurityServerTruststoreFileHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Truststore Algorithm") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Truststore Algorithm") })
String PROP_SECURITY_SERVER_TRUSTSTORE_ALGORITHM = "propertySecurityServerTruststoreAlgorithm";
@I18NMessage("-IncomingTruststoreAlgorithm")
String PROP_SECURITY_SERVER_TRUSTSTORE_ALGORITHM_HELP = "propertySecurityServerTruststoreAlgorithmHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Truststore Type") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Truststore Type") })
String PROP_SECURITY_SERVER_TRUSTSTORE_TYPE = "propertySecurityServerTruststoreType";
@I18NMessage("-IncomingTruststoreType")
String PROP_SECURITY_SERVER_TRUSTSTORE_TYPE_HELP = "propertySecurityServerTruststoreTypeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Truststore Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Truststore Password") })
String PROP_SECURITY_SERVER_TRUSTSTORE_PASSWORD = "propertySecurityServerTruststorePassword";
@I18NMessage("-IncomingTruststorePassword")
String PROP_SECURITY_SERVER_TRUSTSTORE_PASSWORD_HELP = "propertySecurityServerTruststorePasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Incoming Security - Client Authentication Mode") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Incoming Security - Client Authentication Mode") })
String PROP_SECURITY_SERVER_CLIENT_AUTH_MODE = "propertySecurityServerClientAuthMode";
@I18NMessage("-IncomingClientAuthenticationMode")
String PROP_SECURITY_SERVER_CLIENT_AUTH_MODE_HELP = "propertySecurityServerClientAuthModeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Secure Socket Protocol") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Secure Socket Protocol") })
String PROP_SECURITY_CLIENT_SECURE_SOCKET_PROTOCOL = "propertySecurityClientSecureSocketProtocol";
@I18NMessage("-OutgoingSecureSocketProtocol")
String PROP_SECURITY_CLIENT_SECURE_SOCKET_PROTOCOL_HELP = "propertySecurityClientSecureSocketProtocolHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Keystore File") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Keystore File") })
String PROP_SECURITY_CLIENT_KEYSTORE_FILE = "propertySecurityClientKeystoreFile";
@I18NMessage("-OutgoingKeystoreFile")
String PROP_SECURITY_CLIENT_KEYSTORE_FILE_HELP = "propertySecurityClientKeystoreFileHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Algorithm") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Algorithm") })
String PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM = "propertySecurityClientKeystoreAlgorithm";
@I18NMessage("-OutgoingKeystoreAlgorithm")
String PROP_SECURITY_CLIENT_KEYSTORE_ALGORITHM_HELP = "propertySecurityClientKeystoreAlgorithmHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Type") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Type") })
String PROP_SECURITY_CLIENT_KEYSTORE_TYPE = "propertySecurityClientKeystoreType";
@I18NMessage("-OutgoingKeystoreType")
String PROP_SECURITY_CLIENT_KEYSTORE_TYPE_HELP = "propertySecurityClientKeystoreTypeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Password") })
String PROP_SECURITY_CLIENT_KEYSTORE_PASSWORD = "propertySecurityClientKeystorePassword";
@I18NMessage("-OutgoingKeystorePassword")
String PROP_SECURITY_CLIENT_KEYSTORE_PASSWORD_HELP = "propertySecurityClientKeystorePasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Key Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Key Password") })
String PROP_SECURITY_CLIENT_KEYSTORE_KEY_PASSWORD = "propertySecurityClientKeystoreKeyPassword";
@I18NMessage("-OutgoingKeystoreKeyPassword")
String PROP_SECURITY_CLIENT_KEYSTORE_KEY_PASSWORD_HELP = "propertySecurityClientKeystoreKeyPasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Alias") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Keystore Alias") })
String PROP_SECURITY_CLIENT_KEYSTORE_ALIAS = "propertySecurityClientKeystoreAlias";
@I18NMessage("-OutgoingKeystoreAlias")
String PROP_SECURITY_CLIENT_KEYSTORE_ALIAS_HELP = "propertySecurityClientKeystoreAliasHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Truststore File") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Truststore File") })
String PROP_SECURITY_CLIENT_TRUSTSTORE_FILE = "propertySecurityClientTruststoreFile";
@I18NMessage("-OutgoingTruststoreFile")
String PROP_SECURITY_CLIENT_TRUSTSTORE_FILE_HELP = "propertySecurityClientTruststoreFileHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Truststore Algorithm") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Truststore Algorithm") })
String PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM = "propertySecurityClientTruststoreAlgorithm";
@I18NMessage("-OutgoingTruststoreAlgorithm")
String PROP_SECURITY_CLIENT_TRUSTSTORE_ALGORITHM_HELP = "propertySecurityClientTruststoreAlgorithmHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Truststore Type") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Truststore Type") })
String PROP_SECURITY_CLIENT_TRUSTSTORE_TYPE = "propertySecurityClientTruststoreType";
@I18NMessage("-OutgoingTruststoreType")
String PROP_SECURITY_CLIENT_TRUSTSTORE_TYPE_HELP = "propertySecurityClientTruststoreTypeHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Truststore Password") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Truststore Password") })
String PROP_SECURITY_CLIENT_TRUSTSTORE_PASSWORD = "propertySecurityClientTruststorePassword";
@I18NMessage("-OutgoingTruststorePassword")
String PROP_SECURITY_CLIENT_TRUSTSTORE_PASSWORD_HELP = "propertySecurityClientTruststorePasswordHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Outgoing Security - Server Authentication Mode Enabled") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Outgoing Security - Server Authentication Mode Enabled") })
String PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED = "propertySecurityClientServerAuthModeEnabled";
@I18NMessage("-OutgoingServerAuthenticationModeEnabled")
String PROP_SECURITY_CLIENT_SERVER_AUTH_MODE_ENABLED_HELP = "propertySecurityClientServerAuthModeEnabledHelp";
@@ -501,12 +501,12 @@ public interface InstallerI18NResourceKeys {
@I18NMessage("-EmbeddedRHQAgentName")
String PROP_EMBEDDED_RHQ_AGENT_NAME_HELP = "propertyEmbeddedRHQAgentNameHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Embedded Agent Disable Native System") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Embedded Agent Disable Native System") })
String PROP_EMBEDDED_RHQ_AGENT_DISABLE_NATIVE_SYSTEM = "propertyEmbeddedRHQAgentDisableNativeSystem";
@I18NMessage("-EmbeddedRHQAgentDisableNativeSystem")
String PROP_EMBEDDED_RHQ_AGENT_DISABLE_NATIVE_SYSTEM_HELP = "propertyEmbeddedRHQAgentDisableNativeSystemHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Embedded Agent Reset Configuration") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Embedded Agent Reset Configuration") })
String PROP_EMBEDDED_RHQ_AGENT_RESET_CONFIGURATION = "propertyEmbeddedRHQAgentResetConfiguration";
@I18NMessage("-EmbeddedRHQAgentResetConfiguration")
String PROP_EMBEDDED_RHQ_AGENT_RESET_CONFIGURATION_HELP = "propertyEmbeddedRHQAgentResetConfigurationHelp";
@@ -516,7 +516,7 @@ public interface InstallerI18NResourceKeys {
@I18NMessage("-EmailSMTPHostname")
String PROP_EMAIL_SMTP_HOST_HELP = "propertyEmailSmtpHostHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Email SMTP Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Email SMTP Port") })
String PROP_EMAIL_SMTP_PORT = "propertyEmailSmtpPort";
@I18NMessage("-EmailSMTPPort")
String PROP_EMAIL_SMTP_PORT_HELP = "propertyEmailSmtpPortHelp";
@@ -526,144 +526,144 @@ public interface InstallerI18NResourceKeys {
@I18NMessage("-EmailFromAddress")
String PROP_EMAIL_FROM_ADDRESS_HELP = "propertyEmailFromAddressHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Operation Invocation Default Timeout") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Operation Invocation Default Timeout") })
String PROP_OPERATION_TIMEOUT = "propertyOperationTimeout";
@I18NMessage("-OperationInvocationDefaultTimeout")
String PROP_OPERATION_TIMEOUT_HELP = "propertyOperationTimeoutHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition Name") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition Name") })
String PROP_CLUSTER_PARTITION_NAME = "propertyClusterPartitionName";
@I18NMessage("-PartitionName")
String PROP_CLUSTER_PARTITION_NAME_HELP = "propertyClusterPartitionNameHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition Bind Address") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition Bind Address") })
String PROP_CLUSTER_PARTITION_BIND_ADDRESS = "propertyClusterPartitionBindAddress";
@I18NMessage("-PartitionBindAddress")
String PROP_CLUSTER_PARTITION_BIND_ADDRESS_HELP = "propertyClusterPartitionBindAddressHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition UDP Multicast Group IP Address") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition UDP Multicast Group IP Address") })
String PROP_CLUSTER_UDP_GROUP = "propertyClusterUdpGroup";
@I18NMessage("-PartitionUDPMulticastGroupIPAddress")
String PROP_CLUSTER_UDP_GROUP_HELP = "propertyClusterUdpGroupHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition UDP Multicast Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition UDP Multicast Port") })
String PROP_CLUSTER_HAPARTITION_PORT = "propertyClusterHaPartitionPort";
@I18NMessage("-PartitionUDPMulticastPort")
String PROP_CLUSTER_HAPARTITION_PORT_HELP = "propertyClusterHaPartitionPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition UDP EJB3 Entity Cache Multicast Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition UDP EJB3 Entity Cache Multicast Port") })
String PROP_CLUSTER_EJB3CACHE_PORT = "propertyClusterEjb3CachePort";
@I18NMessage("-PartitionUDPEJB3EntityCacheMulticastPort")
String PROP_CLUSTER_EJB3CACHE_PORT_HELP = "propertyClusterEjb3CachePortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition UDP Alert Cache Multicast Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition UDP Alert Cache Multicast Port") })
String PROP_CLUSTER_ALERTCACHE_PORT = "propertyClusterAlertCachePort";
@I18NMessage("-PartitionUDPAlertCacheMulticastPort")
String PROP_CLUSTER_ALERTCACHE_PORT_HELP = "propertyClusterAlertCachePortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - Partition UDP Loopback") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - Partition UDP Loopback") })
String PROP_CLUSTER_UDP_LOOPBACK = "propertyClusterUdpLoopback";
@I18NMessage("-PartitionUDPLoopback")
String PROP_CLUSTER_UDP_LOOPBACK_HELP = "propertyClusterUdpLoopbackHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - HA JNDI Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - HA JNDI Port") })
String PROP_CLUSTER_HAJNDI_PORT = "propertyClusterHaJndiPort";
@I18NMessage("-HAJNDIPort")
String PROP_CLUSTER_HAJNDI_PORT_HELP = "propertyClusterHaJndiPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - HA JNDI RMI Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - HA JNDI RMI Port") })
String PROP_CLUSTER_HAJNDI_RMIPORT = "propertyClusterHaJndiRmiPort";
@I18NMessage("-HAJNDIRMIPort")
String PROP_CLUSTER_HAJNDI_RMIPORT_HELP = "propertyClusterHaJndiRmiPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - HA JNDI Auto Discovery Group Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - HA JNDI Auto Discovery Group Port") })
String PROP_CLUSTER_HAJNDI_AUTODISCOVERPORT = "propertyClusterHaJndiAutoDiscoveryPort";
@I18NMessage("-HAJNDIAutoDiscoveryGroupPort")
String PROP_CLUSTER_HAJNDI_AUTODISCOVERPORT_HELP = "propertyClusterHaJndiAutoDiscoveryPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - HA JRMP Invoker RMI Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - HA JRMP Invoker RMI Port") })
String PROP_CLUSTER_HAJRMPINVOKER_RMIPORT = "propertyClusterHaJrmpInvokerRmiPort";
@I18NMessage("-HAJRMPInvokerRMIPort")
String PROP_CLUSTER_HAJRMPINVOKER_RMIPORT_HELP = "propertyClusterHaJrmpInvokerRmiPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - HA Pooled Invoker Port") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - HA Pooled Invoker Port") })
String PROP_CLUSTER_HAPOOLEDINVOKER_PORT = "propertyClusterHaPooledInvokerPort";
@I18NMessage("-HAPooledInvokerPort")
String PROP_CLUSTER_HAPOOLEDINVOKER_PORT_HELP = "propertyClusterHaPooledInvokerPortHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Cluster - JGroups UDP IP Time To Live") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Cluster - JGroups UDP IP Time To Live") })
String PROP_CLUSTER_JGROUPS_UDP_IP_TTL = "propertyClusterJGroupsUdpIpTtl";
@I18NMessage("-JGroupsUDPIPTimeToLive")
String PROP_CLUSTER_JGROUPS_UDP_IP_TTL_HELP = "propertyClusterJGroupsUdpIpTtlHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Maximum Web Connections") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Maximum Web Connections") })
String PROP_CONCURRENCY_LIMIT_WEBCONNS = "propertyConcurrencyLimitWebConns";
@I18NMessage("-WebConnections")
String PROP_CONCURRENCY_LIMIT_WEBCONNS_HELP = "propertyConcurrencyLimitWebConnsHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Global") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Global") })
String PROP_CONCURRENCY_LIMIT_GLOBAL = "propertyConcurrencyLimitGlobal";
@I18NMessage("-GlobalConcurrencyLimit")
String PROP_CONCURRENCY_LIMIT_GLOBAL_HELP = "propertyConcurrencyLimitGlobalHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Inventory Reports") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Inventory Reports") })
String PROP_CONCURRENCY_LIMIT_INV_REPORT = "propertyConcurrencyLimitInventoryReport";
@I18NMessage("-InventoryReport")
String PROP_CONCURRENCY_LIMIT_INV_REPORT_HELP = "propertyConcurrencyLimitInventoryReportHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Availability Reports") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Availability Reports") })
String PROP_CONCURRENCY_LIMIT_AVAIL_REPORT = "propertyConcurrencyLimitAvailabilityReport";
@I18NMessage("-AvailabilityReport")
String PROP_CONCURRENCY_LIMIT_AVAIL_REPORT_HELP = "propertyConcurrencyLimitAvailabilityReportHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Inventory Synchronizations") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Inventory Synchronizations") })
String PROP_CONCURRENCY_LIMIT_INV_SYNC = "propertyConcurrencyLimitInventorySync";
@I18NMessage("-InventorySynchronization")
String PROP_CONCURRENCY_LIMIT_INV_SYNC_HELP = "propertyConcurrencyLimitInventorySyncHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Content Reports") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Content Reports") })
String PROP_CONCURRENCY_LIMIT_CONTENT_REPORT = "propertyConcurrencyLimitContentReport";
@I18NMessage("-ContentReport")
String PROP_CONCURRENCY_LIMIT_CONTENT_REPORT_HELP = "propertyConcurrencyLimitContentReportHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Content Downloads") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Content Downloads") })
String PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD = "propertyConcurrencyLimitContentDownload";
@I18NMessage("-ContentDownload")
String PROP_CONCURRENCY_LIMIT_CONTENT_DOWNLOAD_HELP = "propertyConcurrencyLimitContentDownloadHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Measurement Reports") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Measurement Reports") })
String PROP_CONCURRENCY_LIMIT_MEAS_REPORT = "propertyConcurrencyLimitMeasurementReport";
@I18NMessage("-MeasurementReport")
String PROP_CONCURRENCY_LIMIT_MEAS_REPORT_HELP = "propertyConcurrencyLimitMeasurementReportHelp";
- @I18NMessages( { @I18NMessage(locale = "en", value = "Concurrency Limit - Measurement Schedule Requests") })
+ @I18NMessages({ @I18NMessage(locale = "en", value = "Concurrency Limit - Measurement Schedule Requests") })
String PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ = "propertyConcurrencyLimitMeasurementScheduleRequest";
@I18NMessage("-MeasurementScheduleRequest")
String PROP_CONCURRENCY_LIMIT_MEASSCHED_REQ_HELP = "propertyConcurrencyLimitMeasurementScheduleRequestHelp";
// Help Documentation - links to the wiki
- @I18NMessage(locale = "en", value = "Please review the documentation linked below to learn more about ${product.shortName}:")
+ @I18NMessage(locale = "en", value = "Please review the documentation linked below to learn more about ${product.name}:")
String INTRODUCE_HELP_DOCS = "introduceHelpDocs";
@I18NMessage("${product.help.installation}")
String HELP_DOC_RHQ_SERVER_INSTALL_GUIDE = "helpDocRHQServerInstallGuide";
- @I18NMessage(locale = "en", value = "${product.shortName} Server Installation Guide")
+ @I18NMessage(locale = "en", value = "${product.name} Server Installation Guide")
String HELP_DOC_RHQ_SERVER_INSTALL_GUIDE_LABEL = "helpDocRHQServerInstallGuideLabel";
@I18NMessage("GUI+Console+Users+Guide")
String HELP_DOC_RHQ_GUI_CONSOLE_USERS_GUIDE = "helpDocRHQGuiConsoleUsersGuide";
- @I18NMessage(locale = "en", value = "${product.shortName} GUI Console Users Guide")
+ @I18NMessage(locale = "en", value = "${product.name} GUI Console Users Guide")
String HELP_DOC_RHQ_GUI_CONSOLE_USERS_GUIDE_LABEL = "helpDocRHQGuiConsoleUsersGuideLabel";
@I18NMessage("${product.help.guide.server}")
String HELP_DOC_RHQ_SERVER_USERS_GUIDE = "helpDocRHQServerUsersGuide";
- @I18NMessage(locale = "en", value = "${product.shortName} Server Users Guide")
+ @I18NMessage(locale = "en", value = "${product.name} Server Users Guide")
String HELP_DOC_RHQ_SERVER_USERS_GUIDE_LABEL = "helpDocRHQServerUsersGuideLabel";
@I18NMessage("${product.help.guide.agent}")
String HELP_DOC_RHQ_AGENT_USERS_GUIDE = "helpDocRHQAgentUsersGuide";
- @I18NMessage(locale = "en", value = "${product.shortName} Agent Users Guide")
+ @I18NMessage(locale = "en", value = "${product.name} Agent Users Guide")
String HELP_DOC_RHQ_AGENT_USERS_GUIDE_LABEL = "helpDocRHQAgentUsersGuideLabel";
@I18NMessage("${product.help.FAQ}")
12 years, 3 months
[rhq] modules/core
by ips
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 4ef5591636537a6f19fa15433482e6d84aacd833
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Feb 2 17:45:12 2012 -0500
[BZ 786980] avoid potential ConcurrentModificationException for Resource.childResources Set
(https://bugzilla.redhat.com/show_bug.cgi?id=786980)
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 3d30b83..ab4ecbc 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1860,7 +1860,10 @@ public class InventoryManager extends AgentService implements ContainerService,
try {
ResourceContainer container = getResourceContainer(resource);
if ((container != null) && (container.getResourceComponentState() == ResourceComponentState.STARTED)) {
- for (Resource child : resource.getChildResources()) {
+ // Copy child Resources to an array and iterate that, rather than iterating the Set, which could cause
+ // a ConcurrentModificationException if another thread tries to modify the Set while we're iterating it.
+ Resource[] childResources = resource.getChildResources().toArray(new Resource[resource.getChildResources().size()]);
+ for (Resource child : childResources) {
deactivateResource(child);
}
12 years, 3 months
[rhq] Branch 'jshaughn/avail' - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/PingRequest.java | 19 -
modules/core/dbutils/pom.xml | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 13
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 144 ++++++----
modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/ClientCommandSender.java | 16 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 8
6 files changed, 129 insertions(+), 73 deletions(-)
New commits:
commit e76a89b5b670e1a40e237b933b9118e1e4b0dc1d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Feb 2 17:34:20 2012 -0500
- Make PingRequest pass agent name as opposed to agent id, which we don't have
- Make PingRequest Serializable so it can be passed between agent and server
- fix schema version to be 2.119
- Fix PluginContainer.addShutdownListener to not immediately invoke the listener
if the PC is down.
- Leaving the updated listeners in PluginContainer because they are a little
more robust, but change strategy around calling the new PC listeners. It's
not really necessary as it turns out. Instead:
* ping from Agent start to agent stop. This gives us clock sync at all times
* ping avail update is only performed when the PC is up, but that can
be determined by a quick call to the PC instance.
* use polling only when we need to determine sendning mode
- start polling at agent start
- stop polling in ping if in sending mode, then just ping
- resume polling if ping fails
In other words, poll when we're not pinging.
- Added the ping thread and ping runnable
- Add method to determine if sender is currently polling
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/PingRequest.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/PingRequest.java
index a19fd9a..10f2f61 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/PingRequest.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/PingRequest.java
@@ -20,24 +20,29 @@
package org.rhq.core.clientapi.server.core;
+import java.io.Serializable;
+
/**
* A simple POJO for requesting actions or data from the ping.
*
* @author Jay Shaughnessy
*/
-public class PingRequest {
- private int agentId;
+public class PingRequest implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String agentName;
private boolean requestUpdateAvailability;
private boolean requestServerTimestamp;
private boolean replyUpdateAvailability;
private Long replyServerTimestamp;
- public PingRequest(int agentId) {
- this(agentId, true, true);
+ public PingRequest(String agentName) {
+ this(agentName, true, true);
}
- public PingRequest(int agentId, boolean requestUpdateAvailability, boolean requestServerTimestamp) {
+ public PingRequest(String agentName, boolean requestUpdateAvailability, boolean requestServerTimestamp) {
+ this.agentName = agentName;
this.requestUpdateAvailability = requestUpdateAvailability;
this.requestServerTimestamp = requestServerTimestamp;
}
@@ -54,8 +59,8 @@ public class PingRequest {
return replyUpdateAvailability;
}
- public int getAgentId() {
- return agentId;
+ public String getAgentName() {
+ return agentName;
}
public void setReplyUpdateAvailability(boolean replyUpdateAvailability) {
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index c18ffe1..29b1f2e 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -15,7 +15,7 @@
<description>Database schema setup, upgrade and other utilities</description>
<properties>
- <db.schema.version>2.118</db.schema.version>
+ <db.schema.version>2.119</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
<rhq.ds.connection-url>${rhq.test.ds.connection-url}</rhq.ds.connection-url>
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 768450b..140e3fd 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -75,8 +75,8 @@ import org.rhq.core.pluginapi.util.FileUtils;
* {@link #setConfiguration(PluginContainerConfiguration)}. If this is not done, a default configuration will be
* created.</p>
*
- * @author Greg Hinkle
* @author John Mazzitelli
+ * @author Greg Hinkle
*/
public class PluginContainer implements ContainerService {
private static final PluginContainer INSTANCE = new PluginContainer();
@@ -661,6 +661,7 @@ public class PluginContainer implements ContainerService {
/**
* Add the callback listener to notify when the plugin container is initialized. If this method is invoked and
* the PC is already initialized, then <code>listener</code> will be invoked immediately.
+ *
* @param name associated with the listener
* @param listener The callback object to notify. If a listener with the supplied name is registered, it
* will be replaced with the newly supplied listner.
@@ -676,8 +677,10 @@ public class PluginContainer implements ContainerService {
}
/**
- * Add the callback listener to notify when the plugin container is shutdown. If this method is invoked and
- * the PC is already shutdown, then <code>listener</code> will be invoked immediately.
+ * Add the callback listener to notify when the plugin container is shutdown. Unlike
+ * {@link #addInitializationListener(String, InitializationListener)} the <code>listener</code> will
+ * not be invoked immediately if the PC is already shutdown. It will only be invoked on future shutdowns.
+ *
* @param name associated with the listener
* @param listener The callback object to notify. If a listener with the supplied name is registered, it
* will be replaced with the newly supplied listner.
@@ -685,10 +688,6 @@ public class PluginContainer implements ContainerService {
public void addShutdownListener(String name, ShutdownListener listener) {
synchronized (shutdownListenersLock) {
shutdownListeners.put(name, listener);
-
- if (!started) {
- listener.shutdown();
- }
}
}
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 928e38e..8536de2 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -48,6 +48,7 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -81,6 +82,7 @@ import org.rhq.core.clientapi.server.core.AgentVersion;
import org.rhq.core.clientapi.server.core.ConnectAgentRequest;
import org.rhq.core.clientapi.server.core.ConnectAgentResults;
import org.rhq.core.clientapi.server.core.CoreServerService;
+import org.rhq.core.clientapi.server.core.PingRequest;
import org.rhq.core.clientapi.server.discovery.DiscoveryServerService;
import org.rhq.core.clientapi.server.drift.DriftServerService;
import org.rhq.core.clientapi.server.event.EventServerService;
@@ -95,6 +97,7 @@ import org.rhq.core.pc.RebootRequestListener;
import org.rhq.core.pc.ServerServices;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.plugin.FileSystemPluginFinder;
+import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.system.SystemInfoFactory;
import org.rhq.core.util.ObjectNameFactory;
import org.rhq.core.util.exception.ThrowableUtil;
@@ -150,11 +153,7 @@ import org.rhq.enterprise.communications.command.client.ClientRemotePojoFactory;
import org.rhq.enterprise.communications.command.client.CommandPreprocessor;
import org.rhq.enterprise.communications.command.client.JBossRemotingRemoteCommunicator;
import org.rhq.enterprise.communications.command.client.OutgoingCommandTrace;
-import org.rhq.enterprise.communications.command.client.PollingListener;
import org.rhq.enterprise.communications.command.client.RemoteCommunicator;
-import org.rhq.enterprise.communications.command.impl.identify.Identification;
-import org.rhq.enterprise.communications.command.impl.identify.IdentifyCommand;
-import org.rhq.enterprise.communications.command.impl.identify.IdentifyCommandResponse;
import org.rhq.enterprise.communications.command.impl.remotepojo.RemotePojoInvocationCommand;
import org.rhq.enterprise.communications.command.server.CommandListener;
import org.rhq.enterprise.communications.command.server.IncomingCommandTrace;
@@ -190,6 +189,11 @@ public class AgentMain {
*/
private static final String JAVA_UTIL_LOGGING_PROPERTIES_RESOURCE_PATH = "java.util.logging.properties";
+ // Ensure only one instance of the ping job runs by using a pool size of 1
+ private static final String PING_THREAD_POOL_NAME = "RHQ Agent Ping Thread";
+ private static final int PING_THREAD_POOL_CORE_POOL_SIZE = 1;
+ private static final long PING_INTERVAL_MINIMUM = 60000L;
+
static final String PROMPT_INPUT_THREAD_NAME = "RHQ Agent Prompt Input Thread";
/**
@@ -373,9 +377,14 @@ public class AgentMain {
private boolean m_disableNativeSystem;
/**
+ * Thread used to repeatedly ping the server for connectivity, agent avail update, and clock sync
+ */
+ private ScheduledThreadPoolExecutor m_pingThreadPoolExecutor;
+
+ /**
* Tracks whether we already logged a warning to let the user know SIGAR support isn't available.
*/
- private boolean loggedNativeSystemInfoUnavailableWarning;
+ private boolean m_loggedNativeSystemInfoUnavailableWarning;
/**
* The main method that starts the whole thing.
@@ -488,6 +497,7 @@ public class AgentMain {
m_serverFailoverList = null;
m_primaryServerSwitchoverThread = null;
m_vmHealthCheckThread = null;
+ m_pingThreadPoolExecutor = null;
if (args == null) {
args = new String[0];
@@ -656,6 +666,15 @@ public class AgentMain {
// now that our plugin container has been initialized, it can begin to receive incoming commands
latch.allowAllCommands(m_commServices);
+ // Now that we are allowing commands to be passed back and forth with the server and
+ // the PC is likely up, start our Ping service
+ m_pingThreadPoolExecutor = new ScheduledThreadPoolExecutor(PING_THREAD_POOL_CORE_POOL_SIZE,
+ new LoggingThreadFactory(PING_THREAD_POOL_NAME, true));
+ long pingInterval = m_configuration.getClientSenderServerPollingInterval();
+ pingInterval = (pingInterval < PING_INTERVAL_MINIMUM) ? PING_INTERVAL_MINIMUM : pingInterval;
+ m_pingThreadPoolExecutor.scheduleWithFixedDelay(new PingExecutor(), 0L, pingInterval,
+ TimeUnit.MILLISECONDS);
+
// prepare our shutdown hook
m_shutdownHook = new AgentShutdownHook(this);
Runtime.getRuntime().addShutdownHook(m_shutdownHook);
@@ -710,6 +729,18 @@ public class AgentMain {
// We want to keep going to ensure we attempt to try to shutdown everything.
///////
+ // stop the thread that pings the server
+ try {
+ if (null != m_pingThreadPoolExecutor) {
+ m_pingThreadPoolExecutor.shutdownNow();
+ m_pingThreadPoolExecutor = null;
+ }
+ } catch (Throwable ignore) {
+ LOG.warn(AgentI18NResourceKeys.FAILED_TO_SHUTDOWN_COMPONENT, "Server Ping Thread",
+ ThrowableUtil.getAllMessages(ignore));
+ }
+
+ ///////
// stop the thread that checks the VM health
try {
if (m_vmHealthCheckThread != null) {
@@ -2233,20 +2264,20 @@ public class AgentMain {
SystemInfoFactory.disableNativeSystemInfo();
LOG.info(AgentI18NResourceKeys.NATIVE_SYSTEM_DISABLED);
}
- this.loggedNativeSystemInfoUnavailableWarning = false;
+ this.m_loggedNativeSystemInfoUnavailableWarning = false;
} else {
if (!SystemInfoFactory.isNativeSystemInfoAvailable()) {
- if (!this.loggedNativeSystemInfoUnavailableWarning) {
+ if (!this.m_loggedNativeSystemInfoUnavailableWarning) {
Throwable t = SystemInfoFactory.getNativeLibraryLoadThrowable();
if (LOG.isDebugEnabled()) {
LOG.debug(AgentI18NResourceKeys.NATIVE_SYSINFO_UNAVAILABLE_DEBUG, t);
} else {
LOG.warn(AgentI18NResourceKeys.NATIVE_SYSINFO_UNAVAILABLE);
}
- this.loggedNativeSystemInfoUnavailableWarning = true;
+ this.m_loggedNativeSystemInfoUnavailableWarning = true;
}
} else {
- this.loggedNativeSystemInfoUnavailableWarning = false;
+ this.m_loggedNativeSystemInfoUnavailableWarning = false;
}
}
@@ -2287,32 +2318,21 @@ public class AgentMain {
// initialize and start the server-side services so we can process incoming commands
m_commServices.start(m_configuration.getPreferences(), m_configuration.getClientCommandSenderConfiguration());
- // TODO: I think this can removed altogether. We don't want to do polling at the comm layer
- // for server detection because we are now pinging the server at a higher level. If that ping (or any
- // server service fails) the sender status will be set to down. The higher level ping is now used
- // for agent avail, clock sync, and server status checking.
-
// prime the sender so it can be prepared to start sending messages.
- // if auto-discovery is enabled, then the auto-discovery listener will tell the sender when its OK to start sending.
- // if polling is enabled, then we start polling now - the poller will tell the sender when its OK to start sending.
- // if both auto-discovery and polling is enabled, at least one of them will tell the sender when its OK to start sending.
- // if neither is enabled, we have to blindly tell the sender that its OK to start sending now.
- //if (m_configuration.getClientSenderServerPollingInterval() <= 0) {
- // if (m_autoDiscoveryListener == null) {
- // LOG.info(AgentI18NResourceKeys.NO_AUTO_DETECT);
- // m_clientSender.startSending();
- // }
- //} else {
- // m_clientSender.startServerPolling();
- //
- // // must do this after we start polling, otherwise, the listener is never really added
- // ClockCheckPollingListener clockCheckPollingListener = new ClockCheckPollingListener();
- // m_clientSender.addPollingListener(clockCheckPollingListener);
- //}
+ // if auto-discovery is enabled, then the auto-discovery listener will tell the sender when its OK to start
+ // sending. Otherwise start polling and let the poller tell the sender when it is ok to start sending.
+ if (!isAutoDiscoveryEnabled()) {
+ LOG.info(AgentI18NResourceKeys.NO_AUTO_DETECT);
+ m_clientSender.startServerPolling();
+ }
return;
}
+ private boolean isAutoDiscoveryEnabled() {
+ return m_autoDiscoveryListener != null;
+ }
+
/**
* This will prepare the auto-discovery listener, if server auto-detection is enabled.
*
@@ -3418,24 +3438,6 @@ public class AgentMain {
}
/**
- * Listener that is told about the results of all server polls (if polling is enabled).
- * Because we know the poll thread uses the {@link IdentifyCommand}, this listener will
- * simply use the results of that command to track our synchronicity with the server clock.
- */
- private class ClockCheckPollingListener implements PollingListener {
- public void pollResponse(CommandResponse response) {
- if (response instanceof IdentifyCommandResponse && response.isSuccessful()) {
- IdentifyCommandResponse id_response = (IdentifyCommandResponse) response;
- Identification id = id_response.getIdentification();
- if (id != null) {
- AgentMain.this.serverClockNotification(id.getTimestamp());
- }
- }
- return;
- }
- }
-
- /**
* Listener that will register the agent as soon as the sender has started (which means we should be able to connect
* to the RHQ Server and send the register command).
*/
@@ -3644,4 +3646,50 @@ public class AgentMain {
return this.serverEndpoint + "@" + new Date(this.timestamp);
}
}
+
+ private class PingExecutor implements Runnable {
+
+ @Override
+ public void run() {
+ try {
+ // if we can't send to the server ignore the ping
+ if (!m_clientSender.isSending()) {
+ // An unlikely state, but if we're not sending, not polling and not performing autoDiscovery
+ // (multicast), then start polling to we eventually get out of this state.
+ if (!(m_clientSender.isServerPolling() || isAutoDiscoveryEnabled())) {
+ LOG.info("Starting polling to determine sender status");
+ m_clientSender.startServerPolling();
+ }
+
+ return;
+ }
+
+ // we are in sending mode, so make sure the poller is off
+ if (m_clientSender.isServerPolling()) {
+ LOG.info("Stopping polling and resuming pinging");
+ m_clientSender.stopServerPolling();
+ }
+
+ boolean updateAvail = PluginContainer.getInstance().isStarted();
+ PingRequest request = new PingRequest(getConfiguration().getAgentName(), updateAvail, true);
+
+ ClientRemotePojoFactory factory = m_clientSender.getClientRemotePojoFactory();
+ CoreServerService server = factory.getRemotePojo(CoreServerService.class);
+ request = server.ping(request);
+
+ // take this opportunity to check the agent-server clock sync
+ serverClockNotification(request.getReplyServerTimestamp());
+
+ } catch (Throwable t) {
+ // If the ping fails, typically do to a CannotConnectException, and we're not using autodiscovery,
+ // then start the poller to have sending mode re-established when the connection resumes.
+ if (!(m_clientSender.isServerPolling() || isAutoDiscoveryEnabled())) {
+ LOG.info("Starting polling to determine sender status", t);
+ m_clientSender.startServerPolling();
+ } else {
+ LOG.warn("Server Ping failed", t);
+ }
+ }
+ }
+ }
}
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/ClientCommandSender.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/ClientCommandSender.java
index ed9f20f..745f755 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/ClientCommandSender.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/ClientCommandSender.java
@@ -228,8 +228,8 @@ public class ClientCommandSender {
public ClientCommandSender(RemoteCommunicator remote_communicator, ClientCommandSenderConfiguration config)
throws IllegalArgumentException {
if (remote_communicator == null) {
- throw new IllegalArgumentException(LOG
- .getMsgString(CommI18NResourceKeys.CLIENT_COMMAND_SENDER_NULL_REMOTE_COMM));
+ throw new IllegalArgumentException(
+ LOG.getMsgString(CommI18NResourceKeys.CLIENT_COMMAND_SENDER_NULL_REMOTE_COMM));
}
if (config == null) {
@@ -384,8 +384,8 @@ public class ClientCommandSender {
*/
public void setRemoteCommunicator(RemoteCommunicator remote_communicator) throws IllegalArgumentException {
if (remote_communicator == null) {
- throw new IllegalArgumentException(LOG
- .getMsgString(CommI18NResourceKeys.CLIENT_COMMAND_SENDER_NULL_REMOTE_COMM));
+ throw new IllegalArgumentException(
+ LOG.getMsgString(CommI18NResourceKeys.CLIENT_COMMAND_SENDER_NULL_REMOTE_COMM));
}
// we don't need to synchronize on this. As per JLS, section 17.7:
@@ -768,6 +768,10 @@ public class ClientCommandSender {
return;
}
+ public boolean isServerPolling() {
+ return (null != m_serverPollingThread);
+ }
+
public void addPollingListener(PollingListener listener) {
ServerPollingThread thread = m_serverPollingThread;
if (thread != null) {
@@ -1159,8 +1163,8 @@ public class ClientCommandSender {
sendAsynch(cnc.getCommand(), cnc.getCallback());
}
} catch (Exception e) {
- LOG.error(e, CommI18NResourceKeys.CLIENT_COMMAND_SENDER_RETRY_FAILURE, m_remoteCommunicator, cnc
- .getCommand());
+ LOG.error(e, CommI18NResourceKeys.CLIENT_COMMAND_SENDER_RETRY_FAILURE, m_remoteCommunicator,
+ cnc.getCommand());
} finally {
m_shuttingDownTasksLock.readLock().unlock();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
index 5dc7b93..8cfaf4e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
@@ -561,7 +561,7 @@ public class AgentManagerBean implements AgentManagerLocal {
long now = System.currentTimeMillis();
if (request.isRequestUpdateAvailability()) {
- updateLastAvailabilityPing(request.getAgentId(), now);
+ updateLastAvailabilityPing(request.getAgentName(), now);
request.setReplyUpdateAvailability(true);
}
@@ -572,7 +572,7 @@ public class AgentManagerBean implements AgentManagerLocal {
return request;
}
- private void updateLastAvailabilityPing(int agentId, long now) {
+ private void updateLastAvailabilityPing(String agentName, long now) {
/*
* since we already know we have to update the agent row with the last avail ping time, might as well
* set the backfilled to false here (as opposed to called agentManager.setBackfilled(agentId, false)
@@ -580,11 +580,11 @@ public class AgentManagerBean implements AgentManagerLocal {
String updateStatement = "" //
+ "UPDATE Agent " //
+ " SET lastAvailabilityPing = :now, backFilled = FALSE " //
- + " WHERE id = :agentId ";
+ + " WHERE name = :agentName ";
Query query = entityManager.createQuery(updateStatement);
query.setParameter("now", now);
- query.setParameter("agentId", agentId);
+ query.setParameter("agentName", agentName);
query.executeUpdate();
}
12 years, 3 months
[rhq] modules/core
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 19 +++++++---
1 file changed, 14 insertions(+), 5 deletions(-)
New commits:
commit f819631220c83f1ae8874953035e60720e61cff4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 2 13:32:01 2012 -0500
[BZ 768706] add some more code to make sure we do proper error correction/checking
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index fc5be1c..3d30b83 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -1463,6 +1463,7 @@ public class InventoryManager extends AgentService implements ContainerService,
// state is a transient field, so reinitialize it just in case this is invoked just after loadFromDisk()
if (state == null) {
container.setResourceComponentState(ResourceComponentState.STOPPED);
+ state = ResourceComponentState.STOPPED;
}
// if the component exists and is not stopped then we may not have to do anything
@@ -1589,11 +1590,19 @@ public class InventoryManager extends AgentService implements ContainerService,
if (prepareResourceForActivation(resource, container, updatedPluginConfig)) {
container.setResourceComponentState(ResourceComponentState.STARTING);
- ResourceContext context = container.getResourceContext();
+ ResourceContext context;
+ ResourceComponent component;
- // Wrap the component in a proxy that will provide locking and a timeout for the call to start().
- ResourceComponent component = container.createResourceComponentProxy(ResourceComponent.class,
- FacetLockType.READ, COMPONENT_START_TIMEOUT, true, false);
+ try {
+ context = container.getResourceContext();
+
+ // Wrap the component in a proxy that will provide locking and a timeout for the call to start().
+ component = container.createResourceComponentProxy(ResourceComponent.class, FacetLockType.READ,
+ COMPONENT_START_TIMEOUT, true, false);
+ } catch (Throwable t) {
+ container.setResourceComponentState(ResourceComponentState.STOPPED);
+ throw new PluginContainerException("Failed getting proxy for resource " + resource + ".", t);
+ }
try {
component.start(context);
@@ -2889,4 +2898,4 @@ public class InventoryManager extends AgentService implements ContainerService,
// nothing to do
}
}
-}
\ No newline at end of file
+}
12 years, 3 months
[rhq] modules/core
by lkrejci
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 3ac2a05f042d3137bb0003a086d0e69556e3bea5
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 2 20:35:11 2012 +0100
[BZ 773661] - Invalid plugin configuration errors are now reported also
during the InventoryManager start up.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 2afe7f0..fc5be1c 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -2848,9 +2848,10 @@ public class InventoryManager extends AgentService implements ContainerService,
}
} catch (InvalidPluginConfigurationException e) {
log.debug("Failed to activate resource [" + resource + "] due to invalid plugin configuration.", e);
-
+ handleInvalidPluginConfigurationResourceError(resource, e);
} catch (Throwable t) {
log.error("Exception thrown while activating [" + resource + "].", t);
+ handleInvalidPluginConfigurationResourceError(resource, t);
}
}
}
12 years, 3 months
[rhq] Branch 'release/jon3.0.x' - 2 commits - modules/common modules/core modules/plugins
by mazz
modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java | 25 -
modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java | 72 ++++
modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java | 135 +++++++-
modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java | 98 +++++-
modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java | 49 +--
modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java | 77 ++++-
modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java | 152 +++++++++-
modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml | 16 +
8 files changed, 540 insertions(+), 84 deletions(-)
New commits:
commit 9eebf13c055908a1afd357ff4e507052190fb890
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 2 08:45:39 2012 -0500
[BZ 784124] forgot to fix this test
Due to the conflict here, I also pulled in BZ 751027 (commit d1e85ac2ef91f4578861f139bbc248603fea782e)
This BZ was simply to make sure the test only runs on RH flavors, not just any old Linux.
Conflicts:
modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
diff --git a/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java b/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
index 1df24d6..bd2d35d 100644
--- a/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
+++ b/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
@@ -59,6 +59,7 @@ import org.rhq.core.util.updater.FileHashcodeMap;
public class AntLauncherTest {
private static final File DEPLOY_DIR = new File("target/test-ant-bundle").getAbsoluteFile();
private static final String ANT_BASEDIR = "target/test-classes";
+ private static final File REDHAT_RELEASE_FILE = new File("/etc/redhat-release");
private int deploymentId;
@@ -107,12 +108,13 @@ public class AntLauncherTest {
public void testInstall() throws Exception {
- if (skipNonLinux("testInstall")) return;
+ if (skipNonRHLinux("testInstall"))
+ return;
// We want to test a fresh install, so make sure the deploy dir doesn't pre-exist.
FileUtil.purge(DEPLOY_DIR, true);
- // but we do want to add an unrelated file to see that it remains untouched - the install just "goes around" it
+ // but we do want to add an unrelated file to see that it goes away - since we have manageRootDir=true
File unrelatedFile = writeFile("unrelated content", DEPLOY_DIR, "unrelated-file.txt");
AntLauncher ant = new AntLauncher();
@@ -156,16 +158,16 @@ public class AntLauncherTest {
assert new File(DEPLOY_DIR, "subdir/test.properties").exists() : "missing file";
assert new File(DEPLOY_DIR, "archived-bundle-file.txt").exists() : "missing archived bundle file";
assert new File(DEPLOY_DIR, "archived-subdir/archived-file-in-subdir.properties").exists() : "missing subdir archive file";
- assert unrelatedFile.exists() : "unrelated file was removed during the install";
+ assert !unrelatedFile.exists() : "unrelated file was not removed during the install";
assert readPropsFile(new File(DEPLOY_DIR, "subdir/test.properties")).getProperty("junk.listener.port").equals(
"10000");
assert readPropsFile(new File(DEPLOY_DIR, "archived-subdir/archived-file-in-subdir.properties")).getProperty(
"templatized.variable").equals("10000");
}
- private boolean skipNonLinux(String meth) {
- if (!System.getProperty("os.name").equals("Linux")) {
- System.out.println("Skipping " + meth + "() as this only works on Linux");
+ private boolean skipNonRHLinux(String meth) {
+ if (!System.getProperty("os.name").equals("Linux") || !REDHAT_RELEASE_FILE.exists()) {
+ System.out.println("Skipping " + meth + "() as this only works on Red Hat Linux flavors");
return true;
}
return false;
@@ -174,10 +176,10 @@ public class AntLauncherTest {
@Test(dependsOnMethods = "testInstall")
public void testUpgrade() throws Exception {
- if (skipNonLinux("testUpgrade")) return;
+ if (skipNonRHLinux("testUpgrade"))
+ return;
- // We want to test an upgrade, so do *not* wipe out the deploy dir - our test method @dependsOnMethods testInstall
- // but we do want to add an unrelated file to see that it gets deleted as part of the upgrade
+ // add an unrelated file to see that it gets deleted as part of the upgrade
File unrelatedFile = writeFile("unrelated content", DEPLOY_DIR, "unrelated-file.txt");
AntLauncher ant = new AntLauncher();
@@ -230,14 +232,15 @@ public class AntLauncherTest {
public void testUpgradeNoManageRootDir() throws Exception {
- if (skipNonLinux("testInstall")) return;
+ if (skipNonRHLinux("testInstall"))
+ return;
// We want to test an upgrade, so do *not* wipe out the deploy dir - let's re-invoke testInstall
// to get us to an initial state of the v1 bundle installed
testInstall();
// we still want the unrelated file - we want to see that manageRootDir=false works (unrelated files should not be deleted)
- File unrelatedFile = new File(DEPLOY_DIR, "unrelated-file.txt");
+ File unrelatedFile = writeFile("unrelated content", DEPLOY_DIR, "unrelated-file.txt");
assert unrelatedFile.exists() : "our initial install test method should have prepared an unmanaged file";
AntLauncher ant = new AntLauncher();
commit 43ba87eadc086fe9da031584620168f1f04d9ec1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Jan 26 17:19:43 2012 -0500
[BZ 784124] fix the issue where, on initial deployment of a bundle, we didn't clean out any files that happen to be in the deployment dir.
we need to remove them, they are in the way. we do back them up so they can be manually retrieved if the user screwed up.
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java b/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
index c4ac737..9135279 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
@@ -33,6 +33,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.ArrayList;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
@@ -102,6 +103,77 @@ public class FileUtil {
StreamUtil.copy(is, os);
}
+ public static void copyDirectory(File inDir, File outDir) throws IOException {
+ if (inDir.exists()) {
+ if (!inDir.isDirectory()) {
+ throw new IOException("Source directory [" + inDir + "] is not a directory");
+ }
+ } else {
+ throw new FileNotFoundException("Source directory [" + inDir + "] does not exist");
+ }
+
+ if (!outDir.mkdirs()) {
+ throw new IOException("Destination directory [" + outDir + "] failed to be created");
+ }
+
+ if (!canWrite(outDir)) {
+ throw new IOException("Cannot write to destination directory [" + outDir + "]");
+ }
+
+ // TODO do we care to restore the last mod time on the destination dir?
+ //outDir.setLastModified(inDir.lastModified());
+
+ File[] files = inDir.listFiles();
+ if (files == null) {
+ throw new IOException("Failed to get the list of files in source directory [" + inDir + "]");
+ }
+ for (File file : files) {
+ File copiedFile = new File(outDir, file.getName());
+ if (file.isDirectory()) {
+ copyDirectory(file, copiedFile);
+ } else {
+ copyFile(file, copiedFile);
+ }
+ }
+
+ files = null; // help GC
+ return;
+ }
+
+ /**
+ * Obtains the list of all files in the given directory and, recursively, all its subdirectories.
+ * Note that the returns list is only regular files - directory names are NOT in the list. Also,
+ * the names in the list are relative to the given directory.
+ * @param directory the directory whose files are to be returned
+ * @return list of files in the directory, not sorted in any particular order
+ * @throws IOException if directory does not exist or is not a directory
+ */
+ public static List<File> getDirectoryFiles(File directory) throws IOException {
+ ArrayList<File> files = new ArrayList<File>();
+ if (!directory.isDirectory()) {
+ throw new IOException("[" + directory + "] is not an existing directory");
+ }
+ getDirectoryFilesRecursive(directory, files, null);
+ return files;
+ }
+
+ private static void getDirectoryFilesRecursive(File directory, List<File> files, String relativeTo)
+ throws IOException {
+ File[] children = directory.listFiles();
+ if (children == null) {
+ throw new IOException("Cannot obtain files from directory [" + directory + "]");
+ }
+ for (File child : children) {
+ if (child.isDirectory()) {
+ getDirectoryFilesRecursive(child, files, ((relativeTo == null) ? "" : relativeTo) + child.getName()
+ + File.separatorChar);
+ } else {
+ files.add(new File(relativeTo, child.getName()));
+ }
+ }
+ return;
+ }
+
/**
* Copy a stream, using a buffer.
* @deprecated use {@link StreamUtil} for more methods like this - those are unit tested and used more
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
index 652bcda..40ce727 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/updater/Deployer.java
@@ -28,6 +28,8 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -301,9 +303,9 @@ public class Deployer {
return;
}
- debug("Estimated disk usage for this deployment is [", usage.getDiskUsage(), "] bytes (file count=[", usage
- .getFileCount(), "]). The maximum disk space currently usable is estimated to be [", usage
- .getMaxDiskUsable(), "] bytes.");
+ debug("Estimated disk usage for this deployment is [", usage.getDiskUsage(), "] bytes (file count=[",
+ usage.getFileCount(), "]). The maximum disk space currently usable is estimated to be [",
+ usage.getMaxDiskUsable(), "] bytes.");
if (usage.getDiskUsage() > usage.getMaxDiskUsable()) {
throw new Exception(
@@ -316,6 +318,31 @@ public class Deployer {
}
private FileHashcodeMap performInitialDeployment(DeployDifferences diff, boolean dryRun) throws Exception {
+ // If we are to fully manage the deployment dir, then we need to delete everything we find here.
+ // Any old files do not belong here - only our bundle files should live here now.
+ if (this.deploymentData.isManageRootDir()) {
+ File destDir = this.deploymentData.getDestinationDir();
+ log.info(buildLogMessage("Will be managing the deploy dir[", destDir,
+ "]; backing up and purging any obsolete content existing in there"));
+ if (destDir.isDirectory()) {
+ int deploymentId = this.deploymentData.getDeploymentProps().getDeploymentId();
+ backupFiles(diff, deploymentId, destDir, dryRun, null, true);
+ if (!dryRun) {
+ // we want to purge everything that is originally in here, but we backed up the files in here
+ // so make sure we don't delete our metadata directory, which is where the backed up files are
+ File[] doomedFiles = destDir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return !DeploymentsMetadata.METADATA_DIR.equals(name);
+ }
+ });
+ for (File doomedFile : doomedFiles) {
+ FileUtil.purge(doomedFile, true);
+ }
+ }
+ }
+ }
+
FileHashcodeMap newFileHashcodeMap = extractZipAndRawFiles(new HashMap<String, String>(0), diff, dryRun);
// this is an initial deployment, so we know every file is new - tell our diff about them all
@@ -340,8 +367,8 @@ public class Deployer {
// * if a current file is backed up
FileHashcodeMap original = this.deploymentsMetadata.getCurrentDeploymentFileHashcodes();
- ChangesFileHashcodeMap current = original.rescan(this.deploymentData.getDestinationDir(), this.deploymentData
- .getIgnoreRegex(), this.deploymentData.isManageRootDir());
+ ChangesFileHashcodeMap current = original.rescan(this.deploymentData.getDestinationDir(),
+ this.deploymentData.getIgnoreRegex(), this.deploymentData.isManageRootDir());
FileHashcodeMap newFiles = getNewDeploymentFileHashcodeMap();
if (current.getUnknownContent() != null) {
@@ -457,7 +484,8 @@ public class Deployer {
int backupDeploymentId = props.getDeploymentId();
debug("Backing up files as part of update deployment. dryRun=", dryRun);
for (String fileToBackupPath : currentFilesToBackup) {
- backupFile(diff, backupDeploymentId, fileToBackupPath, dryRun);
+ boolean toBeDeleted = currentFilesToDelete.remove(fileToBackupPath);
+ backupFile(diff, backupDeploymentId, fileToBackupPath, dryRun, toBeDeleted);
}
}
@@ -503,8 +531,8 @@ public class Deployer {
return newFileHashCodeMap;
}
- private void backupFile(DeployDifferences diff, int deploymentId, final String fileToBackupPath, boolean dryRun)
- throws Exception {
+ private void backupFile(DeployDifferences diff, int deploymentId, final String fileToBackupPath, boolean dryRun,
+ boolean removeFileToBackup) throws Exception {
File bakFile;
@@ -536,8 +564,8 @@ public class Deployer {
String destDirDriveLetter = FileUtil.stripDriveLetter(destDirAbsPathBuilder);
if (destDirDriveLetter == null || driveLetter.equals(destDirDriveLetter)) {
bakFile = new File(backupDir, fileToBackupPath);
- fileToBackup = new File(this.deploymentData.getDestinationDir(), fileToBackupPathNoDriveLetter
- .toString());
+ fileToBackup = new File(this.deploymentData.getDestinationDir(),
+ fileToBackupPathNoDriveLetter.toString());
} else {
throw new Exception("Cannot backup relative path [" + fileToBackupPath
+ "] whose drive letter is different than the destination directory ["
@@ -549,20 +577,77 @@ public class Deployer {
}
}
+ boolean deleted = false; // will be true if we were told to delete the file and we actually did delete it
+
if (!dryRun) {
bakFile.getParentFile().mkdirs();
- FileUtil.copyFile(fileToBackup, bakFile);
+ // try to do a rename first if we are to remove the file, since this is more likely
+ // much faster and more efficient.
+ // if it fails (perhaps because we are crossing file systems), try a true copy
+ if (removeFileToBackup) {
+ boolean movedSuccessfully = fileToBackup.renameTo(bakFile);
+ if (movedSuccessfully) {
+ deleted = true;
+ } else {
+ FileUtil.copyFile(fileToBackup, bakFile);
+ deleted = fileToBackup.delete();
+ if (deleted == false) {
+ // TODO: what should we do? is it a major failure if we can't remove files here?
+ debug("Failed to delete file [", fileToBackup, "] but it is backed up");
+ if (diff != null) {
+ diff.addError(fileToBackupPath, "File [" + fileToBackup.getAbsolutePath()
+ + "] did not delete");
+ }
+ }
+ }
+ } else {
+ FileUtil.copyFile(fileToBackup, bakFile);
+ }
+ } else {
+ deleted = removeFileToBackup; // this is a dry run, pretend we deleted it if we were asked to
}
debug("Backed up file [", fileToBackup, "] to [", bakFile, "]. dryRun=", dryRun);
+ if (deleted) {
+ debug("Deleted file [", fileToBackup, "] after backing it up. dryRun=", dryRun);
+ }
if (diff != null) {
diff.addBackedUpFile(fileToBackupPath, bakFile.getAbsolutePath());
+ if (deleted) {
+ diff.addDeletedFile(fileToBackupPath);
+ }
}
return;
}
+ private void backupFiles(DeployDifferences diff, int deploymentId, File dirToBackup, boolean dryRun,
+ String relativeTo, boolean removeSourceFiles) throws Exception {
+ File[] files = dirToBackup.listFiles();
+ if (files == null) {
+ throw new IOException("Failed to get the list of files in source directory [" + dirToBackup + "]");
+ }
+ if (files.length > 0) {
+ this.deploymentsMetadata.getMetadataDirectory().mkdirs(); // make sure we create this, might not be there yet
+ for (File file : files) {
+ if (file.isDirectory()) {
+ if (file.getName().equals(DeploymentsMetadata.METADATA_DIR)) {
+ continue; // skip the RHQ metadata directory, its where we are putting our backups!
+ }
+ backupFiles(diff, deploymentId, file, dryRun,
+ ((relativeTo == null) ? "" : relativeTo) + file.getName() + File.separatorChar,
+ removeSourceFiles);
+ } else {
+ backupFile(diff, deploymentId, ((relativeTo == null) ? "" : relativeTo) + file.getName(), dryRun,
+ removeSourceFiles);
+ }
+ }
+
+ files = null; // help GC
+ }
+ }
+
private FileHashcodeMap extractZipAndRawFiles(Map<String, String> currentFilesToLeaveAlone, DeployDifferences diff,
boolean dryRun) throws Exception {
@@ -615,8 +700,8 @@ public class Deployer {
ZipUtil.walkZipFile(zipFile, visitor);
// we have to compress the file again - our new compressed file will have the new realized files in them
if (!dryRun) {
- createZipFile(compressedFile, this.deploymentData.getDestinationDir(), visitor
- .getFileHashcodeMap());
+ createZipFile(compressedFile, this.deploymentData.getDestinationDir(),
+ visitor.getFileHashcodeMap());
}
}
@@ -1040,16 +1125,20 @@ public class Deployer {
private void debug(Object... objs) {
if (log.isDebugEnabled()) {
- String bundleName = this.deploymentData.getDeploymentProps().getBundleName();
- String bundleVersion = this.deploymentData.getDeploymentProps().getBundleVersion();
- int deploymentId = this.deploymentData.getDeploymentProps().getDeploymentId();
- StringBuilder str = new StringBuilder();
- str.append("Bundle [").append(bundleName).append(" v").append(bundleVersion).append(']');
- str.append("; Deployment [").append(deploymentId).append("]: ");
- for (Object o : objs) {
- str.append(o);
- }
- log.debug(str.toString());
+ log.debug(buildLogMessage(objs));
+ }
+ }
+
+ private String buildLogMessage(Object... objs) {
+ String bundleName = this.deploymentData.getDeploymentProps().getBundleName();
+ String bundleVersion = this.deploymentData.getDeploymentProps().getBundleVersion();
+ int deploymentId = this.deploymentData.getDeploymentProps().getDeploymentId();
+ StringBuilder str = new StringBuilder();
+ str.append("Bundle [").append(bundleName).append(" v").append(bundleVersion).append(']');
+ str.append("; Deployment [").append(deploymentId).append("]: ");
+ for (Object o : objs) {
+ str.append(o);
}
+ return str.toString();
}
}
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java b/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java
index 31659bd..bb7ad34 100644
--- a/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java
+++ b/modules/core/util/src/test/java/org/rhq/core/util/file/FileUtilTest.java
@@ -22,21 +22,92 @@
*/
package org.rhq.core.util.file;
+import static java.util.Arrays.asList;
+import static org.apache.commons.io.FileUtils.deleteDirectory;
+import static org.apache.commons.io.FileUtils.toFile;
+import static org.apache.commons.io.FileUtils.touch;
+import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
+
+import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import org.testng.annotations.Test;
-import static java.util.Arrays.asList;
-import static org.apache.commons.io.FileUtils.deleteDirectory;
-import static org.apache.commons.io.FileUtils.toFile;
-import static org.apache.commons.io.FileUtils.touch;
-import static org.rhq.test.AssertUtils.assertCollectionEqualsNoOrder;
+import org.rhq.core.util.stream.StreamUtil;
@Test
public class FileUtilTest {
+ public void testCopyDirectory() throws Exception {
+ try {
+ FileUtil.copyDirectory(new File("this.does.not.exist"), new File("dummy"));
+ assert false : "the source directory did not exist, this should have failed because of that";
+ } catch (Exception ok) {
+ }
+
+ // create a source directory and a destination directory. Make sure we start off
+ // with a non-existent destination directory - we want the copyDirectory to create it for us.
+ File outDir = FileUtil.createTempDirectory("fileUtilTestCopyDir", ".dest", null);
+ assert outDir.delete() : "failed to start out with a non-existent dest directory";
+ assert !outDir.exists() : "dest directory should not exist"; // yes, I am paranoid
+
+ File inDir = FileUtil.createTempDirectory("fileUtilTestCopyDir", ".src", null);
+ try {
+ // create some test files in our source directory
+ String testFilename0 = "file0.txt";
+ String testFilename1 = "subdir" + File.separatorChar + "subfile1.txt";
+ String testFilename2 = "subdir" + File.separatorChar + "subfile2.txt";
+
+ File testFile = new File(inDir, testFilename0);
+ StreamUtil.copy(new ByteArrayInputStream("0".getBytes()), new FileOutputStream(testFile));
+ assert "0".equals(new String(StreamUtil.slurp(new FileInputStream(testFile)))); // sanity check, make sure its there
+
+ testFile = new File(inDir, testFilename1);
+ testFile.getParentFile().mkdirs();
+ StreamUtil.copy(new ByteArrayInputStream("1".getBytes()), new FileOutputStream(testFile));
+ assert "1".equals(new String(StreamUtil.slurp(new FileInputStream(testFile)))); // sanity check, make sure its there
+ testFile = new File(inDir, testFilename2);
+ testFile.getParentFile().mkdirs();
+ StreamUtil.copy(new ByteArrayInputStream("2".getBytes()), new FileOutputStream(testFile));
+ assert "2".equals(new String(StreamUtil.slurp(new FileInputStream(testFile)))); // sanity check, make sure its there
+
+ // copy our source directory and confirm the copies are correct
+ FileUtil.copyDirectory(inDir, outDir);
+
+ testFile = new File(outDir, testFilename0);
+ assert testFile.exists() : "file did not get created: " + testFile;
+ assert "0".equals(new String(StreamUtil.slurp(new FileInputStream(testFile))));
+ testFile = new File(outDir, testFilename1);
+ assert testFile.exists() : "file did not get created: " + testFile;
+ assert "1".equals(new String(StreamUtil.slurp(new FileInputStream(testFile))));
+ testFile = new File(outDir, testFilename2);
+ assert testFile.exists() : "file did not get created: " + testFile;
+ assert "2".equals(new String(StreamUtil.slurp(new FileInputStream(testFile))));
+
+ // let's test getDirectoryFiles while we are here
+ List<File> outFiles = FileUtil.getDirectoryFiles(outDir);
+ assert outFiles != null : outFiles;
+ assert outFiles.size() == 3 : outFiles;
+ assert outFiles.contains(new File(testFilename0)) : outFiles;
+ assert outFiles.contains(new File(testFilename1)) : outFiles;
+ assert outFiles.contains(new File(testFilename2)) : outFiles;
+ } finally {
+ // clean up our test
+ try {
+ FileUtil.purge(inDir, true);
+ } catch (Exception ignore) {
+ }
+ try {
+ FileUtil.purge(outDir, true);
+ } catch (Exception ignore) {
+ }
+ }
+ }
+
public void testStripDriveLetter() {
StringBuilder str;
@@ -142,8 +213,7 @@ public class FileUtilTest {
}
});
- assertCollectionEqualsNoOrder(expectedFiles, actualFiles,
- "Expected to visit all files in directory");
+ assertCollectionEqualsNoOrder(expectedFiles, actualFiles, "Expected to visit all files in directory");
}
@Test
@@ -176,8 +246,7 @@ public class FileUtilTest {
}
});
- assertCollectionEqualsNoOrder(expectedFiles, actualFiles,
- "Expected to visit files in sub directories");
+ assertCollectionEqualsNoOrder(expectedFiles, actualFiles, "Expected to visit files in sub directories");
}
@Test
@@ -210,8 +279,7 @@ public class FileUtilTest {
}
});
- assertCollectionEqualsNoOrder(expectedFiles, actualFiles,
- "Expected to visit files in nested sub directories");
+ assertCollectionEqualsNoOrder(expectedFiles, actualFiles, "Expected to visit files in nested sub directories");
}
public void testGetPattern() {
@@ -222,8 +290,8 @@ public class FileUtilTest {
assert regex.matcher("/basedir/test1.txt").matches();
assert !regex.matcher("/basedir/test2.txt").matches();
- regex = assertPatternsRegex("(/basedir/easy\\.txt)|(/basedir/test\\.txt)",
- new PathFilter("/basedir/easy.txt", null), new PathFilter("/basedir/test.txt", null));
+ regex = assertPatternsRegex("(/basedir/easy\\.txt)|(/basedir/test\\.txt)", new PathFilter("/basedir/easy.txt",
+ null), new PathFilter("/basedir/test.txt", null));
assert regex.matcher("/basedir/easy.txt").matches();
assert regex.matcher("/basedir/test.txt").matches();
@@ -244,8 +312,8 @@ public class FileUtilTest {
assert !regex.matcher("/basedir/subdir/foo.txt").matches();
assert !regex.matcher("/basedir/foo.txt.swp").matches();
- regex = assertPatternsRegex("(/var/lib/([^/]*\\.war))|(/var/lib/([^/]*\\.ear))",
- new PathFilter("/var/lib", "*.war"), new PathFilter("/var/lib", "*.ear"));
+ regex = assertPatternsRegex("(/var/lib/([^/]*\\.war))|(/var/lib/([^/]*\\.ear))", new PathFilter("/var/lib",
+ "*.war"), new PathFilter("/var/lib", "*.ear"));
assert regex.matcher("/var/lib/myapp.war").matches();
assert regex.matcher("/var/lib/myapp.ear").matches();
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java b/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java
index 69d6d53..a69931a 100644
--- a/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java
+++ b/modules/core/util/src/test/java/org/rhq/core/util/updater/DeployerTest.java
@@ -230,12 +230,13 @@ public class DeployerTest {
final String file999 = "dir1" + fileSeparator + "file999";
try {
- if (ignore) {
- // create a file that will be retained because we will be ignoring it
- File ignoreDir = FileUtil.createTempDirectory("ignoreme", ".dir", tmpDir);
- fileToIgnore = new File(ignoreDir, "some-log.log");
- StreamUtil.copy(new ByteArrayInputStream("boo".getBytes()), new FileOutputStream(fileToIgnore));
- }
+ // this is a file that will be removed because our initial deployment is managing the root deploy dir
+ // later we will recreate it to see that we ignore it during the upgrade.
+ // note that during the initial deployment, we will still back it up.
+ File ignoreDir = FileUtil.createTempDirectory("ignoreme", ".dir", tmpDir);
+ fileToIgnore = new File(ignoreDir, "some-log.log");
+ StreamUtil.copy(new ByteArrayInputStream("boo".getBytes()), new FileOutputStream(fileToIgnore));
+ String fileToIgnorePath = ignoreDir.getName() + "/" + fileToIgnore.getName(); // yes, use /, even if we are on windows
File testZipFile1 = new File("target/test-classes/updater-test1.zip");
File testZipFile2 = new File("target/test-classes/updater-test2.zip");
@@ -267,15 +268,25 @@ public class DeployerTest {
deployer.deploy(diff);
- if (ignore) {
- assert "boo".equals(new String(StreamUtil.slurp(new FileInputStream(fileToIgnore))));
- assert diff.getIgnoredFiles().size() == 0 : "this was an initial deploy - nothing to ignore (ignore is only for updates)";
- }
+ // our initial deploy should have deleted this because we are managing the root dir
+ assert !fileToIgnore.exists() : "should have removed this file since we are managing the root dir";
+ assert !fileToIgnore.getParentFile().exists() : "should have removed this file since we are managing the root dir";
+ assert diff.getIgnoredFiles().size() == 0 : "this was an initial deploy - nothing to ignore (ignore is only for updates)";
assert diff.getAddedFiles().size() == 6 : diff;
- assert diff.getDeletedFiles().size() == 0 : diff;
+ assert diff.getDeletedFiles().size() == 1 : diff;
+ assert diff.getDeletedFiles().contains(fileToIgnorePath) : "should have deleted this unknown file" + diff;
assert diff.getChangedFiles().size() == 0 : diff;
assert diff.getRealizedFiles().size() == 0 : "No fileA to realize in this deployment: " + diff;
- assert diff.getBackedUpFiles().size() == 0 : "No fileA to realize in this deployment: " + diff;
+ assert diff.getBackedUpFiles().size() == 1 : diff;
+ assert diff.getBackedUpFiles().get(fileToIgnorePath) != null : "should have backed up this file" + diff;
+
+ if (ignore) {
+ // let's create this again to make sure we really do ignore it
+ ignoreDir = FileUtil.createTempDirectory("ignoreme", ".dir", tmpDir);
+ fileToIgnore = new File(ignoreDir, "some-log.log");
+ StreamUtil.copy(new ByteArrayInputStream("boo".getBytes()), new FileOutputStream(fileToIgnore));
+ fileToIgnorePath = ignoreDir.getName() + "/" + fileToIgnore.getName(); // yes, use /, even if we are on windows
+ }
StreamUtil.copy(new ByteArrayInputStream("X".getBytes()), new FileOutputStream(new File(tmpDir, file1)));
StreamUtil.copy(new ByteArrayInputStream("X".getBytes()), new FileOutputStream(updaterAabsolute));
@@ -295,7 +306,7 @@ public class DeployerTest {
templateEngine, ignoreRegex, true, null);
deployer = new Deployer(dd);
diff = new DeployDifferences();
- deployer.deploy(diff);
+ deployer.deploy(diff); // this is an upgrade
if (ignore) {
assert "boo".equals(new String(StreamUtil.slurp(new FileInputStream(fileToIgnore))));
@@ -396,11 +407,11 @@ public class DeployerTest {
assert diff.getChangedFiles().contains(fileB) : diff;
assert diff.getBackedUpFiles().size() == 4 : diff;
assert diff.getBackedUpFiles().containsKey(diff.convertPath(updaterAabsolute.getAbsolutePath())) : diff;
- assert diff.getBackedUpFiles().get(diff.convertPath(updaterAabsolute.getAbsolutePath())).equals(
- diff.convertPath(updaterAabsoluteBackupTo2)) : diff;
+ assert diff.getBackedUpFiles().get(diff.convertPath(updaterAabsolute.getAbsolutePath()))
+ .equals(diff.convertPath(updaterAabsoluteBackupTo2)) : diff;
assert diff.getBackedUpFiles().containsKey(diff.convertPath(updaterBabsolute.getAbsolutePath())) : diff;
- assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath())).equals(
- diff.convertPath(updaterBabsoluteBackupTo2)) : diff;
+ assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath()))
+ .equals(diff.convertPath(updaterBabsoluteBackupTo2)) : diff;
assert diff.getBackedUpFiles().containsKey(fileB) : diff;
assert diff.getBackedUpFiles().get(fileB).equals(diff.convertPath(fileBbackupTo2.getAbsolutePath())) : diff;
assert diff.getBackedUpFiles().containsKey(file999) : diff;
@@ -442,8 +453,8 @@ public class DeployerTest {
assert diff.getChangedFiles().contains(diff.convertPath(updaterBabsolute.getAbsolutePath())) : diff;
assert diff.getBackedUpFiles().size() == 1 : diff;
assert diff.getBackedUpFiles().containsKey(diff.convertPath(updaterBabsolute.getAbsolutePath())) : diff;
- assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath())).equals(
- diff.convertPath(updaterBabsoluteBackupTo3)) : diff;
+ assert diff.getBackedUpFiles().get(diff.convertPath(updaterBabsolute.getAbsolutePath()))
+ .equals(diff.convertPath(updaterBabsoluteBackupTo3)) : diff;
if (realize) {
assert diff.getRealizedFiles().size() == 1 : diff;
assert diff.getRealizedFiles().containsKey(fileA) : diff;
diff --git a/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java b/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java
index f875576..2736f16 100644
--- a/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java
+++ b/modules/core/util/src/test/java/org/rhq/core/util/updater/SimpleDeployerTest.java
@@ -205,7 +205,15 @@ public class SimpleDeployerTest {
baseNoNewWithCurrentDifferentThanOriginal(true);
}
- public void testWithSubdirectories() throws Exception {
+ public void testWithSubdirectoriesManageRootDir() throws Exception {
+ testWithSubdirectories(true);
+ }
+
+ public void testWithSubdirectoriesNoManageRootDir() throws Exception {
+ testWithSubdirectories(false);
+ }
+
+ private void testWithSubdirectories(boolean manageRootDir) throws Exception {
// this test is different than all the rest, start with clean tmp/dest dirs with no beforeMethod buildup
FileUtil.purge(this.tmpDir, false);
FileUtil.purge(this.deployDir, false);
@@ -227,14 +235,40 @@ public class SimpleDeployerTest {
this.originalZipFiles.add(originalZipFile);
this.originalDeployProps = new DeploymentProperties(1, "simple", "1.0", "original test deployment");
DeploymentData dd = new DeploymentData(originalDeployProps, originalZipFiles, null, tmpDir, deployDir, null,
- null, null, null, true, null);
+ null, null, null, manageRootDir, null);
+ this.diff = new DeployDifferences();
Deployer deployer = new Deployer(dd);
- this.originalFileHashcodeMap = deployer.deploy(null);
+ this.originalFileHashcodeMap = deployer.deploy(this.diff);
assert new File(this.deployDir, origFileName1).exists();
assert new File(this.deployDir, origFileName2).exists();
- assert unrelated1.exists() : "the deployment removed unrelated file1";
- assert unrelated2.getParentFile().isDirectory() : "the deployment removed an unrelated dir";
- assert unrelated2.exists() : "the deployment removed unrelated file2";
+ if (manageRootDir) {
+ assert !unrelated1.exists() : "the deployment should have removed unrelated file1";
+ assert !unrelated2.getParentFile().isDirectory() : "the deployment should have removed an unrelated dir";
+ assert !unrelated2.exists() : "the deployment should have removed unrelated file2";
+
+ assert this.diff.getBackedUpFiles().size() == 2 : this.diff;
+ assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName1)).exists() : this.diff;
+ assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName2)).exists() : this.diff;
+ assert this.diff.getDeletedFiles().size() == 2 : this.diff;
+ assert this.diff.getDeletedFiles().contains(unrelatedFileName1) : this.diff;
+ assert this.diff.getDeletedFiles().contains(unrelatedFileName2) : this.diff;
+ } else {
+ assert this.diff.getBackedUpFiles().size() == 0 : this.diff;
+ assert this.diff.getDeletedFiles().size() == 0 : this.diff;
+ assert unrelated1.exists() : "the deployment removed unrelated file1";
+ assert unrelated2.getParentFile().isDirectory() : "the deployment removed an unrelated dir";
+ assert unrelated2.exists() : "the deployment removed unrelated file2";
+ }
+
+ assert this.diff.getAddedFiles().size() == 2 : this.diff;
+ assert this.diff.getAddedFiles().contains(origFileName1) : this.diff;
+ assert this.diff.getAddedFiles().contains(origFileName2) : this.diff;
+ assert this.diff.getChangedFiles().isEmpty() : this.diff;
+ assert this.diff.getIgnoredFiles().isEmpty() : this.diff;
+ assert this.diff.getRealizedFiles().isEmpty() : this.diff;
+ assert this.diff.getRestoredFiles().isEmpty() : this.diff;
+ assert !this.diff.wasCleaned() : this.diff;
+ assert this.diff.getErrors().isEmpty() : this.diff;
// deploy new content
this.newDeployProps = new DeploymentProperties(2, "simple", "2.0", "new test deployment");
@@ -246,19 +280,36 @@ public class SimpleDeployerTest {
new String[] { newFileName1, newFileName2 });
HashSet<File> newZipFiles = new HashSet<File>(1);
newZipFiles.add(newZipFile);
- dd = new DeploymentData(newDeployProps, newZipFiles, null, tmpDir, deployDir, null, null, null, null, true,
- null);
+ dd = new DeploymentData(newDeployProps, newZipFiles, null, tmpDir, deployDir, null, null, null, null,
+ manageRootDir, null);
deployer = new Deployer(dd);
FileHashcodeMap newFileHashcodeMap = deployer.deploy(this.diff);
+ assert newFileHashcodeMap != null;
assert new File(this.deployDir, newFileName1).exists();
assert new File(this.deployDir, newFileName2).exists();
assert !new File(this.deployDir, origFileName1).exists();
assert !new File(this.deployDir, origFileName2).exists();
- assert !unrelated1.exists() : "the deployment did not remove unrelated file1";
- assert !unrelated2.exists() : "the deployment did not remove unrelated file1";
- assert this.diff.getBackedUpFiles().size() == 2 : this.diff;
- assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName1)).exists() : this.diff;
- assert new File(this.diff.getBackedUpFiles().get(unrelatedFileName2)).exists() : this.diff;
+ if (manageRootDir) {
+ assert !unrelated1.exists() : "the deployment did not remove unrelated file1";
+ assert !unrelated2.exists() : "the deployment did not remove unrelated file1";
+ } else {
+ assert unrelated1.exists() : "the deployment removed unrelated file1 but we aren't managing the root dir";
+ assert unrelated2.exists() : "the deployment removed unrelated file1 but we aren't managing the root dir";
+ }
+
+ assert this.diff.getAddedFiles().size() == 2 : this.diff;
+ assert this.diff.getAddedFiles().contains(newFileName1) : this.diff;
+ assert this.diff.getAddedFiles().contains(newFileName2) : this.diff;
+ assert this.diff.getDeletedFiles().size() == 2 : this.diff;
+ assert this.diff.getDeletedFiles().contains(origFileName1) : this.diff;
+ assert this.diff.getDeletedFiles().contains(origFileName2) : this.diff;
+ assert this.diff.getChangedFiles().isEmpty() : this.diff;
+ assert this.diff.getBackedUpFiles().isEmpty() : this.diff;
+ assert this.diff.getIgnoredFiles().isEmpty() : this.diff;
+ assert this.diff.getRealizedFiles().isEmpty() : this.diff;
+ assert this.diff.getRestoredFiles().isEmpty() : this.diff;
+ assert !this.diff.wasCleaned() : this.diff;
+ assert this.diff.getErrors().isEmpty() : this.diff;
}
private void baseX_X_X(boolean dryRun) throws Exception {
diff --git a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
index a772ef0..d712401 100644
--- a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
+++ b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
@@ -231,11 +231,17 @@ public class AntBundlePluginComponentTest {
upgrade(true);
}
+ @Test(enabled = true)
+ public void testAntBundleInitialInstall() throws Exception {
+ doAntBundleInitialInstall(true);
+ }
+
/**
* Test deployment of an RHQ bundle recipe with archive file and raw file
+ * @param startClean if true, the destination directory will be non-existent and thus clean
+ * if false, this will put some junk files in the dest directory
*/
- @Test(enabled = true)
- public void testAntBundleInitialInstall() throws Exception {
+ private void doAntBundleInitialInstall(boolean startClean) throws Exception {
ResourceType resourceType = new ResourceType("testSimpleBundle2Type", "plugin", ResourceCategory.SERVER, null);
BundleType bundleType = new BundleType("testSimpleBundle2BType", resourceType);
Repo repo = new Repo("test-bundle-two");
@@ -273,6 +279,25 @@ public class AntBundlePluginComponentTest {
props.store(outputStream, "test.properties comment");
outputStream.close();
+ // if we are not to start clean, create some junk files that will need to be backed up and moved away
+ if (startClean == false) {
+ this.destDir.mkdirs();
+ File junk1 = new File(this.destDir, "junk1.properties");
+ Properties junkProps = new Properties();
+ junkProps.setProperty("junk1", "wot gorilla?");
+ FileOutputStream os = new FileOutputStream(junk1);
+ junkProps.store(os, "junk1.properties comment");
+ os.close();
+
+ File junk2 = new File(this.destDir, "junksubdir" + File.separatorChar + "junk2.properties");
+ junk2.getParentFile().mkdirs();
+ junkProps = new Properties();
+ junkProps.setProperty("junk2", "more junk");
+ os = new FileOutputStream(junk2);
+ junkProps.store(os, "junk2.properties comment");
+ os.close();
+ }
+
BundleDeployRequest request = new BundleDeployRequest();
request.setBundleFilesLocation(this.bundleFilesDir);
request.setResourceDeployment(new BundleResourceDeployment(deployment, null));
@@ -501,8 +526,129 @@ public class AntBundlePluginComponentTest {
assert "2".equals(props.getProperty("external2")) : "bundle purge removed our unmanaged file 2";
}
+ /**
+ * Test deployment of an RHQ bundle recipe where the deploy directory is to be fully managed.
+ * This is the typical use-case and the default behavior.
+ */
+ @Test(enabled = true)
+ public void testAntBundleManageRootDir() throws Exception {
+ ResourceType resourceType = new ResourceType("testManageRootDirBundle", "plugin", ResourceCategory.SERVER, null);
+ BundleType bundleType = new BundleType("testManageRootDirBundle", resourceType);
+ Repo repo = new Repo("testManageRootDirBundle");
+ PackageType packageType = new PackageType("testManageRootDirBundle", resourceType);
+ Bundle bundle = new Bundle("testManageRootDirBundle", bundleType, repo, packageType);
+ BundleVersion bundleVersion = new BundleVersion("testManageRootDirBundle", "1.0", bundle,
+ getRecipeFromFile("test-bundle-manage-root-dir.xml"));
+ BundleDestination destination = new BundleDestination(bundle, "testManageRootDirBundle", new ResourceGroup(
+ "testManageRootDirBundle"), DEST_BASE_DIR_NAME, this.destDir.getAbsolutePath());
+ Configuration config = new Configuration();
+
+ BundleDeployment deployment = new BundleDeployment();
+ deployment.setName("test bundle deployment name");
+ deployment.setBundleVersion(bundleVersion);
+ deployment.setConfiguration(config);
+ deployment.setDestination(destination);
+
+ // create bundle test files
+ File file0 = new File(this.bundleFilesDir, "zero.properties");
+ Properties props = new Properties();
+ props.setProperty("zero", "0");
+ FileOutputStream outputStream = new FileOutputStream(file0);
+ props.store(outputStream, "zero file");
+ outputStream.close();
+
+ File file1 = new File(this.bundleFilesDir, "one.properties");
+ props.clear();
+ props.setProperty("one", "1");
+ outputStream = new FileOutputStream(file1);
+ props.store(outputStream, "one file");
+ outputStream.close();
+
+ File file2 = new File(this.bundleFilesDir, "two.properties");
+ props.clear();
+ props.setProperty("two", "2");
+ outputStream = new FileOutputStream(file2);
+ props.store(outputStream, "two file");
+ outputStream.close();
+
+ // create some external test files that don't belong to the bundle but are in the dest dir (which is to be managed by the bundle)
+ this.destDir.mkdirs();
+ File external1 = new File(this.destDir, "external1.properties");
+ props.clear();
+ props.setProperty("external1", "1");
+ outputStream = new FileOutputStream(external1);
+ props.store(outputStream, "external1 file");
+ outputStream.close();
+
+ File external2 = new File(this.destDir, "extdir/external2.properties");
+ external2.getParentFile().mkdirs();
+ props.clear();
+ props.setProperty("external2", "2");
+ outputStream = new FileOutputStream(external2);
+ props.store(outputStream, "external2 file");
+ outputStream.close();
+
+ // deploy the bundle
+ BundleDeployRequest request = new BundleDeployRequest();
+ request.setBundleFilesLocation(this.bundleFilesDir);
+ request.setResourceDeployment(new BundleResourceDeployment(deployment, null));
+ request.setBundleManagerProvider(new MockBundleManagerProvider());
+ request.setAbsoluteDestinationDirectory(this.destDir);
+
+ BundleDeployResult results = plugin.deployBundle(request);
+
+ assertResultsSuccess(results);
+
+ // test that files were deployed in the proper place
+ props.clear();
+ loadProperties(props, new FileInputStream(new File(this.destDir, "zero.properties")));
+ assert "0".equals(props.getProperty("zero")) : "did not deploy bundle correctly 0";
+ loadProperties(props, new FileInputStream(new File(this.destDir, "subdir1/one.properties")));
+ assert "1".equals(props.getProperty("one")) : "did not deploy bundle correctly 1";
+ loadProperties(props, new FileInputStream(new File(this.destDir, "subdir2/two.properties")));
+ assert "2".equals(props.getProperty("two")) : "did not deploy bundle correctly 2";
+
+ DeploymentsMetadata metadata = new DeploymentsMetadata(this.destDir);
+ assert metadata.isManaged() == true : "missing metadata directory";
+ assert metadata.getCurrentDeploymentProperties().getManageRootDir() == true : "should be managing root dir";
+
+ // make sure our external files/directories were removed because
+ // they aren't part of the bundle and we are fully managing the dest dir
+ props.clear();
+ try {
+ loadProperties(props, new FileInputStream(new File(this.destDir, "external1.properties")));
+ assert false : "bundle deployment did not remove our managed file 1";
+ } catch (Exception ok) {
+ }
+ try {
+ loadProperties(props, new FileInputStream(new File(this.destDir, "extdir/external2.properties")));
+ assert false : "bundle deployment did not remove our managed file 2";
+ } catch (Exception ok) {
+ }
+
+ // now purge the bundle - this should purge everything in the deploy dir because we are fully managing it
+ BundlePurgeRequest purgeRequest = new BundlePurgeRequest();
+ purgeRequest.setLiveResourceDeployment(new BundleResourceDeployment(deployment, null));
+ purgeRequest.setBundleManagerProvider(new MockBundleManagerProvider());
+ purgeRequest.setAbsoluteDestinationDirectory(this.destDir);
+
+ BundlePurgeResult purgeResults = plugin.purgeBundle(purgeRequest);
+ assertResultsSuccess(purgeResults);
+
+ // make sure our bundle files have been completely purged; the metadata directory should have been purged too
+ assert new File(this.destDir, "zero.properties").exists() == false;
+ assert new File(this.destDir, "subdir1/one.properties").exists() == false;
+ assert new File(this.destDir, "subdir2/two.properties").exists() == false;
+ assert new File(this.destDir, "subdir1").exists() == false;
+ assert new File(this.destDir, "subdir2").exists() == false;
+ assert this.destDir.exists() == false : "deploy dir should not exist, we were told to fully manage it";
+
+ metadata = new DeploymentsMetadata(this.destDir);
+ assert metadata.getMetadataDirectory().exists() == false : "metadata directory should not exist";
+ }
+
private void upgrade(boolean clean) throws Exception {
- testAntBundleInitialInstall(); // install a bundle first
+ doAntBundleInitialInstall(clean); // install a bundle first
cleanPluginDirs(); // clean everything but the dest dir - we want to upgrade the destination
prepareBeforeTestMethod(); // prepare for our new test
diff --git a/modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml b/modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml
new file mode 100644
index 0000000..9b77dd8
--- /dev/null
+++ b/modules/plugins/ant-bundle/src/test/resources/test-bundle-manage-root-dir.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<project name="simple-build" default="main"
+ xmlns:rhq="antlib:org.rhq.bundle">
+
+ <rhq:bundle name="testManageRootDirBundle" version="1.0">
+ <rhq:deployment-unit name="simulated-war" manageRootDir="true">
+ <rhq:file name="zero.properties" destinationFile="zero.properties"/>
+ <rhq:file name="one.properties" destinationFile="subdir1/one.properties"/>
+ <rhq:file name="two.properties" destinationFile="subdir2/two.properties"/>
+ </rhq:deployment-unit>
+ </rhq:bundle>
+
+ <target name="main"/>
+
+</project>
\ No newline at end of file
12 years, 3 months
[rhq] Branch 'stefan/backingcontent' - 3 commits - .classpath modules/enterprise
by snegrea
.classpath | 1
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanMockTest.java | 3
modules/enterprise/server/plugins/disk/pom.xml | 18
modules/enterprise/server/plugins/disk/src/test/java/org/rhq/enterprise/server/plugins/disk/test/DiskSourceTest.java | 263 ++++++++++
modules/enterprise/server/plugins/jboss-software/src/test/java/org/rhq/enterprise/server/plugins/jboss/software/test/RssFeedParserTest.java | 13
5 files changed, 293 insertions(+), 5 deletions(-)
New commits:
commit d2d911e72df3b1a3fa5a65345fbb6f9ccbde802f
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Feb 2 08:29:54 2012 -0600
[BZ 771418] Corrected incorrect import of junit dependencies. Testng is the framework of choice.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanMockTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanMockTest.java
index 7ee018f..70eef9d 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanMockTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/content/test/ContentManagerBeanMockTest.java
@@ -44,13 +44,12 @@ import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.sql.DataSource;
-import junit.framework.Assert;
-
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockObjectFactory;
+import org.testng.Assert;
import org.testng.IObjectFactory;
import org.testng.annotations.ObjectFactory;
import org.testng.annotations.Test;
commit 30f42a139ad7c681e3724467a01c182b4bd2fbc1
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Feb 2 08:26:19 2012 -0600
[BZ 772722] Adding unit tests for the JBoss CSP server plugin to ensure sha256 and version are correctly populated during sync.
diff --git a/modules/enterprise/server/plugins/jboss-software/src/test/java/org/rhq/enterprise/server/plugins/jboss/software/test/RssFeedParserTest.java b/modules/enterprise/server/plugins/jboss-software/src/test/java/org/rhq/enterprise/server/plugins/jboss/software/test/RssFeedParserTest.java
index 15fc3cc..30d0efa 100644
--- a/modules/enterprise/server/plugins/jboss-software/src/test/java/org/rhq/enterprise/server/plugins/jboss/software/test/RssFeedParserTest.java
+++ b/modules/enterprise/server/plugins/jboss-software/src/test/java/org/rhq/enterprise/server/plugins/jboss/software/test/RssFeedParserTest.java
@@ -25,6 +25,10 @@ import java.net.URL;
import java.util.Iterator;
import java.util.Set;
+import churchillobjects.rss4j.RssDocument;
+import churchillobjects.rss4j.parser.RssParser;
+
+import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -32,9 +36,6 @@ import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails
import org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport;
import org.rhq.enterprise.server.plugins.jboss.software.RssFeedParser;
-import churchillobjects.rss4j.RssDocument;
-import churchillobjects.rss4j.parser.RssParser;
-
/**
* @author Jason Dobies
*/
@@ -98,6 +99,8 @@ public class RssFeedParserTest {
int totalNumVersions = 0;
for (ContentProviderPackageDetails pkg : newPackages) {
totalNumVersions += pkg.getResourceVersions().size();
+
+ Assert.assertEquals("[sha256=" + pkg.getSHA256() + "]", pkg.getKey().getVersion());
}
assert totalNumVersions == 282 : "Incorrect number of total versions represented. Expected: 282, Found: "
@@ -126,6 +129,10 @@ public class RssFeedParserTest {
+ report.getDeletedPackages().size();
assert report.getUpdatedPackages().size() == 0 : "Incorrect number of updated packages. Expected: 0, Found: "
+ report.getUpdatedPackages().size();
+
+ for (ContentProviderPackageDetails pkg : report.getNewPackages()) {
+ Assert.assertEquals("[sha256=" + pkg.getSHA256() + "]", pkg.getKey().getVersion());
+ }
}
@Test
commit 696f61d5eda164544bc953add9348bf88248cabd
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Feb 2 01:52:33 2012 -0600
[BZ 772722] Added unit tests for updated functionality of the disk source repository.
diff --git a/.classpath b/.classpath
index ee87d32..f6d885f 100644
--- a/.classpath
+++ b/.classpath
@@ -290,5 +290,6 @@
<classpathentry kind="src" path="modules/plugins/jboss-as-7/src/test/java"/>
<classpathentry kind="src" path="modules/integration-tests/jboss-as-7-plugin-test/src/test/java"/>
<classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/disk/src/test/java"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
diff --git a/modules/enterprise/server/plugins/disk/pom.xml b/modules/enterprise/server/plugins/disk/pom.xml
index 9fcc685..c6f3ced 100644
--- a/modules/enterprise/server/plugins/disk/pom.xml
+++ b/modules/enterprise/server/plugins/disk/pom.xml
@@ -12,6 +12,10 @@
<artifactId>rhq-serverplugin-disk</artifactId>
<packaging>jar</packaging>
+ <properties>
+ <powermock.version>1.4.11</powermock.version>
+ </properties>
+
<name>RHQ Enterprise Server Disk Content Source Plugin</name>
<description>JBoss Operations Network Enterprise Server Disk Content Source Plugin</description>
@@ -24,6 +28,20 @@
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-testng</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
diff --git a/modules/enterprise/server/plugins/disk/src/test/java/org/rhq/enterprise/server/plugins/disk/test/DiskSourceTest.java b/modules/enterprise/server/plugins/disk/src/test/java/org/rhq/enterprise/server/plugins/disk/test/DiskSourceTest.java
new file mode 100644
index 0000000..9981f3a
--- /dev/null
+++ b/modules/enterprise/server/plugins/disk/src/test/java/org/rhq/enterprise/server/plugins/disk/test/DiskSourceTest.java
@@ -0,0 +1,263 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.plugins.disk.test;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.powermock.api.mockito.PowerMockito.verifyNew;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+import java.io.File;
+import java.util.Collection;
+
+import org.mockito.ArgumentCaptor;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.testng.PowerMockObjectFactory;
+import org.testng.Assert;
+import org.testng.IObjectFactory;
+import org.testng.annotations.ObjectFactory;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.util.MessageDigestGenerator;
+import org.rhq.core.util.file.ContentFileInfo;
+import org.rhq.core.util.file.ContentFileInfoFactory;
+import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails;
+import org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport;
+import org.rhq.enterprise.server.plugins.disk.DiskSource;
+
+@PrepareForTest({ DiskSource.class, ContentFileInfoFactory.class })
+public class DiskSourceTest{
+
+ @ObjectFactory
+ public IObjectFactory getObjectFactory() {
+ return new PowerMockObjectFactory();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void noPackageDiscoveredOnDisk() throws Exception {
+
+ //set all the method call arguments
+ String repoName = "testRepo";
+ PackageSyncReport mockPackageSyncReport = mock(PackageSyncReport.class);
+ Collection<ContentProviderPackageDetails> mockCollection = mock(Collection.class);
+
+ //tell the method story as it happens: mock dependencies and make them
+ //behave in a way to get the method under test to completion.
+ Configuration mockConfiguration = mock(Configuration.class);
+ PropertySimple mockProperty = mock(PropertySimple.class);
+ when(mockConfiguration.get("packageSourceEnabled")).thenReturn(mockProperty);
+ when(mockConfiguration.get("repoSourceEnabled")).thenReturn(mockProperty);
+ when(mockProperty.getBooleanValue()).thenReturn(Boolean.TRUE, Boolean.FALSE);
+
+ final String directoryPath = "mock path";
+
+ when(mockConfiguration.getSimpleValue(eq("rootDirectory"), anyString())).thenReturn(directoryPath);
+ when(mockConfiguration.getSimpleValue(eq("packageTypeName"), anyString())).thenReturn("packageTypeName");
+ when(mockConfiguration.getSimpleValue(eq("architectureName"), anyString())).thenReturn("architectureName");
+ when(mockConfiguration.getSimpleValue(eq("resourceType"), anyString())).thenReturn("resource-type");
+
+ File mockRootFolder = mock(File.class);
+ whenNew(File.class).withArguments(directoryPath).thenReturn(mockRootFolder);
+ when(mockRootFolder.exists()).thenReturn(true);
+ when(mockRootFolder.canRead()).thenReturn(true);
+ when(mockRootFolder.isDirectory()).thenReturn(true);
+
+ when(mockCollection.toArray()).thenReturn(new Object[0]);
+
+ File mockRepoFolder = mock(File.class);
+ when(mockRootFolder.listFiles()).thenReturn(new File[] { mockRepoFolder });
+ when(mockRepoFolder.isDirectory()).thenReturn(true);
+ when(mockRepoFolder.getName()).thenReturn(repoName);
+ when(mockRepoFolder.listFiles()).thenReturn(new File[0]);
+
+ //create object to test and inject required dependencies
+ DiskSource objectUnderTest = new DiskSource();
+
+ //run the code to be tested
+ objectUnderTest.initialize(mockConfiguration);
+ objectUnderTest.synchronizePackages(repoName, mockPackageSyncReport, mockCollection);
+
+ //verify the results (Assert and Mock Verification)
+ verify(mockPackageSyncReport, never()).addUpdatedPackage(any(ContentProviderPackageDetails.class));
+ verify(mockPackageSyncReport, never()).addNewPackage(any(ContentProviderPackageDetails.class));
+ verify(mockConfiguration, times(2)).get(anyString());
+ verifyNew(File.class).withArguments(directoryPath);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void onePackageDiscoveredOnDisk() throws Exception {
+
+ //set all the method call arguments
+ String repoName = "testRepo";
+ PackageSyncReport mockPackageSyncReport = mock(PackageSyncReport.class);
+ Collection<ContentProviderPackageDetails> mockCollection = mock(Collection.class);
+
+ //tell the method story as it happens: mock dependencies and make them
+ //behave in a way to get the method under test to completion.
+ Configuration mockConfiguration = mock(Configuration.class);
+ PropertySimple mockProperty = mock(PropertySimple.class);
+ when(mockConfiguration.get("packageSourceEnabled")).thenReturn(mockProperty);
+ when(mockConfiguration.get("repoSourceEnabled")).thenReturn(mockProperty);
+ when(mockProperty.getBooleanValue()).thenReturn(Boolean.TRUE, Boolean.FALSE);
+
+ final String directoryPath = "mock path";
+
+ when(mockConfiguration.getSimpleValue(eq("rootDirectory"), anyString())).thenReturn(directoryPath);
+ when(mockConfiguration.getSimpleValue(eq("packageTypeName"), anyString())).thenReturn("packageTypeName");
+ when(mockConfiguration.getSimpleValue(eq("architectureName"), anyString())).thenReturn("architectureName");
+ when(mockConfiguration.getSimpleValue(eq("resourceType"), anyString())).thenReturn("resource-type");
+ when(mockConfiguration.getSimpleValue(eq("filenameFilter"), anyString())).thenReturn(".*");
+
+ File mockRootFolder = mock(File.class);
+ whenNew(File.class).withArguments(directoryPath).thenReturn(mockRootFolder);
+ when(mockRootFolder.getAbsolutePath()).thenReturn(directoryPath);
+ when(mockRootFolder.exists()).thenReturn(true);
+ when(mockRootFolder.canRead()).thenReturn(true);
+ when(mockRootFolder.isDirectory()).thenReturn(true);
+
+ when(mockCollection.toArray()).thenReturn(new Object[0]);
+
+ File mockRepoFolder = mock(File.class);
+ when(mockRootFolder.listFiles()).thenReturn(new File[] { mockRepoFolder });
+ when(mockRepoFolder.isDirectory()).thenReturn(true);
+ when(mockRepoFolder.getName()).thenReturn(repoName);
+
+ File mockFile = mock(File.class);
+ when(mockRepoFolder.listFiles()).thenReturn(new File[] { mockFile });
+ when(mockFile.getAbsolutePath()).thenReturn("test");
+
+ ContentFileInfo contentFileInfo = mock(ContentFileInfo.class);
+ PowerMockito.mockStatic(ContentFileInfoFactory.class);
+ when(ContentFileInfoFactory.createContentFileInfo(any(File.class))).thenReturn(contentFileInfo);
+
+ MessageDigestGenerator mockDigest = mock(MessageDigestGenerator.class);
+ whenNew(MessageDigestGenerator.class).withArguments(anyString()).thenReturn(mockDigest);
+ when(mockDigest.calcDigestString(any(File.class))).thenReturn("sha256");
+
+ when(mockFile.getName()).thenReturn("fileName");
+ when(mockFile.getAbsolutePath()).thenReturn("mock path");
+
+ //create object to test and inject required dependencies
+ DiskSource objectUnderTest = new DiskSource();
+
+ //run the code to be tested
+ objectUnderTest.initialize(mockConfiguration);
+ objectUnderTest.synchronizePackages(repoName, mockPackageSyncReport, mockCollection);
+
+ //verify the results (Assert and Mock Verification)
+ verify(mockPackageSyncReport, never()).addUpdatedPackage(any(ContentProviderPackageDetails.class));
+ verify(mockConfiguration, times(2)).get(anyString());
+ verifyNew(File.class).withArguments(directoryPath);
+
+ ArgumentCaptor<ContentProviderPackageDetails> argument = ArgumentCaptor
+ .forClass(ContentProviderPackageDetails.class);
+ verify(mockPackageSyncReport, times(1)).addNewPackage(argument.capture());
+ Assert.assertEquals("sha256", argument.getValue().getSHA256());
+ Assert.assertEquals("[sha256=sha256]", argument.getValue().getKey().getVersion());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void onePackageDiscoveredOnDiskWithRedundantSubfolder() throws Exception {
+
+ //set all the method call arguments
+ String repoName = "testRepo";
+ PackageSyncReport mockPackageSyncReport = mock(PackageSyncReport.class);
+ Collection<ContentProviderPackageDetails> mockCollection = mock(Collection.class);
+
+ //tell the method story as it happens: mock dependencies and make them
+ //behave in a way to get the method under test to completion.
+ Configuration mockConfiguration = mock(Configuration.class);
+ PropertySimple mockProperty = mock(PropertySimple.class);
+ when(mockConfiguration.get("packageSourceEnabled")).thenReturn(mockProperty);
+ when(mockConfiguration.get("repoSourceEnabled")).thenReturn(mockProperty);
+ when(mockProperty.getBooleanValue()).thenReturn(Boolean.TRUE, Boolean.FALSE);
+
+ final String directoryPath = "mock path";
+
+ when(mockConfiguration.getSimpleValue(eq("rootDirectory"), anyString())).thenReturn(directoryPath);
+ when(mockConfiguration.getSimpleValue(eq("packageTypeName"), anyString())).thenReturn("packageTypeName");
+ when(mockConfiguration.getSimpleValue(eq("architectureName"), anyString())).thenReturn("architectureName");
+ when(mockConfiguration.getSimpleValue(eq("resourceType"), anyString())).thenReturn("resource-type");
+ when(mockConfiguration.getSimpleValue(eq("filenameFilter"), anyString())).thenReturn(".*");
+
+ File mockRootFolder = mock(File.class);
+ whenNew(File.class).withArguments(directoryPath).thenReturn(mockRootFolder);
+ when(mockRootFolder.getAbsolutePath()).thenReturn(directoryPath);
+ when(mockRootFolder.exists()).thenReturn(true);
+ when(mockRootFolder.canRead()).thenReturn(true);
+ when(mockRootFolder.isDirectory()).thenReturn(true);
+
+ when(mockCollection.toArray()).thenReturn(new Object[0]);
+
+ File mockRepoFolder = mock(File.class);
+ when(mockRootFolder.listFiles()).thenReturn(new File[] { mockRepoFolder });
+ when(mockRepoFolder.isDirectory()).thenReturn(true);
+ when(mockRepoFolder.getName()).thenReturn(repoName);
+
+ File mockExtraFolder = mock(File.class);
+ File mockFile = mock(File.class);
+ when(mockRepoFolder.listFiles()).thenReturn(new File[] { mockFile, mockExtraFolder });
+ when(mockFile.getAbsolutePath()).thenReturn("test");
+ when(mockExtraFolder.isDirectory()).thenReturn(true);
+
+ ContentFileInfo contentFileInfo = mock(ContentFileInfo.class);
+ PowerMockito.mockStatic(ContentFileInfoFactory.class);
+ when(ContentFileInfoFactory.createContentFileInfo(any(File.class))).thenReturn(contentFileInfo);
+
+ MessageDigestGenerator mockDigest = mock(MessageDigestGenerator.class);
+ whenNew(MessageDigestGenerator.class).withArguments(anyString()).thenReturn(mockDigest);
+ when(mockDigest.calcDigestString(any(File.class))).thenReturn("sha256");
+
+ when(mockFile.getName()).thenReturn("fileName");
+ when(mockFile.getAbsolutePath()).thenReturn("mock path");
+
+ //create object to test and inject required dependencies
+ DiskSource objectUnderTest = new DiskSource();
+
+ //run the code to be tested
+ objectUnderTest.initialize(mockConfiguration);
+ objectUnderTest.synchronizePackages(repoName, mockPackageSyncReport, mockCollection);
+
+ //verify the results (Assert and Mock Verification)
+ verify(mockPackageSyncReport, never()).addUpdatedPackage(any(ContentProviderPackageDetails.class));
+ verify(mockConfiguration, times(2)).get(anyString());
+ verifyNew(File.class).withArguments(directoryPath);
+
+ ArgumentCaptor<ContentProviderPackageDetails> argument = ArgumentCaptor
+ .forClass(ContentProviderPackageDetails.class);
+ verify(mockPackageSyncReport, times(1)).addNewPackage(argument.capture());
+ Assert.assertEquals("sha256", argument.getValue().getSHA256());
+ Assert.assertEquals("[sha256=sha256]", argument.getValue().getKey().getVersion());
+
+ verify(mockExtraFolder, times(1)).isDirectory();
+ }
+
+}
\ No newline at end of file
12 years, 3 months