// construct message
List<Map<String, String>> partitionsList = new ArrayList<Map<String,String>>();
partitionsList.add(getPartitionMap("dt=20120101;country=us;state=CA"));
partitionsList.add(getPartitionMap("dt=20120101;country=us;state=NY"));
JSONAddPartitionMessage jsonMsg = new JSONAddPartitionMessage("thrift://"+dep1.getServer(), "", dep1.getDb(),
dep1.getTable(), partitionsList, System.currentTimeMillis());
Message msg = session.createTextMessage(jsonMsg.toString());
msg.setStringProperty(HCatConstants.HCAT_EVENT, HCatEventMessage.EventType.ADD_PARTITION.toString());
// test message processing
HCatMessageHandler hcatHandler = new HCatMessageHandler("hcat.server.com:5080");
hcatHandler.process(msg);
assertNull(pdms.getWaitingActions(dep1));
assertNull(pdms.getWaitingActions(dep2));
assertTrue(pdms.getWaitingActions(dep3).contains(actionId3));
assertTrue(pdms.getWaitingActions(dep4).contains(actionId4));
//test message processing through JMS notification listener
partitionsList.clear();
partitionsList.add(getPartitionMap("dt=20120102;country=us;state=CA"));
partitionsList.add(getPartitionMap("dt=20120102;country=us;state=NY"));
jsonMsg = new JSONAddPartitionMessage("thrift://"+dep1.getServer(), "", dep1.getDb(),
dep1.getTable(), partitionsList, System.currentTimeMillis());
msg = session.createTextMessage(jsonMsg.toString());
msg.setStringProperty(HCatConstants.HCAT_EVENT, HCatEventMessage.EventType.ADD_PARTITION.toString());
HCatAccessorService hcatService = Services.get().get(HCatAccessorService.class);
hcatService.registerForNotification(dep1, "hcat.topic1", hcatHandler);
Topic topic = session.createTopic("hcat.topic1");
MessageProducer producer = session.createProducer(topic);