use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class HTTPSWebConnectorTestCase method startAndSetupContainer.
@Test
@InSequence(-1)
public void startAndSetupContainer() throws Exception {
LOGGER.trace("*** starting server");
containerController.start(CONTAINER);
ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
ManagementClient managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
LOGGER.trace("*** will configure server now");
serverSetup(managementClient);
deployer.deploy(APP_CONTEXT);
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class HTTPSWebConnectorTestCase method serverTearDown.
private void serverTearDown(ManagementClient managementClient) throws Exception {
// delete test security domains
SecurityDomainsSetup.INSTANCE.tearDown(managementClient, null);
final ModelControllerClient client = managementClient.getControllerClient();
// delete https web connectors
ModelNode operation = createOpNode("subsystem=undertow/server=default-server/https-listener=" + HTTPS, ModelDescriptionConstants.REMOVE);
Utils.applyUpdate(operation, client);
rmHttpsConnector(HTTPS_NAME_VERIFY_NOT_REQUESTED, client);
rmHttpsConnector(HTTPS_NAME_VERIFY_REQUESTED, client);
rmHttpsConnector(HTTPS_NAME_VERIFY_REQUIRED, client);
operation = createOpNode("core-service=management/security-realm=" + HTTPS_REALM, ModelDescriptionConstants.REMOVE);
Utils.applyUpdate(operation, client);
FileUtils.deleteDirectory(WORK_DIR);
TRACE_SECURITY.tearDown(managementClient, null);
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class ReloadRequiringChangesTestCase method testWSDLHostChangeRequiresReloadAndDoesNotAffectRuntime.
@Test
@OperateOnDeployment(DEPLOYMENT)
public void testWSDLHostChangeRequiresReloadAndDoesNotAffectRuntime() throws Exception {
Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
ModelControllerClient client = managementClient.getControllerClient();
String initialWsdlHost = null;
try {
initialWsdlHost = getWsdlHost(client);
//change wsdl-host to "foo-host" and reload
final String hostname = "foo-host";
setWsdlHost(client, hostname);
ServerReload.executeReloadAndWaitForCompletion(client);
//change wsdl-host to "bar-host" and verify deployment still uses "foo-host"
setWsdlHost(client, "bar-host");
URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEPLOYMENT + "/POJOService?wsdl");
checkWsdl(wsdlURL, hostname);
} finally {
try {
if (initialWsdlHost != null) {
setWsdlHost(client, initialWsdlHost);
}
} finally {
managementClient.close();
}
}
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class ReloadRequiringChangesTestCase method testWSDLHostUndefineRequiresReloadAndDoesNotAffectRuntime.
@Test
@OperateOnDeployment(DEPLOYMENT)
public void testWSDLHostUndefineRequiresReloadAndDoesNotAffectRuntime() throws Exception {
Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
ModelControllerClient client = managementClient.getControllerClient();
String initialWsdlHost = null;
try {
initialWsdlHost = getWsdlHost(client);
//change wsdl-host to "my-host" and reload
final String hostname = "my-host";
setWsdlHost(client, hostname);
ServerReload.executeReloadAndWaitForCompletion(client);
//undefine wsdl-host and verify deployment still uses "foo-host"
setWsdlHost(client, null);
URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEPLOYMENT + "/POJOService?wsdl");
checkWsdl(wsdlURL, hostname);
} finally {
try {
if (initialWsdlHost != null) {
setWsdlHost(client, initialWsdlHost);
}
} finally {
managementClient.close();
}
}
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class WSAttributesChangesTestCase method performWsdlPathRewriteRuleAttributeTest.
private void performWsdlPathRewriteRuleAttributeTest(boolean checkUpdateWithDeployedEndpoint) throws Exception {
Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
ModelControllerClient client = managementClient.getControllerClient();
try {
final String expectedContext = "xx/jaxws-manual-pojo-1";
final String sedCmdA = "s/jaxws-manual-pojo-1/xx\\/jaxws-manual-pojo-1/g";
ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
op.get(NAME).set("wsdl-path-rewrite-rule");
op.get(VALUE).set(sedCmdA);
//update successful, no need to reload
applyUpdate(client, op, false);
//now we deploy an endpoint...
deployer.deploy(DEP_1);
//verify the updated wsdl host is used...
URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEP_1 + "/POJOService?wsdl");
checkWsdl(wsdlURL, expectedContext);
if (checkUpdateWithDeployedEndpoint) {
//final String hostnameB = "foo-host-b";
final String sedCmdB = "s/jaxws-manual-pojo-1/FOO\\/jaxws-manual-pojo-1/g";
ModelNode opB = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
opB.get(NAME).set("wsdl-path-rewrite-rule");
opB.get(VALUE).set(sedCmdB);
//update again, but we'll need to reload, as there's an active deployment
applyUpdate(client, opB, true);
//check the wsdl host is still the one we updated to before
checkWsdl(wsdlURL, expectedContext);
//and check that still applies even if we undeploy and redeploy the endpoint
deployer.undeploy(DEP_1);
deployer.deploy(DEP_1);
checkWsdl(wsdlURL, expectedContext);
}
} finally {
try {
deployer.undeploy(DEP_1);
} catch (Throwable t) {
//ignore
}
try {
ModelNode op = createOpNode("subsystem=webservices/", UNDEFINE_ATTRIBUTE_OPERATION);
op.get(NAME).set("wsdl-path-rewrite-rule");
applyUpdate(client, op, checkUpdateWithDeployedEndpoint);
} finally {
managementClient.close();
}
}
}
Aggregations