From f425fb64b8aed42078df431862d10ab00c10a7cc Mon Sep 17 00:00:00 2001 From: hemantt Date: Mon, 3 Jul 2023 20:15:09 +0100 Subject: [PATCH 1/4] initial functional test commit --- .vscode/settings.json | 4 + build.gradle | 28 ++- .../controllers/SampleFunctionalTest.java | 0 .../application-functional-test.yaml | 0 .../java/functions/XMLFunctions.java | 23 +++ .../ValidGetBulkFeedback.java.txt | 53 ++++++ .../java/steps/ClaimStatusSteps.java | 85 +++++++++ .../java/submitBulk/ClaimStatusUpdate.java | 65 +++++++ .../java/submitBulk/IssueWarrant.java | 179 ++++++++++++++++++ .../java/submitBulk/MCOLJudgement.java | 151 +++++++++++++++ .../resources/awaitingDataResponseSample.xml | 0 .../resources/breathingSpace.xml | 26 +++ .../resources/claimOneDefendent.xml | 58 ++++++ .../resources/combinedJudgementWarranty.xml | 131 +++++++++++++ .../resources/getBulkFeedback.xml | 11 ++ src/functionalTest/resources/judgement.xml | 106 +++++++++++ .../resources/sampleSubmitBulk.xml | 27 +++ src/functionalTest/resources/statusUpdate.xml | 21 ++ src/functionalTest/resources/submitQuery.xml | 20 ++ src/functionalTest/resources/warrant.xml | 42 ++++ 20 files changed, 1029 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json rename src/{functionalTest => funcTest}/java/uk/gov/hmcts/reform/controllers/SampleFunctionalTest.java (100%) rename src/{functionalTest => funcTest}/resources/application-functional-test.yaml (100%) create mode 100644 src/functionalTest/java/functions/XMLFunctions.java create mode 100644 src/functionalTest/java/getBulkFeedback/ValidGetBulkFeedback.java.txt create mode 100644 src/functionalTest/java/steps/ClaimStatusSteps.java create mode 100644 src/functionalTest/java/submitBulk/ClaimStatusUpdate.java create mode 100644 src/functionalTest/java/submitBulk/IssueWarrant.java create mode 100644 src/functionalTest/java/submitBulk/MCOLJudgement.java create mode 100644 src/functionalTest/resources/awaitingDataResponseSample.xml create mode 100644 src/functionalTest/resources/breathingSpace.xml create mode 100644 src/functionalTest/resources/claimOneDefendent.xml create mode 100644 src/functionalTest/resources/combinedJudgementWarranty.xml create mode 100644 src/functionalTest/resources/getBulkFeedback.xml create mode 100644 src/functionalTest/resources/judgement.xml create mode 100644 src/functionalTest/resources/sampleSubmitBulk.xml create mode 100755 src/functionalTest/resources/statusUpdate.xml create mode 100644 src/functionalTest/resources/submitQuery.xml create mode 100644 src/functionalTest/resources/warrant.xml diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..e01206508 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.compile.nullAnalysis.mode": "automatic", + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index aff9b6718..481c5362d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'se.patrikerdes.use-latest-versions' version '0.2.7' - + id("net.serenity-bdd.serenity-gradle-plugin") version "3.7.0" id 'application' id 'checkstyle' id 'jacoco' @@ -18,8 +18,16 @@ plugins { id "org.jetbrains.gradle.plugin.idea-ext" version "0.7" } +defaultTasks 'clean','test','aggregate' + group = 'uk.gov.hmcts.civil.sdt' version = '0.0.1' +sourceCompatibility = '11' +targetCompatibility = '11' + +repositories { + mavenCentral() +} java { toolchain { @@ -221,6 +229,14 @@ allprojects { apply plugin: 'java' dependencies { + implementation 'org.apache.xmlbeans:xmlbeans:3.1.0' + testImplementation 'net.serenity-bdd:serenity-core:3.2.0' + testImplementation 'net.serenity-bdd:serenity-junit:3.2.0' + testImplementation 'io.rest-assured:rest-assured:4.4.0' + implementation 'io.rest-assured:json-path:4.4.0' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' + testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.2' annotationProcessor 'org.mapstruct:mapstruct-processor:1.3.1.Final', 'org.projectlombok:lombok-mapstruct-binding:0.2.0' annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.10' @@ -370,6 +386,10 @@ allprojects { testImplementation group: 'com.github.hmcts.civil-sdt-common', name: 'producers-api', version: sdtCommonVersion, classifier: 'test' } + serenity { + reports = ["single-page-html"] + } + configurations.configureEach { collect { configuration -> configuration.exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j' @@ -558,6 +578,8 @@ subprojects { subproject -> generateCucumberReports.enabled = false useJUnitPlatform() + testLogging.showStandardStreams = true + systemProperties System.getProperties() testLogging { events "passed", "skipped", "failed" } @@ -744,3 +766,7 @@ cucumberReports { outputDir = file("${rootDir}/target/cucumber") reports = files("${rootDir}/target/cucumber.json") } + +gradle.startParameter.continueOnFailure = true + +test.finalizedBy(aggregate) diff --git a/src/functionalTest/java/uk/gov/hmcts/reform/controllers/SampleFunctionalTest.java b/src/funcTest/java/uk/gov/hmcts/reform/controllers/SampleFunctionalTest.java similarity index 100% rename from src/functionalTest/java/uk/gov/hmcts/reform/controllers/SampleFunctionalTest.java rename to src/funcTest/java/uk/gov/hmcts/reform/controllers/SampleFunctionalTest.java diff --git a/src/functionalTest/resources/application-functional-test.yaml b/src/funcTest/resources/application-functional-test.yaml similarity index 100% rename from src/functionalTest/resources/application-functional-test.yaml rename to src/funcTest/resources/application-functional-test.yaml diff --git a/src/functionalTest/java/functions/XMLFunctions.java b/src/functionalTest/java/functions/XMLFunctions.java new file mode 100644 index 000000000..e64a9ce36 --- /dev/null +++ b/src/functionalTest/java/functions/XMLFunctions.java @@ -0,0 +1,23 @@ +package functions; + +import io.restassured.response.Response; + +public class XMLFunctions { + +public String removeNamespaces(String xmlResponse) { + return xmlResponse.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "") + .replaceAll("(<)(\\w+:)(.*?>)", "$1$3") + .replaceAll("()", "$1$3"); +} + +public String getCleanResponse(Response response) { + String xmlResponse = response.asString(); + xmlResponse = removeNamespaces(xmlResponse); + return xmlResponse; +} + +public int generateRandomNumber(){ + final int randomNumber = (int)(Math.random() * 10000); + return randomNumber; +} +} \ No newline at end of file diff --git a/src/functionalTest/java/getBulkFeedback/ValidGetBulkFeedback.java.txt b/src/functionalTest/java/getBulkFeedback/ValidGetBulkFeedback.java.txt new file mode 100644 index 000000000..57bdb6efa --- /dev/null +++ b/src/functionalTest/java/getBulkFeedback/ValidGetBulkFeedback.java.txt @@ -0,0 +1,53 @@ +import io.restassured.RestAssured; +import io.restassured.response.Response; +import net.serenitybdd.junit.runners.SerenityRunner; +//import net.serenitybdd.SerenityJUnit5Extension.runners.SerenityRunner; + +import net.thucydides.core.annotations.Step; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import java.io.File; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.containsString; + +@RunWith(SerenityRunner.class) +public class ValidGetBulkFeedback{ + + @Step("Given the soap request body") + public File soapRequestBody() { + return new File(getClass().getClassLoader().getResource("getBulkFeedback.xml").getFile()); + } + + @Step("When we send the soap request and get the response") + public Response soapResponse(File file) { + Response response = RestAssured + .given() + .baseUri("http://civil-sdt-demo.service.core-compute-demo.internal") + .basePath("/producers/service/sdtapi") + .header("Content-Type", "application/soap+xml;charset=UTF-8") + //.header("Content-Length", "1356") + .body(file) + .post(); + return response; + } + + @Step("Then the status code should be 200") + public void checkStatusCode(Response response) { + response.then().statusCode(200); + response.prettyPrint(); + } + + // @Test + // public void getBulkFeedback() { + // File file = soapRequestBody(); + // Response response = soapResponse(file); + // checkStatusCode(response); + // String xPathResult = response.xmlPath().get("html.head.title"); + // //String title = doc.getString("html.head.title"); + // //var result = Integer.parseInt(String.valueOf(xPathResult)); + // assertThat(xPathResult, containsString("502 Bad Gateway")); + + // } +} diff --git a/src/functionalTest/java/steps/ClaimStatusSteps.java b/src/functionalTest/java/steps/ClaimStatusSteps.java new file mode 100644 index 000000000..1985e9dcc --- /dev/null +++ b/src/functionalTest/java/steps/ClaimStatusSteps.java @@ -0,0 +1,85 @@ +package steps; + +import net.thucydides.core.annotations.Step; +import io.restassured.RestAssured; +import io.restassured.response.Response; + +import java.nio.file.Files; +import java.nio.file.Paths; + + +public class ClaimStatusSteps { + + private String xml; + private Response response; + private int randomNumber; + + @Step("Given the soap request body") + public String soapRequestBody() { + String xmlContent = ""; + try { + xmlContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("statusUpdate.xml").toURI()))); + } catch (Exception e) { + e.printStackTrace(); + } + + randomNumber = (int)(Math.random() * 10000); // Generate a random number + xmlContent = xmlContent.replace("RANDOM_NUMBER", Integer.toString(randomNumber)); // Replace the token + + return xmlContent; + } + + @Step("When we send the soap request and get the response") + public Response soapResponse(String xml) { + Response response = RestAssured + .given() + .baseUri("http://civil-sdt-demo.service.core-compute-demo.internal") + .basePath("/producers/service/sdtapi") + .header("Content-Type", "application/soap+xml;charset=UTF-8") + .body(xml) + .post(); + return response; + } + + @Step("Then the status code should be 200") + public void checkStatusCode(Response response) { + response.then().statusCode(200); + response.prettyPrint(); + } + + public String removeNamespaces(String xmlResponse) { + return xmlResponse.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "") + .replaceAll("(<)(\\w+:)(.*?>)", "$1$3") + .replaceAll("()", "$1$3"); + } + + public String getCleanResponse() { + String xmlResponse = response.asString(); + xmlResponse = removeNamespaces(xmlResponse); + return xmlResponse; + } + + public String getXml() { + return xml; + } + + public void setXml(String xml) { + this.xml = xml; + } + + public Response getResponse() { + return response; + } + + public void setResponse(Response response) { + this.response = response; + } + + public int getRandomNumber() { + return randomNumber; + } + + public void setRandomNumber(int randomNumber) { + this.randomNumber = randomNumber; + } +} diff --git a/src/functionalTest/java/submitBulk/ClaimStatusUpdate.java b/src/functionalTest/java/submitBulk/ClaimStatusUpdate.java new file mode 100644 index 000000000..0c0712a6b --- /dev/null +++ b/src/functionalTest/java/submitBulk/ClaimStatusUpdate.java @@ -0,0 +1,65 @@ +import net.serenitybdd.junit.runners.SerenityRunner; +import net.thucydides.core.annotations.Steps; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import io.restassured.path.xml.XmlPath; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.matchesRegex; +import static org.hamcrest.CoreMatchers.containsString; +import org.junit.jupiter.api.Assertions; +import steps.ClaimStatusSteps; + + +@RunWith(SerenityRunner.class) +public class ClaimStatusUpdate { + + @Steps + ClaimStatusSteps claimStatusSteps; + + @Before + public void setUp() { + claimStatusSteps.setXml(claimStatusSteps.soapRequestBody()); + claimStatusSteps.setResponse(claimStatusSteps.soapResponse(claimStatusSteps.getXml())); +} + + @Test + public void claimStatusUpdateResponseCode() { + XmlPath xmlPath = new XmlPath(claimStatusSteps.getCleanResponse()).setRoot("Envelope.Body.bulkResponse"); + String xmlResponseCode = xmlPath.getString("status.@code"); + + assertThat(xmlResponseCode, equalTo("Ok")); + Assertions.assertEquals(200, claimStatusSteps.getResponse().getStatusCode()); + + } + + @Test + public void validateCustRefClaimStatusUpdate() { + XmlPath xmlPath = new XmlPath(claimStatusSteps.getCleanResponse()).setRoot("Envelope.Body.bulkResponse"); + String customerReference = xmlPath.getString("customerReference"); + + assertThat(customerReference, equalTo(Integer.toString(claimStatusSteps.getRandomNumber()))); + } + + @Test + public void validateSDTBulkRefClaimStatusUpdate() { + XmlPath xmlPath = new XmlPath(claimStatusSteps.getCleanResponse()).setRoot("Envelope.Body.bulkResponse"); + String sdtBulkReference = xmlPath.getString("sdtBulkReference"); + + assertThat(sdtBulkReference, matchesRegex("MCOL-\\d+-\\d+")); + } + + @Test + public void claimStatusUpdateResponseStructure() { + claimStatusSteps.checkStatusCode(claimStatusSteps.getResponse()); + + String xmlResponse = claimStatusSteps.getCleanResponse(); + + assertThat(xmlResponse, containsString("status")); + assertThat(xmlResponse, containsString("customerReference")); + assertThat(xmlResponse, containsString("code")); + assertThat(xmlResponse, containsString("sdtBulkReference")); + } +} diff --git a/src/functionalTest/java/submitBulk/IssueWarrant.java b/src/functionalTest/java/submitBulk/IssueWarrant.java new file mode 100644 index 000000000..017e36a6b --- /dev/null +++ b/src/functionalTest/java/submitBulk/IssueWarrant.java @@ -0,0 +1,179 @@ + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import net.serenitybdd.junit.runners.SerenityRunner; + +import net.thucydides.core.annotations.Step; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import java.io.File; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.CoreMatchers.containsString; +import io.restassured.path.xml.XmlPath; +import org.junit.jupiter.api.Assertions; +import java.nio.file.Files; +import java.nio.file.Paths; +import static org.hamcrest.Matchers.matchesRegex; +import functions.XMLFunctions; + + +import static org.junit.jupiter.api.Assertions.assertEquals; + + +@RunWith(SerenityRunner.class) +public class IssueWarrant { + + private String xml; + private Response response; + private int randomNumber; + String custId = "10000002"; + String requestCount = "1"; + private String custIDInvalidErrorCode = "CUST_ID_INVALID"; + private String sdtBulkReferenceRegex = "MCOL-\\d+-\\d+"; + private String custIDInvalidDesc = "The Bulk Customer organisation does not have an SDT Customer ID set up"; + private String requestCountErrorCode = "REQ_COUNT_MISMATCH"; + private String requestCountErrorDesc = "Unexpected Total Number of Requests identified"; + XMLFunctions XMLFunctions = new XMLFunctions(); + + @Step("Given the soap request body") + public String soapRequestBody() { + String xmlContent = ""; + try { + xmlContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("warrant.xml").toURI()))); + } catch (Exception e) { + e.printStackTrace(); + } + + randomNumber = XMLFunctions.generateRandomNumber(); + xmlContent = xmlContent.replace("RANDOM_NUMBER", Integer.toString(randomNumber)); + xmlContent = xmlContent.replace("CUSTOMER_ID",custId); + xmlContent = xmlContent.replace("REQUEST_COUNT",requestCount); + return xmlContent; + } + + @Before + public void setUp() { + this.xml = soapRequestBody(); + this.response = soapResponse(xml); + } + + @Step("When we send the soap request and get the response") + public Response soapResponse(String xml) { + Response response = RestAssured + .given() + .baseUri("http://civil-sdt-demo.service.core-compute-demo.internal") + .basePath("/producers/service/sdtapi") + .header("Content-Type", "application/soap+xml;charset=UTF-8") + .body(xml) + .post(); + return response; + } + + @Step("Then the status code should be 200") + public void checkStatusCode(Response response) { + response.then().statusCode(200); + response.prettyPrint(); + } + + @Test + public void issueWarrantResponseCode() { + + XmlPath xmlPath = new XmlPath(XMLFunctions.getCleanResponse(response)).setRoot("Envelope.Body.bulkResponse"); + String xmlResponseCode = xmlPath.getString("status.@code"); + String customerReference = xmlPath.getString("customerReference"); + String sdtBulkReference = xmlPath.getString("sdtBulkReference"); + String submittedDate = xmlPath.getString("submittedDate"); + String sdtService = xmlPath.getString("sdtService"); + String requestCount = xmlPath.getString("requestCount"); + int statusCode = response.getStatusCode(); + + System.out.println("xmlResponseCode: " + xmlResponseCode); + System.out.println("Customer Reference: " + customerReference); + System.out.println("SDT Bulk Reference: " + sdtBulkReference); + System.out.println("Submitted Date: " + submittedDate); + System.out.println("SDT Service: " + sdtService); + System.out.println("Request Count: " + requestCount); + + assertThat(xmlResponseCode, equalTo("Ok")); + Assertions.assertEquals(200, statusCode); + + } + + @Test + public void validateCustRefIssueWarrant() { + + XmlPath xmlPath = new XmlPath(XMLFunctions.getCleanResponse(response)).setRoot("Envelope.Body.bulkResponse"); + String customerReference = xmlPath.getString("customerReference"); + + assertThat(customerReference, equalTo(Integer.toString(randomNumber))); + + } + + @Test + public void validateSDTBulkRefIssueWarrant() { + + XmlPath xmlPath = new XmlPath(XMLFunctions.getCleanResponse(response)).setRoot("Envelope.Body.bulkResponse"); + String sdtBulkReference = xmlPath.getString("sdtBulkReference"); + + assertThat(sdtBulkReference, matchesRegex(sdtBulkReferenceRegex)); + } + + @Test + public void validateCustID() { + + custId = "12345678"; + setUp(); + + XmlPath xmlPath = new XmlPath(XMLFunctions.getCleanResponse(response)).setRoot("Envelope.Body.bulkResponse"); + String errorCode = xmlPath.getString("status.error.code"); + String errorDescription = xmlPath.getString("status.error.description"); + + assertThat(errorCode, equalTo(custIDInvalidErrorCode)); + assertThat(errorDescription, containsString(custIDInvalidDesc)); + + } + + @Test + public void validateRequestCount() { + + requestCount = "2"; + setUp(); + + XmlPath xmlPath = new XmlPath(XMLFunctions.getCleanResponse(response)).setRoot("Envelope.Body.bulkResponse"); + String errorCode = xmlPath.getString("status.error.code"); + String errorDescription = xmlPath.getString("status.error.description"); + + assertThat(errorCode, equalTo(requestCountErrorCode)); + assertThat(errorDescription, containsString(requestCountErrorDesc)); + + } + + // @Test + // public void issueWarrantResponseDescription() { + + // checkStatusCode(response); + + // String xmlResponse = response.asString(); + // xmlResponse = removeNamespaces(xmlResponse); + + // XmlPath xmlPath = new XmlPath(xmlResponse).setRoot("Envelope.Body.bulkResponse.status.error"); + // String errorDescription = xmlPath.getString("description"); + + // assertThat(errorDescription, containsString("Duplicate User File Reference 91 supplied")); + // } + + @Test + public void issueWarrantResponseStructure() { + checkStatusCode(response); + + String xmlResponse = response.asString(); + xmlResponse = XMLFunctions.removeNamespaces(xmlResponse); + + assertThat(xmlResponse, containsString("status")); + assertThat(xmlResponse, containsString("customerReference")); + assertThat(xmlResponse, containsString("code")); + assertThat(xmlResponse, containsString("sdtBulkReference")); + } +} diff --git a/src/functionalTest/java/submitBulk/MCOLJudgement.java b/src/functionalTest/java/submitBulk/MCOLJudgement.java new file mode 100644 index 000000000..fc475fc4f --- /dev/null +++ b/src/functionalTest/java/submitBulk/MCOLJudgement.java @@ -0,0 +1,151 @@ + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import net.serenitybdd.junit.runners.SerenityRunner; + +import net.thucydides.core.annotations.Step; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import java.io.File; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.CoreMatchers.containsString; +import io.restassured.path.xml.XmlPath; +import org.junit.jupiter.api.Assertions; +import java.nio.file.Files; +import java.nio.file.Paths; +import static org.hamcrest.Matchers.matchesRegex; + + +import static org.junit.jupiter.api.Assertions.assertEquals; + + +@RunWith(SerenityRunner.class) +public class MCOLJudgement { + + private String xml; + private Response response; + private int randomNumber; + + @Step("Given the soap request body") + public String soapRequestBody() { + String xmlContent = ""; + try { + xmlContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("judgement.xml").toURI()))); + } catch (Exception e) { + e.printStackTrace(); + } + + randomNumber = (int)(Math.random() * 1000000); // Generate a random number + xmlContent = xmlContent.replace("RANDOM_NUMBER", Integer.toString(randomNumber)); // Replace the token + + return xmlContent; + } + + @Step("When we send the soap request and get the response") + public Response soapResponse(String xml) { + Response response = RestAssured + .given() + .baseUri("http://civil-sdt-demo.service.core-compute-demo.internal") + .basePath("/producers/service/sdtapi") + .header("Content-Type", "application/soap+xml;charset=UTF-8") + .body(xml) + .post(); + return response; + } + + @Step("Then the status code should be 200") + public void checkStatusCode(Response response) { + response.then().statusCode(200); + response.prettyPrint(); + } + + public String removeNamespaces(String xmlResponse) { + return xmlResponse.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "") + .replaceAll("(<)(\\w+:)(.*?>)", "$1$3") + .replaceAll("()", "$1$3"); + } + + @Before + public void setUp() { + this.xml = soapRequestBody(); + this.response = soapResponse(xml); + } + + public String getCleanResponse() { + String xmlResponse = response.asString(); + xmlResponse = removeNamespaces(xmlResponse); + return xmlResponse; + } + + @Test + public void issueWarrantResponseCode() { + + XmlPath xmlPath = new XmlPath(getCleanResponse()).setRoot("Envelope.Body.bulkResponse"); + String xmlResponseCode = xmlPath.getString("status.@code"); + String customerReference = xmlPath.getString("customerReference"); + String sdtBulkReference = xmlPath.getString("sdtBulkReference"); + String submittedDate = xmlPath.getString("submittedDate"); + String sdtService = xmlPath.getString("sdtService"); + String requestCount = xmlPath.getString("requestCount"); + int statusCode = response.getStatusCode(); + + System.out.println("xmlResponseCode: " + xmlResponseCode); + System.out.println("Customer Reference: " + customerReference); + System.out.println("SDT Bulk Reference: " + sdtBulkReference); + System.out.println("Submitted Date: " + submittedDate); + System.out.println("SDT Service: " + sdtService); + System.out.println("Request Count: " + requestCount); + + assertThat(xmlResponseCode, equalTo("Ok")); + Assertions.assertEquals(200, statusCode); + + } + + @Test + public void validateCustRefIssueWarrant() { + + XmlPath xmlPath = new XmlPath(getCleanResponse()).setRoot("Envelope.Body.bulkResponse"); + String customerReference = xmlPath.getString("customerReference"); + + assertThat(customerReference, equalTo(Integer.toString(randomNumber))); + + } + + @Test + public void validateSDTBulkRefIssueWarrant() { + + XmlPath xmlPath = new XmlPath(getCleanResponse()).setRoot("Envelope.Body.bulkResponse"); + String sdtBulkReference = xmlPath.getString("sdtBulkReference"); + + assertThat(sdtBulkReference, matchesRegex("MCOL-\\d+-\\d+")); + } + + // @Test + // public void issueWarrantResponseDescription() { + + // checkStatusCode(response); + + // String xmlResponse = response.asString(); + // xmlResponse = removeNamespaces(xmlResponse); + + // XmlPath xmlPath = new XmlPath(xmlResponse).setRoot("Envelope.Body.bulkResponse.status.error"); + // String errorDescription = xmlPath.getString("description"); + + // assertThat(errorDescription, containsString("Duplicate User File Reference 91 supplied")); + // } + + @Test + public void issueWarrantResponseStructure() { + checkStatusCode(response); + + String xmlResponse = response.asString(); + xmlResponse = removeNamespaces(xmlResponse); + + assertThat(xmlResponse, containsString("status")); + assertThat(xmlResponse, containsString("customerReference")); + assertThat(xmlResponse, containsString("code")); + assertThat(xmlResponse, containsString("sdtBulkReference")); + } +} diff --git a/src/functionalTest/resources/awaitingDataResponseSample.xml b/src/functionalTest/resources/awaitingDataResponseSample.xml new file mode 100644 index 000000000..e69de29bb diff --git a/src/functionalTest/resources/breathingSpace.xml b/src/functionalTest/resources/breathingSpace.xml new file mode 100644 index 000000000..f2c1c5f7a --- /dev/null +++ b/src/functionalTest/resources/breathingSpace.xml @@ -0,0 +1,26 @@ + + + + + + 10000002 + mcol + 1 + RANDOM_NUMBER + + + + + + + H0PR0001 + + 1 + + BT + + + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/claimOneDefendent.xml b/src/functionalTest/resources/claimOneDefendent.xml new file mode 100644 index 000000000..15288352d --- /dev/null +++ b/src/functionalTest/resources/claimOneDefendent.xml @@ -0,0 +1,58 @@ + + + + + + 10000001 + mcol + 1 + RANDOM_NUMBER + + + + + + + + 60000 + + + claimantForename claimantSurname + + claimantAddress line 1 + claimantAddress line 2 + + + + + defendant1Forename defendant1Surname + + defendant1Address line1 + defendant1Address line2 + RG42 2DL + + + true + true + + + 1000 + 2013-08-15 + 2013-08-16 + 10 + + 9999999 + + 10000 + + hello + + true + John + + + + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/combinedJudgementWarranty.xml b/src/functionalTest/resources/combinedJudgementWarranty.xml new file mode 100644 index 000000000..0cddc1792 --- /dev/null +++ b/src/functionalTest/resources/combinedJudgementWarranty.xml @@ -0,0 +1,131 @@ + + + + + + 12345678 + mcol + 1 + RANDOM_NUMBER + + + + + + + + 9QZ00005 + false + A + + true + + 1 + + + defendant1Address line1 + defendant1Address line2 + + defendant1Address line3 + + defendant1Address line4 + RG42 2DL + + + 1960-10-10 + + + + + + 99999 + + 5000 + + 10000000 + + + payee name + + payee line1 + payee line2 + + payee line3 + + payee line4 + + payee line5 + + RG42 2DL + + + 12345678901234 + + payee dx number + + payee fx number + + payee email + + 12 + + payee reference + + 123456789012345678 + + payee bank account holder + + 12345678 + + payee bank name + + payee bank info1 + + payee bank info2 + + payee slip code line1 + + payee slip code line2 + + 12345678 + + 123456789 + + 12 + + 12 + + + true + sotSignature + + + + 9QZ00001 + 1 + + defendant1Address line1 + defendant1Address line1 + + defendant1Address line1 + + defendant1Address line1 + RG42 2DL + + 50000 + 10000 + + 5000 + + additional notes + + true + sotSignature + + + + + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/getBulkFeedback.xml b/src/functionalTest/resources/getBulkFeedback.xml new file mode 100644 index 000000000..08bb23572 --- /dev/null +++ b/src/functionalTest/resources/getBulkFeedback.xml @@ -0,0 +1,11 @@ + + + + + + 12345678 + MCOL-20131223144458-000000030 + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/judgement.xml b/src/functionalTest/resources/judgement.xml new file mode 100644 index 000000000..97af25e0d --- /dev/null +++ b/src/functionalTest/resources/judgement.xml @@ -0,0 +1,106 @@ + + + + + + 10000002 + mcol + 1 + RANDOM_NUMBER + + + + + + + 9QZ00005 + false + A + + true + + 1 + + + defendant1Address line1 + defendant1Address line2 + + defendant1Address line3 + + defendant1Address line4 + RG42 2DL + + + 1960-10-10 + + + + + + 99999 + + 5000 + + 10000000 + + + payee name + + payee line1 + payee line2 + + payee line3 + + payee line4 + + payee line5 + + RG42 2DL + + + 12345678901234 + + payee dx number + + payee fx number + + payee email + + 12 + + payee reference + + 123456789012345678 + + payee bank account holder + + 12345678 + + payee bank name + + payee bank info1 + + payee bank info2 + + payee slip code line1 + + payee slip code line2 + + 12345678 + + 123456789 + + 12 + + 12 + + + true + sotSignature + + + + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/sampleSubmitBulk.xml b/src/functionalTest/resources/sampleSubmitBulk.xml new file mode 100644 index 000000000..a82757e32 --- /dev/null +++ b/src/functionalTest/resources/sampleSubmitBulk.xml @@ -0,0 +1,27 @@ + + + + + + 10000002 + mcol + 1 + RANDOM_NUMBER + + + + + + + claim123 + + 1 + MP + + 2012-01-01 + + + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/statusUpdate.xml b/src/functionalTest/resources/statusUpdate.xml new file mode 100755 index 000000000..31ec34bcd --- /dev/null +++ b/src/functionalTest/resources/statusUpdate.xml @@ -0,0 +1,21 @@ + + + + + + 10000001 + mcol + 1 + RANDOM_NUMBER + + + + + 9QZ00009 + WD + + + + + + diff --git a/src/functionalTest/resources/submitQuery.xml b/src/functionalTest/resources/submitQuery.xml new file mode 100644 index 000000000..bce120f96 --- /dev/null +++ b/src/functionalTest/resources/submitQuery.xml @@ -0,0 +1,20 @@ + + + + + + 12345678 + mcol + optional + + + + + 2009-12-01 + 2009-12-02 + + + + + + \ No newline at end of file diff --git a/src/functionalTest/resources/warrant.xml b/src/functionalTest/resources/warrant.xml new file mode 100644 index 000000000..654ccecf6 --- /dev/null +++ b/src/functionalTest/resources/warrant.xml @@ -0,0 +1,42 @@ + + + + + + CUSTOMER_ID + mcol + REQUEST_COUNT + RANDOM_NUMBER + + + + + + + 9QZ00003 + 1 + + defendant1Address line1 + defendant1Address line1 + + defendant1Address line1 + + defendant1Address line1 + RG42 2DL + + 50000 + 10000 + + 5 + + additional notes + + true + sotSignature + + + + + + + \ No newline at end of file From 593591dba6c68d48ee3b651645db5e081b4fc398 Mon Sep 17 00:00:00 2001 From: Hemanth Potipati Date: Fri, 7 Jul 2023 09:28:24 +0100 Subject: [PATCH 2/4] Delete settings.json --- .vscode/settings.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e01206508..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "java.compile.nullAnalysis.mode": "automatic", - "java.configuration.updateBuildConfiguration": "interactive" -} \ No newline at end of file From dfb38f89d69c6d5f9a6e967e582ca31897b99470 Mon Sep 17 00:00:00 2001 From: Hemanth Potipati Date: Fri, 7 Jul 2023 10:11:52 +0100 Subject: [PATCH 3/4] Update Jenkinsfile_CNP --- Jenkinsfile_CNP | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 5ae4b93eb..ca4eda5db 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -1,13 +1,49 @@ #!groovy +import uk.gov.hmcts.contino.AppPipelineDsl +import uk.gov.hmcts.contino.GithubAPI +properties( + [ + [ + $class : 'GithubProjectProperty', + projectUrlStr: 'https://github.com/hmcts/ccd-data-store-api' + ], + pipelineTriggers([[$class: 'GitHubPushTrigger']]) + ] +) + @Library("Infrastructure") +env.CIVIL_SDT_DEMO_URL = "http://civil-sdt-demo.service.core-compute-demo.internal" + def type = "java" def product = "civil" def component = "sdt" +def branchesToSync = ['demo', 'ithc', 'perftest', 'develop'] withPipeline(type, product, component) { enableAksStagingDeployment() disableLegacyDeployment() - nonServiceApp() + disableLegacyDeploymentOnAAT() +} + +afterAlways('test') { + // hmcts/cnp-jenkins-library may fail to copy artifacts after checkstyle error so repeat command (see /src/uk/gov/hmcts/contino/GradleBuilder.groovy) + steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/checkstyle/*.html' +} + +afterAlways('smoketest:preview') { + steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Smoke Tests Report CIVIL-SDT/**/*' +} + +afterAlways('smoketest:aat') { + steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Smoke Tests Report CIVIL-SDT/**/*' +} + +afterAlways('functionalTest:preview') { + steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Functional Tests Report CIVIL-SDT/**/*' +} + +afterAlways('functionalTest:aat') { + steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Functional Tests Report CIVIL-SDT/**/*' } From 2f5139e981ec6e9538af1327cd819d87f018f529 Mon Sep 17 00:00:00 2001 From: Hemanth Potipati Date: Fri, 7 Jul 2023 10:12:16 +0100 Subject: [PATCH 4/4] Update Jenkinsfile_CNP --- Jenkinsfile_CNP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index ca4eda5db..9b79ee91b 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -6,7 +6,7 @@ properties( [ [ $class : 'GithubProjectProperty', - projectUrlStr: 'https://github.com/hmcts/ccd-data-store-api' + projectUrlStr: 'https://github.com/hmcts/civil-sdt' ], pipelineTriggers([[$class: 'GitHubPushTrigger']]) ]