Search in sources :

Example 61 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class IgnitePersistentStoreTest method blobBinaryLoadCacheTest.

/**
 */
@Test
public void blobBinaryLoadCacheTest() {
    Ignition.stopAll(true);
    try (Ignite ignite = Ignition.start("org/apache/ignite/tests/persistence/loadall_blob/ignite-config.xml")) {
        IgniteCache<Long, PojoPerson> personCache = ignite.getOrCreateCache("cache2");
        assert ignite.configuration().getMarshaller() instanceof BinaryMarshaller;
        personCache.put(1L, new PojoPerson(1, "name"));
        assert personCache.withKeepBinary().get(1L) instanceof BinaryObject;
    }
    Ignition.stopAll(true);
    try (Ignite ignite = Ignition.start("org/apache/ignite/tests/persistence/loadall_blob/ignite-config.xml")) {
        IgniteCache<Long, PojoPerson> personCache = ignite.getOrCreateCache("cache2");
        personCache.loadCache(null, null);
        PojoPerson person = personCache.get(1L);
        LOGGER.info("loadCache tests passed");
    }
}
Also used : BinaryObject(org.apache.ignite.binary.BinaryObject) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) Ignite(org.apache.ignite.Ignite) Test(org.junit.Test)

Example 62 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class GridCacheUtilsSelfTest method binaryMarshaller.

/**
 * @return Binary marshaller.
 * @throws IgniteCheckedException if failed.
 */
private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException {
    IgniteConfiguration iCfg = new IgniteConfiguration();
    BinaryConfiguration bCfg = new BinaryConfiguration();
    iCfg.setBinaryConfiguration(bCfg);
    BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
    BinaryMarshaller marsh = new BinaryMarshaller();
    marsh.setContext(new MarshallerContextTestImpl(null));
    IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
    return marsh;
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) GridBinaryMarshaller(org.apache.ignite.internal.binary.GridBinaryMarshaller) BinaryContext(org.apache.ignite.internal.binary.BinaryContext) MarshallerContextTestImpl(org.apache.ignite.marshaller.MarshallerContextTestImpl)

Example 63 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class GridCacheBinariesNearPartitionedByteArrayValuesSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setMarshaller(new BinaryMarshaller());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller)

Example 64 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class TcpDiscoveryMarshallerCheckSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(discoSpi);
    cfg.setLocalHost("127.0.0.1");
    if (flag)
        cfg.setMarshaller(new JdkMarshaller());
    else
        cfg.setMarshaller(sameMarsh ? new JdkMarshaller() : new BinaryMarshaller());
    // Flip flag.
    flag = !flag;
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller)

Example 65 with BinaryMarshaller

use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.

the class IgniteHadoopFileSystemAbstractSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = new IgniteConfiguration();
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setIgniteInstanceName(igniteInstanceName);
    cfg.setMarshaller(new BinaryMarshaller());
    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsConfiguration(igniteInstanceName));
    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)93 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)61 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)34 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)22 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)14 Ignite (org.apache.ignite.Ignite)9 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)9 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)9 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)8 ArrayList (java.util.ArrayList)7 BinaryObject (org.apache.ignite.binary.BinaryObject)7 Marshaller (org.apache.ignite.marshaller.Marshaller)7 IgniteException (org.apache.ignite.IgniteException)6 NullLogger (org.apache.ignite.logger.NullLogger)6 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)6 HashMap (java.util.HashMap)5 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)5 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)5 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 JdkMarshaller (org.apache.ignite.marshaller.jdk.JdkMarshaller)4