Java Code Examples for org.jboss.as.controller.client.helpers.Operations#createAddress()

The following examples show how to use org.jboss.as.controller.client.helpers.Operations#createAddress() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SNICombinedWithALPNTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Deploys the archive to the running server.
 *
 * @param archive the archive to deploy
 * @throws IOException if an error occurs deploying the archive
 */
public static void deploy(final Archive<?> archive, ManagementClient managementClient) throws IOException {
    // Use an operation to allow overriding the runtime name
    final ModelNode address = Operations.createAddress(DEPLOYMENT, archive.getName());
    final ModelNode addOp = createAddOperation(address);
    addOp.get("enabled").set(true);
    // Create the content for the add operation
    final ModelNode contentNode = addOp.get(CONTENT);
    final ModelNode contentItem = contentNode.get(0);
    contentItem.get(ClientConstants.INPUT_STREAM_INDEX).set(0);

    // Create an operation and add the input archive
    final OperationBuilder builder = OperationBuilder.create(addOp);
    builder.addInputStream(archive.as(ZipExporter.class).exportAsInputStream());

    // Deploy the content and check the results
    final ModelNode result = managementClient.getControllerClient().execute(builder.build());
    if (!Operations.isSuccessfulOutcome(result)) {
        Assert.fail(String.format("Failed to deploy %s: %s", archive, Operations.getFailureDescription(result).asString()));
    }
}
 
Example 2
Source File: FullReplaceUndeployTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static Operation createDeployAddOperation(final InputStream content, final String name, final String runtimeName) {
    final Operations.CompositeOperationBuilder builder = Operations.CompositeOperationBuilder.create(true);
    final ModelNode address = createAddress(DEPLOYMENT, name);
    final ModelNode addOperation = createAddOperation(address);
    if (runtimeName != null) {
        addOperation.get(RUNTIME_NAME).set(runtimeName);
    }
    addContent(builder, addOperation, content);
    builder.addStep(addOperation);

    final ModelNode sgAddress = Operations.createAddress(SERVER_GROUP, "main-server-group", DEPLOYMENT, name);
    final ModelNode op = Operations.createAddOperation(sgAddress);
    op.get("enabled").set(true);
    if (runtimeName != null) {
        op.get(RUNTIME_NAME).set(runtimeName);
    }
    builder.addStep(op);
    return builder.build();
}
 
Example 3
Source File: AbstractLogFieldsOfLogTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
void resetUser(final CompositeOperationBuilder compositeOp) {
    if (elytronEnabled) {
        ModelNode op = Operations.createOperation("map-remove", userAuthAddress);
        op.get("name").set("properties");
        op.get("key").set(DEFAULT_USER_KEY);
        compositeOp.addStep(op.clone());
        op = Operations.createOperation("map-put", userAuthAddress);
        op.get("name").set("properties");
        op.get("key").set(DEFAULT_USER_KEY);
        op.get("value").set("$local");
        compositeOp.addStep(op.clone());

        userIdentRealmAddress = Operations.createAddress("subsystem", "elytron", "identity-realm", "local");
        compositeOp.addStep(Operations.createWriteAttributeOperation(userIdentRealmAddress, "identity", "$local"));
    } else {
        compositeOp.addStep(Operations.createWriteAttributeOperation(userAuthAddress, "default-user", "$local"));
    }
}
 
Example 4
Source File: SocketHandlerTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void setup(final ManagementClient managementClient) throws Exception {
    // Describe the current subsystem to restore in the tearDown
    final ModelNode describeOp = Operations.createOperation("describe", SUBSYSTEM_ADDRESS.toModelNode());
    describeResult = executeOperation(managementClient, describeOp);

    final CompositeOperationBuilder builder = CompositeOperationBuilder.create();

    final ModelNode outboundSocketBindingAddress = Operations.createAddress("socket-binding-group", "standard-sockets",
            "remote-destination-outbound-socket-binding", SOCKET_BINDING_NAME);
    ModelNode op = Operations.createAddOperation(outboundSocketBindingAddress);
    op.get("host").set(HOSTNAME);
    op.get("port").set(PORT);
    builder.addStep(op);

    final ModelNode formatterAddress = SUBSYSTEM_ADDRESS.append("json-formatter", FORMATTER_NAME).toModelNode();
    builder.addStep(Operations.createAddOperation(formatterAddress));

    builder.addStep(Operations.createAddOperation(LOGGER_ADDRESS));

    executeOperation(managementClient, builder.build());
}
 
Example 5
Source File: AbstractLoggingTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Deploys the archive to the running server.
 *
 * @param archive     the archive to deploy
 * @param runtimeName the runtime name for the deployment
 *
 * @throws IOException if an error occurs deploying the archive
 */
public static void deploy(final Archive<?> archive, final String runtimeName) throws IOException {
    // Use an operation to allow overriding the runtime name
    final ModelNode address = Operations.createAddress(DEPLOYMENT, archive.getName());
    final ModelNode addOp = createAddOperation(address);
    if (runtimeName != null && !archive.getName().equals(runtimeName)) {
        addOp.get(RUNTIME_NAME).set(runtimeName);
    }
    addOp.get("enabled").set(true);
    // Create the content for the add operation
    final ModelNode contentNode = addOp.get(CONTENT);
    final ModelNode contentItem = contentNode.get(0);
    contentItem.get(ClientConstants.INPUT_STREAM_INDEX).set(0);

    // Create an operation and add the input archive
    final OperationBuilder builder = OperationBuilder.create(addOp);
    builder.addInputStream(archive.as(ZipExporter.class).exportAsInputStream());

    // Deploy the content and check the results
    final ModelNode result = client.getControllerClient().execute(builder.build());
    if (!Operations.isSuccessfulOutcome(result)) {
        Assert.fail(String.format("Failed to deploy %s: %s", archive, Operations.getFailureDescription(result).asString()));
    }
}
 
Example 6
Source File: SocketHandlerTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testOutboundSocketBindingChange() throws Exception {
    // Add a new outbound-socket-binding
    final String altName = "alt-log-server";
    final ModelNode outboundSocketBindingAddress = Operations.createAddress("socket-binding-group", "standard-sockets",
            "remote-destination-outbound-socket-binding", altName);
    ModelNode op = Operations.createAddOperation(outboundSocketBindingAddress);
    op.get("host").set(HOSTNAME);
    op.get("port").set(ALT_PORT);
    executeOperation(op);
    resourcesToRemove.addLast(outboundSocketBindingAddress);

    // Create the server, plus a new server listening on the alternate port
    try (JsonLogServer server = JsonLogServer.createTcpServer(PORT);
         JsonLogServer altServer = JsonLogServer.createTcpServer(ALT_PORT)
    ) {
        server.start(DFT_TIMEOUT);
        altServer.start(DFT_TIMEOUT);
        final ModelNode altAddress = addSocketHandler("test-log-server-alt", null, null);

        // Log a single message to the current log server and validate
        JsonObject foundMessage = executeRequest("Test first message",
                Collections.singletonMap(LoggingServiceActivator.LOG_LEVELS_KEY, "INFO"), server);
        Assert.assertEquals("Test first message", foundMessage.getString("message"));

        // Change the outbound-socket-binding-ref, which should require a reload
        op = Operations.createWriteAttributeOperation(altAddress, "outbound-socket-binding-ref", altName);
        executeOperation(op);
        ServerReload.executeReloadAndWaitForCompletion(client.getControllerClient());

        // Log a single message to the alternate log server and validate
        foundMessage = executeRequest("Test alternate message",
                Collections.singletonMap(LoggingServiceActivator.LOG_LEVELS_KEY, "INFO"), altServer);
        Assert.assertEquals("Test alternate message", foundMessage.getString("message"));
    }
}
 
Example 7
Source File: AbstractLoggingTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Reads the deployment resource.
 *
 * @param deploymentName the name of the deployment
 *
 * @return the model for the deployment
 *
 * @throws IOException if an error occurs connecting to the server
 */
public static ModelNode readDeploymentResource(final String deploymentName) throws IOException {
    // Don't guess on the address, just parse it as it comes back
    final ModelNode address = Operations.createAddress("deployment", deploymentName, "subsystem", "logging", "configuration", "*");
    final ModelNode op = Operations.createReadResourceOperation(address);
    op.get("include-runtime").set(true);
    final ModelNode result = executeOperation(op);
    // Get the resulting model
    final List<ModelNode> loggingConfigurations = Operations.readResult(result).asList();
    Assert.assertEquals("There should only be one logging configuration defined", 1, loggingConfigurations.size());
    final LinkedList<Property> resultAddress = new LinkedList<>(Operations.getOperationAddress(loggingConfigurations.get(0)).asPropertyList());
    return readDeploymentResource(deploymentName, resultAddress.getLast().getValue().asString());
}
 
Example 8
Source File: CapabilityTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static ModelNode createProfileSubsystemAddress(final String profile, final String... parts) {
    final Collection<String> addressParts = new ArrayList<>();
    addressParts.add("subsystem");
    addressParts.add("logging");
    if (profile != null) {
        addressParts.add("logging-profile");
        addressParts.add(profile);
    }
    Collections.addAll(addressParts, parts);
    return Operations.createAddress(addressParts);
}
 
Example 9
Source File: AbstractLogFieldsOfLogTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
void configureUser(final ModelControllerClient client, final CompositeOperationBuilder compositeOp) throws IOException {

        // Determine the we should be using a security-realm or SASL (we assume SASL means Elytron is enabled)
        String securityRealm = "ManagementRealm";
        ModelNode op = Operations.createReadResourceOperation(Operations.createAddress("core-service", "management", "management-interface", "http-interface"));
        ModelNode result = executeForSuccess(client, OperationBuilder.create(op).build());
        if (result.hasDefined("security-realm")) {
            securityRealm = result.get("security-realm").asString();
        } else if (result.hasDefined("http-upgrade")) {
            final ModelNode httpUpgrade = result.get("http-upgrade");
            // We could query this further to get the actual name of the configurable-sasl-server-factory. Since this
            // is a test we're making some assumptions to limit the number of query calls made to the server.
            if (httpUpgrade.hasDefined("sasl-authentication-factory")) {
                elytronEnabled = true;
            }
        }

        if (elytronEnabled) {
            userAuthAddress = Operations.createAddress("subsystem", "elytron", "configurable-sasl-server-factory", "configured");
            op = Operations.createOperation("map-remove", userAuthAddress);
            op.get("name").set("properties");
            op.get("key").set(DEFAULT_USER_KEY);
            compositeOp.addStep(op.clone());
            op = Operations.createOperation("map-put", userAuthAddress);
            op.get("name").set("properties");
            op.get("key").set(DEFAULT_USER_KEY);
            op.get("value").set("IAmAdmin");
            compositeOp.addStep(op.clone());

            userIdentRealmAddress = Operations.createAddress("subsystem", "elytron", "identity-realm", "local");
            compositeOp.addStep(Operations.createWriteAttributeOperation(userIdentRealmAddress, "identity", "IAmAdmin"));

        } else {
            userAuthAddress = Operations.createAddress(CORE_SERVICE, MANAGEMENT, SECURITY_REALM, securityRealm, AUTHENTICATION, LOCAL);
            compositeOp.addStep(Operations.createWriteAttributeOperation(userAuthAddress, "default-user", "IAmAdmin"));
        }
    }
 
Example 10
Source File: ServerHelper.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static List<JsonObject> readLogFileFromModel(final String logFileName, final String... addressPrefix) throws IOException {
    final Collection<String> addr = new ArrayList<>();
    if (addressPrefix != null) {
        Collections.addAll(addr, addressPrefix);
    }
    addr.add("subsystem");
    addr.add("logging");
    addr.add("log-file");
    addr.add(logFileName);
    final ModelNode address = Operations.createAddress(addr);
    final ModelNode op = Operations.createReadAttributeOperation(address, "stream");
    try (ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient()) {
        final OperationResponse response = client.executeOperation(Operation.Factory.create(op), OperationMessageHandler.logging);
        final ModelNode result = response.getResponseNode();
        if (Operations.isSuccessfulOutcome(result)) {
            final OperationResponse.StreamEntry entry = response.getInputStream(Operations.readResult(result).asString());
            if (entry == null) {
                throw new RuntimeException(String.format("Failed to find entry with UUID %s for log file %s",
                        Operations.readResult(result).asString(), logFileName));
            }
            final List<JsonObject> lines = new ArrayList<>();
            try (BufferedReader reader = new BufferedReader(new InputStreamReader(entry.getStream(), StandardCharsets.UTF_8))) {
                String line;
                while ((line = reader.readLine()) != null) {
                    try (JsonReader jsonReader = Json.createReader(new StringReader(line))) {
                        lines.add(jsonReader.readObject());
                    }
                }
            }
            return lines;
        }
        throw new RuntimeException(String.format("Failed to read log file %s: %s", logFileName, Operations.getFailureDescription(result).asString()));
    }
}
 
Example 11
Source File: AbstractTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static ModelNode determineHostAddress(final ModelControllerClient client) throws IOException {
    final ModelNode op = Operations.createReadAttributeOperation(EMPTY_ADDRESS, "local-host-name");
    ModelNode response = client.execute(op);
    if (Operations.isSuccessfulOutcome(response)) {
        return Operations.createAddress("host", Operations.readResult(response).asString());
    }
    throw new IOException("Failed to determine host name: " + Operations.readResult(response).asString());
}
 
Example 12
Source File: SocketHandlerTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private ModelNode addSocketHandler(final String name, final String level, final String protocol, final Path keyStore) throws IOException {
    final CompositeOperationBuilder builder = CompositeOperationBuilder.create();
    // Add a socket handler
    final ModelNode address = SUBSYSTEM_ADDRESS.append("socket-handler", name).toModelNode();
    ModelNode op = Operations.createAddOperation(address);
    op.get("named-formatter").set(FORMATTER_NAME);
    op.get("outbound-socket-binding-ref").set(SOCKET_BINDING_NAME);
    if (level != null) {
        op.get("level").set(level);
    }
    if (protocol != null) {
        op.get("protocol").set(protocol);
    }
    if (keyStore != null) {
        // We need to add the SSL context to Elytron
        final ModelNode keyStoreAddress = Operations.createAddress("subsystem", "elytron", "key-store", "log-test-ks");
        resourcesToRemove.addFirst(keyStoreAddress);
        final ModelNode keyStoreAddOp = Operations.createAddOperation(keyStoreAddress);
        keyStoreAddOp.get("path").set(keyStore.toAbsolutePath().toString());
        keyStoreAddOp.get("type").set("JKS");
        final ModelNode creds = keyStoreAddOp.get("credential-reference").setEmptyObject();
        creds.get("clear-text").set(TEST_PASSWORD);
        builder.addStep(keyStoreAddOp);

        final ModelNode keyManagerAddress = Operations.createAddress("subsystem", "elytron", "trust-manager", "log-test-tm");
        resourcesToRemove.addLast(keyManagerAddress);
        final ModelNode keyManagerAddOp = Operations.createAddOperation(keyManagerAddress);
        keyManagerAddOp.get("key-store").set("log-test-ks");
        builder.addStep(keyManagerAddOp);

        final ModelNode sslContextAddress = Operations.createAddress("subsystem", "elytron", "client-ssl-context", "log-test-ssl-context");
        resourcesToRemove.addLast(sslContextAddress);
        final ModelNode sslContextAddOp = Operations.createAddOperation(sslContextAddress);
        sslContextAddOp.get("trust-manager").set("log-test-tm");
        sslContextAddOp.get("protocols").setEmptyList().add("TLSv1.2");
        builder.addStep(sslContextAddOp);

        op.get("ssl-context").set("log-test-ssl-context");
    }
    builder.addStep(op);
    resourcesToRemove.addFirst(address);

    // Add the handler to the logger
    op = Operations.createOperation("add-handler", LOGGER_ADDRESS);
    op.get("name").set(name);
    builder.addStep(op);
    executeOperation(builder.build());
    return address;
}
 
Example 13
Source File: ManagementAuthenticationUsersTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private ModelNode getCredentialStoreAddress(String storeName) {
    return Operations.createAddress(SUBSYSTEM, "elytron", "credential-store", storeName);
}
 
Example 14
Source File: ServerConfigurator.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static void configureStandalone() throws InterruptedException, IOException {
    final Path stdout = Paths.get(TestSuiteEnvironment.getTmpDir(), "config-standalone-stdout.txt");
    final StandaloneCommandBuilder builder = StandaloneCommandBuilder.of(ServerHelper.JBOSS_HOME)
            .addJavaOptions(ServerHelper.DEFAULT_SERVER_JAVA_OPTS);

    final String localRepo = System.getProperty("maven.repo.local");
    if (localRepo != null) {
        builder.addJavaOption("-Dmaven.repo.local=" + localRepo);
    }

    Process process = null;
    try {
        process = Launcher.of(builder)
                .setRedirectErrorStream(true)
                .redirectOutput(stdout)
                .launch();
        ServerHelper.waitForStandalone(process, () -> readStdout(stdout));

        try (ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient()) {
            final CompositeOperationBuilder opBuilder = CompositeOperationBuilder.create();
            ModelNode address = Operations.createAddress("subsystem", "logging", "custom-formatter", "json");
            ModelNode op = Operations.createAddOperation(address);
            op.get("class").set("org.jboss.logmanager.formatters.JsonFormatter");
            op.get("module").set("org.jboss.logmanager");
            final ModelNode properties = op.get("properties").setEmptyObject();
            properties.get("exceptionOutputType").set("FORMATTED");
            properties.get("prettyPrint").set(false);
            opBuilder.addStep(op);

            address = Operations.createAddress("subsystem", "logging", "file-handler", "json");
            op = Operations.createAddOperation(address);
            op.get("append").set(false);
            op.get("level").set("DEBUG");
            op.get("autoflush").set(true);
            op.get("named-formatter").set("json");
            final ModelNode file = op.get("file");
            file.get("relative-to").set("jboss.server.log.dir");
            file.get("path").set("json.log");
            opBuilder.addStep(op);

            address = Operations.createAddress("subsystem", "logging", "logger", "org.wildfly.common.test.LoggingAgent");
            op = Operations.createAddOperation(address);
            op.get("handlers").setEmptyList().add("json");
            op.get("level").set("DEBUG");
            opBuilder.addStep(op);

            executeOperation(client, opBuilder.build());
            ServerHelper.shutdownStandalone(client);
        }

        if (!process.waitFor(ServerHelper.TIMEOUT, TimeUnit.SECONDS)) {
            Assert.fail(readStdout(stdout));
        }

        if (process.exitValue() != 0) {
            Assert.fail(readStdout(stdout));
        }

    } finally {
        ProcessHelper.destroyProcess(process);
    }
}
 
Example 15
Source File: ServerConfigurator.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static void configureDomain() throws IOException, InterruptedException {
    final Path stdout = Paths.get(TestSuiteEnvironment.getTmpDir(), "config-domain-stdout.txt");
    final DomainCommandBuilder builder = DomainCommandBuilder.of(ServerHelper.JBOSS_HOME)
            .addHostControllerJavaOptions(ServerHelper.DEFAULT_SERVER_JAVA_OPTS);

    final String localRepo = System.getProperty("maven.repo.local");
    if (localRepo != null) {
        builder.addHostControllerJavaOption("-Dmaven.repo.local=" + localRepo)
                .addProcessControllerJavaOption("-Dmaven.repo.local=" + localRepo);
    }

    Process process = null;
    try {
        process = Launcher.of(builder)
                .setRedirectErrorStream(true)
                .redirectOutput(stdout)
                .launch();
        ServerHelper.waitForDomain(process, () -> readStdout(stdout));

        // Start server-three, configure it, then stop it
        try (DomainClient client = DomainClient.Factory.create(TestSuiteEnvironment.getModelControllerClient())) {
            final String hostName = ServerHelper.determineHostName(client);
            // Configure server-three to launch with an agent
            final CompositeOperationBuilder opBuilder = CompositeOperationBuilder.create();
            ModelNode address = Operations.createAddress("profile", "default");
            ModelNode op = Operations.createOperation("clone", address);
            op.get("to-profile").set("test");
            opBuilder.addStep(op);

            address = Operations.createAddress("server-group", "other-server-group");
            op = Operations.createWriteAttributeOperation(address, "profile", "test");
            opBuilder.addStep(op);

            address = Operations.createAddress("host", hostName, "server-config", "server-three", "jvm", "default");
            op = Operations.createAddOperation(address);
            op.get("module-options").setEmptyList().add("-javaagent:" + ServerHelper.JBOSS_HOME.resolve("logging-agent-tests.jar") + "=" + LoggingAgent.DEBUG_ARG);
            opBuilder.addStep(op);

            address = Operations.createAddress("profile", "test", "subsystem", "logging", "custom-formatter", "json");
            op = Operations.createAddOperation(address);
            op.get("class").set("org.jboss.logmanager.formatters.JsonFormatter");
            op.get("module").set("org.jboss.logmanager");
            final ModelNode properties = op.get("properties").setEmptyObject();
            properties.get("exceptionOutputType").set("FORMATTED");
            properties.get("prettyPrint").set(false);
            opBuilder.addStep(op);

            address = Operations.createAddress("profile", "test", "subsystem", "logging", "file-handler", "json");
            op = Operations.createAddOperation(address);
            op.get("append").set(false);
            op.get("level").set("DEBUG");
            op.get("autoflush").set(true);
            op.get("named-formatter").set("json");
            final ModelNode file = op.get("file");
            file.get("relative-to").set("jboss.server.log.dir");
            file.get("path").set("json.log");
            opBuilder.addStep(op);

            address = Operations.createAddress("profile", "test", "subsystem", "logging", "logger", "org.wildfly.common.test.LoggingAgent");
            op = Operations.createAddOperation(address);
            op.get("handlers").setEmptyList().add("json");
            op.get("level").set("DEBUG");
            opBuilder.addStep(op);

            executeOperation(client, opBuilder.build());


            client.startServer(hostName, "server-three");
            ServerHelper.waitForManagedServer(client, "server-three", () -> readStdout(stdout));
            ServerHelper.shutdownDomain(client);
        }
        if (!process.waitFor(ServerHelper.TIMEOUT, TimeUnit.SECONDS)) {
            Assert.fail(readStdout(stdout));
        }

        if (process.exitValue() != 0) {
            Assert.fail(readStdout(stdout));
        }
    } finally {
        ProcessHelper.destroyProcess(process);
    }
}
 
Example 16
Source File: SlaveHostControllerAuthenticationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private ModelNode getCredentialStoreAddress(String storeName) {
    return Operations.createAddress(HOST, "slave", SUBSYSTEM, "elytron", "credential-store", storeName);
}
 
Example 17
Source File: AbstractLoggingTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Reads the deployment resource.
 *
 * @param deploymentName    the name of the deployment
 * @param configurationName the name of the configuration for the address
 *
 * @return the model for the deployment
 *
 * @throws IOException if an error occurs connecting to the server
 */
public static ModelNode readDeploymentResource(final String deploymentName, final String configurationName) throws IOException {
    ModelNode address = Operations.createAddress("deployment", deploymentName, "subsystem", "logging", "configuration", configurationName);
    ModelNode op = Operations.createReadResourceOperation(address, true);
    op.get("include-runtime").set(true);
    final ModelNode result = Operations.readResult(executeOperation(op));
    // Add the address on the result as the tests might need it
    result.get(ModelDescriptionConstants.OP_ADDR).set(address);
    return result;
}
 
Example 18
Source File: ServerHelper.java    From wildfly-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Attempts to determine the address for a domain server.
 *
 * @param client the client used to communicate with the server
 *
 * @return the host address
 *
 * @throws IOException if an error occurs determining the host name
 */
public static ModelNode determineHostAddress(final ModelControllerClient client) throws IOException {
    return Operations.createAddress("host", determineHostName(client));
}