use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.
the class GridCacheUtilsSelfTest method binaryMarshaller.
/**
* @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;
}
use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.
the class IgfsFileInfoSelfTest method testSerialization.
/**
* Test node info serialization.
*
* @throws Exception If failed.
*/
public void testSerialization() throws Exception {
marshaller.setContext(new MarshallerContextTestImpl());
multithreaded(new Callable<Object>() {
private final Random rnd = new Random();
// Suppress due to default constructor should never be used directly.
@SuppressWarnings("deprecation")
@Nullable
@Override
public Object call() throws IgniteCheckedException {
testSerialization(IgfsUtils.createDirectory(IgniteUuid.randomUuid()));
return null;
}
}, 20);
}
use of org.apache.ignite.marshaller.MarshallerContextTestImpl 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());
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, cfg);
return marsh;
}
use of org.apache.ignite.marshaller.MarshallerContextTestImpl in project ignite by apache.
the class IgniteTestResources method getMarshaller.
/**
* @return Marshaller.
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
public static synchronized Marshaller getMarshaller() throws IgniteCheckedException {
String marshallerName = System.getProperty(MARSH_CLASS_NAME, GridTestProperties.getProperty(GridTestProperties.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) {
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger());
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, new IgniteConfiguration());
}
return marsh;
}
Aggregations