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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations