Java Code Examples for org.apache.ignite.configuration.BinaryConfiguration#setIdMapper()

The following examples show how to use org.apache.ignite.configuration.BinaryConfiguration#setIdMapper() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridCacheBinaryStoreBinariesSimpleNameMappersSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = cfg.getBinaryConfiguration();

    bCfg.setNameMapper(new BinaryBasicNameMapper());
    bCfg.setIdMapper(new BinaryBasicIdMapper(true));

    return cfg;
}
 
Example 2
Source File: BinaryObjectBuilderSimpleNameLowerCaseMappersSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@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;
}
 
Example 3
Source File: GridBinaryWildcardsSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
protected BinaryMarshaller binaryMarshaller(
    BinaryNameMapper nameMapper,
    BinaryIdMapper mapper,
    BinarySerializer serializer,
    Collection<BinaryTypeConfiguration> cfgs
) throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setNameMapper(nameMapper);
    bCfg.setIdMapper(mapper);
    bCfg.setSerializer(serializer);

    bCfg.setTypeConfigurations(cfgs);

    iCfg.setBinaryConfiguration(bCfg);

    BinaryContext ctx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger());

    BinaryMarshaller marsh = new BinaryMarshaller();

    marsh.setContext(new MarshallerContextTestImpl(null));

    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);

    return marsh;
}
 
Example 4
Source File: GridSimpleLowerCaseBinaryMappersBinaryMetaDataSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryConfiguration bCfg = cfg.getBinaryConfiguration();

    bCfg.setNameMapper(new BinaryBasicNameMapper());
    bCfg.setIdMapper(new BinaryBasicIdMapper(true));

    return cfg;
}
 
Example 5
Source File: BinaryMarshallerSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @return Binary marshaller.
 */
protected BinaryMarshaller binaryMarshaller(
    BinaryNameMapper nameMapper,
    BinaryIdMapper mapper,
    BinarySerializer serializer,
    Collection<BinaryTypeConfiguration> cfgs,
    Collection<String> excludedClasses
) throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setNameMapper(nameMapper);
    bCfg.setIdMapper(mapper);
    bCfg.setSerializer(serializer);
    bCfg.setCompactFooter(compactFooter());

    bCfg.setTypeConfigurations(cfgs);

    iCfg.setBinaryConfiguration(bCfg);
    iCfg.setClientMode(false);
    iCfg.setDiscoverySpi(new TcpDiscoverySpi() {
        @Override public void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException {
            //No-op.
        }
    });
    iCfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi());

    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());

    BinaryMarshaller marsh = new BinaryMarshaller();

    MarshallerContextTestImpl marshCtx = new MarshallerContextTestImpl(null, excludedClasses);

    GridTestKernalContext kernCtx = new GridTestKernalContext(log, iCfg);

    kernCtx.add(new GridSystemViewManager(kernCtx));
    kernCtx.add(new GridDiscoveryManager(kernCtx));

    marshCtx.onMarshallerProcessorStarted(kernCtx, null);

    marsh.setContext(marshCtx);

    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);

    return marsh;
}
 
Example 6
Source File: GridDefaultBinaryMappersBinaryMetaDataSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@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(TestObject1.class.getName(), TestObject2.class.getName()));

    cfg.setBinaryConfiguration(bCfg);

    cfg.setMarshaller(new BinaryMarshaller());

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    cfg.setCacheConfiguration(ccfg);

    GridDefaultBinaryMappersBinaryMetaDataSelfTest.cfg = cfg;

    return cfg;
}
 
Example 7
Source File: IgniteServiceProxyTimeoutInitializedTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    final ServiceConfiguration scfg = new ServiceConfiguration();

    if (igniteInstanceName.endsWith("0")) {
        scfg.setName("testService");
        scfg.setService(srvc);
        scfg.setMaxPerNodeCount(1);
        scfg.setTotalCount(1);
        scfg.setNodeFilter(new NodeFilter());

        final Map<String, String> attrs = new HashMap<>();

        attrs.put("clusterGroup", "0");

        cfg.setUserAttributes(attrs);

        cfg.setServiceConfiguration(scfg);
    }

    cfg.setMarshaller(null);

    final BinaryConfiguration binCfg = new BinaryConfiguration();

    // Despite defaults explicitly set to lower case.
    binCfg.setIdMapper(new BinaryBasicIdMapper(true));

    cfg.setBinaryConfiguration(binCfg);

    return cfg;
}
 
Example 8
Source File: GridCacheBinaryStoreAbstractSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@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);

    GridCacheBinaryStoreAbstractSelfTest.cfg = cfg;

    return cfg;
}