use of org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi in project ignite by apache.
the class AbstractBinaryMetadataRegistrationTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TestTcpDiscoverySpi) cfg.getDiscoverySpi()).discoveryHook(new DiscoveryHook() {
@Override
public void beforeDiscovery(DiscoveryCustomMessage customMsg) {
if (customMsg instanceof MetadataUpdateProposedMessage)
proposeMsgNum.incrementAndGet();
}
});
cfg.setCacheConfiguration(cacheConfiguration());
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi in project ignite by apache.
the class BinaryMetadataRemoveTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
final GridTestUtils.DiscoveryHook discoveryHook0 = discoveryHook;
if (discoveryHook0 != null) {
assert cfg.getDiscoverySpi() instanceof TestTcpDiscoverySpi;
((TestTcpDiscoverySpi) cfg.getDiscoverySpi()).discoveryHook(discoveryHook0);
}
cfg.setCacheConfiguration(new CacheConfiguration().setName(CACHE_NAME));
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi in project ignite by apache.
the class BinaryMetadataUpdatesFlowTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setPeerClassLoadingEnabled(false);
if (discoveryHook != null) {
((TestTcpDiscoverySpi) cfg.getDiscoverySpi()).discoveryHook(discoveryHook);
cfg.setMetricsUpdateFrequency(1000);
}
cfg.setMarshaller(new BinaryMarshaller());
cfg.setClientMode("client".equals(gridName) || getTestIgniteInstanceIndex(gridName) >= GRID_CNT);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(CacheMode.REPLICATED);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi in project ignite by apache.
the class CacheBlockOnReadAbstractTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setConsistentId(igniteInstanceName);
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
cfg.setDiscoverySpi(new TestTcpDiscoverySpi() {
/**
* {@inheritDoc}
*/
@Override
protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {
if (discoveryMsgProcessor != null)
discoveryMsgProcessor.accept(msg, igniteInstanceName);
}
}.setIpFinder(customIpFinder == null ? IP_FINDER : customIpFinder));
cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
cfg.setClientMode(startNodesInClientMode);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi in project ignite by apache.
the class GridServiceProxyTopologyInitializationTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (getTestIgniteInstanceName(NODES_CNT - 1).equals(igniteInstanceName)) {
((TestTcpDiscoverySpi) cfg.getDiscoverySpi()).discoveryHook(new DiscoveryHook() {
@Override
public void beforeDiscovery(DiscoveryCustomMessage customMsg) {
if (customMsg instanceof ServiceClusterDeploymentResultBatch) {
fullMsgReceivedLatch.countDown();
try {
fullMsgUnblockedLatch.await(getTestTimeout(), MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
@Override
public void afterDiscovery(DiscoveryCustomMessage customMsg) {
if (customMsg instanceof ServiceClusterDeploymentResultBatch)
fullMsgHandledLatch.countDown();
}
});
cfg.setUserAttributes(Collections.singletonMap(ATTR_SKIP_DEPLOYMENT, true));
}
return cfg;
}
Aggregations