diff options
15 files changed, 98 insertions, 29 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java index 4f3ed4c96e..6fa3afd4b4 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,8 +30,6 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.Subnet; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index b81efa38e5..6713c2d069 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -245,7 +245,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public void queryVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId, MsoRequest msoRequest, String notificationUrl) { - String serviceName = "QueryVnfA"; logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_QUERY_VNF); // Use the synchronous method to perform the actual query @@ -323,7 +322,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public void deleteVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId, MsoRequest msoRequest, String notificationUrl) { - String serviceName = "DeleteVnfA"; logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF); // Use the synchronous method to perform the actual delete @@ -460,7 +458,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs(); if (hMap != null && hMap.value != null) { - Map<String, String> sMap = new HashMap<>(); + Map<String, String> sMap; sMap = hMap.value; CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry(); @@ -478,7 +476,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs(); if (hMap != null && hMap.value != null) { - Map<String, String> sMap = new HashMap<>(); + Map<String, String> sMap; sMap = hMap.value; UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry(); @@ -498,7 +496,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs(); if (hMap != null && hMap.value != null) { - Map<String, String> sMap = new HashMap<>(); + Map<String, String> sMap; sMap = hMap.value; QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry(); diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java index a2c1f135c2..b8bada298e 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,8 +36,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()) - .and().httpBasic(); + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() + .httpBasic(); } @Override diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java index b14e3ce4fb..d27c891304 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,7 +27,6 @@ import javax.persistence.EntityManagerFactory; import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java index e1eb9ecef9..232381385f 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,8 +36,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info", "/services").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()) - .and().httpBasic(); + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() + .httpBasic(); } @Override diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java index ad99d0da36..979238fe2f 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java @@ -41,7 +41,6 @@ public class MapTypedRequestTunablesData { private static final String MISSING_CONFIGURATION_ERROR_MSG = "Missing configuration for: "; private static final String MISSING_CONFIG_PARAM_ERROR_MSG = "Missing config param"; - private static final String MSO_INTERNAL_ERROR = "MsoInternalError"; @Autowired private Environment env; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java index 4270be4897..e94e34d87c 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,8 +36,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info", "/services").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()) - .and().httpBasic(); + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() + .httpBasic(); } @Override diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java index b97b9ac1ca..9828d11186 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java @@ -113,9 +113,9 @@ public class ApplicationControllerAction { errorCode = Integer.toString(appCStatus.getCode()); errorMessage = appCStatus.getMessage(); - } - if (ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)) { - errorCode = "0"; + if (ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)) { + errorCode = "0"; + } } } catch (JsonProcessingException e) { logger.error("Incorrect Payload format for action request: {}", action.toString(), e); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java index c2af155d51..1ed3214214 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") - .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic(); + .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and().httpBasic(); } @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java index c2af155d51..1ed3214214 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") - .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic(); + .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and().httpBasic(); } @Override diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index bf8c80db82..f23e5cdb5a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -123,7 +123,7 @@ public class VnfAdapterVfModuleObjectMapper { public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) - throws IOException { + throws IOException, MissingValueTagException { CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); @@ -172,7 +172,7 @@ public class VnfAdapterVfModuleObjectMapper { private Map<String, Object> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) - throws IOException { + throws IOException, MissingValueTagException { GenericResourceApiVnfTopology vnfTop = diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java index 32d2c50978..d82fd38e9f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java @@ -80,7 +80,7 @@ public class ResumeOrchestrationRequest { private MsoRequest msoRequest; @POST - @Path("/{version:[vV][7]}/requests/{requestId}/resume") + @Path("/{version:[vV][7]}/{requestId}/resume") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Resume request for a given requestId", response = Response.class) diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java index 97b80098e6..632f371af5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,8 +41,8 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()) - .and().httpBasic(); + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() + .httpBasic(); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java index db84353cd4..227506c60e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java @@ -182,7 +182,7 @@ public abstract class AbstractRestHandler { } return selfLinkUrl; } - + /** * @param vfmoduleInstanceId * @param requestId diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java index ea6c6ef71a..46030e94d3 100644 --- a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java +++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java @@ -21,11 +21,17 @@ package org.onap.svnfm.simulator.services; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest; import org.onap.svnfm.simulator.config.ApplicationConfig; import org.onap.svnfm.simulator.model.VnfOperation; @@ -40,13 +46,22 @@ public class InstantiateOperatorProgressorTest { private static final String VNFC_TYPE = "COMPUTE"; private static final String RESOURCE_TEMPLATE_ID = "resTempIdTest"; private static final String VDU_ID = "vduIdTest"; + private static final String VNF_INSTANCE_ID = "vnfInstanceId"; + private static final String VNFC_ID = "vnfcIdTest"; + private static final String RESOURCE_DEFINITION_ID = "resDefTestId"; + private static final String VIM_CONNECTION_ID = "vimConnTestId"; + + private SvnfmService svnfmServiceMock; private InstantiateOperationProgressor testedObject; @Before public void setup() { - testedObject = new InstantiateOperationProgressor(new VnfOperation(), new SvnfmService(), null, - new ApplicationConfig(), createVnfds(), createSubscriptionService()); + svnfmServiceMock = mock(SvnfmService.class); + VnfOperation vnfOperation = new VnfOperation(); + vnfOperation.setVnfInstanceId(VNF_INSTANCE_ID); + testedObject = new InstantiateOperationProgressor(vnfOperation, svnfmServiceMock, null, new ApplicationConfig(), + createVnfds(), createSubscriptionService()); } @Test @@ -65,13 +80,49 @@ public class InstantiateOperatorProgressorTest { assertThat(result).isEmpty(); } + @Test + public void handleGrantResponse_VnfdObjectsAvailable() { + when(svnfmServiceMock.getVnf(VNF_INSTANCE_ID)).thenReturn(createInlineResponse201()); + + InlineResponse201VimConnections inlineResponse201VimConnections = new InlineResponse201VimConnections(); + List<InlineResponse201VimConnections> listOfVimConnection = new ArrayList<>(); + listOfVimConnection.add(inlineResponse201VimConnections); + + InlineResponse201AddResources inlineResponse201AddResources = new InlineResponse201AddResources(); + inlineResponse201AddResources.setResourceDefinitionId(RESOURCE_DEFINITION_ID); + inlineResponse201AddResources.setVimConnectionId(VIM_CONNECTION_ID); + List<InlineResponse201AddResources> listOfResources = new ArrayList<>(); + listOfResources.add(inlineResponse201AddResources); + + InlineResponse201 inlineResponse201 = new InlineResponse201(); + inlineResponse201.setVimConnections(listOfVimConnection); + inlineResponse201.setAddResources(listOfResources); + List<InlineResponse201InstantiatedVnfInfoVnfcResourceInfo> resultList = + testedObject.handleGrantResponse(inlineResponse201); + + assertThat(resultList).hasSize(1); + InlineResponse201InstantiatedVnfInfoVnfcResourceInfo resultObject = resultList.get(0); + assertThat(resultObject.getId()).isEqualTo(VNFC_ID); + assertThat(resultObject.getVduId()).isEqualTo(VDU_ID); + assertThat(resultObject.getComputeResource().getVimConnectionId()).isEqualTo(VIM_CONNECTION_ID); + } + + @Test + public void getVnfcChangeType_enumAdded() { + assertThat(testedObject.getVnfcChangeType().getValue()).isEqualTo("ADDED"); + } + + @Test + public void getRemoveResourcesShouldReturnEmptyList() { + assertThat(testedObject.getRemoveResources("anyVnfId")).isEmpty(); + } + private Vnfds createVnfds() { Vnfd vnfd = new Vnfd(); vnfd.setVnfdId(VNF_ID); List<Vnfc> vnfcList = new ArrayList<>(); vnfcList.add(createVnfc()); vnfd.setVnfcList(vnfcList); - List<Vnfd> vnfdList = new ArrayList<>(); vnfdList.add(vnfd); @@ -82,9 +133,11 @@ public class InstantiateOperatorProgressorTest { private Vnfc createVnfc() { Vnfc vnfc = new Vnfc(); + vnfc.setVnfcId(VNFC_ID); vnfc.setType(VNFC_TYPE); vnfc.setResourceTemplateId(RESOURCE_TEMPLATE_ID); vnfc.setVduId(VDU_ID); + vnfc.setGrantResourceId(RESOURCE_DEFINITION_ID); return vnfc; } @@ -96,4 +149,10 @@ public class InstantiateOperatorProgressorTest { return subscriptionService; } + private org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201 createInlineResponse201() { + org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201 inlineResponse201 = + new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201(); + inlineResponse201.setVnfdId(VNF_ID); + return inlineResponse201; + } } |