Search in sources :

Example 1 with NodeInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO in project nem2-sdk-java by nemtech.

the class NodeRepositoryOkVertxImplTest method shouldGetNode.

@Test
public void shouldGetNode() throws Exception {
    NodeInfoDTO dto = new NodeInfoDTO();
    dto.setPort(3000);
    dto.setHost("http://hostname");
    dto.setFriendlyName("friendlyName");
    dto.setNetworkIdentifier(104);
    dto.setRoles(2);
    dto.setVersion(1234);
    dto.setPublicKey("somePublicKey");
    dto.setNetworkGenerationHashSeed("abc");
    mockRemoteCall(dto);
    NodeInfo info = repository.getNodeInfo().toFuture().get();
    Assertions.assertNotNull(info);
    Assertions.assertEquals(dto.getPort().intValue(), info.getPort());
    Assertions.assertEquals(dto.getHost(), info.getHost());
    Assertions.assertEquals(dto.getPublicKey(), info.getPublicKey());
    Assertions.assertEquals(dto.getFriendlyName(), info.getFriendlyName());
    Assertions.assertEquals(NetworkType.MAIN_NET, info.getNetworkIdentifier());
    Assertions.assertEquals(Collections.singletonList(RoleType.API_NODE), info.getRoles());
    Assertions.assertEquals(dto.getVersion().intValue(), info.getVersion());
    Assertions.assertEquals(dto.getNetworkGenerationHashSeed(), info.getNetworkGenerationHashSeed());
}
Also used : NodeInfo(io.nem.symbol.sdk.model.node.NodeInfo) NodeInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO) Test(org.junit.jupiter.api.Test)

Example 2 with NodeInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO in project nem2-sdk-java by nemtech.

the class NetworkRepositoryVertxImplTest method shouldGetNetworkType.

@Test
void shouldGetNetworkType() throws Exception {
    NodeInfoDTO dto = new NodeInfoDTO();
    dto.setNetworkIdentifier(NetworkType.MIJIN_TEST.getValue());
    mockRemoteCall(dto);
    NetworkType info = repository.getNetworkType().toFuture().get();
    Assertions.assertNotNull(info);
    Assertions.assertEquals(NetworkType.MIJIN_TEST, info);
}
Also used : NetworkType(io.nem.symbol.sdk.model.network.NetworkType) NodeInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO) Test(org.junit.jupiter.api.Test)

Example 3 with NodeInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO in project nem2-sdk-java by nemtech.

the class NodeRepositoryOkVertxImplTest method getNodePeers.

@Test
public void getNodePeers() throws Exception {
    NodeInfoDTO dto = new NodeInfoDTO();
    dto.setPort(3000);
    dto.setHost("http://hostname");
    dto.setFriendlyName("friendlyName");
    dto.setNetworkIdentifier(104);
    dto.setRoles(2);
    dto.setVersion(1234);
    dto.setPublicKey("somePublicKey");
    dto.setNetworkGenerationHashSeed("abc");
    mockRemoteCall(Arrays.asList(dto));
    NodeInfo info = repository.getNodePeers().toFuture().get().get(0);
    Assertions.assertNotNull(info);
    Assertions.assertEquals(dto.getPort().intValue(), info.getPort());
    Assertions.assertEquals(dto.getHost(), info.getHost());
    Assertions.assertEquals(dto.getPublicKey(), info.getPublicKey());
    Assertions.assertEquals(dto.getFriendlyName(), info.getFriendlyName());
    Assertions.assertEquals(NetworkType.MAIN_NET, info.getNetworkIdentifier());
    Assertions.assertEquals(Collections.singletonList(RoleType.API_NODE), info.getRoles());
    Assertions.assertEquals(dto.getVersion().intValue(), info.getVersion());
    Assertions.assertEquals(dto.getNetworkGenerationHashSeed(), info.getNetworkGenerationHashSeed());
}
Also used : NodeInfo(io.nem.symbol.sdk.model.node.NodeInfo) NodeInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO) Test(org.junit.jupiter.api.Test)

Aggregations

NodeInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO)3 Test (org.junit.jupiter.api.Test)3 NodeInfo (io.nem.symbol.sdk.model.node.NodeInfo)2 NetworkType (io.nem.symbol.sdk.model.network.NetworkType)1