use of org.apache.ignite.binary.BinaryWriter in project ignite by apache.
the class BinaryConfigurationConsistencySelfTest method customConfig.
/**
* @return Custom BinaryConfiguration.
* @param compactFooter Compact footer.
*/
private BinaryConfiguration customConfig(boolean compactFooter) {
BinaryConfiguration c = new BinaryConfiguration();
c.setIdMapper(new BinaryBasicIdMapper(true));
c.setSerializer(new BinarySerializer() {
@Override
public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
// No-op.
}
@Override
public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
// No-op.
}
});
c.setCompactFooter(compactFooter);
BinaryTypeConfiguration btc = new BinaryTypeConfiguration("org.MyClass");
btc.setIdMapper(BinaryContext.defaultIdMapper());
btc.setEnum(false);
btc.setSerializer(new BinarySerializer() {
@Override
public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
// No-op.
}
@Override
public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
// No-op.
}
});
c.setTypeConfigurations(Arrays.asList(btc));
return c;
}
use of org.apache.ignite.binary.BinaryWriter in project ignite by apache.
the class GridCacheBinaryObjectUserClassloaderSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setCacheConfiguration(cacheConfiguration(igniteInstanceName));
cfg.setMarshaller(new BinaryMarshaller());
cfg.setClassLoader(useWrappingLoader ? new WrappingClassLoader(getExternalClassLoader()) : getExternalClassLoader());
if (customBinaryConf) {
BinarySerializer bs = new BinarySerializer() {
/** {@inheritDoc} */
@Override
public void writeBinary(Object obj, BinaryWriter writer) throws BinaryObjectException {
//No-op.
}
/** {@inheritDoc} */
@Override
public void readBinary(Object obj, BinaryReader reader) throws BinaryObjectException {
deserialized = true;
}
};
BinaryTypeConfiguration btcfg1 = new BinaryTypeConfiguration();
btcfg1.setTypeName("org.apache.ignite.tests.p2p.CacheDeploymentTestValue");
btcfg1.setSerializer(bs);
BinaryTypeConfiguration btcfg2 = new BinaryTypeConfiguration();
btcfg2.setTypeName("org.apache.ignite.internal.processors.cache.binary." + "GridCacheBinaryObjectUserClassloaderSelfTest$TestValue1");
btcfg2.setSerializer(bs);
BinaryConfiguration bcfg = new BinaryConfiguration();
Set<BinaryTypeConfiguration> set = new HashSet<>();
set.add(btcfg1);
set.add(btcfg2);
bcfg.setTypeConfigurations(set);
cfg.setBinaryConfiguration(bcfg);
}
return cfg;
}
Aggregations