JUnit Test NOSQL

@Test
@UsingDataSet(locations = {
"/test_data/input_data/OrchestrationServiceImplTest_eventListenerTestForOFOEventOfSeries.json" }, loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
@ShouldMatchDataSet(location = "/test_data/expected_data/OrchestrationServiceImplTest_eventListenerTestForOFOEventOfSeries.json")

@IgnorePropertyValue(properties = { "_id", "createdBy", "createdDate", "modifiedBy", "modifiedDate","offeringId","offeringType" })
public void eventListenerTestForOFOEventOfSeries() {


// setup input
EventMessage eventMessage = new EventMessage();
Map<String, Object> map = new HashMap<String, Object>();
map.put("entityGroup", "OFO");
map.put("entityName", "series");
map.put("entityId", "urn:esp:hbo:series:1c5d35d2e45e26238d4e0560b816a057");
map.put("service", "HBO");
map.put("offeringType", "series");
map.put("offeringId", "urn:esp:offering:program:abc123");
eventMessage.setHeaders(map);
String payload = "{ "
+ "       \"_id\": \"urn:woodmark:nls:seriesoffering:84B0461471264F9FB260ADC8747FD2E6\",     "
+ "       \"channelId\": \"urn:woodmark:blueprint:HBOGO\",                                   "
+ "       \"faaId\": \"urn:esp:hbo:series:1c5d35d2e45e26238d4e0560b816a057\",                                      "
+ "       \"startDate\": \"2004-07-18T00:00:000.000Z\",                             "
+ "       \"endDate\": \"2004-08-18T00:00:000.000Z\",                               "
+ "       \"offeringType\": \"SERIES\",                                                      "
+ "       \"images\": [                                                                      "
+ "           {                                                                              "
+ "               \"faaid\": \"image FAA id 1\",                                             "
+ "               \"did\": \"12345\",                                                        "
+ "               \"role\": \"SubPhoto17\"                                                   "
+ "           },                                                                             "
+ "           {                                                                              "
+ "               \"faaid\": \"image FAA id 2\",                                             "
+ "               \"did\": \"23456\",                                                        "
+ "               \"role\": \"SubPhoto15\"                                                   "
+ "           },                                                                             "
+ "           {                                                                              "
+ "               \"faaid\": \"image FAA id 3\",                                             "
+ "               \"did\": \"34567\",                                                        "
+ "               \"role\": \"SubPhoto3\"                                                    "
+ "           }                                                                              "
+ "       ],                                                                                 "
+ "       \"status\": \"PUBLISHED\",                                                         "
+ "       \"lastPublishedDate\": \"2004-08-18T00:00:000.000Z\",                     "
+ "       \"namespace\": \"hbous\",                                                          "
+ "       \"namespaceId\": \"SERS123\",                                                      "
+ "       \"schedulerOfferingId\": \"SERS2763-PMRS1D100031\"                                 "
+ "   }                                                                                      ";
eventMessage.setPayload(null);


Map<String, Object> orcaEvent = CommonUtils.convertPojoToMap(eventMessage);


if (logger.isDebugEnabled()) {
logger.debug("The orcaEvent is [" + orcaEvent + "]");
}


try {
String result = orchestrationService.eventListener(orcaEvent);
List<DeliveryRecord> list = mongoTemplate.findAll(DeliveryRecord.class);
Assert.assertEquals(Constants.OUTPUT_SUCESS, result);
} catch (Exception e) {
e.printStackTrace();


Assert.assertNull("Got exception", e);
}


}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章