diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-04 11:21:02 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-08 22:33:28 -0400 |
commit | 69455a268648881f4b5a0c4547d769c2e6ecc2c1 (patch) | |
tree | 8ea753e5282e91316d842522c8873fd51572344c /bpmn/MSOCommonBPMN/src/test | |
parent | 3e9ee0977d0c8643f81e720bbf23e5a40864a0d8 (diff) |
added generic fabric support to SO
Fix Autoincrement of ID field in table
Fix accidental removal of method
Update usage of requestdb client
removed unused imports in common tasks and test
Fix broken branch, have unit tests pass
references
the Epic branch
Fix broken branch from compiling
committing classpath for vfc adapter cause its not going away
added in the fail case for when there are no profiles
removed second set of adapters in application test yml
removed double adapters in request db application test
added jpa repo dependency to the so bpmn folder pom
add creation timestamp column to the table
added in null checks for Config returned from policy
switched to string in requestprocess with jenerate
switched to string in requestprocess with jenerate
updated aai version in common pom to 605 from 591
renamed the db scripts for flyway sync to register
added endpoint to application test yml for failing test
...
Change-Id: I800f837ea75d7cdff740dc3a387e4d7654cfd085
Issue-ID: SO-972
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
14 files changed, 216 insertions, 28 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java index d2f1186ad0..119d3b1e2d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java @@ -32,6 +32,7 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.model.bpmn.Bpmn; import org.camunda.bpm.model.bpmn.BpmnModelInstance; import org.junit.Before; +import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.MockLoggerDelegate; @@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.test.categories.SpringAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.embedded.LocalServerPort; @@ -62,6 +64,7 @@ import com.github.tomakehurst.wiremock.client.WireMock; @ActiveProfiles("test") @ContextConfiguration @AutoConfigureWireMock(port = 0) +@Category(SpringAware.class) public abstract class BaseTest extends BuildingBlockTestDataSetup { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index a983193ca3..5be879560f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -665,4 +665,27 @@ public class BuildingBlockTestDataSetup{ return ar; } + + public Configuration setConfiguration () { + Configuration config = new Configuration(); + config.setConfigurationId("testConfigurationId"); + ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration(); + modelInfoConfig.setModelCustomizationId("modelCustomizationId"); + modelInfoConfig.setModelVersionId("modelVersionId"); + modelInfoConfig.setModelInvariantId("modelInvariantId"); + modelInfoConfig.setPolicyName("policyName"); + config.setModelInfoConfiguration(modelInfoConfig); + + List<Configuration> configurations = new ArrayList<>(); + configurations.add(config); + ServiceInstance serviceInstance = new ServiceInstance(); + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId"); + serviceInstance.setConfigurations(configurations); + return config; + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java new file mode 100644 index 0000000000..ee2848cf3a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import org.junit.runner.RunWith; +import org.onap.so.test.categories.SpringAware; + +import com.googlecode.junittoolbox.ExcludeCategories; +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@ExcludeCategories({SpringAware.class}) +@SuiteClasses({"**/*Test.class", "!**/bpmn/common/scripts/**/*Test.class"}) +public class NonSpringSuite { + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java index ba8caee058..d1559c2ed1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java @@ -22,8 +22,6 @@ package org.onap.so; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @@ -35,9 +33,7 @@ import org.springframework.context.annotation.Profile; @Profile("test") @EnableProcessApplication("MSO CommonBPMN Test Application") @ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class TestApplication { public static void main(String... args) { SpringApplication.run(TestApplication.class, args); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java index 514d93bdf8..45bbe9e5d8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java @@ -29,9 +29,7 @@ import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -51,9 +49,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EnableProcessApplication("MSO Common Application") @EnableAsync @ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class MSOCommonApplication { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java new file mode 100644 index 0000000000..f84a76468f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.baseclient; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + +import java.util.Map; + +import javax.ws.rs.core.UriBuilder; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.springframework.core.ParameterizedTypeReference; + +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; + +import wiremock.org.apache.http.entity.ContentType; + + +public class BaseClientTest extends BaseTest { + + @Test + public void verifyString() { + BaseClient<String, String> client = new BaseClient<>(); + String response = "{\"hello\" : \"world\"}"; + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString()); + stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + + String result = client.get("", new ParameterizedTypeReference<String>() {}); + assertThat(result, equalTo(response)); + } + + @Test + public void verifyMap() { + BaseClient<String, Map<String, Object>> client = new BaseClient<>(); + String response = "{\"hello\" : \"world\"}"; + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString()); + stubFor(get(urlEqualTo("/test")) + .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + + Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {}); + assertThat("world", equalTo(result.get("hello"))); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index c18dcf5cfa..33e1390b9c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -65,12 +65,15 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.VnfcCustomization; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -613,17 +616,23 @@ public class BBInputSetupMapperLayerTest { String modelCustUUID = "modelCustomizationUUID"; String modelInvariantUUID = "modelInvariantUUID"; String modelVersionUUID = "modelUUID"; + String policyName = "policyName"; ModelInfoConfiguration expected = new ModelInfoConfiguration(); expected.setModelCustomizationId(modelCustUUID); expected.setModelInvariantId(modelInvariantUUID); expected.setModelVersionId(modelVersionUUID); + expected.setPolicyName(policyName); ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization(); configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID); configurationResourceCustomization.setConfigurationResource(new ConfigurationResource()); configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID); configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID); + VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization(); + policyNameTable.setCvnfcCustomization(new CvnfcCustomization()); + policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization()); + policyNameTable.setPolicyName(policyName); - ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization ); + ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable); assertThat(actual, sameBeanAs(expected)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 489163b23a..a5795f923c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -66,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -1074,28 +1075,32 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); String bbName = AssignFlows.FABRIC_CONFIGURATION.toString(); + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); - doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName); - verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service); + instanceName, configResourceKeys); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null); SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName); - verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service); + instanceName, configResourceKeys); + verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); instanceName = "configurationName2"; resourceId = "resourceId2"; lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2"); Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId); doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId); - doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys); SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName); - verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service); + instanceName, configResourceKeys); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys); } @Test @@ -1666,6 +1671,12 @@ public class BBInputSetupTest { String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; + + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); + executeBB.setConfigurationResourceKeys(configResourceKeys); doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); @@ -1714,13 +1725,13 @@ public class BBInputSetupTest { doReturn(configurationCustList).when(service).getConfigurationCustomizations(); configurationCustList.add(configurationCust); doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class)); executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class)); } @Test @@ -1998,6 +2009,13 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); + executeBB.setConfigurationResourceKeys(configResourceKeys); + String resourceId = "123"; String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); @@ -2037,6 +2055,7 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString()); executeBB.getBuildingBlock().setKey("modelCustId"); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class)); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service); @@ -2167,6 +2186,12 @@ public class BBInputSetupTest { cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); String requestAction = "unassignInstance"; + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); + executeBB.setConfigurationResourceKeys(configResourceKeys); + L3Network network = new L3Network(); network.setNetworkId("networkId"); gBB.getServiceInstance().getNetworks().add(network); @@ -2241,13 +2266,14 @@ public class BBInputSetupTest { org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration(); aaiConfiguration.setModelCustomizationId("modelCustId"); doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId()); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class)); executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class), - any(Service.class)); + any(Service.class), isA(ConfigurationResourceKeys.class)); } @Test diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index aa883b67a2..eb74ab804e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -64,12 +64,13 @@ import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.db.request.RequestsDbClient; + import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 79cb33b7c4..2144f1c69a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -20,12 +20,18 @@ package org.onap.so.bpmn.servicedecomposition.tasks; +import static org.hamcrest.CoreMatchers.any; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; import org.junit.Test; import org.onap.so.bpmn.core.WorkflowException; @@ -76,8 +82,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { @Test public void setRetryTimerExceptionTest() { expectedException.expect(BpmnError.class); - - executeBuildingBlockRainyDay.setRetryTimer(null); + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(eq("retryCount"))).thenThrow(Exception.class); + executeBuildingBlockRainyDay.setRetryTimer(execution); } @Test diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java index 0992b59267..47e05831ad 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java @@ -34,7 +34,7 @@ public class GlobalDmaapPublisherTest extends BaseTest{ @Test public void testGetters() { assertEquals("dmaapUsername", globalDmaapPublisher.getUserName()); - assertEquals("dmaapPassword", globalDmaapPublisher.getPassword()); + assertEquals("ZG1hYXBQYXNzd29yZA==", globalDmaapPublisher.getPassword()); assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic()); assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get()); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java new file mode 100644 index 0000000000..21035fcd4d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.test.categories; + +public interface SpringAware { + /* category marker */ +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml index f039441738..236d435cb7 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -162,7 +162,7 @@ mso: global: dmaap: username: dmaapUsername - password: dmaapPassword + password: ZG1hYXBQYXNzd29yZA== host: http://localhost:${wiremock.server.port} publisher: topic: com.att.mso.asyncStatusUpdate diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml index d8f6ba3930..9088d1a844 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml @@ -25,6 +25,6 @@ <appender-ref ref="STDOUT" /> </root> - <logger name="wiremock.org" level="DEBUG" /> + <logger name="wiremock.org" level="ERROR" /> </configuration>
\ No newline at end of file |