Package org.jboss.as.demos

Examples of org.jboss.as.demos.DomainDeploymentUtils


* @author <a href="mailto:jesper.pedersen@jboss.org">Jesper Pedersen</a>
*/
public class ExampleRunner {

    public static void main(String[] args) throws Exception {
        DomainDeploymentUtils utils = null;
        try {
            utils = new DomainDeploymentUtils("ds-mbean.sar", Test.class.getPackage());

            utils.deploy();

            ObjectName objectName = new ObjectName("jboss:name=test,type=ds");

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();
            System.out.println("Calling TestMBean.test() on server one");
            String s = (String) mbeanServer.invoke(objectName, "test", new Object[0], new String[0]);
            System.out.println("Received reply: " + s);

            mbeanServer = utils.getServerTwoConnection();
            System.out.println("Calling TestMBean.test() on server two");
            s = (String) mbeanServer.invoke(objectName, "test", new Object[0], new String[0]);
            System.out.println("Received reply: " + s);

        } catch (Exception e) {
            Throwable parent = e;
            while (parent != null) {
                if (parent instanceof NameNotFoundException && e.getMessage().indexOf("H2DS") > -1) {
                    usage(parent);
                    return;
                }
                parent = parent.getCause();
            }
            e.printStackTrace();
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here


        final ModelNode queueAddOperation = new ModelNode();
        queueAddOperation.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
        queueAddOperation.get(ModelDescriptionConstants.OP_ADDR).set(address);
        queueAddOperation.get("entries").add(queueName);

        DomainDeploymentUtils utils = null;
        boolean deployed = false;
        try {
            utils = new DomainDeploymentUtils(client);
            utils.addDeployment("fakejndi.sar", FakeJndi.class.getPackage());
            utils.deploy();

            deployed = true;

            try {
                final ModelNode result = executeForResult(queueAddOperation);
                Collection<String> serverGroups = resultToServerGroupIdentitySet(result);
                for (String serverGroup : serverGroups) {
                    System.out.println(serverGroup);
                    //TODO: fixme
                    //exerciseQueueOnServer(queueName, serverGroup);
                }

            } catch (Exception e) {
                System.out.println("failed to execute operation " + queueAddOperation);
                e.printStackTrace();
            }

            return continuePrompt();
        } finally {
            if (deployed && utils != null) {
                utils.undeploy();
            }

        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.demos.DomainDeploymentUtils

Copyright © 2018 www.massapicom. 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.