Search in sources :

Example 36 with BinaryConfiguration

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

the class GridCacheBinaryObjectUserClassloaderSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    cfg.setCacheConfiguration(cacheConfiguration(igniteInstanceName));
    cfg.setMarshaller(new BinaryMarshaller());
    cfg.setClassLoader(useWrappingLoader ? new WrappingClassLoader(getExternalClassLoader()) : getExternalClassLoader());
    if (customBinaryConf) {
        BinarySerializer bs = new BinarySerializer() {

            /** {@inheritDoc} */
            @Override
            public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
            //No-op.
            }

            /** {@inheritDoc} */
            @Override
            public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
                deserialized = true;
            }
        };
        BinaryTypeConfiguration btcfg1 = new BinaryTypeConfiguration();
        btcfg1.setTypeName("org.apache.ignite.tests.p2p.CacheDeploymentTestValue");
        btcfg1.setSerializer(bs);
        BinaryTypeConfiguration btcfg2 = new BinaryTypeConfiguration();
        btcfg2.setTypeName("org.apache.ignite.internal.processors.cache.binary." + "GridCacheBinaryObjectUserClassloaderSelfTest$TestValue1");
        btcfg2.setSerializer(bs);
        BinaryConfiguration bcfg = new BinaryConfiguration();
        Set<BinaryTypeConfiguration> set = new HashSet<>();
        set.add(btcfg1);
        set.add(btcfg2);
        bcfg.setTypeConfigurations(set);
        cfg.setBinaryConfiguration(bcfg);
    }
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryWriter(org.apache.ignite.binary.BinaryWriter) BinaryTypeConfiguration(org.apache.ignite.binary.BinaryTypeConfiguration) BinaryReader(org.apache.ignite.binary.BinaryReader) BinarySerializer(org.apache.ignite.binary.BinarySerializer) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) HashSet(java.util.HashSet)

Example 37 with BinaryConfiguration

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

the class GridCacheAffinityRoutingBinarySelfTest method getConfiguration.

/** {@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;
}
Also used : CacheKeyConfiguration(org.apache.ignite.cache.CacheKeyConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryTypeConfiguration(org.apache.ignite.binary.BinaryTypeConfiguration)

Example 38 with BinaryConfiguration

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

the class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryTypeConfiguration(org.apache.ignite.binary.BinaryTypeConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)38 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)29 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)18 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)12 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)12 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)11 BinaryBasicNameMapper (org.apache.ignite.binary.BinaryBasicNameMapper)10 BinaryBasicIdMapper (org.apache.ignite.binary.BinaryBasicIdMapper)9 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)6 NullLogger (org.apache.ignite.logger.NullLogger)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)4 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 LinkedHashMap (java.util.LinkedHashMap)3 IgniteException (org.apache.ignite.IgniteException)3 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)3 BinaryIdMapper (org.apache.ignite.binary.BinaryIdMapper)2 BinaryReader (org.apache.ignite.binary.BinaryReader)2 BinarySerializer (org.apache.ignite.binary.BinarySerializer)2