public void testCreateConsumerWithInvalidFilter() throws Exception {
   clientSession.createQueue(queueName, queueName, false);
   try {
     clientSession.createConsumer(queueName, "this is not valid filter");
     Assert.fail("should throw exception");
   } catch (InvalidFilterExpressionException ifee) {
     // ok
   } catch (HornetQException e) {
     fail("Invalid Exception type:" + e.getType());
   }
 }
 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 {
   try {
     clientSession.createConsumer(queueName);
     Assert.fail("should throw exception");
   } catch (NonExistentQueueException neqe) {
     // ok
   } catch (HornetQException e) {
     fail("Invalid Exception type:" + e.getType());
   }
 }
 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();
   }
 }
 public void testCreateConsumerWithOverrides() throws Exception {
   clientSession.createQueue(queueName, queueName, false);
   ClientConsumer consumer = clientSession.createConsumer(queueName, null, 100, 100, false);
   Assert.assertNotNull(consumer);
 }
 public void testCreateConsumerWithBrowseOnly() throws Exception {
   clientSession.createQueue(queueName, queueName, false);
   ClientConsumer consumer = clientSession.createConsumer(queueName, null, true);
   Assert.assertNotNull(consumer);
 }
 public void testCreateConsumerWithFilter() throws Exception {
   clientSession.createQueue(queueName, queueName, false);
   ClientConsumer consumer = clientSession.createConsumer(queueName, "foo=bar");
   Assert.assertNotNull(consumer);
 }