Closed abruzzi closed 8 years ago
<?xml version="1.0" encoding="UTF-8"?>
<EventDefs>
<NBIMappingNode>
<EventList>
<event id="0x0100" level="1">
<businessSrbPara>
<para name="srbID" value="30101" />
<para name="datasource" value="LTE_CELL_TRC " />
</businessSrbPara>
</event>
</EventList>
</NBIMappingNode>
</EventDefs>
@Test
public void should_generate_multiple_counters_given_multiple_datasource_and_config() throws IOException {
List<NEBusinessSubInfo> neBusinessSubInfoList = prepareNeBusinessSubInfo();
EventDefinition eventDefinition = prepareEventDefinition("/e-rab-setup-request-2-1.xml");
BusinessService businessService = new BusinessService(eventDefinition);
Subscription subscription = businessService.process(neBusinessSubInfoList);
assertThat(subscription.getCounters(), hasSize(2));
Counter expected1 = new Counter("NE256", "LTE_CELL_TRC", "30101");
Counter c1 = subscription.getCounters().get(0);
assertThat(c1, is(expected1));
Counter expected2 = new Counter("NE256", "PICO_CELL_TRC", "30101");
Counter c2 = subscription.getCounters().get(1);
assertThat(c2, is(expected2));
}
private EventDefinition prepareEventDefinition(String fileName) throws java.io.IOException {
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(false);
XmlMapper xmlMapper = new XmlMapper(module);
return xmlMapper.readValue(getClass().getResourceAsStream(fileName), EventDefinition.class);
}
private List<NEBusinessSubInfo> prepareNeBusinessSubInfo() {
NEBusinessSubInfo neBusinessSubInfo = new NEBusinessSubInfo("NE=256", "0", new String[]{"0x0100"});
List<NEBusinessSubInfo> neBusinessSubInfoList = new ArrayList<>();
neBusinessSubInfoList.add(neBusinessSubInfo);
return neBusinessSubInfoList;
}