use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class StatefulEJBRemoteHomeRuntimeNameTestCase method setup.
@BeforeClass
public static void setup() throws Exception {
context = getInitialContext();
JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, SUB_DEPLOYMENT_NAME);
ejbJar.addPackage(BEAN_PACKAGE);
ejbJar.addClass(BEAN_CLASS);
EnterpriseArchive earArchive = ShrinkWrap.create(EnterpriseArchive.class, DEPLOYMENT_NAME);
earArchive.addAsModule(ejbJar);
ModelNode addDeploymentOp = new ModelNode();
addDeploymentOp.get(ModelDescriptionConstants.ADDRESS).add(ModelDescriptionConstants.DEPLOYMENT, DEPLOYMENT_NAME);
addDeploymentOp.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
addDeploymentOp.get(ModelDescriptionConstants.CONTENT).get(0).get(ModelDescriptionConstants.INPUT_STREAM_INDEX).set(0);
addDeploymentOp.get(ModelDescriptionConstants.RUNTIME_NAME).set(RT_NAME);
addDeploymentOp.get(ModelDescriptionConstants.AUTO_START).set(true);
ModelNode deployOp = new ModelNode();
deployOp.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.DEPLOY);
deployOp.get(ModelDescriptionConstants.ADDRESS).add(ModelDescriptionConstants.DEPLOYMENT, DEPLOYMENT_NAME);
deployOp.get(ModelDescriptionConstants.ENABLED).set(true);
ModelNode[] steps = new ModelNode[2];
steps[0] = addDeploymentOp;
steps[1] = deployOp;
ModelNode compositeOp = ModelUtil.createCompositeNode(steps);
OperationBuilder ob = new OperationBuilder(compositeOp, true);
ob.addInputStream(earArchive.as(ZipExporter.class).exportAsInputStream());
ModelNode result = controllerClient.execute(ob.build());
// just to blow up
Assert.assertTrue("Failed to deploy: " + result, Operations.isSuccessfulOutcome(result));
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class WSAttributesChangesTestCase method getAttribute.
private String getAttribute(final String attribute, final ModelControllerClient client, final boolean checkDefined) throws Exception {
ModelNode op = createOpNode("subsystem=webservices/", READ_ATTRIBUTE_OPERATION);
op.get(NAME).set(attribute);
final ModelNode result = client.execute(new OperationBuilder(op).build());
if (result.hasDefined(OUTCOME) && SUCCESS.equals(result.get(OUTCOME).asString())) {
if (checkDefined) {
Assert.assertTrue(result.hasDefined(RESULT));
}
return result.get(RESULT).asString();
} else if (result.hasDefined(FAILURE_DESCRIPTION)) {
throw new Exception(result.get(FAILURE_DESCRIPTION).toString());
} else {
throw new Exception("Operation not successful; outcome = " + result.get(OUTCOME));
}
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class ReloadRequiringChangesTestCase method applyUpdate.
private static ModelNode applyUpdate(final ModelControllerClient client, final ModelNode update) throws Exception {
final ModelNode result = client.execute(new OperationBuilder(update).build());
if (result.hasDefined(OUTCOME) && SUCCESS.equals(result.get(OUTCOME).asString())) {
Assert.assertTrue(result.hasDefined(RESPONSE_HEADERS));
ModelNode responseHeaders = result.get(RESPONSE_HEADERS);
Assert.assertTrue(responseHeaders.hasDefined(OPERATION_REQUIRES_RELOAD));
Assert.assertEquals("true", responseHeaders.get(OPERATION_REQUIRES_RELOAD).asString());
return result;
} else if (result.hasDefined(FAILURE_DESCRIPTION)) {
throw new Exception(result.get(FAILURE_DESCRIPTION).toString());
} else {
throw new Exception("Operation not successful; outcome = " + result.get(OUTCOME));
}
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class ReloadRequiringChangesTestCase method getWsdlHost.
private String getWsdlHost(final ModelControllerClient client) throws Exception {
ModelNode op = createOpNode("subsystem=webservices/", READ_ATTRIBUTE_OPERATION);
op.get(NAME).set("wsdl-host");
final ModelNode result = client.execute(new OperationBuilder(op).build());
if (result.hasDefined(OUTCOME) && SUCCESS.equals(result.get(OUTCOME).asString())) {
Assert.assertTrue(result.hasDefined(RESULT));
return result.get(RESULT).asString();
} else if (result.hasDefined(FAILURE_DESCRIPTION)) {
throw new Exception(result.get(FAILURE_DESCRIPTION).toString());
} else {
throw new Exception("Operation not successful; outcome = " + result.get(OUTCOME));
}
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class MixedDomainDeploymentTest method testDeploymentViaStream.
@Test
public void testDeploymentViaStream() throws Exception {
ModelNode content = new ModelNode();
content.get(INPUT_STREAM_INDEX).set(0);
ModelNode composite = createDeploymentOperation(content, OTHER_SERVER_GROUP_DEPLOYMENT_ADDRESS, MAIN_SERVER_GROUP_DEPLOYMENT_ADDRESS);
OperationBuilder builder = new OperationBuilder(composite, true);
builder.addInputStream(webArchive.as(ZipExporter.class).exportAsInputStream());
executeOnMaster(builder.build());
performHttpCall(DomainTestSupport.slaveAddress, 8080);
}
Aggregations