modules/plugins/jboss-as-7/pom.xml
| 1
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
| 51 ++++++++--
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
| 43 +++++++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java
| 19 +++
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 22 ++++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java
| 33 +++++-
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
| 17 ++-
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java
| 19 ++-
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
| 24 ++--
9 files changed, 190 insertions(+), 39 deletions(-)
New commits:
commit dfa94acdf6e92526bf35f08ebd2199c3c4c4db87
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri May 24 23:56:54 2013 +0200
Bug 920214 - [as7] add async avail check support to AS7 plugin
Only applies to server level resource (Standalone, Domain and Managed servers)
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 5f538b7..d85e7e3 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -617,6 +617,7 @@
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java</include>-->
+
<!--<include>org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/domain/SecurityModuleOptionsTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/nonpc/ManagementConnectionPersistenceTest.java</include>-->
</includes>
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index b80a39a..5d540fd 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -16,6 +16,7 @@
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.modules.plugins.jbossas7;
import java.io.File;
@@ -40,6 +41,8 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable;
+import org.rhq.core.pluginapi.availability.AvailabilityFacet;
import org.rhq.core.pluginapi.event.log.LogFileEventResourceComponentHelper;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
@@ -81,7 +84,8 @@ public abstract class BaseServerComponent<T extends
ResourceComponent<?>> extend
private LogFileEventResourceComponentHelper logFileEventDelegate;
private StartScriptConfiguration startScriptConfig;
private ServerPluginConfiguration serverPluginConfig;
- private AvailabilityType lastAvail;
+ private AvailabilityType previousAvailabilityType;
+ private AvailabilityCollectorRunnable availabilityCollector;
@Override
public void start(ResourceContext<T> resourceContext) throws
InvalidPluginConfigurationException, Exception {
@@ -89,38 +93,69 @@ public abstract class BaseServerComponent<T extends
ResourceComponent<?>> extend
serverPluginConfig = new ServerPluginConfiguration(pluginConfiguration);
connection =
ASConnection.newInstanceForServerPluginConfiguration(serverPluginConfig);
+ // The availabilityCollector is still null at this point. So this call will
always perform a real availability
+ // check and throw InvalidPluginConfigurationException as needed.
getAvailability();
logFileEventDelegate = new LogFileEventResourceComponentHelper(context);
logFileEventDelegate.startLogFileEventPollers();
startScriptConfig = new StartScriptConfiguration(pluginConfiguration);
+
+ Integer availabilityCheckPeriod = null;
+ try {
+ availabilityCheckPeriod = serverPluginConfig.getAvailabilityCheckPeriod();
+ } catch (NumberFormatException e) {
+ log.error("Avail check period config prop was not a valid number. Cause:
" + e);
+ }
+ if (availabilityCheckPeriod != null) {
+ long availCheckMillis = availabilityCheckPeriod * 1000L;
+ this.availabilityCollector =
resourceContext.getAvailabilityContext().createAvailabilityCollectorRunnable(
+ new AvailabilityFacet() {
+ public AvailabilityType getAvailability() {
+ return getAvailabilityNow();
+ }
+ }, availCheckMillis);
+ this.availabilityCollector.start();
+ }
}
@Override
public void stop() {
logFileEventDelegate.stopLogFileEventPollers();
- lastAvail = null;
+ previousAvailabilityType = null;
+ if (this.availabilityCollector != null) {
+ this.availabilityCollector.stop();
+ this.availabilityCollector = null;
+ }
}
@Override
public AvailabilityType getAvailability() {
- AvailabilityType avail;
+ if (this.availabilityCollector != null) {
+ return this.availabilityCollector.getLastKnownAvailability();
+ } else {
+ return getAvailabilityNow();
+ }
+ }
+
+ private AvailabilityType getAvailabilityNow() {
+ AvailabilityType availabilityType;
try {
readAttribute("launch-type");
- avail = AvailabilityType.UP;
+ availabilityType = AvailabilityType.UP;
} catch (Exception e) {
- avail = AvailabilityType.DOWN;
+ availabilityType = AvailabilityType.DOWN;
}
try {
- if ((avail == AvailabilityType.UP) && (lastAvail !=
AvailabilityType.UP)) {
+ if ((availabilityType == AvailabilityType.UP) &&
(previousAvailabilityType != AvailabilityType.UP)) {
validateServerAttributes();
log.info(getResourceDescription() + " has just come UP.");
}
} finally {
- lastAvail = avail;
+ previousAvailabilityType = availabilityType;
}
- return avail;
+ return availabilityType;
}
private void validateServerAttributes() throws InvalidPluginConfigurationException {
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
index e7fcd5b..4f0ea36 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,11 +13,14 @@
* 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.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.modules.plugins.jbossas7;
+import static
org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration.Property.AVAIL_CHECK_PERIOD_CONFIG_PROP;
+
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
@@ -30,6 +33,8 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable;
+import org.rhq.core.pluginapi.availability.AvailabilityFacet;
import org.rhq.core.pluginapi.event.log.LogFileEventResourceComponentHelper;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -51,6 +56,7 @@ public class ManagedASComponent extends
BaseComponent<HostControllerComponent<?>
private static final String MANAGED_SERVER_TYPE_NAME = "Managed Server";
private LogFileEventResourceComponentHelper logFileEventDelegate;
+ private AvailabilityCollectorRunnable availabilityCollector;
@Override
public void start(ResourceContext<HostControllerComponent<?>>
hostControllerComponentResourceContext)
@@ -59,13 +65,34 @@ public class ManagedASComponent extends
BaseComponent<HostControllerComponent<?>
logFileEventDelegate = new LogFileEventResourceComponentHelper(context);
logFileEventDelegate.startLogFileEventPollers();
+
+ Integer availabilityCheckPeriod = null;
+ try {
+ availabilityCheckPeriod =
pluginConfiguration.getSimple(AVAIL_CHECK_PERIOD_CONFIG_PROP).getIntegerValue();
+ } catch (NumberFormatException e) {
+ log.error("Avail check period config prop was not a valid number. Cause:
" + e);
+ }
+ if (availabilityCheckPeriod != null) {
+ long availCheckMillis = availabilityCheckPeriod * 1000L;
+ this.availabilityCollector =
hostControllerComponentResourceContext.getAvailabilityContext()
+ .createAvailabilityCollectorRunnable(new AvailabilityFacet() {
+ public AvailabilityType getAvailability() {
+ return getAvailabilityNow();
+ }
+ }, availCheckMillis);
+ this.availabilityCollector.start();
+ }
+
}
@Override
public void stop() {
super.stop();
-
logFileEventDelegate.stopLogFileEventPollers();
+ if (this.availabilityCollector != null) {
+ this.availabilityCollector.stop();
+ this.availabilityCollector = null;
+ }
}
/**
@@ -76,6 +103,14 @@ public class ManagedASComponent extends
BaseComponent<HostControllerComponent<?>
*/
@Override
public AvailabilityType getAvailability() {
+ if (this.availabilityCollector != null) {
+ return this.availabilityCollector.getLastKnownAvailability();
+ } else {
+ return getAvailabilityNow();
+ }
+ }
+
+ private AvailabilityType getAvailabilityNow() {
if (context.getResourceType().getName().equals(MANAGED_SERVER_TYPE_NAME)) {
Address theAddress = new Address();
String host = pluginConfiguration.getSimpleValue("domainHost",
"local");
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java
index 1433c17..3832ed2 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/helper/ServerPluginConfiguration.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,14 +13,16 @@
* 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.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.modules.plugins.jbossas7.helper;
import java.io.File;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.modules.plugins.jbossas7.JBossProductType;
/**
@@ -43,6 +45,7 @@ public class ServerPluginConfiguration {
public static final String LOG_DIR = "logDir";
public static final String PRODUCT_TYPE = "productType";
public static final String HOST_CONFIG_FILE = "hostConfigFile";
+ public static final String AVAIL_CHECK_PERIOD_CONFIG_PROP =
"availabilityCheckPeriod";
}
private Configuration pluginConfig;
@@ -143,4 +146,14 @@ public class ServerPluginConfiguration {
hostConfigFile.toString() : null);
}
+ public Integer getAvailabilityCheckPeriod() {
+ PropertySimple propertySimple =
this.pluginConfig.getSimple(Property.AVAIL_CHECK_PERIOD_CONFIG_PROP);
+ return propertySimple == null ? null : propertySimple.getIntegerValue();
+ }
+
+ public void setAvailabilityCheckPeriod(Integer availabilityCheckPeriod) {
+ this.pluginConfig.setSimpleValue(Property.AVAIL_CHECK_PERIOD_CONFIG_PROP,
+ availabilityCheckPeriod == null ? null :
availabilityCheckPeriod.toString());
+ }
+
}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index ad22370..7213acd 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -82,6 +82,17 @@
</c:list-property>
</c:group>
'>
+
+ <!ENTITY availabilityCheckPeriod '
+ <c:simple-property name="availabilityCheckPeriod"
+ description="The amount of time, in seconds, that must
elapse between availability checks to see if the server is up. If set, the availability
checks will be performed asynchronously thus allowing slow-responding servers to avoid
being falsely reported as down. Minimum value is 60 seconds."
+ units="seconds" required="false"
type="integer">
+ <c:constraint>
+ <c:integer-constraint minimum="60"/>
+ </c:constraint>
+ </c:simple-property>
+'>
+
<!ENTITY serverKindMetrics '
<metric property="_skm:release-codename" dataType="trait"
displayName="Server Code Name"/>
<metric property="_skm:release-version" dataType="trait"
displayName="Server Version"/>
@@ -862,6 +873,10 @@
&startScriptPluginConfigGroup;
&logSources;
+
+ <c:group name="advanced" displayName="Advanced"
hiddenByDefault="true">
+ &availabilityCheckPeriod;
+ </c:group>
</plugin-configuration>
<process-scan name="HostController"
query="process|basename|match=^java.*,arg|org.jboss.as.host-controller|match=.*"/>
@@ -1173,6 +1188,10 @@
&startScriptPluginConfigGroup;
&logSources;
+
+ <c:group name="advanced" displayName="Advanced"
hiddenByDefault="true">
+ &availabilityCheckPeriod;
+ </c:group>
</plugin-configuration>
<process-scan name="StandaloneAS"
query="process|basename|match=^java.*,arg|org.jboss.as.standalone|match=.*"/>
@@ -1621,6 +1640,9 @@
<plugin-configuration>
<c:simple-property name="path" readOnly="true"/>
&logSources;
+ <c:group name="advanced" displayName="Advanced"
hiddenByDefault="true">
+ &availabilityCheckPeriod;
+ </c:group>
</plugin-configuration>
<operation name="start" description="Start this server
instance." displayName="Start">
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java
index 43e6e06..8c61c8e 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractJBossAS7PluginTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,11 +13,14 @@
* 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.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.modules.plugins.jbossas7.itest;
+import static org.rhq.core.domain.measurement.AvailabilityType.UP;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.util.Set;
@@ -31,8 +34,10 @@ import org.rhq.core.domain.util.ResourceFilter;
import org.rhq.core.domain.util.ResourceUtility;
import org.rhq.core.domain.util.TypeAndKeyResourceFilter;
import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.plugin.testutil.AbstractAgentPluginTest;
import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration;
import org.rhq.modules.plugins.jbossas7.itest.domain.DomainServerComponentTest;
import org.rhq.modules.plugins.jbossas7.itest.standalone.StandaloneServerComponentTest;
import org.rhq.test.arquillian.AfterDiscovery;
@@ -152,4 +157,26 @@ public abstract class AbstractJBossAS7PluginTest extends
AbstractAgentPluginTest
return serverResource;
}
+ protected void testAsynchronousAvailabilityCheck(Resource resource) throws Exception
{
+ // Activate asynchronous availability checking
+ ServerPluginConfiguration serverPluginConfig = new
ServerPluginConfiguration(resource.getPluginConfiguration());
+ int availabilityCheckPeriod = 65;
+ serverPluginConfig.setAvailabilityCheckPeriod(availabilityCheckPeriod);
+ restartResourceComponent(resource);
+
+ Thread.sleep((3 * availabilityCheckPeriod * 1000L) / 2);
+ assertEquals(getAvailability(resource), UP);
+
+ // Deactivate asynchronous availability checking as subsequent tests may rely on
immediate availabilty checking
+ serverPluginConfig.setAvailabilityCheckPeriod(null);
+ restartResourceComponent(resource);
+ }
+
+ private void restartResourceComponent(Resource resource) throws
PluginContainerException {
+ InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
+ inventoryManager.deactivateResource(resource);
+ ResourceContainer serverContainer =
inventoryManager.getResourceContainer(resource);
+ inventoryManager.activateResource(resource, serverContainer, true);
+ }
+
}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
index 4effd50..91ece92 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,9 +13,10 @@
* 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.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.modules.plugins.jbossas7.itest.domain;
import java.io.File;
@@ -76,14 +77,20 @@ public class DomainServerComponentTest extends
AbstractServerComponentTest {
testServerAttributeValidation();
}
+ @Test(priority = 1002)
+ public void testDomainServerAsynchronousAvailabilityCheck() throws Exception {
+ testAsynchronousAvailabilityCheck(getServerResource());
+ }
+
+
// ******************************* METRICS ******************************* //
- @Test(priority = 1002, enabled = true)
+ @Test(priority = 1003, enabled = true)
public void testDomainReleaseVersionTrait() throws Exception {
super.testReleaseVersionTrait();
}
// ******************************* OPERATIONS ******************************* //
- @Test(priority = 1003, enabled = true)
+ @Test(priority = 1004, enabled = true)
public void testDomainServerShutdownAndStartOperations() throws Exception {
super.testShutdownAndStartOperations();
}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java
index 3f9f101..42bab08 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,11 +13,14 @@
* 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.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package org.rhq.modules.plugins.jbossas7.itest.domain;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
import org.testng.annotations.Test;
import org.rhq.core.clientapi.agent.PluginContainerException;
@@ -32,9 +35,6 @@ import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
import org.rhq.test.arquillian.RunDiscovery;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
/**
* Test dealing with managed servers
* @author Heiko W. Rupp
@@ -45,7 +45,7 @@ public class ManagedServerTest extends AbstractJBossAS7PluginTest {
public static final ResourceType RESOURCE_TYPE = new ResourceType("Managed
Server", PLUGIN_NAME, ResourceCategory.SERVER, null);
private static final String RESOURCE_KEY = "master/server-one";
- @Test(priority = 1020, groups = "discovery", enabled = false)
+ @Test(priority = 1020, groups = "discovery", enabled = true)
@RunDiscovery(discoverServices = true, discoverServers = true)
public void runDiscovery() throws Exception {
Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
@@ -93,6 +93,11 @@ public class ManagedServerTest extends AbstractJBossAS7PluginTest {
assertEquals(avail, AvailabilityType.UP);
}
+ @Test(priority = 1022)
+ public void testManagedServerAsynchronousAvailabilityCheck() throws Exception {
+ testAsynchronousAvailabilityCheck(getResource());
+ }
+
private Resource getResource() {
InventoryManager im = pluginContainer.getInventoryManager();
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
index 9845b03..8446345 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,11 +13,14 @@
* 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.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package org.rhq.modules.plugins.jbossas7.itest.standalone;
+import static org.rhq.core.domain.measurement.AvailabilityType.UP;
+import static org.testng.Assert.assertEquals;
+
import java.io.File;
import java.util.Arrays;
import java.util.List;
@@ -38,8 +41,6 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.modules.plugins.jbossas7.itest.AbstractServerComponentTest;
import org.rhq.test.arquillian.RunDiscovery;
-import static org.testng.Assert.assertEquals;
-
/**
* Test discovery and facets of the "JBossAS7 Standalone Server" Resource
type.
*
@@ -105,20 +106,20 @@ public class StandaloneServerComponentTest extends
AbstractServerComponentTest {
}
// TODO: Re-enable once fixed.
- @Test(priority = 5, dependsOnMethods =
"testStandaloneServerShutdownAndStartOperations", enabled = false)
+ @Test(priority = 6, dependsOnMethods =
"testStandaloneServerShutdownAndStartOperations", enabled = false)
public void testRestartOperation() throws Exception {
// First make sure the server is up.
AvailabilityType avail = getAvailability(getServerResource());
- assertEquals(avail, AvailabilityType.UP);
+ assertEquals(avail, UP);
// Make sure the server is back up.
// TODO (ips): Check that the server is a different process now.
invokeOperationAndAssertSuccess(getServerResource(), RESTART_OPERATION_NAME,
null);
avail = getAvailability(getServerResource());
- assertEquals(avail, AvailabilityType.UP);
+ assertEquals(avail, UP);
}
- @Test(priority = 6, enabled = true)
+ @Test(priority = 7, enabled = true)
public void testSystemPropertiesSettings() throws Exception {
Configuration config = loadResourceConfiguration(getServerResource());
@@ -152,6 +153,11 @@ public class StandaloneServerComponentTest extends
AbstractServerComponentTest {
}
+ @Test(priority = 8)
+ public void testStandaloneServerAsynchronousAvailabilityCheck() throws Exception {
+ testAsynchronousAvailabilityCheck(getServerResource());
+ }
+
protected String getExpectedStartScriptFileName() {
return (File.separatorChar == '/') ? "standalone.sh" :
"standalone.bat";
}