/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); BinaryConfiguration binCfg = new BinaryConfiguration(); binCfg.setTypeConfigurations( Arrays.asList( new BinaryTypeConfiguration() { { setTypeName(Key.class.getName()); setIdentityResolver(BinaryArrayIdentityResolver.instance()); } }, new BinaryTypeConfiguration() { { setTypeName(Key2.class.getName()); setIdentityResolver(BinaryArrayIdentityResolver.instance()); } }, new BinaryTypeConfiguration() { { setTypeName(Key3.class.getName()); setIdentityResolver(new BinaryFieldIdentityResolver().setFieldNames("key")); } }, new BinaryTypeConfiguration() { { setTypeName(Key4.class.getName()); setIdentityResolver(new Key4Id()); } })); cfg.setBinaryConfiguration(binCfg); cfg.setPeerClassLoadingEnabled(false); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); BinaryTypeConfiguration customTypeCfg = new BinaryTypeConfiguration(); customTypeCfg.setTypeName(CustomIdMapper.class.getName()); customTypeCfg.setIdMapper( new BinaryIdMapper() { @Override public int typeId(String clsName) { return ~BinaryContext.defaultIdMapper().typeId(clsName); } @Override public int fieldId(int typeId, String fieldName) { return typeId + ~BinaryContext.defaultIdMapper().fieldId(typeId, fieldName); } }); BinaryConfiguration bCfg = new BinaryConfiguration(); bCfg.setCompactFooter(compactFooter()); bCfg.setTypeConfigurations( Arrays.asList( new BinaryTypeConfiguration(Key.class.getName()), new BinaryTypeConfiguration(Value.class.getName()), new BinaryTypeConfiguration("org.gridgain.grid.internal.util.binary.mutabletest.*"), customTypeCfg)); bCfg.setIdMapper(new BinaryBasicIdMapper(false)); bCfg.setNameMapper(new BinaryBasicNameMapper(false)); cfg.setBinaryConfiguration(bCfg); cfg.setMarshaller(new BinaryMarshaller()); this.cfg = cfg; return cfg; }