use of com.swiftmq.amqp.v100.types.AMQPLong in project swiftmq-ce by iitsoftware.
the class AMQPValueMapMessageFactory method verify.
public void verify(AMQPMessage message) throws Exception {
AmqpValue value = message.getAmqpValue();
if (value == null)
throw new Exception(("verify - no AmqpValue section found!"));
AMQPType t = value.getValue();
if (!(t instanceof AMQPMap))
throw new Exception(("verify - AmqpValue does not contain an AmqpMap!"));
Map map = ((AMQPMap) message.getAmqpValue().getValue()).getValue();
for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
if (!((entry.getKey() instanceof AMQPString && ((AMQPString) entry.getKey()).getValue().equals("key1")) || (entry.getKey() instanceof AMQPString && ((AMQPString) entry.getKey()).getValue().equals("key3")) || (entry.getKey() instanceof AMQPString && ((AMQPString) entry.getKey()).getValue().equals("REPLY")) || (entry.getKey() instanceof AMQPString && ((AMQPString) entry.getKey()).getValue().equals(String.valueOf(Integer.MAX_VALUE + 1))) || (entry.getKey() instanceof AMQPString && ((AMQPString) entry.getKey()).getValue().equals(String.valueOf(Integer.MAX_VALUE + 2))) || (entry.getKey() instanceof AMQPLong && ((AMQPLong) entry.getKey()).getValue() == Integer.MAX_VALUE + 1) || (entry.getKey() instanceof AMQPLong && ((AMQPLong) entry.getKey()).getValue() == Integer.MAX_VALUE + 2))) {
System.out.println(map);
throw new Exception("verify - invalid values in map detected: " + map);
}
}
}
use of com.swiftmq.amqp.v100.types.AMQPLong in project swiftmq-ce by iitsoftware.
the class AMQPValueMapMessageFactory method create.
public AMQPMessage create(int sequenceNo) throws Exception {
AMQPMessage msg = new AMQPMessage();
Map map = new HashMap();
map.put(new AMQPString("key1"), new AMQPString("value1"));
map.put(new AMQPLong(Integer.MAX_VALUE + 1), new AMQPLong(200));
map.put(new AMQPString("key3"), new AMQPString("value1"));
map.put(new AMQPLong(Integer.MAX_VALUE + 2), new AMQPLong(400));
msg.setAmqpValue(new AmqpValue(new AMQPMap(map)));
return msg;
}
use of com.swiftmq.amqp.v100.types.AMQPLong in project swiftmq-ce by iitsoftware.
the class AMQPSequenceMessageFactory method create.
public AMQPMessage create(int sequenceNo) throws Exception {
AMQPMessage msg = new AMQPMessage();
List list = new ArrayList();
list.add(new AMQPString("key1"));
list.add(new AMQPLong(Integer.MAX_VALUE + 1));
list.add(new AMQPString("key3"));
list.add(new AMQPLong(Integer.MAX_VALUE + 2));
msg.addAmqpSequence(new AmqpSequence(list));
return msg;
}
Aggregations