public class ModelTestUtils extends Object
Constructor and Description |
---|
ModelTestUtils() |
Modifier and Type | Method and Description |
---|---|
static org.jboss.dmr.ModelNode |
checkFailed(org.jboss.dmr.ModelNode result)
Checks that the operation failes
|
static void |
checkFailedTransformedBootOperations(ModelTestKernelServices<?> mainServices,
ModelVersion modelVersion,
List<org.jboss.dmr.ModelNode> operations,
FailedOperationTransformationConfig config)
A standard test for transformers where things should be rejected.
|
static void |
checkModelAgainstDefinition(org.jboss.dmr.ModelNode model,
ManagementResourceRegistration rr) |
static org.jboss.dmr.ModelNode |
checkOutcome(org.jboss.dmr.ModelNode result)
Checks that the result was successful
|
static org.jboss.dmr.ModelNode |
checkResultAndGetContents(org.jboss.dmr.ModelNode result)
Checks that the result was successful and gets the real result contents
|
static void |
compare(org.jboss.dmr.ModelNode node1,
org.jboss.dmr.ModelNode node2)
Compares two models to make sure that they are the same
|
static void |
compare(org.jboss.dmr.ModelNode node1,
org.jboss.dmr.ModelNode node2,
boolean ignoreUndefined)
Compares two models to make sure that they are the same
|
static void |
compareXml(String original,
String marshalled)
Validate the marshalled xml without adjusting the namespaces for the original and marshalled xml.
|
static void |
compareXml(String original,
String marshalled,
boolean ignoreNamespace)
Validate the marshalled xml without adjusting the namespaces for the original and marshalled xml.
|
static org.jboss.dmr.ModelNode |
getSubModel(org.jboss.dmr.ModelNode model,
PathAddress pathAddress) |
static org.jboss.dmr.ModelNode |
getSubModel(org.jboss.dmr.ModelNode model,
PathElement pathElement) |
static String |
normalizeXML(String xml)
Normalize and pretty-print XML so that it can be compared using string
compare.
|
static String |
readResource(Class<?> clazz,
String name)
Read the classpath resource with the given name and return its contents as a string.
|
static void |
resolveAndCompareModels(org.jboss.dmr.ModelNode node1,
org.jboss.dmr.ModelNode node2)
Resolve two models and compare them to make sure that they have same
content after expression resolution
|
static void |
scanForExpressionFormattedStrings(org.jboss.dmr.ModelNode model)
Scans for entries of type STRING containing expression formatted strings.
|
static void |
validateModelDescriptions(PathAddress address,
ImmutableManagementResourceRegistration reg) |
public static String readResource(Class<?> clazz, String name) throws IOException
Class.getResource(String)
name
- the name of the resourceIOException
public static org.jboss.dmr.ModelNode checkResultAndGetContents(org.jboss.dmr.ModelNode result)
result
- the result to checkpublic static org.jboss.dmr.ModelNode checkOutcome(org.jboss.dmr.ModelNode result)
result
- the result to checkpublic static org.jboss.dmr.ModelNode checkFailed(org.jboss.dmr.ModelNode result)
result
- the result to checkpublic static void validateModelDescriptions(PathAddress address, ImmutableManagementResourceRegistration reg)
public static void compare(org.jboss.dmr.ModelNode node1, org.jboss.dmr.ModelNode node2)
node1
- the first modelnode2
- the second modelpublic static void resolveAndCompareModels(org.jboss.dmr.ModelNode node1, org.jboss.dmr.ModelNode node2)
node1
- the first modelnode2
- the second modelpublic static void compare(org.jboss.dmr.ModelNode node1, org.jboss.dmr.ModelNode node2, boolean ignoreUndefined)
node1
- the first modelnode2
- the second modelignoreUndefined
- true
if keys containing undefined nodes should be ignoredpublic static String normalizeXML(String xml) throws Exception
xml
- The XML to be normalizedException
public static void compareXml(String original, String marshalled) throws Exception
original
- the original subsystem xmlmarshalled
- the marshalled subsystem xmlException
public static void compareXml(String original, String marshalled, boolean ignoreNamespace) throws Exception
original
- 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.Exception
public static org.jboss.dmr.ModelNode getSubModel(org.jboss.dmr.ModelNode model, PathElement pathElement)
public static org.jboss.dmr.ModelNode getSubModel(org.jboss.dmr.ModelNode model, PathAddress pathAddress)
public static void scanForExpressionFormattedStrings(org.jboss.dmr.ModelNode model)
model
- the model to checkpublic static void checkModelAgainstDefinition(org.jboss.dmr.ModelNode model, ManagementResourceRegistration rr)
public static void checkFailedTransformedBootOperations(ModelTestKernelServices<?> mainServices, ModelVersion modelVersion, List<org.jboss.dmr.ModelNode> operations, FailedOperationTransformationConfig config) throws OperationFailedException
mainServices
- The main controller servicesmodelVersion
- The version of the legacy controlleroperations
- the operationsconfig
- the configOperationFailedException
Copyright © 2023 JBoss by Red Hat. All rights reserved.