diff options
20 files changed, 657 insertions, 76 deletions
@@ -10,5 +10,5 @@ ecomp-sdk/*/null* ecomp-sdk/*/jacoco.exec ecomp-sdk/*/target .settings -target/* +ecomp-sdk/target/* test*.txt diff --git a/ecomp-sdk/epsdk-aaf/pom.xml b/ecomp-sdk/epsdk-aaf/pom.xml index d2cb0c5e..34b0c7b7 100644 --- a/ecomp-sdk/epsdk-aaf/pom.xml +++ b/ecomp-sdk/epsdk-aaf/pom.xml @@ -136,6 +136,11 @@ <artifactId>jackson-databind</artifactId> <version>2.6.3</version> </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>1.2.3</version> + </dependency> </dependencies> <profiles> <!-- disable doclint, a new feature in Java 8, when generating javadoc --> diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml index 96bdd186..48c67c67 100644 --- a/ecomp-sdk/epsdk-analytics/pom.xml +++ b/ecomp-sdk/epsdk-analytics/pom.xml @@ -17,6 +17,26 @@ <url>https://wiki.onap.org/display/DW/Portal</url> <!-- properties are inherited from parent --> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.19.1</version> + <configuration> + <skipTests>${skiptests}</skipTests> + <includes> + <include>**/Test*.java</include> + <include>**/*Test.java</include> + <include>**/*TestCase.java</include> + </includes> + <systemPropertyVariables> + <container.classpath>classpath:</container.classpath> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> <!-- repositories are inherited from parent --> <dependencies> diff --git a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtilsTest.java b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtilsTest.java index 1a7d2a8e..9d9f9124 100644 --- a/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtilsTest.java +++ b/ecomp-sdk/epsdk-analytics/src/test/java/org/onap/portalsdk/analytics/system/fusion/RemoteDbUtilsTest.java @@ -70,4 +70,15 @@ public class RemoteDbUtilsTest { } + @Test + public void testClearConnection() + { + RemoteDbUtils remoteDbUtils=new RemoteDbUtils(); + try { + remoteDbUtils.clearConnection(connection); + } + catch(NullPointerException e) { + } + } + } 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 4a12cd9f..ecbbcc60 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 @@ -4,7 +4,7 @@ * =================================================================== * Copyright © 2019 AT&T Intellectual Property. All rights reserved. * =================================================================== - * Modification Copyright © 2020 IBM. + * * Modification Copyright © 2020 IBM. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -37,7 +37,7 @@ * * */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { HttpClientModule } from '@angular/common/http'; @@ -47,15 +47,23 @@ import { LayoutModule } from '../../layout.module'; import { CookieService } from 'ngx-cookie-service'; import { HeaderService } from 'src/app/shared/services/header/header.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { Router } from '@angular/router'; +import { MockBackend, MockConnection } from '@angular/http/testing'; +//import { observable, Observable } from 'rxjs'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import { BaseRequestOptions, Http } from '@angular/http'; describe('HeaderComponent', () => { let headerService:HeaderService; + let cookieService:CookieService; + let router:Router; let component: HeaderComponent; let fixture: ComponentFixture<HeaderComponent>; + let spy: any; beforeEach(async(() => { TestBed.configureTestingModule({ - providers:[CookieService], imports: [ LayoutModule, RouterTestingModule, @@ -63,6 +71,13 @@ describe('HeaderComponent', () => { HttpClientModule, HttpClientTestingModule ], + providers:[CookieService,HeaderService,MockBackend, BaseRequestOptions, { + provide: Http, + useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => { + return new Http(backend, defaultOptions); + }, + deps: [MockBackend, BaseRequestOptions], + }] }) .compileComponents(); })); @@ -72,27 +87,35 @@ describe('HeaderComponent', () => { component = fixture.componentInstance; fixture.detectChanges(); headerService = TestBed.get(HeaderService); + cookieService=TestBed.get(CookieService); + }); it('should create', () => { expect(component).toBeTruthy(); }); - it('should test ngOnInit method',()=>{ - fixture.detectChanges(); - component.ngOnInit(); - if(component.cookieService.get('show_app_header')=='false') - expect(component.showHeader).toBe(false); - expect(component.pushRightClass).toEqual('push-right'); - (done: DoneFn)=> { - headerService.getTopMenuItems().subscribe(res=>{ - expect(component.response).toEqual(res); - expect(component.userFirstName).toBe(component.response.firstName); - expect(component.userEmail).toBe(component.response.email); - expect(component.userId).toBe(component.response.userId); - expect(component.userName).toBe(component.response.userName); - done(); + describe('should test ngOnInit',()=>{ + it('should validate on ngOnInit',()=>{ + let spy=spyOn(headerService, 'getTopMenuItems').and.returnValue(Observable.of('you object')); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); }) - } - }); + }) + + + it('should test isToggled method',()=>{ + expect(component.isToggled()).toBe(false); + }) + + it('should test toggleSidebar method',()=>{ + component.pushRightClass="kumar"; + expect(component.toggleSidebar()).toBeUndefined; + }) + + it('should test on onLoggedout method',()=>{ + expect(localStorage.getItem('isLoggedin')).toBeFalsy + }) + + }); 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 ad425219..38902784 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 @@ -41,27 +41,47 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; import { HttpClientModule } from '@angular/common/http'; -//import { CookieModule, CookieService } from 'ngx-cookie'; import { SidebarComponent } from './sidebar.component'; import { LayoutModule } from '../../layout.module'; import { Session } from 'protractor'; import { CookieService } from 'ngx-cookie-service'; +import { SidebarService } from 'src/app/shared/services'; +import { ReplaySubject } from 'rxjs'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import { BaseRequestOptions, Http, XHRBackend } from '@angular/http'; +import { MockBackend } from '@angular/http/testing'; +import { environment } from 'src/environments/environment'; +import { inject } from '@angular/core'; +import { Response } from '@angular/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('SidebarComponent', () => { let component: SidebarComponent; let fixture: ComponentFixture<SidebarComponent>; + let sidebarService: SidebarService; + let spy:any; + + let mockSidebarService = { + navigate: jasmine.createSpy('navigate') + }; beforeEach(async(() => { TestBed.configureTestingModule({ - providers:[CookieService], imports: [ LayoutModule, RouterTestingModule, TranslateModule.forRoot(), HttpClientModule, - // CookieModule.forRoot() + HttpClientTestingModule ], - // providers:[CookieService] + providers:[CookieService, SidebarService,MockBackend, BaseRequestOptions, { + provide: Http, + useFactory: (backend: XHRBackend, defaultOptions: BaseRequestOptions) => { + return new Http(backend, defaultOptions); + }, + deps: [MockBackend, BaseRequestOptions], + }], }) .compileComponents(); })); @@ -70,12 +90,26 @@ describe('SidebarComponent', () => { fixture = TestBed.createComponent(SidebarComponent); component = fixture.componentInstance; fixture.detectChanges(); + sidebarService = TestBed.get(SidebarService); }); it('should create', () => { expect(component).toBeTruthy(); }); + describe('should test ngOnInit',()=>{ + it('should validate on ngOnInit',(done)=>{ + var result=sidebarService.getLeftMenu() + spy=spyOn(sidebarService, 'getLeftMenu').and.returnValue(result); + fixture.detectChanges(); + sidebarService.getLeftMenu(); + expect(spy).toHaveBeenCalled(); + component.ngOnInit(); + done() + //expect(component.result).toEqual(result) + }) + }) + it('should test addExpandClass if element and showMenu variable value are same', () => { component.showMenu= '1'; component.addExpandClass('1'); @@ -100,8 +134,17 @@ describe('SidebarComponent', () => { expect(component.isActive).toBe(false); }); - it('should test ngOnInit function', () => { - component.ngOnInit(); - }); + it('should test isToggled method',()=>{ + expect(component.isToggled()).toBe(false); + }) + + it('should test toggleSidebar method',()=>{ + component.pushRightClass="kumar"; + expect(component.toggleSidebar()).toBeUndefined; + }) + + it('should test on onLoggedout method',()=>{ + expect(localStorage.getItem('isLoggedin')).toBeFalsy + }) }); 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.service.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.service.spec.ts index 72d0980d..f8611463 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.service.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.service.spec.ts @@ -1,12 +1,28 @@ import { TestBed } from '@angular/core/testing'; import { DashboardReportGridService } from './dashboard-report-grid.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { environment } from 'src/environments/environment'; describe('DashboardReportGridService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + + let service: DashboardReportGridService; + + beforeEach(() => {TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + }); + service = TestBed.get(DashboardReportGridService); + +}); it('should be created', () => { const service: DashboardReportGridService = TestBed.get(DashboardReportGridService); expect(service).toBeTruthy(); }); + + it('should getReportList', () => { + service.getReportList().subscribe((res) => { + expect(res).toBe(environment); + }) + }) }); 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 1dab68ba..8d9003fc 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 @@ -6,6 +6,7 @@ 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'; describe('FormFieldsComponent', () => { let component: FormFieldsComponent; @@ -15,7 +16,13 @@ describe('FormFieldsComponent', () => { TestBed.configureTestingModule({ schemas:[CUSTOM_ELEMENTS_SCHEMA], declarations: [ FormFieldsComponent ], - imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule] + imports:[ + FormsModule, + HttpClientTestingModule, + MatDialogModule, + MatSnackBarModule, + // BrowserAnimationsModule + ] }) .compileComponents(); })); @@ -50,4 +57,102 @@ describe('FormFieldsComponent', () => { } }); + it('should test setDisplayMode method',()=>{ + component.setDisplayMode("setDisplayMode"); + }); + + it('should test edit method',()=>{ + component.edit("Id"); + + }) + + it('should test add method',()=>{ + component.add(); + expect(component.showDialog).toBe(true); + expect(component.closable).toBe(true); + expect(component.validationType).toEqual(""); + expect(component.visible).toEqual("YES"); + expect(component.message).toBe(""); + expect(component.groupFormField).toBe(false); + expect(component.fieldType).toBe(""); + expect(component.fieldSQL).toBe(""); + expect(component.fieldName).toBe(""); + expect(component.fieldId).toBe(""); + expect(component.fieldDefaultSQL).toBe(''); + expect(component.errorStackTrace).toBe(""); + expect(component.errorMessage).toBe(""); + expect(component.defaultValue).toBe(false); + expect(component.predefinedValueList).toEqual([]); + expect(component.showDialog).toBe(true); + expect(component.closable).toBe(true); + expect(component.mode).toEqual("Add"); + }); + + it('should test close method1',()=>{ + component.showDialog=true; + component.close(); + expect(component.showDialog).toBe(false); + expect(component.closable).toBe(false); + }); + + it('should test close method2',()=>{ + component.showDialog=false; + component.close(); + expect(component.showDialog).toBe(true); + expect(component.closable).toBe(false); +}); + + it('should test loseValidateModal method1',()=>{ + component.showDialog1=true; + component.closeValidateModal(); + expect(component.showDialog1).toBe(false); + expect(component.showVerifySpinner).toBe(false); + }) + + it('should test loseValidateModal method2',()=>{ + component.showDialog1=false; + component.closeValidateModal(); + expect(component.showDialog1).toBe(true); + expect(component.showVerifySpinner).toBe(false); +}); + +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.deleteFromList("attrib"); +}); + +it('should test save method',()=>{ + component.save(); + expect(component.showSpinner).toBe(true); + expect(component.showDialog).toBe(false); + expect(component.finalPOSTObj["validationType"]).toEqual(component.validationType); + if(component.visible=="YES") + expect(component.finalPOSTObj["visible"]).toBe(true); + else + expect(component.finalPOSTObj["visible"]).toBe(false); + expect(component.finalPOSTObj["orderSeq"]).toEqual(component.orderSeq); + expect(component.finalPOSTObj["message"]).toEqual(component.message); + expect(component.finalPOSTObj["groupFormField"]).toEqual(component.groupFormField); + expect(component.finalPOSTObj["fieldType"]).toEqual(component.fieldType); + expect(component.finalPOSTObj["fieldSQL"]).toEqual(component.fieldSQL); + expect(component.finalPOSTObj["fieldName"]).toEqual(component.fieldName); + expect(component.finalPOSTObj["fieldId"]).toEqual(component.fieldId); + expect(component.finalPOSTObj["errorStackTrace"]).toEqual(component.errorStackTrace); + expect(component.finalPOSTObj["errorMessage"]).toEqual(component.errorMessage); + expect(component.finalPOSTObj["defaultValue"]).toEqual(component.defaultValue); + if(component.defaultValue===false) + expect(component.finalPOSTObj["fieldDefaultSQL"]).toBe(null); + else + expect(component.finalPOSTObj["fieldDefalultSQL"]).toEqual(component.fieldDefaultSQL); + expect(component.finalPOSTObj["predefinedValueList"]).toEqual(component.predefinedValueList); + +}); + + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-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-dashboard-report/run-dashboard-report.component.spec.ts index 96dcdbaa..e0ea762d 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-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-dashboard-report/run-dashboard-report.component.spec.ts @@ -2,25 +2,39 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MatTableModule } from '@angular/material'; import { RunDashboardReportComponent } from './run-dashboard-report.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { RouterModule } from '@angular/router'; +import { RouterModule, Router } from '@angular/router'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { DashboardReportService } from './dashboard-report.service'; +import { MockBackend, MockConnection } from '@angular/http/testing'; +import { Http, BaseRequestOptions } from '@angular/http'; +import { Observable } from 'rxjs'; +import 'rxjs/add/observable/empty'; +import 'rxjs/add/observable/of'; +import { environment } from 'src/environments/environment'; describe('RunDashboardReportComponent', () => { let component: RunDashboardReportComponent; let fixture: ComponentFixture<RunDashboardReportComponent>; let dashboardService : DashboardReportService; + let router: Router; beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [ RunDashboardReportComponent ], imports: [MatTableModule, RouterTestingModule, HttpClientTestingModule], - providers: [DashboardReportService] + providers:[DashboardReportService, MockBackend, BaseRequestOptions, { + provide: Http, + useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => { + return new Http(backend, defaultOptions); + }, + deps: [MockBackend, BaseRequestOptions], + }] }) .compileComponents(); dashboardService = TestBed.get(DashboardReportService); + router = TestBed.get(Router); })); beforeEach(() => { @@ -49,10 +63,13 @@ describe('RunDashboardReportComponent', () => { expect(component.dataSource.paginator).toEqual(component.paginator); }); - it('should test ngOnChanges method', () => { - component.initialQueryString !== component.queryString; + it('should test ngOnChanges methods if condition', () => { + + component.hitCnt = 1; + component.queryString = "testing" + component.initialQueryString === "test"; component.initCounter > 0; - component.runButtonHitCounter !== component.hitCnt; + component.runButtonHitCounter === 2; component.ngOnChanges(); expect(component.initialQueryString).toEqual(component.queryString); @@ -67,26 +84,51 @@ describe('RunDashboardReportComponent', () => { }); - it('should test afterViewInitProcesses method', () => { - component.afterViewInitProcesses(); - expect(component.displayedColumnsArr).toEqual(new Array()); - 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.isReady).toEqual(false); - expect(component.NEWdisplayedColumns).toEqual(new Array()); - - dashboardService.getReportDataWithFormFields("dummy", "test").subscribe((Response) => { - expect(component.formFieldPresent).toEqual(false); - expect(component.responseFormFieldListLength).toEqual(0); - expect(component.reportName).toEqual(Response["reportName"]); - }); - }); + it('should test ngOnChanges methods else condition', () => { + + component.hitCnt = 1; + component.queryString = "testing" + component.initialQueryString === "testing"; + component.initCounter = 0; + component.runButtonHitCounter === 1; + + component.ngOnChanges(); + expect(component.runButtonHitCounter).toBe(component.hitCnt); + expect(component.initialQueryString).toBe(component.queryString); + +}); it('should test applyFilter method', () => { component.applyFilter("testing"); expect(component.dataSource.filter).toEqual("testing".trim().toLowerCase()); }); + it('should test afterViewInitProcesses method', () => { + component.afterViewInitProcesses(); + expect(component.displayedColumnsArr).toEqual(new Array()); + 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.isReady).toEqual(false); + expect(component.NEWdisplayedColumns).toEqual(new Array()); + }); + + it('should test linkToReport method', () => { + let reportId = "abc"; + let queryParameters = "def"; + component.linkToReport(reportId, queryParameters); + }); + + it('should test linkToFeedback method', () => { + let reportId = "abc"; + let queryParameters = "def"; + component.linkToFeedback(reportId, queryParameters); + }); + + it('should test linkToMail method', () => { + let mailID = "abc"; + component.linkToMail(mailID); + }); + });
\ 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-list.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts index b61e9c56..359bee9f 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts @@ -2,22 +2,30 @@ 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 } from '@angular/material/table'; +import { MatTableModule, MatTableDataSource } from '@angular/material/table'; import { ReportListComponent } from './report-list.component'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { Router } from '@angular/router'; +import { AllReportsDataSource } from './report-list-datasource'; -describe('AllReportsComponent', () => { +describe('ReportListComponent', () => { let component: ReportListComponent; let fixture: ComponentFixture<ReportListComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [ ReportListComponent ], imports: [ NoopAnimationsModule, MatPaginatorModule, MatSortModule, MatTableModule, + HttpClientTestingModule, + RouterTestingModule ] }).compileComponents(); })); @@ -31,4 +39,59 @@ describe('AllReportsComponent', () => { it('should compile', () => { expect(component).toBeTruthy(); }); -}); + + it('should test initializeReportList method', () => { + component.initializeReportList(); + expect(component.showSpinner).toEqual(true); + expect(component.dataSource).toEqual(new AllReportsDataSource()); + expect(component.intermediateDisplayedColumns).toEqual(new Array()); + expect(component.finalGETObj).toEqual(new Object()); + expect(component.finalGETObjRowsArr).toEqual(new Array()); + expect(component.rowArr).toEqual(new Array()); + expect(component.reportIdArr).toEqual(new Array()); + expect(component.toggle).toEqual(false); + expect(component.toggle1).toEqual(false); + expect(component.finalRowArr).toEqual(new Array()); + }); + + it('should test ngOnInit method', () => { + component.ngOnInit(); + expect(component.toggle).toEqual(false); + }); + + it('should test confirmDelete method', () => { + component.confirmDelete("test"); + expect(component.showDialog).toEqual(true); + expect(component.closable).toEqual(true); + expect(component.newReportId).toEqual("test"); + }); + + it('should test ngAfterViewInit method', () => { + component.ngAfterViewInit(); + expect(component.dataSource.sort).toEqual(component.sort); + expect(component.dataSource.paginator).toEqual(component.paginator); + expect(component.table.dataSource).toEqual(component.dataSource); + }); + + it('should test displayReport method', () => { + component.displayReport("Testing"); + expect(component.reportId).toEqual("Testing"); + }); + + it('should test runReport method', () => { + component.runReport("Test"); + expect(component.reportId).toEqual("Test"); + }); + + it('should test applyFilter method', () => { + component.applyFilter("ABC"); + expect(component.dataSource1.filter).toEqual("abc"); + + }); + + it('should test close method', () => { + component.close(); + expect(component.showDialog).toEqual(true); + expect(component.closable).toEqual(false); + }) +});
\ No newline at end of file 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 2e91c188..d87afceb 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 @@ -4,6 +4,8 @@ * =================================================================== * 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"); @@ -39,6 +41,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SelfComponent } from './self.component'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { MatTableModule, MatSelectModule, MatSlideToggleModule } from '@angular/material'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; describe('SelfComponent', () => { let component: SelfComponent; @@ -46,7 +53,17 @@ describe('SelfComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ SelfComponent ] + schemas: [CUSTOM_ELEMENTS_SCHEMA], + declarations: [ SelfComponent ], + imports: [ + ReactiveFormsModule, + FormsModule, + MatTableModule, + MatSelectModule, + MatSlideToggleModule, + BrowserAnimationsModule, + HttpClientTestingModule + ] }) .compileComponents(); })); diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml index 1e8bca6a..bf6e1764 100644 --- a/ecomp-sdk/epsdk-core/pom.xml +++ b/ecomp-sdk/epsdk-core/pom.xml @@ -43,6 +43,60 @@ </systemPropertyVariables> </configuration> </plugin> + + <plugin> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>2.17</version> + <dependencies> + <dependency> + <groupId>org.onap.oparent</groupId> + <artifactId>checkstyle</artifactId> + <version>2.0.0</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>onap-license</id> + <goals> + <goal>check</goal> + </goals> + <phase>process-sources</phase> + <configuration> + <configLocation>onap-checkstyle/check-license.xml</configLocation> + <includeResources>false</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>false</includeTestResources> + <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> + <excludes> + </excludes> + <consoleOutput>true</consoleOutput> + <failsOnViolation>false</failsOnViolation> + </configuration> + </execution> + <execution> + <id>onap-java-style</id> + <goals> + <goal>check</goal> + </goals> + <phase>none</phase> + <configuration> + <!-- Use Google Java Style Guide: + https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml + with minor changes --> + <configLocation>onap-checkstyle/onap-java-style.xml</configLocation> + <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory --> + <sourceDirectory>src</sourceDirectory> + <includeResources>true</includeResources> + <includeTestSourceDirectory>true</includeTestSourceDirectory> + <includeTestResources>true</includeTestResources> + <excludes> + </excludes> + <consoleOutput>true</consoleOutput> + <failsOnViolation>false</failsOnViolation> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml index a5d1cfc7..b5f59ada 100644 --- a/ecomp-sdk/pom.xml +++ b/ecomp-sdk/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>1.2.0</version> + <version>2.0.0</version> <relativePath/> </parent> @@ -125,7 +125,7 @@ <pluginManagement> <plugins> <!-- Silence Eclipse/m2e complaints about checkstyle plugin brought in - by OParent --> + by OParent <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> @@ -150,6 +150,7 @@ </lifecycleMappingMetadata> </configuration> </plugin> + --> <!-- maven-site-plugin config is provided by OParent --> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/package-lock.json b/ecomp-sdk/portalsdk-tag-lib-test-app/package-lock.json index 9bc7bc01..780e6580 100644 --- a/ecomp-sdk/portalsdk-tag-lib-test-app/package-lock.json +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/package-lock.json @@ -8235,7 +8235,7 @@ }, "portalsdk-tag-lib": { "version": "file:portalsdk-tag-lib-0.0.1.tgz", - "integrity": "sha512-O3yOgsgD0OnvfWF8sM/kW27YdCu7HRUqhGXJOMEhKJY04RAGVHsjTkl2bEfaGu/n79GHYG8W3X1rqgHhV8OhzA==", + "integrity": "sha512-iqr81BSaZSC+ids5jIxDwvspC/yEKMX2PlTMoFAy0mvI/tcAeKUvSKgsFadqPRHBPbTbtXFDDpn22ZxgTtyc9Q==", "requires": { "tslib": "^1.9.0" } diff --git a/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz b/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz Binary files differindex ece29655..0bf78906 100644 --- a/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz +++ b/ecomp-sdk/portalsdk-tag-lib-test-app/portalsdk-tag-lib-0.0.1.tgz diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.scss b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.scss index 6e53e96f..64dd1d38 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.scss +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.scss @@ -1,3 +1,37 @@ -.input-editor{ - width: 31em; -}
\ No newline at end of file +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2020 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * 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============================================ + * + * + */
\ No newline at end of file diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts index 31c9e9d7..ea6d1746 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-input-editor/rdp-input-editor.component.ts @@ -1,3 +1,41 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2020 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * 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 { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; @Component({ diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts index a657a000..5dbc037b 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts @@ -1,15 +1,56 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2020 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * 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 { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'rdp-select-editor', styleUrls: ['./rdp-select-editor.component.scss'], template: ` - <mat-select [(value)]="selected" - (selectionChange)="detectChange(columnValue)"> - <mat-option *ngFor="let item of data" [value]="item.name"> - {{item.name}} - </mat-option> - </mat-select> + <mat-form-field> + <mat-label>{{columntitle | titlecase}}:</mat-label> + <mat-select [(value)]="selected" + (selectionChange)="detectChange(columnValue)"> + <mat-option *ngFor="let item of data" [value]="item.name"> + {{item.name}} + </mat-option> + </mat-select> + </mat-form-field> ` }) export class RdpSelectEditorComponent implements OnInit { diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html index 8a967121..a0e2b01b 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html @@ -2,7 +2,7 @@ ============LICENSE_START========================================== ONAP Portal- SDK =================================================================== - Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed @@ -45,10 +45,10 @@ <div class="modal-body"> <!-- This is the modal body where fields has to apper with respect to their field type --> - <div *ngFor="let column of columnsInfoList"> - {{column.dispalyTitle | titlecase}} + <div *ngFor="let column of columnsInfoList" class="elementsContainer"> <div [ngSwitch]="column.type"> - <div *ngSwitchCase="'text'"> + <div *ngSwitchCase="'text'" class="groupItem"> + <label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br> <rdp-input-editor (changedColumnValue)="columnDataChanged($event, column.title)" rowdata="{{selectedRowData}}" columntitle="{{column.title}}" @@ -56,28 +56,33 @@ > </rdp-input-editor> </div> - <div *ngSwitchCase="'dropdown'"> + <div *ngSwitchCase="'dropdown'" class="groupItem"> <rdp-select-editor (changedColumnValue)="columnDataChanged($event, column.title)" rowdata="{{selectedRowData}}" [data]="column.listData" columntitle="{{column.title}}"></rdp-select-editor> </div> - <div *ngSwitchCase="'textarea'"> + <div *ngSwitchCase="'textarea'" class="groupItem"> + <label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br> <rdp-textarea-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-textarea-editor> </div> - <div *ngSwitchCase="'checkbox'"> + <div *ngSwitchCase="'checkbox'" class="groupItem"> + <label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br> <rdp-checkbox-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-checkbox-editor> </div> - <div *ngSwitchCase="'radio'"> + <div *ngSwitchCase="'radio'" class="groupItem"> + <label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br> <rdp-radio-editor (changedColumnValue)="columnDataChanged($event, column.title)" [data]="column.listData" rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-radio-editor> </div> - <div *ngSwitchCase="'datepicker'"> + <div *ngSwitchCase="'datepicker'" class="groupItem"> + <label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br> <rdp-datepicker-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-datepicker-editor> </div> - <div *ngSwitchDefault> + <div *ngSwitchDefault class="groupItem"> + <label class="item-label">{{column.dispalyTitle | titlecase}}:</label><br> <rdp-input-editor (changedColumnValue)="columnDataChanged($event, column.title)" rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-input-editor> </div> diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss index e69de29b..c0c95d90 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss @@ -0,0 +1,63 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2020 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * 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============================================ + * + * + */ + +::ng-deep .modal-dialog { + max-width: 1200px; + width: 855px; + overflow-x: auto; + overflow-y: auto; +} + + +.elementsContainer{ + display: inline-flex; +} + +.groupItem{ + margin-right: 11px; + margin-bottom: 10px; +} + +.form-field{ + height: 30px; + width: 198px +} + +.item-label{ + margin-bottom: 1px; +}
\ No newline at end of file |