@@ -55,6 +55,7 @@ public class SQSMessageTest {
55
55
final String myString = "myString" ;
56
56
final String myCustomString = "myCustomString" ;
57
57
final String myNumber = "myNumber" ;
58
+ final String myBinary = "myBinary" ;
58
59
59
60
@ Before
60
61
public void setup () {
@@ -79,6 +80,7 @@ public void testProperty() throws JMSException {
79
80
message .setByteProperty ("myByteProperty" , (byte ) 'a' );
80
81
message .setStringProperty ("myString" , "StringValue" );
81
82
message .setStringProperty ("myNumber" , "500" );
83
+ message .setStringProperty ("myBinary" , "binarydata" );
82
84
83
85
Assert .assertTrue (message .propertyExists ("myTrueBoolean" ));
84
86
Assert .assertEquals (message .getObjectProperty ("myTrueBoolean" ), true );
@@ -125,6 +127,10 @@ public void testProperty() throws JMSException {
125
127
Assert .assertEquals (message .getDoubleProperty ("myNumber" ), 500d );
126
128
Assert .assertEquals (message .getIntProperty ("myNumber" ), 500 );
127
129
130
+ Assert .assertTrue (message .propertyExists ("myBinary" ));
131
+ Assert .assertEquals (message .getObjectProperty ("myBinary" ), "binarydata" );
132
+ Assert .assertEquals (message .getStringProperty ("myBinary" ), "binarydata" );
133
+
128
134
// Validate property names
129
135
Set <String > propertyNamesSet = new HashSet <String >(Arrays .asList (
130
136
"myTrueBoolean" ,
@@ -136,6 +142,7 @@ public void testProperty() throws JMSException {
136
142
"myShort" ,
137
143
"myByteProperty" ,
138
144
"myNumber" ,
145
+ "myBinary" ,
139
146
"myString" ));
140
147
141
148
Enumeration <String > propertyNames = message .getPropertyNames ();
@@ -156,6 +163,7 @@ public void testProperty() throws JMSException {
156
163
Assert .assertFalse (message .propertyExists ("myByteProperty" ));
157
164
Assert .assertFalse (message .propertyExists ("myString" ));
158
165
Assert .assertFalse (message .propertyExists ("myNumber" ));
166
+ Assert .assertFalse (message .propertyExists ("myBinary" ));
159
167
160
168
propertyNames = message .getPropertyNames ();
161
169
assertFalse (propertyNames .hasMoreElements ());
@@ -335,6 +343,10 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
335
343
.withDataType (SQSMessagingClientConstants .NUMBER )
336
344
.withStringValue ("500" ));
337
345
346
+ messageAttributes .put (myBinary , new MessageAttributeValue ()
347
+ .withDataType (SQSMessagingClientConstants .BINARY )
348
+ .withStringValue ("binarydata" ));
349
+
338
350
com .amazonaws .services .sqs .model .Message sqsMessage = new com .amazonaws .services .sqs .model .Message ()
339
351
.withMessageAttributes (messageAttributes )
340
352
.withAttributes (systemAttributes )
@@ -392,6 +404,9 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
392
404
Assert .assertEquals (message .getFloatProperty (myNumber ), 500f );
393
405
Assert .assertEquals (message .getDoubleProperty (myNumber ), 500d );
394
406
407
+ Assert .assertTrue (message .propertyExists (myBinary ));
408
+ Assert .assertEquals (message .getObjectProperty (myBinary ), "binarydata" );
409
+ Assert .assertEquals (message .getStringProperty (myBinary ), "binarydata" );
395
410
396
411
// Validate property names
397
412
Set <String > propertyNamesSet = new HashSet <String >(Arrays .asList (
@@ -406,6 +421,7 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
406
421
myString ,
407
422
myCustomString ,
408
423
myNumber ,
424
+ myBinary ,
409
425
JMSX_DELIVERY_COUNT ));
410
426
411
427
Enumeration <String > propertyNames = message .getPropertyNames ();
@@ -426,6 +442,7 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
426
442
Assert .assertFalse (message .propertyExists ("myByteProperty" ));
427
443
Assert .assertFalse (message .propertyExists ("myString" ));
428
444
Assert .assertFalse (message .propertyExists ("myNumber" ));
445
+ Assert .assertFalse (message .propertyExists ("myBinary" ));
429
446
430
447
propertyNames = message .getPropertyNames ();
431
448
assertFalse (propertyNames .hasMoreElements ());
0 commit comments