diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src/test')
6 files changed, 78 insertions, 63 deletions
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java index 9521e68e16..7aaf558901 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java @@ -100,4 +100,8 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase { return this.detailedMessages; } + public void resetList() { + detailedMessages.clear(); + } + } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index a03da25248..786ee1e239 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -49,7 +49,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.ok; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; /** diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java index b9c5fdf145..cd54c49671 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSWUPDownloadTest.java @@ -20,11 +20,24 @@ package org.onap.so.bpmn.infrastructure.process; -import com.google.protobuf.Struct; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.okJson; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.assertj.core.api.Assertions; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Before; import org.junit.Test; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; @@ -32,21 +45,10 @@ import org.onap.so.BaseBPMNTest; import org.onap.so.GrpcNettyServer; import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.aaiclient.client.aai.AAIVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import static com.github.tomakehurst.wiremock.client.WireMock.okJson; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import com.google.protobuf.Struct; /** * Basic Integration test for GenericPnfSWUPDownloadTest.bpmn workflow. @@ -100,6 +102,7 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { mockCatalogDb(); mockAai(); + grpcNettyServer.resetList(); final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -117,12 +120,12 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao", + assertThat(pi).isStarted().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao", "ExclusiveGateway_1rj84ne", "ServiceTask_0yavde3", "ExclusiveGateway_1ja7grm", "ServiceTask_1wxo7xz", "ExclusiveGateway_08lusga", "download_EndEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 3); + assertEquals(3, detailedMessages.size()); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -138,7 +141,7 @@ public class GenericPnfSWUPDownloadTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSWUPDownload request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); } private boolean isProcessInstanceEnded() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java index de81f91e66..1c00f3628d 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java @@ -46,7 +46,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; /** * Basic Integration test for GenericPnfSoftwareUpgrade.bpmn workflow. @@ -120,13 +123,13 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { } // Layout is to reflect the bpmn visual layout - assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", + assertThat(pi).isStarted().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 4); + assertEquals(4, detailedMessages.size()); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -142,7 +145,8 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSoftwareUpgrade request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); + grpcNettyServer.resetList(); } private boolean isProcessInstanceEnded() { @@ -159,27 +163,26 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { * the fields of actionIdentifiers should match the one in the * response/GenericPnfSoftwareUpgrade_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_software_upgrade_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); - assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()) - .isEqualTo("demo-sw-ver2.0.0"); + assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); + assertEquals("demo-sw-ver2.0.0", propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java index 2423ad8465..bc364ae736 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java @@ -41,7 +41,9 @@ import java.util.Map; import java.util.UUID; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * Basic Integration test for GenericPnfHealthCheck.bpmn workflow. @@ -118,7 +120,7 @@ public class PnfHealthCheckTest extends BaseBPMNTest { List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); logger.debug("Size of detailedMessage is {}", detailedMessages.size()); - assertThat(detailedMessages.size() == 1).isTrue(); + assertTrue(detailedMessages.size() == 1); int count = 0; try { for (ExecutionServiceInput eSI : detailedMessages) { @@ -132,7 +134,7 @@ public class PnfHealthCheckTest extends BaseBPMNTest { e.printStackTrace(); fail("PNFHealthCheck request exception", e); } - assertThat(count == 1).isTrue(); + assertTrue(count == 1); } private boolean isProcessInstanceEnded() { @@ -148,25 +150,25 @@ public class PnfHealthCheckTest extends BaseBPMNTest { /** * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_health_check_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_health_check_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo"); + assertEquals("PNFDemo", requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo"); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals("PNFDemo", propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("32daaac6-5017-4e1e-96c8-6a27dfbe1421", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); } private void mockAai() { diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java index 7da3a2c81b..60c7e4e769 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java @@ -26,8 +26,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.assertj.core.api.Assertions.fail; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import com.google.protobuf.Struct; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -47,6 +48,7 @@ import org.onap.so.bpmn.mock.FileUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.google.protobuf.Struct; /** * Basic Integration test for ServiceLevelUpgrade.bpmn workflow. @@ -125,6 +127,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { mockCatalogDb(); mockRequestDb(); mockAai(); + grpcNettyServer.resetList(); final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -148,7 +151,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { "Gateway_1vq11i7", "Activity_0o2rrag", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); - assertThat(detailedMessages.size() == 5); + assertEquals(10, detailedMessages.size()); int count = 0; String action = ""; try { @@ -164,7 +167,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { e.printStackTrace(); fail("GenericPnfSoftwareUpgrade request exception", e); } - assertThat(count == actionNames.length); + assertTrue(count == actionNames.length); } private boolean isProcessInstanceEnded() { @@ -181,25 +184,25 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { /** * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json. */ - assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf"); - assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0"); - assertThat(actionIdentifiers.getActionName()).isEqualTo(action); - assertThat(actionIdentifiers.getMode()).isEqualTo("async"); + assertEquals("test_pnf_software_upgrade_restconf", actionIdentifiers.getBlueprintName()); + assertEquals("1.0.0", actionIdentifiers.getBlueprintVersion()); + assertEquals(action, actionIdentifiers.getActionName()); + assertEquals("async", actionIdentifiers.getMode()); CommonHeader commonHeader = executionServiceInput.getCommonHeader(); - assertThat(commonHeader.getOriginatorId()).isEqualTo("SO"); + assertEquals("SO", commonHeader.getOriginatorId()); Struct payload = executionServiceInput.getPayload(); Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue(); - assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo(pnfName); + assertEquals(pnfName, requeststruct.getFieldsOrThrow("resolution-key").getStringValue()); Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue(); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(pnfName); - assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()) - .isEqualTo("d88da85c-d9e8-4f73-b837-3a72a431622b"); - assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()) - .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680"); + assertEquals(pnfName, propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()); + assertEquals("d88da85c-d9e8-4f73-b837-3a72a431622b", + propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()); + assertEquals("38dc9a92-214c-11e7-93ae-92361f002680", + propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue()); } private void mockAai() { |