use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class CacheQueryBuildValueTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setMarshaller(null);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(TestBuilderValue.class.getName());
ArrayList<QueryIndex> idxs = new ArrayList<>();
QueryIndex idx = new QueryIndex("iVal");
idxs.add(idx);
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("iVal", Integer.class.getName());
entity.setFields(fields);
entity.setIndexes(idxs);
ccfg.setQueryEntities(Collections.singleton(entity));
cfg.setCacheConfiguration(ccfg);
BinaryConfiguration binaryCfg = new BinaryConfiguration();
BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();
typeCfg.setTypeName(TestBuilderValue.class.getName());
binaryCfg.setTypeConfigurations(Collections.singletonList(typeCfg));
cfg.setBinaryConfiguration(binaryCfg);
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridCacheBinaryObjectsAbstractDataStreamerSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setNearConfiguration(nearConfiguration());
cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
cfg.setCacheConfiguration(cacheCfg);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName())));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridCacheBinaryStoreAbstractSelfTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setNameMapper(new BinaryBasicNameMapper(false));
bCfg.setIdMapper(new BinaryBasicIdMapper(false));
bCfg.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName()));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
cacheCfg.setStoreKeepBinary(keepBinaryInStore());
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
cfg.setCacheConfiguration(cacheCfg);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
GridCacheBinaryStoreAbstractSelfTest.cfg = cfg;
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridCacheBinaryObjectsAbstractSelfTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
CacheConfiguration cacheCfg = createCacheConfig();
cacheCfg.setCacheStoreFactory(singletonFactory(new TestStore()));
CacheConfiguration binKeysCacheCfg = createCacheConfig();
binKeysCacheCfg.setCacheStoreFactory(singletonFactory(new MapCacheStoreStrategy.MapCacheStore()));
binKeysCacheCfg.setStoreKeepBinary(true);
binKeysCacheCfg.setName("BinKeysCache");
cfg.setCacheConfiguration(cacheCfg, binKeysCacheCfg);
cfg.setMarshaller(new BinaryMarshaller());
List<BinaryTypeConfiguration> binTypes = new ArrayList<>();
binTypes.add(new BinaryTypeConfiguration() {
{
setTypeName("ArrayHashedKey");
}
});
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setTypeConfigurations(binTypes);
cfg.setBinaryConfiguration(binCfg);
CacheKeyConfiguration arrayHashCfg = new CacheKeyConfiguration("ArrayHashedKey", "fld1");
cfg.setCacheKeyConfiguration(arrayHashCfg);
GridCacheBinaryObjectsAbstractSelfTest.cfg = cfg;
return cfg;
}
use of org.apache.ignite.configuration.BinaryConfiguration in project ignite by apache.
the class GridAbstractTest method getConfiguration.
/**
* This method should be overridden by subclasses to change configuration parameters.
*
* @param igniteInstanceName Ignite instance name.
* @return Grid configuration used for starting of grid.
* @throws Exception If failed.
*/
@SuppressWarnings("deprecation")
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = getConfiguration(igniteInstanceName, getTestResources());
cfg.setNodeId(null);
if (GridTestProperties.getProperty(GridTestProperties.BINARY_COMPACT_FOOTERS) != null) {
if (!Boolean.valueOf(GridTestProperties.getProperty(GridTestProperties.BINARY_COMPACT_FOOTERS))) {
BinaryConfiguration bCfg = cfg.getBinaryConfiguration();
if (bCfg == null) {
bCfg = new BinaryConfiguration();
cfg.setBinaryConfiguration(bCfg);
}
bCfg.setCompactFooter(false);
}
}
if (Boolean.valueOf(GridTestProperties.getProperty(BINARY_MARSHALLER_USE_SIMPLE_NAME_MAPPER))) {
BinaryConfiguration bCfg = cfg.getBinaryConfiguration();
if (bCfg == null) {
bCfg = new BinaryConfiguration();
cfg.setBinaryConfiguration(bCfg);
}
bCfg.setNameMapper(new BinaryBasicNameMapper(true));
}
if (igniteInstanceName != null && igniteInstanceName.matches(".*\\d")) {
String idStr = UUID.randomUUID().toString();
if (igniteInstanceName.startsWith(getTestIgniteInstanceName())) {
String idxStr = String.valueOf(getTestIgniteInstanceIndex(igniteInstanceName));
while (idxStr.length() < 5) idxStr = '0' + idxStr;
char[] chars = idStr.toCharArray();
for (int i = 0; i < idxStr.length(); i++) chars[chars.length - idxStr.length() + i] = idxStr.charAt(i);
cfg.setNodeId(UUID.fromString(new String(chars)));
} else {
char[] chars = idStr.toCharArray();
chars[0] = igniteInstanceName.charAt(igniteInstanceName.length() - 1);
chars[1] = '0';
chars[chars.length - 3] = '0';
chars[chars.length - 2] = '0';
chars[chars.length - 1] = igniteInstanceName.charAt(igniteInstanceName.length() - 1);
cfg.setNodeId(UUID.fromString(new String(chars)));
}
}
if (isMultiJvm())
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(LOCAL_IP_FINDER);
return cfg;
}
Aggregations