use of org.wildfly.clustering.server.group.AddressableNode in project wildfly by wildfly.
the class KeyMapperTestCase method test.
@Test
public void test() throws UnknownHostException {
TwoWayKey2StringMapper mapper = new KeyMapper();
Assert.assertTrue(mapper.isSupportedType(LocalNode.class));
Assert.assertTrue(mapper.isSupportedType(AddressableNode.class));
Assert.assertTrue(mapper.isSupportedType(ServiceName.class));
Set<String> formatted = new HashSet<>();
Node localNode = new LocalNode("cluster", "node");
String mappedLocalNode = mapper.getStringMapping(localNode);
Assert.assertEquals(localNode, mapper.getKeyMapping(mappedLocalNode));
Assert.assertTrue(formatted.add(mappedLocalNode));
Node addressableNode = new AddressableNode(UUID.randomUUID(), "node", new InetSocketAddress(InetAddress.getLocalHost(), 0));
String mappedAddressableNode = mapper.getStringMapping(addressableNode);
Assert.assertEquals(addressableNode, mapper.getKeyMapping(mappedAddressableNode));
Assert.assertTrue(formatted.add(mappedAddressableNode));
ServiceName serviceName = ServiceName.of("node");
String mappedServiceName = mapper.getStringMapping(serviceName);
Assert.assertEquals(serviceName, mapper.getKeyMapping(mappedServiceName));
Assert.assertTrue(formatted.add(mappedServiceName));
}
Aggregations