Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setConnectorConfiguration()

The following examples show how to use org.apache.ignite.configuration.IgniteConfiguration#setConnectorConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcResultSetSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration<?, ?> cache = defaultCacheConfiguration();

    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(
        Integer.class, TestObject.class
    );

    cfg.setCacheConfiguration(cache);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 2
Source File: JdbcResultSetSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration<?,?> cache = defaultCacheConfiguration();

    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(
        Integer.class, TestObject.class
    );

    cfg.setCacheConfiguration(cache);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 3
Source File: JdbcEmptyCacheSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cache = defaultCacheConfiguration();

    cache.setName(CACHE_NAME);
    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(
        Byte.class, Byte.class
    );

    cfg.setCacheConfiguration(cache);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 4
Source File: GridFactorySelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param igniteInstanceName Ignite instance name.
 * @throws Exception If test failed.
 */
private void checkLifecycleBeans(@Nullable String igniteInstanceName) throws Exception {
    TestLifecycleBean bean1 = new TestLifecycleBean();
    TestLifecycleBean bean2 = new TestLifecycleBean();

    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setLifecycleBeans(bean1, bean2);
    cfg.setIgniteInstanceName(igniteInstanceName);

    cfg.setEventStorageSpi(new MemoryEventStorageSpi());

    cfg.setConnectorConfiguration(null);

    try (Ignite g = IgniteSpring.start(cfg, new GenericApplicationContext())) {
        bean1.checkState(igniteInstanceName, true);
        bean2.checkState(igniteInstanceName, true);
    }

    bean1.checkState(igniteInstanceName, false);
    bean2.checkState(igniteInstanceName, false);

    checkLifecycleBean(bean1, igniteInstanceName);
    checkLifecycleBean(bean2, igniteInstanceName);
}
 
Example 5
Source File: GridCachePreloadLifecycleAbstractTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

        c.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
        c.setIncludeProperties();
        c.setDeploymentMode(DeploymentMode.SHARED);
        c.setNetworkTimeout(10000);
        c.setConnectorConfiguration(null);

//        c.setPeerClassLoadingLocalClassPathExclude(GridCachePreloadLifecycleAbstractTest.class.getName(),
//            MyValue.class.getName());

        c.setPublicThreadPoolSize(10);
        c.setSystemThreadPoolSize(10);
        c.setPeerClassLoadingThreadPoolSize(3);

        c.setLifecycleBeans(lifecycleBean);

        return c;
    }
 
Example 6
Source File: JdbcDistributedJoinsQueryTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration<?,?> cache = defaultCacheConfiguration();

    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setAtomicityMode(TRANSACTIONAL);
    cache.setIndexedTypes(String.class, Organization.class, String.class, Person.class);

    cfg.setCacheConfiguration(cache);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 7
Source File: RestSetupSimpleTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration configuration = super.getConfiguration(igniteInstanceName);

    configuration.setConnectorConfiguration(new ConnectorConfiguration());

    return configuration;
}
 
Example 8
Source File: TcpDiscoverySnapshotHistoryTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();

    ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500"));

    cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder));
    cfg.setCacheConfiguration();
    cfg.setLocalHost("127.0.0.1");
    cfg.setConnectorConfiguration(null);

    return cfg;
}
 
Example 9
Source File: JdbcNoCacheStreamingSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param gridName Grid name.
 * @return Grid configuration used for starting the grid.
 * @throws Exception If failed.
 */
private IgniteConfiguration getConfiguration0(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<?,?> cache = defaultCacheConfiguration();

    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(
        Integer.class, Integer.class
    );

    cfg.setCacheConfiguration(cache);
    cfg.setLocalHost("127.0.0.1");

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
    ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47501"));

    disco.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(disco);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 10
Source File: JdbcComplexQuerySelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setCacheConfiguration(
        cacheConfiguration("pers", AffinityKey.class, Person.class),
        cacheConfiguration("org", String.class, Organization.class));

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 11
Source File: IgnitePdsCorruptedStoreTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    cfg.setConsistentId(igniteInstanceName);

    failingFileIOFactory = new FailingFileIOFactory();

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration()
                .setMaxSize(100 * 1024 * 1024)
                .setPersistenceEnabled(true)
        )
        .setWalMode(WALMode.FSYNC)
        .setFileIOFactory(failingFileIOFactory);

    cfg.setDataStorageConfiguration(memCfg);

    cfg.setCacheConfiguration(cacheConfiguration(CACHE_NAME1), cacheConfiguration(CACHE_NAME2));

    failureHnd = new DummyFailureHandler();

    cfg.setFailureHandler(failureHnd);

    return cfg;
}
 
Example 12
Source File: GridCacheCommandHandlerSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration() throws Exception {
    // Discovery config.
    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    disco.setJoinTimeout(5000);

    // Cache config.
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(CacheMode.LOCAL);

    cacheCfg.setAtomicityMode(atomicityMode());

    // Grid config.
    IgniteConfiguration cfg = super.getConfiguration();

    cfg.setLocalHost("127.0.0.1");

    ConnectorConfiguration clnCfg = new ConnectorConfiguration();
    clnCfg.setHost("127.0.0.1");

    cfg.setConnectorConfiguration(clnCfg);
    cfg.setDiscoverySpi(disco);
    cfg.setCacheConfiguration(cacheCfg); // Add 'null' cache configuration.

    return cfg;
}
 
Example 13
Source File: JdbcBulkLoadSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param gridName Grid name.
 * @return Grid configuration used for starting the grid.
 * @throws Exception If failed.
 */
private IgniteConfiguration getConfiguration0(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    CacheConfiguration<?,?> cache = defaultCacheConfiguration();

    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(
        Integer.class, Person.class
    );

    cfg.setCacheConfiguration(cache);
    cfg.setLocalHost("127.0.0.1");

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
    ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47501"));

    disco.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(disco);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    return cfg;
}
 
Example 14
Source File: ClientSslParametersTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setSslContextFactory(createSslFactory());

    cfg.setConnectorConfiguration(new ConnectorConfiguration()
        .setSslEnabled(true)
        .setSslClientAuth(true));

    cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE_NAME));

    return cfg;
}
 
Example 15
Source File: HadoopAbstractMapReduceTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Start grid with IGFS.
 *
 * @param igniteInstanceName Ignite instance name.
 * @param igfsName IGFS name
 * @param mode IGFS mode.
 * @param secondaryFs Secondary file system (optional).
 * @param restCfg Rest configuration string (optional).
 * @return Started grid instance.
 * @throws Exception If failed.
 */
protected Ignite startGridWithIgfs(String igniteInstanceName, String igfsName, IgfsMode mode,
    @Nullable IgfsSecondaryFileSystem secondaryFs, @Nullable IgfsIpcEndpointConfiguration restCfg) throws Exception {
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();

    igfsCfg.setName(igfsName);
    igfsCfg.setBlockSize(IGFS_BLOCK_SIZE);
    igfsCfg.setDefaultMode(mode);
    igfsCfg.setIpcEndpointConfiguration(restCfg);
    igfsCfg.setSecondaryFileSystem(secondaryFs);
    igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS);
    igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH);

    CacheConfiguration dataCacheCfg = defaultCacheConfiguration();

    dataCacheCfg.setName("dataCache");
    dataCacheCfg.setCacheMode(PARTITIONED);
    dataCacheCfg.setNearConfiguration(null);
    dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(2));
    dataCacheCfg.setBackups(0);
    dataCacheCfg.setAtomicityMode(TRANSACTIONAL);

    CacheConfiguration metaCacheCfg = defaultCacheConfiguration();

    metaCacheCfg.setName("metaCache");
    metaCacheCfg.setCacheMode(REPLICATED);
    metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    metaCacheCfg.setAtomicityMode(TRANSACTIONAL);

    igfsCfg.setDataCacheConfiguration(dataCacheCfg);
    igfsCfg.setMetaCacheConfiguration(metaCacheCfg);

    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setIgniteInstanceName(igniteInstanceName);

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);

    cfg.setLocalHost("127.0.0.1");
    cfg.setConnectorConfiguration(null);

    HadoopConfiguration hadoopCfg = createHadoopConfiguration();

    if (hadoopCfg != null)
        cfg.setHadoopConfiguration(hadoopCfg);

    return G.start(cfg);
}
 
Example 16
Source File: ChangeStateCommandHandlerTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setLocalHost(HOST);

    ConnectorConfiguration clientCfg = new ConnectorConfiguration();

    clientCfg.setPort(BINARY_PORT);

    cfg.setConnectorConfiguration(clientCfg);

    return cfg;
}
 
Example 17
Source File: RestProcessorHangTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ConnectorConfiguration connectorConfiguration = new ConnectorConfiguration();

    cfg.setConnectorConfiguration(connectorConfiguration);

    return cfg;
}
 
Example 18
Source File: HadoopAbstractSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setHadoopConfiguration(hadoopConfiguration(igniteInstanceName));

    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

    commSpi.setSharedMemoryPort(-1);

    cfg.setCommunicationSpi(commSpi);

    TcpDiscoverySpi discoSpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();

    discoSpi.setIpFinder(singleTestIpFinder);

    if (igfsEnabled())
        cfg.setFileSystemConfiguration(igfsConfiguration());

    if (restEnabled()) {
        ConnectorConfiguration clnCfg = new ConnectorConfiguration();

        clnCfg.setPort(restPort++);

        cfg.setConnectorConfiguration(clnCfg);
    }

    cfg.setLocalHost("127.0.0.1");
    cfg.setPeerClassLoadingEnabled(false);

    return cfg;
}
 
Example 19
Source File: IgniteCacheScanPredicateDeploymentSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    if (getTestIgniteInstanceName(3).equals(igniteInstanceName))
        cfg.setClassLoader(getExternalClassLoader());

    cfg.setCacheConfiguration(cacheConfiguration());

    cfg.setConnectorConfiguration(null);

    return cfg;
}
 
Example 20
Source File: MemcacheRestExampleNodeStartup.java    From ignite with Apache License 2.0 3 votes vote down vote up
/**
 * Create Ignite configuration with IGFS and enabled IPC.
 *
 * @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.setDeploymentMode(SHARED);
    cfg.setPeerClassLoadingEnabled(true);

    cfg.setConnectorConfiguration(new ConnectorConfiguration());

    CacheConfiguration cacheCfg = new CacheConfiguration();

    cacheCfg.setName("default");
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(SYNC);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);

    cfg.setCacheConfiguration(cacheCfg);

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();

    ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));

    discoSpi.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(discoSpi);

    return cfg;
}