Search in sources :

Example 1 with Peer

use of com.quorum.tessera.config.Peer in project tessera by ConsenSys.

the class PicoCliDelegateTest method overridePeers.

@Test
public void overridePeers() throws Exception {
    Path configFile = Paths.get(getClass().getResource("/sample-config.json").toURI());
    CliResult result = cliDelegate.execute("-configfile", configFile.toString(), "-o", "peer[2].url=http://anotherpeer", "--override", "peer[3].url=http://yetanotherpeer");
    assertThat(result).isNotNull();
    assertThat(result.getConfig()).isPresent();
    assertThat(result.getConfig().get().getPeers()).hasSize(4);
    assertThat(result.getConfig().get().getPeers().stream().map(Peer::getUrl)).containsExactlyInAnyOrder("http://anotherpeer", "http://yetanotherpeer", "http://bogus1.com", "http://bogus2.com");
}
Also used : Path(java.nio.file.Path) CliResult(com.quorum.tessera.cli.CliResult) Peer(com.quorum.tessera.config.Peer) Test(org.junit.Test)

Example 2 with Peer

use of com.quorum.tessera.config.Peer in project tessera by ConsenSys.

the class AdminConfigIT method addPeer.

@Test
public void addPeer() {
    Party party = partyHelper.getParties().findAny().get();
    String url = "http://" + UUID.randomUUID().toString().replaceAll("-", "");
    Peer peer = new Peer(url);
    Response response = client.target(party.getAdminUri()).path("config").path("peers").request(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).put(Entity.entity(peer, MediaType.APPLICATION_JSON));
    assertThat(response.getStatus()).isEqualTo(201);
    URI location = response.getLocation();
    Response queryResponse = client.target(location).request(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).get();
    assertThat(queryResponse.getStatus()).isEqualTo(200);
    assertThat(queryResponse.readEntity(Peer.class)).isEqualTo(peer);
}
Also used : Response(jakarta.ws.rs.core.Response) Party(com.quorum.tessera.test.Party) Peer(com.quorum.tessera.config.Peer) URI(java.net.URI) Test(org.junit.Test)

Aggregations

Peer (com.quorum.tessera.config.Peer)2 Test (org.junit.Test)2 CliResult (com.quorum.tessera.cli.CliResult)1 Party (com.quorum.tessera.test.Party)1 Response (jakarta.ws.rs.core.Response)1 URI (java.net.URI)1 Path (java.nio.file.Path)1