summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-flows/src/test/java
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-06-05 16:24:37 -0400
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-06-06 11:26:38 -0400
commit560e84158798cb884de65e3cf33ab657f0e6e6df (patch)
tree83a5aedb750eed64fcff623742bebc63a2a07161 /bpmn/so-bpmn-infrastructure-flows/src/test/java
parent5f4c4f3f3215eb136f9c4f84f51dc8fcd5fe0353 (diff)
parent59eff996497691e0fc82b627dcda306e861655b3 (diff)
Merge remote-tracking branch 'origin/dublin' into 'origin/master'
Change-Id: I551ea3f29a76dc99532455ea4d7e84a316f9bf38 Issue-ID: SO-1980 Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src/test/java')
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java73
1 files changed, 36 insertions, 37 deletions
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 f51ea006d2..5b095a9983 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
@@ -27,13 +27,12 @@ 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 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 com.google.protobuf.Struct;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
-import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Ignore;
@@ -47,17 +46,19 @@ 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 createVcpeResCustService_Simplified.bpmn workflow.
*/
-@Ignore
public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
- private static final long WORKFLOW_WAIT_TIME = 1000L;
private Logger logger = LoggerFactory.getLogger(getClass());
+ private static final long WORKFLOW_WAIT_TIME = 1000L;
+ private static final int DMAAP_DELAY_TIME_MS = 2000;
+
private static final String TEST_PROCESSINSTANCE_KEY = "CreateVcpeResCustService_simplified";
private String testBusinessKey;
@@ -103,6 +104,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
+ @Ignore
@Test
public void workflow_validInput_expectedOuput() throws InterruptedException {
@@ -113,17 +115,9 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
ProcessInstance pi =
runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
- assertThat(pi).isNotNull();
-
- Thread.sleep(WORKFLOW_WAIT_TIME);
-
- Execution execution = runtimeService.createExecutionQuery().processInstanceBusinessKey(testBusinessKey)
- .messageEventSubscriptionName("WorkflowMessage").singleResult();
-
- assertThat(execution).isNotNull();
int waitCount = 10;
- while (!pi.isEnded() && waitCount >= 0) {
+ while (!isProcessInstanceEnded() && waitCount >= 0) {
Thread.sleep(WORKFLOW_WAIT_TIME);
waitCount--;
}
@@ -145,6 +139,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
}
}
+ private boolean isProcessInstanceEnded() {
+ return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY)
+ .singleResult() == null;
+ }
+
private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
logger.info("Checking the configAssign request");
@@ -154,26 +153,26 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* the fields of actionIdentifiers should match the one in the
* response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
- assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
- assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
- assertThat(actionIdentifiers.getActionName()).matches("config-assign");
- assertThat(actionIdentifiers.getMode()).matches("sync");
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo("config-assign");
+ assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
- assertThat(commonHeader.getOriginatorId()).matches("SO");
- assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
Struct payload = executionServiceInput.getPayload();
Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
- assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
- .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
- .matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
}
private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
@@ -185,32 +184,32 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
* the fields of actionIdentifiers should match the one in the
* response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
*/
- assertThat(actionIdentifiers.getBlueprintName()).matches("test_configuration_restconf");
- assertThat(actionIdentifiers.getBlueprintVersion()).matches("1.0.0");
- assertThat(actionIdentifiers.getActionName()).matches("config-deploy");
- assertThat(actionIdentifiers.getMode()).matches("async");
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_configuration_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo("config-deploy");
+ assertThat(actionIdentifiers.getMode()).isEqualTo("async");
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
- assertThat(commonHeader.getOriginatorId()).matches("SO");
- assertThat(commonHeader.getRequestId()).matches(msoRequestId);
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
Struct payload = executionServiceInput.getPayload();
Struct requeststruct = payload.getFieldsOrThrow("config-deploy-request").getStructValue();
- assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).matches("PNFDemo");
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-deploy-properties").getStructValue();
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).matches("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
- .matches("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ .isEqualTo("f2daaac6-5017-4e1e-96c8-6a27dfbe1421");
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
- .matches("68dc9a92-214c-11e7-93ae-92361f002680");
+ .isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
/**
* IP addresses match the OAM ip addresses from AAI.
*/
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).matches("1.1.1.1");
- assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).matches("::/128");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128");
}
/**
@@ -223,8 +222,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
/**
* Get the events from PNF topic
*/
- wireMockServer
- .stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*")).willReturn(okJson(pnfResponse)));
+ wireMockServer.stubFor(get(urlPathMatching("/events/pnfReady/consumerGroup.*"))
+ .willReturn(okJson(pnfResponse).withFixedDelay(DMAAP_DELAY_TIME_MS)));
}
private void mockAai() {