use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class BinaryFieldsAbstractSelfTest method createMarshaller.
/**
* 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));
marsh.setBinaryContext(ctx, iCfg);
return marsh;
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridBinaryMarshallerCtxDisabledSelfTest method testObjectExchange.
/**
* @throws Exception If failed.
*/
@Test
public void testObjectExchange() throws Exception {
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextWithNoStorage());
IgniteConfiguration cfg = new IgniteConfiguration();
BinaryContext context = new BinaryContext(BinaryCachingMetadataHandler.create(), cfg, new NullLogger());
marsh.setBinaryContext(context, cfg);
SimpleObject simpleObj = new SimpleObject();
simpleObj.b = 2;
simpleObj.bArr = new byte[] { 2, 3, 4, 5, 5 };
simpleObj.c = 'A';
simpleObj.enumVal = TestEnum.D;
simpleObj.objArr = new Object[] { "hello", "world", "from", "me" };
simpleObj.enumArr = new TestEnum[] { TestEnum.C, TestEnum.B };
SimpleObject otherObj = new SimpleObject();
otherObj.b = 3;
otherObj.bArr = new byte[] { 5, 3, 4 };
simpleObj.otherObj = otherObj;
assertEquals(simpleObj, marsh.unmarshal(marsh.marshal(simpleObj), null));
SimpleBinary simpleBinary = new SimpleBinary();
simpleBinary.str = "binary";
simpleBinary.arr = new long[] { 100, 200, 300 };
assertEquals(simpleBinary, marsh.unmarshal(marsh.marshal(simpleBinary), null));
SimpleExternalizable simpleExtr = new SimpleExternalizable();
simpleExtr.str = "externalizable";
simpleExtr.arr = new long[] { 20000, 300000, 400000 };
assertEquals(simpleExtr, marsh.unmarshal(marsh.marshal(simpleExtr), null));
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridAbstractTest method createStandaloneBinaryMarshaller.
/**
* 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());
marsh.setBinaryContext(ctx, cfg);
return marsh;
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class GridTestBinaryMarshaller method createBinaryMarshaller.
/**
* @param log Logger.
*/
private BinaryMarshaller createBinaryMarshaller(IgniteLogger log) throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration().setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(true)).setClientMode(false).setDiscoverySpi(new TcpDiscoverySpi() {
@Override
public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
// No-op.
}
});
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl();
marshCtx.onMarshallerProcessorStarted(new GridTestKernalContext(log, iCfg), null);
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(marshCtx);
marsh.setBinaryContext(ctx, iCfg);
return marsh;
}
use of org.apache.ignite.logger.NullLogger in project ignite by apache.
the class IgniteTestResources method getMarshaller.
/**
* @return Marshaller.
* @throws IgniteCheckedException If failed.
*/
public static synchronized Marshaller getMarshaller() throws IgniteCheckedException {
String marshallerName = System.getProperty(MARSH_CLASS_NAME);
Marshaller marsh;
if (marshallerName == null)
marsh = new BinaryMarshaller();
else {
try {
Class<? extends Marshaller> cls = (Class<? extends Marshaller>) Class.forName(marshallerName);
marsh = cls.newInstance();
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
throw new IgniteCheckedException("Failed to create test marshaller [marshaller=" + marshallerName + ']', e);
}
}
marsh.setContext(new MarshallerContextTestImpl());
if (marsh instanceof BinaryMarshaller) {
BinaryMarshaller binaryMarsh = (BinaryMarshaller) marsh;
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger());
binaryMarsh.setBinaryContext(ctx, new IgniteConfiguration());
}
return marsh;
}
Aggregations