Search in sources :

Example 6 with TestTcpDiscoverySpi

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) DiscoveryHook(org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)

Example 7 with TestTcpDiscoverySpi

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 8 with TestTcpDiscoverySpi

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 9 with TestTcpDiscoverySpi

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;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) TestRecordingCommunicationSpi(org.apache.ignite.internal.TestRecordingCommunicationSpi) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryAbstractMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi)

Example 10 with TestTcpDiscoverySpi

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TestTcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi) DiscoveryCustomMessage(org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage) DiscoveryHook(org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)

Aggregations

TestTcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi)10 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)9 DiscoveryCustomMessage (org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage)4 DiscoveryHook (org.apache.ignite.testframework.GridTestUtils.DiscoveryHook)4 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 IgniteEx (org.apache.ignite.internal.IgniteEx)2 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)2 TcpDiscoveryAbstractMessage (org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage)2 GridTestUtils (org.apache.ignite.testframework.GridTestUtils)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 Socket (java.net.Socket)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Ignite (org.apache.ignite.Ignite)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)1 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1