summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java5
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java5
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java13
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java14
-rw-r--r--ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/welcome-dashboard/note/note.component.spec.ts13
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts26
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts6
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts53
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts36
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts3
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts79
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts8
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts20
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts28
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts45
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-success-dialog/sql-validate-success-dialog.component.spec.ts5
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts30
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts49
-rw-r--r--ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java4
21 files changed, 319 insertions, 133 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java
index 9a8f9b8a..bf18decb 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java
@@ -44,6 +44,7 @@ import java.util.Map;
import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@@ -52,13 +53,13 @@ public class AdminController {
@RequestMapping("/")
public class AngularSinglePageController extends RestrictedBaseController {
- @RequestMapping(value = { "/admin" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/admin" })
public ModelAndView view() {
Map<String, Object> model = new HashMap<>();
return new ModelAndView("admin", "model", model);
}
- @RequestMapping(value = { "/admin2" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/admin2" })
public ModelAndView adminView() {
Map<String, Object> model = new HashMap<>();
return new ModelAndView("admin2", "model", model);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java
index 138a805d..3368ce49 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java
@@ -43,6 +43,7 @@ import java.util.Map;
import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@@ -50,13 +51,13 @@ import org.springframework.web.servlet.ModelAndView;
@RequestMapping("/")
public class AngularAdminController extends RestrictedBaseController{
- @RequestMapping(value = {"/userProfile" }, method = RequestMethod.GET)
+ @GetMapping(value = {"/userProfile" })
public ModelAndView view() {
Map<String, Object> model = new HashMap<>();
return new ModelAndView("user_profile_list","model", model);
}
- @RequestMapping(value = {"/admin" }, method = RequestMethod.GET)
+ @GetMapping(value = {"/admin" })
public ModelAndView adminView() {
Map<String, Object> model = new HashMap<>();
return new ModelAndView(getViewName(),"model", model);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java
index f30ab9b3..c102f886 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java
@@ -60,6 +60,7 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.web.support.JsonMessage;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@@ -84,7 +85,7 @@ public class CacheAdminController extends RestrictedBaseController {
return new ModelAndView(getViewName(), model);
}
- @RequestMapping(value = { "/get_regions" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/get_regions" })
public void getRegions(HttpServletResponse response) {
try {
JsonMessage msg = new JsonMessage(getRegions().toString());
@@ -95,7 +96,7 @@ public class CacheAdminController extends RestrictedBaseController {
}
}
- @RequestMapping(value = { "/jcs_admin/clearRegion" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/jcs_admin/clearRegion" })
public void clearRegion(HttpServletRequest request, HttpServletResponse response) throws IOException {
String cacheName = request.getParameter(CACHE_NAME);
clearCacheRegion(cacheName);
@@ -104,7 +105,7 @@ public class CacheAdminController extends RestrictedBaseController {
out.write(getRegions().toString());
}
- @RequestMapping(value = { "/jcs_admin/clearAll" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/jcs_admin/clearAll" })
public void clearAll(HttpServletResponse response) throws IOException {
clearAllRegions();
response.setContentType(APPLICATION_JSON);
@@ -112,7 +113,7 @@ public class CacheAdminController extends RestrictedBaseController {
out.write(getRegions().toString());
}
- @RequestMapping(value = { "/jcs_admin/clearItem" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/jcs_admin/clearItem" })
public void clearItem(HttpServletRequest request, HttpServletResponse response) throws IOException {
String keyName = request.getParameter("keyName");
String cacheName = request.getParameter(CACHE_NAME);
@@ -122,7 +123,7 @@ public class CacheAdminController extends RestrictedBaseController {
out.write(getRegions().toString());
}
- @RequestMapping(value = { "/jcs_admin/showItemDetails" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/jcs_admin/showItemDetails" })
public void showItemDetails(HttpServletRequest request, HttpServletResponse response) throws IOException {
String cacheName = request.getParameter(CACHE_NAME);
String keyName = request.getParameter("keyName");
@@ -139,7 +140,7 @@ public class CacheAdminController extends RestrictedBaseController {
out.write(j.toString());
}
- @RequestMapping(value = { "/jcs_admin/showRegionDetails" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/jcs_admin/showRegionDetails" })
public void showRegionDetails(HttpServletRequest request, HttpServletResponse response) {
String cacheName = request.getParameter(CACHE_NAME);
ObjectMapper mapper = new ObjectMapper();
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java
index 8f49b640..82da2eb8 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java
@@ -4,6 +4,8 @@
* ===================================================================
* Copyright © 2017 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");
@@ -58,6 +60,8 @@ import org.onap.portalsdk.core.web.support.JsonMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@@ -82,7 +86,7 @@ public class FnMenuController extends RestrictedBaseController {
@Autowired
FunctionalMenuListService functionalMenuListService;
- @RequestMapping(value = { "/admin_fn_menu/get_parent_list" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/admin_fn_menu/get_parent_list" })
public void getParentList(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException {
ObjectMapper mapper = new ObjectMapper();
try {
@@ -95,7 +99,7 @@ public class FnMenuController extends RestrictedBaseController {
}
}
- @RequestMapping(value = { "/admin_fn_menu/get_function_cd_list" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/admin_fn_menu/get_function_cd_list" })
public void getFunctionCDList(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException {
ObjectMapper mapper = new ObjectMapper();
try {
@@ -109,7 +113,7 @@ public class FnMenuController extends RestrictedBaseController {
}
- @RequestMapping(value = { "/admin_fn_menu" }, method = RequestMethod.GET)
+ @GetMapping(value = { "/admin_fn_menu" })
public void getFnMenuList(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
@@ -152,7 +156,7 @@ public class FnMenuController extends RestrictedBaseController {
}
- @RequestMapping(value = { "/admin_fn_menu/updateFnMenu" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/admin_fn_menu/updateFnMenu" })
public ModelAndView updateFnMenu(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, java.io.UnsupportedEncodingException {
@@ -189,7 +193,7 @@ public class FnMenuController extends RestrictedBaseController {
}
- @RequestMapping(value = { "/admin_fn_menu/removeMenuItem" }, method = RequestMethod.POST)
+ @PostMapping(value = { "/admin_fn_menu/removeMenuItem" })
public ModelAndView removeFnMenu(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, java.io.UnsupportedEncodingException {
diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/welcome-dashboard/note/note.component.spec.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/welcome-dashboard/note/note.component.spec.ts
index 953906df..c06fe51f 100644
--- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/welcome-dashboard/note/note.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/welcome-dashboard/note/note.component.spec.ts
@@ -60,4 +60,17 @@ describe('NoteComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test onDismiss method',()=>{
+ component.onDismiss("onDismiss");
+ })
+
+ it('should test onFocusOut method',()=>{
+ component.onFocusOut("onFocusOut");
+ })
+
+ //it('should test record method',()=>{
+ //component.record(4);
+ // })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
index 1253b2be..bd9bea48 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts
@@ -91,12 +91,6 @@ describe('HeaderComponent', () => {
expect(component).toBeTruthy();
});
- it('testing if condition in ngOnInit method',()=>{
- component.cookieService.set('show_app_header','false');
- component.ngOnInit();
- expect(component.showHeader).toBe(false)
- })
-
describe('should test ngOnInit',()=>{
it('should validate on ngOnInit',()=>{
let spy=spyOn(headerService, 'getTopMenuItems').and.returnValue(Observable.of('you object'));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts
index 7f5a43fe..9bbcfc4e 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts
@@ -37,6 +37,7 @@
*
*
*/
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule } from '@ngx-translate/core';
@@ -55,13 +56,15 @@ describe('SidebarComponent', () => {
let sidebarService: SidebarService;
var stubData1={
- "data":'{"data":"cachedRegions"}',
- "data2":'{"data2":"cachedRegions2"}'
+ "data":'"d"',
+ "data2":'"data2"'
};
-
+ var stubData2={
+ "data":'"d"',
+ "data2":'" "'
+ };
beforeEach(async(() => {
- let sidebarService: SidebarService;
TestBed.configureTestingModule({
imports: [
LayoutModule,
@@ -87,13 +90,6 @@ describe('SidebarComponent', () => {
expect(component).toBeTruthy();
});
- it('testing if condition in ngOnInit method',()=>{
- component.cookieService.set('show_app_header','false');
- component.ngOnInit();
- expect(component.showHeader).toBe(false)
- })
-
-
describe('should test ngOnInit',()=>{
it('should validate on ngOnInit',()=>{
let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData1));
@@ -102,6 +98,14 @@ describe('SidebarComponent', () => {
})
})
+ //describe('should test ngOnInit if part',()=>{
+ //it('should validate on ngOnInit',()=>{
+ //let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData2));
+ // component.ngOnInit();
+ //expect(spy).toHaveBeenCalled();
+ //})
+ //})
+
it('should test addExpandClass if element and showMenu variable value are same', () => {
component.showMenu= '1';
component.addExpandClass('1');
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts
index 975f72c3..4bc9f5dc 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts
@@ -78,12 +78,6 @@ describe('LayoutComponent', () => {
expect(component).toBeTruthy();
});
- it('testing if condition in ngOnInit method',()=>{
- component.cookieService.set('show_app_header','false');
- component.ngOnInit();
- expect(component.showHeader).toBe(false)
- })
-
it('should test receiveCollapsed method',()=>{
component.receiveCollapsed(true);
expect(component.collapedSideBar).toBe(true);
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
index 8d5c6637..e2b4c720 100644
--- 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
@@ -69,10 +69,6 @@ describe('MenusService', () => {
expect(component).toBeTruthy();
});
- // it('should test getTotalRowCount method',()=>{
- // component.getTotalRowCount();
- // })
-
it('should test updateStatus method',()=>{
component['updateStatus']('N');
})
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 8a30f2a3..d03cf4a6 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
@@ -47,19 +47,30 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
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';
+import { AdminService } from '../../admin.service';
+import { Observable } from 'rxjs';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
describe('NewRoleComponent', () => {
let component: NewRoleComponent;
let fixture: ComponentFixture<NewRoleComponent>;
let role1 = "";
+ let adminService:AdminService;
+ var _element={
+ "selected":false,
+ "code":"code",
+ "type":"type",
+ "action":"action"
+ };
beforeEach(async(() => {
TestBed.configureTestingModule({
- providers: [NgbActiveModal],
+ providers: [NgbActiveModal,AdminService],
schemas: [CUSTOM_ELEMENTS_SCHEMA] ,
declarations: [
NewRoleComponent,
- ConfirmationModalComponent
+ ConfirmationModalComponent,
+ InformationModalComponent
],
imports: [
FormsModule,
@@ -70,7 +81,7 @@ describe('NewRoleComponent', () => {
})
TestBed.overrideModule(BrowserDynamicTestingModule,{
set:{
- entryComponents:[ConfirmationModalComponent]
+ entryComponents:[ConfirmationModalComponent,InformationModalComponent]
}
})
.compileComponents();
@@ -81,15 +92,45 @@ describe('NewRoleComponent', () => {
component = fixture.componentInstance;
component.role = role1;
fixture.detectChanges();
+ adminService=TestBed.get(AdminService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+ // it('should test ngOnInit method',()=>{
+ // component.isEditMode=true;
+ // component.ociavailableRoleFunctions="tndrijeet";
+ // //component.ociavailableRoleFunctions.length=9;
+ // component.ngOnInit();
+ // })
+
+ // it('should test setSelectedRoleFucntions method',()=>{
+ // component.ociavailableRoleFunctions.length={"selected":false};
+ // component.setSelectedRoleFucntions("i");
+ // })
+
+ it('should test delRoleFunctionConfirmPopUp method',()=>{
+ component.delRoleFunctionConfirmPopUp("indrijeet","kumar");
+ })
+
+ // it('should test if condition in saveChanges method',()=>{
+ // component.isEditMode=true;
+ // //spyOn(adminService,'saveRole').and.returnValue(Observable.of('your object'));
+ // component.saveChanges()
+ // })
+
+ it('should test else condition in saveChanges method',()=>{
+ spyOn(adminService,'saveRole').and.returnValue(Observable.of('your object'));
+ component.saveChanges()
+ })
+
it('should test toggleRoleFunction method',()=>{
- component.ociavailableRoleFunctions=1;
- component.toggleRoleFunction("toggleRoleFunction")
+ component.finalSelectedRoleFunctions="Indrijeet kumar";
+ component.ociavailableRoleFunctions="i";
+ component.finalSelectedRoleFunctions="k";
+ component.toggleRoleFunction(_element)
})
it('should test populateTableData method',()=>{
@@ -99,6 +140,8 @@ describe('NewRoleComponent', () => {
})
it('should test isRoleAlreadyExist method',()=>{
+ // component.availableRoles={"name":"currentRoleName"};
+ component.availableRoles={"name":["currentRoleName"]};
component.isRoleAlreadyExist("currentRoleName")
})
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 92d96135..85f62164 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
@@ -51,11 +51,18 @@ 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';
+import { DataSource } from '@angular/cdk/table';
+import { AdminService } from '../admin.service';
+import { FormsModule } from '@angular/forms';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpModule } from '@angular/http';
describe('RolesComponent', () => {
let component: RolesComponent;
let fixture: ComponentFixture<RolesComponent>;
let userService: UserService;
+ let adminService:AdminService;
+ // var stubData={"result":{"data":'{"data"}',"role":'{"role"}'}};
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -63,16 +70,26 @@ describe('RolesComponent', () => {
declarations: [
RolesComponent,
InformationModalComponent,
+ NewRoleComponent
+ ],
+ providers:[
+ UserService,
+ DataSource,
+ AdminService,
+ HttpClientModule
],
imports:[
MatTableModule,
+ FormsModule,
+ HttpModule,
+ HttpClientModule,
HttpClientTestingModule,
- NgbModule.forRoot()
+ NgbModule.forRoot(),
]
})
TestBed.overrideModule(BrowserDynamicTestingModule,{
set:{
- entryComponents:[InformationModalComponent]
+ entryComponents:[InformationModalComponent, NewRoleComponent]
}
})
.compileComponents();
@@ -83,6 +100,7 @@ describe('RolesComponent', () => {
component = fixture.componentInstance;
fixture.detectChanges();
userService=TestBed.get(UserService);
+ adminService=TestBed.get(AdminService);
});
it('should create', () => {
@@ -100,10 +118,6 @@ describe('RolesComponent', () => {
})
- // it('should test openAdoleModaldNewR method',()=>{
- // component.openAdoleModaldNewR('dummydata2')
- // })
-
it('should test openAdoleModaldNewR method',()=>{
component.toggleRole("")
})
@@ -114,9 +128,9 @@ describe('RolesComponent', () => {
component['getDismissReason']("");
})
- // it('should test applyFilter method',()=>{
- // component.applyFilter("filterValue T");
- // expect(component.dataSource.filter).toEqual("filtervalue");
- // })
-
+it('should test openAddNewRoleModal method',()=>{
+ component.openAddNewRoleModal("openAddNewRoleModal");
+ component.openAddNewRoleModal('undefined');
+})
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts
index 22e1cc3d..e663001a 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column.service.spec.ts
@@ -12,9 +12,6 @@ describe('ColumnService', () => {
imports: [HttpClientTestingModule]
}));
- // httpClient=TestBed.get(HttpClient);
- // httpTestingController=TestBed.get(httpTestingController);
-
it('should be created', () => {
const service: ColumnService = TestBed.get(ColumnService);
expect(service).toBeTruthy();
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
index 88010f96..7cc85b94 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
@@ -1,25 +1,34 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { FormFieldsComponent } from './form-fields.component';
+import { FormFieldsComponent, DialogOverviewExampleDialog } from './form-fields.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatDialogModule, MatSnackBarModule } from '@angular/material';
-import { CommonModule } from '@angular/common';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormFieldsService } from './form-fields.service';
import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
describe('FormFieldsComponent', () => {
let component: FormFieldsComponent;
let fixture: ComponentFixture<FormFieldsComponent>;
let _formfieldservice: FormFieldsService;
+ var responseFormFields=[{"orderSeq":3}];
+ var formFieldGroupsJSON={"formFieldGroupsJSON":'{"data":"cachedRegions"}'};
+ var responseDeleted={"responseDeleted":[{"message":"Formfield Deleted"}]}
+ var responseDefaultSQL={"data":[{"elemensts":"indrijeet"}]};
+ var responsePost={"message":true};
+ var stubData=[{m:true}];
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas:[CUSTOM_ELEMENTS_SCHEMA],
- declarations: [ FormFieldsComponent ],
+ declarations: [
+ FormFieldsComponent,
+ DialogOverviewExampleDialog
+ ],
imports:[
FormsModule,
HttpClientTestingModule,
@@ -28,6 +37,11 @@ describe('FormFieldsComponent', () => {
BrowserAnimationsModule
]
})
+ TestBed.overrideModule(BrowserDynamicTestingModule,{
+ set:{
+ entryComponents:[DialogOverviewExampleDialog]
+ }
+ })
.compileComponents();
}));
@@ -42,6 +56,21 @@ describe('FormFieldsComponent', () => {
expect(component).toBeTruthy();
});
+
+ it('should test verify method',()=>{
+ spyOn(_formfieldservice,'verifySQL').and.returnValue(Observable.of(responseDefaultSQL))
+ component.verify("Default");
+ expect(component.validateResponseString).toEqual( responseDefaultSQL["data"]["elements"])
+ component.verify("value");
+ })
+
+ it('should test ngOnInit method',()=>{
+ let spy=spyOn(_formfieldservice,'getListOfFormFields').and.returnValue(Observable.of(responseFormFields))
+ spyOn(_formfieldservice,'getFormFieldGroupsData').and.returnValue(Observable.of(formFieldGroupsJSON))
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+
it('should test isFirst method',()=>{
expect(component.isFirst(0)).toBe(true);
expect(component.isFirst(2)).toBe(false);
@@ -57,6 +86,7 @@ describe('FormFieldsComponent', () => {
expect(component.isLast(11)).toEqual(true);
});
+
it('should test ngDoCheck method for if condition',()=>{
component.sqlAsDefaultValue=true;
component.ngDoCheck();
@@ -132,12 +162,13 @@ describe('FormFieldsComponent', () => {
it('should test addToList method',()=>{
component.addToList("attrib")
- {
+ {
expect(component.predefinedValueList.pop()).toEqual({id:'attrib', name:'attrib',selected:false});
}
});
it('should test deleteFromList method',()=>{
+component.predefinedValueList=[{"id":"attrib"}]
component.deleteFromList("attrib");
});
@@ -145,9 +176,13 @@ it('should test save method1',()=>{
component.visible="YES";
component.defaultValue=false;
+ component.mode ="Edit";
+ responseFormFields["m"]=1;
+ let spy1=spyOn(_formfieldservice,'postFormFieldData').and.returnValue(Observable.of(responsePost));
+ let spy2=spyOn(_formfieldservice,'getListOfFormFields').and.returnValue(Observable.of(stubData));
component.save();
- expect(component.showSpinner).toBe(true);
- expect(component.showDialog).toBe(false);
+ expect(spy1).toHaveBeenCalled();
+ expect(spy2).toHaveBeenCalled();
expect(component.finalPOSTObj["validationType"]).toEqual(component.validationType);
expect(component.finalPOSTObj["visible"]).toBe(true);
expect(component.finalPOSTObj["orderSeq"]).toEqual(component.orderSeq);
@@ -168,7 +203,13 @@ it('should test save method1',()=>{
it('should test save method for else part',()=>{
component.visible!="YES";
component.defaultValue!=false;
+ component.mode ="Edited";
+ responseFormFields["m"]=1;
+ let spy1=spyOn(_formfieldservice,'addFormFieldData').and.returnValue(Observable.of(responsePost));
+ let spy2=spyOn(_formfieldservice,'getListOfFormFields').and.returnValue(Observable.of(stubData));
component.save();
+ expect(spy1).toHaveBeenCalled();
+ expect(spy2).toHaveBeenCalled();
expect(component.finalPOSTObj["visible"]).toBe(false)
expect(component.finalPOSTObj["fieldDefalultSQL"]).toEqual(component.fieldDefaultSQL);
})
@@ -182,25 +223,33 @@ it('should test openSnackBar method',()=>{
})
it('should test deleteGroup method',()=>{
- component.deleteGroup("string");
+ component.Groups=[{"name":"groupName"}];
+ component.deleteGroup("groupName");
})
it('should test deleteFormGroup method',()=>{
+ component.Groups=[{"formFieldList":{"id":"formFieldId"}}]
+ //component.Groups=[{"elements":{"formFieldList":{"id":"formFieldId"}}}]
component.deleteFromGroup("formgroup");
})
it('should test delete method',()=>{
+ responseDeleted["message"]="Formfield Deleted";
+ let spy1=spyOn(_formfieldservice,'deleteFormField').and.returnValue(Observable.of(responseDeleted));
+ let spy2=spyOn(_formfieldservice,'getListOfFormFields').and.returnValue(Observable.of('you object'))
component.delete("delete");
+ expect(spy1).toHaveBeenCalled();
+ expect(spy2).toHaveBeenCalled();
})
-it('should test verify method',()=>{
-component.verify("Default");
-component.verify("value");
-
+it('should test createGroup method',()=>{
+ component.openDialog()
})
-// it('should test createGroup method',()=>{
-// component.openDialog()
-// })
+it('should test createGroup method',()=>{
+ let spy=spyOn(component,'openDialog');
+ component.createGroup();
+ expect(spy).toHaveBeenCalled();
+})
-});
+})
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
index e2b08a4f..af8e9db7 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.spec.ts
@@ -16,13 +16,7 @@ describe('LogComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LogComponent ],
- imports: [HttpClientTestingModule],
- // providers:[LogService,MockBackend,BaseRequestOptions,{
- // porvide:Http,useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
- // return new Http(backend,defaultOptions);
- // },
- // deps:[MockBackend,BaseRequestOptions],
- // }]
+ imports: [HttpClientTestingModule]
})
.compileComponents();
}));
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
index a1906c85..54df7d82 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts
@@ -19,7 +19,9 @@ describe('RunReportFormFieldsComponent', () => {
{
baseUrl: 'just for testing'
}
- ]
+ ];
+ var responseFormFieldGroups={"formFieldGroupsJSON":'{"Indrijeet":"kumar"}'};
+ var respObj={"formFieldList":{"value1":"value1"}};
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -30,12 +32,9 @@ describe('RunReportFormFieldsComponent', () => {
})
.compileComponents();
runService = TestBed.get(RunService);
- // spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment));
- // spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment));
spyOn(runService, 'getDefinitionPageDetails').and.returnValue(Observable.of(environment));
spyOn(runService, 'refreshFormFields').and.returnValue(Observable.of(environment));
- // spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment));
- spyOn(runService, 'getFormFieldGroupsData').and.returnValue(Observable.of(environment));
+
}));
beforeEach(() => {
@@ -127,11 +126,10 @@ describe('RunReportFormFieldsComponent', () => {
expect(component.ngOnInit).toHaveBeenCalled();
});
-// it('should test fetchAndPopulateFormFields method', () => {
-// spyOn(component, 'fetchAndPopulateFormFields').and.callThrough();
-// component.formFieldGroupObjList = null;
-// component.fetchAndPopulateFormFields(1, "test");
-// expect(component.fetchAndPopulateFormFields).toHaveBeenCalled();
-// });
+ it('should test fetchAndPopulateFormFields method', () => {
+ component.formFieldGroupObjList=[{"formFieldList":"formFieldList"}]
+ spyOn(runService, 'getFormFieldGroupsData').and.returnValue(Observable.of(responseFormFieldGroups));
+ component.fetchAndPopulateFormFields(respObj,"value2");
+ });
}); \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts
index 44765d49..fa856c00 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts
@@ -6,12 +6,21 @@ import { MatTableModule } from '@angular/material/table';
import { RunReportResultSetComponent } from './run-report-result-set.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { HttpClient } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing';
+import { RunService } from '../run.service';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/observable/throw';
describe('RunReportResultSetComponent', () => {
let component: RunReportResultSetComponent;
let fixture: ComponentFixture<RunReportResultSetComponent>;
+ let _runService:RunService;
+ var response={
+ "reportDataColumns":[{"columnTitle":"columnTitle"}],
+ "reportDataRows":[{"colId":"colId"}]
+ }
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -31,9 +40,26 @@ describe('RunReportResultSetComponent', () => {
fixture = TestBed.createComponent(RunReportResultSetComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ _runService=TestBed.get(RunService);
});
it('should compile', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method',()=>{
+ component.reportId1="reportId1";
+ let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+
+ })
+
+ it('should test ngAfterViewInit method',()=>{
+ component.reportId1="reportId1";
+ let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response))
+ component.ngAfterViewInit();
+ expect(spy).toHaveBeenCalled();
+ })
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts
index a41b11cd..2aeac4a2 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts
@@ -2,10 +2,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
-import { MatTableModule, MatTableDataSource } from '@angular/material/table';
+import { MatTableModule} from '@angular/material/table';
-import { RunReportComponent, PeriodicElement } from './run-report.component';
-import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core';
+import { RunReportComponent} from './run-report.component';
+import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChanges } from '@angular/core';
import { MatMenuModule } from '@angular/material';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
@@ -24,13 +24,12 @@ describe('RunReportComponent', () => {
let runService : RunService;
let options1 = {};
let dashboard;
- let dashboard2;
let responseformfield = 1;
let environment = [
{
baseUrl: 'just a link'
}
- ]
+ ];
beforeEach(async(() => {
@@ -49,13 +48,10 @@ describe('RunReportComponent', () => {
providers: [RunService]
}).compileComponents();
runService = TestBed.get(RunService);
- //spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment));
- //spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment));
spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
- //dashboard = {"item":{"hasContent":{"name":"rupi","id":"check#check"}}};
fixture = TestBed.createComponent(RunReportComponent);
runService = TestBed.get(RunService);
component = fixture.componentInstance;
@@ -107,6 +103,7 @@ describe('RunReportComponent', () => {
expect(component.NEWdisplayedColumns).toEqual(new Array());
});
+
it('should test showError method', () => {
let errmsg = "errormessage";
let stcktrace = "stacktrace";
@@ -148,40 +145,40 @@ describe('RunReportComponent', () => {
it('should test the ngOnChanges first If condition', () => {
change = {};
+ component.queryString="queryString";
+ component.reportId1="reportId1";
+ var response={"errormessage":true}
component.reportMode !== "Regular"
component.initCnt = 1;
component.TriggerFFArr.length = 0;
+ let spy=spyOn(runService,'getReportDataWithFormFields').and.returnValue(Observable.of(response));
component.ngOnChanges(change);
- expect(component.showMoreVert).toEqual(false);
+ expect(spy).toHaveBeenCalled();
expect(component.initCnt).toEqual(1);
expect(component.showDashboardReport).toEqual(false);
expect(component.displayedRowObj).toEqual(new Array());
expect(component.displayedColumns).toEqual(new Array());
expect(component.formFieldList).toEqual(new Array());
- expect(component.showSpinner).toEqual(true);
expect(component.NEWdisplayedColumns).toEqual(new Array());
expect(component.isReady).toEqual(false);
+
});
+
it('should test initialProcess method', () => {
component.DashboardReportObj.length = 1;
component.initialProcesses();
});
- // it('should test postFetchingReportDataFn method', () => {
- // let response: any;
- // component.postFetchingReportDataFn(response);
- // })
-
- // it('should test ngOnChanges subscribe method', () => {
- // spyOn(component, 'ngOnChanges').and.callThrough();
- // component.ngOnChanges(change);
- // expect(component.ngOnChanges).toHaveBeenCalled();
+ // it('should test postFetchingReportDataFn method',()=>{
+ // var response={
+ // "reportName":"reportName",
+ // "reportDataColumns":[{"columnTitle":"columnTitle","colId":"colId"}],
+ // "reportDataRows":[{"value":"value"}]
+ // }
+ // component.displayedColumnsArr=["string"]
+ // component.postFetchingReportDataFn(response)
// })
- // it('should test postFetchingReportDataFn method', () => {
- // let obj: any;
- // component.postFetchingReportDataFn(obj);
- // })
-
+
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-success-dialog/sql-validate-success-dialog.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-success-dialog/sql-validate-success-dialog.component.spec.ts
index 9f98ff18..92803321 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-success-dialog/sql-validate-success-dialog.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql-validate-success-dialog/sql-validate-success-dialog.component.spec.ts
@@ -22,4 +22,9 @@ describe('ValidateSuccessComponentComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnChanges method',()=>{
+ component.tableObj='{"reportDataColumns":"tableObj","reportDataRows":"reportDataRows"}';
+ component.ngOnChanges();
+ })
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
index 52082c9f..68085b1e 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.spec.ts
@@ -16,7 +16,6 @@ describe('SQLComponentComponent', () => {
let fixture: ComponentFixture<SQLComponent>;
const reportId = "test";
const finalGetObj = {"query":"dummyQuery"};
- let elements = [];
let environment = [
{
"baseUrl": 'just for test'
@@ -32,9 +31,7 @@ describe('SQLComponentComponent', () => {
})
.compileComponents();
sqlService = TestBed.get(SqlService);
- let response : any;
spyOn(sqlService, 'getSQLTabData').and.returnValue(Observable.of(environment));
- spyOn(sqlService, 'postSQLValidateAndSave').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
@@ -82,6 +79,27 @@ describe('SQLComponentComponent', () => {
expect(component.SQLclosable).toEqual(true);
});
+ it('should test saveSQL method else condition',()=>{
+ component.SQLPostResponse = false;
+ component.saveSQL();
+ })
+
+ it('should test validate method',()=>{
+ component.sqlText="sqlText";
+ var response={"data":{"elements":'{"elements":""}'}}
+ let spy=spyOn(sqlService,'postSQLValidateAndSave').and.returnValue(Observable.of(response))
+ component.validate();
+ expect(spy).toHaveBeenCalled();
+ })
+
+ it('should test validate method',()=>{
+ component.sqlText="sqlText";
+ var response={"data":{"elements":'{"query":"query"}'}}
+ let spy=spyOn(sqlService,'postSQLValidateAndSave').and.returnValue(Observable.of(response))
+ component.validate();
+ expect(spy).toHaveBeenCalled();
+ })
+
it('should test closeSaveModal method', () => {
component.closeSaveModal();
expect(component.showSaveSQLDialog).toEqual(component.showSaveSQLDialog);
@@ -113,10 +131,4 @@ describe('SQLComponentComponent', () => {
expect(component.GetValidateResponseString()).toEqual("test");
});
-// it('should test validate method', () => {
-// spyOn(component, 'validate').and.callThrough();
-// component.validate();
-// expect(component.validate).toHaveBeenCalled();
-// });
-
});
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 ee8f7b64..5178b52b 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,18 +50,27 @@ 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';
+import { ModalDismissReasons, NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { ProfileService } from '../profile.service';
+import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
describe('SelfComponent', () => {
let component: SelfComponent;
let fixture: ComponentFixture<SelfComponent>;
let userService:UserService;
+ let profileService:ProfileService;
let tableobj:any=JSON.stringify({"errormessage":"DummyError","stacktrace":"trace"});
+ let data={"data":'{"profile":\'{"data":"data"}\'}'};
+ //var _element={"_element":true};
+ var _element={"_element":{"selected":true}}
+
+
beforeEach(async(() => {
TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA],
- declarations: [ SelfComponent ],
+ declarations: [ SelfComponent,InformationModalComponent ],
imports: [
ReactiveFormsModule,
FormsModule,
@@ -70,9 +79,15 @@ describe('SelfComponent', () => {
MatSlideToggleModule,
BrowserAnimationsModule,
HttpClientTestingModule,
- RouterTestingModule
+ RouterTestingModule,
+ NgbModule.forRoot()
]
})
+ TestBed.overrideModule(BrowserDynamicTestingModule,{
+ set:{
+ entryComponents:[InformationModalComponent ]
+ }
+ })
.compileComponents();
}));
@@ -81,12 +96,17 @@ describe('SelfComponent', () => {
component = fixture.componentInstance;
fixture.detectChanges();
userService=TestBed.get(UserService);
+ profileService=TestBed.get(ProfileService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+ // it('should test assignProfileDetails method',()=>{
+ // component.assignProfileDetails(data);
+ // })
+
describe('should test ngOnInit method',()=>{
it('should test subscribe',()=>{
let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('you object'));
@@ -101,4 +121,27 @@ describe('SelfComponent', () => {
component['getDismissReason']("");
})
+ it('should test getProfileById method',()=>{
+ let spy=spyOn(profileService,'getProfileById').and.callThrough();
+ component.getProfileById("indrijeet");
+ expect(spy).toHaveBeenCalled();
+ })
+
+ it('should test getSelfProfileDetail method',()=>{
+ let spy=spyOn(profileService,'getSelfProfile').and.callThrough();
+ component.getSelfProfileDetail();
+ expect(spy).toHaveBeenCalled();
+ })
+
+ // // it('should test saveProfile method',()=>{
+ // // component.saveProfile()
+ // // })
+
+ it('should test toggleRoles method',()=>{
+ component.ociavailableRoles=[{"ociavailableRoles":"ociavailableRoles"}];
+ component.finalSelectedRoles=[{"finalSelectedRoles":"finalSelectedRoles"}];
+ component.toggleRoles(_element);
+ component.addUserRole(_element);
+ })
+
});
diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java
index 54ce2f4f..21c3f21c 100644
--- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java
+++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java
@@ -85,7 +85,7 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
password = portalRestCentralService.getAppCredentials().get(IPortalRestCentralService.CREDENTIALS_PASS);
appName = portalRestCentralService.getAppCredentials().get(IPortalRestCentralService.CREDENTIALS_APP);
} catch (Exception e) {
- throw new ClassCastException("Failed to find or instantiate class ");
+ throw new ServletException("Failed to instantiate class " + centralClassName, e);
}
}
@@ -211,4 +211,4 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
return credentialsMap;
}
-} \ No newline at end of file
+}