Package org.jboss.as.demos

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


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

    public static void main(String[] args) throws Exception {
        DeploymentUtils utils = null;
        try {
            utils = new DeploymentUtils("serviceloader-example.jar", TestService.class.getPackage());
            utils.addDeployment("serviceloader-mbean.sar", Test.class.getPackage());

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

            MBeanServerConnection mbeanServer = utils.getConnection();

            System.out.println("Calling TestMBean.decorateWithServiceLoader(\"Hello\") on server");
            String s = (String)mbeanServer.invoke(objectName, "decorateWithServiceLoader", new Object[] {"Hello"}, 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 {
        DeploymentUtils utils = null;
        boolean ok = false;
        try {
            utils = new DeploymentUtils("jms-mbean.sar", Test.class.getPackage());
            utils.deploy();
            ObjectName objectName = new ObjectName("jboss:name=test,type=jms");

            MBeanServerConnection mbeanServer = utils.getConnection();

            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            List<String> msgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {}, new String[] {});
            System.out.println("Received messages: " + msgs);
            ok = true;
        } finally {
            try {
                utils.undeploy();
                safeClose(utils);
            }
            catch (Exception e) {
                if (ok)
                    throw e;
View Full Code Here

        System.out.println(msg);
    }

    public static void main(String[] args) throws Exception {
        showInfo();
        DeploymentUtils utils = new DeploymentUtils("jpa-example.jar", SimpleStatelessSessionBean.class.getPackage());
        try {
            utils.addDeployment("jpa-mbean.sar", Test.class.getPackage());
            utils.deploy();

            /*
            InitialContext ctx = new InitialContext();
            SimpleStatelessSessionLocal bean = (SimpleStatelessSessionLocal) ctx.lookup("java:global/jpa-example/SimpleStatelessSessionBean!" + SimpleStatelessSessionLocal.class.getName());
            String msg = bean.echo("Hello world");
            */
            MBeanServerConnection mbeanServer = utils.getConnection();

            SimpleStatelessSessionLocal bean = createProxy(mbeanServer, "java:global/jpa-example/SimpleStatelessSessionBean!" + SimpleStatelessSessionLocal.class.getName(), SimpleStatelessSessionLocal.class);
            String msg = bean.echo("Hello world");
            System.out.println(msg);

            doStatefulMagic(mbeanServer);
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

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

    public static void main(String[] args) throws Exception {
        DeploymentUtils deploymentUtils = null;
        try {
            deploymentUtils = new DeploymentUtils("sar-example.sar", ConfigService.class.getPackage());

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

            MBeanServerConnection mbeanServer = deploymentUtils.getConnection();

            //A little sleep to give the logging done by the bean time to kick in
            Thread.sleep(1500);

            System.out.println("Checking the IntervalSeconds property");
            Object o = mbeanServer.getAttribute(objectName, "IntervalSeconds");
            System.out.println("IntervalSeconds was " + o + ", setting it to 2");
            mbeanServer.setAttribute(objectName, new Attribute("IntervalSeconds", 2));
            System.out.println("IntervalSeconds set");

            //A little sleep to give the logging resulting from the new interval time to show up in the logs
            Thread.sleep(3000);
        } finally {
            deploymentUtils.undeploy();
            safeClose(deploymentUtils);
        }
    }
View Full Code Here

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

    public static void main(String[] args) throws Exception {
        DeploymentUtils utils = null;
        try {
            utils = new DeploymentUtils("rar-example.rar", true, HelloWorldConnection.class.getPackage());
            utils.addDeployment("rar-mbean.sar", true, Test.class.getPackage());

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


            //System.out.println(utils.showJndi());

            MBeanServerConnection mbeanServer = utils.getConnection();
            System.out.println("Calling TestMBean.helloWorld() on server");
            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");
            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

    public static void main(String[] args) throws Exception {
        QueueConnection conn = null;
        QueueSession session = null;
        //TODO Don't do this FakeJndi stuff once we have remote JNDI working
        DeploymentUtils utils = null;
        try {
            utils = new DeploymentUtils("fakejndi.sar", FakeJndi.class.getPackage());
            utils.deploy();

            QueueConnectionFactory qcf = lookup(utils, "RemoteConnectionFactory", QueueConnectionFactory.class);
            Queue queue = lookup(utils, "queue/test", Queue.class);

            System.out.println("Got qcf " + qcf);
            System.out.println("Got q " + queue);

            conn = qcf.createQueueConnection();
            conn.start();
            session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            // Set the async listener
            QueueReceiver recv = session.createReceiver(queue);
            recv.setMessageListener(new MessageListener() {

                @Override
                public void onMessage(Message message) {
                    TextMessage msg = (TextMessage)message;
                    try {
                        System.out.println("---->Received: " + msg.getText());
                    } catch (JMSException e) {
                        e.printStackTrace();
                    }
                }
            });

            QueueSender sender = session.createSender(queue);
            for (int i = 0 ; i < 10 ; i++) {
                String s = "Test" + i;
                System.out.println("----> Sending: " +s );
                TextMessage msg = session.createTextMessage(s);
                sender.send(msg);
            }

            Thread.sleep(1000);


        } finally {
            try {
                conn.stop();
            } catch (Exception ignore) {
            }
            try {
                session.close();
            } catch (Exception ignore) {
            }
            try {
                conn.close();
            } catch (Exception ignore) {
            }

            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

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

    public static void main(String[] args) throws Exception {
        DeploymentUtils utils = null;
        boolean ok = false;
        try {
            utils = new DeploymentUtils("jms-mbean.sar", Test.class.getPackage());
            utils.deploy();
            ObjectName objectName = new ObjectName("jboss:name=test,type=jms");

            MBeanServerConnection mbeanServer = utils.getConnection();

            System.out.println("Sending message: Test");
            mbeanServer.invoke(objectName, "sendMessage", new Object[] {"Test"}, new String[] {"java.lang.String"});
            Thread.sleep(1000);
            List<String> msgs = (List<String>)mbeanServer.invoke(objectName, "readMessages", new Object[] {}, new String[] {});
            System.out.println("Received messages: " + msgs);
            ok = true;
        } finally {
            try {
                utils.undeploy();
                safeClose(utils);
            }
            catch (Exception e) {
                if (ok)
                    throw e;
View Full Code Here

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

   public static void main(String[] args) throws Exception {
      DeploymentUtils utils = null;
      try {
         utils = new DeploymentUtils();
         utils.addWarDeployment("war-example.war", true, SimpleServlet.class.getPackage());
         utils.deploy();

         performCall("simple");
         performCall("legacy");
      } finally {
         utils.undeploy();
         safeClose(utils);
      }
   }
View Full Code Here

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

    public static void main(String[] args) throws Exception {
        DeploymentUtils utils = null;
        QueueConnection conn = null;
        QueueSession session = null;
        //TODO Don't do this FakeJndi stuff once we have remote JNDI working
        try {
            utils = new DeploymentUtils("fakejndi.sar", FakeJndi.class.getPackage());
            utils.addWarDeployment("webapp-example.war", SimpleServlet.class.getPackage());
            utils.deploy();

            QueueConnectionFactory qcf = lookup(utils, "RemoteConnectionFactory", QueueConnectionFactory.class);
            Queue queue = lookup(utils, "queue/test", Queue.class);
            conn = qcf.createQueueConnection();
            conn.start();
            session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            // Set the async listener
            QueueReceiver recv = session.createReceiver(queue);
            recv.setMessageListener(new MessageListener() {

                @Override
                public void onMessage(Message message) {
                    TextMessage msg = (TextMessage)message;
                    try {
                        System.out.println("---->Received from queue: " + msg.getText());
                    } catch (JMSException e) {
                        e.printStackTrace();
                    }
                }
            });


            connect("other?value=One");
            connect("simple?value=Two");
            connect("other?value=Three");
        } finally {
            utils.undeploy();
            safeClose(utils);
            if(conn != null) {
                conn.close();
            }
        }
View Full Code Here

* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
*/
public class ExampleRunner {

    public static void main(String[] args) throws Exception {
        DeploymentUtils utils = null;
        try {
            utils = new DeploymentUtils();
            utils.addDeployment("wsejb-example.jar", true, EndpointImpl.class.getPackage());
            utils.deploy();
            testWSDL();
            testSOAPCall();
        } finally {
            utils.undeploy();
            safeClose(utils);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.demos.DeploymentUtils$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.