Search in sources :

Example 16 with BinaryMarshaller

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

the class GridCacheBinaryStoreAbstractSelfTest method getConfiguration.

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    BinaryConfiguration bCfg = new BinaryConfiguration();
    bCfg.setNameMapper(new BinaryBasicNameMapper(false));
    bCfg.setIdMapper(new BinaryBasicIdMapper(false));
    bCfg.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName()));
    cfg.setBinaryConfiguration(bCfg);
    cfg.setMarshaller(new BinaryMarshaller());
    CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
    cacheCfg.setStoreKeepBinary(keepBinaryInStore());
    cacheCfg.setReadThrough(true);
    cacheCfg.setWriteThrough(true);
    cacheCfg.setLoadPreviousValue(true);
    cfg.setCacheConfiguration(cacheCfg);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    GridCacheBinaryStoreAbstractSelfTest.cfg = cfg;
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryBasicNameMapper(org.apache.ignite.binary.BinaryBasicNameMapper) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryBasicIdMapper(org.apache.ignite.binary.BinaryBasicIdMapper) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 17 with BinaryMarshaller

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

the class GridCacheBinaryObjectMetadataExchangeMultinodeTest method getConfiguration.

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

            @Override
            public void setListener(@Nullable DiscoverySpiListener lsnr) {
                super.setListener(DiscoverySpiListenerWrapper.wrap(lsnr, hook));
            }
        });
    }
    ((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) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 18 with BinaryMarshaller

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

the class BinaryTxCacheLocalEntriesSelfTest method getConfiguration.

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

Example 19 with BinaryMarshaller

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

the class GridBinaryCacheEntryMemorySizeSelfTest method createMarshaller.

/** {@inheritDoc} */
@Override
protected Marshaller createMarshaller() throws IgniteCheckedException {
    BinaryMarshaller marsh = new BinaryMarshaller();
    IgniteConfiguration iCfg = new IgniteConfiguration();
    iCfg.setDiscoverySpi(new TcpDiscoverySpi() {

        @Override
        public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
        // No-op.
        }
    });
    iCfg.setClientMode(false);
    GridTestKernalContext kernCtx = new GridTestKernalContext(log, iCfg);
    kernCtx.add(new GridDiscoveryManager(kernCtx));
    MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(null);
    marshCtx.onMarshallerProcessorStarted(kernCtx, null);
    marsh.setContext(marshCtx);
    BinaryContext pCtx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger());
    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", pCtx, iCfg);
    return marsh;
}
Also used : DiscoverySpiCustomMessage(org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage) GridDiscoveryManager(org.apache.ignite.internal.managers.discovery.GridDiscoveryManager) NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) IgniteException(org.apache.ignite.IgniteException) GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) BinaryContext(org.apache.ignite.internal.binary.BinaryContext) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 20 with BinaryMarshaller

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

the class GridCacheBinaryObjectsAbstractSelfTest method getConfiguration.

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    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;
}
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) ArrayList(java.util.ArrayList) 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

BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)87 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)56 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)30 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)21 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)12 Ignite (org.apache.ignite.Ignite)9 ArrayList (java.util.ArrayList)8 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)8 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)8 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)7 BinaryObject (org.apache.ignite.binary.BinaryObject)6 NullLogger (org.apache.ignite.logger.NullLogger)6 Marshaller (org.apache.ignite.marshaller.Marshaller)6 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)5 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)5 Connection (java.sql.Connection)4 ResultSet (java.sql.ResultSet)4 HashMap (java.util.HashMap)4 IgniteException (org.apache.ignite.IgniteException)4 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)4