Package org.jboss.as.demos

Examples of org.jboss.as.demos.DomainDeploymentUtils$Deployment


* @version $Revision: 1.1 $
*/
public class ExampleRunner {

    public static void main(String[] args) throws Exception {
        DomainDeploymentUtils utils = null;
        try {

            utils = new DomainDeploymentUtils("rar-example.rar", HelloWorldConnection.class.getPackage(), true);
            utils.addDeployment("rar-mbean.sar", Test.class.getPackage(), true);

            utils.deploy();

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

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();

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

            System.out.println("Calling TestMBean.helloWorld(\"AS7\") on server one");
            s = (String) mbeanServer.invoke(objectName, "helloWorld", new Object[] { "AS7" },
                    new String[] { "java.lang.String" });
            System.out.println("Received reply: " + s);

            mbeanServer = utils.getServerTwoConnection();

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

            System.out.println("Calling TestMBean.helloWorld(\"AS7\") on server two");
            s = (String) mbeanServer.invoke(objectName, "helloWorld", new Object[] { "AS7" },
                    new String[] { "java.lang.String" });
            System.out.println("Received reply: " + s);
        } 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<ServerIdentity> servers = resultToServerIdentitySet(result);
                for(ServerIdentity server : servers) {
                    System.out.println(server);
                    exerciseQueueOnServer(queueName, server);
                }

            } 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

* @version $Revision: 1.1 $
*/
public class ExampleRunner {

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

            utils.deploy();
            ObjectName objectName = new ObjectName("jboss:name=test,type=messaging");

            System.out.println("Accessing server-one");
            System.out.println();

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();

            Thread.sleep(1000);
            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            @SuppressWarnings("unchecked")
            List<String> msgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {"Test"}, new String[] {"java.lang.String"});
            System.out.println("Received messages: " + msgs);

            System.out.println("Accessing server-two");
            System.out.println();

            mbeanServer = utils.getServerTwoConnection();

            Thread.sleep(1000);
            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            @SuppressWarnings("unchecked")
            List<String> moreMsgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {"Test"}, new String[] {"java.lang.String"});
            System.out.println("Received messages: " + moreMsgs);
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

* @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

* @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

* @version $Revision: 1.1 $
*/
public class ExampleRunner {

    public static void main(String[] args) throws Exception {
        DomainDeploymentUtils utils = null;
        try {

            utils = new DomainDeploymentUtils("rar-example.rar", HelloWorldConnection.class.getPackage(), true);
            utils.addDeployment("rar-mbean.sar", Test.class.getPackage(), true);

            utils.deploy();

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

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();

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

            System.out.println("Calling TestMBean.helloWorld(\"AS7\") on server one");
            s = (String) mbeanServer.invoke(objectName, "helloWorld", new Object[] { "AS7" },
                    new String[] { "java.lang.String" });
            System.out.println("Received reply: " + s);

            mbeanServer = utils.getServerTwoConnection();

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

            System.out.println("Calling TestMBean.helloWorld(\"AS7\") on server two");
            s = (String) mbeanServer.invoke(objectName, "helloWorld", new Object[] { "AS7" },
                    new String[] { "java.lang.String" });
            System.out.println("Received reply: " + s);
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

* @version $Revision: 1.1 $
*/
public class ExampleRunner {

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

            utils.deploy();
            ObjectName objectName = new ObjectName("jboss:name=test,type=messaging");

            System.out.println("Accessing server-one");
            System.out.println();

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();

            Thread.sleep(1000);
            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            @SuppressWarnings("unchecked")
            List<String> msgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {"Test"}, new String[] {"java.lang.String"});
            System.out.println("Received messages: " + msgs);

            System.out.println("Accessing server-two");
            System.out.println();

            mbeanServer = utils.getServerTwoConnection();

            Thread.sleep(1000);
            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            @SuppressWarnings("unchecked")
            List<String> moreMsgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {"Test"}, new String[] {"java.lang.String"});
            System.out.println("Received messages: " + moreMsgs);
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

* @version $Revision: 1.1 $
*/
public class ExampleRunner {

    public static void main(String[] args) throws Exception {
        DomainDeploymentUtils utils = null;
        try {

            utils = new DomainDeploymentUtils("rar-example.rar", HelloWorldConnection.class.getPackage(), true);
            utils.addDeployment("rar-mbean.sar", Test.class.getPackage(), true);

            utils.deploy();

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

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();

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

            System.out.println("Calling TestMBean.helloWorld(\"AS7\") on server one");
            s = (String) mbeanServer.invoke(objectName, "helloWorld", new Object[] { "AS7" },
                    new String[] { "java.lang.String" });
            System.out.println("Received reply: " + s);

            mbeanServer = utils.getServerTwoConnection();

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

            System.out.println("Calling TestMBean.helloWorld(\"AS7\") on server two");
            s = (String) mbeanServer.invoke(objectName, "helloWorld", new Object[] { "AS7" },
                    new String[] { "java.lang.String" });
            System.out.println("Received reply: " + s);
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

* @version $Revision: 1.1 $
*/
public class ExampleRunner {

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

            utils.deploy();
            ObjectName objectName = new ObjectName("jboss:name=test,type=messaging");

            System.out.println("Accessing server-one");
            System.out.println();

            MBeanServerConnection mbeanServer = utils.getServerOneConnection();

            Thread.sleep(1000);
            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            @SuppressWarnings("unchecked")
            List<String> msgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {"Test"}, new String[] {"java.lang.String"});
            System.out.println("Received messages: " + msgs);

            System.out.println("Accessing server-two");
            System.out.println();

            mbeanServer = utils.getServerTwoConnection();

            Thread.sleep(1000);
            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            @SuppressWarnings("unchecked")
            List<String> moreMsgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {"Test"}, new String[] {"java.lang.String"});
            System.out.println("Received messages: " + moreMsgs);
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

TOP

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

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.