new BinaryContext(metaHnd, ctx.config(), ctx.log(BinaryContext.class)); IgniteUtils.invoke(BinaryMarshaller.class, bMarsh0, "setBinaryContext", binaryCtx, ctx.config());
/** * Create instance of {@link BinaryMarshaller} suitable for use * without starting a grid upon given {@link IgniteConfiguration}. * * @return Binary marshaller. * @throws IgniteCheckedException if failed. */ protected BinaryMarshaller createStandaloneBinaryMarshaller(IgniteConfiguration cfg) throws IgniteCheckedException { BinaryMarshaller marsh = new BinaryMarshaller(); BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger()); marsh.setContext(new MarshallerContextTestImpl()); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, cfg); return marsh; }
new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger()); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, new IgniteConfiguration());
/** * Create marshaller. * * @return Binary marshaller. * @throws Exception If failed. */ protected BinaryMarshaller createMarshaller() throws Exception { BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger()); BinaryMarshaller marsh = new BinaryMarshaller(); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setCompactFooter(compactFooter()); bCfg.setTypeConfigurations(Arrays.asList( new BinaryTypeConfiguration(TestObject.class.getName()), new BinaryTypeConfiguration(TestOuterObject.class.getName()), new BinaryTypeConfiguration(TestInnerObject.class.getName()) )); IgniteConfiguration iCfg = new IgniteConfiguration(); iCfg.setBinaryConfiguration(bCfg); marsh.setContext(new MarshallerContextTestImpl(null)); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg); return marsh; }
/** {@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); }
/** * @return Binary marshaller. * @throws IgniteCheckedException if failed. */ private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException { IgniteConfiguration iCfg = new IgniteConfiguration(); BinaryConfiguration bCfg = new BinaryConfiguration(); iCfg.setBinaryConfiguration(bCfg); BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger()); BinaryMarshaller marsh = new BinaryMarshaller(); marsh.setContext(new MarshallerContextTestImpl(null)); IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg); return marsh; }
/** * @throws Exception In case of error. */ @Test public void testNoDeploymentInfo() throws Exception { GridCacheIoManager ioMgr = cacheIoManager(); TestMessage msg = new TestMessage(); assertNull(msg.deployInfo()); msg.addDepInfo = false; IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg, grid(1).cluster().localNode().id()); assertNull(msg.deployInfo()); }
/** * 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; }
/** {@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; } }
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
/** * @throws Exception In case of error. */ @Test public void testAddedDeploymentInfo() throws Exception { GridCacheContext ctx = cacheContext(); if (grid(0).configuration().getMarshaller() instanceof BinaryMarshaller) assertFalse(ctx.deploymentEnabled()); else { GridCacheIoManager ioMgr = cacheIoManager(); TestMessage msg = new TestMessage(); assertNull(msg.deployInfo()); msg.addDepInfo = true; IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg, grid(1).cluster().localNode().id()); assertNotNull(msg.deployInfo()); } }
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, cfg);
/** * @throws Exception In case of error. */ @Test public void testAddedDeploymentInfo2() throws Exception { GridCacheContext ctx = cacheContext(); if (grid(0).configuration().getMarshaller() instanceof BinaryMarshaller) assertFalse(ctx.deploymentEnabled()); else { assertTrue(ctx.deploymentEnabled()); GridCacheIoManager ioMgr = cacheIoManager(); TestMessage msg = new TestMessage(); assertNull(msg.deployInfo()); msg.addDepInfo = false; IgniteUtils.invoke(GridCacheIoManager.class, ioMgr, "onSend", msg, grid(1).cluster().localNode().id()); assertNull(msg.deployInfo()); } }
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", context, cfg);
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
IgniteUtils.invoke(BinaryMarshaller.class, bMarsh0, "setBinaryContext", binaryCtx, ctx.config());