Skip to content

Commit 5327d19

Browse files
committed
fix(companieshouseapi): #346 update the gov companieshouse url in config
fix(build.gradle): #346 revert logback 1.5.13 version to fix parse error
1 parent be75463 commit 5327d19

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ updates:
1212
open-pull-requests-limit: 10
1313
commit-message:
1414
prefix: ci
15-
include: scope
15+
include: scope

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [1.1 Unit Test](#11-unit-test)
1515
- [1.2 Cucumber End to End Test](#12-cucumber-end-to-end-test)
1616
- [1.3 Mutation Testing](#13-mutation-testing)
17+
- [1.4 Local Testing](#14-local-testing)
1718
- [2. Development Accelerators](#2-development-accelerators)
1819
- [2.1 Mapstruct](#21-mapstruct)
1920
- [2.2 Lombok](#22-lombok)
@@ -49,25 +50,17 @@
4950

5051
### Introduction
5152

52-
This project is intended to bring arguably best practices and integrations available for Spring Boot based Microservice
53-
in a single repository.
53+
This repository combines the best practices and essential integrations for building robust Spring Boot-based microservices, all in one place. It serves as a template, allowing developers to easily create their own microservices by adding or removing dependencies based on their needs.
5454

55-
Developers can use this repository as a template to build there own Microservice by adding or removing dependencies as
56-
per requirement.
55+
In the sections below, I'll walk you through the various integrations included in the project and guide you on how to use them effectively.
5756

58-
In the below section I will try to explain each integration we have made and how to use.
59-
60-
At the moment the Microservice exposes a GET API and expects the company reference as path parameter then makes a call
61-
to the Companies House API hence returning Company Details.
62-
63-
**Note: Texts highlighted in light blue colour are clickable hyperlinks for additional references.**
57+
Currently, the microservice exposes a simple GET API that accepts a company reference as a path parameter. It then queries the Companies House API to retrieve and return detailed company information.
6458

6559
### Prerequisites
6660

6761
- You must have >= Java 21 Installed. You can use [SDKMAN](https://sdkman.io/install) for maintaining different JDK's in your system.
68-
- If you wish to run the application against the actual Companies House
69-
API and then you will need to [create a free account](https://developer.companieshouse.gov.uk/developer/signin).
70-
Once created replace the `authUserName` in the [application.yaml](src/main/resources/application.yaml) under main dir.
62+
- You should [register for a free Companies House account](https://developer.company-information.service.gov.uk/get-started) and then generate a REST API key. This is required for invoking the GET API exposed by this service else the API invocation will fail at runtime with auth error.
63+
- Replace the `authUserName` in the [application.yaml](src/main/resources/application.yaml) under main dir with the newly created API Key.
7164

7265
### Installation and Getting Started
7366

@@ -172,6 +165,22 @@ once the test execution completes report should be accessible at:
172165

173166
![](doc-resources/images/pitest-report.png)
174167

168+
#### 1.4 Local Testing
169+
170+
The application can be started in the IDE through [CompaniesHouseApplication.java](src/main/java/com/uk/companieshouse/CompaniesHouseApplication.java) or by executing below command in the terminal
171+
172+
```bash
173+
./gradlew bootRun
174+
```
175+
176+
Once the application starts the application can be accessed through below URL:
177+
178+
```
179+
curl --location 'http://localhost:8080/companieshouse/search/abhishek'
180+
```
181+
182+
If valid Rest API Key is added in `authUserName` then we should receive all the companies details that has `abhishek` in their registered **title**
183+
175184
### 2. Development Accelerators
176185

177186
#### [2.1 Mapstruct](https://mapstruct.org/)

build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ dependencies {
3737
implementation 'org.springframework.boot:spring-boot-starter-web'
3838
implementation 'org.springframework.boot:spring-boot-starter-actuator'
3939
testImplementation('org.springframework.boot:spring-boot-starter-test')
40-
// Upgrade transient vulnerabilities to fix vulnerabilities
41-
configurations.all {
42-
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
43-
// https://docs.gradle.org/current/userguide/resolution_rules.html
44-
if (details.requested.group == 'ch.qos.logback' && details.requested.name == 'logback-classic') {
45-
details.useVersion '1.5.13'
46-
}
47-
}
48-
}
4940
// Cucumber Dependencies for BDD
5041
testImplementation "io.cucumber:cucumber-java:${ioCucumberVersion}"
5142
testImplementation "io.cucumber:cucumber-junit:${ioCucumberVersion}"

src/main/java/com/uk/companieshouse/connector/CompaniesHouseConnector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public CompaniesHouseGovUKResponse getCompaniesHouseDetails(String crn) {
3333
restTemplate.getInterceptors().add(
3434
new BasicAuthenticationInterceptor(authUsername, ""));
3535

36-
log.debug("CompaniesHouseConnector:getCompaniesHouseDetails: Make External call to {} with CRN {}",
36+
log.debug("CompaniesHouseConnector:getCompaniesHouseDetails: Make External call to: {} with CRN: {}",
3737
govCompaniesHouseEndpoint, crn);
3838
ResponseEntity<CompaniesHouseGovUKResponse> responseEntity = restTemplate
3939
.getForEntity(govCompaniesHouseEndpoint, CompaniesHouseGovUKResponse.class, crn);

src/main/resources/application.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ logging:
1919
companieshouse: DEBUG
2020

2121
govCompaniesHouse:
22-
endpoint: https://api.companieshouse.gov.uk/search/companies?q={companyRef}
22+
endpoint: https://api.company-information.service.gov.uk/search/companies?q={crn}
2323
authUserName: dummy-auth-user

0 commit comments

Comments
 (0)