org.apache.ignite.configuration.BinaryConfiguration Java Examples
The following examples show how to use
org.apache.ignite.configuration.BinaryConfiguration.
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: GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cacheCfg.setCacheMode(cacheMode()); cacheCfg.setAtomicityMode(atomicityMode()); cacheCfg.setNearConfiguration(nearConfiguration()); cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode()); cfg.setCacheConfiguration(cacheCfg); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration(TestObject.class.getName()))); cfg.setBinaryConfiguration(bCfg); cfg.setMarshaller(new BinaryMarshaller()); return cfg; }
Example #2
Source File: BinaryObjectExceptionSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setMarshaller(new BinaryMarshaller()); cfg.setCacheConfiguration( new CacheConfiguration(cacheName) .setCopyOnRead(true) ); BinaryConfiguration bcfg = new BinaryConfiguration() .setNameMapper(new BinaryBasicNameMapper(false)); cfg.setBinaryConfiguration(bcfg); return cfg; }
Example #3
Source File: IgniteBinaryTest.java From ignite with Apache License 2.0 | 6 votes |
/** * Check that binary types are registered for nested types too. * With enabled "CompactFooter" binary type schema also should be passed to server. */ @Test public void testCompactFooterNestedTypeRegistration() throws Exception { try (Ignite ignite = Ignition.start(Config.getServerConfiguration())) { try (IgniteClient client = Ignition.startClient(new ClientConfiguration().setAddresses(Config.SERVER) .setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(true))) ) { IgniteCache<Integer, Person[]> igniteCache = ignite.getOrCreateCache(Config.DEFAULT_CACHE_NAME); ClientCache<Integer, Person[]> clientCache = client.getOrCreateCache(Config.DEFAULT_CACHE_NAME); Integer key = 1; Person[] val = new Person[] {new Person(1, "Joe")}; // Binary types should be registered for both "Person[]" and "Person" classes after this call. clientCache.put(key, val); // Check that we can deserialize on server using registered binary types. assertArrayEquals(val, igniteCache.get(key)); } } }
Example #4
Source File: IgnitePersistentStoreCacheGroupsTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(100L * 1024 * 1024).setPersistenceEnabled(true)) .setPageSize(1024) .setWalMode(WALMode.LOG_ONLY); cfg.setDataStorageConfiguration(memCfg); cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false)); if (ccfgs != null) { cfg.setCacheConfiguration(ccfgs); ccfgs = null; } return cfg; }
Example #5
Source File: BinaryContext.java From ignite with Apache License 2.0 | 6 votes |
/** * @param marsh Binary marshaller. * @param binaryCfg Binary configuration. * @throws BinaryObjectException In case of error. */ public void configure(BinaryMarshaller marsh, BinaryConfiguration binaryCfg) throws BinaryObjectException { if (marsh == null) return; this.marsh = marsh; marshCtx = marsh.getContext(); if (binaryCfg == null) binaryCfg = new BinaryConfiguration(); assert marshCtx != null; optmMarsh.setContext(marshCtx); configure( binaryCfg.getNameMapper(), binaryCfg.getIdMapper(), binaryCfg.getSerializer(), binaryCfg.getTypeConfigurations() ); compactFooter = binaryCfg.isCompactFooter(); }
Example #6
Source File: PlatformDotNetConfigurationClosure.java From ignite with Apache License 2.0 | 6 votes |
/** * Sets binary config. * * @param igniteCfg Ignite config. * @param dotNetCfg .NET config. */ private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) { // Check marshaller. Marshaller marsh = igniteCfg.getMarshaller(); if (marsh == null) { igniteCfg.setMarshaller(new BinaryMarshaller()); dotNetCfg.warnings(Collections.singleton("Marshaller is automatically set to " + BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type).")); } else if (!(marsh instanceof BinaryMarshaller)) throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() + " can be used when running Apache Ignite.NET): " + marsh.getClass().getName()); BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration(); }
Example #7
Source File: IgniteCacheAbstractInsertSqlQuerySelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration binCfg = new BinaryConfiguration(); binCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration() {{ setTypeName(Key.class.getName()); }}, new BinaryTypeConfiguration() {{ setTypeName(Key2.class.getName()); }} )); cfg.setBinaryConfiguration(binCfg); cfg.setPeerClassLoadingEnabled(false); return cfg; }
Example #8
Source File: GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cacheCfg.setCacheMode(cacheMode()); cacheCfg.setAtomicityMode(atomicityMode()); cacheCfg.setNearConfiguration(nearConfiguration()); cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode()); cfg.setCacheConfiguration(cacheCfg); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration(TestObject.class.getName()))); cfg.setBinaryConfiguration(bCfg); cfg.setMarshaller(new BinaryMarshaller()); return cfg; }
Example #9
Source File: BinaryConfigurationConsistencySelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param bCfg1 BinaryConfiguration 1. * @param bCfg2 BinaryConfiguration 2. * @throws Exception If failed. */ private void checkNegative(final BinaryConfiguration bCfg1, BinaryConfiguration bCfg2) throws Exception { binaryCfg = bCfg1; startGrid(0); binaryCfg = bCfg2; GridTestUtils.assertThrows(log, new Callable<Void>() { @Override public Void call() throws Exception { startGrid(1); return null; } }, IgniteCheckedException.class, ""); GridTestUtils.assertThrows(log, new Callable<Void>() { @Override public Void call() throws Exception { startClientGrid(2); return null; } }, IgniteCheckedException.class, ""); }
Example #10
Source File: PersistenceBasicCompatibilityTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setPeerClassLoadingEnabled(false); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE) )); cfg.setBinaryConfiguration( new BinaryConfiguration() .setCompactFooter(compactFooter) ); return cfg; }
Example #11
Source File: IgniteTestConfigurationBuilder.java From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 | 6 votes |
private IgniteConfiguration createConfig() { IgniteConfiguration config = new IgniteConfiguration(); config.setIgniteInstanceName( "OgmTestGrid" ); config.setClientMode( false ); BinaryConfiguration binaryConfiguration = new BinaryConfiguration(); binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) ); binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection) config.setBinaryConfiguration( binaryConfiguration ); TransactionConfiguration transactionConfiguration = new TransactionConfiguration(); // I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests // can highlight the issue. Ideally, we would want to test the different concurrency and isolation level. transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC ); transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED ); config.setTransactionConfiguration( transactionConfiguration ); return config; }
Example #12
Source File: IgniteModuleMemberRegistrationIT.java From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 | 6 votes |
private IgniteConfiguration createConfig() { IgniteConfiguration config = new IgniteConfiguration(); config.setIgniteInstanceName( "OgmTestGrid" ); config.setClientMode( false ); BinaryConfiguration binaryConfiguration = new BinaryConfiguration(); binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) ); binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection) config.setBinaryConfiguration( binaryConfiguration ); TransactionConfiguration transactionConfiguration = new TransactionConfiguration(); // I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests // can highlight the issue. Ideally, we would want to test the different concurrency and isolation level. transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC ); transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED ); config.setTransactionConfiguration( transactionConfiguration ); return config; }
Example #13
Source File: GridSimpleLowerCaseBinaryMappersBinaryMetaDataSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); bCfg.setNameMapper(new BinaryBasicNameMapper()); bCfg.setIdMapper(new BinaryBasicIdMapper(true)); return cfg; }
Example #14
Source File: BinaryObjectBuilderSimpleNameLowerCaseMappersSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); bCfg.setIdMapper(new BinaryBasicIdMapper(true)); bCfg.setNameMapper(new BinaryBasicNameMapper(true)); return cfg; }
Example #15
Source File: VisorBinaryConfiguration.java From ignite with Apache License 2.0 | 5 votes |
/** * Create data transfer object for binary configuration. * * @param src Binary configuration. */ public VisorBinaryConfiguration(BinaryConfiguration src) { idMapper = compactClass(src.getIdMapper()); nameMapper = compactClass(src.getNameMapper()); serializer = compactClass(src.getSerializer()); compactFooter = src.isCompactFooter(); typeCfgs = VisorBinaryTypeConfiguration.list(src.getTypeConfigurations()); }
Example #16
Source File: BinaryConfigurationConsistencySelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws Exception If failed. */ @Test public void testPositiveEmptyConfig() throws Exception { binaryCfg = new BinaryConfiguration(); startGrids(2); startClientGrid(2); }
Example #17
Source File: ClientConfigurationTest.java From ignite with Apache License 2.0 | 5 votes |
/** Serialization/deserialization. */ @Test public void testSerialization() throws IOException, ClassNotFoundException { ClientConfiguration target = new ClientConfiguration() .setAddresses("127.0.0.1:10800", "127.0.0.1:10801") .setTimeout(123) .setBinaryConfiguration(new BinaryConfiguration() .setClassNames(Collections.singleton("Person")) ) .setSslMode(SslMode.REQUIRED) .setSslClientCertificateKeyStorePath("client.jks") .setSslClientCertificateKeyStoreType("JKS") .setSslClientCertificateKeyStorePassword("123456") .setSslTrustCertificateKeyStorePath("trust.jks") .setSslTrustCertificateKeyStoreType("JKS") .setSslTrustCertificateKeyStorePassword("123456") .setSslKeyAlgorithm("SunX509"); ByteArrayOutputStream outBytes = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(outBytes); out.writeObject(target); out.flush(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(outBytes.toByteArray())); Object desTarget = in.readObject(); assertTrue(Comparers.equal(target, desTarget)); }
Example #18
Source File: GridTestBinaryMarshaller.java From ignite with Apache License 2.0 | 5 votes |
/** * @param log Logger. */ private BinaryMarshaller createBinaryMarshaller(IgniteLogger log) throws IgniteCheckedException { IgniteConfiguration iCfg = new IgniteConfiguration() .setBinaryConfiguration( new BinaryConfiguration().setCompactFooter(true) ) .setClientMode(false) .setDiscoverySpi(new TcpDiscoverySpi() { @Override public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException { //No-op. } }); BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger()); MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(); marshCtx.onMarshallerProcessorStarted(new GridTestKernalContext(log, iCfg), null); BinaryMarshaller marsh = new BinaryMarshaller(); marsh.setContext(marshCtx); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg); return marsh; }
Example #19
Source File: GridBinaryWildcardsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * */ protected BinaryMarshaller binaryMarshaller( BinaryNameMapper nameMapper, BinaryIdMapper mapper, BinarySerializer serializer, Collection<BinaryTypeConfiguration> cfgs ) throws IgniteCheckedException { IgniteConfiguration iCfg = new IgniteConfiguration(); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setNameMapper(nameMapper); bCfg.setIdMapper(mapper); bCfg.setSerializer(serializer); bCfg.setTypeConfigurations(cfgs); iCfg.setBinaryConfiguration(bCfg); BinaryContext ctx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger()); BinaryMarshaller marsh = new BinaryMarshaller(); marsh.setContext(new MarshallerContextTestImpl(null)); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg); return marsh; }
Example #20
Source File: TcpClientDiscoveryMarshallerCheckSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (testFooter) { cfg.setMarshaller(new BinaryMarshaller()); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setJoinTimeout(-1); // IGNITE-605, and further tests limitation bypass cfg.setDiscoverySpi(spi); if (igniteInstanceName.endsWith("0")) { BinaryConfiguration bc = new BinaryConfiguration(); bc.setCompactFooter(false); cfg.setBinaryConfiguration(bc); cfg.setClientMode(true); } } else { if (igniteInstanceName.endsWith("0")) cfg.setMarshaller(new JdkMarshaller()); else { cfg.setClientMode(true); cfg.setMarshaller(new BinaryMarshaller()); } } return cfg; }
Example #21
Source File: BinaryEnumsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (register) { BinaryConfiguration bCfg = new BinaryConfiguration(); BinaryTypeConfiguration enumCfg = new BinaryTypeConfiguration(EnumType.class.getName()); enumCfg.setEnum(true); if (igniteInstanceName.equals(WRONG_CONF_NODE_NAME)) enumCfg.setEnumValues(F.asMap(EnumType.ONE.name(), EnumType.ONE.ordinal(), EnumType.TWO.name(), EnumType.ONE.ordinal())); else enumCfg.setEnumValues(F.asMap(EnumType.ONE.name(), EnumType.ONE.ordinal(), EnumType.TWO.name(), EnumType.TWO.ordinal())); bCfg.setTypeConfigurations(Arrays.asList(enumCfg, new BinaryTypeConfiguration(EnumHolder.class.getName()))); cfg.setBinaryConfiguration(bCfg); } cfg.setMarshaller(new BinaryMarshaller()); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setName(CACHE_NAME); ccfg.setCacheMode(CacheMode.PARTITIONED); cfg.setCacheConfiguration(ccfg); return cfg; }
Example #22
Source File: IgniteWalRecoverySeveralRestartsTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(cacheName); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setRebalanceMode(CacheRebalanceMode.NONE); ccfg.setIndexedTypes(Integer.class, IndexedObject.class); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(false, 64 * 4)); // 64 per node ccfg.setReadFromBackup(true); cfg.setCacheConfiguration(ccfg); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(500L * 1024 * 1024).setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY) .setPageSize(PAGE_SIZE); cfg.setDataStorageConfiguration(memCfg); cfg.setMarshaller(null); BinaryConfiguration binCfg = new BinaryConfiguration(); binCfg.setCompactFooter(false); cfg.setBinaryConfiguration(binCfg); return cfg; }
Example #23
Source File: GridCacheBinaryStoreBinariesSimpleNameMappersSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); bCfg.setNameMapper(new BinaryBasicNameMapper()); bCfg.setIdMapper(new BinaryBasicIdMapper(true)); return cfg; }
Example #24
Source File: IgniteDataStorageMetricsSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); long maxRegionSize = 20L * 1024 * 1024; DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setMaxSize(maxRegionSize) .setPersistenceEnabled(true) .setMetricsEnabled(true) .setName("dflt-plc")) .setDataRegionConfigurations(new DataRegionConfiguration() .setMaxSize(maxRegionSize) .setPersistenceEnabled(false) .setMetricsEnabled(true) .setName(NO_PERSISTENCE)) .setWalMode(WALMode.LOG_ONLY) .setMetricsEnabled(true); cfg.setDataStorageConfiguration(memCfg); cfg.setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(false)); cfg.setCacheConfiguration( cacheConfiguration(GROUP1, "cache", PARTITIONED, ATOMIC, 1, null), cacheConfiguration(null, "cache-np", PARTITIONED, ATOMIC, 1, NO_PERSISTENCE)); return cfg; }
Example #25
Source File: IgniteMarshallerCacheClassNameConflictTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TestTcpDiscoverySpi(); disco.setIpFinder(LOCAL_IP_FINDER); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(REPLICATED); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); // Use case sensitive mapper BinaryConfiguration binaryCfg = new BinaryConfiguration().setIdMapper(new BinaryBasicIdMapper(false)); cfg.setBinaryConfiguration(binaryCfg); return cfg; }
Example #26
Source File: BinaryConfigurationConsistencySelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @Test public void testNegativeEmptyCustomConfigs() throws Exception { checkNegative(new BinaryConfiguration(), customConfig(false)); }
Example #27
Source File: BinaryConfigurationConsistencySelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @Test public void testNegativeEmptyNullConfigs() throws Exception { checkNegative(new BinaryConfiguration(), null); }
Example #28
Source File: BinaryConfigurationConsistencySelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @Test public void testNegativeNullEmptyConfigs() throws Exception { checkNegative(null, new BinaryConfiguration()); }
Example #29
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 #30
Source File: BinaryFieldExtractionSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Create marshaller. * * @return Binary marshaller. * @throws Exception If failed. */ protected BinaryMarshaller createMarshaller() throws Exception { BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), log()); BinaryMarshaller marsh = new BinaryMarshaller(); BinaryConfiguration bCfg = new BinaryConfiguration(); IgniteConfiguration iCfg = new IgniteConfiguration(); iCfg.setBinaryConfiguration(bCfg); marsh.setContext(new MarshallerContextTestImpl(null)); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg); return marsh; }