From 7b518ca0f95a2825b6c3686013e7b698a09785fd Mon Sep 17 00:00:00 2001 From: amartin7663 Date: Thu, 14 Apr 2022 15:25:22 +0100 Subject: [PATCH 1/6] add first integration test --- .gitignore | 3 + pom.xml | 47 ++++++++++ .../delta/CucumberFeaturesRunnerITest.java | 14 +++ .../config/KafkaTestContainerConfig.java | 2 +- .../delta/data/TestData.java | 33 +++++++ .../DisqualificationRequestMatcher.java | 85 +++++++++++++++++++ .../delta/steps/CommonSteps.java | 83 ++++++++++++++++++ .../data/natural_undertaking_in.json | 56 ++++++++++++ .../data/natural_undertaking_out.json | 68 +++++++++++++++ .../resources/features/NaturalOfficer.feature | 9 ++ 10 files changed, 399 insertions(+), 1 deletion(-) create mode 100644 src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/CucumberFeaturesRunnerITest.java create mode 100644 src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/data/TestData.java create mode 100644 src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java create mode 100644 src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java create mode 100644 src/itest/resources/data/natural_undertaking_in.json create mode 100644 src/itest/resources/data/natural_undertaking_out.json create mode 100644 src/itest/resources/features/NaturalOfficer.feature diff --git a/.gitignore b/.gitignore index c836fce..d7a5868 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* /target/ + +.idea +*.iml \ No newline at end of file diff --git a/pom.xml b/pom.xml index 50ecacf..8d7b9d3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,12 +23,14 @@ 3.2.0 3.0.0-M5 1.0.0 + 7.2.3 1.4.2 1.9.12 1.0.25 2.0.146 1.0.4 3.1.1 + 2.32.0 false false @@ -124,6 +126,51 @@ ${test-containers.version} test + + + io.cucumber + cucumber-core + ${io-cucumber.version} + test + + + io.cucumber + cucumber-java + ${io-cucumber.version} + test + + + io.cucumber + cucumber-junit + ${io-cucumber.version} + test + + + io.cucumber + cucumber-spring + ${io-cucumber.version} + test + + + com.github.tomakehurst + wiremock-jre8 + ${wiremock.standalone.version} + test + + + org.conscrypt + conscrypt-openjdk-uber + + + com.github.jknack + handlebars + + + com.github.jknack + handlebars-helpers + + + diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/CucumberFeaturesRunnerITest.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/CucumberFeaturesRunnerITest.java new file mode 100644 index 0000000..ec27e1f --- /dev/null +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/CucumberFeaturesRunnerITest.java @@ -0,0 +1,14 @@ +package uk.gov.companieshouse.disqualifiedofficers.delta; + +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; +import io.cucumber.spring.CucumberContextConfiguration; +import org.junit.runner.RunWith; + +@RunWith(Cucumber.class) +@CucumberOptions(features = "src/itest/resources/features", + plugin = {"pretty", "json:target/cucumber-report.json"}) +@CucumberContextConfiguration +public class CucumberFeaturesRunnerITest extends AbstractIntegrationTest { + +} diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/config/KafkaTestContainerConfig.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/config/KafkaTestContainerConfig.java index d74f25e..08b809c 100644 --- a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/config/KafkaTestContainerConfig.java +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/config/KafkaTestContainerConfig.java @@ -60,7 +60,7 @@ public Map consumerConfigs(KafkaContainer kafkaContainer) { Map props = new HashMap<>(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaContainer.getBootstrapServers()); props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); - props.put(ConsumerConfig.GROUP_ID_CONFIG, "insolvency-delta-consumer"); + props.put(ConsumerConfig.GROUP_ID_CONFIG, "disqualified-officer-delta-consumer"); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ChsDeltaDeserializer.class); return props; diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/data/TestData.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/data/TestData.java new file mode 100644 index 0000000..11da52b --- /dev/null +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/data/TestData.java @@ -0,0 +1,33 @@ +package uk.gov.companieshouse.disqualifiedofficers.delta.data; + +import org.springframework.util.FileCopyUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +public class TestData { + + public static String getInputData(String officerType, String disqType) { + disqType = disqType.replace(' ', '_'); + String path = "src/itest/resources/data/" + officerType + '_' + disqType + "_in.json"; + return readFile(path); + } + + public static String getOutputData(String officerType, String disqType) { + disqType = disqType.replace(' ', '_'); + String path = "src/itest/resources/data/" + officerType + '_' + disqType + "_out.json"; + return readFile(path).replaceAll("\n", ""); + } + + private static String readFile(String path) { + String data; + try { + data = FileCopyUtils.copyToString(new InputStreamReader(new FileInputStream(new File(path)))); + } catch (IOException e) { + data = null; + } + return data; + } +} diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java new file mode 100644 index 0000000..92721be --- /dev/null +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java @@ -0,0 +1,85 @@ +package uk.gov.companieshouse.disqualifiedofficers.delta.matcher; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.RequestMethod; +import com.github.tomakehurst.wiremock.matching.MatchResult; +import com.github.tomakehurst.wiremock.matching.ValueMatcher; +import uk.gov.companieshouse.logging.Logger; + +public class DisqualificationRequestMatcher implements ValueMatcher { + + private String expectedOutput; + private String type; + private Logger logger; + + public DisqualificationRequestMatcher(Logger logger, String type, String output) { + this.type = type; + this.expectedOutput = output; + this.logger = logger; + } + + @Override + public MatchResult match(Request value) { + + return MatchResult.aggregate(matchUrl(value.getUrl()), matchMethod(value.getMethod()), + matchBody(value.getBodyAsString())); + } + + private MatchResult matchUrl(String actualUrl) { + String expectedUrl = "/disqualified-officers/" + type + "/1234567890/internal"; + + MatchResult urlResult = MatchResult.of(expectedUrl.equals(actualUrl)); + + if (! urlResult.isExactMatch()) { + logger.error("url does not match expected: <" + expectedUrl + "> actual: <" + actualUrl + ">"); + } + + return urlResult; + } + + private MatchResult matchMethod(RequestMethod actualMethod) { + RequestMethod expectedMethod = RequestMethod.PUT; + + MatchResult typeResult = MatchResult.of(expectedMethod.equals(actualMethod)); + + if (! typeResult.isExactMatch()) { + logger.error("Method does not match expected: <" + expectedMethod + "> actual: <" + actualMethod + ">"); + } + + return typeResult; + } + + private MatchResult matchBody(String actualBody) { + + ObjectMapper mapper = new ObjectMapper(); + + MatchResult bodyResult; + JsonNode expectedBody; + try { + expectedBody = mapper.readTree(expectedOutput); + } catch (JsonProcessingException e) { + logger.error("Could not process expectedBody JSON: " + e); + return MatchResult.of(false); + } + + JsonNode actual; + try { + actual = mapper.readTree(actualBody); + } catch (JsonProcessingException e) { + logger.error("Could not process actualBody JSON: " + e); + return MatchResult.of(false); + } + + bodyResult = MatchResult.of(expectedBody.equals(actual)); + + if (! bodyResult.isExactMatch()) { + logger.error("Body does not match expected: <" + expectedBody + "> actual: <" + actualBody + ">"); + } + + return bodyResult; + } +} + diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java new file mode 100644 index 0000000..c8bcdb2 --- /dev/null +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java @@ -0,0 +1,83 @@ +package uk.gov.companieshouse.disqualifiedofficers.delta.steps; + +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import com.github.tomakehurst.wiremock.WireMockServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.kafka.core.KafkaTemplate; +import uk.gov.companieshouse.delta.ChsDelta; +import uk.gov.companieshouse.disqualifiedofficers.delta.data.TestData; +import uk.gov.companieshouse.disqualifiedofficers.delta.matcher.DisqualificationRequestMatcher; +import uk.gov.companieshouse.logging.Logger; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.requestMadeFor; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; +import static org.assertj.core.api.Assertions.assertThat; + + +public class CommonSteps { + + private final static String ENCODED_OFFICER_ID = "1kETe9SJWIp9OlvZgO1xmjyt5_s"; + + @Value("${disqualified-officers.delta.topic.main}") + private String mainTopic; + + @Value("${wiremock.server.port}") + private String port; + + private static WireMockServer wireMockServer; + + @Autowired + private KafkaTemplate kafkaTemplate; + @Autowired + private Logger logger; + + private String type; + private String output; + + @Given("the application is running") + public void theApplicationRunning() { + assertThat(kafkaTemplate).isNotNull(); + } + + @When("^the consumer receives a (natural|corporate) disqualification of (undertaking|court order)$") + public void theConsumerReceivesDisqualificationOfType(String officerType, String disqType) throws Exception { + configureWiremock(); + stubPutDisqualification(officerType); + this.type = officerType; + this.output = TestData.getOutputData(officerType, disqType); + + ChsDelta delta = new ChsDelta(TestData.getInputData(officerType, disqType), 1, "1"); + kafkaTemplate.send(mainTopic, delta); + + CountDownLatch countDownLatch = new CountDownLatch(1); + countDownLatch.await(5, TimeUnit.SECONDS); + } + + @Then("a PUT request is sent to the disqualifications api with the transformed data") + public void putRequestIsSentToTheDisqualificationsApi() { + verify(1, requestMadeFor(new DisqualificationRequestMatcher(logger, type, output))); + } + + private void configureWiremock() { + wireMockServer = new WireMockServer(Integer.parseInt(port)); + wireMockServer.start(); + configureFor("localhost", Integer.parseInt(port)); + } + + private void stubPutDisqualification(String type) { + stubFor(put(urlEqualTo("/disqualified-officers/" + type + "/1234567890/internal")) + .willReturn(aResponse().withStatus(200))); + } +} + diff --git a/src/itest/resources/data/natural_undertaking_in.json b/src/itest/resources/data/natural_undertaking_in.json new file mode 100644 index 0000000..5e374d0 --- /dev/null +++ b/src/itest/resources/data/natural_undertaking_in.json @@ -0,0 +1,56 @@ +{ + "disqualified_officer": [ + { + "officer_disq_id": "3000034602", + "external_number": "166284060001", + "officer_id": "1234567890", + "officer_detail_id": "3002560732", + "date_of_birth": "19760206", + "title": "Mr", + "forename": "Dust", + "middle_name": "Condition Reserve", + "surname": "KINDNESSLIQUOR", + "honours": "", + "nationality": "British", + "registered_number": "", + "registered_location": "", + "disqualifications": [ + { + "disq_eff_date": "20150218", + "disq_end_date": "20250217", + "disq_type": "UNDERTAKING", + "hearing_date": "20150214", + "section_of_the_act": "CDDA 1986 S7", + "court_ref": "INV3975227", + "court_name": "Insolvency Service", + "address": { + "premise": "30", + "address_line_1": "Lucy Road", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" + }, + "variation_court": "Judys", + "variation_court_ref_no": "1", + "var_instrument_start_date": "20210217", + "company_names": [ + "CONSORTIUM TECHNOLOGY LIMITED" + ] + } + ], + "exemptions": [{ + "court_name": "rinder", + "granted_on": "20140203", + "expires_on": "20160412", + "company_names": [ + "123 LTD", + "321 LTD" + ] + }] + } + ], + "CreatedTime": "16-FEB-22 14.40.57.000000", + "delta_at": "20211008152823383176" +} \ No newline at end of file diff --git a/src/itest/resources/data/natural_undertaking_out.json b/src/itest/resources/data/natural_undertaking_out.json new file mode 100644 index 0000000..b1e0454 --- /dev/null +++ b/src/itest/resources/data/natural_undertaking_out.json @@ -0,0 +1,68 @@ +{ + "external_data" : { + "date_of_birth": [1976,2,6], + "person_number" : "166284060001", + "etag" : null, + "forename" : "Dust", + "honours" : "", + "nationality" : "British", + "other_forenames" : "Condition Reserve", + "surname" : "KINDNESSLIQUOR", + "title" : "Mr", + "links" : { + "self" : "/disqualified-officers/natural/1kETe9SJWIp9OlvZgO1xmjyt5_s" + }, + "disqualifications" : [ + { + "case_identifier" : "INV3975227", + "address" : { + "premise" : "30", + "address_line_1" : "Lucy Road", + "address_line_2" : "Skewen", + "locality" : "Neath", + "region" : "", + "country" : "Wales", + "postal_code" : "SA10 6RR" + }, + "company_names" : [ + "CONSORTIUM TECHNOLOGY LIMITED" + ], + "court_name" : null, + "disqualification_type": "undertaking", + "disqualified_from" : [2015,2,18], + "disqualified_until" : [2025,2,17], + "heard_on" : null, + "undertaken_on" : [2015,2,14], + "last_variation" : { + "varied_on" : [2021,2,17], + "case_identifier" : "1", + "court_name" : "Judys" + }, + "reason" : { + "act" : "company-directors-disqualification-act-1986", + "section" : "7", + "description_identifier" : "order-or-undertaking-and-reporting-provisions" + } + } + ], + "permissions_to_act": [ + { + "company_names" : [ + "123 LTD", + "321 LTD" + ], + "court_name" : "rinder", + "expires_on" : [2016,4,12], + "granted_on" : [2014,2,3], + "purpose" : null + } + ] + }, + "internal_data" : { + "delta_at" : 1.633706903383176E9, + "officer_id" : "1kETe9SJWIp9OlvZgO1xmjyt5_s", + "officer_id_raw" : "1234567890", + "officer_disq_id" : "3000034602", + "officer_detail_id" : "3002560732" + } +} \ No newline at end of file diff --git a/src/itest/resources/features/NaturalOfficer.feature b/src/itest/resources/features/NaturalOfficer.feature new file mode 100644 index 0000000..5041bf2 --- /dev/null +++ b/src/itest/resources/features/NaturalOfficer.feature @@ -0,0 +1,9 @@ +Feature: Natural Officer + +Scenario Outline: Can transform and send a natural officer + Given the application is running + When the consumer receives a natural disqualification of + Then a PUT request is sent to the disqualifications api with the transformed data + Examples: + | type | + | undertaking | \ No newline at end of file From 40b3bbcefda3240e2f8ea26fcda5362d794a7c45 Mon Sep 17 00:00:00 2001 From: osamo-oas Date: Fri, 22 Apr 2022 09:43:42 +0100 Subject: [PATCH 2/6] add json examples & exclude json-unit-core --- pom.xml | 4 ++ .../data/corporate_court_order_in.json | 58 ++++++++++++++++ .../data/corporate_court_order_out.json | 59 ++++++++++++++++ .../data/corporate_undertaking_in.json | 58 ++++++++++++++++ .../data/corporate_undertaking_out.json | 59 ++++++++++++++++ .../data/natural_court_order_in.json | 56 +++++++++++++++ .../data/natural_court_order_out.json | 68 +++++++++++++++++++ 7 files changed, 362 insertions(+) create mode 100644 src/itest/resources/data/corporate_court_order_in.json create mode 100644 src/itest/resources/data/corporate_court_order_out.json create mode 100644 src/itest/resources/data/corporate_undertaking_in.json create mode 100644 src/itest/resources/data/corporate_undertaking_out.json create mode 100644 src/itest/resources/data/natural_court_order_in.json create mode 100644 src/itest/resources/data/natural_court_order_out.json diff --git a/pom.xml b/pom.xml index 8d7b9d3..61f8873 100644 --- a/pom.xml +++ b/pom.xml @@ -169,6 +169,10 @@ com.github.jknack handlebars-helpers + + net.javacrumbs.json-unit + json-unit-core + diff --git a/src/itest/resources/data/corporate_court_order_in.json b/src/itest/resources/data/corporate_court_order_in.json new file mode 100644 index 0000000..972cd32 --- /dev/null +++ b/src/itest/resources/data/corporate_court_order_in.json @@ -0,0 +1,58 @@ +{ + "disqualified_officer": [ + {"corporate_ind":"true", + "officer_disq_id": "3000034602", + "external_number": "166284060001", + "officer_id": "rqaa9E", + "officer_detail_id": "3002560732", + "date_of_birth": "19760206", + "title": "", + "forename": "", + "middle_name": "", + "surname": "BABYLON INCORPORATION LIMITED", + "honours": "", + "nationality": "", + "registered_number": "00053723", + "registered_location": "SCOTLAND", + "disqualifications": [ + { + "disq_eff_date": "20150218", + "disq_end_date": "20250217", + "disq_type": "ORDER", + "hearing_date": "20180214", + "section_of_the_act": "CDDO 1986 A11A", + "court_ref": "INV3975227", + "court_name": "Insolvency Service", + "address": { + "premise": "3000", + "address_line_1": "SYLVESTERucy AVENUE", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" + }, + "variation_court": "SWINDLERS", + "variation_court_ref_no": "1", + "var_instrument_start_date": "20210217", + "company_names": [ + "CONSORTIUM TECHNOLOGY LIMITED" + ] + } + ], + "exemptions": [{ + "court_name": "rinder", + "granted_on": "20140203", + "expires_on": "20160412", + "purpose": "ALPHABET", + "company_names": [ + "123 LTD", + "321 LTD" + + ] + }] + } + ], + "CreatedTime": "16-FEB-22 14.40.57.000000", + "delta_at": "20211008152823383176" + } \ No newline at end of file diff --git a/src/itest/resources/data/corporate_court_order_out.json b/src/itest/resources/data/corporate_court_order_out.json new file mode 100644 index 0000000..22b38ca --- /dev/null +++ b/src/itest/resources/data/corporate_court_order_out.json @@ -0,0 +1,59 @@ +{ + "external_data" : { + "person_number" : "person_number_123", + "date_of_birth" : "2022-03-05", + "etag" : "", + "title" : "string title", + "forename" : "string forename", + "other_forename" : "string other forename", + "surname" : "string surname", + "honours" : "string honours", + "nationality" : "string nationality", + "company_number" : "00000000", + "country_of_registration" : "string country", + "disqualifications" : [ + { + "address" : { + "address_line_1" : "123 String Road", + "address_line_2" : "123 string line 2", + "locality" : "123 string locality", + "postal_code" : "123 string postcode", + "premises" : "123 string premise", + "region" : "123 string region", + "country" : "string country" + }, + "case_identifier" : "123 string caseid", + "company_names" : [ + "123 COMPANY NAME TEST" + ], + "court_name" : "123 string court name", + "disqualification_type" : "123 string disqualification type", + "disqualified_from" : "2022-03-03T12:51:00.767Z", + "disqualified_until" : "2022-03-04T12:51:00.767Z", + "heard_on" : "2022-03-01T12:51:00.767Z", + "undertaken_on" : null, + "reason" : { + "description_identifier" : "123 string description identifier", + "section" : "123 string section", + "act" : "123 string act", + "article" : "123 string article" + }, + "last_variation" : { + "court_name" : "string last variation court name", + "case_identifier" : "string last variation caseid", + "varied_on" : "2022-03-01" + } + } + ], + "links" : { + "self" : "123 link self" + } + }, + "internal_data" : { + "delta_at" : "2022-04-11T11:18:00.768Z", + "officer_id" : "123 test officer id", + "officer_id_raw" : "123 test officer id raw", + "officer_disq_id" : "123 test officer disq id", + "officer_detail_id" : "123 test" + } +} \ No newline at end of file diff --git a/src/itest/resources/data/corporate_undertaking_in.json b/src/itest/resources/data/corporate_undertaking_in.json new file mode 100644 index 0000000..972cd32 --- /dev/null +++ b/src/itest/resources/data/corporate_undertaking_in.json @@ -0,0 +1,58 @@ +{ + "disqualified_officer": [ + {"corporate_ind":"true", + "officer_disq_id": "3000034602", + "external_number": "166284060001", + "officer_id": "rqaa9E", + "officer_detail_id": "3002560732", + "date_of_birth": "19760206", + "title": "", + "forename": "", + "middle_name": "", + "surname": "BABYLON INCORPORATION LIMITED", + "honours": "", + "nationality": "", + "registered_number": "00053723", + "registered_location": "SCOTLAND", + "disqualifications": [ + { + "disq_eff_date": "20150218", + "disq_end_date": "20250217", + "disq_type": "ORDER", + "hearing_date": "20180214", + "section_of_the_act": "CDDO 1986 A11A", + "court_ref": "INV3975227", + "court_name": "Insolvency Service", + "address": { + "premise": "3000", + "address_line_1": "SYLVESTERucy AVENUE", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" + }, + "variation_court": "SWINDLERS", + "variation_court_ref_no": "1", + "var_instrument_start_date": "20210217", + "company_names": [ + "CONSORTIUM TECHNOLOGY LIMITED" + ] + } + ], + "exemptions": [{ + "court_name": "rinder", + "granted_on": "20140203", + "expires_on": "20160412", + "purpose": "ALPHABET", + "company_names": [ + "123 LTD", + "321 LTD" + + ] + }] + } + ], + "CreatedTime": "16-FEB-22 14.40.57.000000", + "delta_at": "20211008152823383176" + } \ No newline at end of file diff --git a/src/itest/resources/data/corporate_undertaking_out.json b/src/itest/resources/data/corporate_undertaking_out.json new file mode 100644 index 0000000..f407adf --- /dev/null +++ b/src/itest/resources/data/corporate_undertaking_out.json @@ -0,0 +1,59 @@ +{ + "external_data" : { + "person_number" : "person_number_123", + "date_of_birth" : "2022-03-05", + "etag" : "", + "title" : "string title", + "forename" : "string forename", + "other_forename" : "string other forename", + "surname" : "string surname", + "honours" : "string honours", + "nationality" : "string nationality", + "company_number" : "00000000", + "country_of_registration" : "string country", + "disqualifications" : [ + { + "address" : { + "address_line_1" : "123 String Road", + "address_line_2" : "123 string line 2", + "locality" : "123 string locality", + "postal_code" : "123 string postcode", + "premises" : "123 string premise", + "region" : "123 string region", + "country" : "string country" + }, + "case_identifier" : "123 string caseid", + "company_names" : [ + "123 COMPANY NAME TEST" + ], + "court_name" : "123 string court name", + "disqualification_type" : "123 string disqualification type", + "disqualified_from" : "2022-03-03T12:51:00.767Z", + "disqualified_until" : "2022-03-04T12:51:00.767Z", + "heard_on" : null, + "undertaken_on" : "2022-03-02T12:51:00.767Z", + "reason" : { + "description_identifier" : "123 string description identifier", + "section" : "123 string section", + "act" : "123 string act", + "article" : "123 string article" + }, + "last_variation" : { + "court_name" : "string last variation court name", + "case_identifier" : "string last variation caseid", + "varied_on" : "2022-03-01" + } + } + ], + "links" : { + "self" : "123 link self" + } + }, + "internal_data" : { + "delta_at" : "2022-04-11T11:18:00.768Z", + "officer_id" : "123 test officer id", + "officer_id_raw" : "123 test officer id raw", + "officer_disq_id" : "123 test officer disq id", + "officer_detail_id" : "123 test" + } +} \ No newline at end of file diff --git a/src/itest/resources/data/natural_court_order_in.json b/src/itest/resources/data/natural_court_order_in.json new file mode 100644 index 0000000..6b6509b --- /dev/null +++ b/src/itest/resources/data/natural_court_order_in.json @@ -0,0 +1,56 @@ +{ + "disqualified_officer": [ + { + "officer_disq_id": "3000034602", + "external_number": "166284060001", + "officer_id": "1234567890", + "officer_detail_id": "3002560732", + "date_of_birth": "19760206", + "title": "Mr", + "forename": "Dust", + "middle_name": "Condition Reserve", + "surname": "KINDNESSLIQUOR", + "honours": "", + "nationality": "British", + "registered_number": "", + "registered_location": "", + "disqualifications": [ + { + "disq_eff_date": "20150218", + "disq_end_date": "20250217", + "disq_type": "ORDER", + "hearing_date": "20150214", + "section_of_the_act": "CDDA 1986 S7", + "court_ref": "INV3975227", + "court_name": "Insolvency Service", + "address": { + "premise": "30", + "address_line_1": "Lucy Road", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" + }, + "variation_court": "Judys", + "variation_court_ref_no": "1", + "var_instrument_start_date": "20210217", + "company_names": [ + "CONSORTIUM TECHNOLOGY LIMITED" + ] + } + ], + "exemptions": [{ + "court_name": "rinder", + "granted_on": "20140203", + "expires_on": "20160412", + "company_names": [ + "123 LTD", + "321 LTD" + ] + }] + } + ], + "CreatedTime": "16-FEB-22 14.40.57.000000", + "delta_at": "20211008152823383176" +} \ No newline at end of file diff --git a/src/itest/resources/data/natural_court_order_out.json b/src/itest/resources/data/natural_court_order_out.json new file mode 100644 index 0000000..7e2c75e --- /dev/null +++ b/src/itest/resources/data/natural_court_order_out.json @@ -0,0 +1,68 @@ +{ + "external_data" : { + "date_of_birth": [1976,2,6], + "person_number" : "166284060001", + "etag" : null, + "forename" : "Dust", + "honours" : "", + "nationality" : "British", + "other_forenames" : "Condition Reserve", + "surname" : "KINDNESSLIQUOR", + "title" : "Mr", + "links" : { + "self" : "/disqualified-officers/natural/1kETe9SJWIp9OlvZgO1xmjyt5_s" + }, + "disqualifications" : [ + { + "case_identifier" : "INV3975227", + "address" : { + "premise" : "30", + "address_line_1" : "Lucy Road", + "address_line_2" : "Skewen", + "locality" : "Neath", + "region" : "", + "country" : "Wales", + "postal_code" : "SA10 6RR" + }, + "company_names" : [ + "CONSORTIUM TECHNOLOGY LIMITED" + ], + "court_name" : null, + "disqualification_type": "undertaking", + "disqualified_from" : [2015,2,18], + "disqualified_until" : [2025,2,17], + "heard_on" : [2015,2,14], + "undertaken_on" : null, + "last_variation" : { + "varied_on" : [2021,2,17], + "case_identifier" : "1", + "court_name" : "Judys" + }, + "reason" : { + "act" : "company-directors-disqualification-act-1986", + "section" : "7", + "description_identifier" : "order-or-undertaking-and-reporting-provisions" + } + } + ], + "permissions_to_act": [ + { + "company_names" : [ + "123 LTD", + "321 LTD" + ], + "court_name" : "rinder", + "expires_on" : [2016,4,12], + "granted_on" : [2014,2,3], + "purpose" : null + } + ] + }, + "internal_data" : { + "delta_at" : 1.633706903383176E9, + "officer_id" : "1kETe9SJWIp9OlvZgO1xmjyt5_s", + "officer_id_raw" : "1234567890", + "officer_disq_id" : "3000034602", + "officer_detail_id" : "3002560732" + } +} \ No newline at end of file From 8e364d4f288d85df47d69cbed099e59630bc559d Mon Sep 17 00:00:00 2001 From: osamo-oas Date: Mon, 25 Apr 2022 09:51:42 +0100 Subject: [PATCH 3/6] move wiremock into app --- .../disqualifiedofficers/delta/steps/CommonSteps.java | 2 ++ src/main/resources/application.yml | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java index c8bcdb2..e970070 100644 --- a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java @@ -66,6 +66,8 @@ public void theConsumerReceivesDisqualificationOfType(String officerType, String @Then("a PUT request is sent to the disqualifications api with the transformed data") public void putRequestIsSentToTheDisqualificationsApi() { + logger.info("I'm here" + output); + logger.info(type); verify(1, requestMadeFor(new DisqualificationRequestMatcher(logger, type, output))); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4165fa1..e10a5a7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -24,5 +24,10 @@ logger: api: disqualified-officers-data-api-key: ${DISQUALIFIED_OFFICERS_DATA_API_KEY:localhost} - api-url: ${API_URL:localhost} - internal-api-url: ${INTERNAL_API_URL:localhost} \ No newline at end of file + api-url: ${API_URL:http://localhost:8888} + internal-api-url: ${INTERNAL_API_URL:localhost} + +wiremock: + server: + port: 8888 + From 12f011aea3f3752891c9d31c96656b4f906426f8 Mon Sep 17 00:00:00 2001 From: amartin7663 Date: Mon, 25 Apr 2022 12:02:48 +0100 Subject: [PATCH 4/6] add features for corporate officers --- pom.xml | 2 +- .../delta/steps/CommonSteps.java | 8 +- .../data/corporate_court_order_in.json | 110 +++++++++--------- .../data/corporate_court_order_out.json | 89 +++++++------- .../data/corporate_undertaking_in.json | 4 +- .../data/corporate_undertaking_out.json | 89 +++++++------- .../data/natural_court_order_out.json | 4 +- .../features/CorporateOfficer.feature | 10 ++ .../resources/features/NaturalOfficer.feature | 5 +- 9 files changed, 171 insertions(+), 150 deletions(-) create mode 100644 src/itest/resources/features/CorporateOfficer.feature diff --git a/pom.xml b/pom.xml index 61f8873..cbc7de1 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.4.2.Final 3.0.0-M5 3.2.0 - 3.0.0-M5 + 2.12.4 1.0.0 7.2.3 1.4.2 diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java index e970070..ddca20b 100644 --- a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java @@ -1,5 +1,6 @@ package uk.gov.companieshouse.disqualifiedofficers.delta.steps; +import io.cucumber.java.After; import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; @@ -66,11 +67,14 @@ public void theConsumerReceivesDisqualificationOfType(String officerType, String @Then("a PUT request is sent to the disqualifications api with the transformed data") public void putRequestIsSentToTheDisqualificationsApi() { - logger.info("I'm here" + output); - logger.info(type); verify(1, requestMadeFor(new DisqualificationRequestMatcher(logger, type, output))); } + @After + public void shutdownWiremock(){ + wireMockServer.stop(); + } + private void configureWiremock() { wireMockServer = new WireMockServer(Integer.parseInt(port)); wireMockServer.start(); diff --git a/src/itest/resources/data/corporate_court_order_in.json b/src/itest/resources/data/corporate_court_order_in.json index 972cd32..e7d5e89 100644 --- a/src/itest/resources/data/corporate_court_order_in.json +++ b/src/itest/resources/data/corporate_court_order_in.json @@ -1,58 +1,58 @@ { - "disqualified_officer": [ - {"corporate_ind":"true", - "officer_disq_id": "3000034602", - "external_number": "166284060001", - "officer_id": "rqaa9E", - "officer_detail_id": "3002560732", - "date_of_birth": "19760206", - "title": "", - "forename": "", - "middle_name": "", - "surname": "BABYLON INCORPORATION LIMITED", - "honours": "", - "nationality": "", - "registered_number": "00053723", - "registered_location": "SCOTLAND", - "disqualifications": [ - { - "disq_eff_date": "20150218", - "disq_end_date": "20250217", - "disq_type": "ORDER", - "hearing_date": "20180214", - "section_of_the_act": "CDDO 1986 A11A", - "court_ref": "INV3975227", - "court_name": "Insolvency Service", - "address": { - "premise": "3000", - "address_line_1": "SYLVESTERucy AVENUE", - "address_line_2": "Skewen", - "locality": "Neath", - "region": "", - "country": "Wales", - "postal_code": "SA10 6RR" - }, - "variation_court": "SWINDLERS", - "variation_court_ref_no": "1", - "var_instrument_start_date": "20210217", - "company_names": [ - "CONSORTIUM TECHNOLOGY LIMITED" - ] - } - ], - "exemptions": [{ - "court_name": "rinder", - "granted_on": "20140203", - "expires_on": "20160412", - "purpose": "ALPHABET", + "disqualified_officer": [ + {"corporate_ind":"true", + "officer_disq_id": "3000034602", + "external_number": "166284060001", + "officer_id": "1234567890", + "officer_detail_id": "3002560732", + "date_of_birth": "19760206", + "title": "", + "forename": "", + "middle_name": "", + "surname": "BABYLON INCORPORATION LIMITED", + "honours": "", + "nationality": "", + "registered_number": "00053723", + "registered_location": "SCOTLAND", + "disqualifications": [ + { + "disq_eff_date": "20150218", + "disq_end_date": "20250217", + "disq_type": "ORDER", + "hearing_date": "20180214", + "section_of_the_act": "CDDO 1986 A11A", + "court_ref": "INV3975227", + "court_name": "Insolvency Service", + "address": { + "premise": "3000", + "address_line_1": "SYLVESTERucy AVENUE", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" + }, + "variation_court": "SWINDLERS", + "variation_court_ref_no": "1", + "var_instrument_start_date": "20210217", "company_names": [ - "123 LTD", - "321 LTD" - + "CONSORTIUM TECHNOLOGY LIMITED" ] - }] - } - ], - "CreatedTime": "16-FEB-22 14.40.57.000000", - "delta_at": "20211008152823383176" - } \ No newline at end of file + } + ], + "exemptions": [{ + "court_name": "rinder", + "granted_on": "20140203", + "expires_on": "20160412", + "purpose": "ALPHABET", + "company_names": [ + "123 LTD", + "321 LTD" + + ] + }] + } + ], + "CreatedTime": "16-FEB-22 14.40.57.000000", + "delta_at": "20211008152823383176" +} \ No newline at end of file diff --git a/src/itest/resources/data/corporate_court_order_out.json b/src/itest/resources/data/corporate_court_order_out.json index 22b38ca..0c51ca8 100644 --- a/src/itest/resources/data/corporate_court_order_out.json +++ b/src/itest/resources/data/corporate_court_order_out.json @@ -1,59 +1,62 @@ { "external_data" : { - "person_number" : "person_number_123", - "date_of_birth" : "2022-03-05", - "etag" : "", - "title" : "string title", - "forename" : "string forename", - "other_forename" : "string other forename", - "surname" : "string surname", - "honours" : "string honours", - "nationality" : "string nationality", - "company_number" : "00000000", - "country_of_registration" : "string country", + "company_number" : "00053723", + "person_number" : "166284060001", + "country_of_registration" : "SCOTLAND", + "etag" : null, + "kind" : null, + "name" : "BABYLON INCORPORATION LIMITED", + "links" : { + "self" : "/disqualified-officers/corporate/1kETe9SJWIp9OlvZgO1xmjyt5_s" + }, "disqualifications" : [ { - "address" : { - "address_line_1" : "123 String Road", - "address_line_2" : "123 string line 2", - "locality" : "123 string locality", - "postal_code" : "123 string postcode", - "premises" : "123 string premise", - "region" : "123 string region", - "country" : "string country" + "case_identifier" : "INV3975227", + "address": { + "premise": "3000", + "address_line_1": "SYLVESTERucy AVENUE", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" }, - "case_identifier" : "123 string caseid", "company_names" : [ - "123 COMPANY NAME TEST" + "CONSORTIUM TECHNOLOGY LIMITED" ], - "court_name" : "123 string court name", - "disqualification_type" : "123 string disqualification type", - "disqualified_from" : "2022-03-03T12:51:00.767Z", - "disqualified_until" : "2022-03-04T12:51:00.767Z", - "heard_on" : "2022-03-01T12:51:00.767Z", + "court_name" : "Insolvency Service", + "disqualification_type" : "court-order", + "disqualified_from" : [2015,2,18], + "disqualified_until" : [2025,2,17], + "heard_on" : [2018,2,14], "undertaken_on" : null, - "reason" : { - "description_identifier" : "123 string description identifier", - "section" : "123 string section", - "act" : "123 string act", - "article" : "123 string article" + "last_variation":{ + "varied_on" : [2021,2,17], + "case_identifier" : "1", + "court_name" : "SWINDLERS" }, - "last_variation" : { - "court_name" : "string last variation court name", - "case_identifier" : "string last variation caseid", - "varied_on" : "2022-03-01" + "reason" : { + "act" : "company-directors-disqualification-northern-ireland-order-2002", + "description_identifier":"order-disqualifying-a-person-instructing-an-unfit-director-of-an-insolvent-company", + "article":"11A" } } ], - "links" : { - "self" : "123 link self" - } + "permissions_to_act": [ + { + "company_names" : ["123 LTD","321 LTD"], + "court_name" : "rinder", + "expires_on":[2016,4,12], + "granted_on":[2014,2,3], + "purpose":"ALPHABET" + } + ] }, "internal_data" : { - "delta_at" : "2022-04-11T11:18:00.768Z", - "officer_id" : "123 test officer id", - "officer_id_raw" : "123 test officer id raw", - "officer_disq_id" : "123 test officer disq id", - "officer_detail_id" : "123 test" + "delta_at" : 1.633706903383176E9, + "officer_id" : "1kETe9SJWIp9OlvZgO1xmjyt5_s", + "officer_id_raw" : "1234567890", + "officer_disq_id" : "3000034602", + "officer_detail_id" : "3002560732" } } \ No newline at end of file diff --git a/src/itest/resources/data/corporate_undertaking_in.json b/src/itest/resources/data/corporate_undertaking_in.json index 972cd32..f2eb7dc 100644 --- a/src/itest/resources/data/corporate_undertaking_in.json +++ b/src/itest/resources/data/corporate_undertaking_in.json @@ -3,7 +3,7 @@ {"corporate_ind":"true", "officer_disq_id": "3000034602", "external_number": "166284060001", - "officer_id": "rqaa9E", + "officer_id": "1234567890", "officer_detail_id": "3002560732", "date_of_birth": "19760206", "title": "", @@ -18,7 +18,7 @@ { "disq_eff_date": "20150218", "disq_end_date": "20250217", - "disq_type": "ORDER", + "disq_type": "UNDERTAKING", "hearing_date": "20180214", "section_of_the_act": "CDDO 1986 A11A", "court_ref": "INV3975227", diff --git a/src/itest/resources/data/corporate_undertaking_out.json b/src/itest/resources/data/corporate_undertaking_out.json index f407adf..ad117ca 100644 --- a/src/itest/resources/data/corporate_undertaking_out.json +++ b/src/itest/resources/data/corporate_undertaking_out.json @@ -1,59 +1,62 @@ { "external_data" : { - "person_number" : "person_number_123", - "date_of_birth" : "2022-03-05", - "etag" : "", - "title" : "string title", - "forename" : "string forename", - "other_forename" : "string other forename", - "surname" : "string surname", - "honours" : "string honours", - "nationality" : "string nationality", - "company_number" : "00000000", - "country_of_registration" : "string country", + "company_number" : "00053723", + "person_number" : "166284060001", + "country_of_registration" : "SCOTLAND", + "etag" : null, + "kind" : null, + "name" : "BABYLON INCORPORATION LIMITED", + "links" : { + "self" : "/disqualified-officers/corporate/1kETe9SJWIp9OlvZgO1xmjyt5_s" + }, "disqualifications" : [ { - "address" : { - "address_line_1" : "123 String Road", - "address_line_2" : "123 string line 2", - "locality" : "123 string locality", - "postal_code" : "123 string postcode", - "premises" : "123 string premise", - "region" : "123 string region", - "country" : "string country" + "case_identifier" : "INV3975227", + "address": { + "premise": "3000", + "address_line_1": "SYLVESTERucy AVENUE", + "address_line_2": "Skewen", + "locality": "Neath", + "region": "", + "country": "Wales", + "postal_code": "SA10 6RR" }, - "case_identifier" : "123 string caseid", "company_names" : [ - "123 COMPANY NAME TEST" + "CONSORTIUM TECHNOLOGY LIMITED" ], - "court_name" : "123 string court name", - "disqualification_type" : "123 string disqualification type", - "disqualified_from" : "2022-03-03T12:51:00.767Z", - "disqualified_until" : "2022-03-04T12:51:00.767Z", + "court_name" : null, + "disqualification_type" : "undertaking", + "disqualified_from" : [2015,2,18], + "disqualified_until" : [2025,2,17], "heard_on" : null, - "undertaken_on" : "2022-03-02T12:51:00.767Z", - "reason" : { - "description_identifier" : "123 string description identifier", - "section" : "123 string section", - "act" : "123 string act", - "article" : "123 string article" + "undertaken_on" : [2018,2,14], + "last_variation":{ + "varied_on" : [2021,2,17], + "case_identifier" : "1", + "court_name" : "SWINDLERS" }, - "last_variation" : { - "court_name" : "string last variation court name", - "case_identifier" : "string last variation caseid", - "varied_on" : "2022-03-01" + "reason" : { + "act" : "company-directors-disqualification-northern-ireland-order-2002", + "description_identifier":"order-disqualifying-a-person-instructing-an-unfit-director-of-an-insolvent-company", + "article":"11A" } } ], - "links" : { - "self" : "123 link self" - } + "permissions_to_act": [ + { + "company_names" : ["123 LTD","321 LTD"], + "court_name" : "rinder", + "expires_on":[2016,4,12], + "granted_on":[2014,2,3], + "purpose":"ALPHABET" + } + ] }, "internal_data" : { - "delta_at" : "2022-04-11T11:18:00.768Z", - "officer_id" : "123 test officer id", - "officer_id_raw" : "123 test officer id raw", - "officer_disq_id" : "123 test officer disq id", - "officer_detail_id" : "123 test" + "delta_at" : 1.633706903383176E9, + "officer_id" : "1kETe9SJWIp9OlvZgO1xmjyt5_s", + "officer_id_raw" : "1234567890", + "officer_disq_id" : "3000034602", + "officer_detail_id" : "3002560732" } } \ No newline at end of file diff --git a/src/itest/resources/data/natural_court_order_out.json b/src/itest/resources/data/natural_court_order_out.json index 7e2c75e..26b7703 100644 --- a/src/itest/resources/data/natural_court_order_out.json +++ b/src/itest/resources/data/natural_court_order_out.json @@ -27,8 +27,8 @@ "company_names" : [ "CONSORTIUM TECHNOLOGY LIMITED" ], - "court_name" : null, - "disqualification_type": "undertaking", + "court_name" : "Insolvency Service", + "disqualification_type": "court-order", "disqualified_from" : [2015,2,18], "disqualified_until" : [2025,2,17], "heard_on" : [2015,2,14], diff --git a/src/itest/resources/features/CorporateOfficer.feature b/src/itest/resources/features/CorporateOfficer.feature new file mode 100644 index 0000000..9d6c62e --- /dev/null +++ b/src/itest/resources/features/CorporateOfficer.feature @@ -0,0 +1,10 @@ +Feature: Corporate Officer + +Scenario Outline: Can transform and send a corporate officer of + Given the application is running + When the consumer receives a corporate disqualification of + Then a PUT request is sent to the disqualifications api with the transformed data + Examples: + | type | + | undertaking | + | court order | \ No newline at end of file diff --git a/src/itest/resources/features/NaturalOfficer.feature b/src/itest/resources/features/NaturalOfficer.feature index 5041bf2..748f71c 100644 --- a/src/itest/resources/features/NaturalOfficer.feature +++ b/src/itest/resources/features/NaturalOfficer.feature @@ -1,9 +1,10 @@ Feature: Natural Officer -Scenario Outline: Can transform and send a natural officer +Scenario Outline: Can transform and send a natural officer of Given the application is running When the consumer receives a natural disqualification of Then a PUT request is sent to the disqualifications api with the transformed data Examples: | type | - | undertaking | \ No newline at end of file + | undertaking | + | court order | \ No newline at end of file From 06f6b34477fce83ba04f34a987cffc48ea970afe Mon Sep 17 00:00:00 2001 From: amartin7663 Date: Mon, 25 Apr 2022 12:08:04 +0100 Subject: [PATCH 5/6] remove unused variable --- pom.xml | 6 +++--- .../delta/matcher/DisqualificationRequestMatcher.java | 4 ++++ .../disqualifiedofficers/delta/steps/CommonSteps.java | 2 -- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index cbc7de1..ad6151d 100644 --- a/pom.xml +++ b/pom.xml @@ -170,9 +170,9 @@ handlebars-helpers - net.javacrumbs.json-unit - json-unit-core - + net.javacrumbs.json-unit + json-unit-core + diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java index 92721be..378fe93 100644 --- a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/matcher/DisqualificationRequestMatcher.java @@ -9,6 +9,10 @@ import com.github.tomakehurst.wiremock.matching.ValueMatcher; import uk.gov.companieshouse.logging.Logger; +/** + * Custom matcher class used to match requests made by the consumer to the + * data api. The url, request type and request body are compared. + */ public class DisqualificationRequestMatcher implements ValueMatcher { private String expectedOutput; diff --git a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java index ddca20b..cd6c9e7 100644 --- a/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java +++ b/src/itest/java/uk/gov/companieshouse/disqualifiedofficers/delta/steps/CommonSteps.java @@ -28,8 +28,6 @@ public class CommonSteps { - private final static String ENCODED_OFFICER_ID = "1kETe9SJWIp9OlvZgO1xmjyt5_s"; - @Value("${disqualified-officers.delta.topic.main}") private String mainTopic; From 39126a2b8274f605e81debb6683d7e6766e12163 Mon Sep 17 00:00:00 2001 From: amartin7663 Date: Mon, 25 Apr 2022 14:05:02 +0100 Subject: [PATCH 6/6] improve in requests --- src/itest/resources/data/corporate_court_order_in.json | 3 +-- src/itest/resources/data/corporate_undertaking_in.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/itest/resources/data/corporate_court_order_in.json b/src/itest/resources/data/corporate_court_order_in.json index e7d5e89..c98fa97 100644 --- a/src/itest/resources/data/corporate_court_order_in.json +++ b/src/itest/resources/data/corporate_court_order_in.json @@ -1,11 +1,10 @@ { "disqualified_officer": [ - {"corporate_ind":"true", + {"corporate_ind" : "1", "officer_disq_id": "3000034602", "external_number": "166284060001", "officer_id": "1234567890", "officer_detail_id": "3002560732", - "date_of_birth": "19760206", "title": "", "forename": "", "middle_name": "", diff --git a/src/itest/resources/data/corporate_undertaking_in.json b/src/itest/resources/data/corporate_undertaking_in.json index f2eb7dc..42462c4 100644 --- a/src/itest/resources/data/corporate_undertaking_in.json +++ b/src/itest/resources/data/corporate_undertaking_in.json @@ -1,11 +1,10 @@ { "disqualified_officer": [ - {"corporate_ind":"true", + {"corporate_ind":"1", "officer_disq_id": "3000034602", "external_number": "166284060001", "officer_id": "1234567890", "officer_detail_id": "3002560732", - "date_of_birth": "19760206", "title": "", "forename": "", "middle_name": "",