Package org.jboss.as.controller.client

Examples of org.jboss.as.controller.client.ModelControllerClient.execute()


            throw new IllegalStateException("Failed to build operation", e1);
        }

        List<String> result;
        try {
            ModelNode outcome = client.execute(request);
            if (!Util.isSuccess(outcome)) {
                // TODO logging... exception?
                result = Collections.emptyList();
            } else {
                result = Util.getList(outcome);
View Full Code Here


            throw new IllegalStateException("Failed to build operation", e1);
        }

        List<String> result;
        try {
            ModelNode outcome = client.execute(request);
            if (!Util.isSuccess(outcome)) {
                // TODO logging... exception?
                result = Collections.emptyList();
            } else {
                result = Util.getList(outcome);
View Full Code Here

            throw new IllegalStateException("Failed to build operation", e1);
        }

        List<String> result;
        try {
            ModelNode outcome = client.execute(request);
            if (!Util.isSuccess(outcome)) {
                result = Collections.emptyList();
            } else {
                outcome.get("request-properties");
                result = Util.getRequestPropertyNames(outcome);
View Full Code Here

        }

        ModelControllerClient client = ctx.getModelControllerClient();
        final ModelNode result;
        try {
            result = client.execute(request);
        } catch (Exception e) {
            ctx.printLine("Failed to perform operation: " + e.getLocalizedMessage());
            return;
        }
View Full Code Here

                    builder.setOperationName("read-attribute");
                    builder.addProperty("name", attrName);

                    try {
                        ModelNode result = client.execute(builder.buildRequest());
                        if(!result.hasDefined("result"))
                            return Collections.emptyList();
                        return Collections.singletonList(result.get("result").asString());
                    } catch (Exception e) {
                        return Collections.emptyList();
View Full Code Here

    public void testCreateDatasourcesDMR() throws Exception {
        ModelControllerClient mcc = mock(ModelControllerClient.class);

        // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully
        when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenAnswer(new Answer<ModelNode>() {
            public ModelNode answer(InvocationOnMock invocation) throws Throwable {
                System.out.println("~~~~~~~\n" + invocation.getArguments()[0]);
                ModelNode retNode = mockSuccess.clone();
                ModelNode resultNode = retNode.get(JBossASClient.RESULT);
                resultNode.get(DatasourceJBossASClient.DATA_SOURCE).setEmptyList();
View Full Code Here

    public void testCreateNewDatasourceDMR() throws Exception {
        ModelControllerClient mcc = mock(ModelControllerClient.class);

        // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully
        when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenReturn(mockSuccess);

        DatasourceJBossASClient client = new DatasourceJBossASClient(mcc);

        HashMap<String, String> connProps = new HashMap<String, String>(2);
        connProps.put("char.encoding", "UTF-8");
View Full Code Here

    public void testCreateNewXADatasourceDMR() throws Exception {
        ModelControllerClient mcc = mock(ModelControllerClient.class);

        // note that this doesn't test actually creating anything - it just tests the DMR can be parsed successfully
        when(mcc.execute(any(ModelNode.class), any(OperationMessageHandler.class))).thenReturn(mockSuccess);

        DatasourceJBossASClient client = new DatasourceJBossASClient(mcc);

        HashMap<String, String> xaDSProps = new HashMap<String, String>(2);
        xaDSProps.put("URL", "${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}");
View Full Code Here

     * @return results
     * @throws Exception
     */
    public ModelNode execute(ModelNode request) throws Exception {
        ModelControllerClient mcc = getModelControllerClient();
        return mcc.execute(request, OperationMessageHandler.logging);
    }

    /**
     * This returns information on the resource at the given address.
     * This will not return an exception if the address points to a non-existent resource, rather,
View Full Code Here

    }

    private static ModelNode applyUpdate(final ModelNode update) throws Exception {
        final ModelControllerClient client = newModelControllerClient();
        try {
            final ModelNode result = client.execute(new OperationBuilder(update).build());
            checkResult(result);
            return result;
        } finally {
            client.close();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.