SpringBoot: rename VirtualNodes to VirtualNodeList
This commit is contained in:
parent
806c619588
commit
07970f31b2
@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import djmil.cordacheckers.cordaclient.dao.VirtualNode;
|
||||
import djmil.cordacheckers.cordaclient.dao.VirtualNodes;
|
||||
import djmil.cordacheckers.cordaclient.dao.VirtualNodeList;
|
||||
|
||||
@Service
|
||||
public class CordaClient {
|
||||
@ -33,11 +33,11 @@ public class CordaClient {
|
||||
// Request
|
||||
final HttpEntity<String> request = new HttpEntity<>(headers);
|
||||
|
||||
ResponseEntity<VirtualNodes> resp = this.restTemplate.exchange(
|
||||
ResponseEntity<VirtualNodeList> resp = this.restTemplate.exchange(
|
||||
"https://localhost:8888/api/v1/virtualnode",
|
||||
HttpMethod.GET,
|
||||
request,
|
||||
VirtualNodes.class );
|
||||
VirtualNodeList.class );
|
||||
|
||||
// TODO: throw exeption instead
|
||||
if (resp.getStatusCode() != HttpStatus.OK || !resp.hasBody()) {
|
||||
|
@ -5,4 +5,4 @@ import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record VirtualNodes(List<VirtualNode> virtualNodes) { }
|
||||
public record VirtualNodeList(List<VirtualNode> virtualNodes) { }
|
@ -28,6 +28,7 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import djmil.cordacheckers.cordaclient.dao.HoldingIdentity;
|
||||
import djmil.cordacheckers.cordaclient.dao.VirtualNodeList;
|
||||
import djmil.cordacheckers.cordaclient.dao.VirtualNodes;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -80,19 +81,19 @@ class CordacheckersApplicationTests {
|
||||
// Request
|
||||
final HttpEntity<String> request = new HttpEntity<>(headers);
|
||||
|
||||
final ResponseEntity<VirtualNodes> response = new RestTemplate(requestFactory)
|
||||
.exchange("https://localhost:8888/api/v1/virtualnode", HttpMethod.GET, request, VirtualNodes.class);
|
||||
final ResponseEntity<VirtualNodeList> response = new RestTemplate(requestFactory)
|
||||
.exchange("https://localhost:8888/api/v1/virtualnode", HttpMethod.GET, request, VirtualNodeList.class);
|
||||
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(response.hasBody());
|
||||
|
||||
VirtualNodes vNode = response.getBody();
|
||||
assertThat(vNode).isNotNull();
|
||||
if (vNode != null) {
|
||||
assertThat(vNode.virtualNodes().size() == 5);
|
||||
VirtualNodeList vNodeList = response.getBody();
|
||||
assertThat(vNodeList).isNotNull();
|
||||
if (vNodeList != null) {
|
||||
assertThat(vNodeList.virtualNodes().size() == 5);
|
||||
}
|
||||
|
||||
HoldingIdentity identity = vNode.virtualNodes().get(0).holdingIdentity();
|
||||
HoldingIdentity identity = vNodeList.virtualNodes().get(0).holdingIdentity();
|
||||
assertThat(identity.x500Name().contains("NotaryRep1"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user