use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridTcpSpiForwardingSelfTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings({ "IfMayBeConditional", "deprecation" })
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
if (ipFinderUseLocPorts)
ipFinder.setAddresses(Arrays.asList("127.0.0.1:" + locPort1, "127.0.0.1:" + locPort2));
else
ipFinder.setAddresses(Arrays.asList("127.0.0.1:" + extPort1, "127.0.0.1:" + extPort2));
TcpDiscoverySpi spi = new TcpDiscoverySpi();
final int locPort;
final int commLocPort;
if (getTestIgniteInstanceName(0).equals(igniteInstanceName)) {
locPort = locPort1;
commLocPort = commLocPort1;
} else if (getTestIgniteInstanceName(1).equals(igniteInstanceName)) {
locPort = locPort2;
commLocPort = commLocPort2;
} else
throw new IllegalArgumentException("Unknown Ignite instance name");
spi.setIpFinder(ipFinder);
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
spi.setLocalPort(locPort);
spi.setLocalPortRange(1);
cfg.setDiscoverySpi(spi);
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
TcpCommunicationSpi commSpi = new TcpCommunicationSpi() {
@Override
protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
Map<String, Object> attrs = new HashMap<>(node.attributes());
attrs.remove(createSpiAttributeName(ATTR_PORT));
((TcpDiscoveryNode) node).setAttributes(attrs);
return super.createTcpClient(node, connIdx);
}
};
commSpi.setLocalAddress("127.0.0.1");
commSpi.setLocalPort(commLocPort);
commSpi.setLocalPortRange(1);
commSpi.setSharedMemoryPort(-1);
commSpi.setConnectionsPerNode(1);
cfg.setCommunicationSpi(commSpi);
assert rslvr != null;
cfg.setAddressResolver(rslvr);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridSessionWaitAttributeSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(JOB_NUM * 2);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridSpiLocalHostInjectionTest method processTcpDiscoverySpiTestInjection.
/**
* Performs test of {@code localHost} resource injection for {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi}.
*
* @param cfgVal {@code true} if {@code localHost} should be set in configuration adapter.
* @param spiVal {@code true} if {@code localHost} should be set in SPI
* @param exp Expected value of {@code localHost} property in SPI after injection.
* @throws IgniteCheckedException If test fails.
*/
private void processTcpDiscoverySpiTestInjection(boolean cfgVal, boolean spiVal, @Nullable String exp) throws IgniteCheckedException {
GridResourceProcessor proc = getResourceProcessor(cfgVal);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
if (spiVal)
spi.setLocalAddress(SPI_LOCAL_ADDR_VALUE);
proc.inject(spi);
assertEquals("Invalid localAddr value after injection: ", exp, spi.getLocalAddress());
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridSessionSetJobAttributeSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridSessionSetFutureAttributeSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(discoSpi);
c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
return c;
}
Aggregations