use of org.apache.ignite.configuration.BasicAddressResolver in project ignite by apache.
the class GridTcpSpiForwardingSelfTest method testBasicResolverMapAddress.
/**
* @throws Exception If failed.
*/
@Test
public void testBasicResolverMapAddress() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("127.0.0.1", "127.0.0.1");
rslvr = new BasicAddressResolver(map);
ipFinderUseLocPorts = true;
doTestForward();
}
use of org.apache.ignite.configuration.BasicAddressResolver in project ignite by apache.
the class GridTcpSpiForwardingSelfTest method testBasicResolverErrors.
/**
* @throws Exception If failed.
*/
@Test
public void testBasicResolverErrors() throws Exception {
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
return new BasicAddressResolver(null);
}
}, IllegalArgumentException.class, "At least one address mapping is required.");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
return new BasicAddressResolver(new HashMap<String, String>());
}
}, IllegalArgumentException.class, "At least one address mapping is required.");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("from", null);
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: from=null");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("from", "");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: from=");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put(null, "to");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: null=to");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("", "to");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: =to");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("from", "to:1111");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: from=to:1111");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("from:1111", "to");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: from:1111=to");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("from:1111:2222", "to:1111");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: from:1111:2222=to:1111");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override
public Object call() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("from:1111", "to:1111:2222");
return new BasicAddressResolver(map);
}
}, IllegalArgumentException.class, "Invalid address mapping: from:1111=to:1111:2222");
}
use of org.apache.ignite.configuration.BasicAddressResolver in project ignite by apache.
the class GridTcpSpiForwardingSelfTest method testBasicResolverMapPorts.
/**
* @throws Exception If failed.
*/
@Test
public void testBasicResolverMapPorts() throws Exception {
Map<String, String> map = new HashMap<>();
map.put("127.0.0.1:" + locPort1, "127.0.0.1:" + extPort1);
map.put("127.0.0.1:" + commLocPort1, "127.0.0.1:" + commExtPort1);
map.put("127.0.0.1:" + locPort2, "127.0.0.1:" + extPort2);
map.put("127.0.0.1:" + commLocPort2, "127.0.0.1:" + commExtPort2);
rslvr = new BasicAddressResolver(map);
doTestForward();
}
Aggregations