public abstract class AbstractSubsystemTest extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
mainSubsystemName |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSubsystemTest(String mainSubsystemName,
Extension mainExtension) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertRemoveSubsystemResources(KernelServices kernelServices)
Checks that the subystem resources can be removed, i.e.
|
protected void |
assertRemoveSubsystemResources(KernelServices kernelServices,
Set<PathAddress> ignoredChildAddresses)
Checks that the subystem resources can be removed, i.e.
|
protected static org.jboss.dmr.ModelNode |
checkResultAndGetContents(org.jboss.dmr.ModelNode result)
Checks that the result was successful and gets the real result contents
|
void |
cleanup() |
protected void |
compare(org.jboss.dmr.ModelNode node1,
org.jboss.dmr.ModelNode node2)
Compares two models to make sure that they are the same
|
protected void |
compareXml(String configId,
String original,
String marshalled)
Validate the marshalled xml without adjusting the namespaces for the original and marshalled xml.
|
protected void |
compareXml(String configId,
String original,
String marshalled,
boolean ignoreNamespace)
Validate the marshalled xml without adjusting the namespaces for the original and marshalled xml.
|
protected Extension |
getMainExtension() |
String |
getMainSubsystemName() |
protected ProcessType |
getProcessType()
Gets the ProcessType to use.
|
protected Resource |
grabRootResource(KernelServices kernelServices)
Grabs the current root resource
|
void |
initializeParser() |
protected KernelServices |
installInController(AdditionalInitialization additionalInit,
List<org.jboss.dmr.ModelNode> bootOperations)
Create a new controller with the passed in operations.
|
protected KernelServices |
installInController(AdditionalInitialization additionalInit,
String subsystemXml)
Initializes the controller and populates the subsystem model from the passed in xml.
|
protected KernelServices |
installInController(List<org.jboss.dmr.ModelNode> bootOperations)
Create a new controller with the passed in operations.
|
protected KernelServices |
installInController(String subsystemXml)
Initializes the controller and populates the subsystem model from the passed in xml.
|
protected String |
normalizeXML(String xml)
Normalize and pretty-print XML so that it can be compared using string
compare.
|
protected String |
outputModel(org.jboss.dmr.ModelNode model)
Output the model to xml
|
protected List<org.jboss.dmr.ModelNode> |
parse(AdditionalParsers additionalParsers,
String subsystemXml)
Parse the subsystem xml and create the operations that will be passed into the controller
|
protected List<org.jboss.dmr.ModelNode> |
parse(String subsystemXml)
Parse the subsystem xml and create the operations that will be passed into the controller
|
protected String |
readResource(String name)
Read the classpath resource with the given name and return its contents as a string.
|
protected final String mainSubsystemName
public String getMainSubsystemName()
protected Extension getMainExtension()
protected String readResource(String name) throws IOException
name - the name of the resourceIOExceptionprotected List<org.jboss.dmr.ModelNode> parse(String subsystemXml) throws XMLStreamException
subsystemXml - the subsystem xml to be parsedXMLStreamException - if there is a parsing problemprotected List<org.jboss.dmr.ModelNode> parse(AdditionalParsers additionalParsers, String subsystemXml) throws XMLStreamException
additionalParsers - additional initialization that should be done to the parsers before initializing our extension. These parsers
will only be initialized the first time this method is called from within a testsubsystemXml - the subsystem xml to be parsedXMLStreamException - if there is a parsing problemprotected String outputModel(org.jboss.dmr.ModelNode model) throws Exception
model - the model to marshallExceptionprotected KernelServices installInController(String subsystemXml) throws Exception
subsystemXml - the subsystem xml to be parsedExceptionprotected KernelServices installInController(AdditionalInitialization additionalInit, String subsystemXml) throws Exception
additionalInit - Additional initialization that should be done to the parsers, controller and service container before initializing our extensionsubsystemXml - the subsystem xml to be parsedExceptionprotected KernelServices installInController(List<org.jboss.dmr.ModelNode> bootOperations) throws Exception
bootOperations - the operationsExceptionprotected KernelServices installInController(AdditionalInitialization additionalInit, List<org.jboss.dmr.ModelNode> bootOperations) throws Exception
additionalInit - Additional initialization that should be done to the parsers, controller and service container before initializing our extensionbootOperations - the operationsExceptionprotected ProcessType getProcessType()
ProcessType.EMBEDDED_SERVERprotected static org.jboss.dmr.ModelNode checkResultAndGetContents(org.jboss.dmr.ModelNode result)
result - the result to checkprotected void assertRemoveSubsystemResources(KernelServices kernelServices)
kernelServices - the kernel services used to access the controllerprotected void assertRemoveSubsystemResources(KernelServices kernelServices, Set<PathAddress> ignoredChildAddresses)
kernelServices - the kernel services used to access the controllerignoredChildAddresses - child addresses that should not be removed, they are managed by one of the parent resources.
This set cannot contain the subsystem resource itselfprotected Resource grabRootResource(KernelServices kernelServices)
kernelServices - the kernel services used to access the controllerprotected void compare(org.jboss.dmr.ModelNode node1,
org.jboss.dmr.ModelNode node2)
node1 - the first modelnode2 - the second modeljunit.framework.AssertionFailedError - if the models were not the sameprotected String normalizeXML(String xml) throws Exception
xml - The XML to be normalizedExceptionprotected void compareXml(String configId, String original, String marshalled) throws Exception
configId - the id of the xml configurationoriginal - the original subsystem xmlmarshalled - the marshalled subsystem xmlExceptionprotected void compareXml(String configId, String original, String marshalled, boolean ignoreNamespace) throws Exception
configId - TODOoriginal - the original subsystem xmlmarshalled - the marshalled subsystem xmlignoreNamespace - if true the subsystem's namespace is ignored, otherwise it is taken into account when comparing the normalized xml.ExceptionCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.