mirror of https://github.com/apache/activemq.git
Test and Fix for http://issues.apache.org/activemq/browse/AMQ-715
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@407816 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bca487a2bb
commit
0fd46ce621
|
@ -351,7 +351,42 @@ public abstract class ComparisonExpression extends BinaryExpression implements B
|
||||||
// If the the objects are not of the same type,
|
// If the the objects are not of the same type,
|
||||||
// try to convert up to allow the comparison.
|
// try to convert up to allow the comparison.
|
||||||
if (lc != rc) {
|
if (lc != rc) {
|
||||||
if (lc == Integer.class) {
|
if (lc == Byte.class) {
|
||||||
|
if (rc == Short.class) {
|
||||||
|
lv = new Short(((Number) lv).shortValue());
|
||||||
|
}
|
||||||
|
else if (rc == Integer.class) {
|
||||||
|
lv = new Integer(((Number) lv).intValue());
|
||||||
|
}
|
||||||
|
else if (rc == Long.class) {
|
||||||
|
lv = new Long(((Number) lv).longValue());
|
||||||
|
}
|
||||||
|
else if (rc == Float.class) {
|
||||||
|
lv = new Float(((Number) lv).floatValue());
|
||||||
|
}
|
||||||
|
else if (rc == Double.class) {
|
||||||
|
lv = new Double(((Number) lv).doubleValue());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
} else if (lc == Short.class) {
|
||||||
|
if (rc == Integer.class) {
|
||||||
|
lv = new Integer(((Number) lv).intValue());
|
||||||
|
}
|
||||||
|
else if (rc == Long.class) {
|
||||||
|
lv = new Long(((Number) lv).longValue());
|
||||||
|
}
|
||||||
|
else if (rc == Float.class) {
|
||||||
|
lv = new Float(((Number) lv).floatValue());
|
||||||
|
}
|
||||||
|
else if (rc == Double.class) {
|
||||||
|
lv = new Double(((Number) lv).doubleValue());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
} else if (lc == Integer.class) {
|
||||||
if (rc == Long.class) {
|
if (rc == Long.class) {
|
||||||
lv = new Long(((Number) lv).longValue());
|
lv = new Long(((Number) lv).longValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,33 @@ public class SelectorTest extends TestCase {
|
||||||
assertSelector(message, "rank > 100", true);
|
assertSelector(message, "rank > 100", true);
|
||||||
assertSelector(message, "rank >= 123", true);
|
assertSelector(message, "rank >= 123", true);
|
||||||
assertSelector(message, "rank >= 124", false);
|
assertSelector(message, "rank >= 124", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testPropertyTypes() throws Exception {
|
||||||
|
Message message = createMessage();
|
||||||
|
assertSelector(message, "byteProp = 123", true);
|
||||||
|
assertSelector(message, "byteProp = 10", false);
|
||||||
|
|
||||||
|
assertSelector(message, "shortProp = 123", true);
|
||||||
|
assertSelector(message, "shortProp = 10", false);
|
||||||
|
|
||||||
|
|
||||||
|
assertSelector(message, "shortProp = 123", true);
|
||||||
|
assertSelector(message, "shortProp = 10", false);
|
||||||
|
|
||||||
|
assertSelector(message, "intProp = 123", true);
|
||||||
|
assertSelector(message, "intProp = 10", false);
|
||||||
|
|
||||||
|
assertSelector(message, "longProp = 123", true);
|
||||||
|
assertSelector(message, "longProp = 10", false);
|
||||||
|
|
||||||
|
assertSelector(message, "floatProp = 123", true);
|
||||||
|
assertSelector(message, "floatProp = 10", false);
|
||||||
|
|
||||||
|
assertSelector(message, "doubleProp = 123", true);
|
||||||
|
assertSelector(message, "doubleProp = 10", false);
|
||||||
|
}
|
||||||
public void testAndSelectors() throws Exception {
|
public void testAndSelectors() throws Exception {
|
||||||
Message message = createMessage();
|
Message message = createMessage();
|
||||||
|
|
||||||
|
@ -297,6 +322,14 @@ public class SelectorTest extends TestCase {
|
||||||
message.setJMSMessageID("connection:1:1:1:1");
|
message.setJMSMessageID("connection:1:1:1:1");
|
||||||
message.setObjectProperty("name", "James");
|
message.setObjectProperty("name", "James");
|
||||||
message.setObjectProperty("location", "London");
|
message.setObjectProperty("location", "London");
|
||||||
|
|
||||||
|
message.setByteProperty("byteProp", (byte)123);
|
||||||
|
message.setShortProperty("shortProp", (short)123);
|
||||||
|
message.setIntProperty("intProp", (int)123);
|
||||||
|
message.setLongProperty("longProp", (long)123);
|
||||||
|
message.setFloatProperty("floatProp", (float)123);
|
||||||
|
message.setDoubleProperty("doubleProp", (double)123);
|
||||||
|
|
||||||
message.setIntProperty("rank", 123);
|
message.setIntProperty("rank", 123);
|
||||||
message.setIntProperty("version", 2);
|
message.setIntProperty("version", 2);
|
||||||
message.setStringProperty("quote", "'In God We Trust'");
|
message.setStringProperty("quote", "'In God We Trust'");
|
||||||
|
|
Loading…
Reference in New Issue