InformationElementServiceImpl implements InformationElementService { @Override public void loadInformationElementMapping(String family, File file) { loadInformationElementMappingInternal(family, file); } InformationElementServiceImpl(InformationElementCache ieCache); @Override InformationElement getInformationElement(String family, int informationElementId); @Override InformationElement getInformationElement(long enterpriseNumber, String informationElementName); @Override boolean isIECacheAvailable(); @Override void loadInformationElementMapping(String family, File file); @Override boolean removeInformationElementMapping(String deviceFamily); @Override void setIeMappingCacheService(IEMappingCacheService ieMappingCacheService);  }
@Test public void testLoadInformationElementMapping() { String family = "family"; ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("ie-mapping/IPFIX_IEId.csv").getFile()); m_informationElementService.loadInformationElementMapping(family, file); InformationElement ie = new InformationElement(); ie.setElementId(1); ie.setDataType(InformationElementType.STRING); ie.setName("/if:interfaces/if:interface/if:name"); ie.setDataTypeSemantics("default"); ie.setStatus("current"); ie.setDescription("A short name uniquely describing an interface, eg \"Eth1/0\"."); ie.setUnits(""); ie.setRange(""); ie.setReferences("See [RFC2863] for the definition of the ifName object."); ie.setRequester(""); ie.setRevision("0"); ie.setDate("20-11-2019"); verify(m_cache).putInformationElementId(family, ie); }
@Test public void testLoadInformationElementMappingWithCSVMissMatchHeader() { String family = "family"; ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("ie-mapping/IPFIX_IEId_Header_Miss_Match.csv").getFile()); m_informationElementService.loadInformationElementMapping(family, file); verifyZeroInteractions(m_cache); }