diff options
9 files changed, 44 insertions, 29 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java index 3260656ff..6c8a37262 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/AsyncInstantiationController.java @@ -76,20 +76,11 @@ public class AsyncInstantiationController extends VidRestrictedBaseController { this.auditService = auditService; } - /** - * Gets the new services status. - * @param request the request - * @return the services list - */ @RequestMapping(method = RequestMethod.GET) - public List<ServiceInfo> getServicesInfo(HttpServletRequest request, - @RequestParam(value = "serviceModelId", required = false) UUID serviceModelId) { - if (serviceModelId == null) { - return asyncInstantiationBL.getAllServicesInfo(); - } else { - return asyncInstantiationRepository.listInstantiatedServicesByServiceModelId(serviceModelId); - } + public List<ServiceInfo> getServicesInfo(HttpServletRequest request) { + return asyncInstantiationBL.getAllServicesInfo(); } + @RequestMapping(value = "bulk", method = RequestMethod.POST) public MsoResponseWrapper2<List<String>> createBulkOfServices(@RequestBody ServiceInstantiation request, HttpServletRequest httpServletRequest) { //Push to DB according the model diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java b/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java index 8aae3d805..ff9add2b6 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/InstantiationTemplatesController.java @@ -21,9 +21,11 @@ package org.onap.vid.controller; +import java.util.List; import java.util.UUID; import javax.servlet.http.HttpServletRequest; import org.onap.vid.dal.AsyncInstantiationRepository; +import org.onap.vid.model.ServiceInfo; import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; import org.onap.vid.services.AsyncInstantiationBusinessLogic; import org.onap.vid.services.InstantiationTemplatesService; @@ -31,6 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController @@ -53,6 +57,13 @@ public class InstantiationTemplatesController extends VidRestrictedBaseControlle this.asyncInstantiationRepository = asyncInstantiationRepository; } + + @GetMapping + public List<ServiceInfo> getTemplatesInfo(HttpServletRequest request, + @RequestParam(value = "serviceModelId") UUID serviceModelId) { + return asyncInstantiationRepository.listInstantiatedServicesByServiceModelId(serviceModelId); + } + @GetMapping("templateTopology/{jobId}") public ServiceInstantiation getTemplateTopology(HttpServletRequest request, @PathVariable(value="jobId") UUID jobId) { return instantiationTemplates.getJobRequestAsTemplate(jobId); diff --git a/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java b/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java index 5e1310535..8855b51f0 100644 --- a/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java +++ b/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java @@ -105,6 +105,10 @@ public class AsyncInstantiationBase extends BaseMsoApiTest { return uri.toASCIIString() + "/asyncInstantiation"; } + protected String getTemplateInfoUrl(String serviceModelId) { + return uri.toASCIIString() + "/instantiationTemplates?serviceModelId=" + serviceModelId; + } + protected String getJobAuditUrl() { return uri.toASCIIString() + "/asyncInstantiation/auditStatus/{JOB_ID}?source={SOURCE}"; } diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java index ff30c9ce5..4d2f06983 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java @@ -16,6 +16,7 @@ import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPres import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID; import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; import static vid.automation.test.services.SimulatorApi.retrieveRecordedRequests; @@ -31,6 +32,7 @@ import java.util.stream.Stream; import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction; import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; @@ -129,6 +131,8 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { @Test public void deployTwoServicesGetServicesFilterByModelId() { + registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), RegistrationStrategy.CLEAR_THEN_SET); + List<String> uuids = new LinkedList<>(); try { //given @@ -145,7 +149,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { //when ResponseEntity<List<ServiceInfo>> response = restTemplate.exchange( - getServiceInfoUrl() + "?serviceModelId=" + SERVICE_MODEL_UUID, + getTemplateInfoUrl(SERVICE_MODEL_UUID), HttpMethod.GET, null, new ParameterizedTypeReference<List<ServiceInfo>>() { @@ -169,8 +173,6 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { uuids.forEach(uuid->new AsyncJobsService().muteAsyncJobById(uuid)); } } - - @Test public void deleteServiceWithTwoVnfGroups_andRetry() { String parentServiceInstanceId = "service-instance-id"; diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts index b2d3eb578..e55b1dcd1 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts @@ -1,7 +1,7 @@ ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> describe('Template', () => { - const asyncInstantiation = [ + const instantiationTemplates = [ { "id": 8, "created": 1525075968000, @@ -102,7 +102,7 @@ describe('Template', () => { }).as('initFlags'); }); - cy.route(Cypress.config('baseUrl') + "/asyncInstantiation**", asyncInstantiation); + cy.route(Cypress.config('baseUrl') + "/instantiationTemplates**", instantiationTemplates); cy.route(Cypress.config('baseUrl') + "/getuserID", '16807000'); cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); @@ -135,13 +135,13 @@ describe('Template', () => { cy.get(`#header-aicZone`).contains('AIC Zone'); // check table body row - cy.getElementByDataTestsId(`userId-${asyncInstantiation[0].jobId}`).contains('16807000'); - cy.getElementByDataTestsId(`createDate-${asyncInstantiation[0].jobId}`).contains('2018-04-30 11:12:48'); - cy.getElementByDataTestsId(`instanceName-${asyncInstantiation[0].jobId}`).contains('nWUfl instance name_002'); - cy.getElementByDataTestsId(`instantiationStatus-${asyncInstantiation[0].jobId}`).contains('FAILED'); - cy.getElementByDataTestsId(`region-${asyncInstantiation[0].jobId}`).contains('hvf6 (WAYNEHOLLAND)'); - cy.getElementByDataTestsId(`tenant-${asyncInstantiation[0].jobId}`).contains('AIN Web Tool-15-D-testalexandria'); - cy.getElementByDataTestsId(`aicZone-${asyncInstantiation[0].jobId}`).contains('NFTJSSSS-NFT1'); + cy.getElementByDataTestsId(`userId-${instantiationTemplates[0].jobId}`).contains('16807000'); + cy.getElementByDataTestsId(`createDate-${instantiationTemplates[0].jobId}`).contains('2018-04-30 11:12:48'); + cy.getElementByDataTestsId(`instanceName-${instantiationTemplates[0].jobId}`).contains('nWUfl instance name_002'); + cy.getElementByDataTestsId(`instantiationStatus-${instantiationTemplates[0].jobId}`).contains('FAILED'); + cy.getElementByDataTestsId(`region-${instantiationTemplates[0].jobId}`).contains('hvf6 (WAYNEHOLLAND)'); + cy.getElementByDataTestsId(`tenant-${instantiationTemplates[0].jobId}`).contains('AIN Web Tool-15-D-testalexandria'); + cy.getElementByDataTestsId(`aicZone-${instantiationTemplates[0].jobId}`).contains('NFTJSSSS-NFT1'); //check load button is disabled diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts index b37d7f9a2..6a734161f 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts @@ -45,7 +45,7 @@ export class InstantiationTemplatesModalComponent extends DialogComponent<string .queryParams .subscribe(params => { - const getServiceJobInfoRoute = this._serviceInfoService.getServicesJobInfo(true, params['serviceModelId']); + const getServiceJobInfoRoute = this._serviceInfoService.getTemplatesInfo(true, params['serviceModelId']); const getUserIdRoute = this._aaiService.getUserId(); forkJoin([getServiceJobInfoRoute, getUserIdRoute]).subscribe(([jobs]) => { diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts index 0234ea514..23d42c972 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts @@ -50,8 +50,8 @@ describe('Service Info Service', () => { test('should call with serviceModelId', ()=>{ let job: ServiceInfoModel = new ServiceInfoModel(); - service.getServicesJobInfo(true, "123").subscribe(); - const req = httpMock.expectOne(`${Constants.Path.SERVICES_JOB_INFO_PATH}?${Constants.Path.SERVICE_MODEL_ID}=123`); + service.getTemplatesInfo(true, "123").subscribe(); + const req = httpMock.expectOne(`${Constants.Path.INSTANTIATION_TEMPLATES_PATH}?${Constants.Path.SERVICE_MODEL_ID}=123`); expect(req.request.method).toBe('GET'); }); }); diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts index 388afdba0..9c4712dc6 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts @@ -12,10 +12,16 @@ export class ServiceInfoService { constructor(private _http: HttpClient) { } - getServicesJobInfo(showSpinner: boolean = true, serviceModelId: string = null): Observable<ServiceInfoModel[]> { + getServicesJobInfo(showSpinner: boolean = true): Observable<ServiceInfoModel[]> { let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH; let headers = new HttpHeaders({'x-show-spinner': showSpinner.toString()}); - let params = serviceModelId ? {serviceModelId} : {}; + return this._http.get<ServiceInfoModel[]>(pathQuery, { headers: headers}); + } + + getTemplatesInfo(showSpinner: boolean = true, serviceModelId: string): Observable<ServiceInfoModel[]> { + let pathQuery = Constants.Path.INSTANTIATION_TEMPLATES_PATH; + let headers = new HttpHeaders({'x-show-spinner': showSpinner.toString()}); + let params = {serviceModelId}; return this._http.get<ServiceInfoModel[]>(pathQuery, { headers: headers, params }); } diff --git a/vid-webpack-master/src/app/shared/utils/constants.ts b/vid-webpack-master/src/app/shared/utils/constants.ts index f09ab088d..da717c8f4 100644 --- a/vid-webpack-master/src/app/shared/utils/constants.ts +++ b/vid-webpack-master/src/app/shared/utils/constants.ts @@ -93,6 +93,7 @@ export module Constants { public static WELCOME_PATH = 'welcome.htm'; public static IS_PERMITTED_SUB_PATH = '&isPermitted='; public static SERVICES_JOB_INFO_PATH = '../../asyncInstantiation'; + public static INSTANTIATION_TEMPLATES_PATH = '../../instantiationTemplates'; public static SERVICE_MODEL_ID = 'serviceModelId'; public static SERVICES_RETRY_TOPOLOGY = '../../asyncInstantiation/bulkForRetry'; public static INSTANTIATION_TEMPLATE_TOPOLOGY = '../../instantiationTemplates/templateTopology'; |