Package org.jboss.test.messaging.tools.container

Examples of org.jboss.test.messaging.tools.container.Server


    * Simulates a queue deployment with a DLQ and ExpiryQueue attributes.
    */
   public static ObjectName deployQueueWithDLQnExpiryQ(String qName, String DLQName, String ExpiryQName) throws Exception
   {
      insureStarted();
      Server testServer = servers[0].getServer();
      return servers[0].getServer().deployQueueWithDLQnExpiryQ(qName, DLQName, ExpiryQName);
   }
View Full Code Here


    * Simulate a queue deployment without starting it.
    */
   public static ObjectName deployQueueWithoutStart(String testDLQName) throws Exception
   {
      insureStarted();
      Server testServer = servers[0].getServer();
      ObjectName name = testServer.deployQueueWithoutStart(testDLQName, null, false);
      return name;
   }
View Full Code Here

      String name = "//localhost:" + RMITestServer.DEFAULT_REGISTRY_PORT +
                    "/" +
                    RMITestServer.RMI_SERVER_PREFIX +
                    index;

      Server s = null;
      int retries = initialRetries;

      while (s == null && retries > 0)
      {
         int attempt = initialRetries - retries + 1;
View Full Code Here

   // Public ---------------------------------------------------------------------------------------

   public void testGracefulClientExit() throws Exception
   {
      Server localServer = null;
      File serialized = null;
     
      Connection conn = null;

      try
      {
         localServer = new LocalTestServer();

         localServer.start("all", true);
         localServer.deployQueue("Queue", null, false);

         // lookup the connection factory and the queue which we'll send to the client VM via a
         // serialized instances saved in file

         InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
         ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
         Queue queue = (Queue)ic.lookup("/queue/Queue");

         serialized = writeToFile(cf, queue);

         // spawn a JVM that creates a JMS client, which sends a test message

         Process p = spawnVM(serialized);

         // read the message from the queue

         conn = cf.createConnection();
         conn.start();
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer cons = sess.createConsumer(queue);
         TextMessage tm = (TextMessage)cons.receive(15000);

         assertNotNull(tm);
         assertEquals(MESSAGE_TEXT, tm.getText());

         // the client VM should exit by itself. If it doesn't, that means we have a problem
         // and the test will timeout
         log.info("waiting for the client VM to exit ...");
         p.waitFor();

         assertEquals(0, p.exitValue());
      }
      finally
      {
         try
         {
            if (conn != null)
               conn.close();

            // TODO delete the file
            if (serialized != null)
            {
               serialized.delete();
            }

            localServer.undeployDestination(true, "Queue");
            localServer.stopServerPeer();
            localServer.stop();
         }
         catch (Throwable ignored)
         {
            log.warn("Exception ignored:" + ignored.toString(), ignored);
         }
View Full Code Here

                                         boolean clearDatabase,
                                         boolean startMessagingServer) throws Exception
   {
      log.info("Attempting to start server " + i);
    
      Server s = create(i);

      s.start(config, attrOverrides, clearDatabase, startMessagingServer);

      log.info("server " + i + " started");
   }
View Full Code Here

      {
         log.info("server " + i + " has not been created or has already been killed, so it cannot be killed");
      }
      else
      {
         Server server = servers[i].getServer();
         log.info("invoking kill() on server " + i);
         try
         {
           server.kill();
         }
         catch (Throwable t)
         {
           // This is likely to throw an exception since the server dies before the response is received
         }        
         servers[i] = null;
        
         log.info("Waiting for server to die");
        
         try
         {
            while(true)
            {
               server.ping();
               log.debug("server " + i + " still alive ...");
               Thread.sleep(100);
            }
         }
         catch (Throwable e)
View Full Code Here

      for(int i = 0; i < servers.length; i++)
      {
         if (servers[i] != null && servers[i].isSpawned())
         {
            Server s = servers[i].getServer();
            destroyed.add(new Integer(s.getServerID()));
           
            log.info("Killing spawned server " + i);

            try
            {
              s.kill();
            }
            catch (Throwable t)
            {             
            }
            servers[i] = null;
View Full Code Here

      // put the invoking thread on wait until the server is actually up and running and bound
      // in the RMI registry

      log.info("spawned server " + i + ", waiting for it to come online");

      Server s = acquireRemote(500, i, true);
     
      log.info("Server contacted");

      if (s == null)
      {
View Full Code Here

    *         server after use.
    */
   public static Server poisonTheServer(int serverIndex, int type) throws Exception
   {
      insureStarted(serverIndex);
      Server poisoned = servers[serverIndex].getServer();

      //We set the server to null so it can be recreated again, but ONLY for those poisons that cause the server to get killed
      //We do not do this for other poisons that don't
     
      if (type != PoisonInterceptor.LONG_SEND && type != PoisonInterceptor.NULL)
      {
        servers[serverIndex] = null;
      }
     
      poisoned.poisonTheServer(type);

      return poisoned;
   }
View Full Code Here

   {
      String name =
         "//localhost:" + RMITestServer.DEFAULT_REGISTRY_PORT + "/" +
         RMITestServer.RMI_SERVER_PREFIX + index;

      Server s = null;
      int retries = initialRetries;

      while (s == null && retries > 0)
      {
         int attempt = initialRetries - retries + 1;
View Full Code Here

TOP

Related Classes of org.jboss.test.messaging.tools.container.Server

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.