op.get(OP).set(enable? "enable" : "disable");
op.get(OP_ADDR).add("subsystem", "datasources").add("data-source", "H2DS");
if (!enable) {
op.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true);
}
ModelController controller = (ModelController)serviceContainer.getRequiredService(Services.JBOSS_SERVER_CONTROLLER).getValue();
System.out.println("toggle " + enable + ":" + op);
ModelNode result = controller.execute(op, OperationMessageHandler.logging, OperationTransactionControl.COMMIT, null);
if (expectFailure) {
System.out.println("Expected failure " + result.get(FAILURE_DESCRIPTION).asString());
Assert.assertEquals(FAILED, result.get(OUTCOME).asString());
} else {
Assert.assertEquals(result.get(FAILURE_DESCRIPTION).asString(), SUCCESS, result.get(OUTCOME).asString());