Search in sources :

Example 86 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteServiceDynamicCachesSelfTest method testDeployCalledBeforeCacheStart.

/**
     * @throws Exception If failed.
     */
public void testDeployCalledBeforeCacheStart() throws Exception {
    String cacheName = "cache";
    CacheConfiguration ccfg = new CacheConfiguration(cacheName);
    ccfg.setBackups(1);
    Ignite ig = ignite(0);
    final IgniteServices svcs = ig.services();
    final String svcName = "myService";
    ig.createCache(ccfg);
    Object key = primaryKey(ig.cache(cacheName));
    ig.destroyCache(cacheName);
    awaitPartitionMapExchange();
    svcs.deployKeyAffinitySingleton(svcName, new TestService(), cacheName, key);
    assert svcs.service(svcName) == null;
    ig.createCache(ccfg);
    try {
        boolean res = GridTestUtils.waitForCondition(new PA() {

            @Override
            public boolean apply() {
                return svcs.service(svcName) != null;
            }
        }, 10 * 1000);
        assertTrue("Service was not deployed", res);
        info("stopping cache: " + cacheName);
        ig.destroyCache(cacheName);
        res = GridTestUtils.waitForCondition(new PA() {

            @Override
            public boolean apply() {
                return svcs.service(svcName) == null;
            }
        }, 10 * 1000);
        assertTrue("Service was not undeployed", res);
    } finally {
        ig.services().cancelAll();
        ig.destroyCache(cacheName);
    }
}
Also used : PA(org.apache.ignite.internal.util.typedef.PA) IgniteServices(org.apache.ignite.IgniteServices) Ignite(org.apache.ignite.Ignite) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 87 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class GridCacheDhtLockBackupSelfTest method cacheConfiguration.

/**
     * @return Cache configuration.
     */
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setWriteSynchronizationMode(FULL_ASYNC);
    cacheCfg.setRebalanceMode(SYNC);
    return cacheCfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 88 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteHadoopFileSystemClientSelfTest method metaCacheConfiguration.

/**
     * Gets cache configuration.
     *
     * @return Cache configuration.
     */
protected CacheConfiguration metaCacheConfiguration() {
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setName("replicated");
    ccfg.setCacheMode(REPLICATED);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setEvictionPolicy(null);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    return ccfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 89 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteHadoopFileSystemClientSelfTest method dataCacheConfiguration.

/**
     * Gets cache configuration.
     *
     * @return Cache configuration.
     */
protected CacheConfiguration dataCacheConfiguration() {
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setName("partitioned");
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setNearConfiguration(null);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setEvictionPolicy(null);
    ccfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
    ccfg.setBackups(0);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    return ccfg;
}
Also used : IgfsGroupDataBlocksKeyMapper(org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 90 with CacheConfiguration

use of org.apache.ignite.configuration.CacheConfiguration in project ignite by apache.

the class IgniteHadoopFileSystemIpcCacheSelfTest method metaCacheConfiguration.

/**
     * Gets cache configuration.
     *
     * @return Cache configuration.
     */
private CacheConfiguration metaCacheConfiguration() {
    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setName("replicated");
    ccfg.setCacheMode(REPLICATED);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    return ccfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)980 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)392 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)287 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)250 Ignite (org.apache.ignite.Ignite)148 ArrayList (java.util.ArrayList)69 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)64 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)59 QueryEntity (org.apache.ignite.cache.QueryEntity)44 IgniteException (org.apache.ignite.IgniteException)43 CacheException (javax.cache.CacheException)42 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)40 IgniteEx (org.apache.ignite.internal.IgniteEx)40 IgniteCache (org.apache.ignite.IgniteCache)39 LinkedHashMap (java.util.LinkedHashMap)35 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)34 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)32 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)30 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)30 Transaction (org.apache.ignite.transactions.Transaction)28