Search in sources :

Example 26 with BinaryMarshaller

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

the class H2DynamicTableSelfTest method commonConfiguration.

/**
     * Create common node configuration.
     *
     * @param idx Index.
     * @return Configuration.
     * @throws Exception If failed.
     */
private IgniteConfiguration commonConfiguration(int idx) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(getTestIgniteInstanceName(idx));
    cfg.setMarshaller(new BinaryMarshaller());
    return optimize(cfg);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller)

Example 27 with BinaryMarshaller

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

the class GridComputationBinarylizableClosuresSelfTest 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 28 with BinaryMarshaller

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

the class GridCacheReplicatedPreloadSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    cfg.setCacheConfiguration(cacheConfiguration(igniteInstanceName));
    cfg.setDeploymentMode(CONTINUOUS);
    cfg.setUserAttributes(F.asMap("EVEN", !igniteInstanceName.endsWith("0") && !igniteInstanceName.endsWith("2")));
    MemoryEventStorageSpi spi = new MemoryEventStorageSpi();
    spi.setExpireCount(50_000);
    cfg.setEventStorageSpi(spi);
    if (disableP2p)
        cfg.setPeerClassLoadingEnabled(false);
    if (getTestIgniteInstanceName(1).equals(igniteInstanceName) || useExtClassLoader || cfg.getMarshaller() instanceof BinaryMarshaller)
        cfg.setClassLoader(getExternalClassLoader());
    if (isClient)
        cfg.setClientMode(true);
    if (cutromEvt) {
        int[] evts = new int[EVTS_ALL.length + 1];
        evts[0] = Integer.MAX_VALUE - 1;
        System.arraycopy(EVTS_ALL, 0, evts, 1, EVTS_ALL.length);
        cfg.setIncludeEventTypes(evts);
    }
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) MemoryEventStorageSpi(org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 29 with BinaryMarshaller

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

the class GridCacheReplicatedPreloadSelfTest method testDeployment.

/**
     * @throws Exception If test failed.
     */
public void testDeployment() throws Exception {
    // TODO GG-11141.
    if (true)
        return;
    preloadMode = SYNC;
    try {
        Ignite g1 = startGrid(1);
        Ignite g2 = startGrid(2);
        IgniteCache<Integer, Object> cache1 = g1.cache(DEFAULT_CACHE_NAME);
        IgniteCache<Integer, Object> cache2 = g2.cache(DEFAULT_CACHE_NAME);
        ClassLoader ldr = grid(1).configuration().getClassLoader();
        Object v1 = ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestValue3").newInstance();
        cache1.put(1, v1);
        info("Stored value in cache1 [v=" + v1 + ", ldr=" + v1.getClass().getClassLoader() + ']');
        Object v2 = cache2.get(1);
        info("Read value from cache2 [v=" + v2 + ", ldr=" + v2.getClass().getClassLoader() + ']');
        assert v2 != null;
        assert v2.toString().equals(v1.toString());
        assert !v2.getClass().getClassLoader().equals(getClass().getClassLoader());
        assert v2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader") || grid(2).configuration().getMarshaller() instanceof BinaryMarshaller;
        Object e1 = ldr.loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestEnumValue").getEnumConstants()[0];
        cache1.put(2, e1);
        Object e2 = cache2.get(2);
        if (g1.configuration().getMarshaller() instanceof BinaryMarshaller) {
            BinaryObject enumObj = (BinaryObject) cache2.withKeepBinary().get(2);
            assertEquals(0, enumObj.enumOrdinal());
            assertTrue(enumObj.type().isEnum());
            assertTrue(enumObj instanceof BinaryEnumObjectImpl);
        }
        assert e2 != null;
        assert e2.toString().equals(e1.toString());
        assert !e2.getClass().getClassLoader().equals(getClass().getClassLoader());
        assert e2.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader") || grid(2).configuration().getMarshaller() instanceof BinaryMarshaller;
        stopGrid(1);
        Ignite g3 = startGrid(3);
        IgniteCache<Integer, Object> cache3 = g3.cache(DEFAULT_CACHE_NAME);
        Object v3 = cache3.localPeek(1, CachePeekMode.ONHEAP);
        assert v3 != null;
        info("Read value from cache3 [v=" + v3 + ", ldr=" + v3.getClass().getClassLoader() + ']');
        assert v3 != null;
        assert v3.toString().equals(v1.toString());
        assert !v3.getClass().getClassLoader().equals(getClass().getClassLoader());
        assert v3.getClass().getClassLoader().getClass().getName().contains("GridDeploymentClassLoader") || grid(3).configuration().getMarshaller() instanceof BinaryMarshaller;
    } finally {
        stopAllGrids();
    }
}
Also used : BinaryObject(org.apache.ignite.binary.BinaryObject) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) Ignite(org.apache.ignite.Ignite) BinaryObject(org.apache.ignite.binary.BinaryObject) BinaryEnumObjectImpl(org.apache.ignite.internal.binary.BinaryEnumObjectImpl)

Example 30 with BinaryMarshaller

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

the class PublicThreadpoolStarvationTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setPublicThreadPoolSize(1);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    cfg.setMarshaller(new BinaryMarshaller());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)

Aggregations

BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)87 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)56 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)30 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)21 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)12 Ignite (org.apache.ignite.Ignite)9 ArrayList (java.util.ArrayList)8 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)8 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)8 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)7 BinaryObject (org.apache.ignite.binary.BinaryObject)6 NullLogger (org.apache.ignite.logger.NullLogger)6 Marshaller (org.apache.ignite.marshaller.Marshaller)6 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)5 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)5 Connection (java.sql.Connection)4 ResultSet (java.sql.ResultSet)4 HashMap (java.util.HashMap)4 IgniteException (org.apache.ignite.IgniteException)4 CacheKeyConfiguration (org.apache.ignite.cache.CacheKeyConfiguration)4