Bumping versions

This commit is contained in:
buildmaster
2020-09-18 11:47:22 +00:00
parent 3126157493
commit 7f6ddf69c5
111 changed files with 1272 additions and 2007 deletions

View File

@@ -50,12 +50,10 @@ public class LeaderController {
@GetMapping
public String getInfo() {
if (this.context == null) {
return String.format("I am '%s' but I am not a leader of the '%s'", this.host,
this.role);
return String.format("I am '%s' but I am not a leader of the '%s'", this.host, this.role);
}
return String.format("I am '%s' and I am the leader of the '%s'", this.host,
this.role);
return String.format("I am '%s' and I am the leader of the '%s'", this.host, this.role);
}
/**
@@ -68,8 +66,7 @@ public class LeaderController {
@PutMapping
public ResponseEntity<String> revokeLeadership() {
if (this.context == null) {
String message = String.format(
"Cannot revoke leadership because '%s' is not a leader", this.host);
String message = String.format("Cannot revoke leadership because '%s' is not a leader", this.host);
return ResponseEntity.badRequest().body(message);
}

View File

@@ -60,8 +60,7 @@ public class LeaderControllerTest {
@Test
public void shouldGetNonLeaderInfo() {
String message = String.format("I am '%s' but I am not a leader of the 'null'",
this.host);
String message = String.format("I am '%s' but I am not a leader of the 'null'", this.host);
assertThat(this.leaderController.getInfo()).isEqualTo(message);
}
@@ -71,8 +70,7 @@ public class LeaderControllerTest {
this.leaderController.handleEvent(this.mockOnGrantedEvent);
String message = String.format("I am '%s' and I am the leader of the 'null'",
this.host);
String message = String.format("I am '%s' and I am the leader of the 'null'", this.host);
assertThat(this.leaderController.getInfo()).isEqualTo(message);
}
@@ -83,8 +81,7 @@ public class LeaderControllerTest {
this.leaderController.handleEvent(this.mockOnGrantedEvent);
this.leaderController.handleEvent(this.mockOnRevokedEvent);
String message = String.format("I am '%s' but I am not a leader of the 'null'",
this.host);
String message = String.format("I am '%s' but I am not a leader of the 'null'", this.host);
assertThat(this.leaderController.getInfo()).isEqualTo(message);
}
@@ -105,8 +102,7 @@ public class LeaderControllerTest {
public void shouldNotRevokeLeadershipIfNotLeader() {
ResponseEntity<String> responseEntity = this.leaderController.revokeLeadership();
String message = String.format(
"Cannot revoke leadership because '%s' is not a leader", this.host);
String message = String.format("Cannot revoke leadership because '%s' is not a leader", this.host);
assertThat(responseEntity.getBody()).isEqualTo(message);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
verify(this.mockContext, times(0)).yield();

View File

@@ -50,10 +50,8 @@ public class GreetingController {
* @return Greeting string.
*/
@GetMapping("/greeting")
public Mono<String> getGreeting(
@RequestParam(value = "delay", defaultValue = "0") int delay) {
return nameService.getName(delay)
.map(name -> String.format("Hello from %s!", name));
public Mono<String> getGreeting(@RequestParam(value = "delay", defaultValue = "0") int delay) {
return nameService.getName(delay).map(name -> String.format("Hello from %s!", name));
}
}

View File

@@ -37,8 +37,7 @@ public class NameService {
}
public Mono<String> getName(int delay) {
return webClient.get()
.uri(String.format("http://name-service/name?delay=%d", delay)).retrieve()
return webClient.get().uri(String.format("http://name-service/name?delay=%d", delay)).retrieve()
.bodyToMono(String.class);
}

View File

@@ -50,10 +50,8 @@ public class NameController {
* @return Host name.
*/
@GetMapping("/name")
public Mono<String> getName(
@RequestParam(value = "delay", defaultValue = "0") int delayValue) {
LOG.info(String.format("Returning a name '%s' with a delay '%d'", hostName,
delayValue));
public Mono<String> getName(@RequestParam(value = "delay", defaultValue = "0") int delayValue) {
LOG.info(String.format("Returning a name '%s' with a delay '%d'", hostName, delayValue));
delay(delayValue);
return Mono.just(hostName);
}