Search in sources :

Example 71 with CacheConfiguration

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

the class GridCacheQueueApiSelfAbstractTest method testSystemCache.

/**
     * @throws Exception If failed.
     */
public void testSystemCache() throws Exception {
    CollectionConfiguration colCfg = collectionConfiguration();
    IgniteQueue queue = grid(0).queue("Queue1", 0, colCfg);
    final CacheConfiguration ccfg = getQueueCache(queue);
    GridTestUtils.assertThrows(log, new Callable<Object>() {

        @Override
        public Object call() throws Exception {
            grid(0).cache(ccfg.getName());
            return null;
        }
    }, IllegalStateException.class, "Failed to get cache because it is a system cache");
    assertNotNull(((IgniteKernal) grid(0)).internalCache(ccfg.getName()));
}
Also used : IgniteQueue(org.apache.ignite.IgniteQueue) CollectionConfiguration(org.apache.ignite.configuration.CollectionConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) IgniteException(org.apache.ignite.IgniteException)

Example 72 with CacheConfiguration

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

the class IgniteCrossCacheTxStoreSelfTest method cacheConfiguration.

/**
     * @param cacheName Cache name.
     * @param factory Factory to use.
     * @return Cache configuration.
     */
private CacheConfiguration cacheConfiguration(String cacheName, Factory<CacheStore> factory) {
    CacheConfiguration cfg = defaultCacheConfiguration();
    cfg.setNearConfiguration(null);
    cfg.setName(cacheName);
    cfg.setBackups(1);
    if (factory != null) {
        cfg.setCacheStoreFactory(factory);
        cfg.setWriteThrough(true);
    }
    return cfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 73 with CacheConfiguration

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

the class IgniteCacheSizeFailoverTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setAtomicityMode(ATOMIC);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setBackups(1);
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 74 with CacheConfiguration

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

the class IgniteCachePrimarySyncTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
    CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    ccfg1.setName("cache1");
    ccfg1.setAtomicityMode(ATOMIC);
    ccfg1.setBackups(2);
    ccfg1.setWriteSynchronizationMode(PRIMARY_SYNC);
    CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    ccfg2.setName("cache2");
    ccfg2.setAtomicityMode(TRANSACTIONAL);
    ccfg2.setBackups(2);
    ccfg2.setWriteSynchronizationMode(PRIMARY_SYNC);
    cfg.setCacheConfiguration(ccfg1, ccfg2);
    cfg.setClientMode(clientMode);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 75 with CacheConfiguration

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

the class IgniteCacheSystemTransactionsSelfTest method cacheConfiguration.

/** {@inheritDoc} */
@Override
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
    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