Operation extends ModelNode { @JsIgnore public Operation runAs(Set<String> runAs) { return new Operation(name, address, parameter, header, newHashSet(runAs)); } @JsIgnore  Operation(ModelNode modelNode);   Operation(String name, ResourceAddress address, ModelNode parameter, ModelNode header, Set<String> roles); @JsProperty String getName(); @JsProperty ResourceAddress getAddress(); @JsProperty ModelNode getParameter(); @JsProperty ModelNode getHeader(); @JsIgnore boolean hasParameter(); @JsIgnore Set<String> getRoles(); @JsIgnore Operation runAs(Set<String> runAs); @Override String toString(); String asCli();  }
@Test public void runAs() throws Exception { ResourceAddress address = new ResourceAddress() .add("subsystem", "datasources") .add("data-source", "foo"); Operation operation = new Operation.Builder(address, ADD) .param(JNDI_NAME, "java:/bar") .header("header1", "value1") .build(); assertOperation(operation.runAs(Collections.singleton("Administrator")), "Administrator"); }