diff options
Diffstat (limited to 'ecomp-sdk')
24 files changed, 582 insertions, 150 deletions
diff --git a/ecomp-sdk/epsdk-aaf/pom.xml b/ecomp-sdk/epsdk-aaf/pom.xml index 34b0c7b7..0377c511 100644 --- a/ecomp-sdk/epsdk-aaf/pom.xml +++ b/ecomp-sdk/epsdk-aaf/pom.xml @@ -7,12 +7,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-aaf</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>ONAP Portal SDK AAF Authorization</name> diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml index 48c67c67..aa2f9052 100644 --- a/ecomp-sdk/epsdk-analytics/pom.xml +++ b/ecomp-sdk/epsdk-analytics/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java index 19b7b138..52077aa8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java @@ -59,10 +59,10 @@ import java.util.TimeZone; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.apache.commons.lang.time.DateUtils; import org.onap.portalsdk.analytics.error.RaptorException; import org.onap.portalsdk.analytics.model.base.ChartSeqComparator; @@ -291,7 +291,8 @@ public class ChartD3Helper { if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { if((dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) || (dct.getChartSeq()!=null && dct.getChartSeq()>0) ) { - if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true; + if(nvl(dct.getChartColor()).length()>0) + hasCustomizedChartColor = true; if(hasCustomizedChartColor) { //duplicates are avoided if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor()))) @@ -465,12 +466,14 @@ public class ChartD3Helper { try { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement)))); //if(MAXNUM < YAXISNUM) MAXNUM = YAXISNUM; - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement)))); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -507,12 +510,14 @@ public class ChartD3Helper { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); dateStrList.add(new Long(date.getTime()).toString()); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -579,12 +584,14 @@ public class ChartD3Helper { dateStrList.add("'"+dateStr+"'"); try { YAXISNUM = Integer.parseInt(ds.getString(i, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3)); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -630,12 +637,14 @@ public class ChartD3Helper { dateStrList.add(new Long(date.getTime()).toString()); try { YAXISNUM = Integer.parseInt(ds.getString(i, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3)); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -939,8 +948,10 @@ public class ChartD3Helper { } wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n"); - if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2; - if( MAXNUMDECIMALPLACES >=3 ) MAXNUMDECIMALPLACES = 2; + if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) + MAXNUMDECIMALPLACES = 2; + if( MAXNUMDECIMALPLACES >=3 ) + MAXNUMDECIMALPLACES = 2; if(!logScale) wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n"); else @@ -1085,7 +1096,8 @@ public class ChartD3Helper { //System.out.println(dct.getDisplayName() + " " + yText); if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { if(yTextSeries.contains((String)dct.getDisplayName())) { - if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true; + if(nvl(dct.getChartColor()).length()>0) + hasCustomizedChartColor = true; if(hasCustomizedChartColor) { //duplicates are avoided if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor()))) @@ -1251,7 +1263,8 @@ public class ChartD3Helper { date = getDateFromDateStr(dateStr); formatFlag = getFlagFromDateStr(dateStr); } - if(date==null && timeAxis) continue; + if(date==null && timeAxis) + continue; //if(ds.getString(i, 2).equals(uniqueElements[j])) { @@ -1260,13 +1273,15 @@ public class ChartD3Helper { uniqueElement = (String)uniqueRevElements[j]; try { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { flagNull = 1; @@ -1289,13 +1304,15 @@ public class ChartD3Helper { if(i<ds.getRowCount()-1) { try { YAXISNUM = Integer.parseInt(ds.getString(i+1, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i+1, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { flagSecondNull = 1; @@ -1343,7 +1360,8 @@ public class ChartD3Helper { formatFlag = getFlagFromDateStr(dateStr); } - if(date==null && timeAxis) continue; + if(date==null && timeAxis) + continue; uniqueElement = (String)uniqueRevElements[j]; //date = MMDDYYYYFormat.parse(ds.getString(i, 1), new ParsePosition(0)); @@ -1352,13 +1370,15 @@ public class ChartD3Helper { // minTime = date.getTime(); try { YAXISNUM = Integer.parseInt(ds.getString(i, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3)); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { @@ -1383,13 +1403,15 @@ public class ChartD3Helper { if (ds.getString(k, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) { try { YAXISNUM = Integer.parseInt(ds.getString(k, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(k, 3)); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { flagSecondNull = 1; @@ -1588,8 +1610,10 @@ public class ChartD3Helper { } wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n"); //if(nvl(subType).length() > 0 && subType.equals("area")) { - if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2; - if( MAXNUMDECIMALPLACES >=3 ) MAXNUMDECIMALPLACES = 2; + if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) + MAXNUMDECIMALPLACES = 2; + if( MAXNUMDECIMALPLACES >=3 ) + MAXNUMDECIMALPLACES = 2; wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n"); /*} else { wholeScript.append(" .tickFormat(d3.format(',.2f')); \n"); @@ -1614,7 +1638,8 @@ public class ChartD3Helper { } wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n"); //if(nvl(subType).length() > 0 && subType.equals("area")) { - if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2; + if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) + MAXNUMDECIMALPLACES = 2; if( MAXNUMDECIMALPLACES >=3 ) { MAXNUMDECIMALPLACES = 2; } @@ -2902,7 +2927,8 @@ public class ChartD3Helper { int rowCount = ds.getRowCount(); for (int i = 0; i < ds.getRowCount(); i++) { s.append("{ \"name\": \""+ ds.getString(i,"ei1") +"\" , \"group\":"+ ds.getString(i,"groups") +", \"level\":2 }"); - if (i < (rowCount-1)) s.append(","); + if (i < (rowCount-1)) + s.append(","); dataStr.append(s); s = new StringBuilder(""); } @@ -2911,7 +2937,8 @@ public class ChartD3Helper { dataStr.append("\"links\":["); for (int i = 0; i < ds.getRowCount(); i++) { s.append("{ \"source\": "+ ds.getString(i,"source") +" , \"target\":"+ ds.getString(i,"target") +", \"value\":2 }"); - if (i < (rowCount-1)) s.append(","); + if (i < (rowCount-1)) + s.append(","); dataStr.append(s); s = new StringBuilder(""); } @@ -3306,7 +3333,8 @@ public class ChartD3Helper { } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { chartValueCols.add(dc); } - else if(filter == 0) chartValueCols.add(dc); + else if(filter == 0) + chartValueCols.add(dc); } else chartValueCols.add(dc); } // } else @@ -3577,116 +3605,142 @@ public class ChartD3Helper { */ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; if(date==null) { date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + if(date!=null) + formatFlag = DAYOFTHEWEEKFLAG; } if(date==null) { date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat1.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = YYYYFormat.parse(dateStr, new ParsePosition(0)); /* Some random numbers should not satisfy this year format. */ - if(dateStr.length()>4) date = null; - if(date!=null) formatFlag = YEARFLAG; + if(dateStr.length()>4) + date = null; + if(date!=null) + formatFlag = YEARFLAG; } if(date==null) { date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) date = null; @@ -3713,8 +3767,10 @@ public class ChartD3Helper { public boolean getBooleanValue(String s, Boolean defaultValue) { s = nvl(s); - if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue(); - else if(s.length()<=0) return false; + if(s.length()<=0 && defaultValue!=null) + return defaultValue.booleanValue(); + else if(s.length()<=0) + return false; else { if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true")) return true; @@ -3819,7 +3875,8 @@ public class ChartD3Helper { value.append("("); } for(int j = 0 ; j < vals.length; j++) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); @@ -3834,7 +3891,8 @@ public class ChartD3Helper { } - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(j != vals.length -1) { value.append(","); diff --git a/ecomp-sdk/epsdk-app-common/pom.xml b/ecomp-sdk/epsdk-app-common/pom.xml index 8995afc2..91f7e8dc 100644 --- a/ecomp-sdk/epsdk-app-common/pom.xml +++ b/ecomp-sdk/epsdk-app-common/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml index 3b3eec32..4a8eae11 100644 --- a/ecomp-sdk/epsdk-app-os/pom.xml +++ b/ecomp-sdk/epsdk-app-os/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> @@ -26,7 +26,7 @@ <skipassembly>true</skipassembly> <!-- Tests usually require some setup that maven cannot do, so skip. --> <skiptests>false</skiptests> - <angularTestPhase>none</angularTestPhase> + <angularTestPhase>compile</angularTestPhase> <jacoco.version>0.7.9</jacoco.version> <!-- Version number gets stored only here --> <tomcat.download.path>http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin</tomcat.download.path> diff --git a/ecomp-sdk/epsdk-app-overlay/pom.xml b/ecomp-sdk/epsdk-app-overlay/pom.xml index a71996bb..3e5a9879 100644 --- a/ecomp-sdk/epsdk-app-overlay/pom.xml +++ b/ecomp-sdk/epsdk-app-overlay/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties index c5e4b57b..eba03083 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/conf/sql.properties @@ -274,17 +274,6 @@ random.string = select ( concat('Z' , round(random() * 1000000000000) ) ) scheduler.user.emails = SELECT au.user_id FROM (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.start_date <= now() AND rs.end_date >= now() AND rs.run_date IS NOT NULL AND rs.schedule_id = [p_schedule_id] ) x, cr_report r, fn_user au WHERE x.rep_id = r.rep_id AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = [p_schedule_id] UNION SELECT ur.user_id FROM fn_user_role ur WHERE ur.role_id IN (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 WHERE rsu2.schedule_id = x.schedule_id and rsu2.schedule_id = [p_schedule_id])) -# my logins - -app.query = SELECT APP_ID, ML_APP_NAME, MOTS_ID from fn_app - -user.log.query = SELECT DISTINCT IFNULL(SBCID, '') CUID, '' AWID, CONCAT('"',IFNULL(SBCID, ''),'"') APPLICATIONUSERID, CONCAT('"',IFNULL(FIRST_NAME, ''),'"') FIRST_NAME, CONCAT('"',substr(IFNULL(MIDDLE_NAME, ''), 0, 1),'"') MIDDLE_INITIAL, CONCAT('"',IFNULL(LAST_NAME, ''),'"') LAST_NAME, IFNULL(DATE_FORMAT(LAST_LOGIN_DATE, '%Y/%m/%d'), '') LAST_LOGON_DATE, DATE_FORMAT(CREATED_DATE, '%Y/%m/%d') ACCOUNT_ACTIVATION_DATE, IFNULL(DATE_FORMAT(MODIFIED_DATE, '%Y/%m/%d'), '') LAST_DATE_ACCOUNT_MODIFIED, '' LAST_PASSWORD_CHANGE_DATE, CONCAT('"',IFNULL(FIRST_NAME, ''),' ',IFNULL(MIDDLE_NAME, ''),' ',IFNULL(LAST_NAME, ''),'"') FULL_USER_NAME, '' NT_ID, IFNULL(EMAIL, '') EMAIL FROM FN_USER FU, FN_USER_ROLE FUR WHERE FU.USER_ID \= FUR.USER_ID and FUR.app_id \= ? and ACTIVE_YN \= 'Y' and sbcid is not null order by 1 - -profile.log.query = SELECT DISTINCT CONCAT('"' , ROLE_NAME , '"') PROFILE_NAME, '""' SECURITY_SETTINGS FROM FN_ROLE FR, FN_USER_ROLE FUR WHERE FUR.ROLE_ID \= FR.ROLE_ID and FR.ACTIVE_YN \= 'Y' and ((FUR.APP_ID \= 1 and FR.ROLE_NAME <> 'Standard User') or (FUR.APP_ID \= ? and FUR.APP_ID <> 1)) ORDER BY 1 - -user.profile.log.query = SELECT DISTINCT IFNULL(SBCID, '') CUID, '' AWID, CONCAT('"' , IFNULL(SBCID, '') , '"') APPLICATIONUSERID , CONCAT('"' , ROLE_NAME , '"') PROFILE_NAME FROM FN_USER A, FN_USER_ROLE B, FN_ROLE C WHERE A.USER_ID \= B.USER_ID AND B.ROLE_ID \= C.ROLE_ID AND A.ACTIVE_YN \= 'Y' AND C.ACTIVE_YN \= 'Y' AND a.sbcid is not null AND ((B.APP_ID \= 1 and C.ROLE_NAME <> 'Standard User') or (B.APP_ID \= ? and B.APP_ID <> 1)) ORDER BY 1 - -all.accounts.log.query = SELECT DISTINCT IFNULL(SBCID, '') CUID, (case when A.ACTIVE_YN\='Y' then 'ACTIVE' else 'INACTIVE' end) ACTIVE_YN, CONCAT('"' , IFNULL(SBCID, '') , '"') APPLICATIONUSERID , IFNULL(DATE_FORMAT(LAST_LOGIN_DATE, '%Y/%m/%d'), '') LAST_LOGON_DATE, '' LAST_PASSWORD_CHANGE_DATE, CONCAT('"' , ROLE_NAME , '"') PROFILE_NAME FROM FN_USER A, FN_USER_ROLE B, FN_ROLE C WHERE A.USER_ID \= B.USER_ID AND B.ROLE_ID \= C.ROLE_ID AND a.sbcid is not null AND ((B.APP_ID \= 1 and C.ROLE_NAME <> 'Standard User') or (B.APP_ID \= ? and B.APP_ID <> 1)) ORDER BY 1 # basic sql diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts index eb8b63dd..08e57de2 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts @@ -4,9 +4,7 @@ import { MatPaginatorModule } from '@angular/material/paginator'; import { MatSortModule } from '@angular/material/sort'; import { HttpClientModule } from '@angular/common/http'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; import { NgbModule, NgbModal } from '@ng-bootstrap/ng-bootstrap'; - import { MenusComponent } from './menus.component'; import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; import { AdminService } from '../admin.service'; @@ -14,17 +12,19 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { MenusService } from './menus.service'; import { CookieService } from 'ngx-cookie-service'; -import { MockBackend } from '@angular/http/testing'; -import { BaseRequestOptions, Http } from '@angular/http'; import 'rxjs/add/observable/of'; import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; describe('MenusComponent', () => { let component: MenusComponent; let fixture: ComponentFixture<MenusComponent>; let modalService: any; let adminService:any; - var stubData={"data":'{"fnMenuItems":{"tableData":{"element":{"active":1}}}}'}; + var stubData={ + "data1":{"data":"cachedRegions"} + } beforeEach(async(() => { TestBed.configureTestingModule({ @@ -56,11 +56,6 @@ describe('MenusComponent', () => { expect(component).toBeTruthy(); }); - // it('should test getFnMenuItems method inside getMenus',()=>{ - // let spy=spyOn(adminService,'getFnMenuItems').and.returnValue(Observable.of(stubData)) - // component.getMenus(); - // expect(spy).toHaveBeenCalled(); - // }) describe('test getMenus',()=>{ it('should test getMenus',()=>{ let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object')) @@ -76,6 +71,11 @@ describe('MenusComponent', () => { expect(spy).toHaveBeenCalled(); }) }) - + it('should test getParentData method error part ',()=>{ + let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.throw({status:404})); + component.getParentData(); + expect(spy).toHaveBeenCalled(); +}) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts new file mode 100644 index 00000000..8d5c6637 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts @@ -0,0 +1,134 @@ + +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { TestBed} from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { MenusService } from './menus.service'; +import { AdminService } from '../admin.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; + +describe('MenusService', () => { + + let component:MenusService; + let service:AdminService; + var stubData={"data":['{"active":"data"}','{"separator":"data1"}']}; + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,MenusService] + }) + component = TestBed.get(MenusService); + service = TestBed.get(AdminService); + }); + + it('should be created', () => { + const component: MenusService = TestBed.get(MenusService); + expect(component).toBeTruthy(); + }); + + // it('should test getTotalRowCount method',()=>{ + // component.getTotalRowCount(); + // }) + + it('should test updateStatus method',()=>{ + component['updateStatus']('N'); + }) + + it('should test updateBooleanValue method',()=>{ + component['updateBooleanValue'](true); + component['updateBooleanValue'](false); + }) + + it('should test updateParentNameToID method',()=>{ + component.parentList=[{'name':'data'}]; + component['updateParentNameToID']('data'); + }) + + it('should test menu',()=>{ + console.log(component.menu); + expect(component.menu.action).toEqual(null); + }) + + it('should test add method',()=>{ + component.add("data"); + }) + + it('should test update method',()=>{ + let spy=spyOn(service,'updateFnMenuItem').and.returnValue(Observable.of("")); + component.update(stubData); + expect(spy).toHaveBeenCalled(); + }) + + it('should test getParentData method2 error part ',()=>{ + let spy=spyOn(service,'updateFnMenuItem').and.returnValue(Observable.throw({status:404})); + component.update(stubData) + expect(spy).toHaveBeenCalled(); + }) + + + it('should test delete method',()=>{ + let spy=spyOn(service,'deleteMenu').and.returnValue(Observable.of("")); + component.delete(stubData); + expect(spy).toHaveBeenCalled(); + }) + + it('should test error part of delete method',()=>{ + let spy=spyOn(service,'deleteMenu').and.returnValue(Observable.throw({status:404})); + component.delete(stubData); + expect(spy).toHaveBeenCalled(); + }) + + it('should test getParentList method',()=>{ + component.getParentList("getParentList"); + expect(component.parentList).toEqual("getParentList"); + }) + + it('should test get method',()=>{ + let spy=spyOn(service,'getFnMenuItems').and.returnValue(Observable.of()); + component.get(); + expect(spy).toHaveBeenCalled(); + }) +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts index ecc0947d..7ef63baf 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -41,7 +43,12 @@ import { NewRoleFunctionComponent } from './new-role-function.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import {MatRadioModule } from '@angular/material'; +import { RouterTestingModule } from '@angular/router/testing'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; describe('NewRoleFunctionComponent', () => { let component: NewRoleFunctionComponent; @@ -50,10 +57,25 @@ describe('NewRoleFunctionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ schemas:[CUSTOM_ELEMENTS_SCHEMA], - declarations: [ NewRoleFunctionComponent ], - imports:[FormsModule,HttpClientTestingModule], + declarations: [ + NewRoleFunctionComponent, + ConfirmationModalComponent, + InformationModalComponent + ], + imports:[ + FormsModule, + HttpClientTestingModule, + MatRadioModule, + RouterTestingModule, + NgbModule.forRoot() + ], providers:[NgbActiveModal] }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent,InformationModalComponent] + } + }) .compileComponents(); })); @@ -63,7 +85,19 @@ describe('NewRoleFunctionComponent', () => { fixture.detectChanges(); }); - // it('should create', () => { - // expect(component).toBeTruthy(); - // }); + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should test ngOnInit method',()=>{ + component.ngOnInit(); + }) + + it('should test saveRoleFunction method',()=>{ + component.saveRoleFunction(); + }) + + it('should test openConfirmationModal method',()=>{ + component.openConfirmationModal("indrijeet","kumar") + }) }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts new file mode 100644 index 00000000..0e59f9eb --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts @@ -0,0 +1,62 @@ + +import { TestBed} from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { AdminService } from '../admin.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; +import { RoleFunctionsService } from './role-functions.service'; + +describe('RoleFunctionsService', () => { + + let component:RoleFunctionsService; + let service:AdminService; + //var stubData=['{"data":'{"active":"data2"}'}'] + //var stubData1='{stubData}' + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,RoleFunctionsService] + }) + component = TestBed.get(RoleFunctionsService); + service = TestBed.get(AdminService); + }); + + it('should be created', () => { + const component: RoleFunctionsService = TestBed.get(RoleFunctionsService); + expect(component).toBeTruthy(); + }); + + it('should test add method',()=>{ + component.add("data"); + }) + + it('should test update method',()=>{ + let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.of('your object')); + component.update("data"); + expect(spy).toHaveBeenCalled(); + }) + + it('should test error part of update method',()=>{ + let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.throw({status:404})); + component.update("data"); + expect(spy).toHaveBeenCalled(); +}) + + + it('should test delete method',()=>{ + let spy=spyOn(service,'deleteRoleFunction').and.returnValue(Observable.of('your object')); + component.delete("data"); + expect(spy).toHaveBeenCalled(); + }) + + it('should test get method',()=>{ + let spy=spyOn(service,'getRoleFunctionList').and.returnValue(Observable.of()) + component.get(); + expect(spy).toHaveBeenCalled(); + }) + +});
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts index 4b496f1b..8a30f2a3 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts @@ -43,9 +43,10 @@ import {FormsModule} from '@angular/forms'; import { NewRoleComponent } from './new-role.component'; import { MatTableModule } from '@angular/material' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { HttpClient, HttpClientModule } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; describe('NewRoleComponent', () => { let component: NewRoleComponent; @@ -56,8 +57,21 @@ describe('NewRoleComponent', () => { TestBed.configureTestingModule({ providers: [NgbActiveModal], schemas: [CUSTOM_ELEMENTS_SCHEMA] , - declarations: [ NewRoleComponent ], - imports: [FormsModule, MatTableModule, HttpClientTestingModule] + declarations: [ + NewRoleComponent, + ConfirmationModalComponent + ], + imports: [ + FormsModule, + MatTableModule, + HttpClientTestingModule, + NgbModule.forRoot() + ] + }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent] + } }) .compileComponents(); })); @@ -69,7 +83,26 @@ describe('NewRoleComponent', () => { fixture.detectChanges(); }); - // it('should create', () => { - // expect(component).toBeTruthy(); - // }); + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should test toggleRoleFunction method',()=>{ + component.ociavailableRoleFunctions=1; + component.toggleRoleFunction("toggleRoleFunction") + }) + + it('should test populateTableData method',()=>{ + component.populateTableData("populateTableData"); + expect(component.roleFunctionDataSource.sort).toEqual(component.sort); + expect(component.roleFunctionDataSource.paginator).toEqual(component.paginator) + }) + + it('should test isRoleAlreadyExist method',()=>{ + component.isRoleAlreadyExist("currentRoleName") + }) + + it('it should test openConfirmationModal method',()=>{ + component.openConfirmationModal("indrijeet","kumar"); + }) });
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts index dcd637fc..92d96135 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts @@ -47,9 +47,10 @@ import { MatTableModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { NewRoleComponent } from './new-role/new-role.component'; describe('RolesComponent', () => { let component: RolesComponent; @@ -102,4 +103,20 @@ describe('RolesComponent', () => { // it('should test openAdoleModaldNewR method',()=>{ // component.openAdoleModaldNewR('dummydata2') // }) + + it('should test openAdoleModaldNewR method',()=>{ + component.toggleRole("") + }) + + it('should test getDismissReason method',()=>{ + component['getDismissReason'](ModalDismissReasons.ESC); + component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK); + component['getDismissReason'](""); + }) + + // it('should test applyFilter method',()=>{ + // component.applyFilter("filterValue T"); + // expect(component.dataSource.filter).toEqual("filtervalue"); + // }) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts index 6d0c2946..d1ed8068 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts @@ -3,10 +3,21 @@ import { FormsModule } from '@angular/forms'; import { DashboardReportGridComponent } from './dashboard-report-grid.component'; import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { DashboardReportService } from '../../run/run-report/run-dashboard-report/dashboard-report.service'; +import { DashboardReportGridService } from './dashboard-report-grid.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs'; +import { GridsterItem } from 'angular-gridster2'; describe('DashboardReportGridComponent', () => { let component: DashboardReportGridComponent; let fixture: ComponentFixture<DashboardReportGridComponent>; + let service; + let environment = [ + { + baseUrl: 'just for testing' + } + ]; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -15,11 +26,15 @@ describe('DashboardReportGridComponent', () => { imports: [FormsModule, HttpClientTestingModule] }) .compileComponents(); + service = TestBed.get(DashboardReportGridService); + spyOn(service, 'getReportList').and.returnValue(Observable.of(environment)); })); beforeEach(() => { fixture = TestBed.createComponent(DashboardReportGridComponent); component = fixture.componentInstance; + environment ["rows"] = [""]; + component.dashboard ["hasContent"] = [""]; fixture.detectChanges(); }); @@ -28,7 +43,9 @@ describe('DashboardReportGridComponent', () => { }); it('should test ngOnInit method', () => { + spyOn(component, 'ngOnInit').and.callThrough(); component.ngOnInit(); + expect(component.ngOnInit).toHaveBeenCalled(); }); it('should test changedOption method', () => { @@ -47,4 +64,10 @@ describe('DashboardReportGridComponent', () => { component.addItem(); }); + it('should test emptyCellClick method', () => { + let event: MouseEvent; + let item: GridsterItem; + component.emptyCellClick(event, item); + }); + });
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts index 2140e0ae..ab0efdb2 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts @@ -1,4 +1,3 @@ - /* * ============LICENSE_START========================================== * ONAP Portal SDK @@ -17,16 +16,33 @@ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. * * ============LICENSE_END============================================ * * */ + import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + import { SearchComponent } from './search.component'; -import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule } from '@angular/core'; -import { MatTableModule, MatTableDataSource, MatMenuModule, MatSortModule, MatPaginatorModule } from '@angular/material'; +import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule, Component } from '@angular/core'; +import { MatTableModule, MatTableDataSource, MatMenuModule, MatSortModule, MatPaginatorModule, MatDialogModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; @@ -35,13 +51,23 @@ import { NgbModule, NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; import { NgbModalBackdrop } from '@ng-bootstrap/ng-bootstrap/modal/modal-backdrop'; import { NgModel } from '@angular/forms'; +import { Observable } from 'rxjs'; +import 'rxjs/add/observable/empty'; +import 'rxjs/add/observable/of'; +import { environment } from 'src/environments/environment'; +import { User } from 'src/app/shared/services/user/user'; +import { DataSource } from '@angular/cdk/table'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; + describe('SearchComponent', () => { let component: SearchComponent; let fixture: ComponentFixture<SearchComponent>; + let resp : any; + beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], - declarations: [ SearchComponent , ConfirmationModalComponent], + declarations: [ SearchComponent , ConfirmationModalComponent, InformationModalComponent], imports: [NoopAnimationsModule, MatPaginatorModule, MatSortModule, @@ -49,35 +75,39 @@ describe('SearchComponent', () => { MatMenuModule, HttpClientTestingModule, RouterTestingModule, + MatDialogModule, + NgbModule.forRoot() ] }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent,InformationModalComponent] + } + }) .compileComponents(); })); + beforeEach(() => { fixture = TestBed.createComponent(SearchComponent); component = fixture.componentInstance; + component.response = resp; fixture.detectChanges(); }); + it('should create', () => { expect(component).toBeTruthy(); }); + it('should test getUsers method', () => { component.getUsers(); - expect(component.showSpinner).toEqual(true); - let response; - component.response.subscribe(data => { - expect(response).toEqual(data); - expect(component.result).toEqual(JSON.parse(response.data)); - expect(component.profileList).toEqual(JSON.parse(component.result.profileList)); - expect(component.dataSource).toEqual(new MatTableDataSource(component.profileList)); - expect(component.dataSource.paginator).toEqual(component.paginator); - expect(component.dataSource.sort).toEqual(component.sort); - expect(component.showSpinner).toEqual(false); - }); }); - // it('should test applyFilter method', () => { - // let filterValue = "test" - // component.applyFilter(filterValue); - // expect(component.dataSource.filter).toEqual(filterValue.trim().toLowerCase()); - // }); -});
\ No newline at end of file + + it('should test openConfirmationModal method', () => { + component.openConfirmationModal("just","test"); + }); + + it('should test openInformationModal method', () => { + component.openInformationModal("just","test"); + }); + +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts index 97e164df..ee8f7b64 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts @@ -50,6 +50,7 @@ import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; +import { ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; describe('SelfComponent', () => { let component: SelfComponent; @@ -94,4 +95,10 @@ describe('SelfComponent', () => { }) }) + it('should test getDismissReason method',()=>{ + component['getDismissReason'](ModalDismissReasons.ESC); + component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK); + component['getDismissReason'](""); + }) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.spec.ts new file mode 100644 index 00000000..e82a7ebc --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.spec.ts @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { HeaderInterceptor } from './header-interceptor'; + +describe('HeaderInterceptor', () => { + let component: HeaderInterceptor; + let fixture: ComponentFixture<HeaderInterceptor>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + }) + .compileComponents(); + })); + + beforeEach(() => { + component=new HeaderInterceptor() + }); + + it('should create', () => { + expect(component).toBeTruthy(); + component.intercept; + }); +}); diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml index bf6e1764..2f48a8d1 100644 --- a/ecomp-sdk/epsdk-core/pom.xml +++ b/ecomp-sdk/epsdk-core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-domain/pom.xml b/ecomp-sdk/epsdk-domain/pom.xml index f1b554e3..c55c4517 100644 --- a/ecomp-sdk/epsdk-domain/pom.xml +++ b/ecomp-sdk/epsdk-domain/pom.xml @@ -5,12 +5,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-domain</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>ONAP Portal SDK Domain</name> diff --git a/ecomp-sdk/epsdk-fw/pom.xml b/ecomp-sdk/epsdk-fw/pom.xml index 1c29ceab..5ea16eaa 100644 --- a/ecomp-sdk/epsdk-fw/pom.xml +++ b/ecomp-sdk/epsdk-fw/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-logger/pom.xml b/ecomp-sdk/epsdk-logger/pom.xml index 3f0f7df0..1007e8ad 100644 --- a/ecomp-sdk/epsdk-logger/pom.xml +++ b/ecomp-sdk/epsdk-logger/pom.xml @@ -4,12 +4,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-logger</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <name>ONAP Portal SDK Logger</name> diff --git a/ecomp-sdk/epsdk-music/pom.xml b/ecomp-sdk/epsdk-music/pom.xml index cfbc41c1..b952d65d 100644 --- a/ecomp-sdk/epsdk-music/pom.xml +++ b/ecomp-sdk/epsdk-music/pom.xml @@ -5,12 +5,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-music</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>ONAP Portal SDK Music</name> diff --git a/ecomp-sdk/epsdk-workflow/pom.xml b/ecomp-sdk/epsdk-workflow/pom.xml index 128057c2..49e3fc5b 100644 --- a/ecomp-sdk/epsdk-workflow/pom.xml +++ b/ecomp-sdk/epsdk-workflow/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml index c02d6f4b..2c16ed1e 100644 --- a/ecomp-sdk/pom.xml +++ b/ecomp-sdk/pom.xml @@ -13,7 +13,7 @@ <!-- Portal SDK Maven parent project --> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>pom</packaging> <name>portal-sdk</name> <url>https://wiki.onap.org/display/DW/Portal</url> @@ -285,23 +285,6 @@ </executions> </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - <!-- defined in oparent <version>1.6.7</version> --> - <extensions>true</extensions> - <configuration> - <nexusUrl>${nexusproxy}</nexusUrl> - <stagingProfileId>176c31dfe190a</stagingProfileId> - <serverId>ecomp-staging</serverId> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-release-plugin</artifactId> - <version>2.5.3</version> - </plugin> </plugins> </build> |