@Override
public void execute(OperationContext context, ModelNode operation) {
context.completeStep();
}
},
new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
ModelNode node = new ModelNode();
node.get(OPERATION_NAME).set("Test");
return node;
}
},
true);
rootRegistration.registerOperationHandler("setup", new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
ModelNode proxyModel = new ModelNode();
proxyModel.get("serverchild", "svrA", "name").set("serverA");
proxyModel.get("serverchild", "svrA", "child", "childA", "name").set("childName");
proxyModel.get("serverchild", "svrA", "child", "childA", "value").set("childValue");
AbstractControllerTestBase.createModel(context, proxyModel);
context.completeStep();
}
}, new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
return new ModelNode();
}
}, false, OperationEntry.EntryType.PRIVATE);
ManagementResourceRegistration serverReg = rootRegistration.registerSubModel(PathElement.pathElement("serverchild", "*"), new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
ModelNode node = new ModelNode();
node.get(DESCRIPTION).set("A server child");
node.get(ATTRIBUTES, NAME, TYPE).set(ModelType.STRING);
node.get(ATTRIBUTES, NAME, DESCRIPTION).set("The name of the server child");
node.get(ATTRIBUTES, NAME, REQUIRED).set(true);
node.get(ATTRIBUTES, NAME, MIN_LENGTH).set(1);
node.get(CHILDREN, "child", DESCRIPTION).set("The children of the server child");
node.get(CHILDREN, "child", MIN_OCCURS).set(1);
node.get(CHILDREN, "child", MODEL_DESCRIPTION);
return node;
}
});
ManagementResourceRegistration serverChildReg = serverReg.registerSubModel(PathElement.pathElement("child", "*"), new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
ModelNode node = new ModelNode();
node.get(DESCRIPTION).set("A named set of children");
node.get(ATTRIBUTES, NAME, TYPE).set(ModelType.STRING);
node.get(ATTRIBUTES, NAME, DESCRIPTION).set("The name of the child");
node.get(ATTRIBUTES, NAME, REQUIRED).set(true);
node.get(ATTRIBUTES, NAME, MIN_LENGTH).set(1);
node.get(ATTRIBUTES, VALUE, TYPE).set(ModelType.STRING);
node.get(ATTRIBUTES, VALUE, DESCRIPTION).set("The value of the child");
node.get(ATTRIBUTES, VALUE, REQUIRED).set(true);
node.get(ATTRIBUTES, VALUE, MIN_LENGTH).set(1);
return node;
}
});
serverChildReg.registerReadWriteAttribute("value", null, new WriteAttributeHandlers.ModelTypeValidatingHandler(ModelType.STRING), AttributeAccess.Storage.CONFIGURATION);
serverChildReg.registerMetric("metric", GlobalOperationsTestCase.TestMetricHandler.INSTANCE);
serverChildReg.registerOperationHandler("test-op",
new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) {
return;
}
},
new DescriptionProvider() {
@Override
public ModelNode getModelDescription(Locale locale) {
ModelNode node = new ModelNode();
node.get(OPERATION_NAME).set("test-op");
node.get(REQUEST_PROPERTIES).setEmptyObject();