@Test public void testIsValidDictionaryName() { DictionaryImportController cotroller = new DictionaryImportController(); assertTrue(!cotroller.isValidDictionaryName("wrong-name")); assertTrue(cotroller.isValidDictionaryName("ActionList")); }
public boolean isValidDictionaryName(String dictionaryName) { String nameCheck = dictionaryName.replace(".csv", ""); try { DictionaryNames mode = DictionaryNames.valueOf(nameCheck); switch (mode) { case Attribute: case ActionPolicyDictionary: case OnapName: case MSPolicyDictionary: case OptimizationPolicyDictionary: case VNFType: case VSCLAction: case ClosedLoopService: case ClosedLoopSite: case PepOptions: case VarbindDictionary: case BRMSParamDictionary: case BRMSControllerDictionary: case BRMSDependencyDictionary: case Settings: case PrefixList: case SecurityZone: case Zone: case ServiceList: case ServiceGroup: case AddressGroup: case ProtocolList: case ActionList: case TermList: case SearchCriteria: return true; default: return false; } } catch (Exception e) { LOGGER.error("Dictionary not exits: " + dictionaryName + e); return false; } }
DictionaryImportController { public boolean isValidDictionaryName(String dictionaryName) { String nameCheck = dictionaryName.replace(".csv", ""); try { DictionaryNames mode = DictionaryNames.valueOf(nameCheck); switch (mode) { case Attribute: case ActionPolicyDictionary: case OnapName: case MSPolicyDictionary: case OptimizationPolicyDictionary: case VNFType: case VSCLAction: case ClosedLoopService: case ClosedLoopSite: case PepOptions: case VarbindDictionary: case BRMSParamDictionary: case BRMSControllerDictionary: case BRMSDependencyDictionary: case Settings: case PrefixList: case SecurityZone: case Zone: case ServiceList: case ServiceGroup: case AddressGroup: case ProtocolList: case ActionList: case TermList: case SearchCriteria: return true; default: return false; } } catch (Exception e) { LOGGER.error("Dictionary not exits: " + dictionaryName + e); return false; } } }
DictionaryImportController { public boolean isValidDictionaryName(String dictionaryName) { String nameCheck = dictionaryName.replace(".csv", ""); try { DictionaryNames mode = DictionaryNames.valueOf(nameCheck); switch (mode) { case Attribute: case ActionPolicyDictionary: case OnapName: case MSPolicyDictionary: case OptimizationPolicyDictionary: case VNFType: case VSCLAction: case ClosedLoopService: case ClosedLoopSite: case PepOptions: case VarbindDictionary: case BRMSParamDictionary: case BRMSControllerDictionary: case BRMSDependencyDictionary: case Settings: case PrefixList: case SecurityZone: case Zone: case ServiceList: case ServiceGroup: case AddressGroup: case ProtocolList: case ActionList: case TermList: case SearchCriteria: return true; default: return false; } } catch (Exception e) { LOGGER.error("Dictionary not exits: " + dictionaryName + e); return false; } } @Autowired  DictionaryImportController(CommonClassDao commonClassDao);  DictionaryImportController(); }
DictionaryImportController { public boolean isValidDictionaryName(String dictionaryName) { String nameCheck = dictionaryName.replace(".csv", ""); try { DictionaryNames mode = DictionaryNames.valueOf(nameCheck); switch (mode) { case Attribute: case ActionPolicyDictionary: case OnapName: case MSPolicyDictionary: case OptimizationPolicyDictionary: case VNFType: case VSCLAction: case ClosedLoopService: case ClosedLoopSite: case PepOptions: case VarbindDictionary: case BRMSParamDictionary: case BRMSControllerDictionary: case BRMSDependencyDictionary: case Settings: case PrefixList: case SecurityZone: case Zone: case ServiceList: case ServiceGroup: case AddressGroup: case ProtocolList: case ActionList: case TermList: case SearchCriteria: return true; default: return false; } } catch (Exception e) { LOGGER.error("Dictionary not exits: " + dictionaryName + e); return false; } } @Autowired  DictionaryImportController(CommonClassDao commonClassDao);  DictionaryImportController(); static void setCommonClassDao(CommonClassDao commonClassDao); @RequestMapping(value = {"/dictionary/import_dictionary"}, method = {RequestMethod.POST}) void importDictionaryData(HttpServletRequest request, HttpServletResponse response); boolean isValidDictionaryName(String dictionaryName); }
DictionaryImportController { public boolean isValidDictionaryName(String dictionaryName) { String nameCheck = dictionaryName.replace(".csv", ""); try { DictionaryNames mode = DictionaryNames.valueOf(nameCheck); switch (mode) { case Attribute: case ActionPolicyDictionary: case OnapName: case MSPolicyDictionary: case OptimizationPolicyDictionary: case VNFType: case VSCLAction: case ClosedLoopService: case ClosedLoopSite: case PepOptions: case VarbindDictionary: case BRMSParamDictionary: case BRMSControllerDictionary: case BRMSDependencyDictionary: case Settings: case PrefixList: case SecurityZone: case Zone: case ServiceList: case ServiceGroup: case AddressGroup: case ProtocolList: case ActionList: case TermList: case SearchCriteria: return true; default: return false; } } catch (Exception e) { LOGGER.error("Dictionary not exits: " + dictionaryName + e); return false; } } @Autowired  DictionaryImportController(CommonClassDao commonClassDao);  DictionaryImportController(); static void setCommonClassDao(CommonClassDao commonClassDao); @RequestMapping(value = {"/dictionary/import_dictionary"}, method = {RequestMethod.POST}) void importDictionaryData(HttpServletRequest request, HttpServletResponse response); boolean isValidDictionaryName(String dictionaryName);  }