Search in sources :

Example 1 with PartyHelper

use of com.quorum.tessera.test.PartyHelper in project tessera by ConsenSys.

the class OpenApiIT method setUp.

@Before
public void setUp() {
    PartyHelper partyHelper = PartyHelper.create();
    node = partyHelper.getParties().findFirst().get();
    client = node.getRestClient();
    LOGGER.debug("Begin test: {}", testName.getMethodName());
}
Also used : PartyHelper(com.quorum.tessera.test.PartyHelper)

Example 2 with PartyHelper

use of com.quorum.tessera.test.PartyHelper in project tessera by ConsenSys.

the class ReceiveIT method beforeTest.

// Persist a single transaction that can be used later
@Before
public void beforeTest() throws UnsupportedEncodingException {
    final PartyHelper partyHelper = PartyHelper.create();
    partyOne = partyHelper.findByAlias("A");
    partyTwo = partyHelper.findByAlias("B");
    SendRequest sendRequest = new SendRequest();
    sendRequest.setFrom(partyOne.getPublicKey());
    sendRequest.setTo(partyTwo.getPublicKey());
    sendRequest.setPayload(transactionData);
    final Response response = partyOne.getRestClient().target(partyOne.getQ2TUri()).path("/send").request().post(Entity.entity(sendRequest, MIME_TYPE_JSON_2_1));
    assertThat(response.getStatus()).isEqualTo(201);
    final SendResponse result = response.readEntity(SendResponse.class);
    final String hash = result.getKey();
    this.encodedHash = URLEncoder.encode(hash, UTF_8.toString());
    this.encodedSender = URLEncoder.encode(partyOne.getPublicKey(), UTF_8.toString());
    this.encodedRecipient = URLEncoder.encode(partyTwo.getPublicKey(), UTF_8.toString());
}
Also used : SendResponse(com.quorum.tessera.api.SendResponse) Response(jakarta.ws.rs.core.Response) ReceiveResponse(com.quorum.tessera.api.ReceiveResponse) SendRequest(com.quorum.tessera.api.SendRequest) SendResponse(com.quorum.tessera.api.SendResponse) PartyHelper(com.quorum.tessera.test.PartyHelper) Before(org.junit.Before)

Example 3 with PartyHelper

use of com.quorum.tessera.test.PartyHelper in project tessera by ConsenSys.

the class MetricsIT method metrics.

@Test
public void metrics() {
    final PartyHelper partyHelper = PartyHelper.create();
    Set<ServerConfig> serverConfigs = partyHelper.getParties().map(Party::getConfig).map(Config::getServerConfigs).flatMap(List::stream).collect(Collectors.toUnmodifiableSet());
    ClientFactory clientFactory = new ClientFactory();
    for (ServerConfig serverConfig : serverConfigs) {
        Client c = clientFactory.buildFrom(serverConfig);
        Response response = c.target(serverConfig.getServerUri()).path("metrics").request().get();
        assertThat(response).isNotNull();
        assertThat(response.getStatus()).isEqualTo(200);
    }
}
Also used : Response(jakarta.ws.rs.core.Response) ServerConfig(com.quorum.tessera.config.ServerConfig) Config(com.quorum.tessera.config.Config) ServerConfig(com.quorum.tessera.config.ServerConfig) ClientFactory(com.quorum.tessera.jaxrs.client.ClientFactory) PartyHelper(com.quorum.tessera.test.PartyHelper) Client(jakarta.ws.rs.client.Client) Test(org.junit.Test)

Aggregations

PartyHelper (com.quorum.tessera.test.PartyHelper)3 Response (jakarta.ws.rs.core.Response)2 ReceiveResponse (com.quorum.tessera.api.ReceiveResponse)1 SendRequest (com.quorum.tessera.api.SendRequest)1 SendResponse (com.quorum.tessera.api.SendResponse)1 Config (com.quorum.tessera.config.Config)1 ServerConfig (com.quorum.tessera.config.ServerConfig)1 ClientFactory (com.quorum.tessera.jaxrs.client.ClientFactory)1 Client (jakarta.ws.rs.client.Client)1 Before (org.junit.Before)1 Test (org.junit.Test)1