use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class DeploymentManagementTestCase method testDeploymentViaStream.
@Test
public void testDeploymentViaStream() throws Exception {
ModelNode content = new ModelNode();
content.get(INPUT_STREAM_INDEX).set(0);
ModelNode composite = createDeploymentOperation(content, MAIN_SERVER_GROUP_DEPLOYMENT_ADDRESS, OTHER_SERVER_GROUP_DEPLOYMENT_ADDRESS);
OperationBuilder builder = new OperationBuilder(composite, true);
builder.addInputStream(webArchive.as(ZipExporter.class).exportAsInputStream());
executeOnMaster(builder.build());
performHttpCall(DomainTestSupport.masterAddress, 8080);
performHttpCall(DomainTestSupport.slaveAddress, 8630);
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class DeploymentOverlayTestCase method setupDeploymentOverride.
public void setupDeploymentOverride() throws Exception {
ModelNode op = new ModelNode();
op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
executeOnMaster(op);
//add an override that will not be linked via a wildcard
//add the content
op = new ModelNode();
OperationBuilder builder = new OperationBuilder(op, true);
ModelNode addr = new ModelNode();
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
addr.add(ModelDescriptionConstants.CONTENT, "WEB-INF/web.xml");
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
op.get(ModelDescriptionConstants.CONTENT).get(INPUT_STREAM_INDEX).set(0);
builder.addInputStream(getClass().getClassLoader().getResourceAsStream("deploymentoverlay/override.xml"));
executeOnMaster(builder.build());
//add the non-wildcard link to the server group
op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.SERVER_GROUP, "main-server-group");
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
executeOnMaster(op);
op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.SERVER_GROUP, "main-server-group");
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_OVERLAY);
addr.add(ModelDescriptionConstants.DEPLOYMENT, "test.war");
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
executeOnMaster(op);
//add the wildard link
final ModelNode composite = new ModelNode();
final OperationBuilder opBuilder = new OperationBuilder(composite, true);
composite.get(Util.OPERATION).set(Util.COMPOSITE);
composite.get(Util.ADDRESS).setEmptyList();
final ModelNode steps = composite.get(Util.STEPS);
op = new ModelNode();
op.get(ModelDescriptionConstants.OP_ADDR).set(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
steps.add(op);
op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
addr.add(ModelDescriptionConstants.CONTENT, "WEB-INF/web.xml");
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
op.get(ModelDescriptionConstants.CONTENT).get(ModelDescriptionConstants.BYTES).set(FileUtils.readFile(getClass().getClassLoader().getResource("deploymentoverlay/wildcard-override.xml")).getBytes());
steps.add(op);
op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
addr.add(ModelDescriptionConstants.CONTENT, "WEB-INF/classes/wildcard-new-file");
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
op.get(ModelDescriptionConstants.CONTENT).get(ModelDescriptionConstants.INPUT_STREAM_INDEX).set(0);
opBuilder.addInputStream(new ByteArrayInputStream("new file".getBytes()));
steps.add(op);
//add the non-wildcard link to the server group
op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.SERVER_GROUP, "main-server-group");
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
steps.add(op);
op = new ModelNode();
addr = new ModelNode();
addr.add(ModelDescriptionConstants.SERVER_GROUP, "main-server-group");
addr.add(ModelDescriptionConstants.DEPLOYMENT_OVERLAY, TEST_WILDCARD);
addr.add(ModelDescriptionConstants.DEPLOYMENT, "*.war");
op.get(ModelDescriptionConstants.OP_ADDR).set(addr);
op.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
steps.add(op);
executeOnMaster(opBuilder.build());
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class DeploymentOverlayTestCase method testDeploymentOverlayInDomainMode.
/**
* This test creates and links two deployment overlays, does a deployment, and then tests that the overlay has taken effect
* @throws Exception
*/
@Test
public void testDeploymentOverlayInDomainMode() throws Exception {
setupDeploymentOverride();
ModelNode content = new ModelNode();
content.get(INPUT_STREAM_INDEX).set(0);
ModelNode composite = createDeploymentOperation(content, MAIN_SERVER_GROUP_DEPLOYMENT_ADDRESS);
OperationBuilder builder = new OperationBuilder(composite, true);
builder.addInputStream(webArchive.as(ZipExporter.class).exportAsInputStream());
executeOnMaster(builder.build());
DomainClient client = testSupport.getDomainMasterLifecycleUtil().createDomainClient();
Assert.assertEquals("OVERRIDDEN", performHttpCall(client, "master", "main-one", "standard-sockets"));
Assert.assertEquals("OVERRIDDEN", performHttpCall(client, "slave", "main-three", "standard-sockets"));
}
use of org.jboss.as.controller.client.OperationBuilder in project wildfly by wildfly.
the class DeploymentManagementTestCase method testManagedFullReplaceUnmanaged.
@Test
public void testManagedFullReplaceUnmanaged() throws Exception {
// Establish the deployment
testUnmanagedExplodedDeployment();
ModelNode content = new ModelNode();
content.get(INPUT_STREAM_INDEX).set(0);
ModelNode op = createDeploymentFullReplaceOperation(content);
OperationBuilder builder = new OperationBuilder(op, true);
builder.addInputStream(webArchive.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 testFullReplaceViaStream.
@Test
public void testFullReplaceViaStream() 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(webArchive.as(ZipExporter.class).exportAsInputStream());
executeOnMaster(builder.build());
// Thread.sleep(1000);
performHttpCall(DomainTestSupport.masterAddress, 8080);
performHttpCall(DomainTestSupport.slaveAddress, 8630);
}
Aggregations