org.rhq.core.plugin.testutil
Class AbstractAgentPluginTest
java.lang.Object
org.jboss.arquillian.testng.Arquillian
org.rhq.core.plugin.testutil.AbstractAgentPluginTest
- All Implemented Interfaces:
- org.testng.IHookable, org.testng.ITestNGListener
public abstract class AbstractAgentPluginTest
- extends org.jboss.arquillian.testng.Arquillian
The base class for an Agent plugin integration test class.
- Author:
- Ian Springer
| Fields inherited from class org.jboss.arquillian.testng.Arquillian |
ARQUILLIAN_DATA_PROVIDER |
|
Method Summary |
protected void |
assertAllNumericMetricsAndTraitsHaveNonNullValues(Map<org.rhq.core.domain.resource.ResourceType,String[]> excludedMetricNamesByType)
|
protected void |
assertAllResourceComponentsStarted()
|
protected void |
assertAllResourceConfigsLoad()
|
protected void |
assertOperationSucceeded(String operationName,
org.rhq.core.domain.configuration.Configuration params,
org.rhq.core.pluginapi.operation.OperationResult result)
|
protected Double |
collectNumericMetric(org.rhq.core.domain.resource.Resource resource,
String metricName)
|
protected String |
collectTrait(org.rhq.core.domain.resource.Resource resource,
String traitName)
|
protected org.rhq.core.domain.measurement.AvailabilityType |
getAvailability(org.rhq.core.domain.resource.Resource resource)
Get availability for a Resource synchronously, with a 5 second timeout. |
protected Set<String> |
getMetricsWithNullValues(org.rhq.core.domain.resource.Resource resource,
Set<org.rhq.core.domain.measurement.MeasurementDefinition> metricDefs)
|
protected Set<String> |
getNumericMetricsAndTraitsWithNullValues(org.rhq.core.domain.resource.Resource resource)
|
static org.rhq.test.shrinkwrap.RhqAgentPluginArchive |
getPlatformPlugin()
|
protected static File |
getPluginJarFile()
|
protected abstract String |
getPluginName()
|
static org.rhq.test.shrinkwrap.RhqAgentPluginArchive |
getPluginUnderTest()
|
protected org.rhq.test.arquillian.FakeServerInventory |
getServerInventory()
|
protected abstract int |
getTypeHierarchyDepth()
|
protected org.rhq.core.pluginapi.operation.OperationResult |
invokeOperation(org.rhq.core.domain.resource.Resource resource,
String operationName,
org.rhq.core.domain.configuration.Configuration params)
Execute an operation on a Resource synchronously, with the same timeout that the PC would use. |
protected void |
invokeOperationAndAssertSuccess(org.rhq.core.domain.resource.Resource resource,
String operationName,
org.rhq.core.domain.configuration.Configuration params)
|
protected org.rhq.core.domain.configuration.Configuration |
loadResourceConfiguration(org.rhq.core.domain.resource.Resource resource)
|
void |
resetServerServices()
Set up our fake server discovery ServerService, which will auto-import all Resources in reports it receives. |
protected org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport |
updateResourceConfiguration(org.rhq.core.domain.resource.Resource resource,
org.rhq.core.domain.configuration.Configuration resourceConfig)
|
void |
waitForAsyncDiscoveries()
|
| Methods inherited from class org.jboss.arquillian.testng.Arquillian |
arquillianAfterClass, arquillianAfterSuite, arquillianAfterTest, arquillianArgumentProvider, arquillianBeforeClass, arquillianBeforeSuite, arquillianBeforeTest, run |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serverServices
@ArquillianResource
protected org.rhq.test.arquillian.MockingServerServices serverServices
pluginContainerConfiguration
@ArquillianResource
protected org.rhq.core.pc.PluginContainerConfiguration pluginContainerConfiguration
pluginContainer
@ArquillianResource
protected org.rhq.core.pc.PluginContainer pluginContainer
AbstractAgentPluginTest
public AbstractAgentPluginTest()
getPlatformPlugin
@Deployment(name="platform",
order=1)
public static org.rhq.test.shrinkwrap.RhqAgentPluginArchive getPlatformPlugin()
throws Exception
- Throws:
Exception
getPluginUnderTest
@Deployment(name="pluginUnderTest",
order=2)
public static org.rhq.test.shrinkwrap.RhqAgentPluginArchive getPluginUnderTest()
throws Exception
- Throws:
Exception
getPluginJarFile
protected static File getPluginJarFile()
resetServerServices
public void resetServerServices()
throws Exception
- Set up our fake server discovery ServerService, which will auto-import all Resources in reports it receives.
- Throws:
Exception - if an error occurs
getTypeHierarchyDepth
protected abstract int getTypeHierarchyDepth()
waitForAsyncDiscoveries
public void waitForAsyncDiscoveries()
throws Exception
- Throws:
Exception
getAvailability
@NotNull
protected org.rhq.core.domain.measurement.AvailabilityType getAvailability(org.rhq.core.domain.resource.Resource resource)
throws org.rhq.core.clientapi.agent.PluginContainerException
- Get availability for a Resource synchronously, with a 5 second timeout.
- Parameters:
resource - the Resource
- Returns:
- the report containing the collected data
- Throws:
org.rhq.core.clientapi.agent.PluginContainerException
invokeOperation
@NotNull
protected org.rhq.core.pluginapi.operation.OperationResult invokeOperation(org.rhq.core.domain.resource.Resource resource,
String operationName,
@Nullable
org.rhq.core.domain.configuration.Configuration params)
throws org.rhq.core.clientapi.agent.PluginContainerException
- Execute an operation on a Resource synchronously, with the same timeout that the PC would use.
- Parameters:
resource - the ResourceoperationName - the name of the operationparams - parameters to pass to the operation; may be null if the operation does not define any parameters
- Returns:
- the result of the operation
- Throws:
org.rhq.core.clientapi.agent.PluginContainerException
loadResourceConfiguration
@NotNull
protected org.rhq.core.domain.configuration.Configuration loadResourceConfiguration(org.rhq.core.domain.resource.Resource resource)
throws Exception
- Throws:
Exception
updateResourceConfiguration
@NotNull
protected org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport updateResourceConfiguration(org.rhq.core.domain.resource.Resource resource,
org.rhq.core.domain.configuration.Configuration resourceConfig)
throws Exception
- Throws:
Exception
assertAllResourceComponentsStarted
protected void assertAllResourceComponentsStarted()
throws Exception
- Throws:
Exception
assertAllResourceConfigsLoad
protected void assertAllResourceConfigsLoad()
throws Exception
- Throws:
Exception
assertAllNumericMetricsAndTraitsHaveNonNullValues
protected void assertAllNumericMetricsAndTraitsHaveNonNullValues(Map<org.rhq.core.domain.resource.ResourceType,String[]> excludedMetricNamesByType)
throws Exception
- Throws:
Exception
getNumericMetricsAndTraitsWithNullValues
protected Set<String> getNumericMetricsAndTraitsWithNullValues(org.rhq.core.domain.resource.Resource resource)
throws Exception
- Throws:
Exception
getMetricsWithNullValues
protected Set<String> getMetricsWithNullValues(org.rhq.core.domain.resource.Resource resource,
Set<org.rhq.core.domain.measurement.MeasurementDefinition> metricDefs)
throws Exception
- Throws:
Exception
collectNumericMetric
@Nullable
protected Double collectNumericMetric(org.rhq.core.domain.resource.Resource resource,
String metricName)
throws Exception
- Throws:
Exception
collectTrait
@Nullable
protected String collectTrait(org.rhq.core.domain.resource.Resource resource,
String traitName)
throws Exception
- Throws:
Exception
invokeOperationAndAssertSuccess
protected void invokeOperationAndAssertSuccess(org.rhq.core.domain.resource.Resource resource,
String operationName,
@Nullable
org.rhq.core.domain.configuration.Configuration params)
throws org.rhq.core.clientapi.agent.PluginContainerException
- Throws:
org.rhq.core.clientapi.agent.PluginContainerException
assertOperationSucceeded
protected void assertOperationSucceeded(String operationName,
org.rhq.core.domain.configuration.Configuration params,
org.rhq.core.pluginapi.operation.OperationResult result)
getPluginName
protected abstract String getPluginName()
getServerInventory
protected org.rhq.test.arquillian.FakeServerInventory getServerInventory()
Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.