Search in sources :

Example 1 with MarshallerContextTestImpl

use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.

the class OptimizedMarshallerTest method marshaller.

/**
 * @return Marshaller.
 */
private OptimizedMarshaller marshaller() {
    U.clearClassCache();
    OptimizedMarshaller marsh = new OptimizedMarshaller();
    marsh.setContext(new MarshallerContextTestImpl());
    return marsh;
}
Also used : MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl)

Example 2 with MarshallerContextTestImpl

use of org.apache.ignite.marshaller.MarshallerContextTestImpl 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 3 with MarshallerContextTestImpl

use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.

the class BinaryMarshallerSelfTest method binaryMarshaller.

/**
 * @return Binary marshaller.
 */
protected BinaryMarshaller binaryMarshaller(BinaryNameMapper nameMapper, BinaryIdMapper mapper, BinarySerializer serializer, Collection<BinaryTypeConfiguration> cfgs, Collection<String> excludedClasses) throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();
    BinaryConfiguration bCfg = new BinaryConfiguration();
    bCfg.setNameMapper(nameMapper);
    bCfg.setIdMapper(mapper);
    bCfg.setSerializer(serializer);
    bCfg.setCompactFooter(compactFooter());
    bCfg.setTypeConfigurations(cfgs);
    iCfg.setBinaryConfiguration(bCfg);
    iCfg.setClientMode(false);
    iCfg.setDiscoverySpi(new TcpDiscoverySpi() {

        @Override
        public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
        // No-op.
        }
    });
    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
    BinaryMarshaller marsh = new BinaryMarshaller();
    MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(null, excludedClasses);
    GridTestKernalContext kernCtx = new GridTestKernalContext(log, iCfg);
    kernCtx.add(new GridDiscoveryManager(kernCtx));
    marshCtx.onMarshallerProcessorStarted(kernCtx, null);
    marsh.setContext(marshCtx);
    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, 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) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) IgniteException(org.apache.ignite.IgniteException) GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 4 with MarshallerContextTestImpl

use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.

the class GridBinaryWildcardsSelfTest method binaryMarshaller.

/**
 */
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;
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl)

Example 5 with MarshallerContextTestImpl

use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.

the class BinaryFooterOffsetsAbstractSelfTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    super.beforeTest();
    ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger());
    marsh = new BinaryMarshaller();
    IgniteConfiguration iCfg = new IgniteConfiguration();
    BinaryConfiguration bCfg = new BinaryConfiguration();
    bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName())));
    bCfg.setCompactFooter(compactFooter());
    iCfg.setBinaryConfiguration(bCfg);
    marsh.setContext(new MarshallerContextTestImpl(null));
    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryTypeConfiguration(org.apache.ignite.binary.BinaryTypeConfiguration) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl)

Aggregations

MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)14 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)9 NullLogger (org.apache.ignite.logger.NullLogger)9 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)6 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)5 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)5 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 IgniteException (org.apache.ignite.IgniteException)2 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)2 GridDiscoveryManager (org.apache.ignite.internal.managers.discovery.GridDiscoveryManager)2 Marshaller (org.apache.ignite.marshaller.Marshaller)2 DiscoverySpiCustomMessage (org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage)2 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)2 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)2 Random (java.util.Random)1 BinaryObject (org.apache.ignite.binary.BinaryObject)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)1 CacheCheckpointSpi (org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi)1 Nullable (org.jetbrains.annotations.Nullable)1