Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setCacheKeyConfiguration()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setCacheKeyConfiguration() .
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: IgniteCacheLockPartitionOnAffinityRunAbstractTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); // Enables template with default test configuration cfg.setCacheConfiguration(F.concat(cfg.getCacheConfiguration(), cacheConfiguration(igniteInstanceName).setName("*"))); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); cfg.setMarshaller(new BinaryMarshaller()); // TODO remove key configuration when https://issues.apache.org/jira/browse/IGNITE-5795 is fixed. cfg.setCacheKeyConfiguration(new CacheKeyConfiguration(Person.Key.class.getName(), "orgId")); AlwaysFailoverSpi failSpi = new AlwaysFailoverSpi(); failSpi.setMaximumFailoverAttempts(MAX_FAILOVER_ATTEMPTS); cfg.setFailoverSpi(failSpi); return cfg; }
Example 2
Source File: IgniteSqlRoutingTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); c.setMarshaller(new BinaryMarshaller()); List<CacheConfiguration> ccfgs = new ArrayList<>(); CacheConfiguration ccfg = buildCacheConfiguration(gridName); if (ccfg != null) ccfgs.add(ccfg); ccfgs.add(buildCacheConfiguration(CACHE_PERSON)); ccfgs.add(buildCacheConfiguration(CACHE_CALL)); c.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()])); c.setCacheKeyConfiguration(new CacheKeyConfiguration(CallKey.class)); c.setIncludeEventTypes(EventType.EVTS_ALL); return c; }
Example 3
Source File: IgnitePdsBinaryMetadataOnClusterRestartTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); if (customWorkSubDir != null) cfg.setWorkDirectory(Paths.get(U.defaultWorkDirectory(), customWorkSubDir).toString()); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setWalMode(WALMode.LOG_ONLY) .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(100L * 1024 * 1024)) ); BinaryConfiguration bCfg = new BinaryConfiguration(); BinaryTypeConfiguration binaryEnumCfg = new BinaryTypeConfiguration(EnumType.class.getName()); binaryEnumCfg.setEnum(true); binaryEnumCfg.setEnumValues(F.asMap(EnumType.ENUM_VAL_0.name(), EnumType.ENUM_VAL_0.ordinal(), EnumType.ENUM_VAL_1.name(), EnumType.ENUM_VAL_1.ordinal())); bCfg.setTypeConfigurations(Arrays.asList(binaryEnumCfg)); cfg.setBinaryConfiguration(bCfg); CacheKeyConfiguration dynamicMetaKeyCfg = new CacheKeyConfiguration(DYNAMIC_TYPE_NAME, DYNAMIC_INT_FIELD_NAME); cfg.setCacheKeyConfiguration(dynamicMetaKeyCfg); cfg.setCacheConfiguration(new CacheConfiguration() .setName(CACHE_NAME) .setAffinity(new RendezvousAffinityFunction()) .setCacheMode(CacheMode.REPLICATED)); return cfg; }
Example 4
Source File: GridCacheAffinityRoutingBinarySelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(); typeCfg.setTypeName(AffinityTestKey.class.getName()); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(AffinityTestKey.class.getName(), "affKey"); cfg.setCacheKeyConfiguration(keyCfg); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setTypeConfigurations(Collections.singleton(typeCfg)); cfg.setBinaryConfiguration(bCfg); cfg.setMarshaller(new BinaryMarshaller()); return cfg; }
Example 5
Source File: IgniteSqlSplitterSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestKey.class.getName(), "affKey"); cfg.setCacheKeyConfiguration(keyCfg); cfg.setPeerClassLoadingEnabled(false); return cfg; }
Example 6
Source File: IgniteCachelessQueriesSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration("MyCache", "affKey"); cfg.setCacheKeyConfiguration(keyCfg); cfg.setPeerClassLoadingEnabled(false); return cfg; }
Example 7
Source File: IgniteCacheJoinQueryWithAffinityKeyTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(); keyCfg.setTypeName(TestKeyWithAffinity.class.getName()); keyCfg.setAffinityKeyFieldName("affKey"); cfg.setCacheKeyConfiguration(keyCfg); return cfg; }
Example 8
Source File: GridCacheClientNodeBinaryObjectMetadataTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryMarshaller marsh = new BinaryMarshaller(); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName())); BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(); typeCfg.setTypeName(TestObject1.class.getName()); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject1.class.getName(), "val2"); cfg.setCacheKeyConfiguration(keyCfg); bCfg.setTypeConfigurations(Arrays.asList(typeCfg)); cfg.setBinaryConfiguration(bCfg); if (igniteInstanceName.equals(getTestIgniteInstanceName(gridCount() - 1))) cfg.setClientMode(true); cfg.setMarshaller(marsh); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); return cfg; }
Example 9
Source File: GridCacheBinaryObjectsAbstractSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg = createCacheConfig(); cacheCfg.setCacheStoreFactory(singletonFactory(new TestStore())); CacheConfiguration binKeysCacheCfg = createCacheConfig(); binKeysCacheCfg.setCacheStoreFactory(singletonFactory(new MapCacheStoreStrategy.MapCacheStore())); binKeysCacheCfg.setStoreKeepBinary(true); binKeysCacheCfg.setName("BinKeysCache"); cfg.setCacheConfiguration(cacheCfg, binKeysCacheCfg); cfg.setMarshaller(new BinaryMarshaller()); List<BinaryTypeConfiguration> binTypes = new ArrayList<>(); binTypes.add(new BinaryTypeConfiguration() {{ setTypeName("ArrayHashedKey"); }}); BinaryConfiguration binCfg = new BinaryConfiguration(); binCfg.setTypeConfigurations(binTypes); cfg.setBinaryConfiguration(binCfg); CacheKeyConfiguration arrayHashCfg = new CacheKeyConfiguration("ArrayHashedKey", "fld1"); cfg.setCacheKeyConfiguration(arrayHashCfg); GridCacheBinaryObjectsAbstractSelfTest.cfg = cfg; return cfg; }
Example 10
Source File: GridBinaryAffinityKeySelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration(); typeCfg.setTypeName(TestObject.class.getName()); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setTypeConfigurations(Collections.singleton(typeCfg)); cfg.setBinaryConfiguration(bCfg); CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject.class.getName(), "affKey"); CacheKeyConfiguration keyCfg2 = new CacheKeyConfiguration("TestObject2", "affKey"); cfg.setCacheKeyConfiguration(keyCfg, keyCfg2); cfg.setMarshaller(new BinaryMarshaller()); if (!igniteInstanceName.equals(getTestIgniteInstanceName(GRID_CNT))) { CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cacheCfg.setCacheMode(PARTITIONED); cfg.setCacheConfiguration(cacheCfg); } return cfg; }