Search in sources :

Example 1 with NodeInfo

use of io.nem.symbol.sdk.model.node.NodeInfo in project nem2-sdk-java by nemtech.

the class NodeRepositoryOkHttpImplTest 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.okhttp_gson.model.NodeInfoDTO) Test(org.junit.jupiter.api.Test)

Example 2 with NodeInfo

use of io.nem.symbol.sdk.model.node.NodeInfo 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 3 with NodeInfo

use of io.nem.symbol.sdk.model.node.NodeInfo in project nem2-sdk-java by nemtech.

the class NodeRepositoryOkHttpImplTest 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(Collections.singletonList(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.okhttp_gson.model.NodeInfoDTO) Test(org.junit.jupiter.api.Test)

Example 4 with NodeInfo

use of io.nem.symbol.sdk.model.node.NodeInfo 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)

Example 5 with NodeInfo

use of io.nem.symbol.sdk.model.node.NodeInfo in project nem2-sdk-java by nemtech.

the class NodeRepositoryIntegrationTest method getNodeInfo.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void getNodeInfo(RepositoryType type) {
    NodeInfo nodeInfo = get(getNodeRepository(type).getNodeInfo());
    assertTrue(!nodeInfo.getPublicKey().equals(""));
    assertNotNull(nodeInfo.getHost());
    assertTrue(nodeInfo.getPort() > 0);
    assertTrue(nodeInfo.getNetworkIdentifier().getValue() > 0);
    assertEquals(getGenerationHash(), nodeInfo.getNetworkGenerationHashSeed());
}
Also used : NodeInfo(io.nem.symbol.sdk.model.node.NodeInfo) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

NodeInfo (io.nem.symbol.sdk.model.node.NodeInfo)5 Test (org.junit.jupiter.api.Test)4 NodeInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.NodeInfoDTO)2 NodeInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.NodeInfoDTO)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1