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

The following examples show how to use org.apache.ignite.configuration.BinaryConfiguration#setClassNames() . 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: 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 2
Source File: BinaryObjectBuilderAdditionalSelfTest.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);

    CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cacheCfg.setCacheMode(REPLICATED);

    CacheConfiguration cacheCfg2 = new CacheConfiguration("partitioned");
    cacheCfg2.setCacheMode(PARTITIONED);

    cfg.setCacheConfiguration(cacheCfg, cacheCfg2);

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setCompactFooter(compactFooter());

    bCfg.setClassNames(Arrays.asList("org.apache.ignite.internal.binary.mutabletest.*"));

    cfg.setMarshaller(new BinaryMarshaller());

    return cfg;
}
 
Example 3
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;
}
 
Example 4
Source File: GridCacheClientNodeBinaryObjectMetadataTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    BinaryMarshaller marsh = new BinaryMarshaller();

    BinaryConfiguration bCfg = new BinaryConfiguration();

    bCfg.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));

    BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();

    typeCfg.setTypeName(TestObject1.class.getName());

    CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject1.class.getName(), "val2");

    cfg.setCacheKeyConfiguration(keyCfg);

    bCfg.setTypeConfigurations(Arrays.asList(typeCfg));

    cfg.setBinaryConfiguration(bCfg);

    if (igniteInstanceName.equals(getTestIgniteInstanceName(gridCount() - 1)))
        cfg.setClientMode(true);

    cfg.setMarshaller(marsh);

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);

    return cfg;
}