Advertisement
Guest User

Untitled

a guest
May 16th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.59 KB | None | 0 0
  1.  @Test
  2.    public void AAAA()
  3.    {
  4.       // stuff and things
  5.       String m_host = "vcatpemd02";
  6.       String m_component = "IFCC";
  7.       String m_tag = "UNITTEST";
  8.       int m_adminPort = 15672;
  9.       int m_trafficPort = 5672;
  10.       boolean connectionGood = false;
  11.       String exchangeName = "testExchange";
  12.       String queueName = "testQueue";
  13.       String messageToSend = "This is the Message To send";
  14.       String user = "admin";
  15.       String password = "9DrSVKSLv6QR";
  16.  
  17.       try
  18.       {
  19.          RmqUtils theEnv = new RmqUtils(m_host, m_component, m_tag, m_adminPort, m_trafficPort);
  20.          theEnv.createNewRmqEnv(true);
  21.  
  22.          // Create a user
  23.          boolean thing = theEnv.createUser(false, user, password, ".*", ".*");
  24.          System.out.println(thing);
  25.  
  26.          // Create a Exchange
  27.          theEnv.makeExchange(exchangeName, RmqEnvironment.MSG_TYPE_DIRECT, true, true);
  28.  
  29.          //Create a Queue
  30.          theEnv.makeQueue(queueName, true, true);
  31.  
  32.          // Bind Exchange to Queue
  33.          theEnv.bindQueueToExchange(exchangeName, queueName, "routingKey");
  34.  
  35.          // Send Message
  36.          theEnv.sendToExchange(exchangeName, messageToSend, user, password);
  37.  
  38.          // Get Message
  39.          String messageReceived = theEnv.getFromQueue(queueName, user, password, 3000);
  40.  
  41.          // Compare message sent to message received
  42.          if (messageReceived.equals(messageToSend))
  43.          {
  44.             connectionGood = true;
  45.          }
  46.       }
  47.       catch (Exception e)
  48.       {
  49.          e.printStackTrace();
  50.       }
  51.       assertTrue(connectionGood);
  52.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement