Bumping versions

This commit is contained in:
buildmaster
2020-09-17 00:23:53 +00:00
parent 3a1e3c9640
commit ffd6574532
460 changed files with 3789 additions and 6477 deletions

View File

@@ -51,22 +51,19 @@ public class LoanApplicationService {
return buildResponseFromFraudResult(response);
}
private FraudServiceResponse sendRequestToFraudDetectionService(
FraudServiceRequest request) {
private FraudServiceResponse sendRequestToFraudDetectionService(FraudServiceRequest request) {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add(HttpHeaders.CONTENT_TYPE, FRAUD_SERVICE_JSON_VERSION_1);
// tag::client_call_server[]
ResponseEntity<FraudServiceResponse> response = this.restTemplate.exchange(
this.fraudUrl + "/fraudcheck", HttpMethod.PUT,
new HttpEntity<>(request, httpHeaders), FraudServiceResponse.class);
ResponseEntity<FraudServiceResponse> response = this.restTemplate.exchange(this.fraudUrl + "/fraudcheck",
HttpMethod.PUT, new HttpEntity<>(request, httpHeaders), FraudServiceResponse.class);
// end::client_call_server[]
return response.getBody();
}
private LoanApplicationResult buildResponseFromFraudResult(
FraudServiceResponse response) {
private LoanApplicationResult buildResponseFromFraudResult(FraudServiceResponse response) {
LoanApplicationStatus applicationStatus = null;
if (FraudCheckStatus.OK == response.getFraudCheckStatus()) {
applicationStatus = LoanApplicationStatus.LOAN_APPLIED;
@@ -75,8 +72,7 @@ public class LoanApplicationService {
applicationStatus = LoanApplicationStatus.LOAN_APPLICATION_REJECTED;
}
return new LoanApplicationResult(applicationStatus,
response.getRejectionReason());
return new LoanApplicationResult(applicationStatus, response.getRejectionReason());
}
public void setFraudUrl(String fraudUrl) {

View File

@@ -25,8 +25,7 @@ public class LoanApplicationResult {
public LoanApplicationResult() {
}
public LoanApplicationResult(LoanApplicationStatus loanApplicationStatus,
String rejectionReason) {
public LoanApplicationResult(LoanApplicationStatus loanApplicationStatus, String rejectionReason) {
this.loanApplicationStatus = loanApplicationStatus;
this.rejectionReason = rejectionReason;
}

View File

@@ -35,10 +35,9 @@ public class FailFastLoanApplicationServiceTests {
@Test
public void shouldFailToStartContextWhenNoStubCanBeFound() {
// When
final Throwable throwable = catchThrowable(() -> new SpringApplicationBuilder(
Application.class, StubRunnerConfiguration.class)
.properties(ImmutableMap.of("stubrunner.stubsMode", "REMOTE",
"stubrunner.repositoryRoot",
final Throwable throwable = catchThrowable(
() -> new SpringApplicationBuilder(Application.class, StubRunnerConfiguration.class)
.properties(ImmutableMap.of("stubrunner.stubsMode", "REMOTE", "stubrunner.repositoryRoot",
"classpath:m2repo/repository/", "stubrunner.ids",
new String[] {
"org.springframework.cloud.contract.verifier.stubs:should-not-be-found" }))
@@ -46,26 +45,23 @@ public class FailFastLoanApplicationServiceTests {
// Then
assertThat(throwable).isInstanceOf(BeanCreationException.class);
assertThat(throwable.getCause().getCause())
.isInstanceOf(BeanInstantiationException.class).hasMessageContaining(
"No stubs or contracts were found for [org.springframework.cloud.contract.verifier.stubs:should-not-be-found:+:stubs] and the switch to fail on no stubs was set.");
assertThat(throwable.getCause().getCause()).isInstanceOf(BeanInstantiationException.class).hasMessageContaining(
"No stubs or contracts were found for [org.springframework.cloud.contract.verifier.stubs:should-not-be-found:+:stubs] and the switch to fail on no stubs was set.");
}
@Test
public void shouldNotTryAndWorkOfflineWhenRemoteModeIsOn() {
// When
final Throwable throwable = catchThrowable(() -> new SpringApplicationBuilder(
Application.class, StubRunnerConfiguration.class)
.properties(ImmutableMap.of("stubrunner.stubsMode", "CLASSPATH",
"stubrunner.ids",
final Throwable throwable = catchThrowable(
() -> new SpringApplicationBuilder(Application.class, StubRunnerConfiguration.class)
.properties(ImmutableMap.of("stubrunner.stubsMode", "CLASSPATH", "stubrunner.ids",
new String[] {
"org.springframework.cloud.contract.verifier.stubs:should-not-be-found" }))
.run());
// Then
assertThat(throwable).isInstanceOf(BeanCreationException.class);
assertThat(throwable.getCause().getCause())
.isInstanceOf(BeanInstantiationException.class)
assertThat(throwable.getCause().getCause()).isInstanceOf(BeanInstantiationException.class)
.hasMessageContaining("No stubs were found on classpath ");
}

View File

@@ -39,8 +39,8 @@ import static org.assertj.core.api.Assertions.assertThat;
// tag::autoconfigure_stubrunner[]
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@AutoConfigureStubRunner(repositoryRoot = "classpath:m2repo/repository/", ids = {
"org.springframework.cloud.contract.verifier.stubs:contextPathFraudDetectionServer" },
@AutoConfigureStubRunner(repositoryRoot = "classpath:m2repo/repository/",
ids = { "org.springframework.cloud.contract.verifier.stubs:contextPathFraudDetectionServer" },
stubsMode = StubRunnerProperties.StubsMode.REMOTE)
public class LoanApplicationServiceTests {
@@ -58,14 +58,13 @@ public class LoanApplicationServiceTests {
@Before
public void setPort() {
this.service.setFraudUrl(
this.stubFinder.findStubUrl("contextPathFraudDetectionServer").toString()
+ "/fraud-path/");
this.stubFinder.findStubUrl("contextPathFraudDetectionServer").toString() + "/fraud-path/");
}
@Test
public void shouldStartThisAppWithContextPath() {
String response = new RestTemplate().getForObject(
"http://localhost:" + this.port + "/my-path/foo", String.class);
String response = new RestTemplate().getForObject("http://localhost:" + this.port + "/my-path/foo",
String.class);
assertThat(response).isNotEmpty();
}
@@ -73,13 +72,11 @@ public class LoanApplicationServiceTests {
@Test
public void shouldSuccessfullyApplyForLoan() {
// given:
LoanApplication application = new LoanApplication(new Client("1234567890"),
123.123);
LoanApplication application = new LoanApplication(new Client("1234567890"), 123.123);
// when:
LoanApplicationResult loanApplication = this.service.loanApplication(application);
// then:
assertThat(loanApplication.getLoanApplicationStatus())
.isEqualTo(LoanApplicationStatus.LOAN_APPLIED);
assertThat(loanApplication.getLoanApplicationStatus()).isEqualTo(LoanApplicationStatus.LOAN_APPLIED);
assertThat(loanApplication.getRejectionReason()).isNull();
}
@@ -87,8 +84,7 @@ public class LoanApplicationServiceTests {
@Test
public void shouldBeRejectedDueToAbnormalLoanAmount() {
// given:
LoanApplication application = new LoanApplication(new Client("1234567890"),
99999);
LoanApplication application = new LoanApplication(new Client("1234567890"), 99999);
// when:
LoanApplicationResult loanApplication = this.service.loanApplication(application);
// then: