use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class DeploymentManagementTestCase method testFullReplaceDifferentFile.
@Test
public void testFullReplaceDifferentFile() throws Exception {
// Establish the deployment
testDeploymentViaStream();
ModelNode content = new ModelNode();
content.get(INPUT_STREAM_INDEX).set(0);
ModelNode op = createDeploymentFullReplaceOperation(content);
OperationBuilder builder = new OperationBuilder(op, true);
builder.addInputStream(webArchive2.as(ZipExporter.class).exportAsInputStream());
executeOnMaster(builder.build());
//Thread.sleep(1000);
performHttpCall(DomainTestSupport.masterAddress, 8080);
performHttpCall(DomainTestSupport.slaveAddress, 8630);
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class DeploymentManagementTestCase method testUploadStream.
@Test
public void testUploadStream() throws Exception {
ModelNode op = getEmptyOperation(UPLOAD_DEPLOYMENT_STREAM, ROOT_ADDRESS);
op.get(INPUT_STREAM_INDEX).set(0);
OperationBuilder builder = new OperationBuilder(op, true);
builder.addInputStream(webArchive.as(ZipExporter.class).exportAsInputStream());
byte[] hash = executeOnMaster(builder.build()).asBytes();
testDeploymentViaHash(hash);
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class BadResourceTestCase method testBadDU.
@Test
public void testBadDU() throws Exception {
final ModelNode deployOp = new ModelNode();
deployOp.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.DEPLOY);
deployOp.get(ModelDescriptionConstants.ADDRESS).add(ModelDescriptionConstants.DEPLOYMENT, Constants.TESTED_DU_NAME);
deployOp.get(ModelDescriptionConstants.ENABLED).set(true);
final OperationBuilder ob = new OperationBuilder(deployOp, true);
final ModelNode result = controllerClient.execute(ob.build());
// just to blow up
Assert.assertTrue("Failed to deploy: " + result, !Operations.isSuccessfulOutcome(result));
Assert.assertTrue("" + result, result.get(ModelDescriptionConstants.FAILURE_DESCRIPTION).toString().contains(Constants.ERROR_MESSAGE));
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class MDBEJBRuntimeNameTestsCase method setup.
@Before
public void setup() throws Exception {
adminSupport = JMSOperationsProvider.getInstance(managementClient);
//Remote JMS - bind name... to make it available remotely, lookup original name.
adminSupport.createJmsQueue(QUEUE_NAME, "java:jboss/exported/" + Constants.QUEUE_JNDI_NAME);
JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, SUB_DEPLOYMENT_NAME);
ejbJar.addPackage(BEAN_PACKAGE);
ejbJar.setManifest(new StringAsset(Descriptors.create(ManifestDescriptor.class).attribute("Dependencies", "org.apache.activemq.artemis.ra").exportAsString()));
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 = managementClient.getControllerClient().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 ServletRuntimeNameTestCase method setup.
@BeforeClass
public static void setup() throws Exception {
WebArchive war = ShrinkWrap.create(WebArchive.class, SUB_DEPLOYMENT_NAME);
war.addClass(SERVLET_CLASS);
EnterpriseArchive earArchive = ShrinkWrap.create(EnterpriseArchive.class, DEPLOYMENT_NAME);
earArchive.addAsModule(war);
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));
}
Aggregations