public void testCreateConsumerWithFilter() throws Exception {
   HornetQServer service = createServer(false);
   try {
     service.start();
     ClientSessionFactory cf = createInVMFactory();
     cf.setProducerMaxRate(99);
     cf.setBlockOnNonDurableSend(true);
     cf.setBlockOnNonDurableSend(true);
     ClientSessionInternal clientSession =
         (ClientSessionInternal) cf.createSession(false, true, true);
     clientSession.createQueue(queueName, queueName, false);
     ClientConsumer consumer = clientSession.createConsumer(queueName, "foo=bar");
     Assert.assertNotNull(consumer);
     clientSession.close();
   } finally {
     service.stop();
   }
 }
 public void testCreateConsumerNoQ() throws Exception {
   HornetQServer service = createServer(false);
   try {
     service.start();
     ClientSessionFactory cf = createInVMFactory();
     cf.setProducerMaxRate(99);
     cf.setBlockOnNonDurableSend(true);
     cf.setBlockOnNonDurableSend(true);
     ClientSessionInternal clientSession =
         (ClientSessionInternal) cf.createSession(false, true, true);
     try {
       clientSession.createConsumer(queueName);
       Assert.fail("should throw exception");
     } catch (HornetQException e) {
       Assert.assertEquals(e.getCode(), HornetQException.QUEUE_DOES_NOT_EXIST);
     }
     clientSession.close();
   } finally {
     service.stop();
   }
 }
 public void testCreateConsumerWithInvalidFilter() throws Exception {
   HornetQServer service = createServer(false);
   try {
     service.start();
     ClientSessionFactory cf = createInVMFactory();
     cf.setProducerMaxRate(99);
     cf.setBlockOnNonDurableSend(true);
     cf.setBlockOnNonDurableSend(true);
     ClientSessionInternal clientSession =
         (ClientSessionInternal) cf.createSession(false, true, true);
     clientSession.createQueue(queueName, queueName, false);
     try {
       clientSession.createConsumer(queueName, "foobar");
       Assert.fail("should throw exception");
     } catch (HornetQException e) {
       Assert.assertEquals(e.getCode(), HornetQException.INVALID_FILTER_EXPRESSION);
     }
     clientSession.close();
   } finally {
     service.stop();
   }
 }