use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class WSAttributesChangesTestCase method performWsdlPortAttributeTest.
private void performWsdlPortAttributeTest(boolean checkUpdateWithDeployedEndpoint) throws Exception {
Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "remote+http");
ModelControllerClient client = managementClient.getControllerClient();
try {
final String portA = "55667";
ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
op.get(NAME).set("wsdl-port");
op.get(VALUE).set(portA);
// update successful, no need to reload
applyUpdate(client, op, false);
// now we deploy an endpoint...
deployer.deploy(DEP_2);
// verify the updated wsdl port is used...
URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEP_2 + "/POJOService?wsdl");
checkWsdl(wsdlURL, portA);
if (checkUpdateWithDeployedEndpoint) {
final String portB = "55668";
ModelNode opB = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
opB.get(NAME).set("wsdl-port");
opB.get(VALUE).set(portB);
// update again, but we'll need to reload, as there's an active deployment
applyUpdate(client, opB, true);
// check the wsdl port is still the one we updated to before
checkWsdl(wsdlURL, portA);
// and check that still applies even if we undeploy and redeploy the endpoint
deployer.undeploy(DEP_2);
deployer.deploy(DEP_2);
checkWsdl(wsdlURL, portA);
}
} finally {
try {
deployer.undeploy(DEP_2);
} catch (Throwable t) {
// ignore
}
try {
ModelNode op = createOpNode("subsystem=webservices/", UNDEFINE_ATTRIBUTE_OPERATION);
op.get(NAME).set("wsdl-port");
applyUpdate(client, op, checkUpdateWithDeployedEndpoint);
} finally {
managementClient.close();
}
}
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class CustomUndertowFilterTestCase method prepareServerConfiguration.
private static void prepareServerConfiguration() throws Exception {
// create a (JBoss) module jar containing the custom http handler and a dummy class that gets used
// by the handler
customHandlerModule = createModule();
// create a custom-filter in the undertow subsystem and use the filter class that's
// present in the module that we just created
final ModelNode addCustomFilter = ModelUtil.createOpNode("subsystem=undertow/configuration=filter" + "/custom-filter=" + CUSTOM_FILTER_RESOURCE_NAME, "add");
addCustomFilter.get("class-name").set(CUSTOM_FILTER_CLASSNAME);
addCustomFilter.get("module").set(CUSTOM_FILTER_MODULE_NAME);
// add a reference to this custom filter, in the default undertow host, so that it gets used
// for all deployed applications on this host
final ModelNode addFilterRef = ModelUtil.createOpNode("subsystem=undertow/server=default-server/host=default-host" + "/filter-ref=" + CUSTOM_FILTER_RESOURCE_NAME, "add");
final ModelControllerClient controllerClient = serverController.getClient().getControllerClient();
ManagementOperations.executeOperation(controllerClient, ModelUtil.createCompositeNode(new ModelNode[] { addCustomFilter, addFilterRef }));
// reload the server for changes to take effect
serverController.reload();
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class CustomUndertowFilterTestCase method resetServerConfiguration.
private static void resetServerConfiguration() throws Exception {
// remove the filter-ref
final ModelNode removeFilterRef = ModelUtil.createOpNode("subsystem=undertow/server=default-server/host=default-host" + "/filter-ref=" + CUSTOM_FILTER_RESOURCE_NAME, "remove");
// remove the custom undertow filter
final ModelNode removeCustomFilter = ModelUtil.createOpNode("subsystem=undertow/configuration=filter" + "/custom-filter=" + CUSTOM_FILTER_RESOURCE_NAME, "remove");
final ModelControllerClient controllerClient = serverController.getClient().getControllerClient();
ManagementOperations.executeOperation(controllerClient, ModelUtil.createCompositeNode(new ModelNode[] { removeFilterRef, removeCustomFilter }));
// remove the custom module
customHandlerModule.remove();
// reload the server
serverController.reload();
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class CredentialStoreServerSetupTask method setup.
@Override
public void setup(ManagementClient managementClient, String s) throws Exception {
final ModelControllerClient client = managementClient.getControllerClient();
createCredentialStore(client);
createAlias(client);
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class DomainHostExcludesTest method setup.
/**
* Subclasses call from a @BeforeClass method
*/
protected static void setup(Class<?> clazz, String hostRelease, ModelVersion slaveApiVersion) throws IOException, MgmtOperationException, TimeoutException, InterruptedException {
version = clazz.getAnnotation(Version.class).value();
testSupport = MixedDomainTestSuite.getSupport(clazz);
// note that some of these 7+ specific changes may warrant creating a newer version of testing-host.xml for the newer slaves
// at some point (the currently used host.xml is quite an old version). If these exceptions become more complicated than this, we should
// probably do that.
// Unset the ignore-unused-configuration flag
ModelNode dc = DomainTestUtils.executeForResult(Util.getReadAttributeOperation(PathAddress.pathAddress(HOST), DOMAIN_CONTROLLER), testSupport.getDomainSlaveLifecycleUtil().getDomainClient());
dc = dc.get("remote");
dc.get(IGNORE_UNUSED_CONFIG).set(false);
dc.get(OP).set("write-remote-domain-controller");
dc.get(OP_ADDR).set(PathAddress.pathAddress(HOST).toModelNode());
DomainTestUtils.executeForResult(dc, testSupport.getDomainSlaveLifecycleUtil().getDomainClient());
stopSlave();
// restarting the slave will recopy the testing-host.xml file over the top, clobbering the ignore-unused-configuration above,
// so use setRewriteConfigFiles(false) to prevent this.
WildFlyManagedConfiguration slaveCfg = testSupport.getDomainSlaveConfiguration();
slaveCfg.setRewriteConfigFiles(false);
// Setup a host exclude for the slave ignoring some extensions
ModelControllerClient client = testSupport.getDomainMasterLifecycleUtil().getDomainClient();
setupExclude(client, hostRelease, slaveApiVersion);
// Now, add some ignored extensions to verify they are ignored due to the host-excluded configured before
addExtensions(true, client);
startSlave();
}
Aggregations