use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryConfigurationCustomSerializerSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setConnectorConfiguration(new ConnectorConfiguration());
cfg.setMarshaller(new BinaryMarshaller());
BinaryConfiguration binaryCfg = new BinaryConfiguration();
BinaryTypeConfiguration btc = new BinaryTypeConfiguration("org.MyClass");
btc.setIdMapper(BinaryContext.defaultIdMapper());
btc.setEnum(false);
// Set custom serializer that is unknown for Optimized marshaller.
btc.setSerializer(new MyBinarySerializer());
binaryCfg.setTypeConfigurations(Collections.singletonList(btc));
cfg.setBinaryConfiguration(binaryCfg);
// Set custom consistent ID that unknown for Optimized marshaller.
cfg.setConsistentId(new MyConsistentId("test"));
cfg.setCacheConfiguration(new CacheConfiguration("TEST"));
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryFieldExtractionSelfTest method createMarshaller.
/**
* 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;
}
use of org.apache.ignite.configuration.BinaryConfiguration 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));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class BinaryObjectBuilderSimpleNameLowerCaseMappersSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryConfiguration bCfg = cfg.getBinaryConfiguration();
bCfg.setIdMapper(new BinaryBasicIdMapper(true));
bCfg.setNameMapper(new BinaryBasicNameMapper(true));
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration 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