ARTEMIS-2761 Supporting Quoted IDs to allow complex names in AMQP
copied/borrowed from fd2139c27d
This commit is contained in:
parent
47d0b6b84b
commit
88b7ee36a3
|
@ -131,6 +131,7 @@ TOKEN [IGNORE_CASE] :
|
||||||
TOKEN [IGNORE_CASE] :
|
TOKEN [IGNORE_CASE] :
|
||||||
{
|
{
|
||||||
< ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
|
< ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* >
|
||||||
|
| < QUOTED_ID : "\"" ( ("\"\"") | ~["\""] )* "\"" >
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -556,6 +557,20 @@ PropertyExpression variable() :
|
||||||
{
|
{
|
||||||
left = new PropertyExpression(t.image);
|
left = new PropertyExpression(t.image);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
t = <QUOTED_ID>
|
||||||
|
{
|
||||||
|
// Decode the string value.
|
||||||
|
StringBuffer rc = new StringBuffer();
|
||||||
|
String image = t.image;
|
||||||
|
for( int i=1; i < image.length()-1; i++ ) {
|
||||||
|
char c = image.charAt(i);
|
||||||
|
if( c == '"' )
|
||||||
|
i++;
|
||||||
|
rc.append(c);
|
||||||
|
}
|
||||||
|
return new PropertyExpression(rc.toString());
|
||||||
|
}
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return left;
|
return left;
|
||||||
|
|
|
@ -192,6 +192,16 @@ public class SelectorTest {
|
||||||
assertSelector(message, "JMSType = 'crap'", false);
|
assertSelector(message, "JMSType = 'crap'", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDottedProperty() throws Exception {
|
||||||
|
MockMessage message = createMessage();
|
||||||
|
message.setJMSType("selector-test");
|
||||||
|
message.setStringProperty("a.test", "value");
|
||||||
|
message.setJMSMessageID("id:test:1:1:1:1");
|
||||||
|
|
||||||
|
assertSelector(message, "\"a.test\" = 'value'", true);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicSelectors() throws Exception {
|
public void testBasicSelectors() throws Exception {
|
||||||
MockMessage message = createMessage();
|
MockMessage message = createMessage();
|
||||||
|
|
Loading…
Reference in New Issue