use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridSpringBeanSerializationSelfTest method config.
/**
* @return Grid configuration.
*/
private IgniteConfiguration config() {
IgniteConfiguration cfg = new IgniteConfiguration();
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setUserAttributes(F.asMap(ATTR_KEY, true));
cfg.setConnectorConfiguration(null);
cfg.setIgniteInstanceName(getTestIgniteInstanceName());
cfg.setBinaryConfiguration(new BinaryConfiguration());
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class ComputeFailoverNodeStartup method configuration.
/**
* Create Ignite configuration with configured checkpoints.
*
* @return Ignite configuration.
* @throws IgniteException If configuration creation failed.
*/
public static IgniteConfiguration configuration() throws IgniteException {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setLocalHost("127.0.0.1");
cfg.setPeerClassLoadingEnabled(true);
// Configure checkpoint SPI.
SharedFsCheckpointSpi checkpointSpi = new SharedFsCheckpointSpi();
checkpointSpi.setDirectoryPaths(Collections.singletonList("work/checkpoint/sharedfs"));
cfg.setCheckpointSpi(checkpointSpi);
// Configure discovery SPI.
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridManagerLocalMessageListenerSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
c.setDiscoverySpi(discoSpi);
TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
c.setCommunicationSpi(commSpi);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridManagerMxBeanIllegalArgumentHandleTest method testIllegalStateIsCatch.
/**
* Creates minimal disco manager mock, checks illegal state is not propagated
*/
public void testIllegalStateIsCatch() {
final IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setDiscoverySpi(new TcpDiscoverySpi());
final IgniteLogger log = Mockito.mock(IgniteLogger.class);
final GridKernalContext ctx = Mockito.mock(GridKernalContext.class);
when(ctx.config()).thenReturn(cfg);
when(ctx.log(Mockito.anyString())).thenReturn(log);
when(ctx.log(Mockito.any(Class.class))).thenReturn(log);
final GridDiscoveryManager mgr = new GridDiscoveryManager(ctx);
final long nHeapMax = mgr.metrics().getNonHeapMemoryMaximum();
if (correctSetupOfTestPerformed)
assertEquals(0, nHeapMax);
final long heapMax = mgr.metrics().getHeapMemoryMaximum();
if (correctSetupOfTestPerformed)
assertEquals(0, heapMax);
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class GridCheckpointManagerAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
assert igniteInstanceName != null;
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
if (igniteInstanceName.contains("cache")) {
String cacheName = "test-checkpoints";
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
CacheCheckpointSpi spi = new CacheCheckpointSpi();
spi.setCacheName(cacheName);
cfg.setCacheConfiguration(cacheCfg);
cfg.setCheckpointSpi(spi);
} else if (igniteInstanceName.contains("jdbc")) {
JdbcCheckpointSpi spi = new JdbcCheckpointSpi();
jdbcDataSource ds = new jdbcDataSource();
ds.setDatabase("jdbc:hsqldb:mem:gg_test_" + getClass().getSimpleName());
ds.setUser("sa");
ds.setPassword("");
spi.setDataSource(ds);
spi.setCheckpointTableName("test_checkpoints");
spi.setKeyFieldName("key");
spi.setValueFieldName("value");
spi.setValueFieldType("longvarbinary");
spi.setExpireDateFieldName("expire_date");
cfg.setCheckpointSpi(spi);
}
return cfg;
}
Aggregations