@Test
  public void testBindingAttributes() throws Exception {
    ClientSession session = basicSetUp();

    session.createQueue("addressName1", "queueName1", true);
    session.createQueue("addressName1", "queueName2", "bob", true);

    session.close();
    locator.close();
    server.stop();

    ByteArrayOutputStream xmlOutputStream = new ByteArrayOutputStream();
    XmlDataExporter xmlDataExporter = new XmlDataExporter();
    xmlDataExporter.process(
        xmlOutputStream,
        server.getConfiguration().getBindingsDirectory(),
        server.getConfiguration().getJournalDirectory(),
        server.getConfiguration().getPagingDirectory(),
        server.getConfiguration().getLargeMessagesDirectory());
    System.out.print(new String(xmlOutputStream.toByteArray()));

    clearDataRecreateServerDirs();
    server.start();
    locator = createInVMNonHALocator();
    factory = createSessionFactory(locator);
    session = factory.createSession(false, true, true);

    ByteArrayInputStream xmlInputStream = new ByteArrayInputStream(xmlOutputStream.toByteArray());
    XmlDataImporter xmlDataImporter = new XmlDataImporter();
    xmlDataImporter.process(xmlInputStream, session);

    ClientSession.QueueQuery queueQuery = session.queueQuery(new SimpleString("queueName1"));

    assertEquals("addressName1", queueQuery.getAddress().toString());
    assertNull(queueQuery.getFilterString());

    queueQuery = session.queueQuery(new SimpleString("queueName2"));

    assertEquals("addressName1", queueQuery.getAddress().toString());
    assertEquals("bob", queueQuery.getFilterString().toString());
    assertEquals(true, queueQuery.isDurable());
  }
  private boolean subscriptionExists(String subscriptionId) {
    ClientSession session = null;
    try {
      session = sessionFactory.createSession();

      ClientSession.QueueQuery query = session.queueQuery(new SimpleString(subscriptionId));
      return query.isExists();
    } catch (ActiveMQException e) {
      throw new RuntimeException(e);
    } finally {
      if (session != null) {
        try {
          session.close();
        } catch (ActiveMQException e) {
        }
      }
    }
  }
  public void testDuplicate() throws Exception {
    ActiveMQDestination queue = (ActiveMQDestination) session.createQueue("TEST,TEST");
    for (int i = 0; i < data.length; i++) {
      Message message = createMessage(i);
      configureMessage(message);
      if (verbose) {
        LOG.info("About to send a message: " + message + " with text: " + data[i]);
      }
      producer.send(queue, message);
    }

    Thread.sleep(200); // wait for messages to be queue;

    try (ServerLocator locator = ServerLocatorImpl.newLocator("tcp://localhost:61616");
        ClientSessionFactory factory = locator.createSessionFactory();
        ClientSession session = factory.createSession()) {
      ClientSession.QueueQuery query = session.queueQuery(new SimpleString("jms.queue.TEST"));
      assertNotNull(query);
      assertEquals(data.length, query.getMessageCount());
    }
  }