public abstract class AbstractAgentPluginTest
extends org.jboss.arquillian.testng.Arquillian
| Modifier and Type | Field and Description |
|---|---|
protected org.rhq.core.pc.PluginContainer |
pluginContainer |
protected org.rhq.core.pc.PluginContainerConfiguration |
pluginContainerConfiguration |
protected org.rhq.test.arquillian.MockingServerServices |
serverServices |
| Constructor and Description |
|---|
AbstractAgentPluginTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertOperationSucceeded(String operationName,
org.rhq.core.domain.configuration.Configuration params,
org.rhq.core.pluginapi.operation.OperationResult result) |
protected org.rhq.core.domain.measurement.MeasurementReport |
collectMetric(org.rhq.core.domain.resource.Resource resource,
String metricName)
Collect a metric for a Resource synchronously, with a 7 second timeout.
|
protected String |
collectTrait(org.rhq.core.domain.resource.Resource resource,
String traitName) |
protected void |
executeNoArgOperations(org.rhq.core.domain.resource.Resource rootResource,
List<String> ignoredResources,
List<String> ignoredOperations)
Test that executes all the no arg operations for all the subresources of a provided resource.
|
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 static org.rhq.test.shrinkwrap.RhqAgentPluginArchive |
getPlatformPlugin() |
protected static File |
getPluginJarFile() |
protected abstract String |
getPluginName() |
protected static org.rhq.test.shrinkwrap.RhqAgentPluginArchive |
getPluginUnderTest() |
protected static int |
getResCount(org.rhq.core.domain.resource.Resource resource) |
protected org.rhq.core.domain.resource.Resource |
getResourceByTypeAndKey(org.rhq.core.domain.resource.Resource parent,
org.rhq.core.domain.resource.ResourceType type,
String key,
boolean isCommitted) |
protected org.rhq.test.arquillian.FakeServerInventory |
getServerInventory() |
protected void |
injectMocks(org.rhq.test.arquillian.MockingServerServices serverServices)
Superclass can override this to add additional mocked services to those already
defined in this abstract base class.
|
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 org.rhq.core.pluginapi.operation.OperationResult |
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) |
protected int |
loadUpdateConfigChildResources(org.rhq.core.domain.resource.Resource rootResource,
List<String> ignoredResources)
Test that loads a resource configuration and then immediately updates the resource
with the exact same loaded settings.
|
protected 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) |
protected void |
waitForAsyncDiscoveryToStabilize(org.rhq.core.domain.resource.Resource root)
This waits until the discovered tree size stabilizes.
|
protected void |
waitForAsyncDiscoveryToStabilize(org.rhq.core.domain.resource.Resource root,
long checkInterval,
int stableCount)
This waits until the discovered tree size stabilizes.
|
protected org.rhq.core.domain.resource.Resource |
waitForResourceByTypeAndKey(org.rhq.core.domain.resource.Resource platform,
org.rhq.core.domain.resource.Resource parent,
org.rhq.core.domain.resource.ResourceType type,
String key)
Convenience, same as calling {{waitForResourceByTypeAndKey(platform, parent, type, key, 600)}}.
|
protected org.rhq.core.domain.resource.Resource |
waitForResourceByTypeAndKey(org.rhq.core.domain.resource.Resource platform,
org.rhq.core.domain.resource.Resource parent,
org.rhq.core.domain.resource.ResourceType type,
String key,
int timeoutInSeconds)
A method that looks for a child resource, given the parent, and will wait for the resource to
show up (and be committed) under the parent if it isn't there already - on the assumption that
discovery is still taking place.
|
@ArquillianResource protected org.rhq.test.arquillian.MockingServerServices serverServices
@ArquillianResource protected org.rhq.core.pc.PluginContainerConfiguration pluginContainerConfiguration
@ArquillianResource protected org.rhq.core.pc.PluginContainer pluginContainer
@Deployment(name="platform",
order=1)
protected static org.rhq.test.shrinkwrap.RhqAgentPluginArchive getPlatformPlugin()
throws Exception
Exception@Deployment(name="pluginUnderTest",
order=2)
protected static org.rhq.test.shrinkwrap.RhqAgentPluginArchive getPluginUnderTest()
throws Exception
Exceptionprotected static File getPluginJarFile()
protected void injectMocks(org.rhq.test.arquillian.MockingServerServices serverServices)
serverServices - protected void resetServerServices()
throws Exception
Exception - if an error occursprotected void waitForAsyncDiscoveryToStabilize(org.rhq.core.domain.resource.Resource root)
protected void waitForAsyncDiscoveryToStabilize(org.rhq.core.domain.resource.Resource root,
long checkInterval,
int stableCount)
root - checkInterval - how long between checks of the tree sizestableCount - how many checks must be the same before we're convinced we're stableprotected static int getResCount(org.rhq.core.domain.resource.Resource resource)
protected org.rhq.core.domain.resource.Resource waitForResourceByTypeAndKey(org.rhq.core.domain.resource.Resource platform,
org.rhq.core.domain.resource.Resource parent,
org.rhq.core.domain.resource.ResourceType type,
String key)
protected org.rhq.core.domain.resource.Resource waitForResourceByTypeAndKey(org.rhq.core.domain.resource.Resource platform,
org.rhq.core.domain.resource.Resource parent,
org.rhq.core.domain.resource.ResourceType type,
String key,
int timeoutInSeconds)
parent - type - key - timeoutInSeconds - minimum timeout is 10s.protected org.rhq.core.domain.resource.Resource getResourceByTypeAndKey(org.rhq.core.domain.resource.Resource parent,
org.rhq.core.domain.resource.ResourceType type,
String key,
boolean isCommitted)
@NotNull
protected org.rhq.core.domain.measurement.AvailabilityType getAvailability(org.rhq.core.domain.resource.Resource resource)
throws org.rhq.core.clientapi.agent.PluginContainerException
resource - the Resourceorg.rhq.core.clientapi.agent.PluginContainerException@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
resource - the ResourceoperationName - the name of the operationparams - parameters to pass to the operation; may be null if the operation does not define any parametersorg.rhq.core.clientapi.agent.PluginContainerException@NotNull
protected org.rhq.core.domain.configuration.Configuration loadResourceConfiguration(org.rhq.core.domain.resource.Resource resource)
throws Exception
Exception@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
Exceptionprotected org.rhq.core.pluginapi.operation.OperationResult 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
org.rhq.core.clientapi.agent.PluginContainerExceptionprotected void assertOperationSucceeded(String operationName, org.rhq.core.domain.configuration.Configuration params, org.rhq.core.pluginapi.operation.OperationResult result)
protected abstract String getPluginName()
protected org.rhq.test.arquillian.FakeServerInventory getServerInventory()
protected int loadUpdateConfigChildResources(org.rhq.core.domain.resource.Resource rootResource,
List<String> ignoredResources)
throws InterruptedException,
org.rhq.core.clientapi.agent.PluginContainerException
rootResource - root resourceignoredResources - resources to be ignoredInterruptedExceptionorg.rhq.core.clientapi.agent.PluginContainerExceptionprotected void executeNoArgOperations(org.rhq.core.domain.resource.Resource rootResource,
List<String> ignoredResources,
List<String> ignoredOperations)
throws org.rhq.core.clientapi.agent.PluginContainerException
rootResource - root resourceignoredResources - resources to be ignoredignoredOperations - operations to be ignoredorg.rhq.core.clientapi.agent.PluginContainerException@Nullable protected String collectTrait(org.rhq.core.domain.resource.Resource resource, String traitName) throws Exception
Exception@NotNull
protected org.rhq.core.domain.measurement.MeasurementReport collectMetric(org.rhq.core.domain.resource.Resource resource,
String metricName)
throws Exception
resource - the ResourcemetricName - the name of the metricExceptionCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.