javax.jms.InvalidSelectorException Java Examples
The following examples show how to use
javax.jms.InvalidSelectorException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionIntegrationTest.java From qpid-jms with Apache License 2.0 | 6 votes |
@Test(timeout = 20000) public void testInvalidSelector() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { Connection connection = testFixture.establishConnecton(testPeer); connection.start(); testPeer.expectBegin(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String topicName = "myTopic"; Topic destination = session.createTopic(topicName); try { session.createConsumer(destination, "3+5"); fail("Should have thrown a invalid selector exception"); } catch (InvalidSelectorException jmsse) { } testPeer.expectClose(); connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }
Example #2
Source File: SelectorParserTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
public void testFunctionCall() throws Exception { Object filter = parse("REGEX('sales.*', group)"); assertTrue("expected type", filter instanceof BooleanFunctionCallExpr); LOG.info("function exp:" + filter); // non existent function try { parse("DoesNotExist('sales.*', group)"); fail("expect ex on non existent function"); } catch (InvalidSelectorException expected) { } }
Example #3
Source File: SelectorTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void assertInvalidSelector(Message message, String text) throws JMSException { try { SelectorParser.parse(text); fail("Created a valid selector"); } catch (InvalidSelectorException e) { } }
Example #4
Source File: NonDurableSubscriberTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testInvalidSelectorOnSubscription() throws Exception { TopicConnection c = createTopicConnection(); c.setClientID("something"); TopicSession s = c.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); try { s.createSubscriber(ActiveMQServerTestCase.topic1, "=TEST 'test'", false); ProxyAssertSupport.fail("this should fail"); } catch (InvalidSelectorException e) { // OK } }
Example #5
Source File: DurableSubscriptionTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testInvalidSelectorException() throws Exception { Connection c = createConnection(); c.setClientID("sofiavergara"); Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE); try { s.createDurableSubscriber(ActiveMQServerTestCase.topic1, "mysubscribption", "=TEST 'test'", true); ProxyAssertSupport.fail("this should fail"); } catch (InvalidSelectorException e) { // OK } }
Example #6
Source File: JmsExceptionUtils.java From activemq-artemis with Apache License 2.0 | 5 votes |
/** * Converts instances of sub-classes of {@link JMSException} into the corresponding sub-class of * {@link JMSRuntimeException}. * * @param e * @return */ public static JMSRuntimeException convertToRuntimeException(JMSException e) { if (e instanceof javax.jms.IllegalStateException) { return new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof InvalidClientIDException) { return new InvalidClientIDRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof InvalidDestinationException) { return new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof InvalidSelectorException) { return new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof JMSSecurityException) { return new JMSSecurityRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof MessageFormatException) { return new MessageFormatRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof MessageNotWriteableException) { return new MessageNotWriteableRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof ResourceAllocationException) { return new ResourceAllocationRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof TransactionInProgressException) { return new TransactionInProgressRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof TransactionRolledBackException) { return new TransactionRolledBackRuntimeException(e.getMessage(), e.getErrorCode(), e); } return new JMSRuntimeException(e.getMessage(), e.getErrorCode(), e); }
Example #7
Source File: JmsSession.java From qpid-jms with Apache License 2.0 | 5 votes |
static String checkSelector(String selector) throws InvalidSelectorException { if (selector != null) { if (selector.trim().length() == 0) { return null; } try { SelectorParser.parse(selector); } catch (FilterException e) { throw new InvalidSelectorException(e.getMessage()); } } return selector; }
Example #8
Source File: JMS2.java From tomee with Apache License 2.0 | 5 votes |
public static JMSRuntimeException toRuntimeException(final JMSException e) { if (e instanceof javax.jms.IllegalStateException) { return new IllegalStateRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof InvalidClientIDException) { return new InvalidClientIDRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof InvalidDestinationException) { return new InvalidDestinationRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof InvalidSelectorException) { return new InvalidSelectorRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof JMSSecurityException) { return new JMSSecurityRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof MessageFormatException) { return new MessageFormatRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof MessageNotWriteableException) { return new MessageNotWriteableRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof ResourceAllocationException) { return new ResourceAllocationRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof TransactionInProgressException) { return new TransactionInProgressRuntimeException(e.getMessage(), e.getErrorCode(), e); } if (e instanceof TransactionRolledBackException) { return new TransactionRolledBackRuntimeException(e.getMessage(), e.getErrorCode(), e); } return new JMSRuntimeException(e.getMessage(), e.getErrorCode(), e); }
Example #9
Source File: JMSExceptionSupportTest.java From pooled-jms with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSelectorRuntimeException.class) public void testConvertsInvalidSelectorExceptionToInvalidSelectorRuntimeException() { throw JMSExceptionSupport.createRuntimeException(new InvalidSelectorException("error")); }
Example #10
Source File: SubscriptionAddRemoveQueueTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override public void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException { }
Example #11
Source File: JMSExceptionHelperTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test public void testINVALID_FILTER_EXPRESSION() throws Exception { doConvertException(INVALID_FILTER_EXPRESSION, InvalidSelectorException.class); }
Example #12
Source File: JmsExceptionSupportTest.java From qpid-jms with Apache License 2.0 | 4 votes |
@Test(expected = InvalidSelectorRuntimeException.class) public void testConvertsInvalidSelectorExceptionToInvalidSelectorRuntimeException() { throw JmsExceptionSupport.createRuntimeException(new InvalidSelectorException("error")); }