@Test public void testProcessApidInfo2() throws Exception { String apidList = "1200;2400"; String gapList = "10"; String expected = "Apid#: 1200; Apid#: 2400; "; String apidInfo = MetadataBuilder.processApidInfo(apidList, gapList); Assert.assertEquals(expected, apidInfo); }
public static String processApidInfo(String apidnum, String apidgaps) { String stringParsed=""; if(apidnum!=null && apidgaps != null) { String[] apidnumList = apidnum.trim().split(";"); String[] apidgapsList = apidgaps.trim().split(";"); if(apidnumList.length == apidgapsList.length) { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+ " Apid total gaps: "+ (apidgapsList[i].isEmpty()?"-":apidgapsList[i])+"; "; } } else { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+"; "; } } } else { logger.error("Error getting Information on missing ISPs APID"); } logger.debug(" ************* missing ISPs APID: " + stringParsed); stringParsed=stringParsed.replace("Apid#: - Apid total gaps: -;", "N/A").replace("Apid#: -;", "N/A"); if(stringParsed.length()>MAX_METADATA_SIZE) { stringParsed=stringParsed.substring(0,MAX_METADATA_SIZE-4)+"..."; } return stringParsed; }
MetadataBuilder { public static String processApidInfo(String apidnum, String apidgaps) { String stringParsed=""; if(apidnum!=null && apidgaps != null) { String[] apidnumList = apidnum.trim().split(";"); String[] apidgapsList = apidgaps.trim().split(";"); if(apidnumList.length == apidgapsList.length) { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+ " Apid total gaps: "+ (apidgapsList[i].isEmpty()?"-":apidgapsList[i])+"; "; } } else { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+"; "; } } } else { logger.error("Error getting Information on missing ISPs APID"); } logger.debug(" ************* missing ISPs APID: " + stringParsed); stringParsed=stringParsed.replace("Apid#: - Apid total gaps: -;", "N/A").replace("Apid#: -;", "N/A"); if(stringParsed.length()>MAX_METADATA_SIZE) { stringParsed=stringParsed.substring(0,MAX_METADATA_SIZE-4)+"..."; } return stringParsed; } }
MetadataBuilder { public static String processApidInfo(String apidnum, String apidgaps) { String stringParsed=""; if(apidnum!=null && apidgaps != null) { String[] apidnumList = apidnum.trim().split(";"); String[] apidgapsList = apidgaps.trim().split(";"); if(apidnumList.length == apidgapsList.length) { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+ " Apid total gaps: "+ (apidgapsList[i].isEmpty()?"-":apidgapsList[i])+"; "; } } else { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+"; "; } } } else { logger.error("Error getting Information on missing ISPs APID"); } logger.debug(" ************* missing ISPs APID: " + stringParsed); stringParsed=stringParsed.replace("Apid#: - Apid total gaps: -;", "N/A").replace("Apid#: -;", "N/A"); if(stringParsed.length()>MAX_METADATA_SIZE) { stringParsed=stringParsed.substring(0,MAX_METADATA_SIZE-4)+"..."; } return stringParsed; } private  MetadataBuilder(); }
MetadataBuilder { public static String processApidInfo(String apidnum, String apidgaps) { String stringParsed=""; if(apidnum!=null && apidgaps != null) { String[] apidnumList = apidnum.trim().split(";"); String[] apidgapsList = apidgaps.trim().split(";"); if(apidnumList.length == apidgapsList.length) { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+ " Apid total gaps: "+ (apidgapsList[i].isEmpty()?"-":apidgapsList[i])+"; "; } } else { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+"; "; } } } else { logger.error("Error getting Information on missing ISPs APID"); } logger.debug(" ************* missing ISPs APID: " + stringParsed); stringParsed=stringParsed.replace("Apid#: - Apid total gaps: -;", "N/A").replace("Apid#: -;", "N/A"); if(stringParsed.length()>MAX_METADATA_SIZE) { stringParsed=stringParsed.substring(0,MAX_METADATA_SIZE-4)+"..."; } return stringParsed; } private  MetadataBuilder(); static String processApidInfo(String apidnum, String apidgaps); static String processApidGapsInfo(String gapStart, String gapStop); }
MetadataBuilder { public static String processApidInfo(String apidnum, String apidgaps) { String stringParsed=""; if(apidnum!=null && apidgaps != null) { String[] apidnumList = apidnum.trim().split(";"); String[] apidgapsList = apidgaps.trim().split(";"); if(apidnumList.length == apidgapsList.length) { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+ " Apid total gaps: "+ (apidgapsList[i].isEmpty()?"-":apidgapsList[i])+"; "; } } else { for(int i=0;i<apidnumList.length;i++) { stringParsed = stringParsed + "Apid#: "+(apidnumList[i].isEmpty()?"-":apidnumList[i])+"; "; } } } else { logger.error("Error getting Information on missing ISPs APID"); } logger.debug(" ************* missing ISPs APID: " + stringParsed); stringParsed=stringParsed.replace("Apid#: - Apid total gaps: -;", "N/A").replace("Apid#: -;", "N/A"); if(stringParsed.length()>MAX_METADATA_SIZE) { stringParsed=stringParsed.substring(0,MAX_METADATA_SIZE-4)+"..."; } return stringParsed; } private  MetadataBuilder(); static String processApidInfo(String apidnum, String apidgaps); static String processApidGapsInfo(String gapStart, String gapStop);  }