Пример #1
0
 @Deployment(testable = false)
 public static JavaArchive createDeployment() throws IOException {
   ResourceDeployer.addQueue(ORDER_QUEUE);
   ResourceDeployer.addQueue(SHIPPING_QUEUE);
   ResourceDeployer.addQueue(FILLING_STOCK_QUEUE);
   ResourceDeployer.addPropertiesUser();
   return ArquillianUtil.createJarQSDeployment("switchyard-jca-outbound-hornetq");
 }
Пример #2
0
  @Test
  public void testDeployment() throws Exception {
    HornetQMixIn hqMixIn =
        new HornetQMixIn(false).setUser(ResourceDeployer.USER).setPassword(ResourceDeployer.PASSWD);
    hqMixIn.initialize();
    String[] orders = {"BREAD", "PIZZA", "JAM", "POTATO", "MILK", "JAM"};

    try {
      Session session = hqMixIn.getJMSSession();
      MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(ORDER_QUEUE));
      for (String order : orders) {
        BytesMessage message = session.createBytesMessage();
        message.writeBytes(order.getBytes());
        producer.send(message);
      }
      session = hqMixIn.createJMSSession();

      MessageConsumer consumer = session.createConsumer(HornetQMixIn.getJMSQueue(SHIPPING_QUEUE));
      List<String> expectedShippingOrders =
          new ArrayList<String>(Arrays.asList("BREAD", "JAM", "MILK", "JAM"));
      Message msg = null;
      while ((msg = consumer.receive(1000)) != null) {
        Assert.assertTrue(expectedShippingOrders.remove(hqMixIn.readStringFromJMSMessage(msg)));
      }
      Assert.assertEquals(0, expectedShippingOrders.size());

      consumer = session.createConsumer(HornetQMixIn.getJMSQueue(FILLING_STOCK_QUEUE));
      List<String> expectedFillingStockOrders =
          new ArrayList<String>(Arrays.asList("PIZZA", "POTATO"));
      while ((msg = consumer.receive(1000)) != null) {
        Assert.assertTrue(expectedFillingStockOrders.remove(hqMixIn.readStringFromJMSMessage(msg)));
      }
      Assert.assertEquals(0, expectedFillingStockOrders.size());
    } finally {
      hqMixIn.uninitialize();
      ResourceDeployer.removeQueue(ORDER_QUEUE);
      ResourceDeployer.removeQueue(SHIPPING_QUEUE);
      ResourceDeployer.removeQueue(FILLING_STOCK_QUEUE);
    }
  }
  @Test
  public void testDeployment() throws Exception {
    HornetQMixIn hqMixIn = new HornetQMixIn(false).setUser(USER).setPassword(PASSWD);
    hqMixIn.initialize();

    try {
      Session session = hqMixIn.getJMSSession();
      MessageProducer producer = session.createProducer(HornetQMixIn.getJMSQueue(QUEUE));
      Message message = hqMixIn.createJMSMessage("Tomo");
      producer.send(message);
    } finally {
      hqMixIn.uninitialize();
      ResourceDeployer.removeQueue(QUEUE);
    }
  }
 @Deployment(testable = false)
 public static JavaArchive createDeployment() throws IOException {
   ResourceDeployer.addQueue(QUEUE);
   ResourceDeployer.addPropertiesUser(USER, PASSWD);
   return ArquillianUtil.createJarQSDeployment("switchyard-quickstart-camel-jms-binding");
 }