@@ -54,6 +54,7 @@ public class SQSMessageTest {
54
54
final String myByte = "myByte" ;
55
55
final String myString = "myString" ;
56
56
final String myNumber = "myNumber" ;
57
+ final String myBinary = "myBinary" ;
57
58
58
59
@ Before
59
60
public void setup () {
@@ -78,6 +79,7 @@ public void testProperty() throws JMSException {
78
79
message .setByteProperty ("myByteProperty" , (byte ) 'a' );
79
80
message .setStringProperty ("myString" , "StringValue" );
80
81
message .setStringProperty ("myNumber" , "500" );
82
+ message .setStringProperty ("myBinary" , "binarydata" );
81
83
82
84
Assert .assertTrue (message .propertyExists ("myTrueBoolean" ));
83
85
Assert .assertEquals (message .getObjectProperty ("myTrueBoolean" ), true );
@@ -124,6 +126,10 @@ public void testProperty() throws JMSException {
124
126
Assert .assertEquals (message .getDoubleProperty ("myNumber" ), 500d );
125
127
Assert .assertEquals (message .getIntProperty ("myNumber" ), 500 );
126
128
129
+ Assert .assertTrue (message .propertyExists ("myBinary" ));
130
+ Assert .assertEquals (message .getObjectProperty ("myBinary" ), "binarydata" );
131
+ Assert .assertEquals (message .getStringProperty ("myBinary" ), "binarydata" );
132
+
127
133
// Validate property names
128
134
Set <String > propertyNamesSet = new HashSet <String >(Arrays .asList (
129
135
"myTrueBoolean" ,
@@ -135,6 +141,7 @@ public void testProperty() throws JMSException {
135
141
"myShort" ,
136
142
"myByteProperty" ,
137
143
"myNumber" ,
144
+ "myBinary" ,
138
145
"myString" ));
139
146
140
147
Enumeration <String > propertyNames = message .getPropertyNames ();
@@ -155,6 +162,7 @@ public void testProperty() throws JMSException {
155
162
Assert .assertFalse (message .propertyExists ("myByteProperty" ));
156
163
Assert .assertFalse (message .propertyExists ("myString" ));
157
164
Assert .assertFalse (message .propertyExists ("myNumber" ));
165
+ Assert .assertFalse (message .propertyExists ("myBinary" ));
158
166
159
167
propertyNames = message .getPropertyNames ();
160
168
assertFalse (propertyNames .hasMoreElements ());
@@ -330,6 +338,10 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
330
338
.withDataType (SQSMessagingClientConstants .NUMBER )
331
339
.withStringValue ("500" ));
332
340
341
+ messageAttributes .put (myBinary , new MessageAttributeValue ()
342
+ .withDataType (SQSMessagingClientConstants .BINARY )
343
+ .withStringValue ("binarydata" ));
344
+
333
345
com .amazonaws .services .sqs .model .Message sqsMessage = new com .amazonaws .services .sqs .model .Message ()
334
346
.withMessageAttributes (messageAttributes )
335
347
.withAttributes (systemAttributes )
@@ -383,6 +395,9 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
383
395
Assert .assertEquals (message .getFloatProperty (myNumber ), 500f );
384
396
Assert .assertEquals (message .getDoubleProperty (myNumber ), 500d );
385
397
398
+ Assert .assertTrue (message .propertyExists (myBinary ));
399
+ Assert .assertEquals (message .getObjectProperty (myBinary ), "binarydata" );
400
+ Assert .assertEquals (message .getStringProperty (myBinary ), "binarydata" );
386
401
387
402
// Validate property names
388
403
Set <String > propertyNamesSet = new HashSet <String >(Arrays .asList (
@@ -396,6 +411,7 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
396
411
myByte ,
397
412
myString ,
398
413
myNumber ,
414
+ myBinary ,
399
415
JMSX_DELIVERY_COUNT ));
400
416
401
417
Enumeration <String > propertyNames = message .getPropertyNames ();
@@ -416,6 +432,7 @@ public void testSQSMessageAttributeToProperty() throws JMSException {
416
432
Assert .assertFalse (message .propertyExists ("myByteProperty" ));
417
433
Assert .assertFalse (message .propertyExists ("myString" ));
418
434
Assert .assertFalse (message .propertyExists ("myNumber" ));
435
+ Assert .assertFalse (message .propertyExists ("myBinary" ));
419
436
420
437
propertyNames = message .getPropertyNames ();
421
438
assertFalse (propertyNames .hasMoreElements ());
0 commit comments