diff options
7 files changed, 53 insertions, 24 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java index 26f33a35..47e3ad54 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java @@ -67,7 +67,7 @@ public class LineInfo { public LineInfo(String nodeID1, String nodeID2) { this.nodeID1 = nodeID1; this.nodeID2 = nodeID2; - lineAttributes = new HashMap<String, String>(); + lineAttributes = new HashMap<>(); } public LineInfo clone() { @@ -167,7 +167,7 @@ public class LineInfo { public List<String> getAttributeKeys() { Set<String> keySet = lineAttributes.keySet(); - List<String> keys = new ArrayList<String>(keySet.size()); + List<String> keys = new ArrayList<>(keySet.size()); Iterator<String> iter = keySet.iterator(); while (iter.hasNext()) { @@ -183,7 +183,7 @@ public class LineInfo { public List<String> getAttributeInternalKeys() { Set<String> keySet = lineAttributes.keySet(); - List<String> internalKeys = new ArrayList<String>(); + List<String> internalKeys = new ArrayList<>(); Iterator<String> iter = keySet.iterator(); while (iter.hasNext()) { diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/ColorProperties.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/ColorProperties.java index 5ce752a7..6e1d7e24 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/ColorProperties.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/ColorProperties.java @@ -51,7 +51,7 @@ public class ColorProperties { public ColorProperties(NovaMap map) { this.map = map; - colorProperties = new HashMap<String, Object>(); + colorProperties = new HashMap<>(); } public void setColor(String type, String color) { diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/Node.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/Node.java index 60e7a166..4764ef50 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/Node.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/Node.java @@ -59,8 +59,8 @@ public class Node { public Node(NovaMap map) { this.map = map; nodeCollection = new NodeCollection(); - nodeIDSet = new HashSet<String>(); - selectionList = new ArrayList<String>(); + nodeIDSet = new HashSet<>(); + selectionList = new ArrayList<>(); } public NodeInfo addNode(NodeParam nodeParam) { @@ -121,7 +121,7 @@ public class Node { public Set<Integer> getUniqueNumberT1(String currentYearMonth) { HashMap<String,NodeInfo> hashMap = this.nodeCollection.getNodeCollection(); Set set = hashMap.entrySet(); - Set<Integer> numberT1Set = new TreeSet<Integer>(); + Set<Integer> numberT1Set = new TreeSet<>(); for (Iterator iterator = set.iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); @@ -172,7 +172,7 @@ public class Node { } if (existNodeInfo == null) { - existNodeInfo = new ArrayList<NodeInfo>(); + existNodeInfo = new ArrayList<>(); } existNodeInfo.add(nodeInfo); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java index 5c3f938a..e630f52c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java @@ -53,8 +53,8 @@ public class NodeCollection { private HashMap<String,NodeInfo> nodeCollection; public NodeCollection() { - selectedNode = new HashSet<String>(); - nodeCollection = new HashMap<String,NodeInfo>(20000); + selectedNode = new HashSet<>(); + nodeCollection = new HashMap<>(20000); } public void addSelectedNode(String nodeID) { diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeInfo.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeInfo.java index 611debc3..8f4473ce 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeInfo.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeInfo.java @@ -64,8 +64,8 @@ public class NodeInfo { public NodeInfo(String nodeID) { this.nodeID = nodeID; - lineIDS = new ArrayList<String>(); - nodeAttributes = new TreeMap<String, String>(); + lineIDS = new ArrayList<>(); + nodeAttributes = new TreeMap<>(); geoCoordinate = new GeoCoordinate(); } @@ -117,7 +117,7 @@ public class NodeInfo { } public List<String> cloneLineIDS() { - List<String> lineIDS = new ArrayList<String>(); + List<String> lineIDS = new ArrayList<>(); for (String lineID : this.lineIDS) { lineIDS.add(lineID); @@ -171,8 +171,7 @@ public class NodeInfo { } public String getAttribute(String key) { - String value = nodeAttributes.get(key); - return value; + return nodeAttributes.get(key); } public void initializeAttributes(Map<String, String> nodeAttributes) { @@ -212,7 +211,7 @@ public class NodeInfo { public List<String> getAttributeKeys() { Set<String> keySet = nodeAttributes.keySet(); - List<String> keys = new ArrayList<String>(keySet.size()); + List<String> keys = new ArrayList<>(keySet.size()); Iterator<String> iter = keySet.iterator(); while (iter.hasNext()) { 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 7ef63baf..32a69848 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 @@ -49,6 +49,8 @@ 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'; +import 'rxjs/add/observable/of'; + describe('NewRoleFunctionComponent', () => { let component: NewRoleFunctionComponent; @@ -73,7 +75,10 @@ describe('NewRoleFunctionComponent', () => { }) TestBed.overrideModule(BrowserDynamicTestingModule,{ set:{ - entryComponents:[ConfirmationModalComponent,InformationModalComponent] + entryComponents:[ + ConfirmationModalComponent, + InformationModalComponent + ] } }) .compileComponents(); @@ -90,6 +95,22 @@ describe('NewRoleFunctionComponent', () => { }); it('should test ngOnInit method',()=>{ + component.editRoleFunction={ + type: "type", + code: "code", + action: "action", + name: "name" + } + component.ngOnInit(); + }) + + it('should test else part of ngOnInit method',()=>{ + component.editRoleFunction={ + type: "menu", + code: "code", + action: "action", + name: "name" + } component.ngOnInit(); }) @@ -98,6 +119,7 @@ describe('NewRoleFunctionComponent', () => { }) it('should test openConfirmationModal method',()=>{ - component.openConfirmationModal("indrijeet","kumar") + component.openConfirmationModal("indrijeet","kumar"); }) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts index 93636519..cffd5290 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.component.spec.ts @@ -1,4 +1,5 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + import { DefinitionComponent } from './definition.component'; import { CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; @@ -18,7 +19,7 @@ describe('DefinitionComponent', () => { "reportId":123, "reportName":"reportName", "reportDescr":"reportDescr", - "reportType":"reportType", + "reportType":"Linear", "dbInfo":"dbInfo", "formHelpText":"formHelpText", "repDefType":"repDefType", @@ -44,7 +45,8 @@ describe('DefinitionComponent', () => { "weeklyRec":true, "monthlyRec":true, "dashboardLayoutJSON":'"data"', - "dashboardLayoutHTML":"dashboardLayoutHTML" + "dashboardLayoutHTML":"dashboardLayoutHTML", + "displayArea":{"selected":true} } beforeEach(async(() => { @@ -74,19 +76,25 @@ describe('DefinitionComponent', () => { }); it('should test ngOnInit method',()=>{ - var params={ - "reportId":100 - }; component.IncomingReportId=-1; component.reportMode="Create"; - //spyOn(activatedRoute,'params').and.returnValue(Observable.of(params)); let spy=spyOn(_definitionService,'getDefinitionPageDetails').and.returnValue(Observable.of(response)); component.ngOnInit(); expect(spy).toHaveBeenCalled(); + expect(_definitionService.getDefinitionPageDetails).toHaveBeenCalled(); expect(component.isEdit).toBe(true); expect(component.showDialog).toBe(false); }); + it('should test ngOnInit method',()=>{ + component.IncomingReportId=1; + component.reportMode="Edit"; + let spy=spyOn(_definitionService,'getDefinitionPageDetails').and.returnValue(Observable.of(response)); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + expect(_definitionService.getDefinitionPageDetails).toHaveBeenCalled(); + }); + it('should test first if condition in saveDefinitionInfo method',()=>{ component.IncomingReportId=-1; component.reportMode="Create"; |