Search in sources :

Example 46 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class BinaryMetadataUpdatesFlowTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    cfg.setPeerClassLoadingEnabled(false);
    if (applyDiscoveryHook) {
        final DiscoveryHook hook = discoveryHook != null ? discoveryHook : new DiscoveryHook();
        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {

            @Override
            public void setListener(@Nullable DiscoverySpiListener lsnr) {
                super.setListener(GridTestUtils.DiscoverySpiListenerWrapper.wrap(lsnr, hook));
            }
        };
        cfg.setDiscoverySpi(discoSpi);
        cfg.setMetricsUpdateFrequency(1000);
    }
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
    cfg.setMarshaller(new BinaryMarshaller());
    cfg.setClientMode(clientMode);
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setCacheMode(CacheMode.REPLICATED);
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) DiscoverySpiListener(org.apache.ignite.spi.discovery.DiscoverySpiListener) DiscoveryHook(org.apache.ignite.testframework.GridTestUtils.DiscoveryHook) Nullable(org.jetbrains.annotations.Nullable) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 47 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller 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 48 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller 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)

Example 49 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class GridCacheClientNodeBinaryObjectMetadataTest method getConfiguration.

/**
 * {@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;
}
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) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 50 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class DataStreamProcessorBinarySelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    BinaryMarshaller marsh = new BinaryMarshaller();
    cfg.setMarshaller(marsh);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller)

Aggregations

BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)93 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)61 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)34 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)22 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)14 Ignite (org.apache.ignite.Ignite)9 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)9 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)9 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)8 ArrayList (java.util.ArrayList)7 BinaryObject (org.apache.ignite.binary.BinaryObject)7 Marshaller (org.apache.ignite.marshaller.Marshaller)7 IgniteException (org.apache.ignite.IgniteException)6 NullLogger (org.apache.ignite.logger.NullLogger)6 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)6 HashMap (java.util.HashMap)5 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)5 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)5 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 JdkMarshaller (org.apache.ignite.marshaller.jdk.JdkMarshaller)4