You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/09/15 01:12:42 UTC

[01/41] ignite git commit: IGNITE-264 - Check backup node for one-phase transaction when primary node crashes.

Repository: ignite
Updated Branches:
  refs/heads/ignite-1400 4200b9efc -> 8c907d66b


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
index 80fdbbe..ea7b124 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteInternalCacheTypesTest.java
@@ -131,7 +131,7 @@ public class IgniteInternalCacheTypesTest extends GridCommonAbstractTest {
 
         checkCache(ignite, CU.MARSH_CACHE_NAME, MARSH_CACHE_POOL, false, false);
 
-        checkCache(ignite, CU.ATOMICS_CACHE_NAME, SYSTEM_POOL, false, false);
+        checkCache(ignite, CU.ATOMICS_CACHE_NAME, SYSTEM_POOL, false, true);
 
         for (String cache : userCaches)
             checkCache(ignite, cache, SYSTEM_POOL, true, false);
@@ -157,4 +157,4 @@ public class IgniteInternalCacheTypesTest extends GridCommonAbstractTest {
         assertEquals("Unexpected property for cache: " + cache.name(), user, cache.context().userCache());
         assertEquals("Unexpected property for cache: " + cache.name(), sysTx, cache.context().systemTx());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
new file mode 100644
index 0000000..87c160f
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cluster.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.communication.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.apache.ignite.transactions.*;
+
+import javax.cache.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
+
+/**
+ * Checks one-phase commit scenarios.
+ */
+public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest {
+    /** Grid count. */
+    private static final int GRID_CNT = 4;
+
+    /** */
+    private int backups = 1;
+
+    /** */
+    private static Map<Class<?>, AtomicInteger> msgCntMap = new ConcurrentHashMap<>();
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setCacheConfiguration(cacheConfiguration(gridName));
+
+        cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
+
+        cfg.setCommunicationSpi(new MessageCountingCommunicationSpi());
+
+        return cfg;
+    }
+
+    /**
+     * @param gridName Grid name.
+     * @return Cache configuration.
+     */
+    protected CacheConfiguration cacheConfiguration(String gridName) {
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setBackups(backups);
+        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+        ccfg.setNearConfiguration(new NearCacheConfiguration());
+
+        return ccfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOnePhaseCommitFromNearNode() throws Exception {
+        backups = 1;
+
+        startGrids(GRID_CNT);
+
+        try {
+            awaitPartitionMapExchange();
+
+            int key = generateNearKey();
+
+            IgniteCache<Object, Object> cache = ignite(0).cache(null);
+
+            checkKey(ignite(0).transactions(), cache, key);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @param transactions Transactions instance.
+     * @param cache Cache instance.
+     * @param key Key.
+     */
+    private void checkKey(IgniteTransactions transactions, Cache<Object, Object> cache, int key) throws Exception {
+        cache.put(key, key);
+
+        finalCheck(key, true);
+
+        TransactionIsolation[] isolations = {READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE};
+        TransactionConcurrency[] concurrencies = {OPTIMISTIC, PESSIMISTIC};
+
+        for (TransactionIsolation isolation : isolations) {
+            for (TransactionConcurrency concurrency : concurrencies) {
+                info("Checking transaction [isolation=" + isolation + ", concurrency=" + concurrency + ']');
+
+                try (Transaction tx = transactions.txStart(concurrency, isolation)) {
+                    cache.put(key, isolation + "-" + concurrency);
+
+                    tx.commit();
+                }
+
+                finalCheck(key, true);
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void finalCheck(final int key, boolean onePhase) throws Exception {
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                try {
+                    for (int i = 0; i < GRID_CNT; i++) {
+                        GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache();
+
+                        GridCacheEntryEx entry = cache.peekEx(key);
+
+                        if (entry != null) {
+                            if (entry.lockedByAny()) {
+                                info("Near entry is still locked [i=" + i + ", entry=" + entry + ']');
+
+                                return false;
+                            }
+                        }
+
+                        entry = cache.context().near().dht().peekEx(key);
+
+                        if (entry != null) {
+                            if (entry.lockedByAny()) {
+                                info("DHT entry is still locked [i=" + i + ", entry=" + entry + ']');
+
+                                return false;
+                            }
+                        }
+                    }
+
+                    return true;
+                }
+                catch (GridCacheEntryRemovedException ignore) {
+                    info("Entry was removed, will retry");
+
+                    return false;
+                }
+            }
+        }, 10_000);
+
+        if (onePhase) {
+            assertMessageCount(GridNearTxPrepareRequest.class, 1);
+            assertMessageCount(GridDhtTxPrepareRequest.class, 1);
+            assertMessageCount(GridNearTxFinishRequest.class, 1);
+            assertMessageCount(GridDhtTxFinishRequest.class, 0);
+
+            msgCntMap.clear();
+        }
+    }
+
+    /**
+     * @param cls Class to check.
+     * @param cnt Expected count.
+     */
+    private void assertMessageCount(Class<?> cls, int cnt) {
+        AtomicInteger val = msgCntMap.get(cls);
+
+        int iVal = val == null ? 0 : val.get();
+
+        assertEquals("Invalid message count for class: " + cls.getSimpleName(), cnt, iVal);
+    }
+
+    /**
+     * @return Key.
+     */
+    protected int generateNearKey() {
+        Affinity<Object> aff = ignite(0).affinity(null);
+
+        int key = 0;
+
+        while (true) {
+            boolean primary = aff.isPrimary(ignite(1).cluster().localNode(), key);
+            boolean primaryOrBackup = aff.isPrimaryOrBackup(ignite(0).cluster().localNode(), key);
+
+            if (primary && !primaryOrBackup)
+                return key;
+
+            key++;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class MessageCountingCommunicationSpi extends TcpCommunicationSpi {
+        /** {@inheritDoc} */
+        @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure)
+            throws IgniteSpiException {
+            if (msg instanceof GridIoMessage) {
+                GridIoMessage ioMsg = (GridIoMessage)msg;
+
+                Class<?> cls = ioMsg.message().getClass();
+
+                AtomicInteger cntr = msgCntMap.get(cls);
+
+                if (cntr == null)
+                    cntr = F.addIfAbsent(msgCntMap, cls, new AtomicInteger());
+
+                cntr.incrementAndGet();
+            }
+
+            super.sendMessage(node, msg, ackClosure);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
index e712cc9..5bc779c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.events.EventType;
 import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -98,7 +99,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
         startGrid(1);
         startGrid(2);
 
-        PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
+        final PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
 
         ignite(2).events().localListen(lsnr, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
 
@@ -127,7 +128,11 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         assert !cache.containsKey(key);
 
-        assert !lsnr.lostParts.isEmpty();
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return !lsnr.lostParts.isEmpty();
+            }
+        }, getTestTimeout());
     }
 
     /**
@@ -139,7 +144,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         awaitPartitionMapExchange();
 
-        PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
+        final PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
 
         ignite(1).events().localListen(lsnr, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
 
@@ -157,7 +162,11 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         assert !jcache(1).containsKey(key);
 
-        assert !lsnr.lostParts.isEmpty();
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return !lsnr.lostParts.isEmpty();
+            }
+        }, getTestTimeout());
     }
 
     /**
@@ -172,7 +181,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         startGrid(0);
 
-        PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
+        final PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
 
         grid(1).events().localListen(lsnr, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
 
@@ -206,7 +215,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         startGrid(1);
 
-        PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
+        final PartitionNotFullyLoadedListener lsnr = new PartitionNotFullyLoadedListener();
 
         grid(1).events().localListen(lsnr, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
 
@@ -235,7 +244,11 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         awaitPartitionMapExchange();
 
-        assert !lsnr.lostParts.isEmpty();
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                return !lsnr.lostParts.isEmpty();
+            }
+        }, getTestTimeout());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index 27b201f..806d8b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -182,7 +182,8 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
 
         startGrids(GRID_CNT);
 
-        awaitPartitionMapExchange();
+        if (cacheMode == REPLICATED)
+            awaitPartitionMapExchange();
 
         ignites = new Ignite[GRID_CNT];
         ids = new UUID[GRID_CNT];
@@ -624,4 +625,4 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
             return null;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
new file mode 100644
index 0000000..1135c40
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -0,0 +1,400 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionRollbackException;
+
+import javax.cache.CacheException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Tests one-phase commit transactions when some of the nodes fail in the middle of the transaction.
+ */
+@SuppressWarnings("unchecked")
+public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
+    /**
+     * @return Grid count.
+     */
+    public int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setCacheConfiguration(cacheConfiguration(gridName));
+
+        cfg.setCommunicationSpi(new BanningCommunicationSpi());
+
+        return cfg;
+    }
+
+    /**
+     * @param gridName Grid name.
+     * @return Cache configuration.
+     */
+    protected CacheConfiguration cacheConfiguration(String gridName) {
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+        ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        ccfg.setBackups(1);
+
+        return ccfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupCommitPessimistic() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(PESSIMISTIC, false, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupCommitOptimistic() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(OPTIMISTIC, false, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupCommitPessimisticOnBackup() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(PESSIMISTIC, true, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupCommitOptimisticOnBackup() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(OPTIMISTIC, true, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupRollbackPessimistic() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(PESSIMISTIC, false, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupRollbackOptimistic() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(OPTIMISTIC, false, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupRollbackPessimisticOnBackup() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(PESSIMISTIC, true, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupRollbackOptimisticOnBackup() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(OPTIMISTIC, true, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupCommitImplicit() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(null, false, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupCommitImplicitOnBackup() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(null, true, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupRollbackImplicit() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(null, false, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPrimaryNodeFailureBackupRollbackImplicitOnBackup() throws Exception {
+        checkPrimaryNodeFailureBackupCommit(null, true, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkPrimaryNodeFailureBackupCommit(
+        final TransactionConcurrency conc,
+        boolean backup,
+        final boolean commit
+    ) throws Exception {
+        startGrids(gridCount());
+        awaitPartitionMapExchange();
+
+        for (int i = 0; i < gridCount(); i++)
+            info("Grid " + i + ": " + ignite(i).cluster().localNode().id());
+
+        try {
+            final Ignite ignite = ignite(0);
+
+            final IgniteCache<Object, Object> cache = ignite.cache(null);
+
+            final int key = generateKey(ignite, backup);
+
+            IgniteEx backupNode = (IgniteEx)backupNode(key, null);
+
+            assertNotNull(backupNode);
+
+            final CountDownLatch commitLatch = new CountDownLatch(1);
+
+            if (!commit) {
+                communication(1).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareRequest.class));
+            }
+            else {
+                if (!backup) {
+                    communication(2).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareResponse.class));
+                    communication(3).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareResponse.class));
+                }
+                else
+                    communication(0).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareResponse.class));
+            }
+
+            IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    if (conc != null) {
+                        try (Transaction tx = ignite.transactions().txStart(conc, REPEATABLE_READ)) {
+                            cache.put(key, key);
+
+                            Transaction asyncTx = (Transaction)tx.withAsync();
+
+                            asyncTx.commit();
+
+                            commitLatch.countDown();
+
+                            try {
+                                IgniteFuture<Object> fut = asyncTx.future();
+
+                                fut.get();
+
+                                if (!commit) {
+                                    error("Transaction has been committed");
+
+                                    fail("Transaction has been committed: " + tx);
+                                }
+                            }
+                            catch (TransactionRollbackException e) {
+                                if (commit) {
+                                    error(e.getMessage(), e);
+
+                                    fail("Failed to commit: " + e);
+                                }
+                                else
+                                    assertTrue(X.hasCause(e, TransactionRollbackException.class));
+                            }
+                        }
+                    }
+                    else {
+                        IgniteCache<Object, Object> cache0 = cache.withAsync();
+
+                        cache0.put(key, key);
+
+                        Thread.sleep(1000);
+
+                        commitLatch.countDown();
+
+                        try {
+                            cache0.future().get();
+
+                            if (!commit) {
+                                error("Transaction has been committed");
+
+                                fail("Transaction has been committed.");
+                            }
+                        }
+                        catch (CacheException e) {
+                            if (commit) {
+                                error(e.getMessage(), e);
+
+                                fail("Failed to commit: " + e);
+                            }
+                            else
+                                assertTrue(X.hasCause(e, TransactionRollbackException.class));
+                        }
+                    }
+
+                    return null;
+                }
+            });
+
+            commitLatch.await();
+
+            stopGrid(1);
+
+            // Check that thread successfully finished.
+            fut.get();
+
+            // Check there are no hanging transactions.
+            assertEquals(0, ((IgniteEx)ignite(0)).context().cache().context().tm().idMapSize());
+            assertEquals(0, ((IgniteEx)ignite(2)).context().cache().context().tm().idMapSize());
+            assertEquals(0, ((IgniteEx)ignite(3)).context().cache().context().tm().idMapSize());
+
+            dataCheck((IgniteKernal)ignite(0), (IgniteKernal)backupNode, key, commit);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @param orig Originating cache.
+     * @param backup Backup cache.
+     * @param key Key being committed and checked.
+     * @param commit Commit or rollback flag.
+     * @throws Exception If check failed.
+     */
+    private void dataCheck(IgniteKernal orig, IgniteKernal backup, int key, boolean commit) throws Exception {
+        GridNearCacheEntry nearEntry = null;
+
+        GridCacheAdapter origCache = orig.internalCache(null);
+
+        if (origCache.isNear())
+            nearEntry = (GridNearCacheEntry)origCache.peekEx(key);
+
+        GridCacheAdapter backupCache = backup.internalCache(null);
+
+        if (backupCache.isNear())
+            backupCache = backupCache.context().near().dht();
+
+        GridDhtCacheEntry dhtEntry = (GridDhtCacheEntry)backupCache.peekEx(key);
+
+        if (commit) {
+            assertNotNull(dhtEntry);
+            assertTrue("dhtEntry=" + dhtEntry, dhtEntry.remoteMvccSnapshot().isEmpty());
+            assertTrue("dhtEntry=" + dhtEntry, dhtEntry.localCandidates().isEmpty());
+            assertEquals(key, backupCache.localPeek(key, null, null));
+
+            if (nearEntry != null) {
+                assertTrue("near=" + nearEntry, nearEntry.remoteMvccSnapshot().isEmpty());
+                assertTrue("near=" + nearEntry, nearEntry.localCandidates().isEmpty());
+
+                // Near peek wil be null since primary node has changed.
+                assertNull("near=" + nearEntry, origCache.localPeek(key, null, null));
+            }
+        }
+        else {
+            assertTrue("near=" + nearEntry + ", hc=" + System.identityHashCode(nearEntry), nearEntry == null);
+            assertTrue("Invalid backup cache entry: " + dhtEntry,
+                dhtEntry == null || dhtEntry.rawGetOrUnmarshal(false) == null);
+        }
+    }
+
+    /**
+     * @param idx Index.
+     * @return Communication SPI.
+     */
+    private BanningCommunicationSpi communication(int idx) {
+        return (BanningCommunicationSpi)ignite(idx).configuration().getCommunicationSpi();
+    }
+
+    /**
+     * @param ignite Ignite instance to generate key.
+     * @return Generated key that is not primary nor backup for {@code ignite(0)} and primary for
+     *      {@code ignite(1)}.
+     */
+    private int generateKey(Ignite ignite, boolean backup) {
+        Affinity<Object> aff = ignite.affinity(null);
+
+        for (int key = 0;;key++) {
+            if (backup) {
+                if (!aff.isBackup(ignite(0).cluster().localNode(), key))
+                    continue;
+            }
+            else {
+                if (aff.isPrimaryOrBackup(ignite(0).cluster().localNode(), key))
+                    continue;
+            }
+
+            if (aff.isPrimary(ignite(1).cluster().localNode(), key))
+                return key;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class BanningCommunicationSpi extends TcpCommunicationSpi {
+        /** */
+        private volatile Collection<Class> bannedClasses = Collections.emptyList();
+
+        /**
+         * @param bannedClasses Banned classes.
+         */
+        public void bannedClasses(Collection<Class> bannedClasses) {
+            this.bannedClasses = bannedClasses;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
+            GridIoMessage ioMsg = (GridIoMessage)msg;
+
+            if (!bannedClasses.contains(ioMsg.message().getClass())) {
+                super.sendMessage(node, msg, ackClosure);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java
new file mode 100644
index 0000000..5735182
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridNearCacheTxNodeFailureSelfTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+
+/**
+ *
+ */
+public class GridNearCacheTxNodeFailureSelfTest extends GridCacheTxNodeFailureSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) {
+        return super.cacheConfiguration(gridName).setNearConfiguration(new NearCacheConfiguration());
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
new file mode 100644
index 0000000..cee54b8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -0,0 +1,283 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ *
+ */
+public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstractTest {
+    /**
+     * Grid count.
+     */
+    private static final int GRID_CNT = 5;
+
+    /**
+     * Restart count.
+     */
+    private static final int RESTART_CNT = 15;
+
+    /**
+     * Atomic long name.
+     */
+    private static final String ATOMIC_LONG_NAME = "test-atomic-long";
+
+    /**
+     * Queue.
+     */
+    private final Queue<Long> queue = new ConcurrentLinkedQueue<>();
+
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        AtomicConfiguration atomicCfg = new AtomicConfiguration();
+        atomicCfg.setCacheMode(CacheMode.PARTITIONED);
+        atomicCfg.setBackups(1);
+
+        cfg.setAtomicConfiguration(atomicCfg);
+
+        return cfg;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        queue.clear();
+    }
+
+    /**
+     *
+     */
+    public void testQueueCreateNodesJoin() throws Exception {
+        CountDownLatch startLatch = new CountDownLatch(GRID_CNT);
+        final AtomicBoolean run = new AtomicBoolean(true);
+
+        Collection<IgniteInternalFuture<?>> futs = new ArrayList<>();
+
+        for (int i = 0; i < GRID_CNT; i++)
+            futs.add(startNodeAndCreaterThread(i, startLatch, run));
+
+        startLatch.await();
+
+        info("All nodes started.");
+
+        Thread.sleep(10_000);
+
+        run.set(false);
+
+        for (IgniteInternalFuture<?> fut : futs)
+            fut.get();
+
+        info("Increments: " + queue.size());
+
+        assert !queue.isEmpty();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIncrementConsistency() throws Exception {
+        startGrids(GRID_CNT);
+
+        final AtomicBoolean run = new AtomicBoolean(true);
+
+        IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+            /** {@inheritDoc} */
+            @Override
+            public Void call() throws Exception {
+                IgniteAtomicLong cntr = ignite(0).atomicLong(ATOMIC_LONG_NAME, 0, true);
+
+                while (run.get())
+                    queue.add(cntr.getAndIncrement());
+
+                return null;
+            }
+        }, 4, "increment-runner");
+
+        for (int i = 0; i < RESTART_CNT; i++) {
+            int restartIdx = ThreadLocalRandom.current().nextInt(GRID_CNT - 1) + 1;
+
+            stopGrid(restartIdx);
+
+            U.sleep(500);
+
+            startGrid(restartIdx);
+        }
+
+        run.set(false);
+
+        fut.get();
+
+        info("Increments: " + queue.size());
+
+        checkQueue();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testQueueClose() throws Exception {
+        startGrids(GRID_CNT);
+
+        int threads = 4;
+
+        final AtomicBoolean run = new AtomicBoolean(true);
+        final AtomicInteger idx = new AtomicInteger();
+        final AtomicReferenceArray<Exception> arr = new AtomicReferenceArray<>(threads);
+
+        IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+            /** {@inheritDoc} */
+            @Override
+            public Void call() throws Exception {
+                int base = idx.getAndIncrement();
+
+                try {
+                    int delta = 0;
+
+                    while (run.get()) {
+                        IgniteAtomicLong cntr = ignite(0).atomicLong(ATOMIC_LONG_NAME + "-" + base + "-" + delta, 0, true);
+
+                        for (int i = 0; i < 5; i++)
+                            queue.add(cntr.getAndIncrement());
+
+                        cntr.close();
+
+                        delta++;
+                    }
+                }
+                catch (Exception e) {
+                    arr.set(base, e);
+
+                    throw e;
+                }
+                finally {
+                    info("RUNNER THREAD IS STOPPING");
+                }
+
+                return null;
+            }
+        }, threads, "increment-runner");
+
+        for (int i = 0; i < RESTART_CNT; i++) {
+            int restartIdx = ThreadLocalRandom.current().nextInt(GRID_CNT - 1) + 1;
+
+            stopGrid(restartIdx);
+
+            U.sleep(500);
+
+            startGrid(restartIdx);
+        }
+
+        run.set(false);
+
+        fut.get();
+
+        for (int i = 0; i < threads; i++) {
+            Exception err = arr.get(i);
+
+            if (err != null)
+                throw err;
+        }
+    }
+
+    /**
+     *
+     */
+    private void checkQueue() {
+        List<Long> list = new ArrayList<>(queue);
+
+        Collections.sort(list);
+
+        boolean failed = false;
+
+        int delta = 0;
+
+        for (int i = 0; i < list.size(); i++) {
+            Long exp = (long)(i + delta);
+
+            Long actual = list.get(i);
+
+            if (!exp.equals(actual)) {
+                failed = true;
+
+                delta++;
+
+                info(">>> Expected " + exp + ", actual " + actual);
+            }
+        }
+
+        assertFalse(failed);
+    }
+
+    /**
+     * @param i Node index.
+     */
+    private IgniteInternalFuture<?> startNodeAndCreaterThread(final int i, final CountDownLatch startLatch, final AtomicBoolean run)
+        throws Exception {
+        return multithreadedAsync(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Ignite ignite = startGrid(i);
+
+                    startLatch.countDown();
+
+                    while (run.get()) {
+                        IgniteAtomicLong cntr = ignite.atomicLong(ATOMIC_LONG_NAME, 0, true);
+
+                        queue.add(cntr.getAndIncrement());
+                    }
+                }
+                catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }, 1, "grunner-" + i);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
index db55731..1d80ac1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
@@ -90,11 +92,14 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
         IgniteCache<Integer, Integer> cache0 = ignite(0).cache(null);
         IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
 
+        Collection<IgniteInternalFuture<?>> futs = new ArrayList<>();
+
         for (int i = 0; i < 5; i++) {
             log.info("Iteration: " + i);
 
-            GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
-                @Override public Object call() throws Exception {
+            futs.add(GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+                @Override
+                public Object call() throws Exception {
                     int val = idx.getAndIncrement();
 
                     IgniteCache<Integer, Integer> cache = ignite1.cache(null);
@@ -104,10 +109,13 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
 
                     return null;
                 }
-            }, 5, "put-thread");
+            }, 5, "put-thread"));
 
             assertEquals(cache0.localPeek(key), cache1.localPeek(key));
         }
+
+        for (IgniteInternalFuture<?> fut : futs)
+            fut.get();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
index 28f9a65..eaeb7b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverTestSuite.java
@@ -30,6 +30,9 @@ import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxNode
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtAtomicRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtClientRemoveFailureTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtRemoveFailureTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheTxNodeFailureSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridNearCacheTxNodeFailureSelfTest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteAtomicLongChangingTopologySelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryAtomicSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCachePutRetryTransactionalSelfTest;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicClientInvalidPartitionHandlingSelfTest;
@@ -97,7 +100,11 @@ public class IgniteCacheFailoverTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheSizeFailoverTest.class);
 
         suite.addTestSuite(IgniteCacheTopologySafeGetSelfTest.class);
+        suite.addTestSuite(IgniteAtomicLongChangingTopologySelfTest.class);
+
+        suite.addTestSuite(GridCacheTxNodeFailureSelfTest.class);
+        suite.addTestSuite(GridNearCacheTxNodeFailureSelfTest.class);
 
         return suite;
     }
-}
\ No newline at end of file
+}


[12/41] ignite git commit: Modified TODO due to GG -> Ignite ticket migration.

Posted by ag...@apache.org.
Modified TODO due to GG -> Ignite ticket migration.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/12b0f2bb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/12b0f2bb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/12b0f2bb

Branch: refs/heads/ignite-1400
Commit: 12b0f2bb8123517456a27b302743bf8df3edd113
Parents: cbc8877
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 11 15:19:50 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 11 15:19:50 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/processors/platform/events/PlatformEvents.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/12b0f2bb/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
index 997c019..8585526 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/events/PlatformEvents.java
@@ -141,7 +141,7 @@ public class PlatformEvents extends PlatformAbstractTarget {
         throws IgniteCheckedException {
         switch (type) {
             case OP_RECORD_LOCAL:
-                // TODO: GG-10244
+                // TODO: IGNITE-1410.
                 return TRUE;
 
             case OP_ENABLE_LOCAL:


[33/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
index f7f5f4e..ef7dc9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
@@ -23,7 +23,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.processors.platform.PlatformProcessor;
 import org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
 
 /**
  * Default store manager implementation.
@@ -82,6 +82,6 @@ public class CacheOsStoreManager extends GridCacheStoreManagerAdapter {
 
     /** {@inheritDoc} */
     @Override public boolean configuredConvertPortable() {
-        return !(ctx.config().getMarshaller() instanceof PortableMarshaller && cfg.isKeepPortableInStore());
+        return true;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
index fac69fb..423b5e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
@@ -19,12 +19,12 @@ package org.apache.ignite.internal.processors.platform.dotnet;
 
 import org.apache.ignite.internal.processors.platform.PlatformConfiguration;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
 
 import java.util.ArrayList;
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
index a9b6022..92028b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
@@ -18,12 +18,12 @@
 package org.apache.ignite.internal.processors.platform.dotnet;
 
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
 
 import java.util.ArrayList;
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
index d7f1ab1..a307860 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
@@ -18,12 +18,12 @@
 package org.apache.ignite.internal.processors.platform.dotnet;
 
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
deleted file mode 100644
index bfc34cd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.marshaller.portable;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.marshaller.AbstractMarshaller;
-import org.apache.ignite.marshaller.MarshallerContext;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableProtocolVersion;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
- * in the portable format.
- * <p>
- * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
- * <p>
- * <h1 class="header">Configuration</h1>
- * <h2 class="header">Mandatory</h2>
- * This marshaller has no mandatory configuration parameters.
- * <h2 class="header">Java Example</h2>
- * <pre name="code" class="java">
- * PortableMarshaller marshaller = new PortableMarshaller();
- *
- * IgniteConfiguration cfg = new IgniteConfiguration();
- *
- * // Override marshaller.
- * cfg.setMarshaller(marshaller);
- *
- * // Starts grid.
- * G.start(cfg);
- * </pre>
- * <h2 class="header">Spring Example</h2>
- * PortableMarshaller can be configured from Spring XML configuration file:
- * <pre name="code" class="xml">
- * &lt;bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"&gt;
- *     ...
- *     &lt;property name="marshaller"&gt;
- *         &lt;bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"&gt;
- *            ...
- *         &lt;/bean&gt;
- *     &lt;/property&gt;
- *     ...
- * &lt;/bean&gt;
- * </pre>
- * <p>
- * <img src="http://ignite.apache.org/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- */
-public class PortableMarshaller extends AbstractMarshaller {
-    /** Default portable protocol version. */
-    public static final PortableProtocolVersion DFLT_PORTABLE_PROTO_VER = PortableProtocolVersion.VER_1_4_0;
-
-    /** Class names. */
-    private Collection<String> clsNames;
-
-    /** ID mapper. */
-    private PortableIdMapper idMapper;
-
-    /** Serializer. */
-    private PortableSerializer serializer;
-
-    /** Types. */
-    private Collection<PortableTypeConfiguration> typeCfgs;
-
-    /** Use timestamp flag. */
-    private boolean useTs = true;
-
-    /** Whether to convert string to bytes using UTF-8 encoding. */
-    private boolean convertString = true;
-
-    /** Meta data enabled flag. */
-    private boolean metaDataEnabled = true;
-
-    /** Keep deserialized flag. */
-    private boolean keepDeserialized = true;
-
-    /** Protocol version. */
-    private PortableProtocolVersion protoVer = DFLT_PORTABLE_PROTO_VER;
-
-    /** */
-    private GridPortableMarshaller impl;
-
-    /**
-     * Gets class names.
-     *
-     * @return Class names.
-     */
-    public Collection<String> getClassNames() {
-        return clsNames;
-    }
-
-    /**
-     * Sets class names of portable objects explicitly.
-     *
-     * @param clsNames Class names.
-     */
-    public void setClassNames(Collection<String> clsNames) {
-        this.clsNames = new ArrayList<>(clsNames.size());
-
-        for (String clsName : clsNames)
-            this.clsNames.add(clsName.trim());
-    }
-
-    /**
-     * Gets ID mapper.
-     *
-     * @return ID mapper.
-     */
-    public PortableIdMapper getIdMapper() {
-        return idMapper;
-    }
-
-    /**
-     * Sets ID mapper.
-     *
-     * @param idMapper ID mapper.
-     */
-    public void setIdMapper(PortableIdMapper idMapper) {
-        this.idMapper = idMapper;
-    }
-
-    /**
-     * Gets serializer.
-     *
-     * @return Serializer.
-     */
-    public PortableSerializer getSerializer() {
-        return serializer;
-    }
-
-    /**
-     * Sets serializer.
-     *
-     * @param serializer Serializer.
-     */
-    public void setSerializer(PortableSerializer serializer) {
-        this.serializer = serializer;
-    }
-
-    /**
-     * Gets types configuration.
-     *
-     * @return Types configuration.
-     */
-    public Collection<PortableTypeConfiguration> getTypeConfigurations() {
-        return typeCfgs;
-    }
-
-    /**
-     * Sets type configurations.
-     *
-     * @param typeCfgs Type configurations.
-     */
-    public void setTypeConfigurations(Collection<PortableTypeConfiguration> typeCfgs) {
-        this.typeCfgs = typeCfgs;
-    }
-
-    /**
-     * If {@code true} then date values converted to {@link Timestamp} on deserialization.
-     * <p>
-     * Default value is {@code true}.
-     *
-     * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
-     */
-    public boolean isUseTimestamp() {
-        return useTs;
-    }
-
-    /**
-     * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
-     */
-    public void setUseTimestamp(boolean useTs) {
-        this.useTs = useTs;
-    }
-
-    /**
-     * Gets strings must be converted to or from bytes using UTF-8 encoding.
-     * <p>
-     * Default value is {@code true}.
-     *
-     * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
-     */
-    public boolean isConvertStringToBytes() {
-        return convertString;
-    }
-
-    /**
-     * Sets strings must be converted to or from bytes using UTF-8 encoding.
-     * <p>
-     * Default value is {@code true}.
-     *
-     * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
-     */
-    public void setConvertStringToBytes(boolean convertString) {
-        this.convertString = convertString;
-    }
-
-    /**
-     * If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
-     * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
-     * <p>
-     * Default value if {@code true}.
-     *
-     * @return Whether meta data is collected.
-     */
-    public boolean isMetaDataEnabled() {
-        return metaDataEnabled;
-    }
-
-    /**
-     * @param metaDataEnabled Whether meta data is collected.
-     */
-    public void setMetaDataEnabled(boolean metaDataEnabled) {
-        this.metaDataEnabled = metaDataEnabled;
-    }
-
-    /**
-     * If {@code true}, {@link PortableObject} will cache deserialized instance after
-     * {@link PortableObject#deserialize()} is called. All consequent calls of this
-     * method on the same instance of {@link PortableObject} will return that cached
-     * value without actually deserializing portable object. If you need to override this
-     * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
-     * method.
-     * <p>
-     * Default value if {@code true}.
-     *
-     * @return Whether deserialized value is kept.
-     */
-    public boolean isKeepDeserialized() {
-        return keepDeserialized;
-    }
-
-    /**
-     * @param keepDeserialized Whether deserialized value is kept.
-     */
-    public void setKeepDeserialized(boolean keepDeserialized) {
-        this.keepDeserialized = keepDeserialized;
-    }
-
-    /**
-     * Gets portable protocol version.
-     * <p>
-     * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
-     *
-     * @return Portable protocol version.
-     */
-    public PortableProtocolVersion getProtocolVersion() {
-        return protoVer;
-    }
-
-    /**
-     * Sets portable protocol version.
-     * <p>
-     * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
-     *
-     * @param protoVer Portable protocol version.
-     */
-    public void setProtocolVersion(PortableProtocolVersion protoVer) {
-        if (protoVer == null)
-            throw new IllegalArgumentException("Wrong portable protocol version: " + protoVer);
-
-        this.protoVer = protoVer;
-    }
-
-    /**
-     * Returns currently set {@link MarshallerContext}.
-     *
-     * @return Marshaller context.
-     */
-    public MarshallerContext getContext() {
-        return ctx;
-    }
-
-    /**
-     * Sets {@link PortableContext}.
-     * <p/>
-     * @param ctx Portable context.
-     */
-    private void setPortableContext(PortableContext ctx) {
-        ctx.configure(this);
-
-        impl = new GridPortableMarshaller(ctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
-        return impl.marshal(obj, 0);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
-        byte[] arr = marshal(obj);
-
-        try {
-            out.write(arr);
-        }
-        catch (IOException e) {
-            throw new PortableException("Failed to marshal the object: " + obj, e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
-        return impl.deserialize(bytes, clsLdr);
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
-        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-
-        byte[] arr = new byte[4096];
-        int cnt;
-
-        // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that
-        // returns number of bytes remaining.
-        try {
-            while ((cnt = in.read(arr)) != -1)
-                buffer.write(arr, 0, cnt);
-
-            buffer.flush();
-
-            return impl.deserialize(buffer.toByteArray(), clsLdr);
-        }
-        catch (IOException e) {
-            throw new PortableException("Failed to unmarshal the object from InputStream", e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
deleted file mode 100644
index 90cc5e6..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains portable marshaller API classes.
- */
-package org.apache.ignite.marshaller.portable;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
deleted file mode 100644
index 377fcdc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
- * <p>
- * Here is an example of how a portable object can be built dynamically:
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
- *
- * builder.setField("fieldA", "A");
- * builder.setField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- * </pre>
- *
- * <p>
- * Also builder can be initialized by existing portable object. This allows changing some fields without affecting
- * other fields.
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder(person);
- *
- * builder.setField("name", "John");
- *
- * person = builder.build();
- * </pre>
- * </p>
- *
- * If you need to modify nested portable object you can get builder for nested object using
- * {@link #getField(String)}, changes made on nested builder will affect parent object,
- * for example:
- *
- * <pre name=code class=java>
- * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
- * PortableBuilder addressBuilder = personBuilder.setField("address");
- *
- * addressBuilder.setField("city", "New York");
- *
- * personPortableObj = personBuilder.build();
- *
- * // Should be "New York".
- * String city = personPortableObj.getField("address").getField("city");
- * </pre>
- *
- * @see IgnitePortables#builder(int)
- * @see IgnitePortables#builder(String)
- * @see IgnitePortables#builder(PortableObject)
- */
-public interface PortableBuilder {
-    /**
-     * Returns value assigned to the specified field.
-     * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
-     * which can be modified.
-     * <p>
-     * Collections and maps returned from this method are modifiable.
-     *
-     * @param name Field name.
-     * @return Filed value.
-     */
-    public <T> T getField(String name);
-
-    /**
-     * Sets field value.
-     *
-     * @param name Field name.
-     * @param val Field value (cannot be {@code null}).
-     * @see PortableObject#metaData()
-     */
-    public PortableBuilder setField(String name, Object val);
-
-    /**
-     * Sets field value with value type specification.
-     * <p>
-     * Field type is needed for proper metadata update.
-     *
-     * @param name Field name.
-     * @param val Field value.
-     * @param type Field type.
-     * @see PortableObject#metaData()
-     */
-    public <T> PortableBuilder setField(String name, @Nullable T val, Class<? super T> type);
-
-    /**
-     * Sets field value.
-     * <p>
-     * This method should be used if field is portable object.
-     *
-     * @param name Field name.
-     * @param builder Builder for object field.
-     */
-    public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
-
-    /**
-     * Removes field from this builder.
-     *
-     * @param fieldName Field name.
-     * @return {@code this} instance for chaining.
-     */
-    public PortableBuilder removeField(String fieldName);
-
-    /**
-     * Sets hash code for resulting portable object returned by {@link #build()} method.
-     * <p>
-     * If not set {@code 0} is used.
-     *
-     * @param hashCode Hash code.
-     * @return {@code this} instance for chaining.
-     */
-    public PortableBuilder hashCode(int hashCode);
-
-    /**
-     * Builds portable object.
-     *
-     * @return Portable object.
-     * @throws PortableException In case of error.
-     */
-    public PortableObject build() throws PortableException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
deleted file mode 100644
index 0f8d78b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.IgniteException;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating portable object serialization error.
- */
-public class PortableException extends IgniteException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates portable exception with error message.
-     *
-     * @param msg Error message.
-     */
-    public PortableException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates portable exception with {@link Throwable} as a cause.
-     *
-     * @param cause Cause.
-     */
-    public PortableException(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Creates portable exception with error message and {@link Throwable} as a cause.
-     *
-     * @param msg Error message.
-     * @param cause Cause.
-     */
-    public PortableException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
deleted file mode 100644
index 368e415..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Type and field ID mapper for portable objects. Ignite never writes full
- * strings for field or type names. Instead, for performance reasons, Ignite
- * writes integer hash codes for type and field names. It has been tested that
- * hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide {@code PortableIdMapper} allows to override the automatically
- * generated hash code IDs for the type and field names.
- * <p>
- * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
- * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
- */
-public interface PortableIdMapper {
-    /**
-     * Gets type ID for provided class name.
-     * <p>
-     * If {@code 0} is returned, hash code of class simple name will be used.
-     *
-     * @param clsName Class name.
-     * @return Type ID.
-     */
-    public int typeId(String clsName);
-
-    /**
-     * Gets ID for provided field.
-     * <p>
-     * If {@code 0} is returned, hash code of field name will be used.
-     *
-     * @param typeId Type ID.
-     * @param fieldName Field name.
-     * @return Field ID.
-     */
-    public int fieldId(int typeId, String fieldName);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
deleted file mode 100644
index 0098ec3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating that class needed for deserialization of portable object does not exist.
- * <p>
- * Thrown from {@link PortableObject#deserialize()} method.
- */
-public class PortableInvalidClassException extends PortableException {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Creates invalid class exception with error message.
-     *
-     * @param msg Error message.
-     */
-    public PortableInvalidClassException(String msg) {
-        super(msg);
-    }
-
-    /**
-     * Creates invalid class exception with {@link Throwable} as a cause.
-     *
-     * @param cause Cause.
-     */
-    public PortableInvalidClassException(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Creates invalid class exception with error message and {@link Throwable} as a cause.
-     *
-     * @param msg Error message.
-     * @param cause Cause.
-     */
-    public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
-        super(msg, cause);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
deleted file mode 100644
index 4270885..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-/**
- * Interface that allows to implement custom serialization
- * logic for portable objects. Portable objects are not required
- * to implement this interface, in which case Ignite will automatically
- * serialize portable objects using reflection.
- * <p>
- * This interface, in a way, is analogous to {@link java.io.Externalizable}
- * interface, which allows users to override default serialization logic,
- * usually for performance reasons. The only difference here is that portable
- * serialization is already very fast and implementing custom serialization
- * logic for portables does not provide significant performance gains.
- */
-public interface PortableMarshalAware {
-    /**
-     * Writes fields to provided writer.
-     *
-     * @param writer Portable object writer.
-     * @throws PortableException In case of error.
-     */
-    public void writePortable(PortableWriter writer) throws PortableException;
-
-    /**
-     * Reads fields from provided reader.
-     *
-     * @param reader Portable object reader.
-     * @throws PortableException In case of error.
-     */
-    public void readPortable(PortableReader reader) throws PortableException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
deleted file mode 100644
index 4ea808b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable type meta data. Metadata for portable types can be accessed from any of the
- * {@link IgnitePortables#metadata(String)} methods.
- * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableMetadata {
-    /**
-     * Gets portable type name.
-     *
-     * @return Portable type name.
-     */
-    public String typeName();
-
-    /**
-     * Gets collection of all field names for this portable type.
-     *
-     * @return Collection of all field names for this portable type.
-     */
-    public Collection<String> fields();
-
-    /**
-     * Gets name of the field type for a given field.
-     *
-     * @param fieldName Field name.
-     * @return Field type name.
-     */
-    @Nullable public String fieldTypeName(String fieldName);
-
-    /**
-     * Portable objects can optionally specify custom key-affinity mapping in the
-     * configuration. This method returns the name of the field which should be
-     * used for the key-affinity mapping.
-     *
-     * @return Affinity key field name.
-     */
-    @Nullable public String affinityKeyFieldName();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
deleted file mode 100644
index 66b8f76..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.TreeMap;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Wrapper for portable object in portable binary format. Once an object is defined as portable,
- * Ignite will always store it in memory in the portable (i.e. binary) format.
- * User can choose to work either with the portable format or with the deserialized form
- * (assuming that class definitions are present in the classpath).
- * <p>
- * <b>NOTE:</b> user does not need to (and should not) implement this interface directly.
- * <p>
- * To work with the portable format directly, user should create a cache projection
- * over {@code PortableObject} class and then retrieve individual fields as needed:
- * <pre name=code class=java>
- * IgniteCache&lt;PortableObject, PortableObject&gt; prj = cache.withKeepPortable();
- *
- * // Convert instance of MyKey to portable format.
- * // We could also use GridPortableBuilder to create the key in portable format directly.
- * PortableObject key = grid.portables().toPortable(new MyKey());
- *
- * PortableObject val = prj.get(key);
- *
- * String field = val.field("myFieldName");
- * </pre>
- * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
- * <pre name=code class=java>
- * IgniteCache&lt;MyKey.class, MyValue.class&gt; cache = grid.cache(null);
- *
- * MyValue val = cache.get(new MyKey());
- *
- * // Normal java getter.
- * String fieldVal = val.getMyFieldName();
- * </pre>
- * <h1 class="header">Working With Maps and Collections</h1>
- * All maps and collections in the portable objects are serialized automatically. When working
- * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
- * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
- * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
- * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
- * in C#, etc.
- * <h1 class="header">Dynamic Structure Changes</h1>
- * Since objects are always cached in the portable binary format, server does not need to
- * be aware of the class definitions. Moreover, if class definitions are not present or not
- * used on the server, then clients can continuously change the structure of the portable
- * objects without having to restart the cluster. For example, if one client stores a
- * certain class with fields A and B, and another client stores the same class with
- * fields B and C, then the server-side portable object will have the fields A, B, and C.
- * As the structure of a portable object changes, the new fields become available for SQL queries
- * automatically.
- * <h1 class="header">Building Portable Objects</h1>
- * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
- *
- * builder.setField("fieldA", "A");
- * builder.setField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- * </pre>
- * For the cases when class definition is present
- * in the class path, it is also possible to populate a standard POJO and then
- * convert it to portable format, like so:
- * <pre name=code class=java>
- * MyObject obj = new MyObject();
- *
- * obj.setFieldA("A");
- * obj.setFieldB(123);
- *
- * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
- * </pre>
- * <h1 class="header">Portable Metadata</h1>
- * Even though Ignite portable protocol only works with hash codes for type and field names
- * to achieve better performance, Ignite provides metadata for all portable types which
- * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
- * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableObject extends Serializable, Cloneable {
-    /**
-     * Gets portable object type ID.
-     *
-     * @return Type ID.
-     */
-    public int typeId();
-
-    /**
-     * Gets meta data for this portable object.
-     *
-     * @return Meta data.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public PortableMetadata metaData() throws PortableException;
-
-    /**
-     * Gets field value.
-     *
-     * @param fieldName Field name.
-     * @return Field value.
-     * @throws PortableException In case of any other error.
-     */
-    @Nullable public <F> F field(String fieldName) throws PortableException;
-
-    /**
-     * Checks whether field is set.
-     *
-     * @param fieldName Field name.
-     * @return {@code true} if field is set.
-     */
-    public boolean hasField(String fieldName);
-
-    /**
-     * Gets fully deserialized instance of portable object.
-     *
-     * @return Fully deserialized instance of portable object.
-     * @throws PortableInvalidClassException If class doesn't exist.
-     * @throws PortableException In case of any other error.
-     */
-    @Nullable public <T> T deserialize() throws PortableException;
-
-    /**
-     * Copies this portable object.
-     *
-     * @return Copy of this portable object.
-     */
-    public PortableObject clone() throws CloneNotSupportedException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
deleted file mode 100644
index 9189b28..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable protocol version.
- */
-public enum PortableProtocolVersion {
-    /** Ignite 1.4.0 release. */
-    VER_1_4_0;
-
-    /** Enumerated values. */
-    private static final PortableProtocolVersion[] VALS = values();
-
-    /**
-     * Efficiently gets enumerated value from its ordinal.
-     *
-     * @param ord Ordinal value.
-     * @return Enumerated value or {@code null} if ordinal out of range.
-     */
-    @Nullable public static PortableProtocolVersion fromOrdinal(int ord) {
-        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
deleted file mode 100644
index 3bae2e1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Raw reader for portable objects. Raw reader does not use field name hash codes, therefore,
- * making the format even more compact. However, if the raw reader is used,
- * dynamic structure changes to the portable objects are not supported.
- */
-public interface PortableRawReader {
-    /**
-     * @return Byte value.
-     * @throws PortableException In case of error.
-     */
-    public byte readByte() throws PortableException;
-
-    /**
-     * @return Short value.
-     * @throws PortableException In case of error.
-     */
-    public short readShort() throws PortableException;
-
-    /**
-     * @return Integer value.
-     * @throws PortableException In case of error.
-     */
-    public int readInt() throws PortableException;
-
-    /**
-     * @return Long value.
-     * @throws PortableException In case of error.
-     */
-    public long readLong() throws PortableException;
-
-    /**
-     * @return Float value.
-     * @throws PortableException In case of error.
-     */
-    public float readFloat() throws PortableException;
-
-    /**
-     * @return Double value.
-     * @throws PortableException In case of error.
-     */
-    public double readDouble() throws PortableException;
-
-    /**
-     * @return Char value.
-     * @throws PortableException In case of error.
-     */
-    public char readChar() throws PortableException;
-
-    /**
-     * @return Boolean value.
-     * @throws PortableException In case of error.
-     */
-    public boolean readBoolean() throws PortableException;
-
-    /**
-     * @return Decimal value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public BigDecimal readDecimal() throws PortableException;
-
-    /**
-     * @return String value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public String readString() throws PortableException;
-
-    /**
-     * @return UUID.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public UUID readUuid() throws PortableException;
-
-    /**
-     * @return Date.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Date readDate() throws PortableException;
-
-    /**
-     * @return Timestamp.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Timestamp readTimestamp() throws PortableException;
-
-    /**
-     * @return Object.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T> T readObject() throws PortableException;
-
-    /**
-     * @return Byte array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public byte[] readByteArray() throws PortableException;
-
-    /**
-     * @return Short array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public short[] readShortArray() throws PortableException;
-
-    /**
-     * @return Integer array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public int[] readIntArray() throws PortableException;
-
-    /**
-     * @return Long array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public long[] readLongArray() throws PortableException;
-
-    /**
-     * @return Float array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public float[] readFloatArray() throws PortableException;
-
-    /**
-     * @return Byte array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public double[] readDoubleArray() throws PortableException;
-
-    /**
-     * @return Char array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public char[] readCharArray() throws PortableException;
-
-    /**
-     * @return Boolean array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public boolean[] readBooleanArray() throws PortableException;
-
-    /**
-     * @return Decimal array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
-
-    /**
-     * @return String array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public String[] readStringArray() throws PortableException;
-
-    /**
-     * @return UUID array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public UUID[] readUuidArray() throws PortableException;
-
-    /**
-     * @return Date array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Date[] readDateArray() throws PortableException;
-
-    /**
-     * @return Object array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Object[] readObjectArray() throws PortableException;
-
-    /**
-     * @return Collection.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T> Collection<T> readCollection() throws PortableException;
-
-    /**
-     * @param colCls Collection class.
-     * @return Collection.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T> Collection<T> readCollection(Class<? extends Collection<T>> colCls)
-        throws PortableException;
-
-    /**
-     * @return Map.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <K, V> Map<K, V> readMap() throws PortableException;
-
-    /**
-     * @param mapCls Map class.
-     * @return Map.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <K, V> Map<K, V> readMap(Class<? extends Map<K, V>> mapCls) throws PortableException;
-
-    /**
-     * @return Value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T extends Enum<?>> T readEnum() throws PortableException;
-
-    /**
-     * @return Value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T extends Enum<?>> T[] readEnumArray() throws PortableException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
deleted file mode 100644
index 53f4f92..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Raw writer for portable object. Raw writer does not write field name hash codes, therefore,
- * making the format even more compact. However, if the raw writer is used,
- * dynamic structure changes to the portable objects are not supported.
- */
-public interface PortableRawWriter {
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeByte(byte val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeShort(short val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeInt(int val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeLong(long val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeFloat(float val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDouble(double val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeChar(char val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeBoolean(boolean val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeString(@Nullable String val) throws PortableException;
-
-    /**
-     * @param val UUID to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeUuid(@Nullable UUID val) throws PortableException;
-
-    /**
-     * @param val Date to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDate(@Nullable Date val) throws PortableException;
-
-    /**
-     * @param val Timestamp to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeTimestamp(@Nullable Timestamp val) throws PortableException;
-
-    /**
-     * @param obj Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeObject(@Nullable Object obj) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeByteArray(@Nullable byte[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeShortArray(@Nullable short[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeIntArray(@Nullable int[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeLongArray(@Nullable long[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeFloatArray(@Nullable float[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDoubleArray(@Nullable double[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeCharArray(@Nullable char[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeBooleanArray(@Nullable boolean[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeStringArray(@Nullable String[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeUuidArray(@Nullable UUID[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDateArray(@Nullable Date[] val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeObjectArray(@Nullable Object[] val) throws PortableException;
-
-    /**
-     * @param col Collection to write.
-     * @throws PortableException In case of error.
-     */
-    public <T> void writeCollection(@Nullable Collection<T> col) throws PortableException;
-
-    /**
-     * @param map Map to write.
-     * @throws PortableException In case of error.
-     */
-    public <K, V> void writeMap(@Nullable Map<K, V> map) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public <T extends Enum<?>> void writeEnum(T val) throws PortableException;
-
-    /**
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public <T extends Enum<?>> void writeEnumArray(T[] val) throws PortableException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
deleted file mode 100644
index 58f078d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Reader for portable objects used in {@link PortableMarshalAware} implementations.
- * Useful for the cases when user wants a fine-grained control over serialization.
- * <p>
- * Note that Ignite never writes full strings for field or type names. Instead,
- * for performance reasons, Ignite writes integer hash codes for type and field names.
- * It has been tested that hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide, Ignite provides {@link PortableIdMapper} which
- * allows to override the automatically generated hash code IDs for the type and field names.
- */
-public interface PortableReader {
-    /**
-     * @param fieldName Field name.
-     * @return Byte value.
-     * @throws PortableException In case of error.
-     */
-    public byte readByte(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Short value.
-     * @throws PortableException In case of error.
-     */
-    public short readShort(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Integer value.
-     * @throws PortableException In case of error.
-     */
-    public int readInt(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Long value.
-     * @throws PortableException In case of error.
-     */
-    public long readLong(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @throws PortableException In case of error.
-     * @return Float value.
-     */
-    public float readFloat(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Double value.
-     * @throws PortableException In case of error.
-     */
-    public double readDouble(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Char value.
-     * @throws PortableException In case of error.
-     */
-    public char readChar(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Boolean value.
-     * @throws PortableException In case of error.
-     */
-    public boolean readBoolean(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Decimal value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return String value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public String readString(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return UUID.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public UUID readUuid(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Date.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Date readDate(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Timestamp.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Timestamp readTimestamp(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Object.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T> T readObject(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Byte array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public byte[] readByteArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Short array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public short[] readShortArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Integer array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public int[] readIntArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Long array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public long[] readLongArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Float array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public float[] readFloatArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Byte array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public double[] readDoubleArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Char array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public char[] readCharArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Boolean array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public boolean[] readBooleanArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Decimal array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return String array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public String[] readStringArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return UUID array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public UUID[] readUuidArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Date array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Date[] readDateArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Object array.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public Object[] readObjectArray(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Collection.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T> Collection<T> readCollection(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param colCls Collection class.
-     * @return Collection.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T> Collection<T> readCollection(String fieldName, Class<? extends Collection<T>> colCls)
-        throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Map.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <K, V> Map<K, V> readMap(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param mapCls Map class.
-     * @return Map.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <K, V> Map<K, V> readMap(String fieldName, Class<? extends Map<K, V>> mapCls)
-        throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T extends Enum<?>> T readEnum(String fieldName) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @return Value.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public <T extends Enum<?>> T[] readEnumArray(String fieldName) throws PortableException;
-
-    /**
-     * Gets raw reader. Raw reader does not use field name hash codes, therefore,
-     * making the format even more compact. However, if the raw reader is used,
-     * dynamic structure changes to the portable objects are not supported.
-     *
-     * @return Raw reader.
-     */
-    public PortableRawReader rawReader();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
deleted file mode 100644
index 90ee562..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Interface that allows to implement custom serialization logic for portable objects.
- * Can be used instead of {@link PortableMarshalAware} in case if the class
- * cannot be changed directly.
- * <p>
- * Portable serializer can be configured for all portable objects via
- * {@link PortableMarshaller#getSerializer()} method, or for a specific
- * portable type via {@link PortableTypeConfiguration#getSerializer()} method.
- */
-public interface PortableSerializer {
-    /**
-     * Writes fields to provided writer.
-     *
-     * @param obj Empty object.
-     * @param writer Portable object writer.
-     * @throws PortableException In case of error.
-     */
-    public void writePortable(Object obj, PortableWriter writer) throws PortableException;
-
-    /**
-     * Reads fields from provided reader.
-     *
-     * @param obj Empty object
-     * @param reader Portable object reader.
-     * @throws PortableException In case of error.
-     */
-    public void readPortable(Object obj, PortableReader reader) throws PortableException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
deleted file mode 100644
index 5e6e09d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.sql.Timestamp;
-import java.util.Collection;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Defines configuration properties for a specific portable type. Providing per-type
- * configuration is optional, as it is generally enough, and also optional, to provide global portable
- * configuration using {@link PortableMarshaller#setClassNames(Collection)}.
- * However, this class allows you to change configuration properties for a specific
- * portable type without affecting configuration for other portable types.
- * <p>
- * Per-type portable configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method.
- */
-public class PortableTypeConfiguration {
-    /** Class name. */
-    private String clsName;
-
-    /** ID mapper. */
-    private PortableIdMapper idMapper;
-
-    /** Serializer. */
-    private PortableSerializer serializer;
-
-    /** Use timestamp flag. */
-    private Boolean useTs;
-
-    /** Meta data enabled flag. */
-    private Boolean metaDataEnabled;
-
-    /** Keep deserialized flag. */
-    private Boolean keepDeserialized;
-
-    /** Affinity key field name. */
-    private String affKeyFieldName;
-
-    /**
-     */
-    public PortableTypeConfiguration() {
-        // No-op.
-    }
-
-    /**
-     * @param clsName Class name.
-     */
-    public PortableTypeConfiguration(String clsName) {
-        this.clsName = clsName;
-    }
-
-    /**
-     * Gets type name.
-     *
-     * @return Type name.
-     */
-    public String getClassName() {
-        return clsName;
-    }
-
-    /**
-     * Sets type name.
-     *
-     * @param clsName Type name.
-     */
-    public void setClassName(String clsName) {
-        this.clsName = clsName;
-    }
-
-    /**
-     * Gets ID mapper.
-     *
-     * @return ID mapper.
-     */
-    public PortableIdMapper getIdMapper() {
-        return idMapper;
-    }
-
-    /**
-     * Sets ID mapper.
-     *
-     * @param idMapper ID mapper.
-     */
-    public void setIdMapper(PortableIdMapper idMapper) {
-        this.idMapper = idMapper;
-    }
-
-    /**
-     * Gets serializer.
-     *
-     * @return Serializer.
-     */
-    public PortableSerializer getSerializer() {
-        return serializer;
-    }
-
-    /**
-     * Sets serializer.
-     *
-     * @param serializer Serializer.
-     */
-    public void setSerializer(PortableSerializer serializer) {
-        this.serializer = serializer;
-    }
-
-    /**
-     * If {@code true} then date values converted to {@link Timestamp} during unmarshalling.
-     *
-     * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
-     */
-    public Boolean isUseTimestamp() {
-        return useTs;
-    }
-
-    /**
-     * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
-     */
-    public void setUseTimestamp(Boolean useTs) {
-        this.useTs = useTs;
-    }
-
-    /**
-     * Defines whether meta data is collected for this type. If provided, this value will override
-     * {@link PortableMarshaller#isMetaDataEnabled()} property.
-     *
-     * @return Whether meta data is collected.
-     */
-    public Boolean isMetaDataEnabled() {
-        return metaDataEnabled;
-    }
-
-    /**
-     * @param metaDataEnabled Whether meta data is collected.
-     */
-    public void setMetaDataEnabled(Boolean metaDataEnabled) {
-        this.metaDataEnabled = metaDataEnabled;
-    }
-
-    /**
-     * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
-     * this value will override {@link PortableMarshaller#isKeepDeserialized()}
-     * property.
-     *
-     * @return Whether deserialized value is kept.
-     */
-    public Boolean isKeepDeserialized() {
-        return keepDeserialized;
-    }
-
-    /**
-     * @param keepDeserialized Whether deserialized value is kept.
-     */
-    public void setKeepDeserialized(Boolean keepDeserialized) {
-        this.keepDeserialized = keepDeserialized;
-    }
-
-    /**
-     * Gets affinity key field name.
-     *
-     * @return Affinity key field name.
-     */
-    public String getAffinityKeyFieldName() {
-        return affKeyFieldName;
-    }
-
-    /**
-     * Sets affinity key field name.
-     *
-     * @param affKeyFieldName Affinity key field name.
-     */
-    public void setAffinityKeyFieldName(String affKeyFieldName) {
-        this.affKeyFieldName = affKeyFieldName;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(PortableTypeConfiguration.class, this, super.toString());
-    }
-}
\ No newline at end of file


[11/41] ignite git commit: Fixed IGFS test which failed because of incorrect GridCacheContext.systemTx() assertion.

Posted by ag...@apache.org.
Fixed IGFS test which failed because of incorrect GridCacheContext.systemTx() assertion.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cbc8877a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cbc8877a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cbc8877a

Branch: refs/heads/ignite-1400
Commit: cbc8877acc3f5c86aa4320dc60c3d4de64c9d9dd
Parents: 82ca431
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 11 14:44:53 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 11 14:44:53 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cbc8877a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
index f6a7a72..56559cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
@@ -157,7 +157,7 @@ public class IgfsStartCacheTest extends IgfsCommonAbstractTest {
     private void checkCache(GridCacheAdapter cache) {
         assertNotNull(cache);
         assertFalse(cache.context().userCache());
-        assertFalse(cache.context().systemTx());
+        assertTrue(cache.context().systemTx());
         assertEquals(SYSTEM_POOL, cache.context().ioPolicy());
     }
 }
\ No newline at end of file


[14/41] ignite git commit: ignite-257: fully muted GridCacheColocatedTxExceptionSelfTest

Posted by ag...@apache.org.
ignite-257: fully muted GridCacheColocatedTxExceptionSelfTest


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1ff4a52a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1ff4a52a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1ff4a52a

Branch: refs/heads/ignite-1400
Commit: 1ff4a52af5e31465b474d8dcc9700d37b7656df6
Parents: a66400a
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Sep 11 17:10:19 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Sep 11 17:10:19 2015 +0300

----------------------------------------------------------------------
 .../GridCacheColocatedTxExceptionSelfTest.java  | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/1ff4a52a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
index 86f32f3..5514ff6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
@@ -28,27 +28,17 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
  */
 public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testRemovePrimary() throws Exception {
+    @Override protected void beforeTestsStarted() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-257");
     }
 
     /** {@inheritDoc} */
-    @Override public void testPutPrimary() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    @Override protected CacheMode cacheMode() {
+        return PARTITIONED;
     }
 
     /** {@inheritDoc} */
-    @Override public void testTransformPrimary() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
     }
 }
\ No newline at end of file


[27/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java
deleted file mode 100644
index 3f8cd1c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractDataStreamerSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest extends
-    GridCachePortableObjectsAbstractDataStreamerSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java
deleted file mode 100644
index a53a5ea..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest extends
-    GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 4;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java
deleted file mode 100644
index 8f3a05f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractMultiThreadedSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest extends
-    GridCachePortableObjectsAbstractMultiThreadedSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java
deleted file mode 100644
index ab6b0dd..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheMemoryModePortableSelfTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheMemoryModeSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Memory models test.
- */
-public class GridCacheMemoryModePortableSelfTest extends GridCacheMemoryModeSelfTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setMarshaller(new PortableMarshaller());
-
-        return cfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java
deleted file mode 100644
index c845257..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredAtomicPortableSelfTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredAtomicSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredAtomicPortableSelfTest extends GridCacheOffHeapTieredAtomicSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean portableEnabled() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        // Enable portables.
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java
deleted file mode 100644
index 1a0d601..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionAtomicSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredEvictionAtomicPortableSelfTest extends GridCacheOffHeapTieredEvictionAtomicSelfTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        // Enable portables.
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected TestPredicate testPredicate(String expVal, boolean acceptNull) {
-        return new PortableValuePredicate(expVal, acceptNull);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected TestProcessor testClosure(String expVal, boolean acceptNull) {
-        return new PortableValueClosure(expVal, acceptNull);
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("PackageVisibleInnerClass")
-    static class PortableValuePredicate extends TestPredicate {
-        /**
-         * @param expVal Expected value.
-         * @param acceptNull If {@code true} value can be null;
-         */
-        PortableValuePredicate(String expVal, boolean acceptNull) {
-            super(expVal, acceptNull);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void checkValue(Object val) {
-            PortableObject obj = (PortableObject)val;
-
-            assertEquals(expVal, obj.field("val"));
-        }
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("PackageVisibleInnerClass")
-    static class PortableValueClosure extends TestProcessor {
-        /**
-         * @param expVal Expected value.
-         * @param acceptNull If {@code true} value can be null;
-         */
-        PortableValueClosure(String expVal, boolean acceptNull) {
-            super(expVal, acceptNull);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void checkValue(Object val) {
-            PortableObject obj = (PortableObject)val;
-
-            assertEquals(expVal, obj.field("val"));
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java
deleted file mode 100644
index 60eed45..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredEvictionPortableSelfTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredEvictionPortableSelfTest extends GridCacheOffHeapTieredEvictionSelfTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        // Enable portables.
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected TestPredicate testPredicate(String expVal, boolean acceptNull) {
-        return new PortableValuePredicate(expVal, acceptNull);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected TestProcessor testClosure(String expVal, boolean acceptNull) {
-        return new PortableValueClosure(expVal, acceptNull);
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("PackageVisibleInnerClass")
-    static class PortableValuePredicate extends TestPredicate {
-        /**
-         * @param expVal Expected value.
-         * @param acceptNull If {@code true} value can be null;
-         */
-        PortableValuePredicate(String expVal, boolean acceptNull) {
-            super(expVal, acceptNull);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void checkValue(Object val) {
-            PortableObject obj = (PortableObject)val;
-
-            assertEquals(expVal, obj.field("val"));
-        }
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("PackageVisibleInnerClass")
-    static class PortableValueClosure extends TestProcessor {
-        /**
-         * @param expVal Expected value.
-         * @param acceptNull If {@code true} value can be null;
-         */
-        PortableValueClosure(String expVal, boolean acceptNull) {
-            super(expVal, acceptNull);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void checkValue(Object val) {
-            PortableObject obj = (PortableObject)val;
-
-            assertEquals(expVal, obj.field("val"));
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java
deleted file mode 100644
index 6170e39..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheOffHeapTieredPortableSelfTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import java.util.Arrays;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCacheOffHeapTieredPortableSelfTest extends GridCacheOffHeapTieredSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean portableEnabled() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        // Enable portables.
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestValue.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java
deleted file mode 100644
index e6f7499..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.internal.processors.cache.portable.GridPortableDuplicateIndexObjectsAbstractSelfTest;
-
-/**
- * Test PARTITIONED ATOMIC.
- */
-public class GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest extends
-    GridPortableDuplicateIndexObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override public CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java
deleted file mode 100644
index b5dc4e9..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.internal.processors.cache.portable.GridPortableDuplicateIndexObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test PARTITIONED and TRANSACTIONAL.
- */
-public class GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest extends
-    GridPortableDuplicateIndexObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override public CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java
deleted file mode 100644
index a5c28f3..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest
-    extends GridCachePortableObjectsAtomicNearDisabledSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean offheapTiered() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java
deleted file mode 100644
index 696c3ed..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicNearDisabledSelfTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsAtomicNearDisabledSelfTest extends GridCachePortableObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java
deleted file mode 100644
index 8e04fa1..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsAtomicOffheapTieredSelfTest extends GridCachePortableObjectsAtomicSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean offheapTiered() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java
deleted file mode 100644
index 106e59b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsAtomicSelfTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsAtomicSelfTest extends GridCachePortableObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return new NearCacheConfiguration();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java
deleted file mode 100644
index 5bc4672..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest
-    extends GridCachePortableObjectsPartitionedNearDisabledSelfTest{
-    /** {@inheritDoc} */
-    @Override protected boolean offheapTiered() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java
deleted file mode 100644
index df55de7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedNearDisabledSelfTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsPartitionedNearDisabledSelfTest extends GridCachePortableObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java
deleted file mode 100644
index a6bc0b4..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCachePortableObjectsPartitionedOffheapTieredSelfTest
-    extends GridCachePortableObjectsPartitionedSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean offheapTiered() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java
deleted file mode 100644
index 8c248be..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortableObjectsPartitionedSelfTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsPartitionedSelfTest extends GridCachePortableObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return new NearCacheConfiguration();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java
deleted file mode 100644
index d984756..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesNearPartitionedByteArrayValuesSelfTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAbstractNearPartitionedByteArrayValuesSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCachePortablesNearPartitionedByteArrayValuesSelfTest
-    extends GridCacheAbstractNearPartitionedByteArrayValuesSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean peerClassLoading() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setMarshaller(new PortableMarshaller());
-
-        return cfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java
deleted file mode 100644
index 5830b12..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- *
- */
-public class GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest
-    extends GridCacheAbstractPartitionedOnlyByteArrayValuesSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean peerClassLoading() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setMarshaller(new PortableMarshaller());
-
-        return cfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java
deleted file mode 100644
index 953fbfa..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/replicated/GridCachePortableObjectsReplicatedSelfTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.replicated;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsReplicatedSelfTest extends GridCachePortableObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return REPLICATED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java
deleted file mode 100644
index 3f3a350..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsAtomicLocalSelfTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.local;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-
-/**
- *
- */
-public class GridCachePortableObjectsAtomicLocalSelfTest extends GridCachePortableObjectsLocalSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java
deleted file mode 100644
index 53713ce..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalOffheapTieredSelfTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.ignite.internal.processors.cache.portable.local;
-
-/**
- *
- */
-public class GridCachePortableObjectsLocalOffheapTieredSelfTest extends GridCachePortableObjectsLocalSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean offheapTiered() {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java
deleted file mode 100644
index 1a87865..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/local/GridCachePortableObjectsLocalSelfTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.local;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableObjectsAbstractSelfTest;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.LOCAL;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class GridCachePortableObjectsLocalSelfTest extends GridCachePortableObjectsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return LOCAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 1;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
index 1e4c828..964753d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java
@@ -35,7 +35,6 @@ import org.apache.ignite.IgniteEvents;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteScheduler;
 import org.apache.ignite.IgniteServices;
@@ -271,11 +270,6 @@ public class IgniteMock implements Ignite {
     }
 
     /** {@inheritDoc} */
-    @Override public IgnitePortables portables() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
     @Override public void close() {}
 
     @Nullable @Override public IgniteAtomicSequence atomicSequence(String name, long initVal, boolean create) {
@@ -339,4 +333,4 @@ public class IgniteMock implements Ignite {
     public void setStaticCfg(IgniteConfiguration staticCfg) {
         this.staticCfg = staticCfg;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
index 2b448f8..dfbb0ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteCacheProcessProxy.java
@@ -153,11 +153,6 @@ public class IgniteCacheProcessProxy<K, V> implements IgniteCache<K, V> {
     }
 
     /** {@inheritDoc} */
-    @Override public <K1, V1> IgniteCache<K1, V1> withKeepPortable() {
-        throw new UnsupportedOperationException("Method should be supported.");
-    }
-
-    /** {@inheritDoc} */
     @Override public void loadCache(@Nullable IgniteBiPredicate<K, V> p, @Nullable Object... args) throws CacheException {
         throw new UnsupportedOperationException("Method should be supported.");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 3522407..ec7dab7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -41,7 +41,7 @@ import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.IgniteIllegalStateException;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteScheduler;
 import org.apache.ignite.IgniteServices;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java
deleted file mode 100644
index d7dda61..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheFullApiTestSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- * Cache full API suite with portable marshaller.
- */
-public class IgnitePortableCacheFullApiTestSuite extends TestSuite {
-    /**
-     * @return Suite.
-     * @throws Exception In case of error.
-     */
-    public static TestSuite suite() throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, PortableMarshaller.class.getName());
-
-        return IgniteCacheFullApiSelfTestSuite.suite();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java
deleted file mode 100644
index db20e48..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheTestSuite.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.testsuites;
-
-import java.util.HashSet;
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheMvccSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredEvictionSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheOffHeapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.expiry.IgniteCacheAtomicLocalExpiryPolicyTest;
-import org.apache.ignite.internal.processors.cache.expiry.IgniteCacheExpiryPolicyTestSuite;
-import org.apache.ignite.internal.processors.cache.portable.GridPortableCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.datastreaming.DataStreamProcessorPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.datastreaming.GridDataStreamerImplSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAffinityRoutingPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheMemoryModePortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredAtomicPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredEvictionAtomicPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredEvictionPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCacheOffHeapTieredPortableSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortablesNearPartitionedByteArrayValuesSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest;
-import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- * Cache suite with portable marshaller.
- */
-public class IgnitePortableCacheTestSuite extends TestSuite {
-    /**
-     * @return Suite.
-     * @throws Exception In case of error.
-     */
-    public static TestSuite suite() throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, PortableMarshaller.class.getName());
-
-        TestSuite suite = new TestSuite("Portable Cache Test Suite");
-
-        HashSet<Class> ignoredTests = new HashSet<>();
-
-        // Tests below have a special version for Portable Marshaller
-        ignoredTests.add(DataStreamProcessorSelfTest.class);
-        ignoredTests.add(GridCacheOffHeapTieredEvictionAtomicSelfTest.class);
-        ignoredTests.add(GridCacheOffHeapTieredEvictionSelfTest.class);
-        ignoredTests.add(GridCacheOffHeapTieredSelfTest.class);
-        ignoredTests.add(GridCacheOffHeapTieredAtomicSelfTest.class);
-        ignoredTests.add(GridCacheAffinityRoutingSelfTest.class);
-        ignoredTests.add(IgniteCacheAtomicLocalExpiryPolicyTest.class);
-        ignoredTests.add(GridCacheEntryMemorySizeSelfTest.class);
-
-        // Tests that are not ready to be used with PortableMarshaller
-        ignoredTests.add(GridCacheMvccSelfTest.class);
-
-        suite.addTest(IgniteCacheTestSuite.suite(ignoredTests));
-        suite.addTest(IgniteCacheExpiryPolicyTestSuite.suite());
-
-        suite.addTestSuite(GridCacheMemoryModePortableSelfTest.class);
-        suite.addTestSuite(GridCacheOffHeapTieredEvictionAtomicPortableSelfTest.class);
-        suite.addTestSuite(GridCacheOffHeapTieredEvictionPortableSelfTest.class);
-
-        suite.addTestSuite(GridCachePortablesPartitionedOnlyByteArrayValuesSelfTest.class);
-        suite.addTestSuite(GridCachePortablesNearPartitionedByteArrayValuesSelfTest.class);
-        suite.addTestSuite(GridCacheOffHeapTieredPortableSelfTest.class);
-        suite.addTestSuite(GridCacheOffHeapTieredAtomicPortableSelfTest.class);
-
-        suite.addTestSuite(GridDataStreamerImplSelfTest.class);
-        suite.addTestSuite(DataStreamProcessorPortableSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest.class);
-
-        suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableMultiNodeSelfTest.class);
-        suite.addTestSuite(GridCacheAtomicPartitionedOnlyPortableMultithreadedSelfTest.class);
-
-        suite.addTestSuite(GridCacheAffinityRoutingPortableSelfTest.class);
-        suite.addTestSuite(GridPortableCacheEntryMemorySizeSelfTest.class);
-
-        return suite;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
deleted file mode 100644
index ecd25e1..0000000
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.portable.GridPortableAffinityKeySelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderAdditionalSelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderSelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderStringAsCharsAdditionalSelfTest;
-import org.apache.ignite.internal.portable.GridPortableBuilderStringAsCharsSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMarshallerCtxDisabledSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMarshallerSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMetaDataDisabledSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMetaDataSelfTest;
-import org.apache.ignite.internal.portable.GridPortableWildcardsSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodePortableMetadataMultinodeTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCacheClientNodePortableMetadataTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableStoreObjectsSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.GridCachePortableStorePortablesSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicNearDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedNearDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableObjectsPartitionedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.replicated.GridCachePortableObjectsReplicatedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.local.GridCachePortableObjectsAtomicLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.local.GridCachePortableObjectsLocalOffheapTieredSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.local.GridCachePortableObjectsLocalSelfTest;
-
-/**
- * Test for portable objects stored in cache.
- */
-public class IgnitePortableObjectsTestSuite extends TestSuite {
-    /**
-     * @return Suite.
-     * @throws Exception If failed.
-     */
-    public static TestSuite suite() throws Exception {
-        TestSuite suite = new TestSuite("GridGain Portable Objects Test Suite");
-
-        suite.addTestSuite(GridPortableMarshallerSelfTest.class);
-        suite.addTestSuite(GridPortableMarshallerCtxDisabledSelfTest.class);
-        suite.addTestSuite(GridPortableBuilderSelfTest.class);
-        suite.addTestSuite(GridPortableBuilderStringAsCharsSelfTest.class);
-        suite.addTestSuite(GridPortableMetaDataSelfTest.class);
-        suite.addTestSuite(GridPortableMetaDataDisabledSelfTest.class);
-        suite.addTestSuite(GridPortableAffinityKeySelfTest.class);
-        suite.addTestSuite(GridPortableWildcardsSelfTest.class);
-        suite.addTestSuite(GridPortableBuilderAdditionalSelfTest.class);
-        suite.addTestSuite(GridPortableBuilderStringAsCharsAdditionalSelfTest.class);
-
-        suite.addTestSuite(GridCachePortableObjectsLocalSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsAtomicLocalSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsReplicatedSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsPartitionedSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsPartitionedNearDisabledSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsAtomicSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsAtomicNearDisabledSelfTest.class);
-
-        suite.addTestSuite(GridCachePortableObjectsLocalOffheapTieredSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsAtomicOffheapTieredSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsAtomicNearDisabledOffheapTieredSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsPartitionedOffheapTieredSelfTest.class);
-        suite.addTestSuite(GridCachePortableObjectsPartitionedNearDisabledOffheapTieredSelfTest.class);
-
-        suite.addTestSuite(GridCachePortableStoreObjectsSelfTest.class);
-        suite.addTestSuite(GridCachePortableStorePortablesSelfTest.class);
-
-        suite.addTestSuite(GridCacheClientNodePortableMetadataTest.class);
-        suite.addTestSuite(GridCacheClientNodePortableMetadataMultinodeTest.class);
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar
deleted file mode 100644
index 863350d..0000000
Binary files a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom
deleted file mode 100644
index c79dfbf..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.ignite.portable</groupId>
-  <artifactId>test1</artifactId>
-  <version>1.1</version>
-  <description>POM was created from install:install-file</description>
-</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml
deleted file mode 100644
index 33f5abf..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
-  <groupId>org.apache.ignite.portable</groupId>
-  <artifactId>test1</artifactId>
-  <versioning>
-    <release>1.1</release>
-    <versions>
-      <version>1.1</version>
-    </versions>
-    <lastUpdated>20140806090184</lastUpdated>
-  </versioning>
-</metadata>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar
deleted file mode 100644
index ccf4ea2..0000000
Binary files a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom
deleted file mode 100644
index 37621e1..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.ignite.portable</groupId>
-  <artifactId>test2</artifactId>
-  <version>1.1</version>
-  <description>POM was created from install:install-file</description>
-</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml b/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml
deleted file mode 100644
index 9c705ef..0000000
--- a/modules/core/src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
-  <groupId>org.apache.ignite.portable</groupId>
-  <artifactId>test2</artifactId>
-  <versioning>
-    <release>1.1</release>
-    <versions>
-      <version>1.1</version>
-    </versions>
-    <lastUpdated>20140806090410</lastUpdated>
-  </versioning>
-</metadata>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
index 2bdf28c..833e49e 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
@@ -43,6 +43,7 @@ import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.IgniteClusterEx;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.processors.igfs.IgfsBlockLocationImpl;
@@ -1024,5 +1025,10 @@ public class HadoopDefaultMapReducePlannerSelfTest extends HadoopAbstractSelfTes
         @Override public GridKernalContext context() {
             return null;
         }
+
+        /** {@inheritDoc} */
+        @Override public IgnitePortables portables() {
+            return null;
+        }
     }
 }
\ No newline at end of file


[09/41] ignite git commit: ignite-1028 (cherry picked from commit 395b320)

Posted by ag...@apache.org.
ignite-1028
(cherry picked from commit 395b320)


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70ad5ba7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70ad5ba7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70ad5ba7

Branch: refs/heads/ignite-1400
Commit: 70ad5ba7721e58f0ac18d3c76fd00b3854df4387
Parents: f02fca6
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 11 12:06:32 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 11 14:02:21 2015 +0300

----------------------------------------------------------------------
 .../internal/util/GridSpiCloseableIteratorWrapper.java       | 5 +++++
 .../processors/cache/GridCacheP2PUndeploySelfTest.java       | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/70ad5ba7/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpiCloseableIteratorWrapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpiCloseableIteratorWrapper.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpiCloseableIteratorWrapper.java
index 5c76cbd..afc574f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpiCloseableIteratorWrapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridSpiCloseableIteratorWrapper.java
@@ -54,4 +54,9 @@ public class GridSpiCloseableIteratorWrapper<T> extends GridCloseableIteratorAda
     @Override protected void onClose() throws IgniteCheckedException {
         iter.close();
     }
+
+    /** {@inheritDoc} */
+    @Override protected void onRemove() throws IgniteCheckedException {
+        iter.remove();
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/70ad5ba7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
index ba52c2f..2c8c748 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
@@ -81,7 +81,11 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
 
         cfg.setMarshaller(new JdkMarshaller());
 
-        cfg.setSwapSpaceSpi(new FileSwapSpaceSpi());
+        FileSwapSpaceSpi swap = new FileSwapSpaceSpi();
+
+        swap.setWriteBufferSize(1);
+
+        cfg.setSwapSpaceSpi(swap);
 
         CacheConfiguration repCacheCfg = defaultCacheConfiguration();
 
@@ -233,6 +237,8 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
 
             cache2.localEvict(ImmutableSet.of(2, 3, 4));
 
+            U.sleep(100); //Time to store entries to disk.
+
             long swapSize = size(cacheName, grid2);
 
             info("Swap size: " + swapSize);


[21/41] ignite git commit: Minor.

Posted by ag...@apache.org.
Minor.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5319199
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5319199
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5319199

Branch: refs/heads/ignite-1400
Commit: e53191994b48e39d1943bc2bc403dcf1a1ee1afc
Parents: d076622
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 14 11:08:36 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 14 11:08:36 2015 +0300

----------------------------------------------------------------------
 .../IgniteAtomicLongChangingTopologySelfTest.java    | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e5319199/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
index cee54b8..1f2e035 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteAtomicLongChangingTopologySelfTest.java
@@ -62,8 +62,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
     /**
      * {@inheritDoc}
      */
-    @Override
-    protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
@@ -84,8 +83,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
     /**
      * {@inheritDoc}
      */
-    @Override
-    protected void afterTest() throws Exception {
+    @Override protected void afterTest() throws Exception {
         stopAllGrids();
 
         queue.clear();
@@ -129,8 +127,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
 
         IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
             /** {@inheritDoc} */
-            @Override
-            public Void call() throws Exception {
+            @Override public Void call() throws Exception {
                 IgniteAtomicLong cntr = ignite(0).atomicLong(ATOMIC_LONG_NAME, 0, true);
 
                 while (run.get())
@@ -173,8 +170,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
 
         IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
             /** {@inheritDoc} */
-            @Override
-            public Void call() throws Exception {
+            @Override public Void call() throws Exception {
                 int base = idx.getAndIncrement();
 
                 try {
@@ -261,8 +257,7 @@ public class IgniteAtomicLongChangingTopologySelfTest extends GridCommonAbstract
     private IgniteInternalFuture<?> startNodeAndCreaterThread(final int i, final CountDownLatch startLatch, final AtomicBoolean run)
         throws Exception {
         return multithreadedAsync(new Runnable() {
-            @Override
-            public void run() {
+            @Override public void run() {
                 try {
                     Ignite ignite = startGrid(i);
 


[22/41] ignite git commit: Added more debug info in test.

Posted by ag...@apache.org.
Added more debug info in test.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/02d398c6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/02d398c6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/02d398c6

Branch: refs/heads/ignite-1400
Commit: 02d398c69ce63b375357dc90377c6c03bd4f0d1b
Parents: e531919
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 14 11:18:15 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 14 11:18:15 2015 +0300

----------------------------------------------------------------------
 .../stream/socket/SocketStreamerSelfTest.java   | 27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/02d398c6/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
index 185599d..da15de3 100644
--- a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.marshaller.Marshaller;
@@ -88,7 +89,7 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
-        startGrids(GRID_CNT);
+        startGridsMultiThreaded(GRID_CNT);
 
         try (ServerSocket sock = new ServerSocket(0)) {
             port = sock.getLocalPort();
@@ -232,8 +233,9 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
      * @param converter Converter.
      * @param r Runnable..
      */
-    private void test(@Nullable SocketMessageConverter<Tuple> converter, @Nullable byte[] delim, Runnable r) throws Exception
-    {
+    private void test(@Nullable SocketMessageConverter<Tuple> converter,
+        @Nullable byte[] delim,
+        Runnable r) throws Exception {
         SocketStreamer<Tuple, Integer, String> sockStmr = null;
 
         Ignite ignite = grid(0);
@@ -243,7 +245,6 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
         cache.clear();
 
         try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(null)) {
-
             stmr.allowOverwrite(true);
             stmr.autoFlushFrequency(10);
 
@@ -268,8 +269,12 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
             final CountDownLatch latch = new CountDownLatch(CNT);
 
+            final GridConcurrentHashSet<CacheEvent> evts = new GridConcurrentHashSet<>();
+
             IgniteBiPredicate<UUID, CacheEvent> locLsnr = new IgniteBiPredicate<UUID, CacheEvent>() {
                 @Override public boolean apply(UUID uuid, CacheEvent evt) {
+                    evts.add(evt);
+
                     latch.countDown();
 
                     return true;
@@ -284,8 +289,18 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
             latch.await();
 
-            for (int i = 0; i < CNT; i++)
-                assertEquals(Integer.toString(i), cache.get(i));
+            for (int i = 0; i < CNT; i++) {
+                Object val = cache.get(i);
+                String exp = Integer.toString(i);
+
+                if (!exp.equals(val))
+                    log.error("Unexpected cache value [key=" + i +
+                        ", exp=" + exp +
+                        ", val=" + val +
+                        ", evts=" + evts + ']');
+
+                assertEquals(exp, val);
+            }
 
             assertEquals(CNT, cache.size(CachePeekMode.PRIMARY));
         }


[41/41] ignite git commit: Merge branch 'ignite-1.4' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1400

Posted by ag...@apache.org.
Merge branch 'ignite-1.4' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1400


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8c907d66
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8c907d66
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8c907d66

Branch: refs/heads/ignite-1400
Commit: 8c907d66bb50f5904847be26a21f04233b35ec86
Parents: 4200b9e 866fb41
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 16:11:19 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 16:11:19 2015 -0700

----------------------------------------------------------------------
 examples/config/example-default.xml             |   76 -
 examples/config/example-ignite.xml              |   56 +-
 .../config/portable/example-ignite-portable.xml |   44 -
 .../ignite/examples/portable/Address.java       |   72 -
 .../ignite/examples/portable/Employee.java      |   93 -
 .../ignite/examples/portable/EmployeeKey.java   |   90 -
 .../portable/ExamplePortableNodeStartup.java    |   36 -
 .../ignite/examples/portable/Organization.java  |   93 -
 .../examples/portable/OrganizationType.java     |   32 -
 ...mputeClientPortableTaskExecutionExample.java |  154 -
 .../portable/computegrid/ComputeClientTask.java |  116 -
 .../portable/computegrid/package-info.java      |   21 -
 .../CacheClientPortablePutGetExample.java       |  230 --
 .../CacheClientPortableQueryExample.java        |  325 --
 .../portable/datagrid/package-info.java         |   21 -
 .../ignite/examples/portable/package-info.java  |   21 -
 .../CacheClientPortableExampleTest.java         |   46 -
 .../ComputeClientPortableExampleTest.java       |   37 -
 .../testsuites/IgniteExamplesSelfTestSuite.java |    6 -
 modules/clients/pom.xml                         |    7 +
 modules/clients/src/test/config/jdbc-config.xml |   55 +
 .../jdbc2/JdbcComplexQuerySelfTest.java         |  316 ++
 .../internal/jdbc2/JdbcConnectionSelfTest.java  |  268 ++
 .../internal/jdbc2/JdbcEmptyCacheSelfTest.java  |  140 +
 .../internal/jdbc2/JdbcLocalCachesSelfTest.java |  156 +
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |  334 ++
 .../jdbc2/JdbcPreparedStatementSelfTest.java    |  730 ++++
 .../internal/jdbc2/JdbcResultSetSelfTest.java   |  751 ++++
 .../internal/jdbc2/JdbcStatementSelfTest.java   |  292 ++
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java   |   11 +
 modules/core/pom.xml                            |   21 -
 .../src/main/java/org/apache/ignite/Ignite.java |    7 -
 .../java/org/apache/ignite/IgniteCache.java     |   44 +-
 .../org/apache/ignite/IgniteJdbcDriver.java     |  281 +-
 .../java/org/apache/ignite/IgnitePortables.java |  370 --
 .../apache/ignite/IgniteSystemProperties.java   |    5 +-
 .../configuration/CacheConfiguration.java       |   70 +-
 .../org/apache/ignite/internal/IgniteEx.java    |    9 +
 .../apache/ignite/internal/IgniteKernal.java    |    8 +-
 .../ignite/internal/IgniteNodeAttributes.java   |    5 +-
 .../ignite/internal/jdbc/JdbcConnection.java    |    4 +
 .../internal/jdbc/JdbcConnectionInfo.java       |   91 -
 .../internal/jdbc/JdbcDatabaseMetadata.java     |    4 +
 .../internal/jdbc/JdbcPreparedStatement.java    |    4 +
 .../ignite/internal/jdbc/JdbcResultSet.java     |    4 +
 .../internal/jdbc/JdbcResultSetMetadata.java    |    4 +
 .../ignite/internal/jdbc/JdbcStatement.java     |    4 +
 .../apache/ignite/internal/jdbc/JdbcUtils.java  |    4 +
 .../ignite/internal/jdbc2/JdbcConnection.java   |  777 ++++
 .../internal/jdbc2/JdbcDatabaseMetadata.java    | 1401 +++++++
 .../internal/jdbc2/JdbcPreparedStatement.java   |  411 ++
 .../ignite/internal/jdbc2/JdbcQueryTask.java    |  361 ++
 .../ignite/internal/jdbc2/JdbcResultSet.java    | 1520 +++++++
 .../internal/jdbc2/JdbcResultSetMetadata.java   |  171 +
 .../ignite/internal/jdbc2/JdbcStatement.java    |  456 +++
 .../apache/ignite/internal/jdbc2/JdbcUtils.java |  155 +
 .../discovery/GridDiscoveryManager.java         |   10 -
 .../portable/GridPortableMarshaller.java        |    2 +-
 .../portable/PortableClassDescriptor.java       |   10 +-
 .../internal/portable/PortableContext.java      |   32 +-
 .../portable/PortableMetaDataCollector.java     |    6 +-
 .../portable/PortableMetaDataHandler.java       |    4 +-
 .../internal/portable/PortableMetaDataImpl.java |   14 +-
 .../internal/portable/PortableObjectEx.java     |    6 +-
 .../internal/portable/PortableObjectImpl.java   |    6 +-
 .../portable/PortableObjectOffheapImpl.java     |    6 +-
 .../internal/portable/PortableRawReaderEx.java  |    4 +-
 .../internal/portable/PortableRawWriterEx.java  |    4 +-
 .../portable/PortableReaderContext.java         |    2 +-
 .../internal/portable/PortableReaderExImpl.java |   10 +-
 .../ignite/internal/portable/PortableUtils.java |    2 +-
 .../internal/portable/PortableWriterExImpl.java |   11 +-
 .../internal/portable/api/IgnitePortables.java  |  362 ++
 .../internal/portable/api/PortableBuilder.java  |  136 +
 .../portable/api/PortableException.java         |   57 +
 .../internal/portable/api/PortableIdMapper.java |   54 +
 .../api/PortableInvalidClassException.java      |   58 +
 .../portable/api/PortableMarshalAware.java      |   48 +
 .../portable/api/PortableMarshaller.java        |  358 ++
 .../internal/portable/api/PortableMetadata.java |   60 +
 .../internal/portable/api/PortableObject.java   |  152 +
 .../portable/api/PortableProtocolVersion.java   |   41 +
 .../portable/api/PortableRawReader.java         |  234 ++
 .../portable/api/PortableRawWriter.java         |  219 +
 .../internal/portable/api/PortableReader.java   |  284 ++
 .../portable/api/PortableSerializer.java        |   47 +
 .../portable/api/PortableTypeConfiguration.java |  195 +
 .../internal/portable/api/PortableWriter.java   |  266 ++
 .../portable/builder/PortableBuilderEnum.java   |    2 +-
 .../portable/builder/PortableBuilderImpl.java   |   14 +-
 .../portable/builder/PortableBuilderReader.java |    2 +-
 .../builder/PortableBuilderSerializer.java      |    2 +-
 .../builder/PortableEnumArrayLazyValue.java     |    4 +-
 .../builder/PortableObjectArrayLazyValue.java   |    2 +-
 .../builder/PortablePlainPortableObject.java    |    2 +-
 .../streams/PortableAbstractInputStream.java    |    2 +-
 .../processors/cache/GridCacheAdapter.java      |    6 +
 .../processors/cache/GridCacheContext.java      |    4 +-
 .../processors/cache/GridCacheIoManager.java    |    4 +-
 .../processors/cache/GridCacheMvcc.java         |    5 +-
 .../processors/cache/GridCacheProcessor.java    |    8 +-
 .../processors/cache/IgniteCacheProxy.java      |    5 -
 .../distributed/GridCacheTxRecoveryFuture.java  |   11 +-
 .../distributed/GridDistributedCacheEntry.java  |    6 +-
 .../GridDistributedTxFinishRequest.java         |   13 +-
 .../GridDistributedTxRemoteAdapter.java         |   10 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |  514 ++-
 .../distributed/dht/GridDhtTxFinishFuture.java  |   15 +-
 .../distributed/dht/GridDhtTxFinishRequest.java |   84 +-
 .../dht/GridDhtTxFinishResponse.java            |   89 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |    4 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   67 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   32 +-
 .../cache/distributed/dht/GridDhtTxRemote.java  |   40 +-
 .../dht/GridPartitionedGetFuture.java           |    4 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |    4 +-
 .../colocated/GridDhtColocatedLockFuture.java   |   11 +-
 .../distributed/near/GridNearLockFuture.java    |   11 +-
 .../distributed/near/GridNearLockRequest.java   |   18 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   52 +-
 .../GridNearPessimisticTxPrepareFuture.java     |   11 +-
 .../near/GridNearTxFinishFuture.java            |  323 +-
 .../near/GridNearTxFinishRequest.java           |   20 +-
 .../cache/distributed/near/GridNearTxLocal.java |   64 +-
 .../distributed/near/GridNearTxRemote.java      |   38 +-
 .../CacheDefaultPortableAffinityKeyMapper.java  |    2 +-
 .../portable/CacheObjectPortableContext.java    |    2 +-
 .../portable/CacheObjectPortableProcessor.java  |    8 +-
 .../CacheObjectPortableProcessorImpl.java       |   12 +-
 .../cache/portable/IgnitePortablesImpl.java     |   10 +-
 .../cache/store/CacheOsStoreManager.java        |    4 +-
 .../cache/transactions/IgniteTxAdapter.java     |    5 +-
 .../cache/transactions/IgniteTxHandler.java     |  281 +-
 .../transactions/IgniteTxLocalAdapter.java      |   37 +-
 .../cache/transactions/IgniteTxManager.java     |   48 +-
 .../datastructures/DataStructuresProcessor.java |  102 +-
 .../GridTransactionalCacheQueueImpl.java        |   15 +-
 .../processors/igfs/IgfsFileAffinityRange.java  |    4 +-
 .../dotnet/PlatformDotNetConfiguration.java     |   12 +-
 .../PlatformDotNetPortableConfiguration.java    |   12 +-
 ...PlatformDotNetPortableTypeConfiguration.java |   12 +-
 .../util/GridSpiCloseableIteratorWrapper.java   |    5 +
 .../marshaller/portable/PortableMarshaller.java |  358 --
 .../marshaller/portable/package-info.java       |   22 -
 .../apache/ignite/portable/PortableBuilder.java |  137 -
 .../ignite/portable/PortableException.java      |   57 -
 .../ignite/portable/PortableIdMapper.java       |   56 -
 .../portable/PortableInvalidClassException.java |   58 -
 .../ignite/portable/PortableMarshalAware.java   |   48 -
 .../ignite/portable/PortableMetadata.java       |   61 -
 .../apache/ignite/portable/PortableObject.java  |  154 -
 .../portable/PortableProtocolVersion.java       |   41 -
 .../ignite/portable/PortableRawReader.java      |  234 --
 .../ignite/portable/PortableRawWriter.java      |  219 -
 .../apache/ignite/portable/PortableReader.java  |  284 --
 .../ignite/portable/PortableSerializer.java     |   49 -
 .../portable/PortableTypeConfiguration.java     |  196 -
 .../apache/ignite/portable/PortableWriter.java  |  266 --
 .../apache/ignite/portable/package-info.java    |   22 -
 .../resources/META-INF/classnames.properties    |   20 +-
 .../GridDiscoveryManagerAttributesSelfTest.java |   45 -
 .../GridPortableAffinityKeySelfTest.java        |  218 -
 .../GridPortableBuilderAdditionalSelfTest.java  | 1226 ------
 .../portable/GridPortableBuilderSelfTest.java   | 1021 -----
 ...eBuilderStringAsCharsAdditionalSelfTest.java |   28 -
 ...ridPortableBuilderStringAsCharsSelfTest.java |   28 -
 ...idPortableMarshallerCtxDisabledSelfTest.java |  256 --
 .../GridPortableMarshallerSelfTest.java         | 3807 ------------------
 .../GridPortableMetaDataDisabledSelfTest.java   |  238 --
 .../portable/GridPortableMetaDataSelfTest.java  |  369 --
 .../portable/GridPortableWildcardsSelfTest.java |  482 ---
 .../GridPortableMarshalerAwareTestClass.java    |   67 -
 .../mutabletest/GridPortableTestClasses.java    |  434 --
 .../portable/mutabletest/package-info.java      |   22 -
 .../ignite/internal/portable/package-info.java  |   22 -
 .../portable/test/GridPortableTestClass1.java   |   28 -
 .../portable/test/GridPortableTestClass2.java   |   24 -
 .../internal/portable/test/package-info.java    |   22 -
 .../test/subpackage/GridPortableTestClass3.java |   24 -
 .../portable/test/subpackage/package-info.java  |   22 -
 .../CacheStoreUsageMultinodeAbstractTest.java   |   16 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |   50 +-
 .../processors/cache/GridCacheMvccSelfTest.java |    4 +-
 .../cache/GridCacheP2PUndeploySelfTest.java     |   30 +-
 .../cache/GridCachePutAllFailoverSelfTest.java  |   28 +-
 .../GridCacheVariableTopologySelfTest.java      |    5 +-
 .../cache/IgniteCachePutAllRestartTest.java     |    2 +
 .../cache/IgniteInternalCacheTypesTest.java     |    4 +-
 .../cache/IgniteOnePhaseCommitNearSelfTest.java |  243 ++
 .../IgniteTxExceptionAbstractSelfTest.java      |   29 +-
 ...ridCachePartitionNotLoadedEventSelfTest.java |   27 +-
 .../GridCacheTransformEventSelfTest.java        |    5 +-
 .../GridCacheColocatedTxExceptionSelfTest.java  |    2 +-
 .../dht/GridCacheTxNodeFailureSelfTest.java     |  405 ++
 .../dht/GridNearCacheTxNodeFailureSelfTest.java |   31 +
 ...gniteAtomicLongChangingTopologySelfTest.java |  278 ++
 .../near/GridCacheNearTxExceptionSelfTest.java  |    2 +-
 .../near/IgniteCacheNearOnlyTxTest.java         |   14 +-
 .../GridCacheReplicatedTxExceptionSelfTest.java |    2 +-
 .../GridCacheLocalTxExceptionSelfTest.java      |    2 +-
 ...ClientNodePortableMetadataMultinodeTest.java |  295 --
 ...GridCacheClientNodePortableMetadataTest.java |  286 --
 ...ableObjectsAbstractDataStreamerSelfTest.java |  190 -
 ...bleObjectsAbstractMultiThreadedSelfTest.java |  231 --
 ...ridCachePortableObjectsAbstractSelfTest.java |  978 -----
 .../GridCachePortableStoreAbstractSelfTest.java |  297 --
 .../GridCachePortableStoreObjectsSelfTest.java  |   55 -
 ...GridCachePortableStorePortablesSelfTest.java |   66 -
 ...ridPortableCacheEntryMemorySizeSelfTest.java |   55 -
 ...leDuplicateIndexObjectsAbstractSelfTest.java |  158 -
 .../DataStreamProcessorPortableSelfTest.java    |   66 -
 .../GridDataStreamerImplSelfTest.java           |  345 --
 ...ridCacheAffinityRoutingPortableSelfTest.java |   47 -
 ...lyPortableDataStreamerMultiNodeSelfTest.java |   29 -
 ...rtableDataStreamerMultithreadedSelfTest.java |   47 -
 ...artitionedOnlyPortableMultiNodeSelfTest.java |   28 -
 ...tionedOnlyPortableMultithreadedSelfTest.java |   47 -
 .../GridCacheMemoryModePortableSelfTest.java    |   36 -
 ...acheOffHeapTieredAtomicPortableSelfTest.java |   47 -
 ...eapTieredEvictionAtomicPortableSelfTest.java |   95 -
 ...heOffHeapTieredEvictionPortableSelfTest.java |   95 -
 .../GridCacheOffHeapTieredPortableSelfTest.java |   47 -
 ...ateIndexObjectPartitionedAtomicSelfTest.java |   38 -
 ...xObjectPartitionedTransactionalSelfTest.java |   41 -
 ...AtomicNearDisabledOffheapTieredSelfTest.java |   29 -
 ...rtableObjectsAtomicNearDisabledSelfTest.java |   51 -
 ...tableObjectsAtomicOffheapTieredSelfTest.java |   29 -
 .../GridCachePortableObjectsAtomicSelfTest.java |   51 -
 ...tionedNearDisabledOffheapTieredSelfTest.java |   30 -
 ...eObjectsPartitionedNearDisabledSelfTest.java |   51 -
 ...ObjectsPartitionedOffheapTieredSelfTest.java |   30 -
 ...CachePortableObjectsPartitionedSelfTest.java |   51 -
 ...sNearPartitionedByteArrayValuesSelfTest.java |   41 -
 ...sPartitionedOnlyByteArrayValuesSelfTest.java |   42 -
 ...dCachePortableObjectsReplicatedSelfTest.java |   51 -
 ...CachePortableObjectsAtomicLocalSelfTest.java |   32 -
 ...rtableObjectsLocalOffheapTieredSelfTest.java |   29 -
 .../GridCachePortableObjectsLocalSelfTest.java  |   51 -
 .../processors/igfs/IgfsStartCacheTest.java     |    2 +-
 .../stream/socket/SocketStreamerSelfTest.java   |   27 +-
 .../ignite/testframework/junits/IgniteMock.java |    8 +-
 .../multijvm/IgniteCacheProcessProxy.java       |    5 -
 .../junits/multijvm/IgniteProcessProxy.java     |    2 +-
 .../IgniteCacheFailoverTestSuite.java           |    9 +-
 .../IgnitePortableCacheFullApiTestSuite.java    |   37 -
 .../IgnitePortableCacheTestSuite.java           |  103 -
 .../IgnitePortableObjectsTestSuite.java         |   92 -
 .../ignite/portable/test1/1.1/test1-1.1.jar     |  Bin 2548 -> 0 bytes
 .../ignite/portable/test1/1.1/test1-1.1.pom     |    9 -
 .../portable/test1/maven-metadata-local.xml     |   12 -
 .../ignite/portable/test2/1.1/test2-1.1.jar     |  Bin 1361 -> 0 bytes
 .../ignite/portable/test2/1.1/test2-1.1.pom     |    9 -
 .../portable/test2/maven-metadata-local.xml     |   12 -
 .../HadoopDefaultMapReducePlannerSelfTest.java  |    6 +
 ...CacheScanPartitionQueryFallbackSelfTest.java |  105 +-
 .../IgniteCacheQueryNodeRestartSelfTest2.java   |    2 +
 .../IgniteCacheReplicatedQuerySelfTest.java     |   49 +-
 .../IgnitePortableCacheQueryTestSuite.java      |  117 -
 .../platform/PlatformContextImpl.java           |    4 +-
 .../platform/compute/PlatformCompute.java       |    2 +-
 .../cpp/PlatformCppConfigurationClosure.java    |    2 +-
 .../PlatformDotNetConfigurationClosure.java     |    6 +-
 .../platform/events/PlatformEvents.java         |    2 +-
 .../services/PlatformAbstractService.java       |    3 +-
 .../Cache/CacheAbstractTest.cs                  |   71 +-
 .../Config/Compute/compute-grid1.xml            |    8 +-
 .../PlatformComputePortableArgTask.java         |    8 +-
 .../ignite/schema/generator/CodeGenerator.java  |    4 +-
 .../ignite/schema/model/PojoDescriptor.java     |    6 +-
 .../parser/dialect/OracleMetadataDialect.java   |    7 +-
 .../org/apache/ignite/IgniteSpringBean.java     |    7 -
 .../yardstick/config/benchmark-query.properties |    5 +-
 modules/yardstick/config/ignite-base-config.xml |    2 +-
 modules/yardstick/config/ignite-jdbc-config.xml |   55 +
 parent/pom.xml                                  |   10 -
 pom.xml                                         |   10 +
 276 files changed, 13959 insertions(+), 18484 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8c907d66/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------


[25/41] ignite git commit: IGNITE-1479 Platform .Net: NPE in PlatformAbstractService upon service cancellation

Posted by ag...@apache.org.
IGNITE-1479 Platform .Net: NPE in PlatformAbstractService upon service cancellation


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a0cd9afd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a0cd9afd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a0cd9afd

Branch: refs/heads/ignite-1400
Commit: a0cd9afd1cbf471ced0363416f4577156a7296ea
Parents: b4c515e
Author: ptupitsyn <pt...@gridgain.com>
Authored: Mon Sep 14 17:23:16 2015 +0300
Committer: ptupitsyn <pt...@gridgain.com>
Committed: Mon Sep 14 17:23:16 2015 +0300

----------------------------------------------------------------------
 .../processors/platform/services/PlatformAbstractService.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a0cd9afd/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
index dac3ea2..dd5c28a 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
@@ -212,7 +212,9 @@ public abstract class PlatformAbstractService implements PlatformService, Extern
     @SuppressWarnings("UnusedDeclaration")
     @IgniteInstanceResource
     public void setIgniteInstance(Ignite ignite) {
-        platformCtx = PlatformUtils.platformContext(ignite);
+        platformCtx = ignite != null
+            ? PlatformUtils.platformContext(ignite)
+            : null;
     }
 
     /** {@inheritDoc} */


[10/41] ignite git commit: ignite-1028 (cherry picked from commit e4d7ae0)

Posted by ag...@apache.org.
ignite-1028
(cherry picked from commit e4d7ae0)


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/82ca4317
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/82ca4317
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/82ca4317

Branch: refs/heads/ignite-1400
Commit: 82ca43176610ff543102b049c26a9f79add098ef
Parents: 70ad5ba
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 11 13:51:22 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 11 14:02:31 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheP2PUndeploySelfTest.java     | 26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/82ca4317/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
index 2c8c748..92c5340 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -36,6 +37,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -201,7 +203,7 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
      * @param cacheName Cache name.
      * @throws Exception If failed.
      */
-    private void checkP2PUndeploy(String cacheName) throws Exception {
+    private void checkP2PUndeploy(final String cacheName) throws Exception {
         assert !F.isEmpty(cacheName);
 
         ClassLoader ldr = getExternalClassLoader();
@@ -210,7 +212,7 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
 
         try {
             Ignite ignite1 = startGrid(1);
-            IgniteKernal grid2 = (IgniteKernal)startGrid(2);
+            final IgniteKernal grid2 = (IgniteKernal)startGrid(2);
 
             IgniteCache<Integer, Object> cache1 = ignite1.cache(cacheName);
             IgniteCache<Integer, Object> cache2 = grid2.cache(cacheName);
@@ -237,20 +239,24 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
 
             cache2.localEvict(ImmutableSet.of(2, 3, 4));
 
-            U.sleep(100); //Time to store entries to disk.
-
-            long swapSize = size(cacheName, grid2);
-
-            info("Swap size: " + swapSize);
-
-            assert swapSize > 0;
+            //Wait until entries stored to disk.
+            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    try {
+                        return size(cacheName, grid2) > 0;
+                    }
+                    catch (IgniteCheckedException e) {
+                        throw new AssertionError(e);
+                    }
+                }
+            }, 5000);
 
             stopGrid(1);
 
             assert waitCacheEmpty(cache2, 10000);
 
             for (int i = 0; i < 3; i++) {
-                swapSize = size(cacheName, grid2);
+                long swapSize = size(cacheName, grid2);
 
                 if (swapSize > 0) {
                     if (i < 2) {


[36/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
ignite-1462: hid portable API in 1.4 release


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/71379a80
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/71379a80
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/71379a80

Branch: refs/heads/ignite-1400
Commit: 71379a8061f50f336adc31fa20cd593b659b050f
Parents: b4c515e
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Sep 14 17:24:27 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Sep 14 17:24:29 2015 +0300

----------------------------------------------------------------------
 examples/config/example-default.xml             |   76 -
 examples/config/example-ignite.xml              |   56 +-
 .../config/portable/example-ignite-portable.xml |   44 -
 .../ignite/examples/portable/Address.java       |   72 -
 .../ignite/examples/portable/Employee.java      |   93 -
 .../ignite/examples/portable/EmployeeKey.java   |   90 -
 .../portable/ExamplePortableNodeStartup.java    |   36 -
 .../ignite/examples/portable/Organization.java  |   93 -
 .../examples/portable/OrganizationType.java     |   32 -
 ...mputeClientPortableTaskExecutionExample.java |  154 -
 .../portable/computegrid/ComputeClientTask.java |  116 -
 .../portable/computegrid/package-info.java      |   21 -
 .../CacheClientPortablePutGetExample.java       |  230 --
 .../CacheClientPortableQueryExample.java        |  325 --
 .../portable/datagrid/package-info.java         |   21 -
 .../ignite/examples/portable/package-info.java  |   21 -
 .../CacheClientPortableExampleTest.java         |   46 -
 .../ComputeClientPortableExampleTest.java       |   37 -
 .../testsuites/IgniteExamplesSelfTestSuite.java |    6 -
 modules/core/pom.xml                            |   21 -
 .../src/main/java/org/apache/ignite/Ignite.java |    7 -
 .../java/org/apache/ignite/IgniteCache.java     |   44 +-
 .../java/org/apache/ignite/IgnitePortables.java |  370 --
 .../configuration/CacheConfiguration.java       |   70 +-
 .../org/apache/ignite/internal/IgniteEx.java    |    9 +
 .../apache/ignite/internal/IgniteKernal.java    |    8 +-
 .../ignite/internal/IgniteNodeAttributes.java   |    5 +-
 .../discovery/GridDiscoveryManager.java         |   10 -
 .../portable/GridPortableMarshaller.java        |    2 +-
 .../portable/PortableClassDescriptor.java       |   10 +-
 .../internal/portable/PortableContext.java      |   14 +-
 .../portable/PortableMetaDataCollector.java     |    6 +-
 .../portable/PortableMetaDataHandler.java       |    4 +-
 .../internal/portable/PortableMetaDataImpl.java |   14 +-
 .../internal/portable/PortableObjectEx.java     |    6 +-
 .../internal/portable/PortableObjectImpl.java   |    6 +-
 .../portable/PortableObjectOffheapImpl.java     |    6 +-
 .../internal/portable/PortableRawReaderEx.java  |    4 +-
 .../internal/portable/PortableRawWriterEx.java  |    4 +-
 .../portable/PortableReaderContext.java         |    2 +-
 .../internal/portable/PortableReaderExImpl.java |   10 +-
 .../ignite/internal/portable/PortableUtils.java |    2 +-
 .../internal/portable/PortableWriterExImpl.java |   11 +-
 .../internal/portable/api/IgnitePortables.java  |  362 ++
 .../internal/portable/api/PortableBuilder.java  |  136 +
 .../portable/api/PortableException.java         |   57 +
 .../internal/portable/api/PortableIdMapper.java |   54 +
 .../api/PortableInvalidClassException.java      |   58 +
 .../portable/api/PortableMarshalAware.java      |   48 +
 .../portable/api/PortableMarshaller.java        |  358 ++
 .../internal/portable/api/PortableMetadata.java |   60 +
 .../internal/portable/api/PortableObject.java   |  152 +
 .../portable/api/PortableProtocolVersion.java   |   41 +
 .../portable/api/PortableRawReader.java         |  234 ++
 .../portable/api/PortableRawWriter.java         |  219 +
 .../internal/portable/api/PortableReader.java   |  284 ++
 .../portable/api/PortableSerializer.java        |   47 +
 .../portable/api/PortableTypeConfiguration.java |  195 +
 .../internal/portable/api/PortableWriter.java   |  266 ++
 .../portable/builder/PortableBuilderEnum.java   |    2 +-
 .../portable/builder/PortableBuilderImpl.java   |   14 +-
 .../portable/builder/PortableBuilderReader.java |    2 +-
 .../builder/PortableBuilderSerializer.java      |    2 +-
 .../builder/PortableEnumArrayLazyValue.java     |    4 +-
 .../builder/PortableObjectArrayLazyValue.java   |    2 +-
 .../builder/PortablePlainPortableObject.java    |    2 +-
 .../streams/PortableAbstractInputStream.java    |    2 +-
 .../processors/cache/GridCacheProcessor.java    |    8 +-
 .../processors/cache/IgniteCacheProxy.java      |    5 -
 .../CacheDefaultPortableAffinityKeyMapper.java  |    2 +-
 .../portable/CacheObjectPortableContext.java    |    2 +-
 .../portable/CacheObjectPortableProcessor.java  |    8 +-
 .../CacheObjectPortableProcessorImpl.java       |   12 +-
 .../cache/portable/IgnitePortablesImpl.java     |   10 +-
 .../cache/store/CacheOsStoreManager.java        |    4 +-
 .../dotnet/PlatformDotNetConfiguration.java     |   12 +-
 .../PlatformDotNetPortableConfiguration.java    |   12 +-
 ...PlatformDotNetPortableTypeConfiguration.java |   12 +-
 .../marshaller/portable/PortableMarshaller.java |  358 --
 .../marshaller/portable/package-info.java       |   22 -
 .../apache/ignite/portable/PortableBuilder.java |  137 -
 .../ignite/portable/PortableException.java      |   57 -
 .../ignite/portable/PortableIdMapper.java       |   56 -
 .../portable/PortableInvalidClassException.java |   58 -
 .../ignite/portable/PortableMarshalAware.java   |   48 -
 .../ignite/portable/PortableMetadata.java       |   61 -
 .../apache/ignite/portable/PortableObject.java  |  154 -
 .../portable/PortableProtocolVersion.java       |   41 -
 .../ignite/portable/PortableRawReader.java      |  234 --
 .../ignite/portable/PortableRawWriter.java      |  219 -
 .../apache/ignite/portable/PortableReader.java  |  284 --
 .../ignite/portable/PortableSerializer.java     |   49 -
 .../portable/PortableTypeConfiguration.java     |  196 -
 .../apache/ignite/portable/PortableWriter.java  |  266 --
 .../apache/ignite/portable/package-info.java    |   22 -
 .../resources/META-INF/classnames.properties    |    8 +-
 .../GridDiscoveryManagerAttributesSelfTest.java |   45 -
 .../GridPortableAffinityKeySelfTest.java        |  218 -
 .../GridPortableBuilderAdditionalSelfTest.java  | 1226 ------
 .../portable/GridPortableBuilderSelfTest.java   | 1021 -----
 ...eBuilderStringAsCharsAdditionalSelfTest.java |   28 -
 ...ridPortableBuilderStringAsCharsSelfTest.java |   28 -
 ...idPortableMarshallerCtxDisabledSelfTest.java |  256 --
 .../GridPortableMarshallerSelfTest.java         | 3807 ------------------
 .../GridPortableMetaDataDisabledSelfTest.java   |  238 --
 .../portable/GridPortableMetaDataSelfTest.java  |  371 --
 .../portable/GridPortableWildcardsSelfTest.java |  482 ---
 .../GridPortableMarshalerAwareTestClass.java    |   67 -
 .../mutabletest/GridPortableTestClasses.java    |  434 --
 .../portable/mutabletest/package-info.java      |   22 -
 .../ignite/internal/portable/package-info.java  |   22 -
 .../portable/test/GridPortableTestClass1.java   |   28 -
 .../portable/test/GridPortableTestClass2.java   |   24 -
 .../internal/portable/test/package-info.java    |   22 -
 .../test/subpackage/GridPortableTestClass3.java |   24 -
 .../portable/test/subpackage/package-info.java  |   22 -
 ...ClientNodePortableMetadataMultinodeTest.java |  295 --
 ...GridCacheClientNodePortableMetadataTest.java |  286 --
 ...ableObjectsAbstractDataStreamerSelfTest.java |  190 -
 ...bleObjectsAbstractMultiThreadedSelfTest.java |  231 --
 ...ridCachePortableObjectsAbstractSelfTest.java |  978 -----
 .../GridCachePortableStoreAbstractSelfTest.java |  297 --
 .../GridCachePortableStoreObjectsSelfTest.java  |   55 -
 ...GridCachePortableStorePortablesSelfTest.java |   66 -
 ...ridPortableCacheEntryMemorySizeSelfTest.java |   55 -
 ...leDuplicateIndexObjectsAbstractSelfTest.java |  158 -
 .../DataStreamProcessorPortableSelfTest.java    |   66 -
 .../GridDataStreamerImplSelfTest.java           |  345 --
 ...ridCacheAffinityRoutingPortableSelfTest.java |   47 -
 ...lyPortableDataStreamerMultiNodeSelfTest.java |   29 -
 ...rtableDataStreamerMultithreadedSelfTest.java |   47 -
 ...artitionedOnlyPortableMultiNodeSelfTest.java |   28 -
 ...tionedOnlyPortableMultithreadedSelfTest.java |   47 -
 .../GridCacheMemoryModePortableSelfTest.java    |   36 -
 ...acheOffHeapTieredAtomicPortableSelfTest.java |   47 -
 ...eapTieredEvictionAtomicPortableSelfTest.java |   95 -
 ...heOffHeapTieredEvictionPortableSelfTest.java |   95 -
 .../GridCacheOffHeapTieredPortableSelfTest.java |   47 -
 ...ateIndexObjectPartitionedAtomicSelfTest.java |   38 -
 ...xObjectPartitionedTransactionalSelfTest.java |   41 -
 ...AtomicNearDisabledOffheapTieredSelfTest.java |   29 -
 ...rtableObjectsAtomicNearDisabledSelfTest.java |   51 -
 ...tableObjectsAtomicOffheapTieredSelfTest.java |   29 -
 .../GridCachePortableObjectsAtomicSelfTest.java |   51 -
 ...tionedNearDisabledOffheapTieredSelfTest.java |   30 -
 ...eObjectsPartitionedNearDisabledSelfTest.java |   51 -
 ...ObjectsPartitionedOffheapTieredSelfTest.java |   30 -
 ...CachePortableObjectsPartitionedSelfTest.java |   51 -
 ...sNearPartitionedByteArrayValuesSelfTest.java |   41 -
 ...sPartitionedOnlyByteArrayValuesSelfTest.java |   42 -
 ...dCachePortableObjectsReplicatedSelfTest.java |   51 -
 ...CachePortableObjectsAtomicLocalSelfTest.java |   32 -
 ...rtableObjectsLocalOffheapTieredSelfTest.java |   29 -
 .../GridCachePortableObjectsLocalSelfTest.java  |   51 -
 .../ignite/testframework/junits/IgniteMock.java |    8 +-
 .../multijvm/IgniteCacheProcessProxy.java       |    5 -
 .../junits/multijvm/IgniteProcessProxy.java     |    2 +-
 .../IgnitePortableCacheFullApiTestSuite.java    |   37 -
 .../IgnitePortableCacheTestSuite.java           |  103 -
 .../IgnitePortableObjectsTestSuite.java         |   92 -
 .../ignite/portable/test1/1.1/test1-1.1.jar     |  Bin 2548 -> 0 bytes
 .../ignite/portable/test1/1.1/test1-1.1.pom     |    9 -
 .../portable/test1/maven-metadata-local.xml     |   12 -
 .../ignite/portable/test2/1.1/test2-1.1.jar     |  Bin 1361 -> 0 bytes
 .../ignite/portable/test2/1.1/test2-1.1.pom     |    9 -
 .../portable/test2/maven-metadata-local.xml     |   12 -
 .../HadoopDefaultMapReducePlannerSelfTest.java  |    6 +
 .../IgnitePortableCacheQueryTestSuite.java      |  117 -
 .../platform/PlatformContextImpl.java           |    4 +-
 .../platform/compute/PlatformCompute.java       |    2 +-
 .../cpp/PlatformCppConfigurationClosure.java    |    2 +-
 .../PlatformDotNetConfigurationClosure.java     |    6 +-
 .../Config/Compute/compute-grid1.xml            |    8 +-
 .../PlatformComputePortableArgTask.java         |    8 +-
 .../org/apache/ignite/IgniteSpringBean.java     |    7 -
 parent/pom.xml                                  |   10 -
 176 files changed, 2778 insertions(+), 17425 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/config/example-default.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-default.xml b/examples/config/example-default.xml
deleted file mode 100644
index e6c359d..0000000
--- a/examples/config/example-default.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-
-<!--
-    Ignite configuration with all defaults and enabled p2p deployment and enabled events.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:util="http://www.springframework.org/schema/util"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd
-        http://www.springframework.org/schema/util
-        http://www.springframework.org/schema/util/spring-util.xsd">
-    <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <!-- Set to true to enable distributed class loading for examples, default is false. -->
-        <property name="peerClassLoadingEnabled" value="true"/>
-
-        <!-- Enable task execution events for examples. -->
-        <property name="includeEventTypes">
-            <list>
-                <!--Task execution events-->
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
-
-                <!--Cache events-->
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
-                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <!--
-                        Ignite provides several options for automatic discovery that can be used
-                        instead os static IP based discovery. For information on all options refer
-                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
-                    -->
-                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
-                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <!-- In distributed environment, replace with actual host IP address. -->
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/config/example-ignite.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-ignite.xml b/examples/config/example-ignite.xml
index d842a6d..e7adb54 100644
--- a/examples/config/example-ignite.xml
+++ b/examples/config/example-ignite.xml
@@ -22,18 +22,62 @@
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-    <!-- Imports default Ignite configuration -->
-    <import resource="example-default.xml"/>
+       xmlns:util="http://www.springframework.org/schema/util"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/util
+        http://www.springframework.org/schema/util/spring-util.xsd">
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <!-- Set to true to enable distributed class loading for examples, default is false. -->
+        <property name="peerClassLoadingEnabled" value="true"/>
 
-    <bean parent="ignite.cfg">
-        <!-- Enabled optimized marshaller -->
         <property name="marshaller">
             <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <!-- Set to false to allow non-serializable objects in examples, default is true. -->
                 <property name="requireSerializable" value="false"/>
             </bean>
         </property>
+
+        <!-- Enable task execution events for examples. -->
+        <property name="includeEventTypes">
+            <list>
+                <!--Task execution events-->
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
+
+                <!--Cache events-->
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
+                <util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <!--
+                        Ignite provides several options for automatic discovery that can be used
+                        instead os static IP based discovery. For information on all options refer
+                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
+                    -->
+                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
+                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <!-- In distributed environment, replace with actual host IP address. -->
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
     </bean>
 </beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/config/portable/example-ignite-portable.xml
----------------------------------------------------------------------
diff --git a/examples/config/portable/example-ignite-portable.xml b/examples/config/portable/example-ignite-portable.xml
deleted file mode 100644
index cde15ea..0000000
--- a/examples/config/portable/example-ignite-portable.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-
-<!--
-    Ignite configuration with all defaults and enabled p2p deployment, events and portable marshaller.
-
-    Use this configuration file when running HTTP REST examples (see 'examples/rest' folder).
-
-    When starting a standalone node, you need to execute the following command:
-    {IGNITE_HOME}/bin/ignite.{bat|sh} examples/config/portable/example-ignite-portable.xml
-
-    When starting Ignite from Java IDE, pass path to this file to Ignition:
-    Ignition.start("examples/config/portable/example-ignite-portable.xml");
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-    <!-- Imports default Ignite configuration -->
-    <import resource="../example-default.xml"/>
-
-    <bean parent="ignite.cfg">
-        <!-- Enables portable marshaller -->
-        <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"/>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Address.java b/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
deleted file mode 100644
index cb08b25..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable;
-
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-
-/**
- * Employee address.
- * <p>
- * This class implements {@link PortableMarshalAware} only for example purposes,
- * in order to show how to customize serialization and deserialization of
- * portable objects.
- */
-public class Address implements PortableMarshalAware {
-    /** Street. */
-    private String street;
-
-    /** ZIP code. */
-    private int zip;
-
-    /**
-     * Required for portable deserialization.
-     */
-    public Address() {
-        // No-op.
-    }
-
-    /**
-     * @param street Street.
-     * @param zip ZIP code.
-     */
-    public Address(String street, int zip) {
-        this.street = street;
-        this.zip = zip;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writePortable(PortableWriter writer) throws PortableException {
-        writer.writeString("street", street);
-        writer.writeInt("zip", zip);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readPortable(PortableReader reader) throws PortableException {
-        street = reader.readString("street");
-        zip = reader.readInt("zip");
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Address [street=" + street +
-            ", zip=" + zip + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java b/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
deleted file mode 100644
index 9614168..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable;
-
-import java.util.Collection;
-
-/**
- * This class represents employee object.
- */
-public class Employee {
-    /** Name. */
-    private String name;
-
-    /** Salary. */
-    private long salary;
-
-    /** Address. */
-    private Address address;
-
-    /** Departments. */
-    private Collection<String> departments;
-
-    /**
-     * Required for portable deserialization.
-     */
-    public Employee() {
-        // No-op.
-    }
-
-    /**
-     * @param name Name.
-     * @param salary Salary.
-     * @param address Address.
-     * @param departments Departments.
-     */
-    public Employee(String name, long salary, Address address, Collection<String> departments) {
-        this.name = name;
-        this.salary = salary;
-        this.address = address;
-        this.departments = departments;
-    }
-
-    /**
-     * @return Name.
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * @return Salary.
-     */
-    public long salary() {
-        return salary;
-    }
-
-    /**
-     * @return Address.
-     */
-    public Address address() {
-        return address;
-    }
-
-    /**
-     * @return Departments.
-     */
-    public Collection<String> departments() {
-        return departments;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Employee [name=" + name +
-            ", salary=" + salary +
-            ", address=" + address +
-            ", departments=" + departments + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
deleted file mode 100644
index f322167..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable;
-
-/**
- * This class represents key for employee object.
- * <p>
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
-    /** ID. */
-    private int id;
-
-    /** Organization ID. */
-    private int organizationId;
-
-    /**
-     * Required for portable deserialization.
-     */
-    public EmployeeKey() {
-        // No-op.
-    }
-
-    /**
-     * @param id ID.
-     * @param organizationId Organization ID.
-     */
-    public EmployeeKey(int id, int organizationId) {
-        this.id = id;
-        this.organizationId = organizationId;
-    }
-
-    /**
-     * @return ID.
-     */
-    public int id() {
-        return id;
-    }
-
-    /**
-     * @return Organization ID.
-     */
-    public int organizationId() {
-        return organizationId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o)
-            return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        EmployeeKey key = (EmployeeKey)o;
-
-        return id == key.id && organizationId == key.organizationId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = id;
-
-        res = 31 * res + organizationId;
-
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "EmployeeKey [id=" + id +
-            ", organizationId=" + organizationId + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
deleted file mode 100644
index 87a41f7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-
-/**
- * Starts up an empty node with example configuration and portable marshaller enabled.
- */
-public class ExamplePortableNodeStartup {
-    /**
-     * Start up an empty node with example configuration and portable marshaller enabled.
-     *
-     * @param args Command line arguments, none required.
-     * @throws IgniteException If failed.
-     */
-    public static void main(String[] args) throws IgniteException {
-        Ignition.start("examples/config/portable/example-ignite-portable.xml");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java b/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
deleted file mode 100644
index f52cac1..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
-    /** Name. */
-    private String name;
-
-    /** Address. */
-    private Address address;
-
-    /** Type. */
-    private OrganizationType type;
-
-    /** Last update time. */
-    private Timestamp lastUpdated;
-
-    /**
-     * Required for portable deserialization.
-     */
-    public Organization() {
-        // No-op.
-    }
-
-    /**
-     * @param name Name.
-     * @param address Address.
-     * @param type Type.
-     * @param lastUpdated Last update time.
-     */
-    public Organization(String name, Address address, OrganizationType type, Timestamp lastUpdated) {
-        this.name = name;
-        this.address = address;
-        this.type = type;
-        this.lastUpdated = lastUpdated;
-    }
-
-    /**
-     * @return Name.
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * @return Address.
-     */
-    public Address address() {
-        return address;
-    }
-
-    /**
-     * @return Type.
-     */
-    public OrganizationType type() {
-        return type;
-    }
-
-    /**
-     * @return Last update time.
-     */
-    public Timestamp lastUpdated() {
-        return lastUpdated;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return "Organization [name=" + name +
-            ", address=" + address +
-            ", type=" + type +
-            ", lastUpdated=" + lastUpdated + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
deleted file mode 100644
index c753e2d..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
-    /** Non-profit organization. */
-    NON_PROFIT,
-
-    /** Private organization. */
-    PRIVATE,
-
-    /** Government organization. */
-    GOVERNMENT
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
deleted file mode 100644
index 34d9cde..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with task execution.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- * <p>
- * The example executes map-reduce task that accepts collection of portable objects as an argument.
- * Since these objects are never deserialized on remote nodes, classes are not required on classpath
- * of these nodes.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- * <p>
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class ComputeClientPortableTaskExecutionExample {
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
-            System.out.println();
-            System.out.println(">>> Portable objects task execution example started.");
-
-            if (ignite.cluster().forRemotes().nodes().isEmpty()) {
-                System.out.println();
-                System.out.println(">>> This example requires remote nodes to be started.");
-                System.out.println(">>> Please start at least 1 remote node.");
-                System.out.println(">>> Refer to example's javadoc for details on configuration.");
-                System.out.println();
-
-                return;
-            }
-
-            // Generate employees to calculate average salary for.
-            Collection<Employee> employees = employees();
-
-            System.out.println();
-            System.out.println(">>> Calculating average salary for employees:");
-
-            for (Employee employee : employees)
-                System.out.println(">>>     " + employee);
-
-            // Convert collection of employees to collection of portable objects.
-            // This allows to send objects across nodes without requiring to have
-            // Employee class on classpath of these nodes.
-            Collection<PortableObject> portables = ignite.portables().toPortable(employees);
-
-            // Execute task and get average salary.
-            Long avgSalary = ignite.compute(ignite.cluster().forRemotes()).execute(new ComputeClientTask(), portables);
-
-            System.out.println();
-            System.out.println(">>> Average salary for all employees: " + avgSalary);
-            System.out.println();
-        }
-    }
-
-    /**
-     * Creates collection of employees.
-     *
-     * @return Collection of employees.
-     */
-    private static Collection<Employee> employees() {
-        Collection<Employee> employees = new ArrayList<>();
-
-        employees.add(new Employee(
-            "James Wilson",
-            12500,
-            new Address("1096 Eddy Street, San Francisco, CA", 94109),
-            Arrays.asList("Human Resources", "Customer Service")
-        ));
-
-        employees.add(new Employee(
-            "Daniel Adams",
-            11000,
-            new Address("184 Fidler Drive, San Antonio, TX", 78205),
-            Arrays.asList("Development", "QA")
-        ));
-
-        employees.add(new Employee(
-            "Cristian Moss",
-            12500,
-            new Address("667 Jerry Dove Drive, Florence, SC", 29501),
-            Arrays.asList("Logistics")
-        ));
-
-        employees.add(new Employee(
-            "Allison Mathis",
-            25300,
-            new Address("2702 Freedom Lane, Hornitos, CA", 95325),
-            Arrays.asList("Development")
-        ));
-
-        employees.add(new Employee(
-            "Breana Robbin",
-            6500,
-            new Address("3960 Sundown Lane, Austin, TX", 78758),
-            Arrays.asList("Sales")
-        ));
-
-        employees.add(new Employee(
-            "Philip Horsley",
-            19800,
-            new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
-            Arrays.asList("Sales")
-        ));
-
-        employees.add(new Employee(
-            "Brian Peters",
-            10600,
-            new Address("1407 Pearlman Avenue, Boston, MA", 12110),
-            Arrays.asList("Development", "QA")
-        ));
-
-        employees.add(new Employee(
-            "Jack Yang",
-            12900,
-            new Address("4425 Parrish Avenue Smithsons Valley, TX", 78130),
-            Arrays.asList("Sales")
-        ));
-
-        return employees;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
deleted file mode 100644
index 0eee8c6..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.portable.PortableObject;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task that is used for {@link ComputeClientPortableTaskExecutionExample} and
- * similar examples in .NET and C++.
- * <p>
- * This task calculates average salary for provided collection of employees.
- * It splits the collection into batches of size {@code 3} and creates a job
- * for each batch. After all jobs are executed, there results are reduced to
- * get the average salary.
- */
-public class ComputeClientTask extends ComputeTaskSplitAdapter<Collection<PortableObject>, Long> {
-    /** {@inheritDoc} */
-    @Override protected Collection<? extends ComputeJob> split(
-        int gridSize,
-        Collection<PortableObject> arg
-    ) {
-        Collection<ComputeClientJob> jobs = new ArrayList<>();
-
-        Collection<PortableObject> employees = new ArrayList<>();
-
-        // Split provided collection into batches and
-        // create a job for each batch.
-        for (PortableObject employee : arg) {
-            employees.add(employee);
-
-            if (employees.size() == 3) {
-                jobs.add(new ComputeClientJob(employees));
-
-                employees = new ArrayList<>(3);
-            }
-        }
-
-        if (!employees.isEmpty())
-            jobs.add(new ComputeClientJob(employees));
-
-        return jobs;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Long reduce(List<ComputeJobResult> results) {
-        long sum = 0;
-        int cnt = 0;
-
-        for (ComputeJobResult res : results) {
-            IgniteBiTuple<Long, Integer> t = res.getData();
-
-            sum += t.get1();
-            cnt += t.get2();
-        }
-
-        return sum / cnt;
-    }
-
-    /**
-     * Remote job for {@link ComputeClientTask}.
-     */
-    private static class ComputeClientJob extends ComputeJobAdapter {
-        /** Collection of employees. */
-        private final Collection<PortableObject> employees;
-
-        /**
-         * @param employees Collection of employees.
-         */
-        private ComputeClientJob(Collection<PortableObject> employees) {
-            this.employees = employees;
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Object execute() {
-            long sum = 0;
-            int cnt = 0;
-
-            for (PortableObject employee : employees) {
-                System.out.println(">>> Processing employee: " + employee.field("name"));
-
-                // Get salary from portable object. Note that object
-                // doesn't need to be fully deserialized.
-                long salary = employee.field("salary");
-
-                sum += salary;
-                cnt++;
-            }
-
-            return new IgniteBiTuple<>(sum, cnt);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
deleted file mode 100644
index 469128c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Demonstrates the usage of portable objects with task execution.
- */
-package org.apache.ignite.examples.portable.computegrid;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
deleted file mode 100644
index 77c5d95..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with Ignite cache.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- * <p>
- * The example executes several put-get operations on Ignite cache with portable values. Note that
- * it demonstrates how portable object can be retrieved in fully-deserialized form or in portable object
- * format using special cache projection.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- * <p>
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortablePutGetExample {
-    /** Cache name. */
-    private static final String CACHE_NAME = CacheClientPortablePutGetExample.class.getSimpleName();
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
-            System.out.println();
-            System.out.println(">>> Portable objects cache put-get example started.");
-
-            CacheConfiguration<Integer, Organization> cfg = new CacheConfiguration<>();
-
-            cfg.setCacheMode(CacheMode.PARTITIONED);
-            cfg.setName(CACHE_NAME);
-            cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-
-            try (IgniteCache<Integer, Organization> cache = ignite.createCache(cfg)) {
-                if (ignite.cluster().forDataNodes(cache.getName()).nodes().isEmpty()) {
-                    System.out.println();
-                    System.out.println(">>> This example requires remote cache node nodes to be started.");
-                    System.out.println(">>> Please start at least 1 remote cache node.");
-                    System.out.println(">>> Refer to example's javadoc for details on configuration.");
-                    System.out.println();
-
-                    return;
-                }
-
-                putGet(cache);
-                putGetPortable(cache);
-                putGetAll(cache);
-                putGetAllPortable(cache);
-
-                System.out.println();
-            }
-            finally {
-                // Delete cache with its content completely.
-                ignite.destroyCache(CACHE_NAME);
-            }
-        }
-    }
-
-    /**
-     * Execute individual put and get.
-     *
-     * @param cache Cache.
-     */
-    private static void putGet(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable object to store in cache.
-        Organization org = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        // Put created data entry to cache.
-        cache.put(1, org);
-
-        // Get recently created organization as a strongly-typed fully de-serialized instance.
-        Organization orgFromCache = cache.get(1);
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization instance from cache: " + orgFromCache);
-    }
-
-    /**
-     * Execute individual put and get, getting value in portable format, without de-serializing it.
-     *
-     * @param cache Cache.
-     */
-    private static void putGetPortable(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable object to store in cache.
-        Organization org = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        // Put created data entry to cache.
-        cache.put(1, org);
-
-        // Get cache that will get values as portable objects.
-        IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();
-
-        // Get recently created organization as a portable object.
-        PortableObject po = portableCache.get(1);
-
-        // Get organization's name from portable object (note that
-        // object doesn't need to be fully deserialized).
-        String name = po.field("name");
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization name from portable object: " + name);
-    }
-
-    /**
-     * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations.
-     *
-     * @param cache Cache.
-     */
-    private static void putGetAll(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable objects to store in cache.
-        Organization org1 = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Organization org2 = new Organization(
-            "Red Cross", // Name.
-            new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
-            OrganizationType.NON_PROFIT, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Map<Integer, Organization> map = new HashMap<>();
-
-        map.put(1, org1);
-        map.put(2, org2);
-
-        // Put created data entries to cache.
-        cache.putAll(map);
-
-        // Get recently created organizations as a strongly-typed fully de-serialized instances.
-        Map<Integer, Organization> mapFromCache = cache.getAll(map.keySet());
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization instances from cache:");
-
-        for (Organization org : mapFromCache.values())
-            System.out.println(">>>     " + org);
-    }
-
-    /**
-     * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations,
-     * getting values in portable format, without de-serializing it.
-     *
-     * @param cache Cache.
-     */
-    private static void putGetAllPortable(IgniteCache<Integer, Organization> cache) {
-        // Create new Organization portable objects to store in cache.
-        Organization org1 = new Organization(
-            "Microsoft", // Name.
-            new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
-            OrganizationType.PRIVATE, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Organization org2 = new Organization(
-            "Red Cross", // Name.
-            new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
-            OrganizationType.NON_PROFIT, // Type.
-            new Timestamp(System.currentTimeMillis())); // Last update time.
-
-        Map<Integer, Organization> map = new HashMap<>();
-
-        map.put(1, org1);
-        map.put(2, org2);
-
-        // Put created data entries to cache.
-        cache.putAll(map);
-
-        // Get cache that will get values as portable objects.
-        IgniteCache<Integer, PortableObject> portableCache = cache.withKeepPortable();
-
-        // Get recently created organizations as portable objects.
-        Map<Integer, PortableObject> poMap = portableCache.getAll(map.keySet());
-
-        Collection<String> names = new ArrayList<>();
-
-        // Get organizations' names from portable objects (note that
-        // objects don't need to be fully deserialized).
-        for (PortableObject po : poMap.values())
-            names.add(po.<String>field("name"));
-
-        System.out.println();
-        System.out.println(">>> Retrieved organization names from portable objects: " + names);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
deleted file mode 100644
index 3170864..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.TextQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.EmployeeKey;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with cache queries.
- * The example populates cache with sample data and runs several SQL and full text queries over this data.
- * <p>
- * Remote nodes should always be started with {@link ExamplePortableNodeStartup} which starts a node with
- * {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortableQueryExample {
-    /** Organization cache name. */
-    private static final String ORGANIZATION_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
-        + "Organizations";
-
-    /** Employee cache name. */
-    private static final String EMPLOYEE_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
-        + "Employees";
-
-    /**
-     * Executes example.
-     *
-     * @param args Command line arguments, none required.
-     */
-    public static void main(String[] args) {
-        try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
-            System.out.println();
-            System.out.println(">>> Portable objects cache query example started.");
-
-            CacheConfiguration<Integer, Organization> orgCacheCfg = new CacheConfiguration<>();
-
-            orgCacheCfg.setCacheMode(CacheMode.PARTITIONED);
-            orgCacheCfg.setName(ORGANIZATION_CACHE_NAME);
-
-            orgCacheCfg.setTypeMetadata(Arrays.asList(createOrganizationTypeMetadata()));
-
-            CacheConfiguration<EmployeeKey, Employee> employeeCacheCfg = new CacheConfiguration<>();
-
-            employeeCacheCfg.setCacheMode(CacheMode.PARTITIONED);
-            employeeCacheCfg.setName(EMPLOYEE_CACHE_NAME);
-
-            employeeCacheCfg.setTypeMetadata(Arrays.asList(createEmployeeTypeMetadata()));
-
-            try (IgniteCache<Integer, Organization> orgCache = ignite.createCache(orgCacheCfg);
-                 IgniteCache<EmployeeKey, Employee> employeeCache = ignite.createCache(employeeCacheCfg)
-            ) {
-                if (ignite.cluster().forDataNodes(orgCache.getName()).nodes().isEmpty()) {
-                    System.out.println();
-                    System.out.println(">>> This example requires remote cache nodes to be started.");
-                    System.out.println(">>> Please start at least 1 remote cache node.");
-                    System.out.println(">>> Refer to example's javadoc for details on configuration.");
-                    System.out.println();
-
-                    return;
-                }
-
-                // Populate cache with sample data entries.
-                populateCache(orgCache, employeeCache);
-
-                // Get cache that will work with portable objects.
-                IgniteCache<PortableObject, PortableObject> portableCache = employeeCache.withKeepPortable();
-
-                // Run SQL query example.
-                sqlQuery(portableCache);
-
-                // Run SQL query with join example.
-                sqlJoinQuery(portableCache);
-
-                // Run SQL fields query example.
-                sqlFieldsQuery(portableCache);
-
-                // Run full text query example.
-                textQuery(portableCache);
-
-                System.out.println();
-            }
-            finally {
-                // Delete caches with their content completely.
-                ignite.destroyCache(ORGANIZATION_CACHE_NAME);
-                ignite.destroyCache(EMPLOYEE_CACHE_NAME);
-            }
-        }
-    }
-
-    /**
-     * Create cache type metadata for {@link Employee}.
-     *
-     * @return Cache type metadata.
-     */
-    private static CacheTypeMetadata createEmployeeTypeMetadata() {
-        CacheTypeMetadata employeeTypeMeta = new CacheTypeMetadata();
-
-        employeeTypeMeta.setValueType(Employee.class);
-
-        employeeTypeMeta.setKeyType(EmployeeKey.class);
-
-        Map<String, Class<?>> ascFields = new HashMap<>();
-
-        ascFields.put("name", String.class);
-        ascFields.put("salary", Long.class);
-        ascFields.put("address.zip", Integer.class);
-        ascFields.put("organizationId", Integer.class);
-
-        employeeTypeMeta.setAscendingFields(ascFields);
-
-        employeeTypeMeta.setTextFields(Arrays.asList("address.street"));
-
-        return employeeTypeMeta;
-    }
-
-    /**
-     * Create cache type metadata for {@link Organization}.
-     *
-     * @return Cache type metadata.
-     */
-    private static CacheTypeMetadata createOrganizationTypeMetadata() {
-        CacheTypeMetadata organizationTypeMeta = new CacheTypeMetadata();
-
-        organizationTypeMeta.setValueType(Organization.class);
-
-        organizationTypeMeta.setKeyType(Integer.class);
-
-        Map<String, Class<?>> ascFields = new HashMap<>();
-
-        ascFields.put("name", String.class);
-
-        Map<String, Class<?>> queryFields = new HashMap<>();
-
-        queryFields.put("address.street", String.class);
-
-        organizationTypeMeta.setAscendingFields(ascFields);
-
-        organizationTypeMeta.setQueryFields(queryFields);
-
-        return organizationTypeMeta;
-    }
-
-    /**
-     * Queries employees that have provided ZIP code in address.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        SqlQuery<PortableObject, PortableObject> query = new SqlQuery<>(Employee.class, "zip = ?");
-
-        int zip = 94109;
-
-        QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees = cache.query(query.setArgs(zip));
-
-        System.out.println();
-        System.out.println(">>> Employees with zip " + zip + ':');
-
-        for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue().deserialize());
-    }
-
-    /**
-     * Queries employees that work for organization with provided name.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlJoinQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        SqlQuery<PortableObject, PortableObject> query = new SqlQuery<>(Employee.class,
-            "from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
-                "where Employee.organizationId = org._key and org.name = ?");
-
-        String organizationName = "GridGain";
-
-        QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees =
-            cache.query(query.setArgs(organizationName));
-
-        System.out.println();
-        System.out.println(">>> Employees working for " + organizationName + ':');
-
-        for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue());
-    }
-
-    /**
-     * Queries names and salaries for all employees.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void sqlFieldsQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        SqlFieldsQuery query = new SqlFieldsQuery("select name, salary from Employee");
-
-        QueryCursor<List<?>> employees = cache.query(query);
-
-        System.out.println();
-        System.out.println(">>> Employee names and their salaries:");
-
-        for (List<?> row : employees.getAll())
-            System.out.println(">>>     [Name=" + row.get(0) + ", salary=" + row.get(1) + ']');
-    }
-
-    /**
-     * Queries employees that live in Texas using full-text query API.
-     *
-     * @param cache Ignite cache.
-     */
-    private static void textQuery(IgniteCache<PortableObject, PortableObject> cache) {
-        TextQuery<PortableObject, PortableObject> query = new TextQuery<>(Employee.class, "TX");
-
-        QueryCursor<Cache.Entry<PortableObject, PortableObject>> employees = cache.query(query);
-
-        System.out.println();
-        System.out.println(">>> Employees living in Texas:");
-
-        for (Cache.Entry<PortableObject, PortableObject> e : employees.getAll())
-            System.out.println(">>>     " + e.getValue().deserialize());
-    }
-
-    /**
-     * Populates cache with data.
-     *
-     * @param orgCache Organization cache.
-     * @param employeeCache Employee cache.
-     */
-    private static void populateCache(IgniteCache<Integer, Organization> orgCache,
-        IgniteCache<EmployeeKey, Employee> employeeCache) {
-        orgCache.put(1, new Organization(
-            "GridGain",
-            new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
-            OrganizationType.PRIVATE,
-            new Timestamp(System.currentTimeMillis())
-        ));
-
-        orgCache.put(2, new Organization(
-            "Microsoft",
-            new Address("1096 Eddy Street, San Francisco, CA", 94109),
-            OrganizationType.PRIVATE,
-            new Timestamp(System.currentTimeMillis())
-        ));
-
-        employeeCache.put(new EmployeeKey(1, 1), new Employee(
-            "James Wilson",
-            12500,
-            new Address("1096 Eddy Street, San Francisco, CA", 94109),
-            Arrays.asList("Human Resources", "Customer Service")
-        ));
-
-        employeeCache.put(new EmployeeKey(2, 1), new Employee(
-            "Daniel Adams",
-            11000,
-            new Address("184 Fidler Drive, San Antonio, TX", 78130),
-            Arrays.asList("Development", "QA")
-        ));
-
-        employeeCache.put(new EmployeeKey(3, 1), new Employee(
-            "Cristian Moss",
-            12500,
-            new Address("667 Jerry Dove Drive, Florence, SC", 29501),
-            Arrays.asList("Logistics")
-        ));
-
-        employeeCache.put(new EmployeeKey(4, 2), new Employee(
-            "Allison Mathis",
-            25300,
-            new Address("2702 Freedom Lane, San Francisco, CA", 94109),
-            Arrays.asList("Development")
-        ));
-
-        employeeCache.put(new EmployeeKey(5, 2), new Employee(
-            "Breana Robbin",
-            6500,
-            new Address("3960 Sundown Lane, Austin, TX", 78130),
-            Arrays.asList("Sales")
-        ));
-
-        employeeCache.put(new EmployeeKey(6, 2), new Employee(
-            "Philip Horsley",
-            19800,
-            new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
-            Arrays.asList("Sales")
-        ));
-
-        employeeCache.put(new EmployeeKey(7, 2), new Employee(
-            "Brian Peters",
-            10600,
-            new Address("1407 Pearlman Avenue, Boston, MA", 12110),
-            Arrays.asList("Development", "QA")
-        ));
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
deleted file mode 100644
index b24f233..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Demonstrates the usage of portable objects with cache.
- */
-package org.apache.ignite.examples.portable.datagrid;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
deleted file mode 100644
index 4301027..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Contains portable classes and examples.
- */
-package org.apache.ignite.examples.portable;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
deleted file mode 100644
index 6ea1484..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortablePutGetExample;
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortableQueryExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- *
- */
-public class CacheClientPortableExampleTest extends GridAbstractExamplesTest {
-    /** {@inheritDoc} */
-    @Override protected String defaultConfig() {
-        return "examples/config/portable/example-ignite-portable.xml";
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortablePutGetExample() throws Exception {
-        CacheClientPortablePutGetExample.main(new String[] {});
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableQueryExample() throws Exception {
-        CacheClientPortableQueryExample.main(new String[] {});
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
deleted file mode 100644
index 2223aec..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.examples;
-
-import org.apache.ignite.examples.portable.computegrid.ComputeClientPortableTaskExecutionExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- *
- */
-public class ComputeClientPortableExampleTest extends GridAbstractExamplesTest {
-    /** {@inheritDoc} */
-    @Override protected String defaultConfig() {
-        return "examples/config/portable/example-ignite-portable.xml";
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableTaskExecutionExample() throws Exception {
-        ComputeClientPortableTaskExecutionExample.main(new String[] {});
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
index baa23fc..4669ae4 100644
--- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
+++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
@@ -20,12 +20,10 @@ package org.apache.ignite.testsuites;
 import junit.framework.TestSuite;
 import org.apache.ignite.examples.BasicExamplesMultiNodeSelfTest;
 import org.apache.ignite.examples.BasicExamplesSelfTest;
-import org.apache.ignite.examples.CacheClientPortableExampleTest;
 import org.apache.ignite.examples.CacheExamplesMultiNodeSelfTest;
 import org.apache.ignite.examples.CacheExamplesSelfTest;
 import org.apache.ignite.examples.CheckpointExamplesSelfTest;
 import org.apache.ignite.examples.ClusterGroupExampleSelfTest;
-import org.apache.ignite.examples.ComputeClientPortableExampleTest;
 import org.apache.ignite.examples.ContinuationExamplesMultiNodeSelfTest;
 import org.apache.ignite.examples.ContinuationExamplesSelfTest;
 import org.apache.ignite.examples.ContinuousMapperExamplesMultiNodeSelfTest;
@@ -95,10 +93,6 @@ public class IgniteExamplesSelfTestSuite extends TestSuite {
         suite.addTest(new TestSuite(MonteCarloExamplesMultiNodeSelfTest.class));
         suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
 
-        // Portable.
-        suite.addTest(new TestSuite(CacheClientPortableExampleTest.class));
-        suite.addTest(new TestSuite(ComputeClientPortableExampleTest.class));
-
         return suite;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 2f0dde7..9162afe 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -34,13 +34,6 @@
     <version>1.4.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
-    <repositories>
-        <repository>
-            <id>ignite-portables-test-repo</id>
-            <url>file://${basedir}/src/test/portables/repo</url>
-        </repository>
-    </repositories>
-
     <properties>
         <ignite.update.notifier.product>apache-ignite</ignite.update.notifier.product>
     </properties>
@@ -176,20 +169,6 @@
             <version>2.4</version>
             <scope>test</scope>
         </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite.portable</groupId>
-            <artifactId>test1</artifactId>
-            <version>1.1</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite.portable</groupId>
-            <artifactId>test2</artifactId>
-            <version>1.1</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 62fd020..0afccd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -459,13 +459,6 @@ public interface Ignite extends AutoCloseable {
     public <T extends IgnitePlugin> T plugin(String name) throws PluginNotFoundException;
 
     /**
-     * Gets an instance of {@link IgnitePortables} interface.
-     *
-     * @return Instance of {@link IgnitePortables} interface.
-     */
-    public IgnitePortables portables();
-
-    /**
      * Closes {@code this} instance of grid. This method is identical to calling
      * {@link G#stop(String, boolean) G.stop(gridName, true)}.
      * <p>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index e0f9f55..5558a26 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -18,12 +18,9 @@
 package org.apache.ignite;
 
 import java.io.Serializable;
-import java.sql.Timestamp;
 import java.util.Collection;
-import java.util.Date;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 import javax.cache.Cache;
@@ -55,7 +52,6 @@ import org.apache.ignite.lang.IgniteAsyncSupported;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
 import org.apache.ignite.mxbean.CacheMetricsMXBean;
 import org.jetbrains.annotations.Nullable;
 
@@ -132,44 +128,6 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
     public IgniteCache<K, V> withNoRetries();
 
     /**
-     * Returns cache that will operate with portable objects.
-     * <p>
-     * Cache returned by this method will not be forced to deserialize portable objects,
-     * so keys and values will be returned from cache API methods without changes. Therefore,
-     * signature of the cache can contain only following types:
-     * <ul>
-     *     <li><code>org.apache.ignite.portable.PortableObject</code> for portable classes</li>
-     *     <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
-     *     <li>Arrays of primitives (byte[], int[], ...)</li>
-     *     <li>{@link String} and array of {@link String}s</li>
-     *     <li>{@link UUID} and array of {@link UUID}s</li>
-     *     <li>{@link Date} and array of {@link Date}s</li>
-     *     <li>{@link Timestamp} and array of {@link Timestamp}s</li>
-     *     <li>Enums and array of enums</li>
-     *     <li>
-     *         Maps, collections and array of objects (but objects inside
-     *         them will still be converted if they are portable)
-     *     </li>
-     * </ul>
-     * <p>
-     * For example, if you use {@link Integer} as a key and {@code Value} class as a value
-     * (which will be stored in portable format), you should acquire following projection
-     * to avoid deserialization:
-     * <pre>
-     * IgniteCache<Integer, PortableObject> prj = cache.withKeepPortable();
-     *
-     * // Value is not deserialized and returned in portable format.
-     * PortableObject po = prj.get(1);
-     * </pre>
-     * <p>
-     * Note that this method makes sense only if cache is working in portable mode ({@link PortableMarshaller} is used).
-     * If not, this method is no-op and will return current cache.
-     *
-     * @return New cache instance for portable objects.
-     */
-    public <K1, V1> IgniteCache<K1, V1> withKeepPortable();
-
-    /**
      * Executes {@link #localLoadCache(IgniteBiPredicate, Object...)} on all cache nodes.
      *
      * @param p Optional predicate (may be {@code null}). If provided, will be used to
@@ -661,4 +619,4 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
      * @return MxBean.
      */
     public CacheMetricsMXBean mxBean();
-}
\ No newline at end of file
+}


[39/41] ignite git commit: IGNITE-1090 - Fixed backup check for one-phase commit transaction.

Posted by ag...@apache.org.
IGNITE-1090 - Fixed backup check for one-phase commit transaction.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/06fdd7d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/06fdd7d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/06fdd7d4

Branch: refs/heads/ignite-1400
Commit: 06fdd7d44dda36900b4c7a76dec2a7848ca9e8fb
Parents: e5f1681
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 13:35:41 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 13:35:41 2015 -0700

----------------------------------------------------------------------
 .../near/GridNearTxFinishFuture.java            | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/06fdd7d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index ddc8be5..21aaef2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -396,20 +396,24 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
 
                 ClusterNode backup = cctx.discovery().node(backupId);
 
-                // Nothing to do if backup has left the grid.
-                if (backup == null)
-                    return;
-
                 MiniFuture mini = new MiniFuture(backup, mapping);
 
                 add(mini);
 
-                if (backup.isLocal()) {
-                    if (cctx.tm().txHandler().checkDhtRemoteTxCommitted(tx.xidVersion())) {
-                        readyNearMappingFromBackup(mapping);
+                // Nothing to do if backup has left the grid.
+                if (backup == null) {
+                    readyNearMappingFromBackup(mapping);
 
+                    mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
+                        "(backup has left grid): " + tx.xidVersion()));
+                }
+                else if (backup.isLocal()) {
+                    boolean committed = cctx.tm().txHandler().checkDhtRemoteTxCommitted(tx.xidVersion());
+
+                    readyNearMappingFromBackup(mapping);
+
+                    if (committed)
                         mini.onDone(tx);
-                    }
                     else
                         mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
                             "(transaction has been rolled back on backup node): " + tx.xidVersion()));


[19/41] ignite git commit: ignite-257: muted back unmuted tests

Posted by ag...@apache.org.
ignite-257: muted back unmuted tests


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/de632ace
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/de632ace
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/de632ace

Branch: refs/heads/ignite-1400
Commit: de632ace6d0495ed5298644191960f383db57a72
Parents: ebb9e2e
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Sep 14 09:29:54 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Sep 14 09:29:54 2015 +0300

----------------------------------------------------------------------
 .../replicated/GridCacheReplicatedTxExceptionSelfTest.java      | 5 +++++
 .../cache/local/GridCacheLocalTxExceptionSelfTest.java          | 5 +++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/de632ace/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
index 1c96a4d..c2799db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
@@ -28,6 +28,11 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
  */
 public class GridCacheReplicatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    }
+
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/de632ace/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
index 63a900d..2fae99b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
@@ -27,6 +27,11 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    }
+
+    /** {@inheritDoc} */
     @Override protected int gridCount() {
         return 1;
     }


[05/41] ignite git commit: ignite-613: test is reworked. However, the replicated iterator is broken. This functionality must be fixed before unmuting the test.

Posted by ag...@apache.org.
ignite-613: test is reworked. However, the replicated iterator is broken. This functionality must be fixed before unmuting the test.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b8be85d5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b8be85d5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b8be85d5

Branch: refs/heads/ignite-1400
Commit: b8be85d5dcacfef1e1f04d9f132f8012239825ce
Parents: b5d8545
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Sep 11 10:39:38 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Sep 11 10:39:38 2015 +0300

----------------------------------------------------------------------
 .../IgniteCacheReplicatedQuerySelfTest.java     | 49 +++++++-------------
 1 file changed, 16 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b8be85d5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
index d0cce4a..9c52f92 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java
@@ -46,6 +46,7 @@ import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.IgniteCacheAbstractQuerySelfTest;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.typedef.F;
@@ -355,52 +356,36 @@ public class IgniteCacheReplicatedQuerySelfTest extends IgniteCacheAbstractQuery
     }
 
     /**
-     * TODO: IGNITE-613.
-     *
      * @throws Exception If failed.
      */
     public void testNodeLeft() throws Exception {
-        // Test works long and fails after. Should be enabled after fix.
         fail("https://issues.apache.org/jira/browse/IGNITE-613");
-        
+
+        Ignite g = startGrid("client");
+
         try {
-            Ignite g = startGrid();
+            assertTrue(g.configuration().isClientMode());
 
             IgniteCache<Integer, Integer> cache = g.cache(null);
 
             for (int i = 0; i < 1000; i++)
                 cache.put(i, i);
 
-            QueryCursor<Cache.Entry<Integer, Integer>> q =
-                cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >= 0 order by _key"));
-
-            assertEquals(0, (int) q.iterator().next().getKey());
-
-            final ConcurrentMap<UUID, Map<Long, GridFutureAdapter<GridCloseableIterator<
-                IgniteBiTuple<Integer, Integer>>>>> map =
-                U.field(((IgniteKernal)grid(0)).internalCache().context().queries(), "qryIters");
-
-            // fut.nextX() does not guarantee the request has completed on remote node
-            // (we could receive page from local one), so we need to wait.
-            assertTrue(GridTestUtils.waitForCondition(new PA() {
-                @Override public boolean apply() {
-                    return map.size() == 1;
-                }
-            }, getTestTimeout()));
-
-            Map<Long, GridFutureAdapter<GridCloseableIterator<IgniteBiTuple<Integer, Integer>>>> futs =
-                map.get(g.cluster().localNode().id());
+            // Client cache should be empty.
+            assertEquals(0, cache.localSize());
 
-            assertEquals(1, futs.size());
+            QueryCursor<Cache.Entry<Integer, Integer>> q =
+                cache.query(new SqlQuery<Integer, Integer>(Integer.class, "_key >= 0 order by _key").setPageSize(10));
 
-            GridCloseableIterator<IgniteBiTuple<Integer, Integer>> iter =
-                (GridCloseableIterator<IgniteBiTuple<Integer, Integer>>)((IgniteInternalFuture)F.first(futs.values()).get()).get();
+            assertEquals(0, (int)q.iterator().next().getKey());
 
-            ResultSet rs = U.field(iter, "data");
+            ConcurrentMap<UUID, ConcurrentMap<Long, ?>> map = U.field(((IgniteH2Indexing)U.field(U.field(
+                grid(0).context(), "qryProc"), "idx")).mapQueryExecutor(), "qryRess");
 
-            assertFalse(rs.isClosed());
+            assertEquals(1, map.size());
 
             final UUID nodeId = g.cluster().localNode().id();
+
             final CountDownLatch latch = new CountDownLatch(1);
 
             grid(0).events().localListen(new IgnitePredicate<Event>() {
@@ -412,16 +397,14 @@ public class IgniteCacheReplicatedQuerySelfTest extends IgniteCacheAbstractQuery
                 }
             }, EVT_NODE_LEFT);
 
-            stopGrid();
+            stopGrid("client");
 
             latch.await();
 
             assertEquals(0, map.size());
-            assertTrue(rs.isClosed());
         }
         finally {
-            // Ensure that additional node is stopped.
-            stopGrid();
+            stopGrid("client");
         }
     }
 


[15/41] ignite git commit: ignite-1250 JDBC driver: migration to embedded Ignite client node

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
new file mode 100644
index 0000000..5092b42
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSet.java
@@ -0,0 +1,1520 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * JDBC result set implementation.
+ */
+public class JdbcResultSet implements ResultSet {
+    /** Uuid. */
+    private final UUID uuid;
+
+    /** Statement. */
+    private final JdbcStatement stmt;
+
+    /** Table names. */
+    private final List<String> tbls;
+
+    /** Column names. */
+    private final List<String> cols;
+
+    /** Class names. */
+    private final List<String> types;
+
+    /** Rows cursor iterator. */
+    private Iterator<List<?>> it;
+
+    /** Finished flag. */
+    private boolean finished;
+
+    /** Current position. */
+    private int pos;
+
+    /** Current. */
+    private List<Object> curr;
+
+    /** Closed flag. */
+    private boolean closed;
+
+    /** Was {@code NULL} flag. */
+    private boolean wasNull;
+
+    /** Fetch size. */
+    private int fetchSize;
+
+    /**
+     * Creates new result set with predefined fields.
+     * Result set created with this constructor will
+     * never execute remote tasks.
+     *
+     * @param uuid Query UUID.
+     * @param stmt Statement.
+     * @param tbls Table names.
+     * @param cols Column names.
+     * @param types Types.
+     * @param fields Fields.
+     */
+    JdbcResultSet(@Nullable UUID uuid, JdbcStatement stmt, List<String> tbls, List<String> cols,
+        List<String> types, Collection<List<?>> fields, boolean finished) {
+        assert stmt != null;
+        assert tbls != null;
+        assert cols != null;
+        assert types != null;
+        assert fields != null;
+
+        this.uuid = uuid;
+        this.stmt = stmt;
+        this.tbls = tbls;
+        this.cols = cols;
+        this.types = types;
+        this.finished = finished;
+
+        this.it = fields.iterator();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public boolean next() throws SQLException {
+        ensureNotClosed();
+
+        if (it == null || (stmt.getMaxRows() > 0 && pos >= stmt.getMaxRows())) {
+            curr = null;
+
+            return false;
+        }
+        else if (it.hasNext()) {
+            curr = new ArrayList<>(it.next());
+
+            pos++;
+
+            if (finished && !it.hasNext())
+                it = null;
+
+            return true;
+        }
+        else if (!finished) {
+            JdbcConnection conn = (JdbcConnection)stmt.getConnection();
+
+            Ignite ignite = conn.ignite();
+
+            UUID nodeId = conn.nodeId();
+
+            boolean loc = nodeId == null;
+
+            JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(),
+                null, loc, null, fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery());
+
+            try {
+                JdbcQueryTask.QueryResult res =
+                    loc ? qryTask.call() : ignite.compute(ignite.cluster().forNodeId(nodeId)).call(qryTask);
+
+                finished = res.isFinished();
+
+                it = res.getRows().iterator();
+
+                return next();
+            }
+            catch (Exception e) {
+                throw new SQLException("Failed to query Ignite.", e);
+            }
+        }
+
+        it = null;
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws SQLException {
+        if (uuid != null)
+            stmt.resSets.remove(this);
+
+        closeInternal();
+    }
+
+    /**
+     * Marks result set as closed.
+     * If this result set is associated with locally executed query then query cursor will also closed.
+     */
+    void closeInternal() throws SQLException  {
+        if (((JdbcConnection)stmt.getConnection()).nodeId() == null)
+            JdbcQueryTask.remove(uuid);
+
+        closed = true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean wasNull() throws SQLException {
+        return wasNull;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getString(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, String.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getBoolean(int colIdx) throws SQLException {
+        Boolean val = getTypedValue(colIdx, Boolean.class);
+
+        return val != null ? val : false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte getByte(int colIdx) throws SQLException {
+        Byte val = getTypedValue(colIdx, Byte.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short getShort(int colIdx) throws SQLException {
+        Short val = getTypedValue(colIdx, Short.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getInt(int colIdx) throws SQLException {
+        Integer val = getTypedValue(colIdx, Integer.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getLong(int colIdx) throws SQLException {
+        Long val = getTypedValue(colIdx, Long.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getFloat(int colIdx) throws SQLException {
+        Float val = getTypedValue(colIdx, Float.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getDouble(int colIdx) throws SQLException {
+        Double val = getTypedValue(colIdx, Double.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(int colIdx, int scale) throws SQLException {
+        return getTypedValue(colIdx, BigDecimal.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] getBytes(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, byte[].class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, Date.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, Time.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, Timestamp.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getAsciiStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getUnicodeStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getBinaryStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Stream are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getString(String colLb) throws SQLException {
+        return getTypedValue(colLb, String.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getBoolean(String colLb) throws SQLException {
+        Boolean val = getTypedValue(colLb, Boolean.class);
+
+        return val != null ? val : false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte getByte(String colLb) throws SQLException {
+        Byte val = getTypedValue(colLb, Byte.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short getShort(String colLb) throws SQLException {
+        Short val = getTypedValue(colLb, Short.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getInt(String colLb) throws SQLException {
+        Integer val = getTypedValue(colLb, Integer.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getLong(String colLb) throws SQLException {
+        Long val = getTypedValue(colLb, Long.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getFloat(String colLb) throws SQLException {
+        Float val = getTypedValue(colLb, Float.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getDouble(String colLb) throws SQLException {
+        Double val = getTypedValue(colLb, Double.class);
+
+        return val != null ? val : 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(String colLb, int scale) throws SQLException {
+        return getTypedValue(colLb, BigDecimal.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] getBytes(String colLb) throws SQLException {
+        return getTypedValue(colLb, byte[].class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(String colLb) throws SQLException {
+        return getTypedValue(colLb, Date.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(String colLb) throws SQLException {
+        return getTypedValue(colLb, Time.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(String colLb) throws SQLException {
+        return getTypedValue(colLb, Timestamp.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getAsciiStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getUnicodeStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public InputStream getBinaryStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLWarning getWarnings() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearWarnings() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCursorName() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSetMetaData getMetaData() throws SQLException {
+        ensureNotClosed();
+
+        return new JdbcResultSetMetadata(tbls, cols, types);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, Object.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(String colLb) throws SQLException {
+        return getTypedValue(colLb, Object.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int findColumn(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        int idx = cols.indexOf(colLb.toUpperCase());
+
+        if (idx == -1)
+            throw new SQLException("Column not found: " + colLb);
+
+        return idx + 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getCharacterStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getCharacterStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, BigDecimal.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BigDecimal getBigDecimal(String colLb) throws SQLException {
+        return getTypedValue(colLb, BigDecimal.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isBeforeFirst() throws SQLException {
+        ensureNotClosed();
+
+        return pos < 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isAfterLast() throws SQLException {
+        ensureNotClosed();
+
+        return finished && it == null && curr == null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isFirst() throws SQLException {
+        ensureNotClosed();
+
+        return pos == 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isLast() throws SQLException {
+        ensureNotClosed();
+
+        return finished && it == null && curr != null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void beforeFirst() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void afterLast() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean first() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean last() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getRow() throws SQLException {
+        ensureNotClosed();
+
+        return isAfterLast() ? 0 : pos;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean absolute(int row) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean relative(int rows) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean previous() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLException("Result set is forward-only.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchDirection(int direction) throws SQLException {
+        ensureNotClosed();
+
+        if (direction != FETCH_FORWARD)
+            throw new SQLFeatureNotSupportedException("Only forward direction is supported");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchDirection() throws SQLException {
+        ensureNotClosed();
+
+        return FETCH_FORWARD;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchSize(int fetchSize) throws SQLException {
+        ensureNotClosed();
+
+        if (fetchSize <= 0)
+            throw new SQLException("Fetch size must be greater than zero.");
+
+        this.fetchSize = fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchSize() throws SQLException {
+        ensureNotClosed();
+
+        return fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getType() throws SQLException {
+        ensureNotClosed();
+
+        return stmt.getResultSetType();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getConcurrency() throws SQLException {
+        ensureNotClosed();
+
+        return CONCUR_READ_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean rowUpdated() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean rowInserted() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean rowDeleted() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNull(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBoolean(int colIdx, boolean x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateByte(int colIdx, byte x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateShort(int colIdx, short x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateInt(int colIdx, int x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateLong(int colIdx, long x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateFloat(int colIdx, float x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDouble(int colIdx, double x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBigDecimal(int colIdx, BigDecimal x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateString(int colIdx, String x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBytes(int colIdx, byte[] x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDate(int colIdx, Date x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTime(int colIdx, Time x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTimestamp(int colIdx, Timestamp x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(int colIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(int colIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(int colIdx, Reader x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(int colIdx, Object x, int scaleOrLen) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(int colIdx, Object x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNull(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBoolean(String colLb, boolean x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateByte(String colLb, byte x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateShort(String colLb, short x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateInt(String colLb, int x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateLong(String colLb, long x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateFloat(String colLb, float x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDouble(String colLb, double x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBigDecimal(String colLb, BigDecimal x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateString(String colLb, String x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBytes(String colLb, byte[] x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateDate(String colLb, Date x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTime(String colLb, Time x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateTimestamp(String colLb, Timestamp x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(String colLb, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(String colLb, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(String colLb, Reader reader, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(String colLb, Object x, int scaleOrLen) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateObject(String colLb, Object x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void insertRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void deleteRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void refreshRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Row refreshing is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelRowUpdates() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void moveToInsertRow() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void moveToCurrentRow() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement getStatement() throws SQLException {
+        ensureNotClosed();
+
+        return stmt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(int colIdx, Map<String, Class<?>> map) throws SQLException {
+        return getTypedValue(colIdx, Object.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Ref getRef(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Blob getBlob(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Clob getClob(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Array getArray(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getObject(String colLb, Map<String, Class<?>> map) throws SQLException {
+        return getTypedValue(colLb, Object.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Ref getRef(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Blob getBlob(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Clob getClob(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Array getArray(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(int colIdx, Calendar cal) throws SQLException {
+        return getTypedValue(colIdx, Date.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Date getDate(String colLb, Calendar cal) throws SQLException {
+        return getTypedValue(colLb, Date.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(int colIdx, Calendar cal) throws SQLException {
+        return getTypedValue(colIdx, Time.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Time getTime(String colLb, Calendar cal) throws SQLException {
+        return getTypedValue(colLb, Time.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(int colIdx, Calendar cal) throws SQLException {
+        return getTypedValue(colIdx, Timestamp.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Timestamp getTimestamp(String colLb, Calendar cal) throws SQLException {
+        return getTypedValue(colLb, Timestamp.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public URL getURL(int colIdx) throws SQLException {
+        return getTypedValue(colIdx, URL.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public URL getURL(String colLb) throws SQLException {
+        return getTypedValue(colLb, URL.class);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRef(int colIdx, Ref x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRef(String colLb, Ref x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(int colIdx, Blob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(String colLb, Blob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(int colIdx, Clob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(String colLb, Clob x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateArray(int colIdx, Array x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateArray(String colLb, Array x) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public RowId getRowId(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public RowId getRowId(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRowId(int colIdx, RowId x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateRowId(String colLb, RowId x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getHoldability() throws SQLException {
+        ensureNotClosed();
+
+        return HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isClosed() throws SQLException {
+        return closed;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNString(int colIdx, String nStr) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNString(String colLb, String nStr) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(int colIdx, NClob nClob) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(String colLb, NClob nClob) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public NClob getNClob(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public NClob getNClob(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLXML getSQLXML(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLXML getSQLXML(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateSQLXML(int colIdx, SQLXML xmlObj) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateSQLXML(String colLb, SQLXML xmlObj) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getNString(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getNString(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getNCharacterStream(int colIdx) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Reader getNCharacterStream(String colLb) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(int colIdx, Reader x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(int colIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(int colIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(int colIdx, Reader x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(String colLb, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(String colLb, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(int colIdx, InputStream inputStream, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(String colLb, InputStream inputStream, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(int colIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(int colIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(String colLb, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(int colIdx, Reader x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNCharacterStream(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(int colIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(int colIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(int colIdx, Reader x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateAsciiStream(String colLb, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBinaryStream(String colLb, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateCharacterStream(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(int colIdx, InputStream inputStream) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateBlob(String colLb, InputStream inputStream) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(int colIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateClob(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(int colIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void updateNClob(String colLb, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Result set is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface == ResultSet.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T getObject(int colIdx, Class<T> type) throws SQLException {
+        return getTypedValue(colIdx, type);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T getObject(String colLb, Class<T> type) throws SQLException {
+        return getTypedValue(colLb, type);
+    }
+
+    /**
+     * Gets casted field value by label.
+     *
+     * @param colLb Column label.
+     * @param cls Value class.
+     * @return Casted field value.
+     * @throws SQLException In case of error.
+     */
+    private <T> T getTypedValue(String colLb, Class<T> cls) throws SQLException {
+        ensureNotClosed();
+        ensureHasCurrentRow();
+
+        String name = colLb.toUpperCase();
+
+        Integer idx = stmt.fieldsIdxs.get(name);
+
+        int colIdx;
+
+        if (idx != null)
+            colIdx = idx;
+        else {
+            colIdx = cols.indexOf(name) + 1;
+
+            if (colIdx <= 0)
+                throw new SQLException("Invalid column label: " + colLb);
+
+            stmt.fieldsIdxs.put(name, colIdx);
+        }
+
+        return getTypedValue(colIdx, cls);
+    }
+
+    /**
+     * Gets casted field value by index.
+     *
+     * @param colIdx Column index.
+     * @param cls Value class.
+     * @return Casted field value.
+     * @throws SQLException In case of error.
+     */
+    @SuppressWarnings("unchecked")
+    private <T> T getTypedValue(int colIdx, Class<T> cls) throws SQLException {
+        ensureNotClosed();
+        ensureHasCurrentRow();
+
+        try {
+            T val = cls == String.class ? (T)String.valueOf(curr.get(colIdx - 1)) : (T)curr.get(colIdx - 1);
+
+            wasNull = val == null;
+
+            return val;
+        }
+        catch (IndexOutOfBoundsException ignored) {
+            throw new SQLException("Invalid column index: " + colIdx);
+        }
+        catch (ClassCastException ignored) {
+            throw new SQLException("Value is an not instance of " + cls.getName());
+        }
+    }
+
+    /**
+     * Ensures that result set is not closed.
+     *
+     * @throws SQLException If result set is closed.
+     */
+    private void ensureNotClosed() throws SQLException {
+        if (closed)
+            throw new SQLException("Result set is closed.");
+    }
+
+    /**
+     * Ensures that result set is positioned on a row.
+     *
+     * @throws SQLException If result set is not positioned on a row.
+     */
+    private void ensureHasCurrentRow() throws SQLException {
+        if (curr == null)
+            throw new SQLException("Result set is not positioned on a row.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSetMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSetMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSetMetadata.java
new file mode 100644
index 0000000..ce8c269
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSetMetadata.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.sql.*;
+import java.util.*;
+
+/**
+ * JDBC result set metadata implementation.
+ */
+public class JdbcResultSetMetadata implements ResultSetMetaData {
+    /** Column width. */
+    private static final int COL_WIDTH = 30;
+
+    /** Table names. */
+    private final List<String> tbls;
+
+    /** Column names. */
+    private final List<String> cols;
+
+    /** Class names. */
+    private final List<String> types;
+
+    /**
+     * @param tbls Table names.
+     * @param cols Column names.
+     * @param types Types.
+     */
+    JdbcResultSetMetadata(List<String> tbls, List<String> cols, List<String> types) {
+        assert cols != null;
+        assert types != null;
+
+        this.tbls = tbls;
+        this.cols = cols;
+        this.types = types;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getColumnCount() throws SQLException {
+        return cols.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isAutoIncrement(int col) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isCaseSensitive(int col) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSearchable(int col) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isCurrency(int col) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int isNullable(int col) throws SQLException {
+        return columnNullable;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isSigned(int col) throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getColumnDisplaySize(int col) throws SQLException {
+        return COL_WIDTH;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getColumnLabel(int col) throws SQLException {
+        return cols.get(col - 1);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getColumnName(int col) throws SQLException {
+        return cols.get(col - 1);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSchemaName(int col) throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getPrecision(int col) throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getScale(int col) throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getTableName(int col) throws SQLException {
+        return tbls != null ? tbls.get(col - 1) : "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCatalogName(int col) throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getColumnType(int col) throws SQLException {
+        return JdbcUtils.type(types.get(col - 1));
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getColumnTypeName(int col) throws SQLException {
+        return JdbcUtils.typeName(types.get(col - 1));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadOnly(int col) throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWritable(int col) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isDefinitelyWritable(int col) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getColumnClassName(int col) throws SQLException {
+        return types.get(col - 1);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Result set meta data is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface == ResultSetMetaData.class;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
new file mode 100644
index 0000000..f4a3e1d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcStatement.java
@@ -0,0 +1,456 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+
+import static java.sql.ResultSet.CONCUR_READ_ONLY;
+import static java.sql.ResultSet.FETCH_FORWARD;
+import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
+import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+
+/**
+ * JDBC statement implementation.
+ */
+public class JdbcStatement implements Statement {
+    /** Default fetch size. */
+    private static final int DFLT_FETCH_SIZE = 1024;
+
+    /** Connection. */
+    private final JdbcConnection conn;
+
+    /** Closed flag. */
+    private boolean closed;
+
+    /** Rows limit. */
+    private int maxRows;
+
+    /** Current result set. */
+    private ResultSet rs;
+
+    /** Query arguments. */
+    protected Object[] args;
+
+    /** Fetch size. */
+    private int fetchSize = DFLT_FETCH_SIZE;
+
+    /** Result sets. */
+    final Set<JdbcResultSet> resSets = new HashSet<>();
+
+    /** Fields indexes. */
+    Map<String, Integer> fieldsIdxs = new HashMap<>();
+
+    /**
+     * Creates new statement.
+     *
+     * @param conn Connection.
+     */
+    JdbcStatement(JdbcConnection conn) {
+        assert conn != null;
+
+        this.conn = conn;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet executeQuery(String sql) throws SQLException {
+        ensureNotClosed();
+
+        rs = null;
+
+        if (sql == null || sql.isEmpty())
+            throw new SQLException("SQL query is empty");
+
+        Ignite ignite = conn.ignite();
+
+        UUID nodeId = conn.nodeId();
+
+        UUID uuid = UUID.randomUUID();
+
+        boolean loc = nodeId == null;
+
+        JdbcQueryTask qryTask = new JdbcQueryTask(loc ? ignite : null, conn.cacheName(),
+            sql, loc, args, fetchSize, uuid, conn.isLocalQuery(), conn.isCollocatedQuery());
+
+        try {
+            JdbcQueryTask.QueryResult res =
+                loc ? qryTask.call() : ignite.compute(ignite.cluster().forNodeId(nodeId)).call(qryTask);
+
+            JdbcResultSet rs = new JdbcResultSet(uuid, this, res.getTbls(), res.getCols(), res.getTypes(),
+                res.getRows(), res.isFinished());
+
+            rs.setFetchSize(fetchSize);
+
+            resSets.add(rs);
+
+            return rs;
+        }
+        catch (Exception e) {
+            throw new SQLException("Failed to query Ignite.", e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws SQLException {
+        conn.statements.remove(this);
+
+        closeInternal();
+    }
+
+    /**
+     * Marks statement as closed and closes all result sets.
+     */
+    void closeInternal() throws SQLException {
+        for (Iterator<JdbcResultSet> it = resSets.iterator(); it.hasNext(); ) {
+            JdbcResultSet rs = it.next();
+
+            rs.closeInternal();
+
+            it.remove();
+        }
+
+        closed = true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxFieldSize() throws SQLException {
+        ensureNotClosed();
+
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setMaxFieldSize(int max) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Field size limitation is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxRows() throws SQLException {
+        ensureNotClosed();
+
+        return maxRows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setMaxRows(int maxRows) throws SQLException {
+        ensureNotClosed();
+
+        this.maxRows = maxRows;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setEscapeProcessing(boolean enable) throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getQueryTimeout() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Query timeout is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setQueryTimeout(int timeout) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Query timeout is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancel() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Cancellation is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLWarning getWarnings() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearWarnings() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCursorName(String name) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql) throws SQLException {
+        ensureNotClosed();
+
+        rs = executeQuery(sql);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getResultSet() throws SQLException {
+        ensureNotClosed();
+
+        ResultSet rs0 = rs;
+
+        rs = null;
+
+        return rs0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getUpdateCount() throws SQLException {
+        ensureNotClosed();
+
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getMoreResults() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Multiple open results are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchDirection(int direction) throws SQLException {
+        ensureNotClosed();
+
+        if (direction != FETCH_FORWARD)
+            throw new SQLFeatureNotSupportedException("Only forward direction is supported");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchDirection() throws SQLException {
+        ensureNotClosed();
+
+        return FETCH_FORWARD;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFetchSize(int fetchSize) throws SQLException {
+        ensureNotClosed();
+
+        if (fetchSize < 0)
+            throw new SQLException("Fetch size must be greater or equal zero.");
+
+        this.fetchSize = fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getFetchSize() throws SQLException {
+        ensureNotClosed();
+
+        return fetchSize;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetConcurrency() throws SQLException {
+        ensureNotClosed();
+
+        return CONCUR_READ_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetType() throws SQLException {
+        ensureNotClosed();
+
+        return TYPE_FORWARD_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addBatch(String sql) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearBatch() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int[] executeBatch() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Connection getConnection() throws SQLException {
+        ensureNotClosed();
+
+        return conn;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getMoreResults(int curr) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Multiple open results are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getGeneratedKeys() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, int[] colIndexes) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate(String sql, String[] colNames) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
+        ensureNotClosed();
+
+        if (autoGeneratedKeys == RETURN_GENERATED_KEYS)
+            throw new SQLFeatureNotSupportedException("Updates are not supported.");
+
+        return execute(sql);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, int[] colIndexes) throws SQLException {
+        ensureNotClosed();
+
+        if (colIndexes != null && colIndexes.length > 0)
+            throw new SQLFeatureNotSupportedException("Updates are not supported.");
+
+        return execute(sql);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute(String sql, String[] colNames) throws SQLException {
+        ensureNotClosed();
+
+        if (colNames != null && colNames.length > 0)
+            throw new SQLFeatureNotSupportedException("Updates are not supported.");
+
+        return execute(sql);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetHoldability() throws SQLException {
+        ensureNotClosed();
+
+        return HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isClosed() throws SQLException {
+        return closed;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setPoolable(boolean poolable) throws SQLException {
+        ensureNotClosed();
+
+        if (poolable)
+            throw new SQLFeatureNotSupportedException("Pooling is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isPoolable() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Statement is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface == Statement.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void closeOnCompletion() throws SQLException {
+        throw new SQLFeatureNotSupportedException("closeOnCompletion is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isCloseOnCompletion() throws SQLException {
+        ensureNotClosed();
+
+        return false;
+    }
+
+    /**
+     * Ensures that statement is not closed.
+     *
+     * @throws SQLException If statement is closed.
+     */
+    protected void ensureNotClosed() throws SQLException {
+        if (closed)
+            throw new SQLException("Statement is closed.");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
new file mode 100644
index 0000000..b519340
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcUtils.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.Date;
+
+import static java.sql.Types.BIGINT;
+import static java.sql.Types.BINARY;
+import static java.sql.Types.BOOLEAN;
+import static java.sql.Types.DATE;
+import static java.sql.Types.DOUBLE;
+import static java.sql.Types.FLOAT;
+import static java.sql.Types.INTEGER;
+import static java.sql.Types.OTHER;
+import static java.sql.Types.SMALLINT;
+import static java.sql.Types.TIME;
+import static java.sql.Types.TIMESTAMP;
+import static java.sql.Types.TINYINT;
+import static java.sql.Types.VARCHAR;
+
+/**
+ * Utility methods for JDBC driver.
+ */
+public class JdbcUtils {
+    /**
+     * Converts Java class name to type from {@link Types}.
+     *
+     * @param cls Java class name.
+     * @return Type from {@link Types}.
+     */
+    public static int type(String cls) {
+        if (Boolean.class.getName().equals(cls) || boolean.class.getName().equals(cls))
+            return BOOLEAN;
+        else if (Byte.class.getName().equals(cls) || byte.class.getName().equals(cls))
+            return TINYINT;
+        else if (Short.class.getName().equals(cls) || short.class.getName().equals(cls))
+            return SMALLINT;
+        else if (Integer.class.getName().equals(cls) || int.class.getName().equals(cls))
+            return INTEGER;
+        else if (Long.class.getName().equals(cls) || long.class.getName().equals(cls))
+            return BIGINT;
+        else if (Float.class.getName().equals(cls) || float.class.getName().equals(cls))
+            return FLOAT;
+        else if (Double.class.getName().equals(cls) || double.class.getName().equals(cls))
+            return DOUBLE;
+        else if (String.class.getName().equals(cls))
+            return VARCHAR;
+        else if (byte[].class.getName().equals(cls))
+            return BINARY;
+        else if (Time.class.getName().equals(cls))
+            return TIME;
+        else if (Timestamp.class.getName().equals(cls))
+            return TIMESTAMP;
+        else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
+            return DATE;
+        else
+            return OTHER;
+    }
+
+    /**
+     * Converts Java class name to SQL type name.
+     *
+     * @param cls Java class name.
+     * @return SQL type name.
+     */
+    public static String typeName(String cls) {
+        if (Boolean.class.getName().equals(cls) || boolean.class.getName().equals(cls))
+            return "BOOLEAN";
+        else if (Byte.class.getName().equals(cls) || byte.class.getName().equals(cls))
+            return "TINYINT";
+        else if (Short.class.getName().equals(cls) || short.class.getName().equals(cls))
+            return "SMALLINT";
+        else if (Integer.class.getName().equals(cls) || int.class.getName().equals(cls))
+            return "INTEGER";
+        else if (Long.class.getName().equals(cls) || long.class.getName().equals(cls))
+            return "BIGINT";
+        else if (Float.class.getName().equals(cls) || float.class.getName().equals(cls))
+            return "FLOAT";
+        else if (Double.class.getName().equals(cls) || double.class.getName().equals(cls))
+            return "DOUBLE";
+        else if (String.class.getName().equals(cls))
+            return "VARCHAR";
+        else if (byte[].class.getName().equals(cls))
+            return "BINARY";
+        else if (Time.class.getName().equals(cls))
+            return "TIME";
+        else if (Timestamp.class.getName().equals(cls))
+            return "TIMESTAMP";
+        else if (Date.class.getName().equals(cls) || java.sql.Date.class.getName().equals(cls))
+            return "DATE";
+        else
+            return "OTHER";
+    }
+
+    /**
+     * Determines whether type is nullable.
+     *
+     * @param name Column name.
+     * @param cls Java class name.
+     * @return {@code True} if nullable.
+     */
+    public static boolean nullable(String name, String cls) {
+        return !"_KEY".equalsIgnoreCase(name) &&
+            !"_VAL".equalsIgnoreCase(name) &&
+            !(boolean.class.getName().equals(cls) ||
+            byte.class.getName().equals(cls) ||
+            short.class.getName().equals(cls) ||
+            int.class.getName().equals(cls) ||
+            long.class.getName().equals(cls) ||
+            float.class.getName().equals(cls) ||
+            double.class.getName().equals(cls));
+    }
+
+    /**
+     * Checks whether type of the object is SQL-complaint.
+     *
+     * @param obj Object.
+     * @return Whether type of the object is SQL-complaint.
+     */
+    public static boolean sqlType(Object obj) {
+        return obj == null ||
+            obj instanceof BigDecimal ||
+            obj instanceof Boolean ||
+            obj instanceof Byte ||
+            obj instanceof byte[] ||
+            obj instanceof java.util.Date ||
+            obj instanceof Double ||
+            obj instanceof Float ||
+            obj instanceof Integer ||
+            obj instanceof Long ||
+            obj instanceof Short ||
+            obj instanceof String ||
+            obj instanceof URL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index dd8c3f3..70c32e5 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -254,6 +254,15 @@ org.apache.ignite.internal.executor.GridExecutorService
 org.apache.ignite.internal.executor.GridExecutorService$1
 org.apache.ignite.internal.executor.GridExecutorService$TaskTerminateListener
 org.apache.ignite.internal.igfs.common.IgfsIpcCommand
+org.apache.ignite.internal.interop.InteropAwareEventFilter
+org.apache.ignite.internal.interop.InteropBootstrapFactory
+org.apache.ignite.internal.interop.InteropException
+org.apache.ignite.internal.interop.InteropNoCallbackException
+org.apache.ignite.internal.jdbc2.JdbcConnection$JdbcConnectionValidationTask
+org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask
+org.apache.ignite.internal.jdbc2.JdbcQueryTask
+org.apache.ignite.internal.jdbc2.JdbcQueryTask$1
+org.apache.ignite.internal.jdbc2.JdbcQueryTask$QueryResult
 org.apache.ignite.internal.managers.GridManagerAdapter$1$1
 org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet
 org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
@@ -426,7 +435,8 @@ org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$Ex
 org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$MessageHandler
 org.apache.ignite.internal.processors.cache.GridCacheProcessor$2
 org.apache.ignite.internal.processors.cache.GridCacheProcessor$3
-org.apache.ignite.internal.processors.cache.GridCacheProcessor$5
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$4
+org.apache.ignite.internal.processors.cache.GridCacheProcessor$6
 org.apache.ignite.internal.processors.cache.GridCacheProcessor$LocalAffinityFunction
 org.apache.ignite.internal.processors.cache.GridCacheProxyImpl
 org.apache.ignite.internal.processors.cache.GridCacheReturn

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/yardstick/config/benchmark-query.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-query.properties b/modules/yardstick/config/benchmark-query.properties
index 1a75926..486d00e 100644
--- a/modules/yardstick/config/benchmark-query.properties
+++ b/modules/yardstick/config/benchmark-query.properties
@@ -21,7 +21,7 @@
 # JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
 
 # Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
-JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" \
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false \
   -XX:+UseParNewGC \
   -XX:+UseConcMarkSweepGC \
   -XX:+UseTLAB \
@@ -64,5 +64,6 @@ CONFIGS="\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryJoinOffHeapBenchmark -sn IgniteNode -ds sql-query-join-offheap-1-backup,\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds sql-query-put-1-backup,\
 -cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC -dn IgniteSqlQueryPutOffHeapBenchmark -sn IgniteNode -ds sql-query-put-offheap-1-backup,\
--cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -jdbc jdbc:ignite://127.0.0.1/query -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcSqlQueryBenchmark -sn IgniteNode -ds sql-query-jdbc-1-backup\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -jdbc jdbc:ignite://127.0.0.1/query -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcSqlQueryBenchmark -sn IgniteNode -ds sql-query-jdbc-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300 -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t 64 -sm PRIMARY_SYNC -dn IgniteJdbcSqlQueryBenchmark -sn IgniteNode -ds sql-query-jdbc-1-backup\
 "

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/yardstick/config/ignite-base-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-base-config.xml b/modules/yardstick/config/ignite-base-config.xml
index c77cc9a..6e94b3c 100644
--- a/modules/yardstick/config/ignite-base-config.xml
+++ b/modules/yardstick/config/ignite-base-config.xml
@@ -25,7 +25,7 @@
        xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
     <bean id="base-ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true">
-        <property name="peerClassLoadingEnabled" value="false"/>
+        <property name="peerClassLoadingEnabled" value="true"/>
 
         <property name="metricsLogFrequency" value="5000"/>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/yardstick/config/ignite-jdbc-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-jdbc-config.xml b/modules/yardstick/config/ignite-jdbc-config.xml
new file mode 100644
index 0000000..9428858
--- /dev/null
+++ b/modules/yardstick/config/ignite-jdbc-config.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    Ignite Spring configuration file.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="clientMode" value="true"/>
+
+        <property name="peerClassLoadingEnabled" value="true"/>
+
+        <property name="localHost" value="127.0.0.1"/>
+
+        <property name="marshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
+                <property name="requireSerializable" value="false"/>
+            </bean>
+        </property>
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47549</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>


[07/41] ignite git commit: ignite-1399

Posted by ag...@apache.org.
ignite-1399


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/18752a6f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/18752a6f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/18752a6f

Branch: refs/heads/ignite-1400
Commit: 18752a6f86e55946dbd0a0b67992e08d85ef80ef
Parents: d26f746
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 11 12:25:45 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 11 12:25:45 2015 +0300

----------------------------------------------------------------------
 pom.xml | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/18752a6f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d026b30..fc609a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -301,6 +301,11 @@
 
                                         <chmod dir="${basedir}/target/release-package" perm="755" includes="**/*.sh" />
 
+                                        <!-- hotfix according to https://issues.apache.org/jira/browse/IGNITE-1399. Remove at 1.5 -->
+                                        <move todir="${basedir}/target/temp/release-package/libs/optional/ignite-platform">
+                                            <fileset dir="${basedir}/target/release-package/libs/optional/ignite-platform"/>
+                                        </move>
+
                                         <zip destfile="${basedir}/target/bin/${ignite.zip.pattern}.zip" encoding="UTF-8">
                                             <zipfileset dir="${basedir}/target/release-package" prefix="${ignite.zip.pattern}" filemode="755">
                                                 <include name="**/*.sh" />
@@ -317,6 +322,11 @@
                                                 <exclude name="**/missing" />
                                             </zipfileset>
                                         </zip>
+
+                                        <!-- hotfix according to https://issues.apache.org/jira/browse/IGNITE-1399. Remove at 1.5 -->
+                                        <move todir="${basedir}/target/release-package/libs/optional/ignite-platform">
+                                            <fileset dir="${basedir}/target/temp/release-package/libs/optional/ignite-platform"/>
+                                        </move>
                                     </target>
                                 </configuration>
                             </execution>


[13/41] ignite git commit: Removed several obsolete .Net tests.

Posted by ag...@apache.org.
Removed several obsolete .Net tests.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a66400aa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a66400aa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a66400aa

Branch: refs/heads/ignite-1400
Commit: a66400aa5adc48e465435ff77814789b9947c42e
Parents: 12b0f2b
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Sep 11 15:24:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Sep 11 15:24:27 2015 +0300

----------------------------------------------------------------------
 .../Cache/CacheAbstractTest.cs                  | 71 +-------------------
 1 file changed, 1 insertion(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a66400aa/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 24d2b73..6af877e 100644
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -2467,76 +2467,7 @@ namespace Apache.Ignite.Core.Tests.Cache
 
             Assert.IsNull(err);
         }
-
-        //// TODO [Test]
-        //public void TestCacheEntryGetSetRemove()
-        //{
-        //    TestCacheEntryGetSetRemove(false);
-        //}
-
-        //// TODO [Test]
-        //public void TestCacheEntryGetSetRemoveAsync()
-        //{
-        //    TestCacheEntryGetSetRemove(true);
-        //}
-
-        //private void TestCacheEntryGetSetRemove(bool async)
-        //{
-        //    IGridCache cache = Cache();
-
-        //    int key = PrimaryKeyForCache(cache);
-
-        //    IGridCacheEntry<int, int> e = cache.Entry(key);
-
-        //    Assert.IsNotNull(e);
-
-        //    if (async)
-        //    {
-        //        IGridFuture<int> fut = e.GetAsync();
-
-        //        Assert.IsNull(fut.Result);
-
-        //        Assert.IsTrue(fut.IsDone);
-
-        //        fut = e.SetAsync(10);
-
-        //        Assert.IsNull(fut.Result);
-
-        //        Assert.IsTrue(fut.IsDone);
-
-        //        fut = e.GetAsync();
-
-        //        Assert.AreEqual(10, fut.Result);
-
-        //        Assert.IsTrue(fut.IsDone);
-        //    }
-        //    else
-        //    {
-        //        Assert.IsNull(e.Get());
-
-        //        Assert.IsNull(e.Set(10));
-
-        //        Assert.AreEqual(10, e.Get());
-        //    }
-
-        //    Assert.AreEqual(10, cache.Get(key));
-
-        //    if (async)
-        //    {
-        //        IGridFuture<int> fut = e.RemoveAsync();
-
-        //        Assert.AreEqual(10, fut.Result);
-
-        //        Assert.IsTrue(fut.IsDone);
-        //    }
-        //    else
-        //        Assert.AreEqual(10, e.Remove());
-
-        //    Assert.IsNull(e.Get());
-
-        //    Assert.IsNull(cache.Get(key));
-        //}
-
+        
         /**
          * Test tries to provoke garbage collection for .Net future before it was completed to verify
          * futures pinning works.


[34/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
new file mode 100644
index 0000000..de0df8d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
@@ -0,0 +1,358 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.portable.GridPortableMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.marshaller.AbstractMarshaller;
+import org.apache.ignite.marshaller.MarshallerContext;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableProtocolVersion;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
+ * in the portable format.
+ * <p>
+ * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
+ * <p>
+ * <h1 class="header">Configuration</h1>
+ * <h2 class="header">Mandatory</h2>
+ * This marshaller has no mandatory configuration parameters.
+ * <h2 class="header">Java Example</h2>
+ * <pre name="code" class="java">
+ * PortableMarshaller marshaller = new PortableMarshaller();
+ *
+ * IgniteConfiguration cfg = new IgniteConfiguration();
+ *
+ * // Override marshaller.
+ * cfg.setMarshaller(marshaller);
+ *
+ * // Starts grid.
+ * G.start(cfg);
+ * </pre>
+ * <h2 class="header">Spring Example</h2>
+ * PortableMarshaller can be configured from Spring XML configuration file:
+ * <pre name="code" class="xml">
+ * &lt;bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"&gt;
+ *     ...
+ *     &lt;property name="marshaller"&gt;
+ *         &lt;bean class="org.apache.ignite.internal.portable.api.PortableMarshaller"&gt;
+ *            ...
+ *         &lt;/bean&gt;
+ *     &lt;/property&gt;
+ *     ...
+ * &lt;/bean&gt;
+ * </pre>
+ * <p>
+ * <img src="http://ignite.apache.org/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ */
+public class PortableMarshaller extends AbstractMarshaller {
+    /** Default portable protocol version. */
+    public static final PortableProtocolVersion DFLT_PORTABLE_PROTO_VER = PortableProtocolVersion.VER_1_4_0;
+
+    /** Class names. */
+    private Collection<String> clsNames;
+
+    /** ID mapper. */
+    private PortableIdMapper idMapper;
+
+    /** Serializer. */
+    private PortableSerializer serializer;
+
+    /** Types. */
+    private Collection<PortableTypeConfiguration> typeCfgs;
+
+    /** Use timestamp flag. */
+    private boolean useTs = true;
+
+    /** Whether to convert string to bytes using UTF-8 encoding. */
+    private boolean convertString = true;
+
+    /** Meta data enabled flag. */
+    private boolean metaDataEnabled = true;
+
+    /** Keep deserialized flag. */
+    private boolean keepDeserialized = true;
+
+    /** Protocol version. */
+    private PortableProtocolVersion protoVer = DFLT_PORTABLE_PROTO_VER;
+
+    /** */
+    private GridPortableMarshaller impl;
+
+    /**
+     * Gets class names.
+     *
+     * @return Class names.
+     */
+    public Collection<String> getClassNames() {
+        return clsNames;
+    }
+
+    /**
+     * Sets class names of portable objects explicitly.
+     *
+     * @param clsNames Class names.
+     */
+    public void setClassNames(Collection<String> clsNames) {
+        this.clsNames = new ArrayList<>(clsNames.size());
+
+        for (String clsName : clsNames)
+            this.clsNames.add(clsName.trim());
+    }
+
+    /**
+     * Gets ID mapper.
+     *
+     * @return ID mapper.
+     */
+    public PortableIdMapper getIdMapper() {
+        return idMapper;
+    }
+
+    /**
+     * Sets ID mapper.
+     *
+     * @param idMapper ID mapper.
+     */
+    public void setIdMapper(PortableIdMapper idMapper) {
+        this.idMapper = idMapper;
+    }
+
+    /**
+     * Gets serializer.
+     *
+     * @return Serializer.
+     */
+    public PortableSerializer getSerializer() {
+        return serializer;
+    }
+
+    /**
+     * Sets serializer.
+     *
+     * @param serializer Serializer.
+     */
+    public void setSerializer(PortableSerializer serializer) {
+        this.serializer = serializer;
+    }
+
+    /**
+     * Gets types configuration.
+     *
+     * @return Types configuration.
+     */
+    public Collection<PortableTypeConfiguration> getTypeConfigurations() {
+        return typeCfgs;
+    }
+
+    /**
+     * Sets type configurations.
+     *
+     * @param typeCfgs Type configurations.
+     */
+    public void setTypeConfigurations(Collection<PortableTypeConfiguration> typeCfgs) {
+        this.typeCfgs = typeCfgs;
+    }
+
+    /**
+     * If {@code true} then date values converted to {@link Timestamp} on deserialization.
+     * <p>
+     * Default value is {@code true}.
+     *
+     * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+     */
+    public boolean isUseTimestamp() {
+        return useTs;
+    }
+
+    /**
+     * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+     */
+    public void setUseTimestamp(boolean useTs) {
+        this.useTs = useTs;
+    }
+
+    /**
+     * Gets strings must be converted to or from bytes using UTF-8 encoding.
+     * <p>
+     * Default value is {@code true}.
+     *
+     * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
+     */
+    public boolean isConvertStringToBytes() {
+        return convertString;
+    }
+
+    /**
+     * Sets strings must be converted to or from bytes using UTF-8 encoding.
+     * <p>
+     * Default value is {@code true}.
+     *
+     * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
+     */
+    public void setConvertStringToBytes(boolean convertString) {
+        this.convertString = convertString;
+    }
+
+    /**
+     * If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
+     * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
+     * <p>
+     * Default value if {@code true}.
+     *
+     * @return Whether meta data is collected.
+     */
+    public boolean isMetaDataEnabled() {
+        return metaDataEnabled;
+    }
+
+    /**
+     * @param metaDataEnabled Whether meta data is collected.
+     */
+    public void setMetaDataEnabled(boolean metaDataEnabled) {
+        this.metaDataEnabled = metaDataEnabled;
+    }
+
+    /**
+     * If {@code true}, {@link PortableObject} will cache deserialized instance after
+     * {@link PortableObject#deserialize()} is called. All consequent calls of this
+     * method on the same instance of {@link PortableObject} will return that cached
+     * value without actually deserializing portable object. If you need to override this
+     * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
+     * method.
+     * <p>
+     * Default value if {@code true}.
+     *
+     * @return Whether deserialized value is kept.
+     */
+    public boolean isKeepDeserialized() {
+        return keepDeserialized;
+    }
+
+    /**
+     * @param keepDeserialized Whether deserialized value is kept.
+     */
+    public void setKeepDeserialized(boolean keepDeserialized) {
+        this.keepDeserialized = keepDeserialized;
+    }
+
+    /**
+     * Gets portable protocol version.
+     * <p>
+     * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
+     *
+     * @return Portable protocol version.
+     */
+    public PortableProtocolVersion getProtocolVersion() {
+        return protoVer;
+    }
+
+    /**
+     * Sets portable protocol version.
+     * <p>
+     * Defaults to {@link #DFLT_PORTABLE_PROTO_VER}.
+     *
+     * @param protoVer Portable protocol version.
+     */
+    public void setProtocolVersion(PortableProtocolVersion protoVer) {
+        if (protoVer == null)
+            throw new IllegalArgumentException("Wrong portable protocol version: " + protoVer);
+
+        this.protoVer = protoVer;
+    }
+
+    /**
+     * Returns currently set {@link MarshallerContext}.
+     *
+     * @return Marshaller context.
+     */
+    public MarshallerContext getContext() {
+        return ctx;
+    }
+
+    /**
+     * Sets {@link PortableContext}.
+     * <p/>
+     * @param ctx Portable context.
+     */
+    private void setPortableContext(PortableContext ctx) {
+        ctx.configure(this);
+
+        impl = new GridPortableMarshaller(ctx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
+        return impl.marshal(obj, 0);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+        byte[] arr = marshal(obj);
+
+        try {
+            out.write(arr);
+        }
+        catch (IOException e) {
+            throw new PortableException("Failed to marshal the object: " + obj, e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+        return impl.deserialize(bytes, clsLdr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+        byte[] arr = new byte[4096];
+        int cnt;
+
+        // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that
+        // returns number of bytes remaining.
+        try {
+            while ((cnt = in.read(arr)) != -1)
+                buffer.write(arr, 0, cnt);
+
+            buffer.flush();
+
+            return impl.deserialize(buffer.toByteArray(), clsLdr);
+        }
+        catch (IOException e) {
+            throw new PortableException("Failed to unmarshal the object from InputStream", e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
new file mode 100644
index 0000000..a90bdca
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.util.Collection;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable type meta data. Metadata for portable types can be accessed from any of the
+ * {@link IgnitePortables#metadata(String)} methods.
+ * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ */
+public interface PortableMetadata {
+    /**
+     * Gets portable type name.
+     *
+     * @return Portable type name.
+     */
+    public String typeName();
+
+    /**
+     * Gets collection of all field names for this portable type.
+     *
+     * @return Collection of all field names for this portable type.
+     */
+    public Collection<String> fields();
+
+    /**
+     * Gets name of the field type for a given field.
+     *
+     * @param fieldName Field name.
+     * @return Field type name.
+     */
+    @Nullable public String fieldTypeName(String fieldName);
+
+    /**
+     * Portable objects can optionally specify custom key-affinity mapping in the
+     * configuration. This method returns the name of the field which should be
+     * used for the key-affinity mapping.
+     *
+     * @return Affinity key field name.
+     */
+    @Nullable public String affinityKeyFieldName();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
new file mode 100644
index 0000000..ec965c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Wrapper for portable object in portable binary format. Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ * <p>
+ * <b>NOTE:</b> user does not need to (and should not) implement this interface directly.
+ * <p>
+ * To work with the portable format directly, user should create a cache projection
+ * over {@code PortableObject} class and then retrieve individual fields as needed:
+ * <pre name=code class=java>
+ * IgniteCache&lt;PortableObject, PortableObject&gt; prj = cache.withKeepPortable();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use GridPortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.portables().toPortable(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ * </pre>
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ * <pre name=code class=java>
+ * IgniteCache&lt;MyKey.class, MyValue.class&gt; cache = grid.cache(null);
+ *
+ * MyValue val = cache.get(new MyKey());
+ *
+ * // Normal java getter.
+ * String fieldVal = val.getMyFieldName();
+ * </pre>
+ * <h1 class="header">Working With Maps and Collections</h1>
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ * <h1 class="header">Dynamic Structure Changes</h1>
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ * <h1 class="header">Building Portable Objects</h1>
+ * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
+ *
+ * builder.setField("fieldA", "A");
+ * builder.setField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ * <pre name=code class=java>
+ * MyObject obj = new MyObject();
+ *
+ * obj.setFieldA("A");
+ * obj.setFieldB(123);
+ *
+ * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
+ * </pre>
+ * <h1 class="header">Portable Metadata</h1>
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ */
+public interface PortableObject extends Serializable, Cloneable {
+    /**
+     * Gets portable object type ID.
+     *
+     * @return Type ID.
+     */
+    public int typeId();
+
+    /**
+     * Gets meta data for this portable object.
+     *
+     * @return Meta data.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public PortableMetadata metaData() throws PortableException;
+
+    /**
+     * Gets field value.
+     *
+     * @param fieldName Field name.
+     * @return Field value.
+     * @throws PortableException In case of any other error.
+     */
+    @Nullable public <F> F field(String fieldName) throws PortableException;
+
+    /**
+     * Checks whether field is set.
+     *
+     * @param fieldName Field name.
+     * @return {@code true} if field is set.
+     */
+    public boolean hasField(String fieldName);
+
+    /**
+     * Gets fully deserialized instance of portable object.
+     *
+     * @return Fully deserialized instance of portable object.
+     * @throws PortableInvalidClassException If class doesn't exist.
+     * @throws PortableException In case of any other error.
+     */
+    @Nullable public <T> T deserialize() throws PortableException;
+
+    /**
+     * Copies this portable object.
+     *
+     * @return Copy of this portable object.
+     */
+    public PortableObject clone() throws CloneNotSupportedException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
new file mode 100644
index 0000000..741c2a5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable protocol version.
+ */
+public enum PortableProtocolVersion {
+    /** Ignite 1.4.0 release. */
+    VER_1_4_0;
+
+    /** Enumerated values. */
+    private static final PortableProtocolVersion[] VALS = values();
+
+    /**
+     * Efficiently gets enumerated value from its ordinal.
+     *
+     * @param ord Ordinal value.
+     * @return Enumerated value or {@code null} if ordinal out of range.
+     */
+    @Nullable public static PortableProtocolVersion fromOrdinal(int ord) {
+        return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
new file mode 100644
index 0000000..c12aa1a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
@@ -0,0 +1,234 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Raw reader for portable objects. Raw reader does not use field name hash codes, therefore,
+ * making the format even more compact. However, if the raw reader is used,
+ * dynamic structure changes to the portable objects are not supported.
+ */
+public interface PortableRawReader {
+    /**
+     * @return Byte value.
+     * @throws PortableException In case of error.
+     */
+    public byte readByte() throws PortableException;
+
+    /**
+     * @return Short value.
+     * @throws PortableException In case of error.
+     */
+    public short readShort() throws PortableException;
+
+    /**
+     * @return Integer value.
+     * @throws PortableException In case of error.
+     */
+    public int readInt() throws PortableException;
+
+    /**
+     * @return Long value.
+     * @throws PortableException In case of error.
+     */
+    public long readLong() throws PortableException;
+
+    /**
+     * @return Float value.
+     * @throws PortableException In case of error.
+     */
+    public float readFloat() throws PortableException;
+
+    /**
+     * @return Double value.
+     * @throws PortableException In case of error.
+     */
+    public double readDouble() throws PortableException;
+
+    /**
+     * @return Char value.
+     * @throws PortableException In case of error.
+     */
+    public char readChar() throws PortableException;
+
+    /**
+     * @return Boolean value.
+     * @throws PortableException In case of error.
+     */
+    public boolean readBoolean() throws PortableException;
+
+    /**
+     * @return Decimal value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal readDecimal() throws PortableException;
+
+    /**
+     * @return String value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public String readString() throws PortableException;
+
+    /**
+     * @return UUID.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public UUID readUuid() throws PortableException;
+
+    /**
+     * @return Date.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Date readDate() throws PortableException;
+
+    /**
+     * @return Timestamp.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Timestamp readTimestamp() throws PortableException;
+
+    /**
+     * @return Object.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T> T readObject() throws PortableException;
+
+    /**
+     * @return Byte array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public byte[] readByteArray() throws PortableException;
+
+    /**
+     * @return Short array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public short[] readShortArray() throws PortableException;
+
+    /**
+     * @return Integer array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public int[] readIntArray() throws PortableException;
+
+    /**
+     * @return Long array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public long[] readLongArray() throws PortableException;
+
+    /**
+     * @return Float array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public float[] readFloatArray() throws PortableException;
+
+    /**
+     * @return Byte array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public double[] readDoubleArray() throws PortableException;
+
+    /**
+     * @return Char array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public char[] readCharArray() throws PortableException;
+
+    /**
+     * @return Boolean array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public boolean[] readBooleanArray() throws PortableException;
+
+    /**
+     * @return Decimal array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
+
+    /**
+     * @return String array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public String[] readStringArray() throws PortableException;
+
+    /**
+     * @return UUID array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public UUID[] readUuidArray() throws PortableException;
+
+    /**
+     * @return Date array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Date[] readDateArray() throws PortableException;
+
+    /**
+     * @return Object array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Object[] readObjectArray() throws PortableException;
+
+    /**
+     * @return Collection.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T> Collection<T> readCollection() throws PortableException;
+
+    /**
+     * @param colCls Collection class.
+     * @return Collection.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T> Collection<T> readCollection(Class<? extends Collection<T>> colCls)
+        throws PortableException;
+
+    /**
+     * @return Map.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <K, V> Map<K, V> readMap() throws PortableException;
+
+    /**
+     * @param mapCls Map class.
+     * @return Map.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <K, V> Map<K, V> readMap(Class<? extends Map<K, V>> mapCls) throws PortableException;
+
+    /**
+     * @return Value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T extends Enum<?>> T readEnum() throws PortableException;
+
+    /**
+     * @return Value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T extends Enum<?>> T[] readEnumArray() throws PortableException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
new file mode 100644
index 0000000..91f0e3b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Raw writer for portable object. Raw writer does not write field name hash codes, therefore,
+ * making the format even more compact. However, if the raw writer is used,
+ * dynamic structure changes to the portable objects are not supported.
+ */
+public interface PortableRawWriter {
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeByte(byte val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeShort(short val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeInt(int val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeLong(long val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeFloat(float val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDouble(double val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeChar(char val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeBoolean(boolean val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeString(@Nullable String val) throws PortableException;
+
+    /**
+     * @param val UUID to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeUuid(@Nullable UUID val) throws PortableException;
+
+    /**
+     * @param val Date to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDate(@Nullable Date val) throws PortableException;
+
+    /**
+     * @param val Timestamp to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeTimestamp(@Nullable Timestamp val) throws PortableException;
+
+    /**
+     * @param obj Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeObject(@Nullable Object obj) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeByteArray(@Nullable byte[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeShortArray(@Nullable short[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeIntArray(@Nullable int[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeLongArray(@Nullable long[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeFloatArray(@Nullable float[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDoubleArray(@Nullable double[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeCharArray(@Nullable char[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeBooleanArray(@Nullable boolean[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeStringArray(@Nullable String[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeUuidArray(@Nullable UUID[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDateArray(@Nullable Date[] val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeObjectArray(@Nullable Object[] val) throws PortableException;
+
+    /**
+     * @param col Collection to write.
+     * @throws PortableException In case of error.
+     */
+    public <T> void writeCollection(@Nullable Collection<T> col) throws PortableException;
+
+    /**
+     * @param map Map to write.
+     * @throws PortableException In case of error.
+     */
+    public <K, V> void writeMap(@Nullable Map<K, V> map) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public <T extends Enum<?>> void writeEnum(T val) throws PortableException;
+
+    /**
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public <T extends Enum<?>> void writeEnumArray(T[] val) throws PortableException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
new file mode 100644
index 0000000..ca322e7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
@@ -0,0 +1,284 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Reader for portable objects used in {@link PortableMarshalAware} implementations.
+ * Useful for the cases when user wants a fine-grained control over serialization.
+ * <p>
+ * Note that Ignite never writes full strings for field or type names. Instead,
+ * for performance reasons, Ignite writes integer hash codes for type and field names.
+ * It has been tested that hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide, Ignite provides {@link PortableIdMapper} which
+ * allows to override the automatically generated hash code IDs for the type and field names.
+ */
+public interface PortableReader {
+    /**
+     * @param fieldName Field name.
+     * @return Byte value.
+     * @throws PortableException In case of error.
+     */
+    public byte readByte(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Short value.
+     * @throws PortableException In case of error.
+     */
+    public short readShort(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Integer value.
+     * @throws PortableException In case of error.
+     */
+    public int readInt(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Long value.
+     * @throws PortableException In case of error.
+     */
+    public long readLong(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @throws PortableException In case of error.
+     * @return Float value.
+     */
+    public float readFloat(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Double value.
+     * @throws PortableException In case of error.
+     */
+    public double readDouble(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Char value.
+     * @throws PortableException In case of error.
+     */
+    public char readChar(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Boolean value.
+     * @throws PortableException In case of error.
+     */
+    public boolean readBoolean(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Decimal value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return String value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public String readString(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return UUID.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public UUID readUuid(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Date.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Date readDate(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Timestamp.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Timestamp readTimestamp(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Object.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T> T readObject(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Byte array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public byte[] readByteArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Short array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public short[] readShortArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Integer array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public int[] readIntArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Long array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public long[] readLongArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Float array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public float[] readFloatArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Byte array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public double[] readDoubleArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Char array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public char[] readCharArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Boolean array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public boolean[] readBooleanArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Decimal array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return String array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public String[] readStringArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return UUID array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public UUID[] readUuidArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Date array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Date[] readDateArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Object array.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public Object[] readObjectArray(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Collection.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T> Collection<T> readCollection(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param colCls Collection class.
+     * @return Collection.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T> Collection<T> readCollection(String fieldName, Class<? extends Collection<T>> colCls)
+        throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Map.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <K, V> Map<K, V> readMap(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param mapCls Map class.
+     * @return Map.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <K, V> Map<K, V> readMap(String fieldName, Class<? extends Map<K, V>> mapCls)
+        throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T extends Enum<?>> T readEnum(String fieldName) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @return Value.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public <T extends Enum<?>> T[] readEnumArray(String fieldName) throws PortableException;
+
+    /**
+     * Gets raw reader. Raw reader does not use field name hash codes, therefore,
+     * making the format even more compact. However, if the raw reader is used,
+     * dynamic structure changes to the portable objects are not supported.
+     *
+     * @return Raw reader.
+     */
+    public PortableRawReader rawReader();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
new file mode 100644
index 0000000..b9e835f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+/**
+ * Interface that allows to implement custom serialization logic for portable objects.
+ * Can be used instead of {@link PortableMarshalAware} in case if the class
+ * cannot be changed directly.
+ * <p>
+ * Portable serializer can be configured for all portable objects via
+ * {@link PortableMarshaller#getSerializer()} method, or for a specific
+ * portable type via {@link PortableTypeConfiguration#getSerializer()} method.
+ */
+public interface PortableSerializer {
+    /**
+     * Writes fields to provided writer.
+     *
+     * @param obj Empty object.
+     * @param writer Portable object writer.
+     * @throws PortableException In case of error.
+     */
+    public void writePortable(Object obj, PortableWriter writer) throws PortableException;
+
+    /**
+     * Reads fields from provided reader.
+     *
+     * @param obj Empty object
+     * @param reader Portable object reader.
+     * @throws PortableException In case of error.
+     */
+    public void readPortable(Object obj, PortableReader reader) throws PortableException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
new file mode 100644
index 0000000..80a043e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.sql.Timestamp;
+import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Defines configuration properties for a specific portable type. Providing per-type
+ * configuration is optional, as it is generally enough, and also optional, to provide global portable
+ * configuration using {@link PortableMarshaller#setClassNames(Collection)}.
+ * However, this class allows you to change configuration properties for a specific
+ * portable type without affecting configuration for other portable types.
+ * <p>
+ * Per-type portable configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method.
+ */
+public class PortableTypeConfiguration {
+    /** Class name. */
+    private String clsName;
+
+    /** ID mapper. */
+    private PortableIdMapper idMapper;
+
+    /** Serializer. */
+    private PortableSerializer serializer;
+
+    /** Use timestamp flag. */
+    private Boolean useTs;
+
+    /** Meta data enabled flag. */
+    private Boolean metaDataEnabled;
+
+    /** Keep deserialized flag. */
+    private Boolean keepDeserialized;
+
+    /** Affinity key field name. */
+    private String affKeyFieldName;
+
+    /**
+     */
+    public PortableTypeConfiguration() {
+        // No-op.
+    }
+
+    /**
+     * @param clsName Class name.
+     */
+    public PortableTypeConfiguration(String clsName) {
+        this.clsName = clsName;
+    }
+
+    /**
+     * Gets type name.
+     *
+     * @return Type name.
+     */
+    public String getClassName() {
+        return clsName;
+    }
+
+    /**
+     * Sets type name.
+     *
+     * @param clsName Type name.
+     */
+    public void setClassName(String clsName) {
+        this.clsName = clsName;
+    }
+
+    /**
+     * Gets ID mapper.
+     *
+     * @return ID mapper.
+     */
+    public PortableIdMapper getIdMapper() {
+        return idMapper;
+    }
+
+    /**
+     * Sets ID mapper.
+     *
+     * @param idMapper ID mapper.
+     */
+    public void setIdMapper(PortableIdMapper idMapper) {
+        this.idMapper = idMapper;
+    }
+
+    /**
+     * Gets serializer.
+     *
+     * @return Serializer.
+     */
+    public PortableSerializer getSerializer() {
+        return serializer;
+    }
+
+    /**
+     * Sets serializer.
+     *
+     * @param serializer Serializer.
+     */
+    public void setSerializer(PortableSerializer serializer) {
+        this.serializer = serializer;
+    }
+
+    /**
+     * If {@code true} then date values converted to {@link Timestamp} during unmarshalling.
+     *
+     * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+     */
+    public Boolean isUseTimestamp() {
+        return useTs;
+    }
+
+    /**
+     * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+     */
+    public void setUseTimestamp(Boolean useTs) {
+        this.useTs = useTs;
+    }
+
+    /**
+     * Defines whether meta data is collected for this type. If provided, this value will override
+     * {@link PortableMarshaller#isMetaDataEnabled()} property.
+     *
+     * @return Whether meta data is collected.
+     */
+    public Boolean isMetaDataEnabled() {
+        return metaDataEnabled;
+    }
+
+    /**
+     * @param metaDataEnabled Whether meta data is collected.
+     */
+    public void setMetaDataEnabled(Boolean metaDataEnabled) {
+        this.metaDataEnabled = metaDataEnabled;
+    }
+
+    /**
+     * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
+     * this value will override {@link PortableMarshaller#isKeepDeserialized()}
+     * property.
+     *
+     * @return Whether deserialized value is kept.
+     */
+    public Boolean isKeepDeserialized() {
+        return keepDeserialized;
+    }
+
+    /**
+     * @param keepDeserialized Whether deserialized value is kept.
+     */
+    public void setKeepDeserialized(Boolean keepDeserialized) {
+        this.keepDeserialized = keepDeserialized;
+    }
+
+    /**
+     * Gets affinity key field name.
+     *
+     * @return Affinity key field name.
+     */
+    public String getAffinityKeyFieldName() {
+        return affKeyFieldName;
+    }
+
+    /**
+     * Sets affinity key field name.
+     *
+     * @param affKeyFieldName Affinity key field name.
+     */
+    public void setAffinityKeyFieldName(String affKeyFieldName) {
+        this.affKeyFieldName = affKeyFieldName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(PortableTypeConfiguration.class, this, super.toString());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
new file mode 100644
index 0000000..8af04a3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Writer for portable object used in {@link PortableMarshalAware} implementations.
+ * Useful for the cases when user wants a fine-grained control over serialization.
+ * <p>
+ * Note that Ignite never writes full strings for field or type names. Instead,
+ * for performance reasons, Ignite writes integer hash codes for type and field names.
+ * It has been tested that hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide, Ignite provides {@link PortableIdMapper} which
+ * allows to override the automatically generated hash code IDs for the type and field names.
+ */
+public interface PortableWriter {
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeByte(String fieldName, byte val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeShort(String fieldName, short val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeInt(String fieldName, int val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeLong(String fieldName, long val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeFloat(String fieldName, float val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDouble(String fieldName, double val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeChar(String fieldName, char val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeBoolean(String fieldName, boolean val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeString(String fieldName, @Nullable String val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val UUID to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Date to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDate(String fieldName, @Nullable Date val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Timestamp to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param obj Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeObject(String fieldName, @Nullable Object obj) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param col Collection to write.
+     * @throws PortableException In case of error.
+     */
+    public <T> void writeCollection(String fieldName, @Nullable Collection<T> col) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param map Map to write.
+     * @throws PortableException In case of error.
+     */
+    public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws PortableException;
+
+    /**
+     * @param fieldName Field name.
+     * @param val Value to write.
+     * @throws PortableException In case of error.
+     */
+    public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws PortableException;
+
+    /**
+     * Gets raw writer. Raw writer does not write field name hash codes, therefore,
+     * making the format even more compact. However, if the raw writer is used,
+     * dynamic structure changes to the portable objects are not supported.
+     *
+     * @return Raw writer.
+     */
+    public PortableRawWriter rawWriter();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
index 1472d56..8673b70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
index b2e4c0d..96d10a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
@@ -25,17 +25,13 @@ import java.util.Set;
 import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
 import org.apache.ignite.internal.util.GridArgumentCheck;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 import org.apache.ignite.internal.portable.*;
-import org.apache.ignite.internal.processors.cache.portable.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.portable.*;
 
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLS_NAME_POS;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.DFLT_HDR_LEN;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
index 45355d7..e93f860 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.portable.PortablePrimitives;
 import org.apache.ignite.internal.portable.PortableReaderExImpl;
 import org.apache.ignite.internal.portable.PortableUtils;
 import org.apache.ignite.internal.portable.PortableWriterExImpl;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
index 2d9c961..6fe8875 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
@@ -21,8 +21,8 @@ import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableObjectEx;
 import org.apache.ignite.internal.portable.PortableUtils;
 import org.apache.ignite.internal.portable.PortableWriterExImpl;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.apache.ignite.internal.util.*;
-import org.apache.ignite.portable.*;
 
 import java.util.*;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
index d864a6e..15c52e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
@@ -20,8 +20,8 @@ package org.apache.ignite.internal.portable.builder;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
index 1126a3c..96f4944 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
index 8743fbe..300c4ad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
 import org.apache.ignite.internal.portable.PortableObjectImpl;
 import org.apache.ignite.internal.portable.PortableObjectOffheapImpl;
 import org.apache.ignite.internal.portable.PortableWriterExImpl;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
index 107b02e..80f91be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.portable.streams;
 
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
 
 /**
  * Portable abstract input stream.

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 75d4c43..59bb5f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -115,7 +115,7 @@ import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.lifecycle.LifecycleAware;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
 import org.apache.ignite.spi.IgniteNodeValidationResult;
 import org.jetbrains.annotations.Nullable;
 
@@ -1063,12 +1063,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         CacheConfiguration cfg = cacheCtx.config();
 
-        // Intentionally compare Boolean references using '!=' below to check if the flag has been explicitly set.
-        if (cfg.isKeepPortableInStore() && cfg.isKeepPortableInStore() != CacheConfiguration.DFLT_KEEP_PORTABLE_IN_STORE
-            && !(ctx.config().getMarshaller() instanceof PortableMarshaller))
-            U.warn(log, "CacheConfiguration.isKeepPortableInStore() configuration property will be ignored because " +
-                "PortableMarshaller is not used");
-
         // Start managers.
         for (GridCacheManager mgr : F.view(cacheCtx.managers(), F.notContains(dhtExcludes(cacheCtx))))
             mgr.start(cacheCtx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index ce0cdd7..cc6c19a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -311,11 +311,6 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public <K1, V1> IgniteCache<K1, V1> withKeepPortable() {
-        return keepPortable();
-    }
-
-    /** {@inheritDoc} */
     @Override public IgniteCache<K, V> withNoRetries() {
         GridCacheGateway<K, V> gate = this.gate;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
index 23edd9e..0dbf71d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
@@ -21,7 +21,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
index 2e0d37d..d064601 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.portable.PortableUtils;
 import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
 
 /**
  *

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
index fcd73d2..7f6512b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
@@ -20,11 +20,11 @@ package org.apache.ignite.internal.processors.cache.portable;
 import java.util.Collection;
 import java.util.Map;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
index 1be5aea..4cab3db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
@@ -39,7 +39,7 @@ import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.MutableEntry;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -80,11 +80,11 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 import sun.misc.Unsafe;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
index 5ed6505..40c3b70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
@@ -18,13 +18,13 @@
 package org.apache.ignite.internal.processors.cache.portable;
 
 import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 
 /**


[38/41] ignite git commit: Merge branch 'ignite-1.4' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.4-main

Posted by ag...@apache.org.
Merge branch 'ignite-1.4' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1.4-main


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5f16818
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5f16818
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5f16818

Branch: refs/heads/ignite-1400
Commit: e5f16818c20c774c2dcccfacbd85040a071edce9
Parents: 71379a8 c01313d
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Sep 14 17:36:15 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Sep 14 17:36:15 2015 +0300

----------------------------------------------------------------------
 .../processors/platform/services/PlatformAbstractService.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[02/41] ignite git commit: IGNITE-264 - Check backup node for one-phase transaction when primary node crashes.

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 23a8b1f..25ab297 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -63,7 +63,7 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
     /** Implicit transaction with one key flag. */
     private boolean implicitSingleTx;
 
-    /** One phase commit flag. */
+    /** Flag is kept for backward compatibility. */
     private boolean onePhaseCommit;
 
     /** Array of mapped DHT versions for this entry. */
@@ -220,20 +220,6 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
     }
 
     /**
-     * @return One phase commit flag.
-     */
-    public boolean onePhaseCommit() {
-        return onePhaseCommit;
-    }
-
-    /**
-     * @param onePhaseCommit One phase commit flag.
-     */
-    public void onePhaseCommit(boolean onePhaseCommit) {
-        this.onePhaseCommit = onePhaseCommit;
-    }
-
-    /**
      * @return Sync commit flag.
      */
     public boolean syncCommit() {
@@ -603,4 +589,4 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
         return S.toString(GridNearLockRequest.class, this, "filter", Arrays.toString(filter),
             "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
index 529f29c..3f9decf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearOptimisticTxPrepareFuture.java
@@ -24,6 +24,7 @@ import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.cluster.ClusterTopologyException;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -50,6 +51,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -142,6 +144,16 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
      * @param e Error.
      */
     void onError(@Nullable UUID nodeId, @Nullable Iterable<GridDistributedTxMapping> mappings, Throwable e) {
+        if (X.hasCause(e, ClusterTopologyCheckedException.class) || X.hasCause(e, ClusterTopologyException.class)) {
+            if (tx.onePhaseCommit()) {
+                tx.markForBackupCheck();
+
+                onComplete();
+
+                return;
+            }
+        }
+
         if (err.compareAndSet(null, e)) {
             boolean marked = tx.setRollbackOnly();
 
@@ -209,17 +221,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
 
         this.err.compareAndSet(null, err);
 
-        if (err == null)
-            tx.state(PREPARED);
-
-        if (super.onDone(tx, err)) {
-            // Don't forget to clean up.
-            cctx.mvcc().removeFuture(this);
-
-            return true;
-        }
-
-        return false;
+        return onComplete();
     }
 
     /**
@@ -233,10 +235,20 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
     /**
      * Completeness callback.
      */
-    private void onComplete() {
-        if (super.onDone(tx, err.get()))
+    private boolean onComplete() {
+        Throwable err0 = err.get();
+
+        if (err0 == null || tx.needCheckBackup())
+            tx.state(PREPARED);
+
+        if (super.onDone(tx, err0)) {
             // Don't forget to clean up.
             cctx.mvcc().removeFuture(this);
+
+            return true;
+        }
+
+        return false;
     }
 
     /** {@inheritDoc} */
@@ -244,6 +256,14 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
         // Obtain the topology version to use.
         AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(Thread.currentThread().getId());
 
+        // If there is another system transaction in progress, use it's topology version to prevent deadlock.
+        if (topVer == null && tx != null && tx.system()) {
+            IgniteInternalTx tx0 = cctx.tm().anyActiveThreadTx(tx);
+
+            if (tx0 != null)
+                topVer = tx0.topologyVersionSnapshot();
+        }
+
         if (topVer != null) {
             tx.topologyVersion(topVer);
 
@@ -437,7 +457,6 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
     /**
      * @param reads Read entries.
      * @param writes Write entries.
-     * @throws IgniteCheckedException If transaction is group-lock and some key was mapped to to the local node.
      */
     private void prepare(
         Iterable<IgniteTxEntry> reads,
@@ -618,7 +637,6 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
      * @param topVer Topology version.
      * @param cur Current mapping.
      * @param waitLock Wait lock flag.
-     * @throws IgniteCheckedException If transaction is group-lock and local node is not primary for key.
      * @return Mapping.
      */
     private GridDistributedTxMapping map(
@@ -626,7 +644,7 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
         AffinityTopologyVersion topVer,
         @Nullable GridDistributedTxMapping cur,
         boolean waitLock
-    ) throws IgniteCheckedException {
+    ) {
         GridCacheContext cacheCtx = entry.context();
 
         List<ClusterNode> nodes = cacheCtx.affinity().nodes(entry.key(), topVer);
@@ -857,4 +875,4 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
index 63f1f79..b8d2250 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearPessimisticTxPrepareFuture.java
@@ -261,7 +261,7 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
 
         err = this.err.get();
 
-        if (err == null)
+        if (err == null || tx.needCheckBackup())
             tx.state(PREPARED);
 
         if (super.onDone(tx, err)) {
@@ -339,6 +339,13 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
          * @param e Error.
          */
         void onNodeLeft(ClusterTopologyCheckedException e) {
+            if (tx.onePhaseCommit()) {
+                tx.markForBackupCheck();
+
+                // Do not fail future for one-phase transaction right away.
+                onDone(tx);
+            }
+
             onError(e);
         }
 
@@ -366,4 +373,4 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index f29bd28..ddc8be5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReference;
@@ -32,6 +34,8 @@ import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 import org.apache.ignite.internal.processors.cache.GridCacheFuture;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -42,14 +46,17 @@ import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.transactions.TransactionRollbackException;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.processors.cache.GridCacheOperation.NOOP;
-import static org.apache.ignite.transactions.TransactionState.COMMITTING;
+import static org.apache.ignite.transactions.TransactionState.UNKNOWN;
 
 /**
  *
@@ -57,6 +64,9 @@ import static org.apache.ignite.transactions.TransactionState.COMMITTING;
 public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFuture<IgniteInternalTx>
     implements GridCacheFuture<IgniteInternalTx> {
     /** */
+    public static final IgniteProductVersion FINISH_NEAR_ONE_PHASE_SINCE = IgniteProductVersion.fromString("1.4.0");
+
+    /** */
     private static final long serialVersionUID = 0L;
 
     /** Logger reference. */
@@ -216,27 +226,66 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             }
     }
 
+    /**
+     * @param nodeId Sender.
+     * @param res Result.
+     */
+    public void onResult(UUID nodeId, GridDhtTxFinishResponse res) {
+        if (!isDone())
+            for (IgniteInternalFuture<IgniteInternalTx> fut : futures()) {
+                if (isMini(fut)) {
+                    MiniFuture f = (MiniFuture)fut;
+
+                    if (f.futureId().equals(res.miniId())) {
+                        assert f.node().id().equals(nodeId);
+
+                        f.onResult(res);
+                    }
+                }
+            }
+    }
+
     /** {@inheritDoc} */
-    @Override public boolean onDone(IgniteInternalTx tx, Throwable err) {
+    @Override public boolean onDone(IgniteInternalTx tx0, Throwable err) {
         if ((initialized() || err != null)) {
-            if (this.tx.onePhaseCommit() && (this.tx.state() == COMMITTING))
-                this.tx.tmCommit();
+            if (tx.needCheckBackup()) {
+                assert tx.onePhaseCommit();
+
+                if (err != null)
+                    err = new TransactionRollbackException("Failed to commit transaction.", err);
+
+                try {
+                    tx.finish(err == null);
+                }
+                catch (IgniteCheckedException e) {
+                    if (err != null)
+                        err.addSuppressed(e);
+                    else
+                        err = e;
+                }
+            }
+
+            if (tx.onePhaseCommit()) {
+                finishOnePhase();
+
+                tx.tmFinish(err == null);
+            }
 
             Throwable th = this.err.get();
 
-            if (super.onDone(tx, th != null ? th : err)) {
+            if (super.onDone(tx0, th != null ? th : err)) {
                 if (error() instanceof IgniteTxHeuristicCheckedException) {
-                    AffinityTopologyVersion topVer = this.tx.topologyVersion();
+                    AffinityTopologyVersion topVer = tx.topologyVersion();
 
-                    for (IgniteTxEntry e : this.tx.writeMap().values()) {
+                    for (IgniteTxEntry e : tx.writeMap().values()) {
                         GridCacheContext cacheCtx = e.context();
 
                         try {
                             if (e.op() != NOOP && !cacheCtx.affinity().localNode(e.key(), topVer)) {
-                                GridCacheEntryEx Entry = cacheCtx.cache().peekEx(e.key());
+                                GridCacheEntryEx entry = cacheCtx.cache().peekEx(e.key());
 
-                                if (Entry != null)
-                                    Entry.invalidate(null, this.tx.xidVersion());
+                                if (entry != null)
+                                    entry.invalidate(null, tx.xidVersion());
                             }
                         }
                         catch (Throwable t) {
@@ -284,52 +333,194 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
      * Initializes future.
      */
     void finish() {
-        if (tx.onePhaseCommit()) {
-            // No need to send messages as transaction was already committed on remote node.
-            // Finish local mapping only as we need send commit message to backups.
-            for (GridDistributedTxMapping m : mappings.values()) {
-                if (m.node().isLocal()) {
-                    IgniteInternalFuture<IgniteInternalTx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx);
-
-                    // Add new future.
-                    if (fut != null)
-                        add(fut);
-                }
-            }
+        if (tx.needCheckBackup()) {
+            assert tx.onePhaseCommit();
+
+            checkBackup();
 
+            // If checkBackup is set, it means that primary node has crashed and we will not need to send
+            // finish request to it, so we can mark future as initialized.
             markInitialized();
 
             return;
         }
 
-        if (mappings != null) {
-            finish(mappings.values());
+        try {
+            if (tx.finish(commit) || (!commit && tx.state() == UNKNOWN)) {
+                if ((tx.onePhaseCommit() && needFinishOnePhase()) || (!tx.onePhaseCommit() && mappings != null))
+                    finish(mappings.values());
 
-            markInitialized();
+                markInitialized();
 
-            if (!isSync()) {
-                boolean complete = true;
+                if (!isSync()) {
+                    boolean complete = true;
 
-                for (IgniteInternalFuture<?> f : pending())
-                    // Mini-future in non-sync mode gets done when message gets sent.
-                    if (isMini(f) && !f.isDone())
-                        complete = false;
+                    for (IgniteInternalFuture<?> f : pending())
+                        // Mini-future in non-sync mode gets done when message gets sent.
+                        if (isMini(f) && !f.isDone())
+                            complete = false;
 
-                if (complete)
-                    onComplete();
+                    if (complete)
+                        onComplete();
+                }
             }
+            else
+                onError(new IgniteCheckedException("Failed to commit transaction: " + CU.txString(tx)));
         }
-        else {
-            assert !commit;
+        catch (Error | RuntimeException e) {
+            onError(e);
 
-            try {
-                tx.rollback();
+            throw e;
+        }
+        catch (IgniteCheckedException e) {
+            onError(e);
+        }
+    }
+
+    /**
+     *
+     */
+    private void checkBackup() {
+        assert mappings.size() <= 1;
+
+        for (Map.Entry<UUID, GridDistributedTxMapping> entry : mappings.entrySet()) {
+            UUID nodeId = entry.getKey();
+            GridDistributedTxMapping mapping = entry.getValue();
+
+            Collection<UUID> backups = tx.transactionNodes().get(nodeId);
+
+            if (!F.isEmpty(backups)) {
+                assert backups.size() == 1;
+
+                UUID backupId = F.first(backups);
+
+                ClusterNode backup = cctx.discovery().node(backupId);
+
+                // Nothing to do if backup has left the grid.
+                if (backup == null)
+                    return;
+
+                MiniFuture mini = new MiniFuture(backup, mapping);
+
+                add(mini);
+
+                if (backup.isLocal()) {
+                    if (cctx.tm().txHandler().checkDhtRemoteTxCommitted(tx.xidVersion())) {
+                        readyNearMappingFromBackup(mapping);
+
+                        mini.onDone(tx);
+                    }
+                    else
+                        mini.onDone(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
+                            "(transaction has been rolled back on backup node): " + tx.xidVersion()));
+                }
+                else {
+                    GridDhtTxFinishRequest finishReq = new GridDhtTxFinishRequest(
+                        cctx.localNodeId(),
+                        futureId(),
+                        mini.futureId(),
+                        tx.topologyVersion(),
+                        tx.xidVersion(),
+                        tx.commitVersion(),
+                        tx.threadId(),
+                        tx.isolation(),
+                        true,
+                        false,
+                        tx.system(),
+                        tx.ioPolicy(),
+                        false,
+                        true,
+                        true,
+                        null,
+                        null,
+                        null,
+                        null,
+                        0,
+                        null,
+                        0);
+
+                    finishReq.checkCommitted(true);
+
+                    try {
+                        if (FINISH_NEAR_ONE_PHASE_SINCE.compareTo(backup.version()) <= 0)
+                            cctx.io().send(backup, finishReq, tx.ioPolicy());
+                        else
+                            mini.onDone(new IgniteTxHeuristicCheckedException("Failed to check for tx commit on " +
+                                "the backup node (node has an old Ignite version) [rmtNodeId=" + backup.id() +
+                                ", ver=" + backup.version() + ']'));
+                    }
+                    catch (ClusterTopologyCheckedException e) {
+                        mini.onResult(e);
+                    }
+                    catch (IgniteCheckedException e) {
+                        mini.onResult(e);
+                    }
+                }
             }
-            catch (IgniteCheckedException e) {
-                U.error(log, "Failed to rollback empty transaction: " + tx, e);
+            else
+                readyNearMappingFromBackup(mapping);
+        }
+    }
+
+    /**
+     *
+     */
+    private boolean needFinishOnePhase() {
+        if (F.isEmpty(tx.mappings()))
+            return false;
+
+        assert tx.mappings().size() == 1;
+
+        boolean finish = false;
+
+        for (Integer cacheId : tx.activeCacheIds()) {
+            GridCacheContext<K, V> cacheCtx = cctx.cacheContext(cacheId);
+
+            if (cacheCtx.isNear()) {
+                finish = true;
+
+                break;
             }
+        }
 
-            markInitialized();
+        if (finish) {
+            GridDistributedTxMapping mapping = F.first(tx.mappings().values());
+
+            if (FINISH_NEAR_ONE_PHASE_SINCE.compareTo(mapping.node().version()) > 0)
+                finish = false;
+        }
+
+        return finish;
+    }
+
+    /**
+     *
+     */
+    private void finishOnePhase() {
+        // No need to send messages as transaction was already committed on remote node.
+        // Finish local mapping only as we need send commit message to backups.
+        for (GridDistributedTxMapping m : mappings.values()) {
+            if (m.node().isLocal()) {
+                IgniteInternalFuture<IgniteInternalTx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx);
+
+                // Add new future.
+                if (fut != null)
+                    add(fut);
+            }
+        }
+    }
+
+    /**
+     * @param mapping Mapping to finish.
+     */
+    private void readyNearMappingFromBackup(GridDistributedTxMapping mapping) {
+        if (mapping.near()) {
+            GridCacheVersion xidVer = tx.xidVersion();
+
+            mapping.dhtVersion(xidVer, xidVer);
+
+            tx.readyNearLocks(mapping, Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList(),
+                Collections.<GridCacheVersion>emptyList());
         }
     }
 
@@ -417,9 +608,9 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             @SuppressWarnings("unchecked")
             @Override public String apply(IgniteInternalFuture<?> f) {
                 if (isMini(f)) {
-                    return "[node=" + ((MiniFuture) f).node().id() +
-                        ", loc=" + ((MiniFuture) f).node().isLocal() +
-                        ", done=" + f.isDone() + "]";
+                    MiniFuture m = (MiniFuture)f;
+
+                    return "[node=" + m.node().id() + ", loc=" + m.node().isLocal() + ", done=" + f.isDone() + "]";
                 }
                 else
                     return "[loc=true, done=" + f.isDone() + "]";
@@ -446,6 +637,9 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
         @GridToStringInclude
         private GridDistributedTxMapping m;
 
+        /** Backup check flag. */
+        private ClusterNode backup;
+
         /**
          * @param m Mapping.
          */
@@ -454,6 +648,15 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
         }
 
         /**
+         * @param backup Backup to check.
+         * @param m Mapping associated with the backup.
+         */
+        MiniFuture(ClusterNode backup, GridDistributedTxMapping m) {
+            this.backup = backup;
+            this.m = m;
+        }
+
+        /**
          * @return Future ID.
          */
         IgniteUuid futureId() {
@@ -464,7 +667,9 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
          * @return Node ID.
          */
         public ClusterNode node() {
-            return m.node();
+            assert m != null || backup != null;
+
+            return backup != null ? backup : m.node();
         }
 
         /**
@@ -492,20 +697,42 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             if (log.isDebugEnabled())
                 log.debug("Remote node left grid while sending or waiting for reply (will fail): " + this);
 
-            // Complete future with tx.
-            onDone(tx);
+            if (backup != null) {
+                readyNearMappingFromBackup(m);
+
+                onDone(e);
+            }
+            else
+                // Complete future with tx.
+                onDone(tx);
         }
 
         /**
          * @param res Result callback.
          */
         void onResult(GridNearTxFinishResponse res) {
+            assert backup == null;
+
             if (res.error() != null)
                 onDone(res.error());
             else
                 onDone(tx);
         }
 
+        /**
+         * @param res Response.
+         */
+        void onResult(GridDhtTxFinishResponse res) {
+            assert backup != null;
+
+            readyNearMappingFromBackup(m);
+
+            if (res.checkCommittedError() != null)
+                onDone(res.checkCommittedError());
+            else
+                onDone(tx);
+        }
+
         /** {@inheritDoc} */
         @Override public String toString() {
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
index 5e5a222..c52a127 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishRequest.java
@@ -97,8 +97,22 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash) {
-        super(xidVer, futId, null, threadId, commit, invalidate, sys, plc, syncCommit, syncRollback, baseVer,
-            committedVers, rolledbackVers, txSize);
+        super(
+            xidVer,
+            futId,
+            null,
+            threadId,
+            commit,
+            invalidate,
+            sys,
+            plc,
+            syncCommit,
+            syncRollback,
+            baseVer,
+            committedVers,
+            rolledbackVers,
+            txSize
+        );
 
         this.explicitLock = explicitLock;
         this.storeEnabled = storeEnabled;
@@ -290,4 +304,4 @@ public class GridNearTxFinishRequest extends GridDistributedTxFinishRequest {
     @Override public String toString() {
         return GridToStringBuilder.toString(GridNearTxFinishRequest.class, this, "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index fd64fdf..a4e06c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -114,6 +114,9 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     private Map<IgniteTxKey, IgniteCacheExpiryPolicy> accessMap;
 
     /** */
+    private boolean needCheckBackup;
+
+    /** */
     private boolean hasRemoteLocks;
 
     /**
@@ -164,6 +167,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
             timeout,
             false,
             storeEnabled,
+            false,
             txSize,
             subjId,
             taskNameHash);
@@ -242,6 +246,20 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     }
 
     /**
+     * Marks transaction to check if commit on backup.
+     */
+    public void markForBackupCheck() {
+        needCheckBackup = true;
+    }
+
+    /**
+     * @return If need to check tx commit on backup.
+     */
+    public boolean needCheckBackup() {
+        return needCheckBackup;
+    }
+
+    /**
      * Checks if transaction is fully synchronous.
      *
      * @return {@code True} if transaction is fully synchronous.
@@ -501,9 +519,15 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
                 GridDistributedTxMapping m = mappings.get(n.id());
 
-                if (m == null)
+                if (m == null) {
                     m = F.addIfAbsent(mappings, n.id(), new GridDistributedTxMapping(n));
 
+                    m.near(map.near());
+
+                    if (map.explicitLock())
+                        m.markExplicitLock();
+                }
+
                 assert m != null;
 
                 for (IgniteTxEntry entry : map.entries())
@@ -736,7 +760,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
         cctx.mvcc().addFuture(fut);
 
-        IgniteInternalFuture<?> prepareFut = prepFut.get();
+        final IgniteInternalFuture<?> prepareFut = prepFut.get();
 
         prepareFut.listen(new CI1<IgniteInternalFuture<?>>() {
             @Override public void apply(IgniteInternalFuture<?> f) {
@@ -744,17 +768,15 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
                 try {
                     // Make sure that here are no exceptions.
-                    f.get();
+                    prepareFut.get();
 
-                    if (finish(true))
-                        fut0.finish();
-                    else
-                        fut0.onError(new IgniteCheckedException("Failed to commit transaction: " +
-                            CU.txString(GridNearTxLocal.this)));
+                    fut0.finish();
                 }
                 catch (Error | RuntimeException e) {
                     commitErr.compareAndSet(null, e);
 
+                    fut0.onError(e);
+
                     throw e;
                 }
                 catch (IgniteCheckedException e) {
@@ -796,15 +818,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
                     log.debug("Got optimistic tx failure [tx=" + this + ", err=" + e + ']');
             }
 
-            try {
-                if (finish(false) || state() == UNKNOWN)
-                    fut.finish();
-                else
-                    fut.onError(new IgniteCheckedException("Failed to gracefully rollback transaction: " + CU.txString(this)));
-            }
-            catch (IgniteCheckedException e) {
-                fut.onError(e);
-            }
+            fut.finish();
         }
         else {
             prepFut.listen(new CI1<IgniteInternalFuture<?>>() {
@@ -820,19 +834,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
 
                     GridNearTxFinishFuture fut0 = rollbackFut.get();
 
-                    try {
-                        if (finish(false) || state() == UNKNOWN)
-                            fut0.finish();
-                        else
-                            fut0.onError(new IgniteCheckedException("Failed to gracefully rollback transaction: " +
-                                CU.txString(GridNearTxLocal.this)));
-                    }
-                    catch (IgniteCheckedException e) {
-                        U.error(log, "Failed to gracefully rollback transaction: " +
-                            CU.txString(GridNearTxLocal.this), e);
-
-                        fut0.onError(e);
-                    }
+                    fut0.finish();
                 }
             });
         }
@@ -1253,4 +1255,4 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     @Override public String toString() {
         return S.toString(GridNearTxLocal.class, this, "mappings", mappings.keySet(), "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
index 4395198..87c68b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
@@ -106,8 +106,22 @@ public class GridNearTxRemote extends GridDistributedTxRemoteAdapter {
         @Nullable UUID subjId,
         int taskNameHash
     ) throws IgniteCheckedException {
-        super(ctx, nodeId, rmtThreadId, xidVer, commitVer, sys, plc, concurrency, isolation, invalidate, timeout,
-            txSize, subjId, taskNameHash);
+        super(
+            ctx, 
+            nodeId, 
+            rmtThreadId, 
+            xidVer, 
+            commitVer, 
+            sys, 
+            plc, 
+            concurrency, 
+            isolation, 
+            invalidate, 
+            timeout, 
+            txSize,
+            subjId, 
+            taskNameHash
+        );
 
         assert nearNodeId != null;
 
@@ -162,8 +176,22 @@ public class GridNearTxRemote extends GridDistributedTxRemoteAdapter {
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(ctx, nodeId, rmtThreadId, xidVer, commitVer, sys, plc, concurrency, isolation, invalidate, timeout,
-            txSize, subjId, taskNameHash);
+        super(
+            ctx, 
+            nodeId, 
+            rmtThreadId, 
+            xidVer, 
+            commitVer,
+            sys,
+            plc,
+            concurrency, 
+            isolation, 
+            invalidate, 
+            timeout, 
+            txSize,
+            subjId, 
+            taskNameHash
+        );
 
         assert nearNodeId != null;
 
@@ -383,4 +411,4 @@ public class GridNearTxRemote extends GridDistributedTxRemoteAdapter {
     @Override public String toString() {
         return GridToStringBuilder.toString(GridNearTxRemote.class, this, "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 1ad1064..88752a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -211,6 +211,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
     private AtomicBoolean preparing = new AtomicBoolean();
 
     /** */
+    @GridToStringInclude
     private Map<Integer, Set<Integer>> invalidParts = new HashMap<>(3);
 
     /**
@@ -293,6 +294,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash
@@ -312,6 +314,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
         this.timeout = timeout;
         this.invalidate = invalidate;
         this.storeEnabled = storeEnabled;
+        this.onePhaseCommit = onePhaseCommit;
         this.txSize = txSize;
         this.subjId = subjId;
         this.taskNameHash = taskNameHash;
@@ -2210,4 +2213,4 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
             return S.toString(TxShadow.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index d64b26e..9efa43a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -59,24 +59,24 @@ import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
 import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.util.future.GridCompoundFuture;
-import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
 import org.apache.ignite.internal.util.future.GridFinishedFuture;
-import org.apache.ignite.internal.util.lang.GridClosureException;
-import org.apache.ignite.internal.util.typedef.C2;
+import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CI2;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFutureCancelledException;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.UTILITY_CACHE_POOL;
 import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isNearEnabled;
+import static org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishFuture.FINISH_NEAR_ONE_PHASE_SINCE;
 import static org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx.FinalizationStatus.USER_FINISH;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
 import static org.apache.ignite.transactions.TransactionState.PREPARED;
 import static org.apache.ignite.transactions.TransactionState.ROLLED_BACK;
 import static org.apache.ignite.transactions.TransactionState.ROLLING_BACK;
@@ -211,41 +211,40 @@ public class IgniteTxHandler {
         final GridNearTxLocal locTx,
         final GridNearTxPrepareRequest req
     ) {
-        IgniteInternalFuture<Object> fut = new GridFinishedFuture<>(); // TODO force preload keys.
-
-        return new GridEmbeddedFuture<>(
-            fut,
-            new C2<Object, Exception, IgniteInternalFuture<GridNearTxPrepareResponse>>() {
-                @Override public IgniteInternalFuture<GridNearTxPrepareResponse> apply(Object o, Exception ex) {
-                    if (ex != null)
-                        throw new GridClosureException(ex);
-
-                    IgniteInternalFuture<GridNearTxPrepareResponse> fut = locTx.prepareAsyncLocal(
-                        req.reads(),
-                        req.writes(),
-                        req.transactionNodes(),
-                        req.last(),
-                        req.lastBackups());
-
-                    if (locTx.isRollbackOnly())
-                        locTx.rollbackAsync();
-
-                    return fut;
+        IgniteInternalFuture<GridNearTxPrepareResponse> fut = locTx.prepareAsyncLocal(
+            req.reads(),
+            req.writes(),
+            req.transactionNodes(),
+            req.last(),
+            req.lastBackups());
+
+        if (locTx.isRollbackOnly())
+            locTx.rollbackAsync();
+
+        return fut.chain(new C1<IgniteInternalFuture<GridNearTxPrepareResponse>, GridNearTxPrepareResponse>() {
+            @Override public GridNearTxPrepareResponse apply(IgniteInternalFuture<GridNearTxPrepareResponse> f) {
+                try {
+                    return f.get();
                 }
-            },
-            new C2<GridNearTxPrepareResponse, Exception, GridNearTxPrepareResponse>() {
-                @Nullable @Override public GridNearTxPrepareResponse apply(GridNearTxPrepareResponse res, Exception e) {
-                    if (e != null) {
-                        locTx.setRollbackOnly(); // Just in case.
-
-                        if (!(e instanceof IgniteTxOptimisticCheckedException))
-                            U.error(log, "Failed to prepare transaction: " + locTx, e);
-                    }
+                catch (Exception e) {
+                    locTx.setRollbackOnly(); // Just in case.
+
+                    if (!X.hasCause(e, IgniteTxOptimisticCheckedException.class) &&
+                        !X.hasCause(e, IgniteFutureCancelledException.class))
+                        U.error(log, "Failed to prepare DHT transaction: " + locTx, e);
 
-                    return res;
+                    return new GridNearTxPrepareResponse(
+                        req.version(),
+                        req.futureId(),
+                        req.miniId(),
+                        req.version(),
+                        req.version(),
+                        null,
+                        e,
+                        null);
                 }
             }
-        );
+        });
     }
 
     /**
@@ -303,7 +302,7 @@ public class IgniteTxHandler {
             GridDhtPartitionTopology top = null;
 
             if (req.firstClientRequest()) {
-                assert req.concurrency().equals(OPTIMISTIC) : req;
+                assert req.concurrency() == OPTIMISTIC : req;
                 assert CU.clientNode(nearNode) : nearNode;
 
                 top = firstEntry.context().topology();
@@ -333,7 +332,7 @@ public class IgniteTxHandler {
                     try {
                         ctx.io().send(nearNode, res, req.policy());
                     }
-                    catch (ClusterTopologyCheckedException e) {
+                    catch (ClusterTopologyCheckedException ignored) {
                         if (log.isDebugEnabled())
                             log.debug("Failed to send client tx remap response, client node failed " +
                                 "[node=" + nearNode + ", req=" + req + ']');
@@ -363,6 +362,7 @@ public class IgniteTxHandler {
                     req.timeout(),
                     req.isInvalidate(),
                     true,
+                    req.onePhaseCommit(),
                     req.txSize(),
                     req.transactionNodes(),
                     req.subjectId(),
@@ -389,6 +389,10 @@ public class IgniteTxHandler {
 
             tx.transactionNodes(req.transactionNodes());
 
+            // Set near on originating node flag only if the sender node has new version.
+            if (req.near() && FINISH_NEAR_ONE_PHASE_SINCE.compareTo(nearNode.version()) <= 0)
+                tx.nearOnOriginatingNode(true);
+
             if (req.onePhaseCommit()) {
                 assert req.last();
                 assert F.isEmpty(req.lastBackups()) || req.lastBackups().size() <= 1;
@@ -428,7 +432,8 @@ public class IgniteTxHandler {
                     catch (IgniteCheckedException e) {
                         tx0.setRollbackOnly(); // Just in case.
 
-                        if (!(e instanceof IgniteTxOptimisticCheckedException))
+                        if (!X.hasCause(e, IgniteTxOptimisticCheckedException.class) &&
+                            !X.hasCause(e, IgniteFutureCancelledException.class))
                             U.error(log, "Failed to prepare DHT transaction: " + tx0, e);
                     }
                 }
@@ -527,17 +532,32 @@ public class IgniteTxHandler {
         assert nodeId != null;
         assert res != null;
 
-        GridDhtTxFinishFuture fut = (GridDhtTxFinishFuture)ctx.mvcc().<IgniteInternalTx>future(res.xid(),
-            res.futureId());
+        if (res.checkCommitted()) {
+            GridNearTxFinishFuture fut = (GridNearTxFinishFuture)ctx.mvcc().<IgniteInternalTx>future(
+                res.xid(), res.futureId());
 
-        if (fut == null) {
-            if (log.isDebugEnabled())
-                log.debug("Received response for unknown future (will ignore): " + res);
+            if (fut == null) {
+                if (log.isDebugEnabled())
+                    log.debug("Received response for unknown future (will ignore): " + res);
 
-            return;
+                return;
+            }
+
+            fut.onResult(nodeId, res);
         }
+        else {
+            GridDhtTxFinishFuture fut = (GridDhtTxFinishFuture)ctx.mvcc().<IgniteInternalTx>future(
+                res.xid(), res.futureId());
 
-        fut.onResult(nodeId, res);
+            if (fut == null) {
+                if (log.isDebugEnabled())
+                    log.debug("Received response for unknown future (will ignore): " + res);
+
+                return;
+            }
+
+            fut.onResult(nodeId, res);
+        }
     }
 
     /**
@@ -653,42 +673,10 @@ public class IgniteTxHandler {
         }
 
         try {
-            if (req.commit()) {
-                if (tx == null) {
-                    // Create transaction and add entries.
-                    tx = ctx.tm().onCreated(null,
-                        new GridDhtTxLocal(
-                            ctx,
-                            nodeId,
-                            req.version(),
-                            req.futureId(),
-                            req.miniId(),
-                            req.threadId(),
-                            true,
-                            false, /* we don't know, so assume false. */
-                            req.system(),
-                            req.explicitLock(),
-                            req.policy(),
-                            PESSIMISTIC,
-                            READ_COMMITTED,
-                            /*timeout */0,
-                            req.isInvalidate(),
-                            req.storeEnabled(),
-                            req.txSize(),
-                            null,
-                            req.subjectId(),
-                            req.taskNameHash()));
-
-                    if (tx == null || !ctx.tm().onStarted(tx))
-                        throw new IgniteTxRollbackCheckedException("Attempt to start a completed transaction: " + req);
-
-                    tx.topologyVersion(req.topologyVersion());
-                }
-                else {
-                    if (req.explicitLock())
-                        tx.explicitLock(req.explicitLock());
-                }
+            assert tx != null : "Transaction is null for near finish request [nodeId=" +
+                nodeId + ", req=" + req + "]";
 
+            if (req.commit()) {
                 tx.storeEnabled(req.storeEnabled());
 
                 if (!tx.markFinalizing(USER_FINISH)) {
@@ -712,47 +700,17 @@ public class IgniteTxHandler {
                 return commitFut;
             }
             else {
-                assert tx != null || req.explicitLock() : "Transaction is null for near rollback request [nodeId=" +
-                    nodeId + ", req=" + req + "]";
-
-                if (tx != null) {
-                    tx.syncRollback(req.syncRollback());
-
-                    tx.nearFinishFutureId(req.futureId());
-                    tx.nearFinishMiniId(req.miniId());
+                tx.syncRollback(req.syncRollback());
 
-                    IgniteInternalFuture<IgniteInternalTx> rollbackFut = tx.rollbackAsync();
-
-                    // Only for error logging.
-                    rollbackFut.listen(CU.errorLogger(log));
-
-                    return rollbackFut;
-                }
-                else {
-                    // Always send finish response.
-                    GridCacheMessage res = new GridNearTxFinishResponse(req.version(), req.threadId(),
-                        req.futureId(), req.miniId(), null);
+                tx.nearFinishFutureId(req.futureId());
+                tx.nearFinishMiniId(req.miniId());
 
-                    try {
-                        ctx.io().send(nodeId, res, req.policy());
-                    }
-                    catch (Throwable e) {
-                        // Double-check.
-                        if (ctx.discovery().node(nodeId) == null) {
-                            if (log.isDebugEnabled())
-                                log.debug("Node left while sending finish response [nodeId=" + nodeId + ", res=" + res +
-                                    ']');
-                        }
-                        else
-                            U.error(log, "Failed to send finish response to node [nodeId=" + nodeId + ", " +
-                                "res=" + res + ']', e);
+                IgniteInternalFuture<IgniteInternalTx> rollbackFut = tx.rollbackAsync();
 
-                        if (e instanceof Error)
-                            throw (Error)e;
-                    }
+                // Only for error logging.
+                rollbackFut.listen(CU.errorLogger(log));
 
-                    return null;
-                }
+                return rollbackFut;
             }
         }
         catch (Throwable e) {
@@ -912,6 +870,12 @@ public class IgniteTxHandler {
         if (log.isDebugEnabled())
             log.debug("Processing dht tx finish request [nodeId=" + nodeId + ", req=" + req + ']');
 
+        if (req.checkCommitted()) {
+            sendReply(nodeId, req, checkDhtRemoteTxCommitted(req.version()));
+
+            return;
+        }
+
         GridDhtTxRemote dhtTx = ctx.tm().tx(req.version());
         GridNearTxRemote nearTx = ctx.tm().nearTx(req.version());
 
@@ -947,13 +911,33 @@ public class IgniteTxHandler {
                 completeFut.listen(new CI1<IgniteInternalFuture<IgniteInternalTx>>() {
                     @Override
                     public void apply(IgniteInternalFuture<IgniteInternalTx> igniteTxIgniteFuture) {
-                        sendReply(nodeId, req);
+                        sendReply(nodeId, req, true);
                     }
                 });
             }
             else
-                sendReply(nodeId, req);
+                sendReply(nodeId, req, true);
         }
+        else
+            sendReply(nodeId, req, true);
+    }
+
+    /**
+     * Checks whether DHT remote transaction with given version has been committed. If not, will add version
+     * to rollback version set so that late response will not falsely commit this transaction.
+     *
+     * @param writeVer Write version to check.
+     * @return {@code True} if transaction has been committed, {@code false} otherwise.
+     */
+    public boolean checkDhtRemoteTxCommitted(GridCacheVersion writeVer) {
+        assert writeVer != null;
+
+        boolean committed = true;
+
+        if (ctx.tm().addRolledbackTx(writeVer))
+            committed = false;
+
+        return committed;
     }
 
     /**
@@ -988,15 +972,14 @@ public class IgniteTxHandler {
 
         try {
             if (req.commit() || req.isSystemInvalidate()) {
-                if (tx.commitVersion(req.commitVersion())) {
-                    tx.invalidate(req.isInvalidate());
-                    tx.systemInvalidate(req.isSystemInvalidate());
+                tx.commitVersion(req.commitVersion());
+                tx.invalidate(req.isInvalidate());
+                tx.systemInvalidate(req.isSystemInvalidate());
 
-                    // Complete remote candidates.
-                    tx.doneRemote(req.baseVersion(), null, null, null);
+                // Complete remote candidates.
+                tx.doneRemote(req.baseVersion(), null, null, null);
 
-                    tx.commit();
-                }
+                tx.commit();
             }
             else {
                 tx.doneRemote(req.baseVersion(), null, null, null);
@@ -1067,23 +1050,33 @@ public class IgniteTxHandler {
      * @param nodeId Node id that originated finish request.
      * @param req Request.
      */
-    protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req) {
-        GridCacheMessage res = new GridDhtTxFinishResponse(req.version(), req.futureId(), req.miniId());
+    protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committed) {
+        if (req.replyRequired()) {
+            GridDhtTxFinishResponse res = new GridDhtTxFinishResponse(req.version(), req.futureId(), req.miniId());
 
-        try {
-            ctx.io().send(nodeId, res, req.system() ? UTILITY_CACHE_POOL : SYSTEM_POOL);
-        }
-        catch (Throwable e) {
-            // Double-check.
-            if (ctx.discovery().node(nodeId) == null) {
-                if (log.isDebugEnabled())
-                    log.debug("Node left while sending finish response [nodeId=" + nodeId + ", res=" + res + ']');
+            if (req.checkCommitted()) {
+                res.checkCommitted(true);
+
+                if (!committed)
+                    res.checkCommittedError(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
+                        "(transaction has been rolled back on backup node): " + req.version()));
             }
-            else
-                U.error(log, "Failed to send finish response to node [nodeId=" + nodeId + ", res=" + res + ']', e);
 
-            if (e instanceof Error)
-                throw (Error)e;
+            try {
+                ctx.io().send(nodeId, res, req.system() ? UTILITY_CACHE_POOL : SYSTEM_POOL);
+            }
+            catch (Throwable e) {
+                // Double-check.
+                if (ctx.discovery().node(nodeId) == null) {
+                    if (log.isDebugEnabled())
+                        log.debug("Node left while sending finish response [nodeId=" + nodeId + ", res=" + res + ']');
+                }
+                else
+                    U.error(log, "Failed to send finish response to node [nodeId=" + nodeId + ", res=" + res + ']', e);
+
+                if (e instanceof Error)
+                    throw (Error)e;
+            }
         }
     }
 
@@ -1188,8 +1181,14 @@ public class IgniteTxHandler {
             // in prepare phase will get properly ordered as well.
             tx.prepare();
 
-            if (req.last())
+            if (req.last()) {
+                assert !F.isEmpty(req.transactionNodes()) :
+                    "Received last prepare request with empty transaction nodes: " + req;
+
+                tx.transactionNodes(req.transactionNodes());
+
                 tx.state(PREPARED);
+            }
 
             res.invalidPartitionsByCacheId(tx.invalidPartitions());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 7d32401..00b91dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -196,12 +196,29 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(cctx, xidVer, implicit, implicitSingle, /*local*/true, sys, plc, concurrency, isolation, timeout,
-            invalidate, storeEnabled, txSize, subjId, taskNameHash);
+        super(
+            cctx, 
+            xidVer, 
+            implicit, 
+            implicitSingle, 
+            /*local*/true, 
+            sys, 
+            plc,
+            concurrency, 
+            isolation, 
+            timeout,
+            invalidate,
+            storeEnabled, 
+            onePhaseCommit, 
+            txSize, 
+            subjId, 
+            taskNameHash
+        );
 
         minVer = xidVer;
     }
@@ -986,6 +1003,10 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                             log.debug("Ignoring READ entry when committing: " + txEntry);
                                     }
                                     else {
+                                        assert ownsLock(txEntry.cached()):
+                                            "Transaction does not own lock for group lock entry during  commit [tx=" +
+                                                this + ", txEntry=" + txEntry + ']';
+
                                         if (conflictCtx == null || !conflictCtx.isUseOld()) {
                                             if (txEntry.ttl() != CU.TTL_NOT_CHANGED)
                                                 cached.updateTtl(null, txEntry.ttl());
@@ -1085,14 +1106,17 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
     /**
      * Commits transaction to transaction manager. Used for one-phase commit transactions only.
      */
-    public void tmCommit() {
+    public void tmFinish(boolean commit) {
         assert onePhaseCommit();
 
         if (doneFlag.compareAndSet(false, true)) {
             // Unlock all locks.
-            cctx.tm().commitTx(this);
+            if (commit)
+                cctx.tm().commitTx(this);
+            else
+                cctx.tm().rollbackTx(this);
 
-            state(COMMITTED);
+            state(commit ? COMMITTED : ROLLED_BACK);
 
             boolean needsCompletedVersions = needsCompletedVersions();
 
@@ -1386,7 +1410,6 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 null,
                                 skipStore);
 
-
                             // As optimization, mark as checked immediately
                             // for non-pessimistic if value is not null.
                             if (val != null && !pessimistic())
@@ -3785,4 +3808,4 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
          */
         abstract T finish(T t) throws IgniteCheckedException;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index b28225d..4074eee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -415,7 +415,8 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         TransactionIsolation isolation,
         long timeout,
         boolean storeEnabled,
-        int txSize) {
+        int txSize
+    ) {
         assert sysCacheCtx == null || sysCacheCtx.systemTx();
 
         UUID subjId = null; // TODO GG-9141 how to get subj ID?
@@ -692,7 +693,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     /**
      * @return Any transaction associated with the current thread.
      */
-    public IgniteInternalTx anyActiveThreadTx() {
+    public IgniteInternalTx anyActiveThreadTx(IgniteInternalTx ignore) {
         long threadId = Thread.currentThread().getId();
 
         IgniteInternalTx tx = threadMap.get(threadId);
@@ -706,7 +707,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
 
             tx = sysThreadMap.get(new TxThreadKey(threadId, cacheCtx.cacheId()));
 
-            if (tx != null && tx.topologyVersionSnapshot() != null)
+            if (tx != null && tx != ignore && tx.topologyVersionSnapshot() != null)
                 return tx;
         }
 
@@ -1067,7 +1068,12 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      * @return If transaction was not already present in committed set.
      */
     public boolean addCommittedTx(IgniteInternalTx tx) {
-        return addCommittedTx(tx.xidVersion(), tx.nearXidVersion());
+        boolean res = addCommittedTx(tx.xidVersion(), tx.nearXidVersion());
+
+        if (!tx.local() && !tx.near() && tx.onePhaseCommit())
+            addCommittedTx(tx.nearXidVersion(), null);
+
+        return res;
     }
 
     /**
@@ -1261,9 +1267,12 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         if (!((committed != null && committed) || tx.writeSet().isEmpty() || tx.isSystemInvalidate())) {
             uncommitTx(tx);
 
+            GridCacheVersion first = completedVers.isEmpty() ? null : completedVers.firstKey();
+            GridCacheVersion last = completedVers.isEmpty() ? null : completedVers.lastKey();
+
             throw new IgniteException("Missing commit version (consider increasing " +
                 IGNITE_MAX_COMPLETED_TX_COUNT + " system property) [ver=" + tx.xidVersion() + ", firstVer=" +
-                completedVers.firstKey() + ", lastVer=" + completedVers.lastKey() + ", tx=" + tx.xid() + ']');
+                first + ", lastVer=" + last + ", tx=" + tx.xid() + ']');
         }
 
         ConcurrentMap<GridCacheVersion, IgniteInternalTx> txIdMap = transactionMap(tx);
@@ -1786,13 +1795,13 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * @param ver Version.
+     * @param xidVer Version.
      * @return Future for flag indicating if transactions was committed.
      */
-    public IgniteInternalFuture<Boolean> txCommitted(GridCacheVersion ver) {
+    public IgniteInternalFuture<Boolean> txCommitted(GridCacheVersion xidVer) {
         final GridFutureAdapter<Boolean> resFut = new GridFutureAdapter<>();
 
-        final IgniteInternalTx tx = cctx.tm().tx(ver);
+        final IgniteInternalTx tx = cctx.tm().tx(xidVer);
 
         if (tx != null) {
             assert tx.near() && tx.local() : tx;
@@ -1814,7 +1823,22 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             return resFut;
         }
 
-        Boolean committed = completedVers.get(ver);
+        Boolean committed = null;
+
+        for (Map.Entry<GridCacheVersion, Boolean> entry : completedVers.entrySet()) {
+            if (entry.getValue() == null)
+                continue;
+
+            if (entry.getKey() instanceof CommittedVersion) {
+                CommittedVersion comm = (CommittedVersion)entry.getKey();
+
+                if (comm.nearVer.equals(xidVer)) {
+                    committed = entry.getValue();
+
+                    break;
+                }
+            }
+        }
 
         if (log.isDebugEnabled())
             log.debug("Near transaction committed: " + committed);
@@ -2030,9 +2054,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             try {
                 cctx.kernalContext().gateway().readLock();
             }
-            catch (IllegalStateException | IgniteClientDisconnectedException ignore) {
+            catch (IllegalStateException | IgniteClientDisconnectedException e) {
                 if (log.isDebugEnabled())
-                    log.debug("Failed to acquire kernal gateway [err=" + ignore + ']');
+                    log.debug("Failed to acquire kernal gateway [err=" + e + ']');
 
                 return;
             }
@@ -2213,4 +2237,4 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             }
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 0025f6bf..a5561e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -492,18 +492,28 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
         if (!create)
             return c.applyx();
 
-        try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
-            err = utilityCache.invoke(DATA_STRUCTURES_KEY, new AddAtomicProcessor(dsInfo)).get();
+        while (true) {
+            try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
+                err = utilityCache.invoke(DATA_STRUCTURES_KEY, new AddAtomicProcessor(dsInfo)).get();
 
-            if (err != null)
-                throw err;
+                if (err != null)
+                    throw err;
 
-            dataStructure = c.applyx();
+                dataStructure = c.applyx();
 
-            tx.commit();
-        }
+                tx.commit();
+
+                return dataStructure;
+            }
+            catch (ClusterTopologyCheckedException e) {
+                IgniteInternalFuture<?> fut = e.retryReadyFuture();
 
-        return dataStructure;
+                fut.get();
+            }
+            catch (IgniteTxRollbackCheckedException ignore) {
+                // Safe to retry right away.
+            }
+        }
     }
 
     /**
@@ -559,31 +569,39 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
         if (err != null)
             throw err;
 
-        T rmvInfo;
+        while (true) {
+            try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
+                T2<Boolean, IgniteCheckedException> res =
+                    utilityCache.invoke(DATA_STRUCTURES_KEY, new RemoveDataStructureProcessor(dsInfo)).get();
 
-        try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
-            T2<Boolean, IgniteCheckedException> res =
-                utilityCache.invoke(DATA_STRUCTURES_KEY, new RemoveDataStructureProcessor(dsInfo)).get();
+                err = res.get2();
 
-            err = res.get2();
+                if (err != null)
+                    throw err;
 
-            if (err != null)
-                throw err;
+                assert res.get1() != null;
 
-            assert res.get1() != null;
+                boolean exists = res.get1();
 
-            boolean exists = res.get1();
+                if (!exists)
+                    return;
 
-            if (!exists)
-                return;
+                T rmvInfo = c.applyx();
 
-            rmvInfo = c.applyx();
+                tx.commit();
 
-            tx.commit();
-        }
+                if (afterRmv != null && rmvInfo != null)
+                    afterRmv.applyx(rmvInfo);
+            }
+            catch (ClusterTopologyCheckedException e) {
+                IgniteInternalFuture<?> fut = e.retryReadyFuture();
 
-        if (afterRmv != null && rmvInfo != null)
-            afterRmv.applyx(rmvInfo);
+                fut.get();
+            }
+            catch (IgniteTxRollbackCheckedException ignore) {
+                // Safe to retry right away.
+            }
+        }
     }
 
     /**
@@ -953,27 +971,35 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
             return c.applyx(cacheCtx);
         }
 
-        T col;
+        while (true) {
+            try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
+                T2<String, IgniteCheckedException> res =
+                    utilityCache.invoke(DATA_STRUCTURES_KEY, new AddCollectionProcessor(dsInfo)).get();
 
-        try (IgniteInternalTx tx = utilityCache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) {
-            T2<String, IgniteCheckedException> res =
-                utilityCache.invoke(DATA_STRUCTURES_KEY, new AddCollectionProcessor(dsInfo)).get();
+                err = res.get2();
 
-            err = res.get2();
+                if (err != null)
+                    throw err;
 
-            if (err != null)
-                throw err;
+                String cacheName = res.get1();
 
-            String cacheName = res.get1();
+                final GridCacheContext cacheCtx = ctx.cache().internalCache(cacheName).context();
 
-            final GridCacheContext cacheCtx = ctx.cache().internalCache(cacheName).context();
+                T col = c.applyx(cacheCtx);
 
-            col = c.applyx(cacheCtx);
+                tx.commit();
 
-            tx.commit();
-        }
+                return col;
+            }
+            catch (ClusterTopologyCheckedException e) {
+                IgniteInternalFuture<?> fut = e.retryReadyFuture();
 
-        return col;
+                fut.get();
+            }
+            catch (IgniteTxRollbackCheckedException ignore) {
+                // Safe to retry right away.
+            }
+        }
     }
 
     /**
@@ -2060,4 +2086,4 @@ public final class DataStructuresProcessor extends GridProcessorAdapter {
             return S.toString(RemoveDataStructureProcessor.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
index 94cbfbd..c7750a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridTransactionalCacheQueueImpl.java
@@ -22,19 +22,22 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.transactions.TransactionRollbackException;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
 import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
 
 /**
- * {@link org.apache.ignite.IgniteQueue} implementation using transactional cache.
+ * {@link IgniteQueue} implementation using transactional cache.
  */
 public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T> {
     /**
@@ -76,7 +79,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
                         break;
                     }
                 }
-                catch (ClusterTopologyCheckedException e) {
+                catch (ClusterTopologyCheckedException | TransactionRollbackException | IgniteTxRollbackCheckedException e) {
                     if (e instanceof ClusterGroupEmptyCheckedException)
                         throw e;
 
@@ -123,14 +126,14 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
 
                     break;
                 }
-                catch (ClusterTopologyCheckedException e) {
+                catch (ClusterTopologyCheckedException | TransactionRollbackException | IgniteTxRollbackCheckedException e) {
                     if (e instanceof ClusterGroupEmptyCheckedException)
                         throw e;
 
                     if (cnt++ == MAX_UPDATE_RETRIES)
                         throw e;
                     else {
-                        U.warn(log, "Failed to add item, will retry [err=" + e + ']');
+                        U.warn(log, "Failed to poll item, will retry [err=" + e + ']');
 
                         U.sleep(RETRY_DELAY);
                     }
@@ -180,7 +183,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
 
                     break;
                 }
-                catch (ClusterTopologyCheckedException e) {
+                catch (ClusterTopologyCheckedException | TransactionRollbackException | IgniteTxRollbackCheckedException e) {
                     if (e instanceof ClusterGroupEmptyCheckedException)
                         throw e;
 
@@ -223,7 +226,7 @@ public class GridTransactionalCacheQueueImpl<T> extends GridCacheQueueAdapter<T>
 
                     break;
                 }
-                catch (ClusterTopologyCheckedException e) {
+                catch (ClusterTopologyCheckedException | TransactionRollbackException | IgniteTxRollbackCheckedException e) {
                     if (e instanceof ClusterGroupEmptyCheckedException)
                         throw e;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
index 5f083b6..9cf1da4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFileAffinityRange.java
@@ -274,7 +274,6 @@ public class IgfsFileAffinityRange implements Message, Externalizable {
                 writer.incrementState();
 
             case 1:
-                // The field 'done' was removed, but its writing preserved for compatibility reasons.
                 if (!writer.writeBoolean("done", done))
                     return false;
 
@@ -320,7 +319,6 @@ public class IgfsFileAffinityRange implements Message, Externalizable {
                 reader.incrementState();
 
             case 1:
-                // field 'done' was removed, but reading preserved for compatibility reasons.
                 done = reader.readBoolean("done");
 
                 if (!reader.isLastRead())
@@ -371,4 +369,4 @@ public class IgfsFileAffinityRange implements Message, Externalizable {
     @Override public String toString() {
         return S.toString(IgfsFileAffinityRange.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
index 9054297..fa3c9a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
@@ -148,6 +148,8 @@ public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNoConfiguration() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-1377");
+
         portables().toPortable(new TestObject3());
 
         assertNotNull(portables().metadata(TestObject3.class));

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
index 0f16862..9c4b7b2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
@@ -26,6 +26,7 @@ import javax.cache.configuration.Factory;
 import javax.cache.integration.CacheLoaderException;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cache.store.CacheStore;
@@ -104,6 +105,7 @@ public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbs
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode());
+        ccfg.setAtomicWriteOrderMode(CacheAtomicWriteOrderMode.PRIMARY);
         ccfg.setBackups(1);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
@@ -220,10 +222,16 @@ public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbs
 
         Transaction tx = tc != null ? ignite.transactions().txStart(tc, REPEATABLE_READ) : null;
 
-        cache.put(key, key);
+        try {
+            cache.put(key, key);
 
-        if (tx != null)
-            tx.commit();
+            if (tx != null)
+                tx.commit();
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
 
         boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override
@@ -310,4 +318,4 @@ public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbs
             // No-op.
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index faebcfe..3e646d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -64,6 +64,7 @@ import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
 import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
 import org.apache.ignite.internal.util.typedef.CIX1;
 import org.apache.ignite.internal.util.typedef.F;
@@ -2866,6 +2867,53 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @param keys0 Keys to check.
+     * @throws IgniteCheckedException If failed.
+     */
+    protected void checkUnlocked(final Collection<String> keys0) throws IgniteCheckedException {
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                try {
+                    for (int i = 0; i < gridCount(); i++) {
+                        GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache();
+
+                        for (String key : keys0) {
+                            GridCacheEntryEx entry = cache.peekEx(key);
+
+                            if (entry != null) {
+                                if (entry.lockedByAny()) {
+                                    info("Entry is still locked [i=" + i + ", entry=" + entry + ']');
+
+                                    return false;
+                                }
+                            }
+
+                            if (cache.isNear()) {
+                                entry = cache.context().near().dht().peekEx(key);
+
+                                if (entry != null) {
+                                    if (entry.lockedByAny()) {
+                                        info("Entry is still locked [i=" + i + ", entry=" + entry + ']');
+
+                                        return false;
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                    return true;
+                }
+                catch (GridCacheEntryRemovedException ignore) {
+                    info("Entry was removed, will retry");
+
+                    return false;
+                }
+            }
+        }, 10_000);
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testGlobalClearAll() throws Exception {
@@ -5173,4 +5221,4 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         /** */
         ONE_BY_ONE
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
index f2bb8fa..cdf8eca 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
@@ -1650,7 +1650,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * @param vers Ordered versions.
      */
     private void checkOrder(Collection<GridCacheMvccCandidate> cands, GridCacheVersion... vers) {
-        assert cands.size() == vers.length;
+        assertEquals(vers.length, cands.size());
 
         int i = 0;
 
@@ -1841,4 +1841,4 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
         for (GridCacheMvccCandidate c : cands)
             info(">>> " + c);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index 26911a3..b401907 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -358,6 +358,32 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
 
             info(">>> Absent keys: " + absentKeys);
 
+            if (!F.isEmpty(absentKeys)) {
+                for (Ignite g : runningWorkers) {
+                    IgniteKernal k = (IgniteKernal)g;
+
+                    info(">>>> Entries on node: " + k.getLocalNodeId());
+
+                    GridCacheAdapter<Object, Object> cache = k.internalCache("partitioned");
+
+                    for (Integer key : absentKeys) {
+                        GridCacheEntryEx entry = cache.peekEx(key);
+
+                        if (entry != null)
+                            info(" >>> " + entry);
+
+                        if (cache.context().isNear()) {
+                            GridCacheEntryEx entry0 = cache.context().near().dht().peekEx(key);
+
+                            if (entry0 != null)
+                                info(" >>> " + entry);
+                        }
+                    }
+
+                    info("");
+                }
+            }
+
             assertTrue(absentKeys.isEmpty());
 
             // Actual primary cache size.
@@ -746,4 +772,4 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
             return failedOverJobs;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePutAllRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePutAllRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePutAllRestartTest.java
index c5ad4ec..fc14085 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePutAllRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePutAllRestartTest.java
@@ -161,6 +161,8 @@ public class IgniteCachePutAllRestartTest extends GridCommonAbstractTest {
 
             final Ignite ignite = ignite(node);
 
+            info("Running iteration on the node [idx=" + node + ", nodeId=" + ignite.cluster().localNode().id() + ']');
+
             IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
                 @Override public Void call() throws Exception {
                     Thread.currentThread().setName("put-thread");


[06/41] ignite git commit: IGNITE-1408: Fixed POJO code generation: duplicate asc/desc fields. Fixed SQLXML JDBC type mapping to correct java type: String.

Posted by ag...@apache.org.
IGNITE-1408: Fixed POJO code generation: duplicate asc/desc fields. Fixed SQLXML JDBC type mapping to correct java type: String.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d26f7466
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d26f7466
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d26f7466

Branch: refs/heads/ignite-1400
Commit: d26f74662486516d72cfa704e70abc37e11c0123
Parents: b8be85d
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Sep 11 15:44:11 2015 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Sep 11 15:44:11 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/schema/generator/CodeGenerator.java     | 4 ++--
 .../java/org/apache/ignite/schema/model/PojoDescriptor.java   | 6 ++++--
 .../ignite/schema/parser/dialect/OracleMetadataDialect.java   | 7 +++++--
 3 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d26f7466/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
index a278a56..f1119cf 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
@@ -571,7 +571,7 @@ public class CodeGenerator {
     private static boolean addQueryFields(Collection<String> src, Collection<PojoField> fields, String varName,
         String mtdName, String comment, boolean first) {
         if (fields.isEmpty())
-            return true;
+            return first;
 
         add2(src, comment);
         add2(src, (first ? "Map<String, Class<?>> " : "") + varName + " = new LinkedHashMap<>();");
@@ -739,4 +739,4 @@ public class CodeGenerator {
 
         write(src, cacheCfg);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/d26f7466/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
index c092c50..d84643b 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
@@ -56,6 +56,7 @@ import static java.sql.Types.NUMERIC;
 import static java.sql.Types.NVARCHAR;
 import static java.sql.Types.REAL;
 import static java.sql.Types.SMALLINT;
+import static java.sql.Types.SQLXML;
 import static java.sql.Types.TIME;
 import static java.sql.Types.TIMESTAMP;
 import static java.sql.Types.TINYINT;
@@ -529,6 +530,7 @@ public class PojoDescriptor {
             case LONGNVARCHAR:
             case CLOB:
             case NCLOB:
+            case SQLXML:
                 return String.class;
 
             case DATE:
@@ -541,9 +543,9 @@ public class PojoDescriptor {
                 return java.sql.Timestamp.class;
 
             // BINARY, VARBINARY, LONGVARBINARY, ARRAY, BLOB, NULL, DATALINK
-            // OTHER, JAVA_OBJECT, DISTINCT, STRUCT, REF, ROWID, SQLXML
+            // OTHER, JAVA_OBJECT, DISTINCT, STRUCT, REF, ROWID
             default:
                 return Object.class;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/d26f7466/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
index 2d4cf24..cf7e979 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
@@ -48,6 +48,7 @@ import static java.sql.Types.LONGVARCHAR;
 import static java.sql.Types.NUMERIC;
 import static java.sql.Types.OTHER;
 import static java.sql.Types.SMALLINT;
+import static java.sql.Types.SQLXML;
 import static java.sql.Types.TIMESTAMP;
 import static java.sql.Types.TINYINT;
 import static java.sql.Types.VARCHAR;
@@ -212,8 +213,10 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
 
                 case "CLOB":
                 case "NCLOB":
-                case "XMLTYPE":
                     return CLOB;
+
+                case "XMLTYPE":
+                    return SQLXML;
             }
         }
 
@@ -352,4 +355,4 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
 
         return tbls;
     }
-}
\ No newline at end of file
+}


[32/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
deleted file mode 100644
index 0d7160f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Writer for portable object used in {@link PortableMarshalAware} implementations.
- * Useful for the cases when user wants a fine-grained control over serialization.
- * <p>
- * Note that Ignite never writes full strings for field or type names. Instead,
- * for performance reasons, Ignite writes integer hash codes for type and field names.
- * It has been tested that hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide, Ignite provides {@link PortableIdMapper} which
- * allows to override the automatically generated hash code IDs for the type and field names.
- */
-public interface PortableWriter {
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeByte(String fieldName, byte val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeShort(String fieldName, short val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeInt(String fieldName, int val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeLong(String fieldName, long val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeFloat(String fieldName, float val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDouble(String fieldName, double val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeChar(String fieldName, char val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeBoolean(String fieldName, boolean val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeString(String fieldName, @Nullable String val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val UUID to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Date to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDate(String fieldName, @Nullable Date val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Timestamp to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param obj Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeObject(String fieldName, @Nullable Object obj) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param col Collection to write.
-     * @throws PortableException In case of error.
-     */
-    public <T> void writeCollection(String fieldName, @Nullable Collection<T> col) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param map Map to write.
-     * @throws PortableException In case of error.
-     */
-    public <K, V> void writeMap(String fieldName, @Nullable Map<K, V> map) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public <T extends Enum<?>> void writeEnum(String fieldName, T val) throws PortableException;
-
-    /**
-     * @param fieldName Field name.
-     * @param val Value to write.
-     * @throws PortableException In case of error.
-     */
-    public <T extends Enum<?>> void writeEnumArray(String fieldName, T[] val) throws PortableException;
-
-    /**
-     * Gets raw writer. Raw writer does not write field name hash codes, therefore,
-     * making the format even more compact. However, if the raw writer is used,
-     * dynamic structure changes to the portable objects are not supported.
-     *
-     * @return Raw writer.
-     */
-    public PortableRawWriter rawWriter();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/package-info.java b/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
deleted file mode 100644
index 0105b15..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains portable objects API classes.
- */
-package org.apache.ignite.portable;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 70c32e5..36ac156 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1572,10 +1572,10 @@ org.apache.ignite.plugin.security.SecuritySubject
 org.apache.ignite.plugin.security.SecuritySubjectType
 org.apache.ignite.plugin.segmentation.SegmentationPolicy
 org.apache.ignite.plugin.segmentation.SegmentationResolver
-org.apache.ignite.portable.PortableException
-org.apache.ignite.portable.PortableInvalidClassException
-org.apache.ignite.portable.PortableObject
-org.apache.ignite.portable.PortableProtocolVersion
+org.apache.ignite.internal.portable.api.PortableException
+org.apache.ignite.internal.portable.api.PortableInvalidClassException
+org.apache.ignite.internal.portable.api.PortableObject
+org.apache.ignite.internal.portable.api.PortableProtocolVersion
 org.apache.ignite.services.Service
 org.apache.ignite.services.ServiceConfiguration
 org.apache.ignite.services.ServiceContext

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index 82da10f..dc73cff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -159,51 +159,6 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
     }
 
     /**
-     * @throws Exception If failed.
-     */
-    public void testDifferentPortableProtocolVersions() throws Exception {
-        startGridWithPortableProtocolVer("VER_99_99_99");
-
-        try {
-            startGrid(1);
-
-            fail();
-        }
-        catch (IgniteCheckedException e) {
-            if (!e.getCause().getMessage().startsWith("Remote node has portable protocol version different from local"))
-                throw e;
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNullPortableProtocolVersion() throws Exception {
-        startGridWithPortableProtocolVer(null);
-
-        // Must not fail in order to preserve backward compatibility with the nodes that don't have this property yet.
-        startGrid(1);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void startGridWithPortableProtocolVer(String ver) throws Exception {
-        Ignite ignite = startGrid(0);
-
-        ClusterNode clusterNode = ignite.cluster().localNode();
-
-        Field f = clusterNode.getClass().getDeclaredField("attrs");
-        f.setAccessible(true);
-
-        Map<String, Object> attrs = new HashMap<>((Map<String, Object>)f.get(clusterNode));
-
-        attrs.put(IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER, ver);
-
-        f.set(clusterNode, attrs);
-    }
-
-    /**
      * @param preferIpV4 {@code java.net.preferIPv4Stack} system property value.
      * @throws Exception If failed.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
deleted file mode 100644
index 59084db..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import java.util.Collections;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.affinity.GridAffinityProcessor;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.CacheObjectContext;
-import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.lang.IgniteRunnable;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Test for portable object affinity key.
- */
-public class GridPortableAffinityKeySelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final AtomicReference<UUID> nodeId = new AtomicReference<>();
-
-    /** VM ip finder for TCP discovery. */
-    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static int GRID_CNT = 5;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
-        typeCfg.setClassName(TestObject.class.getName());
-        typeCfg.setAffinityKeyFieldName("affKey");
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Collections.singleton(typeCfg));
-
-        cfg.setMarshaller(marsh);
-
-        if (!gridName.equals(getTestGridName(GRID_CNT))) {
-            CacheConfiguration cacheCfg = new CacheConfiguration();
-
-            cacheCfg.setCacheMode(PARTITIONED);
-
-            cfg.setCacheConfiguration(cacheCfg);
-        }
-
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGridsMultiThreaded(GRID_CNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAffinity() throws Exception {
-        checkAffinity(grid(0));
-
-        try (Ignite igniteNoCache = startGrid(GRID_CNT)) {
-            try {
-                igniteNoCache.cache(null);
-            }
-            catch (IllegalArgumentException ignore) {
-                // Expected error.
-            }
-
-            checkAffinity(igniteNoCache);
-        }
-    }
-
-    /**
-     * @param ignite Ignite.
-     * @throws Exception If failed.
-     */
-    private void checkAffinity(Ignite ignite) throws Exception {
-        Affinity<Object> aff = ignite.affinity(null);
-
-        GridAffinityProcessor affProc = ((IgniteKernal)ignite).context().affinity();
-
-        IgniteCacheObjectProcessor cacheObjProc = ((IgniteKernal)ignite).context().cacheObjects();
-
-        CacheObjectContext cacheObjCtx = cacheObjProc.contextForCache(
-            ignite.cache(null).getConfiguration(CacheConfiguration.class));
-
-        for (int i = 0; i < 1000; i++) {
-            assertEquals(i, aff.affinityKey(i));
-
-            assertEquals(i, aff.affinityKey(new TestObject(i)));
-
-            CacheObject cacheObj = cacheObjProc.toCacheObject(cacheObjCtx, new TestObject(i), true);
-
-            assertEquals(i, aff.affinityKey(cacheObj));
-
-            assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(new TestObject(i)));
-
-            assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(cacheObj));
-
-            assertEquals(i, affProc.affinityKey(null, i));
-
-            assertEquals(i, affProc.affinityKey(null, new TestObject(i)));
-
-            assertEquals(i, affProc.affinityKey(null, cacheObj));
-
-            assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, new TestObject(i)));
-
-            assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, cacheObj));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAffinityRun() throws Exception {
-        Affinity<Object> aff = grid(0).affinity(null);
-
-        for (int i = 0; i < 1000; i++) {
-            nodeId.set(null);
-
-            grid(0).compute().affinityRun(null, new TestObject(i), new IgniteRunnable() {
-                @IgniteInstanceResource
-                private Ignite ignite;
-
-                @Override public void run() {
-                    nodeId.set(ignite.configuration().getNodeId());
-                }
-            });
-
-            assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAffinityCall() throws Exception {
-        Affinity<Object> aff = grid(0).affinity(null);
-
-        for (int i = 0; i < 1000; i++) {
-            nodeId.set(null);
-
-            grid(0).compute().affinityCall(null, new TestObject(i), new IgniteCallable<Object>() {
-                @IgniteInstanceResource
-                private Ignite ignite;
-
-                @Override public Object call() {
-                    nodeId.set(ignite.configuration().getNodeId());
-
-                    return null;
-                }
-            });
-
-            assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
-        }
-    }
-
-    /**
-     */
-    private static class TestObject {
-        /** */
-        @SuppressWarnings("UnusedDeclaration")
-        private int affKey;
-
-        /**
-         */
-        private TestObject() {
-            // No-op.
-        }
-
-        /**
-         * @param affKey Affinity key.
-         */
-        private TestObject(int affKey) {
-            this.affKey = affKey;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
deleted file mode 100644
index 61ec714..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
+++ /dev/null
@@ -1,1226 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.portable.builder.PortableBuilderEnum;
-import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableMarshalerAwareTestClass;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
-import org.apache.ignite.internal.processors.cache.portable.IgnitePortablesImpl;
-import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assert;
-
-import static org.apache.ignite.cache.CacheMode.REPLICATED;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.Address;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.AddressBook;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.Company;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectAllTypes;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectArrayList;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectContainer;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectEnum;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectInner;
-import static org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectOuter;
-
-/**
- *
- */
-public class GridPortableBuilderAdditionalSelfTest extends GridCommonAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration cacheCfg = new CacheConfiguration();
-
-        cacheCfg.setCacheMode(REPLICATED);
-
-        cfg.setCacheConfiguration(cacheCfg);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList("org.apache.ignite.internal.portable.mutabletest.*"));
-
-        marsh.setConvertStringToBytes(useUtf8());
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrids(1);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        jcache(0).clear();
-    }
-
-    /**
-     * @return Whether to use UTF8 strings.
-     */
-    protected boolean useUtf8() {
-        return true;
-    }
-
-    /**
-     * @return Portables API.
-     */
-    protected IgnitePortables portables() {
-        return grid(0).portables();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSimpleTypeFieldRead() throws Exception {
-        TestObjectAllTypes exp = new TestObjectAllTypes();
-
-        exp.setDefaultData();
-
-        PortableBuilder mutPo = wrap(exp);
-
-        for (Field field : TestObjectAllTypes.class.getDeclaredFields()) {
-            Object expVal = field.get(exp);
-            Object actVal = mutPo.getField(field.getName());
-
-            switch (field.getName()) {
-                case "anEnum":
-                    assertEquals(((PortableBuilderEnum)actVal).getOrdinal(), ((Enum)expVal).ordinal());
-                    break;
-
-                case "enumArr": {
-                    PortableBuilderEnum[] actArr = (PortableBuilderEnum[])actVal;
-                    Enum[] expArr = (Enum[])expVal;
-
-                    assertEquals(expArr.length, actArr.length);
-
-                    for (int i = 0; i < actArr.length; i++)
-                        assertEquals(expArr[i].ordinal(), actArr[i].getOrdinal());
-
-                    break;
-                }
-
-                case "entry":
-                    assertEquals(((Map.Entry)expVal).getKey(), ((Map.Entry)actVal).getKey());
-                    assertEquals(((Map.Entry)expVal).getValue(), ((Map.Entry)actVal).getValue());
-                    break;
-
-                default:
-                    assertTrue(field.getName(), Objects.deepEquals(expVal, actVal));
-                    break;
-            }
-        }
-    }
-
-    /**
-     *
-     */
-    public void testSimpleTypeFieldSerialize() {
-        TestObjectAllTypes exp = new TestObjectAllTypes();
-
-        exp.setDefaultData();
-
-        PortableBuilderImpl mutPo = wrap(exp);
-
-        TestObjectAllTypes res = mutPo.build().deserialize();
-
-        GridTestUtils.deepEquals(exp, res);
-    }
-
-    /**
-     * @throws Exception If any error occurs.
-     */
-    public void testSimpleTypeFieldOverride() throws Exception {
-        TestObjectAllTypes exp = new TestObjectAllTypes();
-
-        exp.setDefaultData();
-
-        PortableBuilderImpl mutPo = wrap(new TestObjectAllTypes());
-
-        for (Field field : TestObjectAllTypes.class.getDeclaredFields())
-            mutPo.setField(field.getName(), field.get(exp));
-
-        TestObjectAllTypes res = mutPo.build().deserialize();
-
-        GridTestUtils.deepEquals(exp, res);
-    }
-
-    /**
-     * @throws Exception If any error occurs.
-     */
-    public void testSimpleTypeFieldSetNull() throws Exception {
-        TestObjectAllTypes exp = new TestObjectAllTypes();
-
-        exp.setDefaultData();
-
-        PortableBuilderImpl mutPo = wrap(exp);
-
-        for (Field field : TestObjectAllTypes.class.getDeclaredFields()) {
-            if (!field.getType().isPrimitive())
-                mutPo.setField(field.getName(), null);
-        }
-
-        TestObjectAllTypes res = mutPo.build().deserialize();
-
-        for (Field field : TestObjectAllTypes.class.getDeclaredFields()) {
-            if (!field.getType().isPrimitive())
-                assertNull(field.getName(), field.get(res));
-        }
-    }
-
-    /**
-     * @throws IgniteCheckedException If any error occurs.
-     */
-    public void testMakeCyclicDependency() throws IgniteCheckedException {
-        TestObjectOuter outer = new TestObjectOuter();
-        outer.inner = new TestObjectInner();
-
-        PortableBuilderImpl mutOuter = wrap(outer);
-
-        PortableBuilderImpl mutInner = mutOuter.getField("inner");
-
-        mutInner.setField("outer", mutOuter);
-        mutInner.setField("foo", mutInner);
-
-        TestObjectOuter res = mutOuter.build().deserialize();
-
-        assertEquals(res, res.inner.outer);
-        assertEquals(res.inner, res.inner.foo);
-    }
-
-    /**
-     *
-     */
-    public void testDateArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.dateArr =  new Date[] {new Date(11111), new Date(11111), new Date(11111)};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Date[] arr = mutObj.getField("dateArr");
-        arr[0] = new Date(22222);
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new Date[] {new Date(22222), new Date(11111), new Date(11111)}, res.dateArr);
-    }
-
-    /**
-     *
-     */
-    public void testUUIDArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.uuidArr = new UUID[] {new UUID(1, 1), new UUID(1, 1), new UUID(1, 1)};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        UUID[] arr = mutObj.getField("uuidArr");
-        arr[0] = new UUID(2, 2);
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new UUID[] {new UUID(2, 2), new UUID(1, 1), new UUID(1, 1)}, res.uuidArr);
-    }
-
-    /**
-     *
-     */
-    public void testDecimalArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.bdArr = new BigDecimal[] {new BigDecimal(1000), new BigDecimal(1000), new BigDecimal(1000)};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        BigDecimal[] arr = mutObj.getField("bdArr");
-        arr[0] = new BigDecimal(2000);
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new BigDecimal[] {new BigDecimal(1000), new BigDecimal(1000), new BigDecimal(1000)},
-            res.bdArr);
-    }
-
-    /**
-     *
-     */
-    public void testBooleanArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.zArr = new boolean[] {false, false, false};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        boolean[] arr = mutObj.getField("zArr");
-        arr[0] = true;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        boolean[] expected = new boolean[] {true, false, false};
-
-        assertEquals(expected.length, res.zArr.length);
-
-        for (int i = 0; i < expected.length; i++)
-            assertEquals(expected[i], res.zArr[i]);
-    }
-
-    /**
-     *
-     */
-    public void testCharArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.cArr = new char[] {'a', 'a', 'a'};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        char[] arr = mutObj.getField("cArr");
-        arr[0] = 'b';
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new char[] {'b', 'a', 'a'}, res.cArr);
-    }
-
-    /**
-     *
-     */
-    public void testDoubleArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.dArr = new double[] {1.0, 1.0, 1.0};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        double[] arr = mutObj.getField("dArr");
-        arr[0] = 2.0;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new double[] {2.0, 1.0, 1.0}, res.dArr, 0);
-    }
-
-    /**
-     *
-     */
-    public void testFloatArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.fArr = new float[] {1.0f, 1.0f, 1.0f};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        float[] arr = mutObj.getField("fArr");
-        arr[0] = 2.0f;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new float[] {2.0f, 1.0f, 1.0f}, res.fArr, 0);
-    }
-
-    /**
-     *
-     */
-    public void testLongArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.lArr = new long[] {1, 1, 1};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        long[] arr = mutObj.getField("lArr");
-        arr[0] = 2;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new long[] {2, 1, 1}, res.lArr);
-    }
-
-    /**
-     *
-     */
-    public void testIntArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.iArr = new int[] {1, 1, 1};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        int[] arr = mutObj.getField("iArr");
-        arr[0] = 2;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new int[] {2, 1, 1}, res.iArr);
-    }
-
-    /**
-     *
-     */
-    public void testShortArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.sArr = new short[] {1, 1, 1};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        short[] arr = mutObj.getField("sArr");
-        arr[0] = 2;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new short[] {2, 1, 1}, res.sArr);
-    }
-
-    /**
-     *
-     */
-    public void testByteArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.bArr = new byte[] {1, 1, 1};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        byte[] arr = mutObj.getField("bArr");
-        arr[0] = 2;
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new byte[] {2, 1, 1}, res.bArr);
-    }
-
-    /**
-     *
-     */
-    public void testStringArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.strArr = new String[] {"a", "a", "a"};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        String[] arr = mutObj.getField("strArr");
-        arr[0] = "b";
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new String[] {"b", "a", "a"}, res.strArr);
-    }
-
-    /**
-     *
-     */
-    public void testModifyObjectArray() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = new Object[] {"a"};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Object[] arr = mutObj.getField("foo");
-
-        Assert.assertArrayEquals(new Object[] {"a"}, arr);
-
-        arr[0] = "b";
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new Object[] {"b"}, (Object[])res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testOverrideObjectArrayField() {
-        PortableBuilderImpl mutObj = wrap(new TestObjectContainer());
-
-        Object[] createdArr = {mutObj, "a", 1, new String[] {"s", "s"}, new byte[] {1, 2}, new UUID(3, 0)};
-
-        mutObj.setField("foo", createdArr.clone());
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        createdArr[0] = res;
-
-        assertTrue(Objects.deepEquals(createdArr, res.foo));
-    }
-
-    /**
-     *
-     */
-    public void testDeepArray() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = new Object[] {new Object[] {"a", obj}};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Object[] arr = (Object[])mutObj.<Object[]>getField("foo")[0];
-
-        assertEquals("a", arr[0]);
-        assertSame(mutObj, arr[1]);
-
-        arr[0] = mutObj;
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        arr = (Object[])((Object[])res.foo)[0];
-
-        assertSame(arr[0], res);
-        assertSame(arr[0], arr[1]);
-    }
-
-    /**
-     *
-     */
-    public void testArrayListRead() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Lists.newArrayList(obj, "a");
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        List<Object> list = mutObj.getField("foo");
-
-        assert list.equals(Lists.newArrayList(mutObj, "a"));
-    }
-
-    /**
-     *
-     */
-    public void testArrayListOverride() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        ArrayList<Object> list = Lists.newArrayList(mutObj, "a", Lists.newArrayList(1, 2));
-
-        mutObj.setField("foo", list);
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        list.set(0, res);
-
-        assertNotSame(list, res.foo);
-        assertEquals(list, res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testArrayListModification() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Lists.newArrayList("a", "b", "c");
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        List<String> list = mutObj.getField("foo");
-
-        list.add("!"); // "a", "b", "c", "!"
-        list.add(0, "_"); // "_", "a", "b", "c", "!"
-
-        String s = list.remove(1); // "_", "b", "c", "!"
-        assertEquals("a", s);
-
-        assertEquals(Arrays.asList("c", "!"), list.subList(2, 4));
-        assertEquals(1, list.indexOf("b"));
-        assertEquals(1, list.lastIndexOf("b"));
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        assertTrue(res.foo instanceof ArrayList);
-        assertEquals(Arrays.asList("_", "b", "c", "!"), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testArrayListClear() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Lists.newArrayList("a", "b", "c");
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        List<String> list = mutObj.getField("foo");
-
-        list.clear();
-
-        assertEquals(Collections.emptyList(), mutObj.build().<TestObjectContainer>deserialize().foo);
-    }
-
-    /**
-     *
-     */
-    public void testArrayListWriteUnmodifiable() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        ArrayList<Object> src = Lists.newArrayList(obj, "a", "b", "c");
-
-        obj.foo = src;
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        TestObjectContainer deserialized = mutObj.build().deserialize();
-
-        List<Object> res = (List<Object>)deserialized.foo;
-
-        src.set(0, deserialized);
-
-        assertEquals(src, res);
-    }
-
-    /**
-     *
-     */
-    public void testLinkedListRead() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Lists.newLinkedList(Arrays.asList(obj, "a"));
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        List<Object> list = mutObj.getField("foo");
-
-        assert list.equals(Lists.newLinkedList(Arrays.asList(mutObj, "a")));
-    }
-
-    /**
-     *
-     */
-    public void testLinkedListOverride() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        List<Object> list = Lists.newLinkedList(Arrays.asList(mutObj, "a", Lists.newLinkedList(Arrays.asList(1, 2))));
-
-        mutObj.setField("foo", list);
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        list.set(0, res);
-
-        assertNotSame(list, res.foo);
-        assertEquals(list, res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testLinkedListModification() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        obj.foo = Lists.newLinkedList(Arrays.asList("a", "b", "c"));
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        List<String> list = mutObj.getField("foo");
-
-        list.add("!"); // "a", "b", "c", "!"
-        list.add(0, "_"); // "_", "a", "b", "c", "!"
-
-        String s = list.remove(1); // "_", "b", "c", "!"
-        assertEquals("a", s);
-
-        assertEquals(Arrays.asList("c", "!"), list.subList(2, 4));
-        assertEquals(1, list.indexOf("b"));
-        assertEquals(1, list.lastIndexOf("b"));
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        assertTrue(res.foo instanceof LinkedList);
-        assertEquals(Arrays.asList("_", "b", "c", "!"), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testLinkedListWriteUnmodifiable() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        LinkedList<Object> src = Lists.newLinkedList(Arrays.asList(obj, "a", "b", "c"));
-
-        obj.foo = src;
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        TestObjectContainer deserialized = mutObj.build().deserialize();
-
-        List<Object> res = (List<Object>)deserialized.foo;
-
-        src.set(0, deserialized);
-
-        assertEquals(src, res);
-    }
-
-    /**
-     *
-     */
-    public void testHashSetRead() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Sets.newHashSet(obj, "a");
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Set<Object> set = mutObj.getField("foo");
-
-        assert set.equals(Sets.newHashSet(mutObj, "a"));
-    }
-
-    /**
-     *
-     */
-    public void testHashSetOverride() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Set<Object> c = Sets.newHashSet(mutObj, "a", Sets.newHashSet(1, 2));
-
-        mutObj.setField("foo", c);
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        c.remove(mutObj);
-        c.add(res);
-
-        assertNotSame(c, res.foo);
-        assertEquals(c, res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testHashSetModification() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Sets.newHashSet("a", "b", "c");
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Set<String> set = mutObj.getField("foo");
-
-        set.remove("b");
-        set.add("!");
-
-        assertEquals(Sets.newHashSet("a", "!", "c"), set);
-        assertTrue(set.contains("a"));
-        assertTrue(set.contains("!"));
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        assertTrue(res.foo instanceof HashSet);
-        assertEquals(Sets.newHashSet("a", "!", "c"), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testHashSetWriteUnmodifiable() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        Set<Object> src = Sets.newHashSet(obj, "a", "b", "c");
-
-        obj.foo = src;
-
-        TestObjectContainer deserialized = wrap(obj).build().deserialize();
-
-        Set<Object> res = (Set<Object>)deserialized.foo;
-
-        src.remove(obj);
-        src.add(deserialized);
-
-        assertEquals(src, res);
-    }
-
-    /**
-     *
-     */
-    public void testMapRead() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Maps.newHashMap(ImmutableMap.of(obj, "a", "b", obj));
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Map<Object, Object> map = mutObj.getField("foo");
-
-        assert map.equals(ImmutableMap.of(mutObj, "a", "b", mutObj));
-    }
-
-    /**
-     *
-     */
-    public void testMapOverride() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Map<Object, Object> map = Maps.newHashMap(ImmutableMap.of(mutObj, "a", "b", mutObj));
-
-        mutObj.setField("foo", map);
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        assertEquals(ImmutableMap.of(res, "a", "b", res), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testMapModification() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Maps.newHashMap(ImmutableMap.of(1, "a", 2, "b"));
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        Map<Object, Object> map = mutObj.getField("foo");
-
-        map.put(3, mutObj);
-        Object rmv = map.remove(1);
-
-        assertEquals("a", rmv);
-
-        TestObjectContainer res = mutObj.build().deserialize();
-
-        assertEquals(ImmutableMap.of(2, "b", 3, res), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testEnumArrayModification() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-
-        obj.enumArr = new TestObjectEnum[] {TestObjectEnum.A, TestObjectEnum.B};
-
-        PortableBuilderImpl mutObj = wrap(obj);
-
-        PortableBuilderEnum[] arr = mutObj.getField("enumArr");
-        arr[0] = new PortableBuilderEnum(mutObj.typeId(), TestObjectEnum.B);
-
-        TestObjectAllTypes res = mutObj.build().deserialize();
-
-        Assert.assertArrayEquals(new TestObjectEnum[] {TestObjectEnum.A, TestObjectEnum.B}, res.enumArr);
-    }
-
-    /**
-     *
-     */
-    public void testEditObjectWithRawData() {
-        GridPortableMarshalerAwareTestClass obj = new GridPortableMarshalerAwareTestClass();
-
-        obj.s = "a";
-        obj.sRaw = "aa";
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        mutableObj.setField("s", "z");
-
-        GridPortableMarshalerAwareTestClass res = mutableObj.build().deserialize();
-        assertEquals("z", res.s);
-        assertEquals("aa", res.sRaw);
-    }
-
-    /**
-     *
-     */
-    public void testHashCode() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        assertEquals(obj.hashCode(), mutableObj.build().hashCode());
-
-        mutableObj.hashCode(25);
-
-        assertEquals(25, mutableObj.build().hashCode());
-    }
-
-    /**
-     *
-     */
-    public void testCollectionsInCollection() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = Lists.newArrayList(
-            Lists.newArrayList(1, 2),
-            Lists.newLinkedList(Arrays.asList(1, 2)),
-            Sets.newHashSet("a", "b"),
-            Sets.newLinkedHashSet(Arrays.asList("a", "b")),
-            Maps.newHashMap(ImmutableMap.of(1, "a", 2, "b")));
-
-        TestObjectContainer deserialized = wrap(obj).build().deserialize();
-
-        assertEquals(obj.foo, deserialized.foo);
-    }
-
-    /**
-     *
-     */
-    public void testMapEntryModification() {
-        TestObjectContainer obj = new TestObjectContainer();
-        obj.foo = ImmutableMap.of(1, "a").entrySet().iterator().next();
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        Map.Entry<Object, Object> entry = mutableObj.getField("foo");
-
-        assertEquals(1, entry.getKey());
-        assertEquals("a", entry.getValue());
-
-        entry.setValue("b");
-
-        TestObjectContainer res = mutableObj.build().deserialize();
-
-        assertEquals(new GridMapEntry<>(1, "b"), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testMapEntryOverride() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        mutableObj.setField("foo", new GridMapEntry<>(1, "a"));
-
-        TestObjectContainer res = mutableObj.build().deserialize();
-
-        assertEquals(new GridMapEntry<>(1, "a"), res.foo);
-    }
-
-    /**
-     *
-     */
-    public void testMetadataChangingDoublePut() {
-        PortableBuilderImpl mutableObj = wrap(new TestObjectContainer());
-
-        mutableObj.setField("xx567", "a");
-        mutableObj.setField("xx567", "b");
-
-        mutableObj.build();
-
-        PortableMetadata metadata = portables().metadata(TestObjectContainer.class);
-
-        assertEquals("String", metadata.fieldTypeName("xx567"));
-    }
-
-    /**
-     *
-     */
-    public void testMetadataChangingDoublePut2() {
-        PortableBuilderImpl mutableObj = wrap(new TestObjectContainer());
-
-        mutableObj.setField("xx567", "a");
-        mutableObj.setField("xx567", "b");
-
-        mutableObj.build();
-
-        PortableMetadata metadata = portables().metadata(TestObjectContainer.class);
-
-        assertEquals("String", metadata.fieldTypeName("xx567"));
-    }
-
-    /**
-     *
-     */
-    public void testMetadataChanging() {
-        TestObjectContainer c = new TestObjectContainer();
-
-        PortableBuilderImpl mutableObj = wrap(c);
-
-        mutableObj.setField("intField", 1);
-        mutableObj.setField("intArrField", new int[] {1});
-        mutableObj.setField("arrField", new String[] {"1"});
-        mutableObj.setField("strField", "1");
-        mutableObj.setField("colField", Lists.newArrayList("1"));
-        mutableObj.setField("mapField", Maps.newHashMap(ImmutableMap.of(1, "1")));
-        mutableObj.setField("enumField", TestObjectEnum.A);
-        mutableObj.setField("enumArrField", new Enum[] {TestObjectEnum.A});
-
-        mutableObj.build();
-
-        PortableMetadata metadata = portables().metadata(c.getClass());
-
-        assertTrue(metadata.fields().containsAll(Arrays.asList("intField", "intArrField", "arrField", "strField",
-            "colField", "mapField", "enumField", "enumArrField")));
-
-        assertEquals("int", metadata.fieldTypeName("intField"));
-        assertEquals("int[]", metadata.fieldTypeName("intArrField"));
-        assertEquals("String[]", metadata.fieldTypeName("arrField"));
-        assertEquals("String", metadata.fieldTypeName("strField"));
-        assertEquals("Collection", metadata.fieldTypeName("colField"));
-        assertEquals("Map", metadata.fieldTypeName("mapField"));
-        assertEquals("Enum", metadata.fieldTypeName("enumField"));
-        assertEquals("Enum[]", metadata.fieldTypeName("enumArrField"));
-    }
-
-    /**
-     *
-     */
-    public void testDateInObjectField() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        obj.foo = new Date();
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        assertEquals(Timestamp.class, mutableObj.getField("foo").getClass());
-    }
-
-    /**
-     *
-     */
-    public void testDateInCollection() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        obj.foo = Lists.newArrayList(new Date());
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        assertEquals(Timestamp.class, ((List<?>)mutableObj.getField("foo")).get(0).getClass());
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("AssertEqualsBetweenInconvertibleTypes")
-    public void testDateArrayOverride() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        PortableBuilderImpl mutableObj = wrap(obj);
-
-        Date[] arr = {new Date()};
-
-        mutableObj.setField("foo", arr);
-
-        TestObjectContainer res = mutableObj.build().deserialize();
-
-        assertEquals(Date[].class, res.foo.getClass());
-        assertTrue(Objects.deepEquals(arr, res.foo));
-    }
-
-    /**
-     *
-     */
-    public void testChangeMap() {
-        AddressBook addrBook = new AddressBook();
-
-        addrBook.addCompany(new Company(1, "Google inc", 100, new Address("Saint-Petersburg", "Torzhkovskya", 1, 53), "occupation"));
-        addrBook.addCompany(new Company(2, "Apple inc", 100, new Address("Saint-Petersburg", "Torzhkovskya", 1, 54), "occupation"));
-        addrBook.addCompany(new Company(3, "Microsoft", 100, new Address("Saint-Petersburg", "Torzhkovskya", 1, 55), "occupation"));
-        addrBook.addCompany(new Company(4, "Oracle", 100, new Address("Saint-Petersburg", "Nevskiy", 1, 1), "occupation"));
-
-        PortableBuilderImpl mutableObj = wrap(addrBook);
-
-        Map<String, List<PortableBuilderImpl>> map = mutableObj.getField("companyByStreet");
-
-        List<PortableBuilderImpl> list = map.get("Torzhkovskya");
-
-        PortableBuilderImpl company = list.get(0);
-
-        assert "Google inc".equals(company.<String>getField("name"));
-
-        list.remove(0);
-
-        AddressBook res = mutableObj.build().deserialize();
-
-        assertEquals(Arrays.asList("Nevskiy", "Torzhkovskya"), new ArrayList<>(res.getCompanyByStreet().keySet()));
-
-        List<Company> torzhkovskyaCompanies = res.getCompanyByStreet().get("Torzhkovskya");
-
-        assertEquals(2, torzhkovskyaCompanies.size());
-        assertEquals("Apple inc", torzhkovskyaCompanies.get(0).name);
-    }
-
-    /**
-     *
-     */
-    public void testSavingObjectWithNotZeroStart() {
-        TestObjectOuter out = new TestObjectOuter();
-        TestObjectInner inner = new TestObjectInner();
-
-        out.inner = inner;
-        inner.outer = out;
-
-        PortableBuilderImpl builder = wrap(out);
-
-        PortableBuilderImpl innerBuilder = builder.getField("inner");
-
-        TestObjectInner res = innerBuilder.build().deserialize();
-
-        assertSame(res, res.outer.inner);
-    }
-
-    /**
-     *
-     */
-    public void testPortableObjectField() {
-        TestObjectContainer container = new TestObjectContainer(toPortable(new TestObjectArrayList()));
-
-        PortableBuilderImpl wrapper = wrap(container);
-
-        assertTrue(wrapper.getField("foo") instanceof PortableObject);
-
-        TestObjectContainer deserialized = wrapper.build().deserialize();
-        assertTrue(deserialized.foo instanceof PortableObject);
-    }
-
-    /**
-     *
-     */
-    public void testAssignPortableObject() {
-        TestObjectContainer container = new TestObjectContainer();
-
-        PortableBuilderImpl wrapper = wrap(container);
-
-        wrapper.setField("foo", toPortable(new TestObjectArrayList()));
-
-        TestObjectContainer deserialized = wrapper.build().deserialize();
-        assertTrue(deserialized.foo instanceof TestObjectArrayList);
-    }
-
-    /**
-     *
-     */
-    public void testRemoveFromNewObject() {
-        PortableBuilderImpl wrapper = newWrapper(TestObjectAllTypes.class);
-
-        wrapper.setField("str", "a");
-
-        wrapper.removeField("str");
-
-        assertNull(wrapper.build().<TestObjectAllTypes>deserialize().str);
-    }
-
-    /**
-     *
-     */
-    public void testRemoveFromExistingObject() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-        obj.setDefaultData();
-
-        PortableBuilderImpl wrapper = wrap(toPortable(obj));
-
-        wrapper.removeField("str");
-
-        assertNull(wrapper.build().<TestObjectAllTypes>deserialize().str);
-    }
-
-    /**
-     *
-     */
-    public void testCyclicArrays() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        Object[] arr1 = new Object[1];
-        Object[] arr2 = new Object[] {arr1};
-
-        arr1[0] = arr2;
-
-        obj.foo = arr1;
-
-        TestObjectContainer res = toPortable(obj).deserialize();
-
-        Object[] resArr = (Object[])res.foo;
-
-        assertSame(((Object[])resArr[0])[0], resArr);
-    }
-
-    /**
-     *
-     */
-    @SuppressWarnings("TypeMayBeWeakened")
-    public void testCyclicArrayList() {
-        TestObjectContainer obj = new TestObjectContainer();
-
-        List<Object> arr1 = new ArrayList<>();
-        List<Object> arr2 = new ArrayList<>();
-
-        arr1.add(arr2);
-        arr2.add(arr1);
-
-        obj.foo = arr1;
-
-        TestObjectContainer res = toPortable(obj).deserialize();
-
-        List<?> resArr = (List<?>)res.foo;
-
-        assertSame(((List<Object>)resArr.get(0)).get(0), resArr);
-    }
-
-    /**
-     * @param obj Object.
-     * @return Object in portable format.
-     */
-    private PortableObject toPortable(Object obj) {
-        return portables().toPortable(obj);
-    }
-
-    /**
-     * @param obj Object.
-     * @return GridMutablePortableObject.
-     */
-    private PortableBuilderImpl wrap(Object obj) {
-        return PortableBuilderImpl.wrap(toPortable(obj));
-    }
-
-    /**
-     * @param aCls Class.
-     * @return Wrapper.
-     */
-    private PortableBuilderImpl newWrapper(Class<?> aCls) {
-        CacheObjectPortableProcessorImpl processor = (CacheObjectPortableProcessorImpl)(
-            (IgnitePortablesImpl)portables()).processor();
-
-        return new PortableBuilderImpl(processor.portableContext(), processor.typeId(aCls.getName()),
-            aCls.getSimpleName());
-    }
-}
\ No newline at end of file


[29/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
deleted file mode 100644
index 05df23b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.portable;
-
-import java.util.Arrays;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Test for disabled meta data.
- */
-public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest {
-    /** */
-    private PortableMarshaller marsh;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /**
-     * @return Portables.
-     */
-    private IgnitePortables portables() {
-        return grid().portables();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableGlobal() throws Exception {
-        marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(
-            TestObject1.class.getName(),
-            TestObject2.class.getName()
-        ));
-
-        marsh.setMetaDataEnabled(false);
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-            portables().toPortable(new TestObject3());
-
-            assertEquals(0, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-
-            PortableBuilder bldr = portables().builder("FakeType");
-
-            bldr.setField("field1", 0).setField("field2", "value").build();
-
-            assertNull(portables().metadata("FakeType"));
-            assertNull(portables().metadata(TestObject3.class));
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableGlobalSimpleClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject2.class.getName());
-
-        typeCfg.setMetaDataEnabled(true);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject1.class.getName()),
-            typeCfg
-        ));
-
-        marsh.setMetaDataEnabled(false);
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(0, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(1, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableGlobalMarshalAwareClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject1.class.getName());
-
-        typeCfg.setMetaDataEnabled(true);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject2.class.getName()),
-            typeCfg
-        ));
-
-        marsh.setMetaDataEnabled(false);
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(1, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableSimpleClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject1.class.getName());
-
-        typeCfg.setMetaDataEnabled(false);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject2.class.getName()),
-            typeCfg
-        ));
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(0, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(1, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableMarshalAwareClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject2.class.getName());
-
-        typeCfg.setMetaDataEnabled(false);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject1.class.getName()),
-            typeCfg
-        ));
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(1, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestObject1 {
-        /** */
-        private int field;
-    }
-
-    /**
-     */
-    private static class TestObject2 implements PortableMarshalAware {
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeInt("field", 1);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            // No-op.
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestObject3 {
-        /** */
-        private int field;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
deleted file mode 100644
index fa3c9a7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Portable meta data test.
- */
-public class GridPortableMetaDataSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static int idx;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        CacheConfiguration ccfg = new CacheConfiguration();
-
-        cfg.setCacheConfiguration(ccfg);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        idx = 0;
-
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopGrid();
-    }
-
-    /**
-     * @return Portables API.
-     */
-    protected IgnitePortables portables() {
-        return grid().portables();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAll() throws Exception {
-        portables().toPortable(new TestObject2());
-
-        Collection<PortableMetadata> metas = portables().metadata();
-
-        assertEquals(2, metas.size());
-
-        for (PortableMetadata meta : metas) {
-            Collection<String> fields;
-
-            switch (meta.typeName()) {
-                case "TestObject1":
-                    fields = meta.fields();
-
-                    assertEquals(7, fields.size());
-
-                    assertTrue(fields.contains("intVal"));
-                    assertTrue(fields.contains("strVal"));
-                    assertTrue(fields.contains("arrVal"));
-                    assertTrue(fields.contains("obj1Val"));
-                    assertTrue(fields.contains("obj2Val"));
-                    assertTrue(fields.contains("decVal"));
-                    assertTrue(fields.contains("decArrVal"));
-
-                    assertEquals("int", meta.fieldTypeName("intVal"));
-                    assertEquals("String", meta.fieldTypeName("strVal"));
-                    assertEquals("byte[]", meta.fieldTypeName("arrVal"));
-                    assertEquals("Object", meta.fieldTypeName("obj1Val"));
-                    assertEquals("Object", meta.fieldTypeName("obj2Val"));
-                    assertEquals("decimal", meta.fieldTypeName("decVal"));
-                    assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-
-                    break;
-
-                case "TestObject2":
-                    fields = meta.fields();
-
-                    assertEquals(7, fields.size());
-
-                    assertTrue(fields.contains("boolVal"));
-                    assertTrue(fields.contains("dateVal"));
-                    assertTrue(fields.contains("uuidArrVal"));
-                    assertTrue(fields.contains("objVal"));
-                    assertTrue(fields.contains("mapVal"));
-                    assertTrue(fields.contains("decVal"));
-                    assertTrue(fields.contains("decArrVal"));
-
-                    assertEquals("boolean", meta.fieldTypeName("boolVal"));
-                    assertEquals("Date", meta.fieldTypeName("dateVal"));
-                    assertEquals("UUID[]", meta.fieldTypeName("uuidArrVal"));
-                    assertEquals("Object", meta.fieldTypeName("objVal"));
-                    assertEquals("Map", meta.fieldTypeName("mapVal"));
-                    assertEquals("decimal", meta.fieldTypeName("decVal"));
-                    assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-
-                    break;
-
-                default:
-                    assert false : meta.typeName();
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNoConfiguration() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1377");
-
-        portables().toPortable(new TestObject3());
-
-        assertNotNull(portables().metadata(TestObject3.class));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReflection() throws Exception {
-        PortableMetadata meta = portables().metadata(TestObject1.class);
-
-        assertNotNull(meta);
-
-        assertEquals("TestObject1", meta.typeName());
-
-        Collection<String> fields = meta.fields();
-
-        assertEquals(7, fields.size());
-
-        assertTrue(fields.contains("intVal"));
-        assertTrue(fields.contains("strVal"));
-        assertTrue(fields.contains("arrVal"));
-        assertTrue(fields.contains("obj1Val"));
-        assertTrue(fields.contains("obj2Val"));
-        assertTrue(fields.contains("decVal"));
-        assertTrue(fields.contains("decArrVal"));
-
-        assertEquals("int", meta.fieldTypeName("intVal"));
-        assertEquals("String", meta.fieldTypeName("strVal"));
-        assertEquals("byte[]", meta.fieldTypeName("arrVal"));
-        assertEquals("Object", meta.fieldTypeName("obj1Val"));
-        assertEquals("Object", meta.fieldTypeName("obj2Val"));
-        assertEquals("decimal", meta.fieldTypeName("decVal"));
-        assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableMarshalAware() throws Exception {
-        portables().toPortable(new TestObject2());
-
-        PortableMetadata meta = portables().metadata(TestObject2.class);
-
-        assertNotNull(meta);
-
-        assertEquals("TestObject2", meta.typeName());
-
-        Collection<String> fields = meta.fields();
-
-        assertEquals(7, fields.size());
-
-        assertTrue(fields.contains("boolVal"));
-        assertTrue(fields.contains("dateVal"));
-        assertTrue(fields.contains("uuidArrVal"));
-        assertTrue(fields.contains("objVal"));
-        assertTrue(fields.contains("mapVal"));
-        assertTrue(fields.contains("decVal"));
-        assertTrue(fields.contains("decArrVal"));
-
-        assertEquals("boolean", meta.fieldTypeName("boolVal"));
-        assertEquals("Date", meta.fieldTypeName("dateVal"));
-        assertEquals("UUID[]", meta.fieldTypeName("uuidArrVal"));
-        assertEquals("Object", meta.fieldTypeName("objVal"));
-        assertEquals("Map", meta.fieldTypeName("mapVal"));
-        assertEquals("decimal", meta.fieldTypeName("decVal"));
-        assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMerge() throws Exception {
-        portables().toPortable(new TestObject2());
-
-        idx = 1;
-
-        portables().toPortable(new TestObject2());
-
-        PortableMetadata meta = portables().metadata(TestObject2.class);
-
-        assertNotNull(meta);
-
-        assertEquals("TestObject2", meta.typeName());
-
-        Collection<String> fields = meta.fields();
-
-        assertEquals(9, fields.size());
-
-        assertTrue(fields.contains("boolVal"));
-        assertTrue(fields.contains("dateVal"));
-        assertTrue(fields.contains("uuidArrVal"));
-        assertTrue(fields.contains("objVal"));
-        assertTrue(fields.contains("mapVal"));
-        assertTrue(fields.contains("charVal"));
-        assertTrue(fields.contains("colVal"));
-        assertTrue(fields.contains("decVal"));
-        assertTrue(fields.contains("decArrVal"));
-
-        assertEquals("boolean", meta.fieldTypeName("boolVal"));
-        assertEquals("Date", meta.fieldTypeName("dateVal"));
-        assertEquals("UUID[]", meta.fieldTypeName("uuidArrVal"));
-        assertEquals("Object", meta.fieldTypeName("objVal"));
-        assertEquals("Map", meta.fieldTypeName("mapVal"));
-        assertEquals("char", meta.fieldTypeName("charVal"));
-        assertEquals("Collection", meta.fieldTypeName("colVal"));
-        assertEquals("decimal", meta.fieldTypeName("decVal"));
-        assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSerializedObject() throws Exception {
-        TestObject1 obj = new TestObject1();
-
-        obj.intVal = 10;
-        obj.strVal = "str";
-        obj.arrVal = new byte[] {2, 4, 6};
-        obj.obj1Val = null;
-        obj.obj2Val = new TestObject2();
-        obj.decVal = BigDecimal.ZERO;
-        obj.decArrVal = new BigDecimal[] { BigDecimal.ONE };
-
-        PortableObject po = portables().toPortable(obj);
-
-        info(po.toString());
-
-        PortableMetadata meta = po.metaData();
-
-        assertNotNull(meta);
-
-        assertEquals("TestObject1", meta.typeName());
-
-        Collection<String> fields = meta.fields();
-
-        assertEquals(7, fields.size());
-
-        assertTrue(fields.contains("intVal"));
-        assertTrue(fields.contains("strVal"));
-        assertTrue(fields.contains("arrVal"));
-        assertTrue(fields.contains("obj1Val"));
-        assertTrue(fields.contains("obj2Val"));
-        assertTrue(fields.contains("decVal"));
-        assertTrue(fields.contains("decArrVal"));
-
-        assertEquals("int", meta.fieldTypeName("intVal"));
-        assertEquals("String", meta.fieldTypeName("strVal"));
-        assertEquals("byte[]", meta.fieldTypeName("arrVal"));
-        assertEquals("Object", meta.fieldTypeName("obj1Val"));
-        assertEquals("Object", meta.fieldTypeName("obj2Val"));
-        assertEquals("decimal", meta.fieldTypeName("decVal"));
-        assertEquals("decimal[]", meta.fieldTypeName("decArrVal"));
-    }
-
-    /**
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestObject1 {
-        /** */
-        private int intVal;
-
-        /** */
-        private String strVal;
-
-        /** */
-        private byte[] arrVal;
-
-        /** */
-        private TestObject1 obj1Val;
-
-        /** */
-        private TestObject2 obj2Val;
-
-        /** */
-        private BigDecimal decVal;
-
-        /** */
-        private BigDecimal[] decArrVal;
-    }
-
-    /**
-     */
-    private static class TestObject2 implements PortableMarshalAware {
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeBoolean("boolVal", false);
-            writer.writeDate("dateVal", new Date());
-            writer.writeUuidArray("uuidArrVal", null);
-            writer.writeObject("objVal", null);
-            writer.writeMap("mapVal", new HashMap<>());
-            writer.writeDecimal("decVal", BigDecimal.ZERO);
-            writer.writeDecimalArray("decArrVal", new BigDecimal[] { BigDecimal.ONE });
-
-            if (idx == 1) {
-                writer.writeChar("charVal", (char)0);
-                writer.writeCollection("colVal", null);
-            }
-
-            PortableRawWriter raw = writer.rawWriter();
-
-            raw.writeChar((char)0);
-            raw.writeCollection(null);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            // No-op.
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestObject3 {
-        /** */
-        private int intVal;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
deleted file mode 100644
index 349f152..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import java.util.Arrays;
-import java.util.Map;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Wildcards test.
- */
-public class GridPortableWildcardsSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
-        @Override public void addMeta(int typeId, PortableMetadata meta) {
-            // No-op.
-        }
-
-        @Override public PortableMetadata metadata(int typeId) {
-            return null;
-        }
-    };
-
-    /**
-     * @return Portable context.
-     */
-    private PortableContext portableContext() {
-        return new PortableContext(META_HND, null);
-    }
-
-    /**
-     * @return Portable marshaller.
-     */
-    private PortableMarshaller portableMarshaller() {
-        PortableMarshaller marsh = new PortableMarshaller();
-        marsh.setContext(new MarshallerContextTestImpl(null));
-
-        return marsh;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClassNames() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(
-            "org.apache.ignite.internal.portable.test.*",
-            "unknown.*"
-        ));
-
-        ctx.configure(marsh);
-
-        Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
-        assertEquals(3, typeIds.size());
-
-        assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-        assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
-        assertTrue(typeIds.containsKey("innerclass".hashCode()));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClassNamesWithMapper() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @SuppressWarnings("IfMayBeConditional")
-            @Override public int typeId(String clsName) {
-                if (clsName.endsWith("1"))
-                    return 300;
-                else if (clsName.endsWith("2"))
-                    return 400;
-                else if (clsName.endsWith("InnerClass"))
-                    return 500;
-                else
-                    return -500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setClassNames(Arrays.asList(
-            "org.apache.ignite.internal.portable.test.*",
-            "unknown.*"
-        ));
-
-        ctx.configure(marsh);
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
-        assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-        assertEquals(500, typeMappers.get("InnerClass").typeId("InnerClass"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeConfigurations() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration("org.apache.ignite.internal.portable.test.*"),
-            new PortableTypeConfiguration("unknown.*")
-        ));
-
-        ctx.configure(marsh);
-
-        Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
-        assertEquals(3, typeIds.size());
-
-        assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-        assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
-        assertTrue(typeIds.containsKey("innerclass".hashCode()));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeConfigurationsWithGlobalMapper() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @SuppressWarnings("IfMayBeConditional")
-            @Override public int typeId(String clsName) {
-                if (clsName.endsWith("1"))
-                    return 300;
-                else if (clsName.endsWith("2"))
-                    return 400;
-                else if (clsName.endsWith("InnerClass"))
-                    return 500;
-                else
-                    return -500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration("org.apache.ignite.internal.portable.test.*"),
-            new PortableTypeConfiguration("unknown.*")
-        ));
-
-        ctx.configure(marsh);
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
-        assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-        assertEquals(500, typeMappers.get("InnerClass").typeId("InnerClass"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeConfigurationsWithNonGlobalMapper() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @SuppressWarnings("IfMayBeConditional")
-            @Override public int typeId(String clsName) {
-                if (clsName.endsWith("1"))
-                    return 300;
-                else if (clsName.endsWith("2"))
-                    return 400;
-                else if (clsName.endsWith("InnerClass"))
-                    return 500;
-                else
-                    return -500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration("org.apache.ignite.internal.portable.test.*"),
-            new PortableTypeConfiguration("unknown.*")
-        ));
-
-        ctx.configure(marsh);
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
-        assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-        assertEquals(500, typeMappers.get("InnerClass").typeId("InnerClass"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOverride() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(
-            "org.apache.ignite.internal.portable.test.*"
-        ));
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
-        typeCfg.setClassName("org.apache.ignite.internal.portable.test.GridPortableTestClass2");
-        typeCfg.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 100;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
-        ctx.configure(marsh);
-
-        Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
-        assertEquals(3, typeIds.size());
-
-        assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-        assertTrue(typeIds.containsKey("innerclass".hashCode()));
-        assertFalse(typeIds.containsKey("gridportabletestclass2".hashCode()));
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(100, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClassNamesJar() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(
-            "org.apache.ignite.portable.testjar.*",
-            "unknown.*"
-        ));
-
-        ctx.configure(marsh);
-
-        Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
-        assertEquals(3, typeIds.size());
-
-        assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-        assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClassNamesWithMapperJar() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @SuppressWarnings("IfMayBeConditional")
-            @Override public int typeId(String clsName) {
-                if (clsName.endsWith("1"))
-                    return 300;
-                else if (clsName.endsWith("2"))
-                    return 400;
-                else
-                    return -500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setClassNames(Arrays.asList(
-            "org.apache.ignite.portable.testjar.*",
-            "unknown.*"
-        ));
-
-        ctx.configure(marsh);
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
-        assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeConfigurationsJar() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration("org.apache.ignite.portable.testjar.*"),
-            new PortableTypeConfiguration("unknown.*")
-        ));
-
-        ctx.configure(marsh);
-
-        Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
-        assertEquals(3, typeIds.size());
-
-        assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-        assertTrue(typeIds.containsKey("gridportabletestclass2".hashCode()));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeConfigurationsWithGlobalMapperJar() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @SuppressWarnings("IfMayBeConditional")
-            @Override public int typeId(String clsName) {
-                if (clsName.endsWith("1"))
-                    return 300;
-                else if (clsName.endsWith("2"))
-                    return 400;
-                else
-                    return -500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration("org.apache.ignite.portable.testjar.*"),
-            new PortableTypeConfiguration("unknown.*")
-        ));
-
-        ctx.configure(marsh);
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
-        assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeConfigurationsWithNonGlobalMapperJar() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @SuppressWarnings("IfMayBeConditional")
-            @Override public int typeId(String clsName) {
-                if (clsName.endsWith("1"))
-                    return 300;
-                else if (clsName.endsWith("2"))
-                    return 400;
-                else
-                    return -500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration("org.apache.ignite.portable.testjar.*"),
-            new PortableTypeConfiguration("unknown.*")
-        ));
-
-        ctx.configure(marsh);
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(300, typeMappers.get("GridPortableTestClass1").typeId("GridPortableTestClass1"));
-        assertEquals(400, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOverrideJar() throws Exception {
-        PortableContext ctx = portableContext();
-
-        PortableMarshaller marsh = portableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(
-            "org.apache.ignite.portable.testjar.*"
-        ));
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(
-            "org.apache.ignite.portable.testjar.GridPortableTestClass2");
-
-        typeCfg.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 100;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
-        ctx.configure(marsh);
-
-        Map<Integer, Class> typeIds = U.field(ctx, "userTypes");
-
-        assertEquals(3, typeIds.size());
-
-        assertTrue(typeIds.containsKey("gridportabletestclass1".hashCode()));
-
-        Map<String, PortableIdMapper> typeMappers = U.field(ctx, "typeMappers");
-
-        assertEquals(3, typeMappers.size());
-
-        assertEquals(100, typeMappers.get("GridPortableTestClass2").typeId("GridPortableTestClass2"));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
deleted file mode 100644
index 3244331..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable.mutabletest;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.GridTestUtils;
-
-/**
- *
- */
-public class GridPortableMarshalerAwareTestClass implements PortableMarshalAware {
-    /** */
-    public String s;
-
-    /** */
-    public String sRaw;
-
-    /** {@inheritDoc} */
-    @Override public void writePortable(PortableWriter writer) throws PortableException {
-        writer.writeString("s", s);
-
-        PortableRawWriter raw = writer.rawWriter();
-
-        raw.writeString(sRaw);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readPortable(PortableReader reader) throws PortableException {
-        s = reader.readString("s");
-
-        PortableRawReader raw = reader.rawReader();
-
-        sRaw = raw.readString();
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("FloatingPointEquality")
-    @Override public boolean equals(Object other) {
-        return this == other || GridTestUtils.deepEquals(this, other);
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridPortableMarshalerAwareTestClass.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
deleted file mode 100644
index e49514b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable.mutabletest;
-
-import com.google.common.base.Throwables;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- *
- */
-@SuppressWarnings({"PublicInnerClass", "PublicField"})
-public class GridPortableTestClasses {
-    /**
-     *
-     */
-    public static class TestObjectContainer {
-        /** */
-        public Object foo;
-
-        /**
-         *
-         */
-        public TestObjectContainer() {
-            // No-op.
-        }
-
-        /**
-         * @param foo Object.
-         */
-        public TestObjectContainer(Object foo) {
-            this.foo = foo;
-        }
-    }
-
-    /**
-     *
-     */
-    public static class TestObjectOuter {
-        /** */
-        public TestObjectInner inner;
-
-        /** */
-        public String foo;
-
-        /**
-         *
-         */
-        public TestObjectOuter() {
-
-        }
-
-        /**
-         * @param inner Inner object.
-         */
-        public TestObjectOuter(TestObjectInner inner) {
-            this.inner = inner;
-        }
-    }
-
-    /** */
-    public static class TestObjectInner {
-        /** */
-        public Object foo;
-
-        /** */
-        public TestObjectOuter outer;
-    }
-
-    /** */
-    public static class TestObjectArrayList {
-        /** */
-        public List<String> list = new ArrayList<>();
-    }
-
-    /**
-     *
-     */
-    public static class TestObjectPlainPortable {
-        /** */
-        public PortableObject plainPortable;
-
-        /**
-         *
-         */
-        public TestObjectPlainPortable() {
-            // No-op.
-        }
-
-        /**
-         * @param plainPortable Object.
-         */
-        public TestObjectPlainPortable(PortableObject plainPortable) {
-            this.plainPortable = plainPortable;
-        }
-    }
-
-    /**
-     *
-     */
-    public static class TestObjectAllTypes implements Serializable {
-        /** */
-        public Byte b_;
-
-        /** */
-        public Short s_;
-
-        /** */
-        public Integer i_;
-
-        /** */
-        public Long l_;
-
-        /** */
-        public Float f_;
-
-        /** */
-        public Double d_;
-
-        /** */
-        public Character c_;
-
-        /** */
-        public Boolean z_;
-
-        /** */
-        public byte b;
-
-        /** */
-        public short s;
-
-        /** */
-        public int i;
-
-        /** */
-        public long l;
-
-        /** */
-        public float f;
-
-        /** */
-        public double d;
-
-        /** */
-        public char c;
-
-        /** */
-        public boolean z;
-
-        /** */
-        public String str;
-
-        /** */
-        public UUID uuid;
-
-        /** */
-        public Date date;
-
-        /** */
-        public byte[] bArr;
-
-        /** */
-        public short[] sArr;
-
-        /** */
-        public int[] iArr;
-
-        /** */
-        public long[] lArr;
-
-        /** */
-        public float[] fArr;
-
-        /** */
-        public double[] dArr;
-
-        /** */
-        public char[] cArr;
-
-        /** */
-        public boolean[] zArr;
-
-        /** */
-        public BigDecimal[] bdArr;
-
-        /** */
-        public String[] strArr;
-
-        /** */
-        public UUID[] uuidArr;
-
-        /** */
-        public Date[] dateArr;
-
-        /** */
-        public TestObjectEnum anEnum;
-
-        /** */
-        public TestObjectEnum[] enumArr;
-
-        /** */
-        public Map.Entry entry;
-
-        /**
-         * @return Array.
-         */
-        private byte[] serialize() {
-            ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
-
-            try {
-                ObjectOutput out = new ObjectOutputStream(byteOut);
-
-                out.writeObject(this);
-
-                out.close();
-            }
-            catch (IOException e) {
-                Throwables.propagate(e);
-            }
-
-            return byteOut.toByteArray();
-        }
-
-        /**
-         *
-         */
-        public void setDefaultData() {
-            b_ = 11;
-            s_ = 22;
-            i_ = 33;
-            l_ = 44L;
-            f_ = 55f;
-            d_ = 66d;
-            c_ = 'e';
-            z_ = true;
-
-            b = 1;
-            s = 2;
-            i = 3;
-            l = 4;
-            f = 5;
-            d = 6;
-            c = 7;
-            z = true;
-
-            str = "abc";
-            uuid = new UUID(1, 1);
-            date = new Date(1000000);
-
-            bArr = new byte[] {1, 2, 3};
-            sArr = new short[] {1, 2, 3};
-            iArr = new int[] {1, 2, 3};
-            lArr = new long[] {1, 2, 3};
-            fArr = new float[] {1, 2, 3};
-            dArr = new double[] {1, 2, 3};
-            cArr = new char[] {1, 2, 3};
-            zArr = new boolean[] {true, false};
-
-            strArr = new String[] {"abc", "ab", "a"};
-            uuidArr = new UUID[] {new UUID(1, 1), new UUID(2, 2)};
-            bdArr = new BigDecimal[] {new BigDecimal(1000), BigDecimal.TEN};
-            dateArr = new Date[] {new Date(1000000), new Date(200000)};
-
-            anEnum = TestObjectEnum.A;
-
-            enumArr = new TestObjectEnum[] {TestObjectEnum.B};
-
-            entry = new GridMapEntry<>(1, "a");
-        }
-    }
-
-    /**
-     *
-     */
-    public enum TestObjectEnum {
-        A, B, C
-    }
-
-    /**
-     *
-     */
-    public static class Address {
-        /** City. */
-        public String city;
-
-        /** Street. */
-        public String street;
-
-        /** Street number. */
-        public int streetNumber;
-
-        /** Flat number. */
-        public int flatNumber;
-
-        /**
-         * Default constructor.
-         */
-        public Address() {
-            // No-op.
-        }
-
-        /**
-         * Constructor.
-         *
-         * @param city City.
-         * @param street Street.
-         * @param streetNumber Street number.
-         * @param flatNumber Flat number.
-         */
-        public Address(String city, String street, int streetNumber, int flatNumber) {
-            this.city = city;
-            this.street = street;
-            this.streetNumber = streetNumber;
-            this.flatNumber = flatNumber;
-        }
-    }
-
-    /**
-     *
-     */
-    public static class Company {
-        /** ID. */
-        public int id;
-
-        /** Name. */
-        public String name;
-
-        /** Size. */
-        public int size;
-
-        /** Address. */
-        public Address address;
-
-        /** Occupation. */
-        public String occupation;
-
-        /**
-         * Default constructor.
-         */
-        public Company() {
-            // No-op.
-        }
-
-        /**
-         * Constructor.
-         *
-         * @param id ID.
-         * @param name Name.
-         * @param size Size.
-         * @param address Address.
-         * @param occupation Occupation.
-         */
-        public Company(int id, String name, int size, Address address, String occupation) {
-            this.id = id;
-            this.name = name;
-            this.size = size;
-            this.address = address;
-            this.occupation = occupation;
-        }
-    }
-
-    /**
-     *
-     */
-    public static class AddressBook {
-        /** */
-        private Map<String, List<Company>> companyByStreet = new TreeMap<>();
-
-        /**
-         * @param street Street.
-         * @return Company.
-         */
-        public List<Company> findCompany(String street) {
-            return companyByStreet.get(street);
-        }
-
-        /**
-         * @param company Company.
-         */
-        public void addCompany(Company company) {
-            List<Company> list = companyByStreet.get(company.address.street);
-
-            if (list == null) {
-                list = new ArrayList<>();
-
-                companyByStreet.put(company.address.street, list);
-            }
-
-            list.add(company);
-        }
-
-        /**
-         * @return map
-         */
-        public Map<String, List<Company>> getCompanyByStreet() {
-            return companyByStreet;
-        }
-
-        /**
-         * @param companyByStreet map
-         */
-        public void setCompanyByStreet(Map<String, List<Company>> companyByStreet) {
-            this.companyByStreet = companyByStreet;
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java
deleted file mode 100644
index daa13d5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable.mutabletest;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java
deleted file mode 100644
index 26897e6..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java
deleted file mode 100644
index 05a8c33..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass1.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable.test;
-
-/**
- */
-public class GridPortableTestClass1 {
-    /**
-     */
-    private static class InnerClass {
-        // No-op.
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java
deleted file mode 100644
index ba69991..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/GridPortableTestClass2.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable.test;
-
-/**
- */
-public class GridPortableTestClass2 {
-    // No-op.
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java
deleted file mode 100644
index e63b814..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable.test;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java
deleted file mode 100644
index cf3aa2d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/GridPortableTestClass3.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable.test.subpackage;
-
-/**
- */
-public class GridPortableTestClass3 {
-    // No-op.
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java
deleted file mode 100644
index ae8ee73..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/test/subpackage/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * <!-- Package description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.portable.test.subpackage;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
deleted file mode 100644
index 1ba3d4d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.util.lang.GridAbsPredicate;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- *
- */
-public class GridCacheClientNodePortableMetadataMultinodeTest extends GridCommonAbstractTest {
-    /** */
-    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private boolean client;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setPeerClassLoadingEnabled(false);
-
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder).setForceServerMode(true);
-
-        cfg.setMarshaller(new PortableMarshaller());
-
-        CacheConfiguration ccfg = new CacheConfiguration();
-
-        ccfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        cfg.setCacheConfiguration(ccfg);
-
-        cfg.setClientMode(client);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        stopAllGrids();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClientMetadataInitialization() throws Exception {
-        startGrids(2);
-
-        final AtomicBoolean stop = new AtomicBoolean();
-
-        final ConcurrentHashSet<String> allTypes = new ConcurrentHashSet<>();
-
-        IgniteInternalFuture<?> fut;
-
-        try {
-            // Update portable metadata concurrently with client nodes start.
-            fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    IgnitePortables portables = ignite(0).portables();
-
-                    IgniteCache<Object, Object> cache = ignite(0).cache(null).withKeepPortable();
-
-                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
-                    for (int i = 0; i < 1000; i++) {
-                        log.info("Iteration: " + i);
-
-                        String type = "portable-type-" + i;
-
-                        allTypes.add(type);
-
-                        for (int f = 0; f < 10; f++) {
-                            PortableBuilder builder = portables.builder(type);
-
-                            String fieldName = "f" + f;
-
-                            builder.setField(fieldName, i);
-
-                            cache.put(rnd.nextInt(0, 100_000), builder.build());
-
-                            if (f % 100 == 0)
-                                log.info("Put iteration: " + f);
-                        }
-
-                        if (stop.get())
-                            break;
-                    }
-
-                    return null;
-                }
-            }, 5, "update-thread");
-        }
-        finally {
-            stop.set(true);
-        }
-
-        client = true;
-
-        startGridsMultiThreaded(2, 5);
-
-        fut.get();
-
-        assertFalse(allTypes.isEmpty());
-
-        log.info("Expected portable types: " + allTypes.size());
-
-        assertEquals(7, ignite(0).cluster().nodes().size());
-
-        for (int i = 0; i < 7; i++) {
-            log.info("Check metadata on node: " + i);
-
-            boolean client = i > 1;
-
-            assertEquals((Object)client, ignite(i).configuration().isClientMode());
-
-            IgnitePortables portables = ignite(i).portables();
-
-            Collection<PortableMetadata> metaCol = portables.metadata();
-
-            assertEquals(allTypes.size(), metaCol.size());
-
-            Set<String> names = new HashSet<>();
-
-            for (PortableMetadata meta : metaCol) {
-                assertTrue(names.add(meta.typeName()));
-
-                assertNull(meta.affinityKeyFieldName());
-
-                assertEquals(10, meta.fields().size());
-            }
-
-            assertEquals(allTypes.size(), names.size());
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFailoverOnStart() throws Exception {
-        startGrids(4);
-
-        IgnitePortables portables = ignite(0).portables();
-
-        IgniteCache<Object, Object> cache = ignite(0).cache(null).withKeepPortable();
-
-        for (int i = 0; i < 1000; i++) {
-            PortableBuilder builder = portables.builder("type-" + i);
-
-            builder.setField("f0", i);
-
-            cache.put(i, builder.build());
-        }
-
-        client = true;
-
-        final CyclicBarrier barrier = new CyclicBarrier(6);
-
-        final AtomicInteger startIdx = new AtomicInteger(4);
-
-        IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                barrier.await();
-
-                Ignite ignite = startGrid(startIdx.getAndIncrement());
-
-                assertTrue(ignite.configuration().isClientMode());
-
-                log.info("Started node: " + ignite.name());
-
-                return null;
-            }
-        }, 5, "start-thread");
-
-        barrier.await();
-
-        U.sleep(ThreadLocalRandom.current().nextInt(10, 100));
-
-        for (int i = 0; i < 3; i++)
-            stopGrid(i);
-
-        fut.get();
-
-        assertEquals(6, ignite(3).cluster().nodes().size());
-
-        for (int i = 3; i < 7; i++) {
-            log.info("Check metadata on node: " + i);
-
-            boolean client = i > 3;
-
-            assertEquals((Object) client, ignite(i).configuration().isClientMode());
-
-            portables = ignite(i).portables();
-
-            final IgnitePortables p0 = portables;
-
-            GridTestUtils.waitForCondition(new GridAbsPredicate() {
-                @Override public boolean apply() {
-                    Collection<PortableMetadata> metaCol = p0.metadata();
-
-                    return metaCol.size() == 1000;
-                }
-            }, getTestTimeout());
-
-            Collection<PortableMetadata> metaCol = portables.metadata();
-
-            assertEquals(1000, metaCol.size());
-
-            Set<String> names = new HashSet<>();
-
-            for (PortableMetadata meta : metaCol) {
-                assertTrue(names.add(meta.typeName()));
-
-                assertNull(meta.affinityKeyFieldName());
-
-                assertEquals(1, meta.fields().size());
-            }
-
-            assertEquals(1000, names.size());
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClientStartsFirst() throws Exception {
-        client = true;
-
-        Ignite ignite0 = startGrid(0);
-
-        assertTrue(ignite0.configuration().isClientMode());
-
-        client = false;
-
-        Ignite ignite1 = startGrid(1);
-
-        assertFalse(ignite1.configuration().isClientMode());
-
-        IgnitePortables portables = ignite(1).portables();
-
-        IgniteCache<Object, Object> cache = ignite(1).cache(null).withKeepPortable();
-
-        for (int i = 0; i < 100; i++) {
-            PortableBuilder builder = portables.builder("type-" + i);
-
-            builder.setField("f0", i);
-
-            cache.put(i, builder.build());
-        }
-
-        assertEquals(100, ignite(0).portables().metadata().size());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java
deleted file mode 100644
index a66d940..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataTest.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.util.Arrays;
-import java.util.Collection;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-
-/**
- *
- */
-public class GridCacheClientNodePortableMetadataTest extends GridCacheAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 4;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
-        typeCfg.setClassName(TestObject1.class.getName());
-        typeCfg.setAffinityKeyFieldName("val2");
-
-        marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
-        if (gridName.equals(getTestGridName(gridCount() - 1)))
-            cfg.setClientMode(true);
-
-        cfg.setMarshaller(marsh);
-
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableMetadataOnClient() throws Exception {
-        Ignite ignite0 = ignite(gridCount() - 1);
-
-        assertTrue(ignite0.configuration().isClientMode());
-
-        Ignite ignite1 = ignite(0);
-
-        assertFalse(ignite1.configuration().isClientMode());
-
-        Affinity<Object> aff0 = ignite0.affinity(null);
-        Affinity<Object> aff1 = ignite1.affinity(null);
-
-        for (int i = 0 ; i < 100; i++) {
-            TestObject1 obj1 = new TestObject1(i, i + 1);
-
-            assertEquals(aff1.mapKeyToPrimaryAndBackups(obj1),
-                aff0.mapKeyToPrimaryAndBackups(obj1));
-
-            TestObject2 obj2 = new TestObject2(i, i + 1);
-
-            assertEquals(aff1.mapKeyToPrimaryAndBackups(obj2),
-                aff0.mapKeyToPrimaryAndBackups(obj2));
-        }
-
-        {
-            PortableBuilder builder = ignite0.portables().builder("TestObject3");
-
-            builder.setField("f1", 1);
-
-            ignite0.cache(null).put(0, builder.build());
-
-            IgniteCache<Integer, PortableObject> cache = ignite0.cache(null).withKeepPortable();
-
-            PortableObject obj = cache.get(0);
-
-            PortableMetadata meta = obj.metaData();
-
-            assertNotNull(meta);
-            assertEquals(1, meta.fields().size());
-
-            meta = ignite0.portables().metadata(TestObject1.class);
-
-            assertNotNull(meta);
-            assertEquals("val2", meta.affinityKeyFieldName());
-
-            meta = ignite0.portables().metadata(TestObject2.class);
-
-            assertNotNull(meta);
-            assertNull(meta.affinityKeyFieldName());
-        }
-
-        {
-            PortableBuilder builder = ignite1.portables().builder("TestObject3");
-
-            builder.setField("f2", 2);
-
-            ignite1.cache(null).put(1, builder.build());
-
-            IgniteCache<Integer, PortableObject> cache = ignite1.cache(null).withKeepPortable();
-
-            PortableObject obj = cache.get(0);
-
-            PortableMetadata meta = obj.metaData();
-
-            assertNotNull(meta);
-            assertEquals(2, meta.fields().size());
-
-            meta = ignite1.portables().metadata(TestObject1.class);
-
-            assertNotNull(meta);
-            assertEquals("val2", meta.affinityKeyFieldName());
-
-            meta = ignite1.portables().metadata(TestObject2.class);
-
-            assertNotNull(meta);
-            assertNull(meta.affinityKeyFieldName());
-        }
-
-        PortableMetadata meta = ignite0.portables().metadata("TestObject3");
-
-        assertNotNull(meta);
-        assertEquals(2, meta.fields().size());
-
-        IgniteCache<Integer, PortableObject> cache = ignite0.cache(null).withKeepPortable();
-
-        PortableObject obj = cache.get(1);
-
-        assertEquals(Integer.valueOf(2), obj.field("f2"));
-        assertNull(obj.field("f1"));
-
-        meta = obj.metaData();
-
-        assertNotNull(meta);
-        assertEquals(2, meta.fields().size());
-
-        Collection<PortableMetadata> meta1 = ignite1.portables().metadata();
-        Collection<PortableMetadata> meta2 = ignite1.portables().metadata();
-
-        assertEquals(meta1.size(), meta2.size());
-
-        for (PortableMetadata m1 : meta1) {
-            boolean found = false;
-
-            for (PortableMetadata m2 : meta1) {
-                if (m1.typeName().equals(m2.typeName())) {
-                    assertEquals(m1.affinityKeyFieldName(), m2.affinityKeyFieldName());
-                    assertEquals(m1.fields(), m2.fields());
-
-                    found = true;
-
-                    break;
-                }
-            }
-
-            assertTrue(found);
-        }
-    }
-
-    /**
-     *
-     */
-    static class TestObject1 {
-        /** */
-        private int val1;
-
-        /** */
-        private int val2;
-
-        /**
-         * @param val1 Value 1.
-         * @param val2 Value 2.
-         */
-        public TestObject1(int val1, int val2) {
-            this.val1 = val1;
-            this.val2 = val2;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            TestObject1 that = (TestObject1)o;
-
-            return val1 == that.val1;
-
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val1;
-        }
-    }
-
-    /**
-     *
-     */
-    static class TestObject2 {
-        /** */
-        private int val1;
-
-        /** */
-        private int val2;
-
-        /**
-         * @param val1 Value 1.
-         * @param val2 Value 2.
-         */
-        public TestObject2(int val1, int val2) {
-            this.val1 = val1;
-            this.val2 = val2;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            TestObject2 that = (TestObject2)o;
-
-            return val2 == that.val2;
-
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val2;
-        }
-    }
-}
\ No newline at end of file


[04/41] ignite git commit: ignite-257: fixed most of the test. Only collocated and near tests are keep failing.

Posted by ag...@apache.org.
ignite-257: fixed most of the test. Only collocated and near tests are keep failing.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b5d85453
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b5d85453
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b5d85453

Branch: refs/heads/ignite-1400
Commit: b5d8545341aeb2b58904a4d9b4405b608d53baee
Parents: e1707b6
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Sep 11 10:16:50 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Fri Sep 11 10:16:50 2015 +0300

----------------------------------------------------------------------
 .../IgniteTxExceptionAbstractSelfTest.java      | 29 ++++++++++++++------
 .../GridCacheColocatedTxExceptionSelfTest.java  | 20 ++++++++++----
 .../near/GridCacheNearTxExceptionSelfTest.java  |  2 +-
 .../GridCacheReplicatedTxExceptionSelfTest.java |  5 ----
 .../GridCacheLocalTxExceptionSelfTest.java      |  5 ----
 5 files changed, 37 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
index bdbc004..10b47fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
@@ -26,7 +26,9 @@ import javax.cache.Cache;
 import javax.cache.CacheException;
 import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -64,7 +66,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
     private static final int NOT_PRIMARY_AND_BACKUP = 2;
 
     /** */
-    private static Integer lastKey;
+    private static volatile Integer lastKey;
 
     /** {@inheritDoc} */
     @Override protected int gridCount() {
@@ -91,6 +93,8 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
         ccfg.setWriteThrough(false);
         ccfg.setLoadPreviousValue(true);
 
+        ccfg.setIndexedTypes(Integer.class, Integer.class);
+
         return ccfg;
     }
 
@@ -105,8 +109,18 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
     @Override protected void afterTest() throws Exception {
         idxSpi.forceFail(false);
 
-        for (int key = 0; key < lastKey; key++)
+        Transaction tx = jcache().unwrap(Ignite.class).transactions().tx();
+
+        if (tx != null) {
+            tx.close();
+
+            fail("Cache transaction remained after test completion: " + tx);
+        }
+
+        for (int key = 0; key <= lastKey; key++)
             grid(0).cache(null).remove(key);
+
+        assertEquals(0, jcache(0).size(CachePeekMode.ALL));
     }
 
     /** {@inheritDoc} */
@@ -367,7 +381,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
         info("Check key: " + key);
 
         for (int i = 0; i < gridCount(); i++) {
-            IgniteKernal grid = (IgniteKernal) grid(i);
+            IgniteKernal grid = (IgniteKernal)grid(i);
 
             GridCacheAdapter cache = grid.internalCache(null);
 
@@ -383,9 +397,8 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
                 log.info("Dht entry: " + entry);
 
-                if (entry != null) {
+                if (entry != null)
                     assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + entry + ']', entry.lockedByAny());
-                }
             }
         }
     }
@@ -459,7 +472,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
             }
         }, CacheException.class, null);
 
-        assertTrue("Unexpected cause: "  +e, e.getCause() instanceof TransactionHeuristicException);
+        assertTrue("Unexpected cause: " + e, e.getCause() instanceof TransactionHeuristicException);
 
         checkUnlocked(key);
     }
@@ -469,7 +482,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
      * @param keys Keys.
      * @throws Exception If failed.
      */
-    private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception {
+    private void checkPutAll(boolean putBefore, Integer... keys) throws Exception {
         assert keys.length > 1;
 
         if (putBefore) {
@@ -616,7 +629,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
         }
 
         /** {@inheritDoc} */
-        @Override public Iterator<Cache.Entry<?,?>> query(@Nullable String spaceName, Collection<Object> params,
+        @Override public Iterator<Cache.Entry<?, ?>> query(@Nullable String spaceName, Collection<Object> params,
             @Nullable IndexingQueryFilter filters) throws IgniteSpiException {
             throw new UnsupportedOperationException();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
index 5c1435f..86f32f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
@@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
  */
 public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
-    }
-
-    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return PARTITIONED;
     }
@@ -41,4 +36,19 @@ public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbst
     @Override protected NearCacheConfiguration nearConfiguration() {
         return null;
     }
+
+    /** {@inheritDoc} */
+    @Override public void testRemovePrimary() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testPutPrimary() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testTransformPrimary() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-257");
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
index 4cb47f4..67bccac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
@@ -27,7 +27,7 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
  */
 public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
+    @Override protected void beforeTestsStarted() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-257");
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
index fa74043..1c96a4d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedTxExceptionSelfTest.java
@@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.REPLICATED;
  */
 public class GridCacheReplicatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
-    }
-
-    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return REPLICATED;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5d85453/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
index a112462..63a900d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
@@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
-    }
-
-    /** {@inheritDoc} */
     @Override protected int gridCount() {
         return 1;
     }


[20/41] ignite git commit: Fixed test.

Posted by ag...@apache.org.
Fixed test.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d0766224
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d0766224
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d0766224

Branch: refs/heads/ignite-1400
Commit: d07662248ddc02c39f42a026323b7e77e66bc1f0
Parents: de632ac
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 14 09:43:40 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 14 09:43:40 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheVariableTopologySelfTest.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d0766224/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
index 82e3f98..7078843 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionRollbackException;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -142,8 +143,8 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
 
                         tx.commit();
                     }
-                    catch (ClusterTopologyException e) {
-                        info("Caught topology exception: " + e);
+                    catch (TransactionRollbackException | ClusterTopologyException e) {
+                        info("Caught exception: " + e);
                     }
                     catch (IgniteException e) {
                         if (X.hasCause(e, ClusterTopologyCheckedException.class))


[16/41] ignite git commit: ignite-1250 JDBC driver: migration to embedded Ignite client node

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
new file mode 100644
index 0000000..98a2563
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
@@ -0,0 +1,1401 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
+import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+import static java.sql.Connection.TRANSACTION_NONE;
+import static java.sql.ResultSet.CONCUR_READ_ONLY;
+import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
+import static java.sql.RowIdLifetime.ROWID_UNSUPPORTED;
+
+/**
+ * JDBC database metadata implementation.
+ */
+public class JdbcDatabaseMetadata implements DatabaseMetaData {
+    /** Connection. */
+    private final JdbcConnection conn;
+
+    /** Metadata. */
+    private Map<String, Map<String, Map<String, String>>> meta;
+
+    /** Index info. */
+    private Collection<List<Object>> indexes;
+
+    /**
+     * @param conn Connection.
+     */
+    JdbcDatabaseMetadata(JdbcConnection conn) {
+        this.conn = conn;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean allProceduresAreCallable() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean allTablesAreSelectable() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getURL() throws SQLException {
+        return conn.url();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getUserName() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadOnly() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean nullsAreSortedHigh() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean nullsAreSortedLow() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean nullsAreSortedAtStart() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean nullsAreSortedAtEnd() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getDatabaseProductName() throws SQLException {
+        return "Ignite Cache";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getDatabaseProductVersion() throws SQLException {
+        return "4.1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getDriverName() throws SQLException {
+        return "Ignite JDBC Driver";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getDriverVersion() throws SQLException {
+        return "1.0";
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDriverMajorVersion() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDriverMinorVersion() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean usesLocalFiles() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean usesLocalFilePerTable() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsMixedCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean storesUpperCaseIdentifiers() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean storesLowerCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean storesMixedCaseIdentifiers() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getIdentifierQuoteString() throws SQLException {
+        return " ";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSQLKeywords() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getNumericFunctions() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getStringFunctions() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSystemFunctions() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getTimeDateFunctions() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSearchStringEscape() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getExtraNameCharacters() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsAlterTableWithAddColumn() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsAlterTableWithDropColumn() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsColumnAliasing() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean nullPlusNonNullIsNull() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsConvert() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsConvert(int fromType, int toType) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsTableCorrelationNames() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsExpressionsInOrderBy() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsOrderByUnrelated() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsGroupBy() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsGroupByUnrelated() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsGroupByBeyondSelect() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsLikeEscapeClause() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsMultipleResultSets() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsMultipleTransactions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsNonNullableColumns() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsMinimumSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCoreSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsExtendedSQLGrammar() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsANSI92IntermediateSQL() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsANSI92FullSQL() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsOuterJoins() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsFullOuterJoins() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsLimitedOuterJoins() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSchemaTerm() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getProcedureTerm() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCatalogTerm() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isCatalogAtStart() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCatalogSeparator() throws SQLException {
+        return "";
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSchemasInDataManipulation() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSchemasInProcedureCalls() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSchemasInTableDefinitions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCatalogsInDataManipulation() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsPositionedDelete() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsPositionedUpdate() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSelectForUpdate() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsStoredProcedures() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSubqueriesInComparisons() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSubqueriesInExists() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSubqueriesInIns() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsCorrelatedSubqueries() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsUnion() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsUnionAll() throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxBinaryLiteralLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxCharLiteralLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxColumnNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxColumnsInGroupBy() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxColumnsInIndex() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxColumnsInOrderBy() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxColumnsInSelect() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxColumnsInTable() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxConnections() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxCursorNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxIndexLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxSchemaNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxProcedureNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxCatalogNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxRowSize() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxStatementLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxStatements() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxTableNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxTablesInSelect() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getMaxUserNameLength() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDefaultTransactionIsolation() throws SQLException {
+        return TRANSACTION_NONE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsTransactions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getProcedures(String catalog, String schemaPtrn,
+        String procedureNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME",
+                "REMARKS", "PROCEDURE_TYPE", "SPECIFIC_NAME"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), Short.class.getName(), String.class.getName()),
+            Collections.<List<?>>emptyList(), true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getProcedureColumns(String catalog, String schemaPtrn, String procedureNamePtrn,
+        String colNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("PROCEDURE_CAT", "PROCEDURE_SCHEM", "PROCEDURE_NAME",
+                "COLUMN_NAME", "COLUMN_TYPE", "DATA_TYPE", "TYPE_NAME", "PRECISION",
+                "LENGTH", "SCALE", "RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF",
+                "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH",
+                "ORDINAL_POSITION", "IS_NULLABLE", "SPECIFIC_NAME"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), Short.class.getName(), Integer.class.getName(), String.class.getName(),
+                Integer.class.getName(), Integer.class.getName(), Short.class.getName(), Short.class.getName(),
+                Short.class.getName(), String.class.getName(), String.class.getName(), Integer.class.getName(),
+                Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
+                String.class.getName()),
+            Collections.<List<?>>emptyList(), true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn,
+        String[] tblTypes) throws SQLException {
+        updateMetaData();
+
+        List<List<?>> rows = new LinkedList<>();
+
+        if (tblTypes == null || Arrays.asList(tblTypes).contains("TABLE"))
+            for (Map.Entry<String, Map<String, Map<String, String>>> schema : meta.entrySet())
+                if (matches(schema.getKey(), schemaPtrn))
+                    for (String tbl : schema.getValue().keySet())
+                        if (matches(tbl, tblNamePtrn))
+                            rows.add(tableRow(schema.getKey(), tbl));
+
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT",
+                "TYPE_SCHEM", "TYPE_NAME", "SELF_REFERENCING_COL_NAME", "REF_GENERATION"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), String.class.getName(), String.class.getName()),
+            rows, true
+        );
+    }
+
+    /**
+     * @param schema Schema name.
+     * @param tbl Table name.
+     * @return Table metadata row.
+     */
+    private List<Object> tableRow(String schema, String tbl) {
+        List<Object> row = new ArrayList<>(10);
+
+        row.add(null);
+        row.add(schema);
+        row.add(tbl.toUpperCase());
+        row.add("TABLE");
+        row.add(null);
+        row.add(null);
+        row.add(null);
+        row.add(null);
+        row.add(null);
+        row.add(null);
+
+        return row;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getSchemas() throws SQLException {
+        return getSchemas(null, "%");
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getCatalogs() throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.singletonList("TABLE_CAT"),
+            Collections.singletonList(String.class.getName()),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getTableTypes() throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.singletonList("TABLE_TYPE"),
+            Collections.singletonList(String.class.getName()),
+            Collections.<List<?>>singletonList(Collections.singletonList("TABLE")),
+            true);
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getColumns(String catalog, String schemaPtrn, String tblNamePtrn,
+        String colNamePtrn) throws SQLException {
+        updateMetaData();
+
+        List<List<?>> rows = new LinkedList<>();
+
+        int cnt = 0;
+
+        for (Map.Entry<String, Map<String, Map<String, String>>> schema : meta.entrySet())
+            if (matches(schema.getKey(), schemaPtrn))
+                for (Map.Entry<String, Map<String, String>> tbl : schema.getValue().entrySet())
+                    if (matches(tbl.getKey(), tblNamePtrn))
+                        for (Map.Entry<String, String> col : tbl.getValue().entrySet())
+                            rows.add(columnRow(schema.getKey(), tbl.getKey(), col.getKey(),
+                                JdbcUtils.type(col.getValue()), JdbcUtils.typeName(col.getValue()),
+                                JdbcUtils.nullable(col.getKey(), col.getValue()), ++cnt));
+
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE",
+                "TYPE_NAME", "COLUMN_SIZE", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE",
+                "REMARKS", "COLUMN_DEF", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE",
+                "SCOPE_CATLOG", "SCOPE_SCHEMA", "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), Integer.class.getName(), String.class.getName(), Integer.class.getName(),
+                Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
+                String.class.getName(), Integer.class.getName(), Integer.class.getName(), String.class.getName(),
+                String.class.getName(), String.class.getName(), String.class.getName(), Short.class.getName(),
+                String.class.getName()),
+            rows, true
+        );
+    }
+
+    /**
+     * @param schema Schema name.
+     * @param tbl Table name.
+     * @param col Column name.
+     * @param type Type.
+     * @param typeName Type name.
+     * @param nullable Nullable flag.
+     * @param pos Ordinal position.
+     * @return Column metadata row.
+     */
+    private List<Object> columnRow(String schema, String tbl, String col, int type, String typeName,
+        boolean nullable, int pos) {
+        List<Object> row = new ArrayList<>(20);
+
+        row.add(null);
+        row.add(schema);
+        row.add(tbl);
+        row.add(col);
+        row.add(type);
+        row.add(typeName);
+        row.add(null);
+        row.add(null);
+        row.add(10);
+        row.add(nullable ? columnNullable : columnNoNulls);
+        row.add(null);
+        row.add(null);
+        row.add(Integer.MAX_VALUE);
+        row.add(pos);
+        row.add("YES");
+        row.add(null);
+        row.add(null);
+        row.add(null);
+        row.add(null);
+        row.add("NO");
+
+        return row;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getColumnPrivileges(String catalog, String schema, String tbl,
+        String colNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getTablePrivileges(String catalog, String schemaPtrn,
+        String tblNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String tbl, int scope,
+        boolean nullable) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getVersionColumns(String catalog, String schema, String tbl) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getPrimaryKeys(String catalog, String schema, String tbl) throws SQLException {
+        updateMetaData();
+
+        List<List<?>> rows = new LinkedList<>();
+
+        for (Map.Entry<String, Map<String, Map<String, String>>> s : meta.entrySet())
+            if (schema == null || schema.toUpperCase().equals(s.getKey()))
+                for (Map.Entry<String, Map<String, String>> t : s.getValue().entrySet())
+                    if (tbl == null || tbl.toUpperCase().equals(t.getKey()))
+                        rows.add(Arrays.<Object>asList(null, s.getKey().toUpperCase(),
+                            t.getKey().toUpperCase(), "_KEY", 1, "_KEY"));
+
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "KEY_SEQ", "PK_NAME"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), Short.class.getName(), String.class.getName()),
+            rows, true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getImportedKeys(String catalog, String schema, String tbl) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getExportedKeys(String catalog, String schema, String tbl) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTbl,
+        String foreignCatalog, String foreignSchema, String foreignTbl) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getTypeInfo() throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getIndexInfo(String catalog, String schema, String tbl, boolean unique,
+        boolean approximate) throws SQLException {
+        Collection<List<?>> rows = new ArrayList<>(indexes.size());
+
+        for (List<Object> idx : indexes) {
+            String idxSchema = (String)idx.get(0);
+            String idxTbl = (String)idx.get(1);
+
+            if ((schema == null || schema.equals(idxSchema)) && (tbl == null || tbl.equals(idxTbl))) {
+                List<Object> row = new ArrayList<>(13);
+
+                row.add(null);
+                row.add(idxSchema);
+                row.add(idxTbl);
+                row.add(idx.get(2));
+                row.add(null);
+                row.add(idx.get(3));
+                row.add((int)tableIndexOther);
+                row.add(idx.get(4));
+                row.add(idx.get(5));
+                row.add((Boolean)idx.get(6) ? "D" : "A");
+                row.add(0);
+                row.add(0);
+                row.add(null);
+
+                rows.add(row);
+            }
+        }
+
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER",
+                "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY",
+                "PAGES", "FILTER_CONDITION"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                Boolean.class.getName(), String.class.getName(), String.class.getName(), Short.class.getName(),
+                Short.class.getName(), String.class.getName(), String.class.getName(), Integer.class.getName(),
+                Integer.class.getName(), String.class.getName()),
+            rows, true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsResultSetType(int type) throws SQLException {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
+        return concurrency == CONCUR_READ_ONLY;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean ownUpdatesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean ownDeletesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean ownInsertsAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean othersUpdatesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean othersDeletesAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean othersInsertsAreVisible(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean updatesAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean deletesAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean insertsAreDetected(int type) throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsBatchUpdates() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getUDTs(String catalog, String schemaPtrn, String typeNamePtrn,
+        int[] types) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public Connection getConnection() throws SQLException {
+        return conn;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsSavepoints() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsNamedParameters() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsMultipleOpenResults() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsGetGeneratedKeys() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getSuperTypes(String catalog, String schemaPtrn,
+        String typeNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getSuperTables(String catalog, String schemaPtrn,
+        String tblNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getAttributes(String catalog, String schemaPtrn, String typeNamePtrn,
+        String attributeNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsResultSetHoldability(int holdability) throws SQLException {
+        return holdability == HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getResultSetHoldability() throws SQLException {
+        return HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDatabaseMajorVersion() throws SQLException {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDatabaseMinorVersion() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getJDBCMajorVersion() throws SQLException {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getJDBCMinorVersion() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getSQLStateType() throws SQLException {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean locatorsUpdateCopy() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsStatementPooling() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public RowIdLifetime getRowIdLifetime() throws SQLException {
+        return ROWID_UNSUPPORTED;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getSchemas(String catalog, String schemaPtrn) throws SQLException {
+        updateMetaData();
+
+        List<List<?>> rows = new ArrayList<>(meta.size());
+
+        for (String schema : meta.keySet())
+            if (matches(schema, schemaPtrn))
+                rows.add(Arrays.<Object>asList(schema, null));
+
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("TABLE_SCHEM", "TABLE_CATALOG"),
+            Arrays.asList(String.class.getName(), String.class.getName()),
+            rows, true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getClientInfoProperties() throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getFunctions(String catalog, String schemaPtrn,
+        String functionNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME",
+                "REMARKS", "FUNCTION_TYPE", "SPECIFIC_NAME"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), Short.class.getName(), String.class.getName()),
+            Collections.<List<?>>emptyList(), true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getFunctionColumns(String catalog, String schemaPtrn, String functionNamePtrn,
+        String colNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Arrays.asList("FUNCTION_CAT", "FUNCTION_SCHEM", "FUNCTION_NAME",
+                "COLUMN_NAME", "COLUMN_TYPE", "DATA_TYPE", "TYPE_NAME", "PRECISION",
+                "LENGTH", "SCALE", "RADIX", "NULLABLE", "REMARKS", "CHAR_OCTET_LENGTH",
+                "ORDINAL_POSITION", "IS_NULLABLE", "SPECIFIC_NAME"),
+            Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(),
+                String.class.getName(), Short.class.getName(), Integer.class.getName(), String.class.getName(),
+                Integer.class.getName(), Integer.class.getName(), Short.class.getName(), Short.class.getName(),
+                Short.class.getName(), String.class.getName(), Integer.class.getName(), Integer.class.getName(),
+                String.class.getName(), String.class.getName()),
+            Collections.<List<?>>emptyList(), true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Database meta data is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface == DatabaseMetaData.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet getPseudoColumns(String catalog, String schemaPtrn, String tblNamePtrn,
+        String colNamePtrn) throws SQLException {
+        return new JdbcResultSet(null,
+            conn.createStatement0(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<String>emptyList(),
+            Collections.<List<?>>emptyList(),
+            true
+        );
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean generatedKeyAlwaysReturned() throws SQLException {
+        return false;
+    }
+
+    /**
+     * Updates meta data.
+     *
+     * @throws SQLException In case of error.
+     */
+    @SuppressWarnings("unchecked")
+    private void updateMetaData() throws SQLException {
+        if (conn.isClosed())
+            throw new SQLException("Connection is closed.");
+
+        try {
+            Ignite ignite = conn.ignite();
+
+            UUID nodeId = conn.nodeId();
+
+            Collection<GridCacheSqlMetadata> metas;
+
+            UpdateMetadataTask task = new UpdateMetadataTask(conn.cacheName(), nodeId == null ? ignite : null);
+
+            metas = nodeId == null ? task.call() : ignite.compute(ignite.cluster().forNodeId(nodeId)).call(task);
+
+            meta = U.newHashMap(metas.size());
+
+            indexes = new ArrayList<>();
+
+            for (GridCacheSqlMetadata m : metas) {
+                String name = m.cacheName();
+
+                if (name == null)
+                    name = "PUBLIC";
+
+                Collection<String> types = m.types();
+
+                Map<String, Map<String, String>> typesMap = U.newHashMap(types.size());
+
+                for (String type : types) {
+                    typesMap.put(type.toUpperCase(), m.fields(type));
+
+                    for (GridCacheSqlIndexMetadata idx : m.indexes(type)) {
+                        int cnt = 0;
+
+                        for (String field : idx.fields()) {
+                            indexes.add(F.<Object>asList(name, type.toUpperCase(), !idx.unique(),
+                                idx.name().toUpperCase(), ++cnt, field, idx.descending(field)));
+                        }
+                    }
+                }
+
+                meta.put(name, typesMap);
+            }
+        }
+        catch (Exception e) {
+            throw new SQLException("Failed to get meta data from Ignite.", e);
+        }
+    }
+
+    /**
+     * Checks whether string matches SQL pattern.
+     *
+     * @param str String.
+     * @param ptrn Pattern.
+     * @return Whether string matches pattern.
+     */
+    private boolean matches(String str, String ptrn) {
+        return str != null && (ptrn == null ||
+            str.toUpperCase().matches(ptrn.toUpperCase().replace("%", ".*").replace("_", ".")));
+    }
+
+    /**
+     *
+     */
+    private static class UpdateMetadataTask implements IgniteCallable<Collection<GridCacheSqlMetadata>> {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /** Ignite. */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** Cache name. */
+        private final String cacheName;
+
+        /**
+         * @param cacheName Cache name.
+         * @param ignite Ignite.
+         */
+        public UpdateMetadataTask(String cacheName, Ignite ignite) {
+            this.cacheName = cacheName;
+            this.ignite = ignite;
+        }
+
+        /** {@inheritDoc} */
+        @SuppressWarnings("unchecked")
+        @Override public Collection<GridCacheSqlMetadata> call() throws Exception {
+            IgniteCache cache = ignite.cache(cacheName);
+
+            return ((IgniteCacheProxy)cache).context().queries().sqlMetadata();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatement.java
new file mode 100644
index 0000000..a99f24c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatement.java
@@ -0,0 +1,411 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.io.*;
+import java.math.*;
+import java.net.*;
+import java.sql.*;
+import java.sql.Date;
+import java.util.*;
+
+/**
+ * JDBC prepared statement implementation.
+ */
+public class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement {
+    /** SQL query. */
+    private final String sql;
+
+    /** Arguments count. */
+    private final int argsCnt;
+
+    /**
+     * Creates new prepared statement.
+     *
+     * @param conn Connection.
+     * @param sql SQL query.
+     */
+    JdbcPreparedStatement(JdbcConnection conn, String sql) {
+        super(conn);
+
+        this.sql = sql;
+
+        argsCnt = sql.replaceAll("[^?]", "").length();
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSet executeQuery() throws SQLException {
+        ResultSet rs = executeQuery(sql);
+
+        args = null;
+
+        return rs;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int executeUpdate() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNull(int paramIdx, int sqlType) throws SQLException {
+        setArgument(paramIdx, null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBoolean(int paramIdx, boolean x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setByte(int paramIdx, byte x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setShort(int paramIdx, short x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setInt(int paramIdx, int x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setLong(int paramIdx, long x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setFloat(int paramIdx, float x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setDouble(int paramIdx, double x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBigDecimal(int paramIdx, BigDecimal x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setString(int paramIdx, String x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBytes(int paramIdx, byte[] x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setDate(int paramIdx, Date x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTime(int paramIdx, Time x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTimestamp(int paramIdx, Timestamp x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAsciiStream(int paramIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setUnicodeStream(int paramIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBinaryStream(int paramIdx, InputStream x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearParameters() throws SQLException {
+        ensureNotClosed();
+
+        args = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setObject(int paramIdx, Object x, int targetSqlType) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setObject(int paramIdx, Object x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean execute() throws SQLException {
+        return execute(sql);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void addBatch() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCharacterStream(int paramIdx, Reader x, int len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setRef(int paramIdx, Ref x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBlob(int paramIdx, Blob x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClob(int paramIdx, Clob x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setArray(int paramIdx, Array x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public ResultSetMetaData getMetaData() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Meta data for prepared statement is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setDate(int paramIdx, Date x, Calendar cal) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTime(int paramIdx, Time x, Calendar cal) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTimestamp(int paramIdx, Timestamp x, Calendar cal) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNull(int paramIdx, int sqlType, String typeName) throws SQLException {
+        setNull(paramIdx, sqlType);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setURL(int paramIdx, URL x) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public ParameterMetaData getParameterMetaData() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Meta data for prepared statement is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setRowId(int paramIdx, RowId x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNString(int paramIdx, String val) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNCharacterStream(int paramIdx, Reader val, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNClob(int paramIdx, NClob val) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClob(int paramIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBlob(int paramIdx, InputStream inputStream, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNClob(int paramIdx, Reader reader, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setSQLXML(int paramIdx, SQLXML xmlObj) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setObject(int paramIdx, Object x, int targetSqlType,
+        int scaleOrLen) throws SQLException {
+        setArgument(paramIdx, x);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAsciiStream(int paramIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBinaryStream(int paramIdx, InputStream x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCharacterStream(int paramIdx, Reader x, long len) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAsciiStream(int paramIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBinaryStream(int paramIdx, InputStream x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCharacterStream(int paramIdx, Reader x) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Streams are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNCharacterStream(int paramIdx, Reader val) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClob(int paramIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setBlob(int paramIdx, InputStream inputStream) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNClob(int paramIdx, Reader reader) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /**
+     * Sets query argument value.
+     *
+     * @param paramIdx Index.
+     * @param val Value.
+     * @throws SQLException If index is invalid.
+     */
+    private void setArgument(int paramIdx, Object val) throws SQLException {
+        ensureNotClosed();
+
+        if (paramIdx < 1 || paramIdx > argsCnt)
+            throw new SQLException("Parameter index is invalid: " + paramIdx);
+
+        if (args == null)
+            args = new Object[argsCnt];
+
+        args[paramIdx - 1] = val;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
new file mode 100644
index 0000000..ac711b8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcQueryTask.java
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteJdbcDriver;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
+import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
+import org.apache.ignite.internal.util.typedef.CAX;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ * Task for SQL queries execution through {@link IgniteJdbcDriver}.
+ * <p>
+ * Not closed cursors will be removed after {@link #RMV_DELAY} milliseconds.
+ * This parameter can be configured via {@link IgniteSystemProperties#IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY}
+ * system property.
+ */
+class JdbcQueryTask implements IgniteCallable<JdbcQueryTask.QueryResult> {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** How long to store open cursor. */
+    private static final long RMV_DELAY = IgniteSystemProperties.getLong(
+        IgniteSystemProperties.IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY, 600000);
+
+    /** Scheduler. */
+    private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(1);
+
+    /** Open cursors. */
+    private static final ConcurrentMap<UUID, Cursor> CURSORS = new ConcurrentHashMap<>();
+
+    /** Ignite. */
+    @IgniteInstanceResource
+    private Ignite ignite;
+
+    /** Uuid. */
+    private final UUID uuid;
+
+    /** Cache name. */
+    private final String cacheName;
+
+    /** Sql. */
+    private final String sql;
+
+    /** Args. */
+    private final Object[] args;
+
+    /** Fetch size. */
+    private final int fetchSize;
+
+    /** Local execution flag. */
+    private final boolean loc;
+
+    /** Local query flag. */
+    private final boolean locQry;
+
+    /** Collocated query flag. */
+    private final boolean collocatedQry;
+
+    /**
+     * @param ignite Ignite.
+     * @param cacheName Cache name.
+     * @param sql Sql query.
+     * @param loc Local execution flag.
+     * @param args Args.
+     * @param fetchSize Fetch size.
+     * @param uuid UUID.
+     * @param locQry Local query flag.
+     * @param collocatedQry Collocated query flag.
+     */
+    public JdbcQueryTask(Ignite ignite, String cacheName, String sql,
+        boolean loc, Object[] args, int fetchSize, UUID uuid, boolean locQry, boolean collocatedQry) {
+        this.ignite = ignite;
+        this.args = args;
+        this.uuid = uuid;
+        this.cacheName = cacheName;
+        this.sql = sql;
+        this.fetchSize = fetchSize;
+        this.loc = loc;
+        this.locQry = locQry;
+        this.collocatedQry = collocatedQry;
+    }
+
+    /** {@inheritDoc} */
+    @Override public JdbcQueryTask.QueryResult call() throws Exception {
+        Cursor cursor = CURSORS.get(uuid);
+
+        List<String> tbls = null;
+        List<String> cols = null;
+        List<String> types = null;
+
+        boolean first;
+
+        if (first = (cursor == null)) {
+            IgniteCache<?, ?> cache = ignite.cache(cacheName);
+
+            SqlFieldsQuery qry = new SqlFieldsQuery(sql).setArgs(args);
+
+            qry.setPageSize(fetchSize);
+            qry.setLocal(locQry);
+            qry.setCollocated(collocatedQry);
+
+            QueryCursor<List<?>> qryCursor = cache.query(qry);
+
+            Collection<GridQueryFieldMetadata> meta = ((QueryCursorImpl<List<?>>)qryCursor).fieldsMeta();
+
+            tbls = new ArrayList<>(meta.size());
+            cols = new ArrayList<>(meta.size());
+            types = new ArrayList<>(meta.size());
+
+            for (GridQueryFieldMetadata desc : meta) {
+                tbls.add(desc.typeName());
+                cols.add(desc.fieldName().toUpperCase());
+                types.add(desc.fieldTypeName());
+            }
+
+            CURSORS.put(uuid, cursor = new Cursor(qryCursor, qryCursor.iterator()));
+        }
+
+        List<List<?>> rows = new ArrayList<>();
+
+        for (List<?> row : cursor) {
+            List<Object> row0 = new ArrayList<>(row.size());
+
+            for (Object val : row)
+                row0.add(JdbcUtils.sqlType(val) ? val : val.toString());
+
+            rows.add(row0);
+
+            if (rows.size() == fetchSize) // If fetchSize is 0 then unlimited
+                break;
+        }
+
+        boolean finished = !cursor.hasNext();
+
+        if (finished)
+            remove(uuid, cursor);
+        else if (first) {
+            if (!loc)
+                scheduleRemoval(uuid, RMV_DELAY);
+        }
+        else if (!loc && !CURSORS.replace(uuid, cursor, new Cursor(cursor.cursor, cursor.iter)))
+            assert !CURSORS.containsKey(uuid) : "Concurrent cursor modification.";
+
+        return new QueryResult(uuid, finished, rows, cols, tbls, types);
+    }
+
+    /**
+     * Schedules removal of stored cursor in case of remote query execution.
+     *
+     * @param uuid Cursor UUID.
+     * @param delay Delay in milliseconds.
+     */
+    private void scheduleRemoval(final UUID uuid, long delay) {
+        assert !loc;
+
+        SCHEDULER.schedule(new CAX() {
+            @Override public void applyx() {
+                while (true) {
+                    Cursor c = CURSORS.get(uuid);
+
+                    if (c == null)
+                        break;
+
+                    // If the cursor was accessed since last scheduling then reschedule.
+                    long untouchedTime = U.currentTimeMillis() - c.lastAccessTime;
+
+                    if (untouchedTime < RMV_DELAY) {
+                        scheduleRemoval(uuid, RMV_DELAY - untouchedTime);
+
+                        break;
+                    }
+                    else if (remove(uuid, c))
+                        break;
+                }
+            }
+        }, delay, TimeUnit.MILLISECONDS);
+    }
+
+    /**
+     * @param uuid Cursor UUID.
+     * @param c Cursor.
+     * @return {@code true} If succeeded.
+     */
+    private static boolean remove(UUID uuid, Cursor c) {
+        boolean rmv = CURSORS.remove(uuid, c);
+
+        if (rmv)
+            c.cursor.close();
+
+        return rmv;
+    }
+
+    /**
+     * Closes and removes cursor.
+     *
+     * @param uuid Cursor UUID.
+     */
+    static void remove(UUID uuid) {
+        Cursor c = CURSORS.remove(uuid);
+
+        if (c != null)
+            c.cursor.close();
+    }
+
+
+    /**
+     * Result of query execution.
+     */
+    static class QueryResult implements Serializable {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /** Uuid. */
+        private final UUID uuid;
+
+        /** Finished. */
+        private final boolean finished;
+
+        /** Rows. */
+        private final List<List<?>> rows;
+
+        /** Tables. */
+        private final List<String> tbls;
+
+        /** Columns. */
+        private final List<String> cols;
+
+        /** Types. */
+        private final List<String> types;
+
+        /**
+         * @param uuid UUID..
+         * @param finished Finished.
+         * @param rows Rows.
+         * @param cols Columns.
+         * @param tbls Tables.
+         * @param types Types.
+         */
+        public QueryResult(UUID uuid, boolean finished, List<List<?>> rows, List<String> cols,
+            List<String> tbls, List<String> types) {
+            this.cols = cols;
+            this.uuid = uuid;
+            this.finished = finished;
+            this.rows = rows;
+            this.tbls = tbls;
+            this.types = types;
+        }
+
+        /**
+         * @return Query result rows.
+         */
+        public List<List<?>> getRows() {
+            return rows;
+        }
+
+        /**
+         * @return Tables metadata.
+         */
+        public List<String> getTbls() {
+            return tbls;
+        }
+
+        /**
+         * @return Columns metadata.
+         */
+        public List<String> getCols() {
+            return cols;
+        }
+
+        /**
+         * @return Types metadata.
+         */
+        public List<String> getTypes() {
+            return types;
+        }
+
+        /**
+         * @return Query UUID.
+         */
+        public UUID getUuid() {
+            return uuid;
+        }
+
+        /**
+         * @return {@code True} if it is finished query.
+         */
+        public boolean isFinished() {
+            return finished;
+        }
+    }
+
+    /**
+     * Cursor.
+     */
+    private static final class Cursor implements Iterable<List<?>> {
+        /** Cursor. */
+        final QueryCursor<List<?>> cursor;
+
+        /** Iterator. */
+        final Iterator<List<?>> iter;
+
+        /** Last access time. */
+        final long lastAccessTime;
+
+        /**
+         * @param cursor Cursor.
+         * @param iter Iterator.
+         */
+        private Cursor(QueryCursor<List<?>> cursor, Iterator<List<?>> iter) {
+            this.cursor = cursor;
+            this.iter = iter;
+            this.lastAccessTime = U.currentTimeMillis();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Iterator<List<?>> iterator() {
+            return iter;
+        }
+
+        /**
+         * @return {@code True} if cursor has next element.
+         */
+        public boolean hasNext() {
+            return iter.hasNext();
+        }
+    }
+}


[26/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java
deleted file mode 100644
index 27ac436..0000000
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgnitePortableCacheQueryTestSuite.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.CacheLocalQueryMetricsSelfTest;
-import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsDistributedSelfTest;
-import org.apache.ignite.internal.processors.cache.CachePartitionedQueryMetricsLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsDistributedSelfTest;
-import org.apache.ignite.internal.processors.cache.CacheReplicatedQueryMetricsLocalSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheLargeResultSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapTieredMultithreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheP2pUnmarshallingQueryErrorTest;
-import org.apache.ignite.internal.processors.cache.IgniteCachePartitionedQueryMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheQueryEvictsMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheQueryMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteCacheQueryOffheapMultiThreadedSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.portable.distributed.dht.GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicNearEnabledSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicP2PDisabledSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryLocalAtomicSelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryPartitionedOnlySelfTest;
-import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryReplicatedAtomicSelfTest;
-import org.apache.ignite.internal.processors.query.h2.sql.BaseH2CompareQueryTest;
-import org.apache.ignite.internal.processors.query.h2.sql.GridQueryParsingTest;
-import org.apache.ignite.internal.processors.query.h2.sql.H2CompareBigQueryTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.spi.communication.tcp.GridOrderedMessageCancelSelfTest;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- * Cache query suite with portable marshaller.
- */
-public class IgnitePortableCacheQueryTestSuite extends TestSuite {
-    /**
-     * @return Suite.
-     * @throws Exception In case of error.
-     */
-    public static TestSuite suite() throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, PortableMarshaller.class.getName());
-
-        TestSuite suite = new TestSuite("Grid Cache Query Test Suite using PortableMarshaller");
-
-        // Parsing
-        suite.addTestSuite(GridQueryParsingTest.class);
-
-        // Queries tests.
-        suite.addTestSuite(GridCacheQueryIndexDisabledSelfTest.class);
-        suite.addTestSuite(IgniteCachePartitionedQueryMultiThreadedSelfTest.class);
-        suite.addTestSuite(IgniteCacheLargeResultSelfTest.class);
-        suite.addTestSuite(IgniteCacheQueryMultiThreadedSelfTest.class);
-        suite.addTestSuite(IgniteCacheQueryEvictsMultiThreadedSelfTest.class);
-        suite.addTestSuite(IgniteCacheQueryOffheapMultiThreadedSelfTest.class);
-
-        suite.addTestSuite(IgniteCacheOffheapTieredMultithreadedSelfTest.class);
-        suite.addTestSuite(GridCacheReduceQueryMultithreadedSelfTest.class);
-
-
-        // Fields queries.
-        suite.addTestSuite(IgniteCacheFieldsQueryNoDataSelfTest.class);
-
-        // Continuous queries.
-        suite.addTestSuite(GridCacheContinuousQueryLocalAtomicSelfTest.class);
-        suite.addTestSuite(GridCacheContinuousQueryReplicatedAtomicSelfTest.class);
-        suite.addTestSuite(GridCacheContinuousQueryPartitionedOnlySelfTest.class);
-        suite.addTestSuite(GridCacheContinuousQueryAtomicSelfTest.class);
-        suite.addTestSuite(GridCacheContinuousQueryAtomicNearEnabledSelfTest.class);
-        suite.addTestSuite(GridCacheContinuousQueryAtomicP2PDisabledSelfTest.class);
-
-        suite.addTestSuite(GridCacheQueryIndexingDisabledSelfTest.class);
-
-        //Should be adjusted. Not ready to be used with PortableMarshaller.
-        //suite.addTestSuite(GridCachePortableSwapScanQuerySelfTest.class);
-
-        suite.addTestSuite(GridOrderedMessageCancelSelfTest.class);
-
-        // Ignite cache and H2 comparison.
-        suite.addTestSuite(BaseH2CompareQueryTest.class);
-        suite.addTestSuite(H2CompareBigQueryTest.class);
-
-        // Metrics tests
-        suite.addTestSuite(CacheLocalQueryMetricsSelfTest.class);
-        suite.addTestSuite(CachePartitionedQueryMetricsDistributedSelfTest.class);
-        suite.addTestSuite(CachePartitionedQueryMetricsLocalSelfTest.class);
-        suite.addTestSuite(CacheReplicatedQueryMetricsDistributedSelfTest.class);
-        suite.addTestSuite(CacheReplicatedQueryMetricsLocalSelfTest.class);
-
-        //Unmarshallig query test.
-        suite.addTestSuite(IgniteCacheP2pUnmarshallingQueryErrorTest.class);
-
-        suite.addTestSuite(GridCachePortableDuplicateIndexObjectPartitionedAtomicSelfTest.class);
-        suite.addTestSuite(GridCachePortableDuplicateIndexObjectPartitionedTransactionalSelfTest.class);
-
-        return suite;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
index 3895506..738f910 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableMetaDataImpl;
 import org.apache.ignite.internal.portable.PortableRawReaderEx;
 import org.apache.ignite.internal.portable.PortableRawWriterEx;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
 import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
 import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilter;
 import org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl;
@@ -70,7 +71,6 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T4;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.portable.PortableMetadata;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
@@ -373,7 +373,7 @@ public class PlatformContextImpl implements PlatformContext {
 
         writer.writeInt(metas.size());
 
-        for (org.apache.ignite.portable.PortableMetadata m : metas)
+        for (PortableMetadata m : metas)
             writeMetadata0(writer, cacheObjProc.typeId(m.typeName()), m);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
index 638b4b1..9e092c5 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/compute/PlatformCompute.java
@@ -33,7 +33,7 @@ import org.apache.ignite.internal.processors.platform.PlatformContext;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
 
 import static org.apache.ignite.internal.processors.task.GridTaskThreadContextKey.TC_SUBGRID;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
index d95a82b..ee8f9a3 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/cpp/PlatformCppConfigurationClosure.java
@@ -25,7 +25,7 @@ import org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurat
 import org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
 import org.apache.ignite.platform.cpp.PlatformCppConfiguration;
 
 import java.util.Collections;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index 6e03dfe..21cd01a 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -36,10 +36,10 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lifecycle.LifecycleBean;
 import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
 import org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
 
 import java.util.ArrayList;
 import java.util.Collections;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index 183676b..6164ef3 100644
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@ -69,16 +69,16 @@
 
         <!-- Portable marshaller configuration -->
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
+            <bean class="org.apache.ignite.internal.portable.api.PortableMarshaller">
                 <property name="typeConfigurations">
                     <list>
-                        <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
+                        <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
                             <property name="className" value="org.apache.ignite.platform.PlatformComputePortable"/>
                         </bean>
-                        <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
+                        <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
                             <property name="className" value="org.apache.ignite.platform.PlatformComputeJavaPortable"/>
                         </bean>
-                        <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
+                        <bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration">
                             <property name="className" value="org.apache.ignite.platform.PlatformComputeEnum"/>
                         </bean>
                     </list>

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
index 0e8b825..9b90209 100644
--- a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
@@ -24,9 +24,10 @@ import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.compute.ComputeJobAdapter;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.jetbrains.annotations.Nullable;
 
@@ -89,7 +90,8 @@ public class PlatformComputePortableArgTask extends ComputeTaskAdapter<Object, I
         @Nullable @Override public Object execute() {
             PortableObject arg0 = ((PortableObject)arg);
 
-            PortableMetadata meta = ignite.portables().metadata(arg0.typeId());
+            PortableMetadata meta = ignite instanceof IgniteEx ?
+                ((IgniteEx)ignite).portables().metadata(arg0.typeId()) : null;
 
             if (meta == null)
                 throw new IgniteException("Metadata doesn't exist.");

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
index 4320df5..42514e3 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java
@@ -347,13 +347,6 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea
     }
 
     /** {@inheritDoc} */
-    @Override public IgnitePortables portables() {
-        assert g != null;
-
-        return g.portables();
-    }
-
-    /** {@inheritDoc} */
     @Override public void close() throws IgniteException {
         g.close();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index f5a29cb..ba44c85 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -319,10 +319,6 @@
                                 <packages>org.apache.ignite.marshaller*</packages>
                             </group>
                             <group>
-                                <title>Portable Objects API</title>
-                                <packages>org.apache.ignite.portable*</packages>
-                            </group>
-                            <group>
                                 <title>Visor Plugins</title>
                                 <packages>org.apache.ignite.visor.plugin</packages>
                             </group>
@@ -712,10 +708,6 @@
                                         <exclude>dev-tools/.gradle/**/*</exclude>
                                         <exclude>dev-tools/gradle/wrapper/**/*</exclude>
                                         <exclude>dev-tools/gradlew</exclude>
-                                        <exclude>src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.pom</exclude>
-                                        <exclude>src/test/portables/repo/org/apache/ignite/portable/test2/maven-metadata-local.xml</exclude>
-                                        <exclude>src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.pom</exclude>
-                                        <exclude>src/test/portables/repo/org/apache/ignite/portable/test1/maven-metadata-local.xml</exclude>
                                         <!--shmem-->
                                         <exclude>ipc/shmem/**/Makefile.in</exclude><!--auto generated files-->
                                         <exclude>ipc/shmem/**/Makefile</exclude><!--auto generated files-->
@@ -745,8 +737,6 @@
                                         <exclude>src/main/java/META-INF/services/org.apache.ignite.internal.processors.platform.PlatformBootstrapFactory</exclude>
                                         <exclude>src/main/resources/META-INF/services/org.apache.ignite.internal.processors.platform.PlatformBootstrapFactory</exclude>
                                         <exclude>src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj</exclude>
-                                        <exclude>src/test/portables/repo/org/apache/ignite/portable/test1/1.1/test1-1.1.jar</exclude>
-                                        <exclude>src/test/portables/repo/org/apache/ignite/portable/test2/1.1/test2-1.1.jar</exclude>
                                         <exclude>**/Makefile.am</exclude>
                                         <exclude>**/configure.ac</exclude>
                                         <exclude>**/*.pc.in</exclude>


[08/41] ignite git commit: ignite-1399

Posted by ag...@apache.org.
ignite-1399


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f02fca6d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f02fca6d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f02fca6d

Branch: refs/heads/ignite-1400
Commit: f02fca6d79be298599630004566305b110362449
Parents: 18752a6
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 11 12:37:57 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 11 12:37:57 2015 +0300

----------------------------------------------------------------------
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f02fca6d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fc609a0..f70bf3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -302,7 +302,7 @@
                                         <chmod dir="${basedir}/target/release-package" perm="755" includes="**/*.sh" />
 
                                         <!-- hotfix according to https://issues.apache.org/jira/browse/IGNITE-1399. Remove at 1.5 -->
-                                        <move todir="${basedir}/target/temp/release-package/libs/optional/ignite-platform">
+                                        <move todir="${basedir}/target/temp/release-package/libs/optional/ignite-platform" failonerror="false">
                                             <fileset dir="${basedir}/target/release-package/libs/optional/ignite-platform"/>
                                         </move>
 
@@ -324,7 +324,7 @@
                                         </zip>
 
                                         <!-- hotfix according to https://issues.apache.org/jira/browse/IGNITE-1399. Remove at 1.5 -->
-                                        <move todir="${basedir}/target/release-package/libs/optional/ignite-platform">
+                                        <move todir="${basedir}/target/release-package/libs/optional/ignite-platform" failonerror="false">
                                             <fileset dir="${basedir}/target/temp/release-package/libs/optional/ignite-platform"/>
                                         </move>
                                     </target>


[30/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
deleted file mode 100644
index 21fc81c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
+++ /dev/null
@@ -1,3807 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.InetSocketAddress;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentSkipListSet;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
-import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jsr166.ConcurrentHashMap8;
-import sun.misc.Unsafe;
-
-import static org.apache.ignite.internal.portable.PortableThreadLocalMemoryAllocator.THREAD_LOCAL_ALLOC;
-import static org.junit.Assert.assertArrayEquals;
-
-/**
- * Portable marshaller tests.
- */
-@SuppressWarnings({"OverlyStrongTypeCast", "ArrayHashCode", "ConstantConditions"})
-public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
-
-    /** */
-    protected static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
-
-    /** */
-    protected static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
-        @Override public void addMeta(int typeId, PortableMetadata meta) {
-            // No-op.
-        }
-
-        @Override public PortableMetadata metadata(int typeId) {
-            return null;
-        }
-    };
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNull() throws Exception {
-        assertNull(marshalUnmarshal(null));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testByte() throws Exception {
-        assertEquals((byte)100, marshalUnmarshal((byte)100).byteValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testShort() throws Exception {
-        assertEquals((short)100, marshalUnmarshal((short)100).shortValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testInt() throws Exception {
-        assertEquals(100, marshalUnmarshal(100).intValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLong() throws Exception {
-        assertEquals(100L, marshalUnmarshal(100L).longValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFloat() throws Exception {
-        assertEquals(100.001f, marshalUnmarshal(100.001f).floatValue(), 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDouble() throws Exception {
-        assertEquals(100.001d, marshalUnmarshal(100.001d).doubleValue(), 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testChar() throws Exception {
-        assertEquals((char)100, marshalUnmarshal((char)100).charValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBoolean() throws Exception {
-        assertEquals(true, marshalUnmarshal(true).booleanValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDecimal() throws Exception {
-        BigDecimal val;
-
-        assertEquals((val = BigDecimal.ZERO), marshalUnmarshal(val));
-        assertEquals((val = BigDecimal.valueOf(Long.MAX_VALUE, 0)), marshalUnmarshal(val));
-        assertEquals((val = BigDecimal.valueOf(Long.MIN_VALUE, 0)), marshalUnmarshal(val));
-        assertEquals((val = BigDecimal.valueOf(Long.MAX_VALUE, 8)), marshalUnmarshal(val));
-        assertEquals((val = BigDecimal.valueOf(Long.MIN_VALUE, 8)), marshalUnmarshal(val));
-
-        assertEquals((val = new BigDecimal(new BigInteger("-79228162514264337593543950336"))), marshalUnmarshal(val));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testString() throws Exception {
-        assertEquals("str", marshalUnmarshal("str"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testUuid() throws Exception {
-        UUID uuid = UUID.randomUUID();
-
-        assertEquals(uuid, marshalUnmarshal(uuid));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDate() throws Exception {
-        Date date = new Date();
-
-        Date val = marshalUnmarshal(date);
-
-        assertEquals(date, val);
-        assertEquals(Timestamp.class, val.getClass()); // With default configuration should unmarshal as Timestamp.
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setUseTimestamp(false);
-
-        val = marshalUnmarshal(date, marsh);
-
-        assertEquals(date, val);
-        assertEquals(Date.class, val.getClass());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTimestamp() throws Exception {
-        Timestamp ts = new Timestamp(System.currentTimeMillis());
-
-        ts.setNanos(999999999);
-
-        assertEquals(ts, marshalUnmarshal(ts));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testByteArray() throws Exception {
-        byte[] arr = new byte[] {10, 20, 30};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testShortArray() throws Exception {
-        short[] arr = new short[] {10, 20, 30};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIntArray() throws Exception {
-        int[] arr = new int[] {10, 20, 30};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLongArray() throws Exception {
-        long[] arr = new long[] {10, 20, 30};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFloatArray() throws Exception {
-        float[] arr = new float[] {10.1f, 20.1f, 30.1f};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr), 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDoubleArray() throws Exception {
-        double[] arr = new double[] {10.1d, 20.1d, 30.1d};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr), 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCharArray() throws Exception {
-        char[] arr = new char[] {10, 20, 30};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBooleanArray() throws Exception {
-        boolean[] arr = new boolean[] {true, false, true};
-
-        assertBooleanArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDecimalArray() throws Exception {
-        BigDecimal[] arr = new BigDecimal[] { BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN } ;
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStringArray() throws Exception {
-        String[] arr = new String[] {"str1", "str2", "str3"};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testUuidArray() throws Exception {
-        UUID[] arr = new UUID[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDateArray() throws Exception {
-        Date[] arr = new Date[] {new Date(11111), new Date(22222), new Date(33333)};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testObjectArray() throws Exception {
-        Object[] arr = new Object[] {1, 2, 3};
-
-        assertArrayEquals(arr, marshalUnmarshal(arr));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollection() throws Exception {
-        testCollection(new ArrayList<Integer>(3));
-        testCollection(new LinkedHashSet<Integer>());
-        testCollection(new HashSet<Integer>());
-        testCollection(new TreeSet<Integer>());
-        testCollection(new ConcurrentSkipListSet<Integer>());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void testCollection(Collection<Integer> col) throws Exception {
-        col.add(1);
-        col.add(2);
-        col.add(3);
-
-        assertEquals(col, marshalUnmarshal(col));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMap() throws Exception {
-        testMap(new HashMap<Integer, String>());
-        testMap(new LinkedHashMap());
-        testMap(new TreeMap<Integer, String>());
-        testMap(new ConcurrentHashMap8<Integer, String>());
-        testMap(new ConcurrentHashMap<Integer, String>());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    private void testMap(Map<Integer, String> map) throws Exception {
-        map.put(1, "str1");
-        map.put(2, "str2");
-        map.put(3, "str3");
-
-        assertEquals(map, marshalUnmarshal(map));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMapEntry() throws Exception {
-        Map.Entry<Integer, String> e = new GridMapEntry<>(1, "str1");
-
-        assertEquals(e, marshalUnmarshal(e));
-
-        Map<Integer, String> map = new HashMap<>(1);
-
-        map.put(2, "str2");
-
-        e = F.firstEntry(map);
-
-        Map.Entry<Integer, String> e0 = marshalUnmarshal(e);
-
-        assertEquals(2, e0.getKey().intValue());
-        assertEquals("str2", e0.getValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableObject() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(SimpleObject.class.getName())));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject po0 = marshalUnmarshal(po, marsh);
-
-        assertTrue(po.hasField("b"));
-        assertTrue(po.hasField("s"));
-        assertTrue(po.hasField("i"));
-        assertTrue(po.hasField("l"));
-        assertTrue(po.hasField("f"));
-        assertTrue(po.hasField("d"));
-        assertTrue(po.hasField("c"));
-        assertTrue(po.hasField("bool"));
-
-        assertFalse(po.hasField("no_such_field"));
-
-        assertEquals(obj, po.deserialize());
-        assertEquals(obj, po0.deserialize());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testEnum() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(TestEnum.class.getName()));
-
-        assertEquals(TestEnum.B, marshalUnmarshal(TestEnum.B, marsh));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testUseTimestampFlag() throws Exception {
-        PortableTypeConfiguration cfg1 = new PortableTypeConfiguration(DateClass1.class.getName());
-
-        PortableTypeConfiguration cfg2 = new PortableTypeConfiguration(DateClass2.class.getName());
-
-        cfg2.setUseTimestamp(false);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(cfg1, cfg2));
-
-        Date date = new Date();
-        Timestamp ts = new Timestamp(System.currentTimeMillis());
-
-        DateClass1 obj1 = new DateClass1();
-        obj1.date = date;
-        obj1.ts = ts;
-
-        DateClass2 obj2 = new DateClass2();
-        obj2.date = date;
-        obj2.ts = ts;
-
-        PortableObject po1 = marshal(obj1, marsh);
-
-        assertEquals(date, po1.field("date"));
-        assertEquals(Timestamp.class, po1.field("date").getClass());
-        assertEquals(ts, po1.field("ts"));
-
-        PortableObject po2 = marshal(obj2, marsh);
-
-        assertEquals(date, po2.field("date"));
-        assertEquals(Date.class, po2.field("date").getClass());
-        assertEquals(new Date(ts.getTime()), po2.field("ts"));
-        assertEquals(Date.class, po2.field("ts").getClass());
-
-        obj1 = po1.deserialize();
-        assertEquals(date, obj1.date);
-        assertEquals(Date.class, obj1.date.getClass());
-        assertEquals(ts, obj1.ts);
-
-        obj2 = po2.deserialize();
-        assertEquals(date, obj2.date);
-        assertEquals(Date.class, obj2.date.getClass());
-        assertEquals(ts, obj2.ts);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSimpleObject() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        assertEquals(obj.hashCode(), po.hashCode());
-
-        assertEquals(obj, po.deserialize());
-
-        assertEquals(obj.b, (byte)po.field("b"));
-        assertEquals(obj.s, (short)po.field("s"));
-        assertEquals(obj.i, (int)po.field("i"));
-        assertEquals(obj.l, (long)po.field("l"));
-        assertEquals(obj.f, (float)po.field("f"), 0);
-        assertEquals(obj.d, (double)po.field("d"), 0);
-        assertEquals(obj.c, (char)po.field("c"));
-        assertEquals(obj.bool, (boolean)po.field("bool"));
-        assertEquals(obj.str, po.field("str"));
-        assertEquals(obj.uuid, po.field("uuid"));
-        assertEquals(obj.date, po.field("date"));
-        assertEquals(Date.class, obj.date.getClass());
-        assertEquals(obj.ts, po.field("ts"));
-        assertArrayEquals(obj.bArr, (byte[])po.field("bArr"));
-        assertArrayEquals(obj.sArr, (short[])po.field("sArr"));
-        assertArrayEquals(obj.iArr, (int[])po.field("iArr"));
-        assertArrayEquals(obj.lArr, (long[])po.field("lArr"));
-        assertArrayEquals(obj.fArr, (float[])po.field("fArr"), 0);
-        assertArrayEquals(obj.dArr, (double[])po.field("dArr"), 0);
-        assertArrayEquals(obj.cArr, (char[])po.field("cArr"));
-        assertBooleanArrayEquals(obj.boolArr, (boolean[])po.field("boolArr"));
-        assertArrayEquals(obj.strArr, (String[])po.field("strArr"));
-        assertArrayEquals(obj.uuidArr, (UUID[])po.field("uuidArr"));
-        assertArrayEquals(obj.dateArr, (Date[])po.field("dateArr"));
-        assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
-        assertEquals(obj.col, po.field("col"));
-        assertEquals(obj.map, po.field("map"));
-        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
-        assertNull(po.field("unknown"));
-
-        PortableObject innerPo = po.field("inner");
-
-        assertEquals(obj.inner, innerPo.deserialize());
-
-        assertEquals(obj.inner.b, (byte)innerPo.field("b"));
-        assertEquals(obj.inner.s, (short)innerPo.field("s"));
-        assertEquals(obj.inner.i, (int)innerPo.field("i"));
-        assertEquals(obj.inner.l, (long)innerPo.field("l"));
-        assertEquals(obj.inner.f, (float)innerPo.field("f"), 0);
-        assertEquals(obj.inner.d, (double)innerPo.field("d"), 0);
-        assertEquals(obj.inner.c, (char)innerPo.field("c"));
-        assertEquals(obj.inner.bool, (boolean)innerPo.field("bool"));
-        assertEquals(obj.inner.str, innerPo.field("str"));
-        assertEquals(obj.inner.uuid, innerPo.field("uuid"));
-        assertEquals(obj.inner.date, innerPo.field("date"));
-        assertEquals(Date.class, obj.inner.date.getClass());
-        assertEquals(obj.inner.ts, innerPo.field("ts"));
-        assertArrayEquals(obj.inner.bArr, (byte[])innerPo.field("bArr"));
-        assertArrayEquals(obj.inner.sArr, (short[])innerPo.field("sArr"));
-        assertArrayEquals(obj.inner.iArr, (int[])innerPo.field("iArr"));
-        assertArrayEquals(obj.inner.lArr, (long[])innerPo.field("lArr"));
-        assertArrayEquals(obj.inner.fArr, (float[])innerPo.field("fArr"), 0);
-        assertArrayEquals(obj.inner.dArr, (double[])innerPo.field("dArr"), 0);
-        assertArrayEquals(obj.inner.cArr, (char[])innerPo.field("cArr"));
-        assertBooleanArrayEquals(obj.inner.boolArr, (boolean[])innerPo.field("boolArr"));
-        assertArrayEquals(obj.inner.strArr, (String[])innerPo.field("strArr"));
-        assertArrayEquals(obj.inner.uuidArr, (UUID[])innerPo.field("uuidArr"));
-        assertArrayEquals(obj.inner.dateArr, (Date[])innerPo.field("dateArr"));
-        assertArrayEquals(obj.inner.objArr, (Object[])innerPo.field("objArr"));
-        assertEquals(obj.inner.col, innerPo.field("col"));
-        assertEquals(obj.inner.map, innerPo.field("map"));
-        assertEquals(new Integer(obj.inner.enumVal.ordinal()),
-            new Integer(((Enum<?>)innerPo.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.inner.enumArr), ordinals((Enum<?>[])innerPo.field("enumArr")));
-        assertNull(innerPo.field("inner"));
-        assertNull(innerPo.field("unknown"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortable() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName()),
-            new PortableTypeConfiguration(TestPortableObject.class.getName())
-        ));
-
-        TestPortableObject obj = portableObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        assertEquals(obj.hashCode(), po.hashCode());
-
-        assertEquals(obj, po.deserialize());
-
-        assertEquals(obj.b, (byte)po.field("_b"));
-        assertEquals(obj.s, (short)po.field("_s"));
-        assertEquals(obj.i, (int)po.field("_i"));
-        assertEquals(obj.l, (long)po.field("_l"));
-        assertEquals(obj.f, (float)po.field("_f"), 0);
-        assertEquals(obj.d, (double)po.field("_d"), 0);
-        assertEquals(obj.c, (char)po.field("_c"));
-        assertEquals(obj.bool, (boolean)po.field("_bool"));
-        assertEquals(obj.str, po.field("_str"));
-        assertEquals(obj.uuid, po.field("_uuid"));
-        assertEquals(obj.date, po.field("_date"));
-        assertEquals(obj.ts, po.field("_ts"));
-        assertArrayEquals(obj.bArr, (byte[])po.field("_bArr"));
-        assertArrayEquals(obj.sArr, (short[])po.field("_sArr"));
-        assertArrayEquals(obj.iArr, (int[])po.field("_iArr"));
-        assertArrayEquals(obj.lArr, (long[])po.field("_lArr"));
-        assertArrayEquals(obj.fArr, (float[])po.field("_fArr"), 0);
-        assertArrayEquals(obj.dArr, (double[])po.field("_dArr"), 0);
-        assertArrayEquals(obj.cArr, (char[])po.field("_cArr"));
-        assertBooleanArrayEquals(obj.boolArr, (boolean[])po.field("_boolArr"));
-        assertArrayEquals(obj.strArr, (String[])po.field("_strArr"));
-        assertArrayEquals(obj.uuidArr, (UUID[])po.field("_uuidArr"));
-        assertArrayEquals(obj.dateArr, (Date[])po.field("_dateArr"));
-        assertArrayEquals(obj.objArr, (Object[])po.field("_objArr"));
-        assertEquals(obj.col, po.field("_col"));
-        assertEquals(obj.map, po.field("_map"));
-        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("_enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("_enumArr")));
-        assertNull(po.field("unknown"));
-
-        PortableObject simplePo = po.field("_simple");
-
-        assertEquals(obj.simple, simplePo.deserialize());
-
-        assertEquals(obj.simple.b, (byte)simplePo.field("b"));
-        assertEquals(obj.simple.s, (short)simplePo.field("s"));
-        assertEquals(obj.simple.i, (int)simplePo.field("i"));
-        assertEquals(obj.simple.l, (long)simplePo.field("l"));
-        assertEquals(obj.simple.f, (float)simplePo.field("f"), 0);
-        assertEquals(obj.simple.d, (double)simplePo.field("d"), 0);
-        assertEquals(obj.simple.c, (char)simplePo.field("c"));
-        assertEquals(obj.simple.bool, (boolean)simplePo.field("bool"));
-        assertEquals(obj.simple.str, simplePo.field("str"));
-        assertEquals(obj.simple.uuid, simplePo.field("uuid"));
-        assertEquals(obj.simple.date, simplePo.field("date"));
-        assertEquals(Date.class, obj.simple.date.getClass());
-        assertEquals(obj.simple.ts, simplePo.field("ts"));
-        assertArrayEquals(obj.simple.bArr, (byte[])simplePo.field("bArr"));
-        assertArrayEquals(obj.simple.sArr, (short[])simplePo.field("sArr"));
-        assertArrayEquals(obj.simple.iArr, (int[])simplePo.field("iArr"));
-        assertArrayEquals(obj.simple.lArr, (long[])simplePo.field("lArr"));
-        assertArrayEquals(obj.simple.fArr, (float[])simplePo.field("fArr"), 0);
-        assertArrayEquals(obj.simple.dArr, (double[])simplePo.field("dArr"), 0);
-        assertArrayEquals(obj.simple.cArr, (char[])simplePo.field("cArr"));
-        assertBooleanArrayEquals(obj.simple.boolArr, (boolean[])simplePo.field("boolArr"));
-        assertArrayEquals(obj.simple.strArr, (String[])simplePo.field("strArr"));
-        assertArrayEquals(obj.simple.uuidArr, (UUID[])simplePo.field("uuidArr"));
-        assertArrayEquals(obj.simple.dateArr, (Date[])simplePo.field("dateArr"));
-        assertArrayEquals(obj.simple.objArr, (Object[])simplePo.field("objArr"));
-        assertEquals(obj.simple.col, simplePo.field("col"));
-        assertEquals(obj.simple.map, simplePo.field("map"));
-        assertEquals(new Integer(obj.simple.enumVal.ordinal()),
-            new Integer(((Enum<?>)simplePo.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.simple.enumArr), ordinals((Enum<?>[])simplePo.field("enumArr")));
-        assertNull(simplePo.field("simple"));
-        assertNull(simplePo.field("portable"));
-        assertNull(simplePo.field("unknown"));
-
-        PortableObject portablePo = po.field("_portable");
-
-        assertEquals(obj.portable, portablePo.deserialize());
-
-        assertEquals(obj.portable.b, (byte)portablePo.field("_b"));
-        assertEquals(obj.portable.s, (short)portablePo.field("_s"));
-        assertEquals(obj.portable.i, (int)portablePo.field("_i"));
-        assertEquals(obj.portable.l, (long)portablePo.field("_l"));
-        assertEquals(obj.portable.f, (float)portablePo.field("_f"), 0);
-        assertEquals(obj.portable.d, (double)portablePo.field("_d"), 0);
-        assertEquals(obj.portable.c, (char)portablePo.field("_c"));
-        assertEquals(obj.portable.bool, (boolean)portablePo.field("_bool"));
-        assertEquals(obj.portable.str, portablePo.field("_str"));
-        assertEquals(obj.portable.uuid, portablePo.field("_uuid"));
-        assertEquals(obj.portable.date, portablePo.field("_date"));
-        assertEquals(obj.portable.ts, portablePo.field("_ts"));
-        assertArrayEquals(obj.portable.bArr, (byte[])portablePo.field("_bArr"));
-        assertArrayEquals(obj.portable.sArr, (short[])portablePo.field("_sArr"));
-        assertArrayEquals(obj.portable.iArr, (int[])portablePo.field("_iArr"));
-        assertArrayEquals(obj.portable.lArr, (long[])portablePo.field("_lArr"));
-        assertArrayEquals(obj.portable.fArr, (float[])portablePo.field("_fArr"), 0);
-        assertArrayEquals(obj.portable.dArr, (double[])portablePo.field("_dArr"), 0);
-        assertArrayEquals(obj.portable.cArr, (char[])portablePo.field("_cArr"));
-        assertBooleanArrayEquals(obj.portable.boolArr, (boolean[])portablePo.field("_boolArr"));
-        assertArrayEquals(obj.portable.strArr, (String[])portablePo.field("_strArr"));
-        assertArrayEquals(obj.portable.uuidArr, (UUID[])portablePo.field("_uuidArr"));
-        assertArrayEquals(obj.portable.dateArr, (Date[])portablePo.field("_dateArr"));
-        assertArrayEquals(obj.portable.objArr, (Object[])portablePo.field("_objArr"));
-        assertEquals(obj.portable.col, portablePo.field("_col"));
-        assertEquals(obj.portable.map, portablePo.field("_map"));
-        assertEquals(new Integer(obj.portable.enumVal.ordinal()),
-            new Integer(((Enum<?>)portablePo.field("_enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.portable.enumArr), ordinals((Enum<?>[])portablePo.field("_enumArr")));
-        assertNull(portablePo.field("_simple"));
-        assertNull(portablePo.field("_portable"));
-        assertNull(portablePo.field("unknown"));
-    }
-
-    /**
-     * @param obj Simple object.
-     * @param po Portable object.
-     */
-    private void checkSimpleObjectData(SimpleObject obj, PortableObject po) {
-        assertEquals(obj.b, (byte)po.field("b"));
-        assertEquals(obj.s, (short)po.field("s"));
-        assertEquals(obj.i, (int)po.field("i"));
-        assertEquals(obj.l, (long)po.field("l"));
-        assertEquals(obj.f, (float)po.field("f"), 0);
-        assertEquals(obj.d, (double)po.field("d"), 0);
-        assertEquals(obj.c, (char)po.field("c"));
-        assertEquals(obj.bool, (boolean)po.field("bool"));
-        assertEquals(obj.str, po.field("str"));
-        assertEquals(obj.uuid, po.field("uuid"));
-        assertEquals(obj.date, po.field("date"));
-        assertEquals(Date.class, obj.date.getClass());
-        assertEquals(obj.ts, po.field("ts"));
-        assertArrayEquals(obj.bArr, (byte[])po.field("bArr"));
-        assertArrayEquals(obj.sArr, (short[])po.field("sArr"));
-        assertArrayEquals(obj.iArr, (int[])po.field("iArr"));
-        assertArrayEquals(obj.lArr, (long[])po.field("lArr"));
-        assertArrayEquals(obj.fArr, (float[])po.field("fArr"), 0);
-        assertArrayEquals(obj.dArr, (double[])po.field("dArr"), 0);
-        assertArrayEquals(obj.cArr, (char[])po.field("cArr"));
-        assertBooleanArrayEquals(obj.boolArr, (boolean[])po.field("boolArr"));
-        assertArrayEquals(obj.strArr, (String[])po.field("strArr"));
-        assertArrayEquals(obj.uuidArr, (UUID[])po.field("uuidArr"));
-        assertArrayEquals(obj.dateArr, (Date[])po.field("dateArr"));
-        assertArrayEquals(obj.objArr, (Object[])po.field("objArr"));
-        assertEquals(obj.col, po.field("col"));
-        assertEquals(obj.map, po.field("map"));
-        assertEquals(new Integer(obj.enumVal.ordinal()), new Integer(((Enum<?>)po.field("enumVal")).ordinal()));
-        assertArrayEquals(ordinals(obj.enumArr), ordinals((Enum<?>[])po.field("enumArr")));
-        assertNull(po.field("unknown"));
-
-        assertEquals(obj, po.deserialize());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testInvalidClass() throws Exception {
-        byte[] arr = new byte[20];
-
-        arr[0] = 103;
-
-        U.intToBytes(Integer.reverseBytes(11111), arr, 2);
-
-        final PortableObject po = new PortableObjectImpl(initPortableContext(new PortableMarshaller()), arr, 0);
-
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-                                       @Override public Object call() throws Exception {
-                                           po.deserialize();
-
-                                           return null;
-                                       }
-                                   }, PortableInvalidClassException.class, "Unknown type ID: 11111"
-        );
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClassWithoutPublicConstructor() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-                                        new PortableTypeConfiguration(NoPublicConstructor.class.getName()),
-                                        new PortableTypeConfiguration(NoPublicDefaultConstructor.class.getName()),
-                                        new PortableTypeConfiguration(ProtectedConstructor.class.getName()))
-        );
-
-        initPortableContext(marsh);
-
-        NoPublicConstructor npc = new NoPublicConstructor();
-        PortableObject npc2 = marshal(npc, marsh);
-
-        assertEquals("test", npc2.<NoPublicConstructor>deserialize().val);
-
-        NoPublicDefaultConstructor npdc = new NoPublicDefaultConstructor(239);
-        PortableObject npdc2 = marshal(npdc, marsh);
-
-        assertEquals(239, npdc2.<NoPublicDefaultConstructor>deserialize().val);
-
-        ProtectedConstructor pc = new ProtectedConstructor();
-        PortableObject pc2 = marshal(pc, marsh);
-
-        assertEquals(ProtectedConstructor.class, pc2.<ProtectedConstructor>deserialize().getClass());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCustomSerializer() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration type =
-            new PortableTypeConfiguration(CustomSerializedObject1.class.getName());
-
-        type.setSerializer(new CustomSerializer1());
-
-        marsh.setTypeConfigurations(Arrays.asList(type));
-
-        CustomSerializedObject1 obj1 = new CustomSerializedObject1(10);
-
-        PortableObject po1 = marshal(obj1, marsh);
-
-        assertEquals(20, po1.<CustomSerializedObject1>deserialize().val);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCustomSerializerWithGlobal() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setSerializer(new CustomSerializer1());
-
-        PortableTypeConfiguration type1 =
-            new PortableTypeConfiguration(CustomSerializedObject1.class.getName());
-        PortableTypeConfiguration type2 =
-            new PortableTypeConfiguration(CustomSerializedObject2.class.getName());
-
-        type2.setSerializer(new CustomSerializer2());
-
-        marsh.setTypeConfigurations(Arrays.asList(type1, type2));
-
-        CustomSerializedObject1 obj1 = new CustomSerializedObject1(10);
-
-        PortableObject po1 = marshal(obj1, marsh);
-
-        assertEquals(20, po1.<CustomSerializedObject1>deserialize().val);
-
-        CustomSerializedObject2 obj2 = new CustomSerializedObject2(10);
-
-        PortableObject po2 = marshal(obj2, marsh);
-
-        assertEquals(30, po2.<CustomSerializedObject2>deserialize().val);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCustomIdMapper() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration type =
-            new PortableTypeConfiguration(CustomMappedObject1.class.getName());
-
-        type.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 11111;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                assert typeId == 11111;
-
-                if ("val1".equals(fieldName))
-                    return 22222;
-                else if ("val2".equals(fieldName))
-                    return 33333;
-
-                assert false : "Unknown field: " + fieldName;
-
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(type));
-
-        CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str");
-
-        PortableObject po1 = marshal(obj1, marsh);
-
-        assertEquals(11111, po1.typeId());
-        assertEquals(22222, intFromPortable(po1, 18));
-        assertEquals(33333, intFromPortable(po1, 31));
-
-        assertEquals(10, po1.<CustomMappedObject1>deserialize().val1);
-        assertEquals("str", po1.<CustomMappedObject1>deserialize().val2);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCustomIdMapperWithGlobal() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 11111;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                assert typeId == 11111;
-
-                if ("val1".equals(fieldName)) return 22222;
-                else if ("val2".equals(fieldName)) return 33333;
-
-                assert false : "Unknown field: " + fieldName;
-
-                return 0;
-            }
-        });
-
-        PortableTypeConfiguration type1 =
-            new PortableTypeConfiguration(CustomMappedObject1.class.getName());
-        PortableTypeConfiguration type2 =
-            new PortableTypeConfiguration(CustomMappedObject2.class.getName());
-
-        type2.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 44444;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                assert typeId == 44444;
-
-                if ("val1".equals(fieldName)) return 55555;
-                else if ("val2".equals(fieldName)) return 66666;
-
-                assert false : "Unknown field: " + fieldName;
-
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(type1, type2));
-
-        CustomMappedObject1 obj1 = new CustomMappedObject1(10, "str1");
-
-        PortableObject po1 = marshal(obj1, marsh);
-
-        assertEquals(11111, po1.typeId());
-        assertEquals(22222, intFromPortable(po1, 18));
-        assertEquals(33333, intFromPortable(po1, 31));
-
-        assertEquals(10, po1.<CustomMappedObject1>deserialize().val1);
-        assertEquals("str1", po1.<CustomMappedObject1>deserialize().val2);
-
-        CustomMappedObject2 obj2 = new CustomMappedObject2(20, "str2");
-
-        PortableObject po2 = marshal(obj2, marsh);
-
-        assertEquals(44444, po2.typeId());
-        assertEquals(55555, intFromPortable(po2, 18));
-        assertEquals(66666, intFromPortable(po2, 31));
-
-        assertEquals(20, po2.<CustomMappedObject2>deserialize().val1);
-        assertEquals("str2", po2.<CustomMappedObject2>deserialize().val2);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDynamicObject() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(DynamicObject.class.getName())
-        ));
-
-        PortableObject po1 = marshal(new DynamicObject(0, 10, 20, 30), marsh);
-
-        assertEquals(new Integer(10), po1.field("val1"));
-        assertEquals(null, po1.field("val2"));
-        assertEquals(null, po1.field("val3"));
-
-        DynamicObject do1 = po1.deserialize();
-
-        assertEquals(10, do1.val1);
-        assertEquals(0, do1.val2);
-        assertEquals(0, do1.val3);
-
-        PortableObject po2 = marshal(new DynamicObject(1, 10, 20, 30), marsh);
-
-        assertEquals(new Integer(10), po2.field("val1"));
-        assertEquals(new Integer(20), po2.field("val2"));
-        assertEquals(null, po2.field("val3"));
-
-        DynamicObject do2 = po2.deserialize();
-
-        assertEquals(10, do2.val1);
-        assertEquals(20, do2.val2);
-        assertEquals(0, do2.val3);
-
-        PortableObject po3 = marshal(new DynamicObject(2, 10, 20, 30), marsh);
-
-        assertEquals(new Integer(10), po3.field("val1"));
-        assertEquals(new Integer(20), po3.field("val2"));
-        assertEquals(new Integer(30), po3.field("val3"));
-
-        DynamicObject do3 = po3.deserialize();
-
-        assertEquals(10, do3.val1);
-        assertEquals(20, do3.val2);
-        assertEquals(30, do3.val3);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCycleLink() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(CycleLinkObject.class.getName())
-        ));
-
-        CycleLinkObject obj = new CycleLinkObject();
-
-        obj.self = obj;
-
-        PortableObject po = marshal(obj, marsh);
-
-        CycleLinkObject obj0 = po.deserialize();
-
-        assert obj0.self == obj0;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDetached() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(DetachedTestObject.class.getName()),
-            new PortableTypeConfiguration(DetachedInnerTestObject.class.getName())
-        ));
-
-        UUID id = UUID.randomUUID();
-
-        DetachedTestObject obj = marshal(new DetachedTestObject(
-            new DetachedInnerTestObject(null, id)), marsh).deserialize();
-
-        assertEquals(id, obj.inner1.id);
-        assertEquals(id, obj.inner4.id);
-
-        assert obj.inner1 == obj.inner4;
-
-        PortableObjectImpl innerPo = (PortableObjectImpl)obj.inner2;
-
-        assert innerPo.detached();
-
-        DetachedInnerTestObject inner = innerPo.deserialize();
-
-        assertEquals(id, inner.id);
-
-        PortableObjectImpl detachedPo = (PortableObjectImpl)innerPo.detach();
-
-        assert detachedPo.detached();
-
-        inner = detachedPo.deserialize();
-
-        assertEquals(id, inner.id);
-
-        innerPo = (PortableObjectImpl)obj.inner3;
-
-        assert innerPo.detached();
-
-        inner = innerPo.deserialize();
-
-        assertEquals(id, inner.id);
-        assertNotNull(inner.inner);
-
-        detachedPo = (PortableObjectImpl)innerPo.detach();
-
-        assert detachedPo.detached();
-
-        inner = innerPo.deserialize();
-
-        assertEquals(id, inner.id);
-        assertNotNull(inner.inner);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollectionFields() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(CollectionFieldsObject.class.getName()),
-            new PortableTypeConfiguration(Key.class.getName()),
-            new PortableTypeConfiguration(Value.class.getName())
-        ));
-
-        Object[] arr = new Object[] {new Value(1), new Value(2), new Value(3)};
-        Collection<Value> col = Arrays.asList(new Value(4), new Value(5), new Value(6));
-        Map<Key, Value> map = F.asMap(new Key(10), new Value(10), new Key(20), new Value(20), new Key(30), new Value(30));
-
-        CollectionFieldsObject obj = new CollectionFieldsObject(arr, col, map);
-
-        PortableObject po = marshal(obj, marsh);
-
-        Object[] arr0 = po.field("arr");
-
-        assertEquals(3, arr0.length);
-
-        int i = 1;
-
-        for (Object valPo : arr0)
-            assertEquals(i++, ((PortableObject)valPo).<Value>deserialize().val);
-
-        Collection<PortableObject> col0 = po.field("col");
-
-        i = 4;
-
-        for (PortableObject valPo : col0)
-            assertEquals(i++, valPo.<Value>deserialize().val);
-
-        Map<PortableObject, PortableObject> map0 = po.field("map");
-
-        for (Map.Entry<PortableObject, PortableObject> e : map0.entrySet())
-            assertEquals(e.getKey().<Key>deserialize().key, e.getValue().<Value>deserialize().val);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDefaultMapping() throws Exception {
-        PortableMarshaller marsh1 = new PortableMarshaller();
-
-        PortableTypeConfiguration customMappingType =
-            new PortableTypeConfiguration(TestPortableObject.class.getName());
-
-        customMappingType.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                String typeName;
-
-                try {
-                    Method mtd = PortableContext.class.getDeclaredMethod("typeName", String.class);
-
-                    mtd.setAccessible(true);
-
-                    typeName = (String)mtd.invoke(null, clsName);
-                }
-                catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
-                    throw new RuntimeException(e);
-                }
-
-                return typeName.toLowerCase().hashCode();
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return fieldName.toLowerCase().hashCode();
-            }
-        });
-
-        marsh1.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName()),
-            customMappingType
-        ));
-
-        TestPortableObject obj = portableObject();
-
-        PortableObjectImpl po = marshal(obj, marsh1);
-
-        PortableMarshaller marsh2 = new PortableMarshaller();
-
-        marsh2.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName()),
-            new PortableTypeConfiguration(TestPortableObject.class.getName())
-        ));
-
-        PortableContext ctx = initPortableContext(marsh2);
-
-        po.context(ctx);
-
-        assertEquals(obj, po.deserialize());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTypeNames() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration customType1 = new PortableTypeConfiguration(Value.class.getName());
-
-        customType1.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 300;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        PortableTypeConfiguration customType2 = new PortableTypeConfiguration("org.gridgain.NonExistentClass1");
-
-        customType2.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 400;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        PortableTypeConfiguration customType3 = new PortableTypeConfiguration("NonExistentClass2");
-
-        customType3.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 500;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        PortableTypeConfiguration customType4 = new PortableTypeConfiguration("NonExistentClass5");
-
-        customType4.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 0;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(Key.class.getName()),
-            new PortableTypeConfiguration("org.gridgain.NonExistentClass3"),
-            new PortableTypeConfiguration("NonExistentClass4"),
-            customType1,
-            customType2,
-            customType3,
-            customType4
-        ));
-
-        PortableContext ctx = initPortableContext(marsh);
-
-        assertEquals("notconfiguredclass".hashCode(), ctx.typeId("NotConfiguredClass"));
-        assertEquals("key".hashCode(), ctx.typeId("Key"));
-        assertEquals("nonexistentclass3".hashCode(), ctx.typeId("NonExistentClass3"));
-        assertEquals("nonexistentclass4".hashCode(), ctx.typeId("NonExistentClass4"));
-        assertEquals(300, ctx.typeId(getClass().getSimpleName() + "$Value"));
-        assertEquals(400, ctx.typeId("NonExistentClass1"));
-        assertEquals(500, ctx.typeId("NonExistentClass2"));
-        assertEquals("nonexistentclass5".hashCode(), ctx.typeId("NonExistentClass5"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFieldIdMapping() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration customType1 = new PortableTypeConfiguration(Value.class.getName());
-
-        customType1.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 300;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                switch (fieldName) {
-                    case "val1":
-                        return 301;
-
-                    case "val2":
-                        return 302;
-
-                    default:
-                        return 0;
-                }
-            }
-        });
-
-        PortableTypeConfiguration customType2 = new PortableTypeConfiguration("NonExistentClass1");
-
-        customType2.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 400;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                switch (fieldName) {
-                    case "val1":
-                        return 401;
-
-                    case "val2":
-                        return 402;
-
-                    default:
-                        return 0;
-                }
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(Key.class.getName()),
-                                                  new PortableTypeConfiguration("NonExistentClass2"),
-                                                  customType1,
-                                                  customType2));
-
-        PortableContext ctx = initPortableContext(marsh);
-
-        assertEquals("val".hashCode(), ctx.fieldId("key".hashCode(), "val"));
-        assertEquals("val".hashCode(), ctx.fieldId("nonexistentclass2".hashCode(), "val"));
-        assertEquals("val".hashCode(), ctx.fieldId("notconfiguredclass".hashCode(), "val"));
-        assertEquals(301, ctx.fieldId(300, "val1"));
-        assertEquals(302, ctx.fieldId(300, "val2"));
-        assertEquals("val3".hashCode(), ctx.fieldId(300, "val3"));
-        assertEquals(401, ctx.fieldId(400, "val1"));
-        assertEquals(402, ctx.fieldId(400, "val2"));
-        assertEquals("val3".hashCode(), ctx.fieldId(400, "val3"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDuplicateTypeId() throws Exception {
-        final PortableMarshaller marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration customType1 = new PortableTypeConfiguration("org.gridgain.Class1");
-
-        customType1.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 100;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        PortableTypeConfiguration customType2 = new PortableTypeConfiguration("org.gridgain.Class2");
-
-        customType2.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return 100;
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return 0;
-            }
-        });
-
-        marsh.setTypeConfigurations(Arrays.asList(customType1, customType2));
-
-        try {
-            initPortableContext(marsh);
-        }
-        catch (IgniteCheckedException e) {
-            assertEquals("Duplicate type ID [clsName=org.gridgain.Class1, id=100]",
-                e.getCause().getCause().getMessage());
-
-            return;
-        }
-
-        assert false;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopy() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        final PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, null);
-
-        assertEquals(obj, copy.deserialize());
-
-        copy = copy(po, new HashMap<String, Object>());
-
-        assertEquals(obj, copy.deserialize());
-
-        Map<String, Object> map = new HashMap<>(1, 1.0f);
-
-        map.put("i", 3);
-
-        copy = copy(po, map);
-
-        assertEquals((byte)2, copy.<Byte>field("b").byteValue());
-        assertEquals((short)2, copy.<Short>field("s").shortValue());
-        assertEquals(3, copy.<Integer>field("i").intValue());
-        assertEquals(2L, copy.<Long>field("l").longValue());
-        assertEquals(2.2f, copy.<Float>field("f").floatValue(), 0);
-        assertEquals(2.2d, copy.<Double>field("d").doubleValue(), 0);
-        assertEquals((char)2, copy.<Character>field("c").charValue());
-        assertEquals(false, copy.<Boolean>field("bool").booleanValue());
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertEquals((byte)2, obj0.b);
-        assertEquals((short)2, obj0.s);
-        assertEquals(3, obj0.i);
-        assertEquals(2L, obj0.l);
-        assertEquals(2.2f, obj0.f, 0);
-        assertEquals(2.2d, obj0.d, 0);
-        assertEquals((char)2, obj0.c);
-        assertEquals(false, obj0.bool);
-
-        map = new HashMap<>(3, 1.0f);
-
-        map.put("b", (byte)3);
-        map.put("l", 3L);
-        map.put("bool", true);
-
-        copy = copy(po, map);
-
-        assertEquals((byte)3, copy.<Byte>field("b").byteValue());
-        assertEquals((short)2, copy.<Short>field("s").shortValue());
-        assertEquals(2, copy.<Integer>field("i").intValue());
-        assertEquals(3L, copy.<Long>field("l").longValue());
-        assertEquals(2.2f, copy.<Float>field("f").floatValue(), 0);
-        assertEquals(2.2d, copy.<Double>field("d").doubleValue(), 0);
-        assertEquals((char)2, copy.<Character>field("c").charValue());
-        assertEquals(true, copy.<Boolean>field("bool").booleanValue());
-
-        obj0 = copy.deserialize();
-
-        assertEquals((byte)3, obj0.b);
-        assertEquals((short)2, obj0.s);
-        assertEquals(2, obj0.i);
-        assertEquals(3L, obj0.l);
-        assertEquals(2.2f, obj0.f, 0);
-        assertEquals(2.2d, obj0.d, 0);
-        assertEquals((char)2, obj0.c);
-        assertEquals(true, obj0.bool);
-
-        map = new HashMap<>(8, 1.0f);
-
-        map.put("b", (byte)3);
-        map.put("s", (short)3);
-        map.put("i", 3);
-        map.put("l", 3L);
-        map.put("f", 3.3f);
-        map.put("d", 3.3d);
-        map.put("c", (char)3);
-        map.put("bool", true);
-
-        copy = copy(po, map);
-
-        assertEquals((byte)3, copy.<Byte>field("b").byteValue());
-        assertEquals((short)3, copy.<Short>field("s").shortValue());
-        assertEquals(3, copy.<Integer>field("i").intValue());
-        assertEquals(3L, copy.<Long>field("l").longValue());
-        assertEquals(3.3f, copy.<Float>field("f").floatValue(), 0);
-        assertEquals(3.3d, copy.<Double>field("d").doubleValue(), 0);
-        assertEquals((char)3, copy.<Character>field("c").charValue());
-        assertEquals(true, copy.<Boolean>field("bool").booleanValue());
-
-        obj0 = copy.deserialize();
-
-        assertEquals((byte)3, obj0.b);
-        assertEquals((short)3, obj0.s);
-        assertEquals(3, obj0.i);
-        assertEquals(3L, obj0.l);
-        assertEquals(3.3f, obj0.f, 0);
-        assertEquals(3.3d, obj0.d, 0);
-        assertEquals((char)3, obj0.c);
-        assertEquals(true, obj0.bool);
-
-//        GridTestUtils.assertThrows(
-//            log,
-//            new Callable<Object>() {
-//                @Override public Object call() throws Exception {
-//                    po.copy(F.<String, Object>asMap("i", false));
-//
-//                    return null;
-//                }
-//            },
-//            PortableException.class,
-//            "Invalid value type for field: i"
-//        );
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyString() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("str", "str3"));
-
-        assertEquals("str3", copy.<String>field("str"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertEquals("str3", obj0.str);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyUuid() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        UUID uuid = UUID.randomUUID();
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("uuid", uuid));
-
-        assertEquals(uuid, copy.<UUID>field("uuid"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertEquals(uuid, obj0.uuid);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyByteArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("bArr", new byte[]{1, 2, 3}));
-
-        assertArrayEquals(new byte[] {1, 2, 3}, copy.<byte[]>field("bArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new byte[] {1, 2, 3}, obj0.bArr);
-    }
-
-    /**
-     * @param po Portable object.
-     * @param fields Fields.
-     * @return Copy.
-     */
-    private PortableObject copy(PortableObject po, Map<String, Object> fields) {
-        PortableBuilder builder = PortableBuilderImpl.wrap(po);
-
-        if (fields != null) {
-            for (Map.Entry<String, Object> e : fields.entrySet())
-                builder.setField(e.getKey(), e.getValue());
-        }
-
-        return builder.build();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyShortArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("sArr", new short[]{1, 2, 3}));
-
-        assertArrayEquals(new short[] {1, 2, 3}, copy.<short[]>field("sArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new short[] {1, 2, 3}, obj0.sArr);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyIntArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("iArr", new int[]{1, 2, 3}));
-
-        assertArrayEquals(new int[] {1, 2, 3}, copy.<int[]>field("iArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new int[] {1, 2, 3}, obj0.iArr);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyLongArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("lArr", new long[]{1, 2, 3}));
-
-        assertArrayEquals(new long[] {1, 2, 3}, copy.<long[]>field("lArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new long[] {1, 2, 3}, obj0.lArr);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyFloatArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("fArr", new float[]{1, 2, 3}));
-
-        assertArrayEquals(new float[] {1, 2, 3}, copy.<float[]>field("fArr"), 0);
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new float[] {1, 2, 3}, obj0.fArr, 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyDoubleArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("dArr", new double[]{1, 2, 3}));
-
-        assertArrayEquals(new double[] {1, 2, 3}, copy.<double[]>field("dArr"), 0);
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new double[] {1, 2, 3}, obj0.dArr, 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyCharArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("cArr", new char[]{1, 2, 3}));
-
-        assertArrayEquals(new char[]{1, 2, 3}, copy.<char[]>field("cArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new char[]{1, 2, 3}, obj0.cArr);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyStringArray() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("strArr", new String[]{"str1", "str2"}));
-
-        assertArrayEquals(new String[]{"str1", "str2"}, copy.<String[]>field("strArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertArrayEquals(new String[]{"str1", "str2"}, obj0.strArr);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyObject() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        SimpleObject newObj = new SimpleObject();
-
-        newObj.i = 12345;
-        newObj.fArr = new float[] {5, 8, 0};
-        newObj.str = "newStr";
-
-        PortableObject copy = copy(po, F.<String, Object>asMap("inner", newObj));
-
-        assertEquals(newObj, copy.<PortableObject>field("inner").deserialize());
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertEquals(newObj, obj0.inner);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyNonPrimitives() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())
-        ));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        Map<String, Object> map = new HashMap<>(3, 1.0f);
-
-        SimpleObject newObj = new SimpleObject();
-
-        newObj.i = 12345;
-        newObj.fArr = new float[] {5, 8, 0};
-        newObj.str = "newStr";
-
-        map.put("str", "str555");
-        map.put("inner", newObj);
-        map.put("bArr", new byte[]{6, 7, 9});
-
-        PortableObject copy = copy(po, map);
-
-        assertEquals("str555", copy.<String>field("str"));
-        assertEquals(newObj, copy.<PortableObject>field("inner").deserialize());
-        assertArrayEquals(new byte[]{6, 7, 9}, copy.<byte[]>field("bArr"));
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertEquals("str555", obj0.str);
-        assertEquals(newObj, obj0.inner);
-        assertArrayEquals(new byte[] {6, 7, 9}, obj0.bArr);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPortableCopyMixed() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(SimpleObject.class.getName())));
-
-        SimpleObject obj = simpleObject();
-
-        PortableObject po = marshal(obj, marsh);
-
-        Map<String, Object> map = new HashMap<>(3, 1.0f);
-
-        SimpleObject newObj = new SimpleObject();
-
-        newObj.i = 12345;
-        newObj.fArr = new float[] {5, 8, 0};
-        newObj.str = "newStr";
-
-        map.put("i", 1234);
-        map.put("str", "str555");
-        map.put("inner", newObj);
-        map.put("s", (short)2323);
-        map.put("bArr", new byte[]{6, 7, 9});
-        map.put("b", (byte)111);
-
-        PortableObject copy = copy(po, map);
-
-        assertEquals(1234, copy.<Integer>field("i").intValue());
-        assertEquals("str555", copy.<String>field("str"));
-        assertEquals(newObj, copy.<PortableObject>field("inner").deserialize());
-        assertEquals((short)2323, copy.<Short>field("s").shortValue());
-        assertArrayEquals(new byte[] {6, 7, 9}, copy.<byte[]>field("bArr"));
-        assertEquals((byte)111, copy.<Byte>field("b").byteValue());
-
-        SimpleObject obj0 = copy.deserialize();
-
-        assertEquals(1234, obj0.i);
-        assertEquals("str555", obj0.str);
-        assertEquals(newObj, obj0.inner);
-        assertEquals((short)2323, obj0.s);
-        assertArrayEquals(new byte[] {6, 7, 9}, obj0.bArr);
-        assertEquals((byte)111, obj0.b);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testKeepDeserialized() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(SimpleObject.class.getName()));
-        marsh.setKeepDeserialized(true);
-
-        PortableObject po = marshal(simpleObject(), marsh);
-
-        assert po.deserialize() == po.deserialize();
-
-        marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(SimpleObject.class.getName()));
-        marsh.setKeepDeserialized(false);
-
-        po = marshal(simpleObject(), marsh);
-
-        assert po.deserialize() != po.deserialize();
-
-        marsh = new PortableMarshaller();
-
-        marsh.setKeepDeserialized(true);
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())));
-
-        po = marshal(simpleObject(), marsh);
-
-        assert po.deserialize() == po.deserialize();
-
-        marsh = new PortableMarshaller();
-
-        marsh.setKeepDeserialized(false);
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(SimpleObject.class.getName())));
-
-        po = marshal(simpleObject(), marsh);
-
-        assert po.deserialize() != po.deserialize();
-
-        marsh = new PortableMarshaller();
-
-        marsh.setKeepDeserialized(true);
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(SimpleObject.class.getName());
-
-        typeCfg.setKeepDeserialized(false);
-
-        marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
-        po = marshal(simpleObject(), marsh);
-
-        assert po.deserialize() != po.deserialize();
-
-        marsh = new PortableMarshaller();
-
-        marsh.setKeepDeserialized(false);
-
-        typeCfg = new PortableTypeConfiguration(SimpleObject.class.getName());
-
-        typeCfg.setKeepDeserialized(true);
-
-        marsh.setTypeConfigurations(Arrays.asList(typeCfg));
-
-        po = marshal(simpleObject(), marsh);
-
-        assert po.deserialize() == po.deserialize();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOffheapPortable() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(new PortableTypeConfiguration(SimpleObject.class.getName())));
-
-        PortableContext ctx = initPortableContext(marsh);
-
-        SimpleObject simpleObj = simpleObject();
-
-        PortableObjectImpl obj = marshal(simpleObj, marsh);
-
-        long ptr = 0;
-
-        long ptr1 = 0;
-
-        long ptr2 = 0;
-
-        try {
-            ptr = copyOffheap(obj);
-
-            PortableObjectOffheapImpl offheapObj = new PortableObjectOffheapImpl(ctx,
-                ptr,
-                0,
-                obj.array().length);
-
-            assertTrue(offheapObj.equals(offheapObj));
-            assertFalse(offheapObj.equals(null));
-            assertFalse(offheapObj.equals("str"));
-            assertTrue(offheapObj.equals(obj));
-            assertTrue(obj.equals(offheapObj));
-
-            ptr1 = copyOffheap(obj);
-
-            PortableObjectOffheapImpl offheapObj1 = new PortableObjectOffheapImpl(ctx,
-                ptr1,
-                0,
-                obj.array().length);
-
-            assertTrue(offheapObj.equals(offheapObj1));
-            assertTrue(offheapObj1.equals(offheapObj));
-
-            assertEquals(obj.typeId(), offheapObj.typeId());
-            assertEquals(obj.hashCode(), offheapObj.hashCode());
-
-            checkSimpleObjectData(simpleObj, offheapObj);
-
-            PortableObjectOffheapImpl innerOffheapObj = offheapObj.field("inner");
-
-            assertNotNull(innerOffheapObj);
-
-            checkSimpleObjectData(simpleObj.inner, innerOffheapObj);
-
-            obj = (PortableObjectImpl)offheapObj.heapCopy();
-
-            assertEquals(obj.typeId(), offheapObj.typeId());
-            assertEquals(obj.hashCode(), offheapObj.hashCode());
-
-            checkSimpleObjectData(simpleObj, obj);
-
-            PortableObjectImpl innerObj = obj.field("inner");
-
-            assertNotNull(innerObj);
-
-            checkSimpleObjectData(simpleObj.inner, innerObj);
-
-            simpleObj.d = 0;
-
-            obj = marshal(simpleObj, marsh);
-
-            assertFalse(offheapObj.equals(obj));
-            assertFalse(obj.equals(offheapObj));
-
-            ptr2 = copyOffheap(obj);
-
-            PortableObjectOffheapImpl offheapObj2 = new PortableObjectOffheapImpl(ctx,
-                ptr2,
-                0,
-                obj.array().length);
-
-            assertFalse(offheapObj.equals(offheapObj2));
-            assertFalse(offheapObj2.equals(offheapObj));
-        }
-        finally {
-            UNSAFE.freeMemory(ptr);
-
-            if (ptr1 > 0)
-                UNSAFE.freeMemory(ptr1);
-
-            if (ptr2 > 0)
-                UNSAFE.freeMemory(ptr2);
-        }
-    }
-
-    /**
-     *
-     */
-    public void testReadResolve() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(
-            Arrays.asList(MySingleton.class.getName(), SingletonMarker.class.getName()));
-
-        PortableObjectImpl portableObj = marshal(MySingleton.INSTANCE, marsh);
-
-        assertTrue(portableObj.array().length <= 1024); // Check that big string was not serialized.
-
-        MySingleton singleton = portableObj.deserialize();
-
-        assertSame(MySingleton.INSTANCE, singleton);
-    }
-
-    /**
-     *
-     */
-    public void testReadResolveOnPortableAware() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Collections.singletonList(MyTestClass.class.getName()));
-
-        PortableObjectImpl portableObj = marshal(new MyTestClass(), marsh);
-
-        MyTestClass obj = portableObj.deserialize();
-
-        assertEquals("readResolve", obj.s);
-    }
-
-    /**
-     * @throws Exception If ecxeption thrown.
-     */
-    public void testDeclareReadResolveInParent() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(ChildPortable.class.getName()));
-
-        PortableObjectImpl portableObj = marshal(new ChildPortable(), marsh);
-
-        ChildPortable singleton = portableObj.deserialize();
-
-        assertNotNull(singleton.s);
-    }
-
-    /**
-     *
-     */
-    public void testDecimalFields() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        Collection<String> clsNames = new ArrayList<>();
-
-        clsNames.add(DecimalReflective.class.getName());
-        clsNames.add(DecimalMarshalAware.class.getName());
-
-        marsh.setClassNames(clsNames);
-
-        // 1. Test reflective stuff.
-        DecimalReflective obj1 = new DecimalReflective();
-
-        obj1.val = BigDecimal.ZERO;
-        obj1.valArr = new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN };
-
-        PortableObjectImpl portObj = marshal(obj1, marsh);
-
-        assertEquals(obj1.val, portObj.field("val"));
-        assertArrayEquals(obj1.valArr, portObj.<BigDecimal[]>field("valArr"));
-
-        assertEquals(obj1.val, portObj.<DecimalReflective>deserialize().val);
-        assertArrayEquals(obj1.valArr, portObj.<DecimalReflective>deserialize().valArr);
-
-        // 2. Test marshal aware stuff.
-        DecimalMarshalAware obj2 = new DecimalMarshalAware();
-
-        obj2.val = BigDecimal.ZERO;
-        obj2.valArr = new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN.negate() };
-        obj2.rawVal = BigDecimal.TEN;
-        obj2.rawValArr = new BigDecimal[] { BigDecimal.ZERO, BigDecimal.ONE };
-
-        portObj = marshal(obj2, marsh);
-
-        assertEquals(obj2.val, portObj.field("val"));
-        assertArrayEquals(obj2.valArr, portObj.<BigDecimal[]>field("valArr"));
-
-        assertEquals(obj2.val, portObj.<DecimalMarshalAware>deserialize().val);
-        assertArrayEquals(obj2.valArr, portObj.<DecimalMarshalAware>deserialize().valArr);
-        assertEquals(obj2.rawVal, portObj.<DecimalMarshalAware>deserialize().rawVal);
-        assertArrayEquals(obj2.rawValArr, portObj.<DecimalMarshalAware>deserialize().rawValArr);
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void testFinalField() throws IgniteCheckedException {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        SimpleObjectWithFinal obj = new SimpleObjectWithFinal();
-
-        SimpleObjectWithFinal po0 = marshalUnmarshal(obj, marsh);
-
-        assertEquals(obj.time, po0.time);
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void testThreadLocalArrayReleased() throws IgniteCheckedException {
-        // Checking the writer directly.
-        assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
-        try (PortableWriterExImpl writer = new PortableWriterExImpl(initPortableContext(new PortableMarshaller()), 0)) {
-            assertEquals(true, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
-            writer.writeString("Thread local test");
-
-            writer.array();
-
-            assertEquals(true, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-        }
-
-        // Checking the portable marshaller.
-        assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        initPortableContext(marsh);
-
-        marsh.marshal(new SimpleObject());
-
-        assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-
-        // Checking the builder.
-        PortableBuilder builder = new PortableBuilderImpl(initPortableContext(new PortableMarshaller()),
-            "org.gridgain.foo.bar.TestClass");
-
-        builder.setField("a", "1");
-
-        PortableObject portableObj = builder.build();
-
-        assertEquals(false, THREAD_LOCAL_ALLOC.isThreadLocalArrayAcquired());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDuplicateName() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        initPortableContext(marsh);
-
-        Test1.Job job1 = new Test1().new Job();
-        Test2.Job job2 = new Test2().new Job();
-
-        marsh.marshal(job1);
-
-        try {
-            marsh.marshal(job2);
-        } catch (PortableException e) {
-            assertEquals(true, e.getMessage().contains("Failed to register class"));
-            return;
-        }
-
-        assert false;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testClassFieldsMarshalling() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        initPortableContext(marsh);
-
-        ObjectWithClassFields obj = new ObjectWithClassFields();
-        obj.cls1 = GridPortableMarshallerSelfTest.class;
-
-        byte[] marshal = marsh.marshal(obj);
-
-        ObjectWithClassFields obj2 = marsh.unmarshal(marshal, null);
-
-        assertEquals(obj.cls1, obj2.cls1);
-        assertNull(obj2.cls2);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMarshallingThroughJdk() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        initPortableContext(marsh);
-
-        InetSocketAddress addr = new InetSocketAddress("192.168.0.2", 4545);
-
-        byte[] arr = marsh.marshal(addr);
-
-        InetSocketAddress addr2 = marsh.unmarshal(arr, null);
-
-        assertEquals(addr.getHostString(), addr2.getHostString());
-        assertEquals(addr.getPort(), addr2.getPort());
-
-        TestAddress testAddr = new TestAddress();
-        testAddr.addr = addr;
-        testAddr.str1 = "Hello World";
-
-        SimpleObject simpleObj = new SimpleObject();
-        simpleObj.c = 'g';
-        simpleObj.date = new Date();
-
-        testAddr.obj = simpleObj;
-
-        arr = marsh.marshal(testAddr);
-
-        TestAddress testAddr2 = marsh.unmarshal(arr, null);
-
-        assertEquals(testAddr.addr.getHostString(), testAddr2.addr.getHostString());
-        assertEquals(testAddr.addr.getPort(), testAddr2.addr.getPort());
-        assertEquals(testAddr.str1, testAddr2.str1);
-        assertEquals(testAddr.obj.c, testAddr2.obj.c);
-        assertEquals(testAddr.obj.date, testAddr2.obj.date);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPredefinedTypeIds() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        PortableContext pCtx = initPortableContext(marsh);
-
-        Field field = pCtx.getClass().getDeclaredField("predefinedTypeNames");
-
-        field.setAccessible(true);
-
-        Map<String, Integer> map = (Map<String, Integer>)field.get(pCtx);
-
-        assertTrue(map.size() > 0);
-
-        for (Map.Entry<String, Integer> entry : map.entrySet()) {
-            int id = entry.getValue();
-
-            if (id == GridPortableMarshaller.UNREGISTERED_TYPE_ID)
-                continue;
-
-            PortableClassDescriptor desc = pCtx.descriptorForTypeId(false, entry.getValue(), null);
-
-            assertEquals(desc.typeId(), pCtx.typeId(desc.describedClass().getName()));
-            assertEquals(desc.typeId(), pCtx.typeId(pCtx.typeName(desc.describedClass().getName())));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCyclicReferencesMarshalling() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        SimpleObject obj = simpleObject();
-
-        obj.bArr = obj.inner.bArr;
-        obj.cArr = obj.inner.cArr;
-        obj.boolArr = obj.inner.boolArr;
-        obj.sArr = obj.inner.sArr;
-        obj.strArr = obj.inner.strArr;
-        obj.iArr = obj.inner.iArr;
-        obj.lArr = obj.inner.lArr;
-        obj.fArr = obj.inner.fArr;
-        obj.dArr = obj.inner.dArr;
-        obj.dateArr = obj.inner.dateArr;
-        obj.uuidArr = obj.inner.uuidArr;
-        obj.objArr = obj.inner.objArr;
-        obj.bdArr = obj.inner.bdArr;
-        obj.map = obj.inner.map;
-        obj.col = obj.inner.col;
-        obj.mEntry = obj.inner.mEntry;
-
-        SimpleObject res = (SimpleObject)marshalUnmarshal(obj, marsh);
-
-        assertEquals(obj, res);
-
-        assertTrue(res.bArr == res.inner.bArr);
-        assertTrue(res.cArr == res.inner.cArr);
-        assertTrue(res.boolArr == res.inner.boolArr);
-        assertTrue(res.sArr == res.inner.sArr);
-        assertTrue(res.strArr == res.inner.strArr);
-        assertTrue(res.iArr == res.inner.iArr);
-        assertTrue(res.lArr == res.inner.lArr);
-        assertTrue(res.fArr == res.inner.fArr);
-        assertTrue(res.dArr == res.inner.dArr);
-        assertTrue(res.dateArr == res.inner.dateArr);
-        assertTrue(res.uuidArr == res.inner.uuidArr);
-        assertTrue(res.objArr == res.inner.objArr);
-        assertTrue(res.bdArr == res.inner.bdArr);
-        assertTrue(res.map == res.inner.map);
-        assertTrue(res.col == res.inner.col);
-        assertTrue(res.mEntry == res.inner.mEntry);
-    }
-
-    /**
-     *
-     */
-    private static class ObjectWithClassFields {
-        private Class<?> cls1;
-
-        private Class<?> cls2;
-    }
-
-    /**
-     *
-     */
-    private static class TestAddress {
-        /** */
-        private SimpleObject obj;
-
-        /** */
-        private InetSocketAddress addr;
-
-        /** */
-        private String str1;
-    }
-
-    /**
-     *
-     */
-    private static class Test1 {
-        /**
-         *
-         */
-        private class Job {
-
-        }
-    }
-
-    /**
-     *
-     */
-    private static class Test2 {
-        /**
-         *
-         */
-        private class Job {
-
-        }
-    }
-
-    /**
-     * @param obj Object.
-     * @return Offheap address.
-     */
-    private long copyOffheap(PortableObjectImpl obj) {
-        byte[] arr = obj.array();
-
-        long ptr = UNSAFE.allocateMemory(arr.length);
-
-        UNSAFE.copyMemory(arr, BYTE_ARR_OFF, null, ptr, arr.length);
-
-        return ptr;
-    }
-
-    /**
-     * @param enumArr Enum array.
-     * @return Ordinals.
-     */
-    private <T extends Enum<?>> Integer[] ordinals(T[] enumArr) {
-        Integer[] ords = new Integer[enumArr.length];
-
-        for (int i = 0; i < enumArr.length; i++)
-            ords[i] = enumArr[i].ordinal();
-
-        return ords;
-    }
-
-    /**
-     * @param po Portable object.
-     * @param off Offset.
-     * @return Value.
-     */
-    private int intFromPortable(PortableObject po, int off) {
-        byte[] arr = U.field(po, "arr");
-
-        return Integer.reverseBytes(U.bytesToInt(arr, off));
-    }
-
-    /**
-     * @param obj Original object.
-     * @return Result object.
-     */
-    private <T> T marshalUnmarshal(T obj) throws IgniteCheckedException {
-        return marshalUnmarshal(obj, new PortableMarshaller());
-    }
-
-    /**
-     * @param obj Original object.
-     * @param marsh Marshaller.
-     * @return Result object.
-     */
-    private <T> T marshalUnmarshal(Object obj, PortableMarshaller marsh) throws IgniteCheckedException {
-        initPortableContext(marsh);
-
-        byte[] bytes = marsh.marshal(obj);
-
-        return marsh.unmarshal(bytes, null);
-    }
-
-    /**
-     * @param obj Object.
-     * @param marsh Marshaller.
-     * @return Portable object.
-     */
-    private <T> PortableObjectImpl marshal(T obj, PortableMarshaller marsh) throws IgniteCheckedException {
-        initPortableContext(marsh);
-
-        byte[] bytes = marsh.marshal(obj);
-
-        return new PortableObjectImpl(U.<GridPortableMarshaller>field(marsh, "impl").context(),
-            bytes, 0);
-    }
-
-    /**
-     * @return Portable context.
-     */
-    protected PortableContext initPortableContext(PortableMarshaller marsh) throws IgniteCheckedException {
-        PortableContext ctx = new PortableContext(META_HND, null);
-
-        marsh.setContext(new MarshallerContextTestImpl(null));
-
-        IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", ctx);
-
-        return ctx;
-    }
-
-    /**
-     * @param exp Expected.
-     * @param act Actual.
-     */
-    private void assertBooleanArrayEquals(boolean[] exp, boolean[] act) {
-        assertEquals(exp.length, act.length);
-
-        for (int i = 0; i < act.length; i++)
-            assertEquals(exp[i], act[i]);
-    }
-
-    /**
-     *
-     */
-    private static class SimpleObjectWithFinal {
-        /** */
-        private final long time = System.currentTimeMillis();
-    }
-
-    /**
-     * @return Simple object.
-     */
-    private SimpleObject simpleObject() {
-        SimpleObject inner = new SimpleObject();
-
-        inner.b = 1;
-        inner.s = 1;
-        inner.i = 1;
-        inner.l = 1;
-        inner.f = 1.1f;
-        inner.d = 1.1d;
-        inner.c = 1;
-        inner.bool = true;
-        inner.str = "str1";
-        inner.uuid = UUID.randomUUID();
-        inner.date = new Date();
-        inner.ts = new Timestamp(System.currentTimeMillis());
-        inner.bArr = new byte[] {1, 2, 3};
-        inner.sArr = new short[] {1, 2, 3};
-        inner.iArr = new int[] {1, 2, 3};
-        inner.lArr = new long[] {1, 2, 3};
-        inner.fArr = new float[] {1.1f, 2.2f, 3.3f};
-        inner.dArr = new double[] {1.1d, 2.2d, 3.3d};
-        inner.cArr = new char[] {1, 2, 3};
-        inner.boolArr = new boolean[] {true, false, true};
-        inner.strArr = new String[] {"str1", "str2", "str3"};
-        inner.uuidArr = new UUID[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
-        inner.dateArr = new Date[] {new Date(11111), new Date(22222), new Date(33333)};
-        inner.objArr = new Object[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
-        inner.col = new ArrayList<>();
-        inner.map = new HashMap<>();
-        inner.enumVal = TestEnum.A;
-        inner.enumArr = new TestEnum[] {TestEnum.A, TestEnum.B};
-        inner.bdArr = new BigDecimal[] {new BigDecimal(1000), BigDecimal.ONE};
-
-        inner.col.add("str1");
-        inner.col.add("str2");
-        inner.col.add("str3");
-
-        inner.map.put(1, "str1");
-        inner.map.put(2, "str2");
-        inner.map.put(3, "str3");
-
-        inner.mEntry = inner.map.entrySet().iterator().next();
-
-        SimpleObject outer = new SimpleObject();
-
-        outer.b = 2;
-        outer.s = 2;
-        outer.i = 2;
-        outer.l = 2;
-        outer.f = 2.2f;
-        outer.d = 2.2d;
-        outer.c = 2;
-        outer.bool = false;
-        outer.str = "str2";
-        outer.uuid = UUID.randomUUID();
-        outer.date = new Date();
-        outer.ts = new Timestamp(System.currentTimeMillis());
-        outer.bArr = new byte[] {10, 20, 30};
-        outer.sArr = new short[] {10, 20, 30};
-        outer.iArr = new int[] {10, 20, 30};
-        outer.lArr = new long[] {10, 20, 30};
-        outer.fArr = new float[] {10.01f, 20.02f, 30.03f};
-        outer.dArr = new double[] {10.01d, 20.02d, 30.03d};
-        outer.cArr = new char[] {10, 20, 30};
-        outer.boolArr = new boolean[] {false, true, false};
-        outer.strArr = new String[] {"str10", "str20", "str30"};
-        outer.uuidArr = new UUID[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
-        outer.dateArr = new Date[] {new Date(44444), new Date(55555), new Date(66666)};
-        outer.objArr = new Object[] {UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()};
-        outer.col = new ArrayList<>();
-        outer.map = new HashMap<>();
-        outer.enumVal = TestEnum.B;
-        outer.enumArr = new TestEnum[] {TestEnum.B, TestEnum.C};
-        outer.inner = inner;
-        outer.bdArr = new BigDecimal[] {new BigDecimal(5000), BigDecimal.TEN};
-
-
-        outer.col.add("str4");
-        outer.col.add("str5");
-        outer.col.add("str6");
-
-        outer.map.put(4, "str4");
-        o

<TRUNCATED>

[31/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
deleted file mode 100644
index 7f23c1f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
+++ /dev/null
@@ -1,1021 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectAllTypes;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectContainer;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectInner;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectOuter;
-import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectPlainPortable;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
-import org.apache.ignite.internal.util.GridUnsafe;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import sun.misc.Unsafe;
-
-/**
- * Portable builder test.
- */
-public class GridPortableBuilderSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
-
-    /** */
-    protected static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName(),
-            "org.gridgain.grid.internal.util.portable.mutabletest.*"));
-
-        PortableTypeConfiguration customIdMapper = new PortableTypeConfiguration();
-
-        customIdMapper.setClassName(CustomIdMapper.class.getName());
-        customIdMapper.setIdMapper(new PortableIdMapper() {
-            @Override public int typeId(String clsName) {
-                return ~PortableContext.DFLT_ID_MAPPER.typeId(clsName);
-            }
-
-            @Override public int fieldId(int typeId, String fieldName) {
-                return typeId + ~PortableContext.DFLT_ID_MAPPER.fieldId(typeId, fieldName);
-            }
-        });
-
-        marsh.setTypeConfigurations(Collections.singleton(customIdMapper));
-
-        marsh.setConvertStringToBytes(useUtf8());
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrids(1);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @return Whether to use UTF8 strings.
-     */
-    protected boolean useUtf8() {
-        return true;
-    }
-
-    /**
-     *
-     */
-    public void testAllFieldsSerialization() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-        obj.setDefaultData();
-        obj.enumArr = null;
-
-        TestObjectAllTypes deserialized = builder(toPortable(obj)).build().deserialize();
-
-        GridTestUtils.deepEquals(obj, deserialized);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testByteField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("byteField", (byte)1);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals((byte)1, po.<Byte>field("byteField").byteValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testShortField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("shortField", (short)1);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals((short)1, po.<Short>field("shortField").shortValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIntField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("intField", 1);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(1, po.<Integer>field("intField").intValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLongField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("longField", 1L);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(1L, po.<Long>field("longField").longValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFloatField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("floatField", 1.0f);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(1.0f, po.<Float>field("floatField").floatValue(), 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDoubleField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("doubleField", 1.0d);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(1.0d, po.<Double>field("doubleField").doubleValue(), 0);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCharField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("charField", (char)1);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals((char)1, po.<Character>field("charField").charValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBooleanField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("booleanField", true);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(po.<Boolean>field("booleanField"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDecimalField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("decimalField", BigDecimal.TEN);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(BigDecimal.TEN, po.<String>field("decimalField"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStringField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("stringField", "str");
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals("str", po.<String>field("stringField"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testUuidField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        UUID uuid = UUID.randomUUID();
-
-        builder.setField("uuidField", uuid);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(uuid, po.<UUID>field("uuidField"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testByteArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("byteArrayField", new byte[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new byte[] {1, 2, 3}, po.<byte[]>field("byteArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testShortArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("shortArrayField", new short[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new short[] {1, 2, 3}, po.<short[]>field("shortArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIntArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("intArrayField", new int[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new int[] {1, 2, 3}, po.<int[]>field("intArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLongArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("longArrayField", new long[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new long[] {1, 2, 3}, po.<long[]>field("longArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFloatArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("floatArrayField", new float[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new float[] {1, 2, 3}, po.<float[]>field("floatArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDoubleArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("doubleArrayField", new double[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new double[] {1, 2, 3}, po.<double[]>field("doubleArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCharArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("charArrayField", new char[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new char[] {1, 2, 3}, po.<char[]>field("charArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBooleanArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("booleanArrayField", new boolean[] {true, false});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        boolean[] arr = po.field("booleanArrayField");
-
-        assertEquals(2, arr.length);
-
-        assertTrue(arr[0]);
-        assertFalse(arr[1]);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDecimalArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("decimalArrayField", new BigDecimal[] {BigDecimal.ONE, BigDecimal.TEN});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new BigDecimal[] {BigDecimal.ONE, BigDecimal.TEN}, po.<String[]>field("decimalArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStringArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("stringArrayField", new String[] {"str1", "str2", "str3"});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(new String[] {"str1", "str2", "str3"}, po.<String[]>field("stringArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testUuidArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        UUID[] arr = new UUID[] {UUID.randomUUID(), UUID.randomUUID()};
-
-        builder.setField("uuidArrayField", arr);
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertTrue(Arrays.equals(arr, po.<UUID[]>field("uuidArrayField")));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testObjectField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("objectField", new Value(1));
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(1, po.<PortableObject>field("objectField").<Value>deserialize().i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testObjectArrayField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("objectArrayField", new Value[] {new Value(1), new Value(2)});
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        Object[] arr = po.field("objectArrayField");
-
-        assertEquals(2, arr.length);
-
-        assertEquals(1, ((PortableObject)arr[0]).<Value>deserialize().i);
-        assertEquals(2, ((PortableObject)arr[1]).<Value>deserialize().i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollectionField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("collectionField", Arrays.asList(new Value(1), new Value(2)));
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        List<PortableObject> list = po.field("collectionField");
-
-        assertEquals(2, list.size());
-
-        assertEquals(1, list.get(0).<Value>deserialize().i);
-        assertEquals(2, list.get(1).<Value>deserialize().i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMapField() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("mapField", F.asMap(new Key(1), new Value(1), new Key(2), new Value(2)));
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        Map<PortableObject, PortableObject> map = po.field("mapField");
-
-        assertEquals(2, map.size());
-
-        for (Map.Entry<PortableObject, PortableObject> e : map.entrySet())
-            assertEquals(e.getKey().<Key>deserialize().i, e.getValue().<Value>deserialize().i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSeveralFields() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("i", 111);
-        builder.setField("f", 111.111f);
-        builder.setField("iArr", new int[] {1, 2, 3});
-        builder.setField("obj", new Key(1));
-        builder.setField("col", Arrays.asList(new Value(1), new Value(2)));
-
-        PortableObject po = builder.build();
-
-        assertEquals("class".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(111, po.<Integer>field("i").intValue());
-        assertEquals(111.111f, po.<Float>field("f").floatValue(), 0);
-        assertTrue(Arrays.equals(new int[] {1, 2, 3}, po.<int[]>field("iArr")));
-        assertEquals(1, po.<PortableObject>field("obj").<Key>deserialize().i);
-
-        List<PortableObject> list = po.field("col");
-
-        assertEquals(2, list.size());
-
-        assertEquals(1, list.get(0).<Value>deserialize().i);
-        assertEquals(2, list.get(1).<Value>deserialize().i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOffheapPortable() throws Exception {
-        PortableBuilder builder = builder("Class");
-
-        builder.hashCode(100);
-
-        builder.setField("i", 111);
-        builder.setField("f", 111.111f);
-        builder.setField("iArr", new int[] {1, 2, 3});
-        builder.setField("obj", new Key(1));
-        builder.setField("col", Arrays.asList(new Value(1), new Value(2)));
-
-        PortableObject po = builder.build();
-
-        byte[] arr = ((CacheObjectPortableProcessorImpl)(grid(0)).context().cacheObjects()).marshal(po);
-
-        long ptr = UNSAFE.allocateMemory(arr.length + 5);
-
-        try {
-            long ptr0 = ptr;
-
-            UNSAFE.putBoolean(null, ptr0++, false);
-
-            UNSAFE.putInt(ptr0, arr.length);
-
-            UNSAFE.copyMemory(arr, BYTE_ARR_OFF, null, ptr0 + 4, arr.length);
-
-            PortableObject offheapObj = (PortableObject)
-                ((CacheObjectPortableProcessorImpl)(grid(0)).context().cacheObjects()).unmarshal(ptr, false);
-
-            assertEquals(PortableObjectOffheapImpl.class, offheapObj.getClass());
-
-            assertEquals("class".hashCode(), offheapObj.typeId());
-            assertEquals(100, offheapObj.hashCode());
-
-            assertEquals(111, offheapObj.<Integer>field("i").intValue());
-            assertEquals(111.111f, offheapObj.<Float>field("f").floatValue(), 0);
-            assertTrue(Arrays.equals(new int[] {1, 2, 3}, offheapObj.<int[]>field("iArr")));
-            assertEquals(1, offheapObj.<PortableObject>field("obj").<Key>deserialize().i);
-
-            List<PortableObject> list = offheapObj.field("col");
-
-            assertEquals(2, list.size());
-
-            assertEquals(1, list.get(0).<Value>deserialize().i);
-            assertEquals(2, list.get(1).<Value>deserialize().i);
-
-            assertEquals(po, offheapObj);
-            assertEquals(offheapObj, po);
-        }
-        finally {
-            UNSAFE.freeMemory(ptr);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testBuildAndDeserialize() throws Exception {
-        PortableBuilder builder = builder(Value.class.getName());
-
-        builder.hashCode(100);
-
-        builder.setField("i", 1);
-
-        PortableObject po = builder.build();
-
-        assertEquals("value".hashCode(), po.typeId());
-        assertEquals(100, po.hashCode());
-
-        assertEquals(1, po.<Value>deserialize().i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMetaData2() throws Exception {
-        PortableBuilder builder = builder("org.test.MetaTest2");
-
-        builder.setField("objectField", "a", Object.class);
-
-        PortableObject po = builder.build();
-
-        PortableMetadata meta = po.metaData();
-
-        assertEquals("MetaTest2", meta.typeName());
-        assertEquals("Object", meta.fieldTypeName("objectField"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMetaData() throws Exception {
-        PortableBuilder builder = builder("org.test.MetaTest");
-
-        builder.hashCode(100);
-
-        builder.setField("intField", 1);
-        builder.setField("byteArrayField", new byte[] {1, 2, 3});
-
-        PortableObject po = builder.build();
-
-        PortableMetadata meta = po.metaData();
-
-        assertEquals("MetaTest", meta.typeName());
-
-        Collection<String> fields = meta.fields();
-
-        assertEquals(2, fields.size());
-
-        assertTrue(fields.contains("intField"));
-        assertTrue(fields.contains("byteArrayField"));
-
-        assertEquals("int", meta.fieldTypeName("intField"));
-        assertEquals("byte[]", meta.fieldTypeName("byteArrayField"));
-
-        builder = builder("org.test.MetaTest");
-
-        builder.hashCode(100);
-
-        builder.setField("intField", 2);
-        builder.setField("uuidField", UUID.randomUUID());
-
-        po = builder.build();
-
-        meta = po.metaData();
-
-        assertEquals("MetaTest", meta.typeName());
-
-        fields = meta.fields();
-
-        assertEquals(3, fields.size());
-
-        assertTrue(fields.contains("intField"));
-        assertTrue(fields.contains("byteArrayField"));
-        assertTrue(fields.contains("uuidField"));
-
-        assertEquals("int", meta.fieldTypeName("intField"));
-        assertEquals("byte[]", meta.fieldTypeName("byteArrayField"));
-        assertEquals("UUID", meta.fieldTypeName("uuidField"));
-    }
-
-    /**
-     *
-     */
-    public void testGetFromCopiedObj() {
-        PortableObject objStr = builder(TestObjectAllTypes.class.getName()).setField("str", "aaa").build();
-
-        PortableBuilderImpl builder = builder(objStr);
-        assertEquals("aaa", builder.getField("str"));
-
-        builder.setField("str", "bbb");
-        assertEquals("bbb", builder.getField("str"));
-
-        assertNull(builder.getField("i_"));
-        assertEquals("bbb", builder.build().<TestObjectAllTypes>deserialize().str);
-    }
-
-    /**
-     *
-     */
-    public void testCopyFromInnerObjects() {
-        ArrayList<Object> list = new ArrayList<>();
-        list.add(new TestObjectAllTypes());
-        list.add(list.get(0));
-
-        TestObjectContainer c = new TestObjectContainer(list);
-
-        PortableBuilderImpl builder = builder(toPortable(c));
-        builder.<List>getField("foo").add("!!!");
-
-        PortableObject res = builder.build();
-
-        TestObjectContainer deserialized = res.deserialize();
-
-        List deserializedList = (List)deserialized.foo;
-
-        assertSame(deserializedList.get(0), deserializedList.get(1));
-        assertEquals("!!!", deserializedList.get(2));
-        assertTrue(deserializedList.get(0) instanceof TestObjectAllTypes);
-    }
-
-    /**
-     *
-     */
-    public void testSetPortableObject() {
-        PortableObject portableObj = builder(TestObjectContainer.class.getName())
-            .setField("foo", toPortable(new TestObjectAllTypes()))
-            .build();
-
-        assertTrue(portableObj.<TestObjectContainer>deserialize().foo instanceof TestObjectAllTypes);
-    }
-
-    /**
-     *
-     */
-    public void testPlainPortableObjectCopyFrom() {
-        TestObjectPlainPortable obj = new TestObjectPlainPortable(toPortable(new TestObjectAllTypes()));
-
-        PortableBuilderImpl builder = builder(toPortable(obj));
-        assertTrue(builder.getField("plainPortable") instanceof PortableObject);
-
-        TestObjectPlainPortable deserialized = builder.build().deserialize();
-        assertTrue(deserialized.plainPortable instanceof PortableObject);
-    }
-
-    /**
-     *
-     */
-    public void testRemoveFromNewObject() {
-        PortableBuilder builder = builder(TestObjectAllTypes.class.getName());
-
-        builder.setField("str", "a");
-
-        builder.removeField("str");
-
-        assertNull(builder.build().<TestObjectAllTypes>deserialize().str);
-    }
-
-    /**
-     *
-     */
-    public void testRemoveFromExistingObject() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-        obj.setDefaultData();
-        obj.enumArr = null;
-
-        PortableBuilder builder = builder(toPortable(obj));
-
-        builder.removeField("str");
-
-        assertNull(builder.build().<TestObjectAllTypes>deserialize().str);
-    }
-
-    /**
-     *
-     */
-    public void testRemoveFromExistingObjectAfterGet() {
-        TestObjectAllTypes obj = new TestObjectAllTypes();
-        obj.setDefaultData();
-        obj.enumArr = null;
-
-        PortableBuilderImpl builder = builder(toPortable(obj));
-
-        builder.getField("i_");
-
-        builder.removeField("str");
-
-        assertNull(builder.build().<TestObjectAllTypes>deserialize().str);
-    }
-
-    /**
-     * @throws IgniteCheckedException If any error occurs.
-     */
-    public void testDontBrokeCyclicDependency() throws IgniteCheckedException {
-        TestObjectOuter outer = new TestObjectOuter();
-        outer.inner = new TestObjectInner();
-        outer.inner.outer = outer;
-        outer.foo = "a";
-
-        PortableBuilder builder = builder(toPortable(outer));
-
-        builder.setField("foo", "b");
-
-        TestObjectOuter res = builder.build().deserialize();
-
-        assertEquals("b", res.foo);
-        assertSame(res, res.inner.outer);
-    }
-
-    /**
-     * @return Portables.
-     */
-    private IgnitePortables portables() {
-        return grid(0).portables();
-    }
-
-    /**
-     * @param obj Object.
-     * @return Portable object.
-     */
-    private PortableObject toPortable(Object obj) {
-        return portables().toPortable(obj);
-    }
-
-    /**
-     * @return Builder.
-     */
-    private <T> PortableBuilder builder(int typeId) {
-        return portables().builder(typeId);
-    }
-
-    /**
-     * @return Builder.
-     */
-    private <T> PortableBuilder builder(String clsName) {
-        return portables().builder(clsName);
-    }
-
-    /**
-     * @return Builder.
-     */
-    private <T> PortableBuilderImpl builder(PortableObject obj) {
-        return (PortableBuilderImpl)portables().builder(obj);
-    }
-
-    /**
-     *
-     */
-    private static class CustomIdMapper {
-        /** */
-        private String str = "a";
-
-        /** */
-        private int i = 10;
-    }
-
-    /**
-     */
-    private static class Key {
-        /** */
-        private int i;
-
-        /**
-         */
-        private Key() {
-            // No-op.
-        }
-
-        /**
-         * @param i Index.
-         */
-        private Key(int i) {
-            this.i = i;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            Key key = (Key)o;
-
-            return i == key.i;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return i;
-        }
-    }
-
-    /**
-     */
-    private static class Value {
-        /** */
-        private int i;
-
-        /**
-         */
-        private Value() {
-            // No-op.
-        }
-
-        /**
-         * @param i Index.
-         */
-        private Value(int i) {
-            this.i = i;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java
deleted file mode 100644
index 2fce1a5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsAdditionalSelfTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-/**
- *
- */
-public class GridPortableBuilderStringAsCharsAdditionalSelfTest extends GridPortableBuilderAdditionalSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean useUtf8() {
-        return false;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java
deleted file mode 100644
index 5c53233..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderStringAsCharsSelfTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-/**
- * Portable builder test.
- */
-public class GridPortableBuilderStringAsCharsSelfTest extends GridPortableBuilderSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean useUtf8() {
-        return false;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
deleted file mode 100644
index bd9612c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Arrays;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.MarshallerContextAdapter;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class GridPortableMarshallerCtxDisabledSelfTest extends GridCommonAbstractTest {
-    /** */
-    protected static final PortableMetaDataHandler META_HND = new PortableMetaDataHandler() {
-        @Override public void addMeta(int typeId, PortableMetadata meta) {
-            // No-op.
-        }
-
-        @Override public PortableMetadata metadata(int typeId) {
-            return null;
-        }
-    };
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testObjectExchange() throws Exception {
-        PortableMarshaller marsh = new PortableMarshaller();
-        marsh.setContext(new MarshallerContextWithNoStorage());
-
-        PortableContext context = new PortableContext(META_HND, null);
-
-        IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", context);
-
-        SimpleObject simpleObj = new SimpleObject();
-
-        simpleObj.b = 2;
-        simpleObj.bArr = new byte[] {2, 3, 4, 5, 5};
-        simpleObj.c = 'A';
-        simpleObj.enumVal = TestEnum.D;
-        simpleObj.objArr = new Object[] {"hello", "world", "from", "me"};
-        simpleObj.enumArr = new TestEnum[] {TestEnum.C, TestEnum.B};
-
-        SimpleObject otherObj = new SimpleObject();
-
-        otherObj.b = 3;
-        otherObj.bArr = new byte[] {5, 3, 4};
-
-        simpleObj.otherObj = otherObj;
-
-        assertEquals(simpleObj, marsh.unmarshal(marsh.marshal(simpleObj), null));
-
-        SimplePortable simplePortable = new SimplePortable();
-
-        simplePortable.str = "portable";
-        simplePortable.arr = new long[] {100, 200, 300};
-
-        assertEquals(simplePortable, marsh.unmarshal(marsh.marshal(simplePortable), null));
-
-        SimpleExternalizable simpleExtr = new SimpleExternalizable();
-
-        simpleExtr.str = "externalizable";
-        simpleExtr.arr = new long[] {20000, 300000, 400000};
-
-        assertEquals(simpleExtr, marsh.unmarshal(marsh.marshal(simpleExtr), null));
-    }
-
-    /**
-     * Marshaller context with no storage. Platform has to work in such environment as well by marshalling class name of
-     * a portable object.
-     */
-    private static class MarshallerContextWithNoStorage extends MarshallerContextAdapter {
-        /** */
-        public MarshallerContextWithNoStorage() {
-            super(null);
-        }
-
-        /** {@inheritDoc} */
-        @Override protected boolean registerClassName(int id, String clsName) throws IgniteCheckedException {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override protected String className(int id) throws IgniteCheckedException {
-            return null;
-        }
-    }
-
-    /**
-     */
-    private enum TestEnum {
-        A, B, C, D, E
-    }
-
-    /**
-     */
-    private static class SimpleObject {
-        /** */
-        private byte b;
-
-        /** */
-        private char c;
-
-        /** */
-        private byte[] bArr;
-
-        /** */
-        private Object[] objArr;
-
-        /** */
-        private TestEnum enumVal;
-
-        /** */
-        private TestEnum[] enumArr;
-
-        private SimpleObject otherObj;
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            SimpleObject object = (SimpleObject)o;
-
-            if (b != object.b)
-                return false;
-
-            if (c != object.c)
-                return false;
-
-            if (!Arrays.equals(bArr, object.bArr))
-                return false;
-
-            // Probably incorrect - comparing Object[] arrays with Arrays.equals
-            if (!Arrays.equals(objArr, object.objArr))
-                return false;
-
-            if (enumVal != object.enumVal)
-                return false;
-
-            // Probably incorrect - comparing Object[] arrays with Arrays.equals
-            if (!Arrays.equals(enumArr, object.enumArr))
-                return false;
-
-            return !(otherObj != null ? !otherObj.equals(object.otherObj) : object.otherObj != null);
-        }
-    }
-
-    /**
-     *
-     */
-    private static class SimplePortable implements PortableMarshalAware {
-        /** */
-        private String str;
-
-        /** */
-        private long[] arr;
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeString("str", str);
-            writer.writeLongArray("longArr", arr);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            str = reader.readString("str");
-            arr = reader.readLongArray("longArr");
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            SimplePortable that = (SimplePortable)o;
-
-            if (str != null ? !str.equals(that.str) : that.str != null)
-                return false;
-
-            return Arrays.equals(arr, that.arr);
-        }
-    }
-
-    /**
-     *
-     */
-    private static class SimpleExternalizable implements Externalizable {
-        /** */
-        private String str;
-
-        /** */
-        private long[] arr;
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeUTF(str);
-            out.writeObject(arr);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            str = in.readUTF();
-            arr = (long[])in.readObject();
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            SimpleExternalizable that = (SimpleExternalizable)o;
-
-            if (str != null ? !str.equals(that.str) : that.str != null)
-                return false;
-
-            return Arrays.equals(arr, that.arr);
-        }
-    }
-}
\ No newline at end of file


[24/41] ignite git commit: Minor.

Posted by ag...@apache.org.
Minor.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b4c515e6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b4c515e6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b4c515e6

Branch: refs/heads/ignite-1400
Commit: b4c515e62bc8412a2859a5a771ef3c4b38691529
Parents: 095d4b3
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 14 11:37:36 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 14 11:37:36 2015 +0300

----------------------------------------------------------------------
 .../dht/GridCacheTxNodeFailureSelfTest.java      | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b4c515e6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
index 1135c40..dc78003 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -36,8 +36,10 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
@@ -59,6 +61,9 @@ import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_REA
  */
 @SuppressWarnings("unchecked")
 public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
     /**
      * @return Grid count.
      */
@@ -70,6 +75,8 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
+
         cfg.setCacheConfiguration(cacheConfiguration(gridName));
 
         cfg.setCommunicationSpi(new BanningCommunicationSpi());
@@ -202,9 +209,8 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
 
             final CountDownLatch commitLatch = new CountDownLatch(1);
 
-            if (!commit) {
+            if (!commit)
                 communication(1).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareRequest.class));
-            }
             else {
                 if (!backup) {
                     communication(2).bannedClasses(Collections.<Class>singletonList(GridDhtTxPrepareResponse.class));
@@ -389,12 +395,11 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure) throws IgniteSpiException {
+        @Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) {
             GridIoMessage ioMsg = (GridIoMessage)msg;
 
-            if (!bannedClasses.contains(ioMsg.message().getClass())) {
-                super.sendMessage(node, msg, ackClosure);
-            }
+            if (!bannedClasses.contains(ioMsg.message().getClass()))
+                super.sendMessage(node, msg, ackC);
         }
     }
 }


[35/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
deleted file mode 100644
index ee0a4ec..0000000
--- a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.TreeMap;
-import java.util.UUID;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Defines portable objects functionality. With portable objects you are able to:
- * <ul>
- * <li>Seamlessly interoperate between Java, .NET, and C++.</li>
- * <li>Make any object portable with zero code change to your existing code.</li>
- * <li>Nest portable objects within each other.</li>
- * <li>Automatically handle {@code circular} or {@code null} references.</li>
- * <li>Automatically convert collections and maps between Java, .NET, and C++.</li>
- * <li>
- *      Optionally avoid deserialization of objects on the server side
- *      (objects are stored in {@link PortableObject} format).
- * </li>
- * <li>Avoid need to have concrete class definitions on the server side.</li>
- * <li>Dynamically change structure of the classes without having to restart the cluster.</li>
- * <li>Index into portable objects for querying purposes.</li>
- * </ul>
- * <h1 class="header">Working With Portables Directly</h1>
- * Once an object is defined as portable,
- * Ignite will always store it in memory in the portable (i.e. binary) format.
- * User can choose to work either with the portable format or with the deserialized form
- * (assuming that class definitions are present in the classpath).
- * <p>
- * To work with the portable format directly, user should create a special cache projection
- * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
- * <pre name=code class=java>
- * IgniteCache&lt;PortableObject, PortableObject&gt; prj = cache.withKeepPortable();
- *
- * // Convert instance of MyKey to portable format.
- * // We could also use PortableBuilder to create the key in portable format directly.
- * PortableObject key = grid.portables().toPortable(new MyKey());
- *
- * PortableObject val = prj.get(key);
- *
- * String field = val.field("myFieldName");
- * </pre>
- * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
- * <pre name=code class=java>
- * IgniteCache&lt;MyKey.class, MyValue.class&gt; cache = grid.cache(null);
- *
- * MyValue val = cache.get(new MyKey());
- *
- * // Normal java getter.
- * String fieldVal = val.getMyFieldName();
- * </pre>
- * If we used, for example, one of the automatically handled portable types for a key, like integer,
- * and still wanted to work with binary portable format for values, then we would declare cache projection
- * as follows:
- * <pre name=code class=java>
- * IgniteCache&lt;Integer.class, PortableObject&gt; prj = cache.withKeepPortable();
- * </pre>
- * <h1 class="header">Automatic Portable Types</h1>
- * Note that only portable classes are converted to {@link PortableObject} format. Following
- * classes are never converted (e.g., {@link #toPortable(Object)} method will return original
- * object, and instances of these classes will be stored in cache without changes):
- * <ul>
- *     <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
- *     <li>Arrays of primitives (byte[], int[], ...)</li>
- *     <li>{@link String} and array of {@link String}s</li>
- *     <li>{@link UUID} and array of {@link UUID}s</li>
- *     <li>{@link Date} and array of {@link Date}s</li>
- *     <li>{@link Timestamp} and array of {@link Timestamp}s</li>
- *     <li>Enums and array of enums</li>
- *     <li>
- *         Maps, collections and array of objects (but objects inside
- *         them will still be converted if they are portable)
- *     </li>
- * </ul>
- * <h1 class="header">Working With Maps and Collections</h1>
- * All maps and collections in the portable objects are serialized automatically. When working
- * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
- * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
- * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
- * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
- * in C#, etc.
- * <h1 class="header">Building Portable Objects</h1>
- * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
- * <pre name=code class=java>
- * PortableBuilder builder = Ignition.ignite().portables().builder();
- *
- * builder.typeId("MyObject");
- *
- * builder.stringField("fieldA", "A");
- * build.intField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- * </pre>
- * For the cases when class definition is present
- * in the class path, it is also possible to populate a standard POJO and then
- * convert it to portable format, like so:
- * <pre name=code class=java>
- * MyObject obj = new MyObject();
- *
- * obj.setFieldA("A");
- * obj.setFieldB(123);
- *
- * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
- * </pre>
- * NOTE: you don't need to convert typed objects to portable format before storing
- * them in cache, Ignite will do that automatically.
- * <h1 class="header">Portable Metadata</h1>
- * Even though Ignite portable protocol only works with hash codes for type and field names
- * to achieve better performance, Ignite provides metadata for all portable types which
- * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
- * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- * <h1 class="header">Dynamic Structure Changes</h1>
- * Since objects are always cached in the portable binary format, server does not need to
- * be aware of the class definitions. Moreover, if class definitions are not present or not
- * used on the server, then clients can continuously change the structure of the portable
- * objects without having to restart the cluster. For example, if one client stores a
- * certain class with fields A and B, and another client stores the same class with
- * fields B and C, then the server-side portable object will have the fields A, B, and C.
- * As the structure of a portable object changes, the new fields become available for SQL queries
- * automatically.
- * <h1 class="header">Configuration</h1>
- * By default all your objects are considered as portables and no specific configuration is needed.
- * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
- * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
- * The only requirement Ignite imposes is that your object has an empty
- * constructor. Note, that since server side does not have to know the class definition,
- * you only need to list portable objects in configuration on the client side. However, if you
- * list them on the server side as well, then you get the ability to deserialize portable objects
- * into concrete types on the server as well as on the client.
- * <p>
- * Here is an example of portable configuration (note that star (*) notation is supported):
- * <pre name=code class=xml>
- * ...
- * &lt;!-- Explicit portable objects configuration. --&gt;
- * &lt;property name="marshaller"&gt;
- *     &lt;bean class="org.apache.ignite.marshaller.portable.PortableMarshaller"&gt;
- *         &lt;property name="classNames"&gt;
- *             &lt;list&gt;
- *                 &lt;value&gt;my.package.for.portable.objects.*&lt;/value&gt;
- *                 &lt;value&gt;org.apache.ignite.examples.client.portable.Employee&lt;/value&gt;
- *             &lt;/list&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- * &lt;/property&gt;
- * ...
- * </pre>
- * or from code:
- * <pre name=code class=java>
- * IgniteConfiguration cfg = new IgniteConfiguration();
- *
- * PortableMarshaller marsh = new PortableMarshaller();
- *
- * marsh.setClassNames(Arrays.asList(
- *     Employee.class.getName(),
- *     Address.class.getName())
- * );
- *
- * cfg.setMarshaller(marsh);
- * </pre>
- * You can also specify class name for a portable object via {@link PortableTypeConfiguration}.
- * Do it in case if you need to override other configuration properties on per-type level, like
- * ID-mapper, or serializer.
- * <h1 class="header">Custom Affinity Keys</h1>
- * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
- * storing objects in cache. For example, if you are caching {@code Employee} object with
- * {@code Organization}, and want to colocate employees with organization they work for,
- * so you can process them together, you need to specify an alternate affinity key.
- * With portable objects you would have to do it as following:
- * <pre name=code class=xml>
- * &lt;property name="marshaller"&gt;
- *     &lt;bean class="org.gridgain.grid.marshaller.portable.PortableMarshaller"&gt;
- *         ...
- *         &lt;property name="typeConfigurations"&gt;
- *             &lt;list&gt;
- *                 &lt;bean class="org.apache.ignite.portable.PortableTypeConfiguration"&gt;
- *                     &lt;property name="className" value="org.apache.ignite.examples.client.portable.EmployeeKey"/&gt;
- *                     &lt;property name="affinityKeyFieldName" value="organizationId"/&gt;
- *                 &lt;/bean&gt;
- *             &lt;/list&gt;
- *         &lt;/property&gt;
- *         ...
- *     &lt;/bean&gt;
- * &lt;/property&gt;
- * </pre>
- * <h1 class="header">Serialization</h1>
- * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
- * serialization logic by optionally implementing {@link PortableMarshalAware} interface, like so:
- * <pre name=code class=java>
- * public class Address implements PortableMarshalAware {
- *     private String street;
- *     private int zip;
- *
- *     // Empty constructor required for portable deserialization.
- *     public Address() {}
- *
- *     &#64;Override public void writePortable(PortableWriter writer) throws PortableException {
- *         writer.writeString("street", street);
- *         writer.writeInt("zip", zip);
- *     }
- *
- *     &#64;Override public void readPortable(PortableReader reader) throws PortableException {
- *         street = reader.readString("street");
- *         zip = reader.readInt("zip");
- *     }
- * }
- * </pre>
- * Alternatively, if you cannot change class definitions, you can provide custom serialization
- * logic in {@link PortableSerializer} either globally in {@link PortableMarshaller} or
- * for a specific type via {@link PortableTypeConfiguration} instance.
- * <p>
- * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
- * <ul>
- *     <li>
- *         {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
- *         It may be used to replace the de-serialized object by another one of your choice.
- *     </li>
- *     <li>
- *          {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
- *          allows the developer to provide a replacement object that will be serialized instead of the original one.
- *     </li>
- * </ul>
- *
- * <h1 class="header">Custom ID Mappers</h1>
- * Ignite implementation uses name hash codes to generate IDs for class names or field names
- * internally. However, in cases when you want to provide your own ID mapping schema,
- * you can provide your own {@link PortableIdMapper} implementation.
- * <p>
- * ID-mapper may be provided either globally in {@link PortableMarshaller},
- * or for a specific type via {@link PortableTypeConfiguration} instance.
- * <h1 class="header">Query Indexing</h1>
- * Portable objects can be indexed for querying by specifying index fields in
- * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
- * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
- * like so:
- * <pre name=code class=xml>
- * ...
- * &lt;bean class="org.apache.ignite.cache.CacheConfiguration"&gt;
- *     ...
- *     &lt;property name="typeMetadata"&gt;
- *         &lt;list&gt;
- *             &lt;bean class="CacheTypeMetadata"&gt;
- *                 &lt;property name="type" value="Employee"/&gt;
- *
- *                 &lt;!-- Fields to index in ascending order. --&gt;
- *                 &lt;property name="ascendingFields"&gt;
- *                     &lt;map&gt;
- *                     &lt;entry key="name" value="java.lang.String"/&gt;
- *
- *                         &lt;!-- Nested portable objects can also be indexed. --&gt;
- *                         &lt;entry key="address.zip" value="java.lang.Integer"/&gt;
- *                     &lt;/map&gt;
- *                 &lt;/property&gt;
- *             &lt;/bean&gt;
- *         &lt;/list&gt;
- *     &lt;/property&gt;
- * &lt;/bean&gt;
- * </pre>
- */
-public interface IgnitePortables {
-    /**
-     * Gets type ID for given type name.
-     *
-     * @param typeName Type name.
-     * @return Type ID.
-     */
-    public int typeId(String typeName);
-
-    /**
-     * Converts provided object to instance of {@link PortableObject}.
-     *
-     * @param obj Object to convert.
-     * @return Converted object.
-     * @throws PortableException In case of error.
-     */
-    public <T> T toPortable(@Nullable Object obj) throws PortableException;
-
-    /**
-     * Creates new portable builder.
-     *
-     * @param typeId ID of the type.
-     * @return Newly portable builder.
-     */
-    public PortableBuilder builder(int typeId);
-
-    /**
-     * Creates new portable builder.
-     *
-     * @param typeName Type name.
-     * @return Newly portable builder.
-     */
-    public PortableBuilder builder(String typeName);
-
-    /**
-     * Creates portable builder initialized by existing portable object.
-     *
-     * @param portableObj Portable object to initialize builder.
-     * @return Portable builder.
-     */
-    public PortableBuilder builder(PortableObject portableObj);
-
-    /**
-     * Gets metadata for provided class.
-     *
-     * @param cls Class.
-     * @return Metadata.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public PortableMetadata metadata(Class<?> cls) throws PortableException;
-
-    /**
-     * Gets metadata for provided class name.
-     *
-     * @param typeName Type name.
-     * @return Metadata.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public PortableMetadata metadata(String typeName) throws PortableException;
-
-    /**
-     * Gets metadata for provided type ID.
-     *
-     * @param typeId Type ID.
-     * @return Metadata.
-     * @throws PortableException In case of error.
-     */
-    @Nullable public PortableMetadata metadata(int typeId) throws PortableException;
-
-    /**
-     * Gets metadata for all known types.
-     *
-     * @return Metadata.
-     * @throws PortableException In case of error.
-     */
-    public Collection<PortableMetadata> metadata() throws PortableException;
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 9fb56bc..7d1e14d 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -17,10 +17,24 @@
 
 package org.apache.ignite.configuration;
 
+import java.io.Serializable;
+import java.util.Collection;
+import javax.cache.Cache;
+import javax.cache.configuration.CompleteConfiguration;
+import javax.cache.configuration.Factory;
+import javax.cache.configuration.MutableConfiguration;
+import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.CacheAtomicWriteOrderMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.cache.CacheInterceptor;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.cache.affinity.AffinityFunction;
 import org.apache.ignite.cache.affinity.AffinityKeyMapper;
 import org.apache.ignite.cache.eviction.EvictionFilter;
@@ -36,15 +50,6 @@ import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.plugin.CachePluginConfiguration;
 import org.jetbrains.annotations.Nullable;
 
-import javax.cache.Cache;
-import javax.cache.CacheException;
-import javax.cache.configuration.CompleteConfiguration;
-import javax.cache.configuration.Factory;
-import javax.cache.configuration.MutableConfiguration;
-import javax.cache.expiry.ExpiryPolicy;
-import java.io.Serializable;
-import java.util.Collection;
-
 /**
  * This class defines grid cache configuration. This configuration is passed to
  * grid via {@link IgniteConfiguration#getCacheConfiguration()} method. It defines all configuration
@@ -163,10 +168,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Default size for onheap SQL row cache size. */
     public static final int DFLT_SQL_ONHEAP_ROW_CACHE_SIZE = 10 * 1024;
 
-    /** Default value for keep portable in store behavior .*/
-    @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"})
-    public static final Boolean DFLT_KEEP_PORTABLE_IN_STORE  = new Boolean(true);
-
     /** Cache name. */
     private String name;
 
@@ -219,9 +220,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     private Factory storeFactory;
 
     /** */
-    private Boolean keepPortableInStore = DFLT_KEEP_PORTABLE_IN_STORE;
-
-    /** */
     private boolean loadPrevVal = DFLT_LOAD_PREV_VAL;
 
     /** Node group resolver. */
@@ -383,8 +381,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         invalidate = cc.isInvalidate();
         isReadThrough = cc.isReadThrough();
         isWriteThrough = cc.isWriteThrough();
-        keepPortableInStore = cc.isKeepPortableInStore() != null ? cc.isKeepPortableInStore() :
-            DFLT_KEEP_PORTABLE_IN_STORE;
         listenerConfigurations = cc.listenerConfigurations;
         loadPrevVal = cc.isLoadPreviousValue();
         longQryWarnTimeout = cc.getLongQueryWarningTimeout();
@@ -825,38 +821,6 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     }
 
     /**
-     * Flag indicating that {@link CacheStore} implementation
-     * is working with portable objects instead of Java objects.
-     * Default value of this flag is {@link #DFLT_KEEP_PORTABLE_IN_STORE},
-     * because this is recommended behavior from performance standpoint.
-     * <p>
-     * If set to {@code false}, Ignite will deserialize keys and
-     * values stored in portable format before they are passed
-     * to cache store.
-     * <p>
-     * Note that setting this flag to {@code false} can simplify
-     * store implementation in some cases, but it can cause performance
-     * degradation due to additional serializations and deserializations
-     * of portable objects. You will also need to have key and value
-     * classes on all nodes since portables will be deserialized when
-     * store is called.
-     *
-     * @return Keep portables in store flag.
-     */
-    public Boolean isKeepPortableInStore() {
-        return keepPortableInStore;
-    }
-
-    /**
-     * Sets keep portables in store flag.
-     *
-     * @param keepPortableInStore Keep portables in store flag.
-     */
-    public void setKeepPortableInStore(boolean keepPortableInStore) {
-        this.keepPortableInStore = keepPortableInStore;
-    }
-
-    /**
      * Gets key topology resolver to provide mapping from keys to nodes.
      *
      * @return Key topology resolver to provide mapping from keys to nodes.
@@ -1860,4 +1824,4 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
             return obj.getClass().equals(this.getClass());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index e3859c5..9443f21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal;
 import java.util.Collection;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.cluster.IgniteClusterEx;
 import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
@@ -140,4 +141,12 @@ public interface IgniteEx extends Ignite {
      * @return Kernal context.
      */
     public GridKernalContext context();
+
+
+    /**
+     * Gets an instance of {@link IgnitePortables} interface.
+     *
+     * @return Instance of {@link IgnitePortables} interface.
+     */
+    public IgnitePortables portables();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 9b615b1..abab1f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -64,7 +64,7 @@ import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.IgniteLogger;
 import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
 import org.apache.ignite.IgniteQueue;
 import org.apache.ignite.IgniteScheduler;
 import org.apache.ignite.IgniteServices;
@@ -157,7 +157,7 @@ import org.apache.ignite.lifecycle.LifecycleBean;
 import org.apache.ignite.lifecycle.LifecycleEventType;
 import org.apache.ignite.marshaller.MarshallerExclusions;
 import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
 import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
 import org.apache.ignite.mxbean.IgniteMXBean;
 import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -203,7 +203,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
@@ -1270,9 +1269,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
         add(ATTR_USER_NAME, System.getProperty("user.name"));
         add(ATTR_GRID_NAME, gridName);
-        add(ATTR_PORTABLE_PROTO_VER, cfg.getMarshaller() instanceof PortableMarshaller ?
-            ((PortableMarshaller)cfg.getMarshaller()).getProtocolVersion().toString() :
-            PortableMarshaller.DFLT_PORTABLE_PROTO_VER.toString());
 
         add(ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
         add(ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 7be2af3..10b8df0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -135,13 +135,10 @@ public final class IgniteNodeAttributes {
     /** Node consistent id. */
     public static final String ATTR_NODE_CONSISTENT_ID = ATTR_PREFIX + ".consistent.id";
 
-    /** Portable protocol version. */
-    public static final String ATTR_PORTABLE_PROTO_VER = ATTR_PREFIX + ".portable.proto.ver";
-
     /**
      * Enforces singleton.
      */
     private IgniteNodeAttributes() {
         /* No-op. */
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index bc4f756..3a09b2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -125,7 +125,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
 import static org.apache.ignite.internal.IgniteVersionUtils.VER;
 import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.NOOP;
@@ -982,8 +981,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
         // Fetch local node attributes once.
         String locPreferIpV4 = locNode.attribute("java.net.preferIPv4Stack");
 
-        String locPortableProtoVer = locNode.attribute(ATTR_PORTABLE_PROTO_VER);
-
         Object locMode = locNode.attribute(ATTR_DEPLOYMENT_MODE);
 
         int locJvmMajVer = nodeJavaMajorVersion(locNode);
@@ -1033,13 +1030,6 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
                         ", rmtId8=" + U.id8(n.id()) + ", rmtPeerClassLoading=" + rmtP2pEnabled +
                         ", rmtAddrs=" + U.addressesAsString(n) + ']');
             }
-
-            String rmtPortableProtoVer = n.attribute(ATTR_PORTABLE_PROTO_VER);
-
-            // In order to support backward compatibility skip the check for nodes that don't have this attribute.
-            if (rmtPortableProtoVer != null && !F.eq(locPortableProtoVer, rmtPortableProtoVer))
-                throw new IgniteCheckedException("Remote node has portable protocol version different from local " +
-                    "[locVersion=" + locPortableProtoVer + ", rmtVersion=" + rmtPortableProtoVer + ']');
         }
 
         if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
index c7a9e6f..4bc8545 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.portable;
 
 import org.apache.ignite.internal.portable.streams.PortableInputStream;
 import org.apache.ignite.internal.portable.streams.PortableOutputStream;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
index a2b4b74..e1b7324 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
@@ -40,11 +40,11 @@ import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.MarshallerExclusions;
 import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
 import org.jetbrains.annotations.Nullable;
 
 import static java.lang.reflect.Modifier.isStatic;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 165ad9a..2ee96b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -60,16 +60,16 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.marshaller.MarshallerContext;
 import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
 import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfiguration;
 import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetPortableConfiguration;
 import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetPortableTypeConfiguration;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
index ae5fbf0..05e7f20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
@@ -27,9 +27,9 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
index e03d67f..fafafad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
@@ -17,8 +17,8 @@
 
 package org.apache.ignite.internal.portable;
 
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
 
 /**
  * Portable meta data handler.

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
index 1d26007..c0423eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
@@ -27,13 +27,13 @@ import java.util.Map;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
index fe4b628..229c90f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
@@ -23,9 +23,9 @@ import java.util.IdentityHashMap;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
 import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index 47ff1ab..cb81efe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -34,9 +34,9 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index ba8ee83..e788422 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -30,9 +30,9 @@ import org.apache.ignite.internal.util.GridUnsafe;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 import sun.misc.Unsafe;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
index e703f2f..e401142 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
@@ -17,8 +17,8 @@
 
 package org.apache.ignite.internal.portable;
 
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
index a59f157..43b7650 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.internal.portable;
 
 import org.apache.ignite.internal.portable.streams.PortableOutputStream;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
index 2d4a1c3..2537926 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 
 /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index 4ad125a..a101db5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -45,11 +45,11 @@ import org.apache.ignite.internal.util.GridEnumCache;
 import org.apache.ignite.internal.util.lang.GridMapEntry;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableReader;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 7259cc9..ccc1a5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListSet;
 import org.apache.ignite.internal.portable.builder.PortableLazyValue;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
index 3152c4b..1d5ca60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
@@ -18,12 +18,8 @@
 package org.apache.ignite.internal.portable;
 
 import java.io.IOException;
-import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Timestamp;
@@ -32,14 +28,13 @@ import java.util.Date;
 import java.util.IdentityHashMap;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.portable.streams.PortableHeapOutputStream;
 import org.apache.ignite.internal.portable.streams.PortableOutputStream;
 import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableWriter;
 import org.jetbrains.annotations.Nullable;
 
 import static java.nio.charset.StandardCharsets.UTF_8;

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
new file mode 100644
index 0000000..56f3768
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
@@ -0,0 +1,362 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import java.util.UUID;
+import org.apache.ignite.IgniteCache;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Defines portable objects functionality. With portable objects you are able to:
+ * <ul>
+ * <li>Seamlessly interoperate between Java, .NET, and C++.</li>
+ * <li>Make any object portable with zero code change to your existing code.</li>
+ * <li>Nest portable objects within each other.</li>
+ * <li>Automatically handle {@code circular} or {@code null} references.</li>
+ * <li>Automatically convert collections and maps between Java, .NET, and C++.</li>
+ * <li>
+ *      Optionally avoid deserialization of objects on the server side
+ *      (objects are stored in {@link PortableObject} format).
+ * </li>
+ * <li>Avoid need to have concrete class definitions on the server side.</li>
+ * <li>Dynamically change structure of the classes without having to restart the cluster.</li>
+ * <li>Index into portable objects for querying purposes.</li>
+ * </ul>
+ * <h1 class="header">Working With Portables Directly</h1>
+ * Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ * <p>
+ * To work with the portable format directly, user should create a special cache projection
+ * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
+ * <pre name=code class=java>
+ * IgniteCache&lt;PortableObject, PortableObject&gt; prj = cache.withKeepPortable();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use PortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.portables().toPortable(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ * </pre>
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ * <pre name=code class=java>
+ * IgniteCache&lt;MyKey.class, MyValue.class&gt; cache = grid.cache(null);
+ *
+ * MyValue val = cache.get(new MyKey());
+ *
+ * // Normal java getter.
+ * String fieldVal = val.getMyFieldName();
+ * </pre>
+ * If we used, for example, one of the automatically handled portable types for a key, like integer,
+ * and still wanted to work with binary portable format for values, then we would declare cache projection
+ * as follows:
+ * <pre name=code class=java>
+ * IgniteCache&lt;Integer.class, PortableObject&gt; prj = cache.withKeepPortable();
+ * </pre>
+ * <h1 class="header">Automatic Portable Types</h1>
+ * Note that only portable classes are converted to {@link PortableObject} format. Following
+ * classes are never converted (e.g., {@link #toPortable(Object)} method will return original
+ * object, and instances of these classes will be stored in cache without changes):
+ * <ul>
+ *     <li>All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)</li>
+ *     <li>Arrays of primitives (byte[], int[], ...)</li>
+ *     <li>{@link String} and array of {@link String}s</li>
+ *     <li>{@link UUID} and array of {@link UUID}s</li>
+ *     <li>{@link Date} and array of {@link Date}s</li>
+ *     <li>{@link Timestamp} and array of {@link Timestamp}s</li>
+ *     <li>Enums and array of enums</li>
+ *     <li>
+ *         Maps, collections and array of objects (but objects inside
+ *         them will still be converted if they are portable)
+ *     </li>
+ * </ul>
+ * <h1 class="header">Working With Maps and Collections</h1>
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ * <h1 class="header">Building Portable Objects</h1>
+ * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder();
+ *
+ * builder.typeId("MyObject");
+ *
+ * builder.stringField("fieldA", "A");
+ * build.intField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ * <pre name=code class=java>
+ * MyObject obj = new MyObject();
+ *
+ * obj.setFieldA("A");
+ * obj.setFieldB(123);
+ *
+ * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
+ * </pre>
+ * NOTE: you don't need to convert typed objects to portable format before storing
+ * them in cache, Ignite will do that automatically.
+ * <h1 class="header">Portable Metadata</h1>
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ * <h1 class="header">Dynamic Structure Changes</h1>
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ * <h1 class="header">Configuration</h1>
+ * By default all your objects are considered as portables and no specific configuration is needed.
+ * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
+ * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
+ * The only requirement Ignite imposes is that your object has an empty
+ * constructor. Note, that since server side does not have to know the class definition,
+ * you only need to list portable objects in configuration on the client side. However, if you
+ * list them on the server side as well, then you get the ability to deserialize portable objects
+ * into concrete types on the server as well as on the client.
+ * <p>
+ * Here is an example of portable configuration (note that star (*) notation is supported):
+ * <pre name=code class=xml>
+ * ...
+ * &lt;!-- Explicit portable objects configuration. --&gt;
+ * &lt;property name="marshaller"&gt;
+ *     &lt;bean class="org.apache.ignite.internal.portable.api.PortableMarshaller"&gt;
+ *         &lt;property name="classNames"&gt;
+ *             &lt;list&gt;
+ *                 &lt;value&gt;my.package.for.portable.objects.*&lt;/value&gt;
+ *                 &lt;value&gt;org.apache.ignite.examples.client.portable.Employee&lt;/value&gt;
+ *             &lt;/list&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ * &lt;/property&gt;
+ * ...
+ * </pre>
+ * or from code:
+ * <pre name=code class=java>
+ * IgniteConfiguration cfg = new IgniteConfiguration();
+ *
+ * PortableMarshaller marsh = new PortableMarshaller();
+ *
+ * marsh.setClassNames(Arrays.asList(
+ *     Employee.class.getName(),
+ *     Address.class.getName())
+ * );
+ *
+ * cfg.setMarshaller(marsh);
+ * </pre>
+ * You can also specify class name for a portable object via {@link PortableTypeConfiguration}.
+ * Do it in case if you need to override other configuration properties on per-type level, like
+ * ID-mapper, or serializer.
+ * <h1 class="header">Custom Affinity Keys</h1>
+ * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
+ * storing objects in cache. For example, if you are caching {@code Employee} object with
+ * {@code Organization}, and want to colocate employees with organization they work for,
+ * so you can process them together, you need to specify an alternate affinity key.
+ * With portable objects you would have to do it as following:
+ * <pre name=code class=xml>
+ * &lt;property name="marshaller"&gt;
+ *     &lt;bean class="org.gridgain.grid.marshaller.portable.PortableMarshaller"&gt;
+ *         ...
+ *         &lt;property name="typeConfigurations"&gt;
+ *             &lt;list&gt;
+ *                 &lt;bean class="org.apache.ignite.internal.portable.api.PortableTypeConfiguration"&gt;
+ *                     &lt;property name="className" value="org.apache.ignite.examples.client.portable.EmployeeKey"/&gt;
+ *                     &lt;property name="affinityKeyFieldName" value="organizationId"/&gt;
+ *                 &lt;/bean&gt;
+ *             &lt;/list&gt;
+ *         &lt;/property&gt;
+ *         ...
+ *     &lt;/bean&gt;
+ * &lt;/property&gt;
+ * </pre>
+ * <h1 class="header">Serialization</h1>
+ * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
+ * serialization logic by optionally implementing {@link PortableMarshalAware} interface, like so:
+ * <pre name=code class=java>
+ * public class Address implements PortableMarshalAware {
+ *     private String street;
+ *     private int zip;
+ *
+ *     // Empty constructor required for portable deserialization.
+ *     public Address() {}
+ *
+ *     &#64;Override public void writePortable(PortableWriter writer) throws PortableException {
+ *         writer.writeString("street", street);
+ *         writer.writeInt("zip", zip);
+ *     }
+ *
+ *     &#64;Override public void readPortable(PortableReader reader) throws PortableException {
+ *         street = reader.readString("street");
+ *         zip = reader.readInt("zip");
+ *     }
+ * }
+ * </pre>
+ * Alternatively, if you cannot change class definitions, you can provide custom serialization
+ * logic in {@link PortableSerializer} either globally in {@link PortableMarshaller} or
+ * for a specific type via {@link PortableTypeConfiguration} instance.
+ * <p>
+ * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
+ * <ul>
+ *     <li>
+ *         {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
+ *         It may be used to replace the de-serialized object by another one of your choice.
+ *     </li>
+ *     <li>
+ *          {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
+ *          allows the developer to provide a replacement object that will be serialized instead of the original one.
+ *     </li>
+ * </ul>
+ *
+ * <h1 class="header">Custom ID Mappers</h1>
+ * Ignite implementation uses name hash codes to generate IDs for class names or field names
+ * internally. However, in cases when you want to provide your own ID mapping schema,
+ * you can provide your own {@link PortableIdMapper} implementation.
+ * <p>
+ * ID-mapper may be provided either globally in {@link PortableMarshaller},
+ * or for a specific type via {@link PortableTypeConfiguration} instance.
+ * <h1 class="header">Query Indexing</h1>
+ * Portable objects can be indexed for querying by specifying index fields in
+ * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
+ * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
+ * like so:
+ * <pre name=code class=xml>
+ * ...
+ * &lt;bean class="org.apache.ignite.cache.CacheConfiguration"&gt;
+ *     ...
+ *     &lt;property name="typeMetadata"&gt;
+ *         &lt;list&gt;
+ *             &lt;bean class="CacheTypeMetadata"&gt;
+ *                 &lt;property name="type" value="Employee"/&gt;
+ *
+ *                 &lt;!-- Fields to index in ascending order. --&gt;
+ *                 &lt;property name="ascendingFields"&gt;
+ *                     &lt;map&gt;
+ *                     &lt;entry key="name" value="java.lang.String"/&gt;
+ *
+ *                         &lt;!-- Nested portable objects can also be indexed. --&gt;
+ *                         &lt;entry key="address.zip" value="java.lang.Integer"/&gt;
+ *                     &lt;/map&gt;
+ *                 &lt;/property&gt;
+ *             &lt;/bean&gt;
+ *         &lt;/list&gt;
+ *     &lt;/property&gt;
+ * &lt;/bean&gt;
+ * </pre>
+ */
+public interface IgnitePortables {
+    /**
+     * Gets type ID for given type name.
+     *
+     * @param typeName Type name.
+     * @return Type ID.
+     */
+    public int typeId(String typeName);
+
+    /**
+     * Converts provided object to instance of {@link PortableObject}.
+     *
+     * @param obj Object to convert.
+     * @return Converted object.
+     * @throws PortableException In case of error.
+     */
+    public <T> T toPortable(@Nullable Object obj) throws PortableException;
+
+    /**
+     * Creates new portable builder.
+     *
+     * @param typeId ID of the type.
+     * @return Newly portable builder.
+     */
+    public PortableBuilder builder(int typeId);
+
+    /**
+     * Creates new portable builder.
+     *
+     * @param typeName Type name.
+     * @return Newly portable builder.
+     */
+    public PortableBuilder builder(String typeName);
+
+    /**
+     * Creates portable builder initialized by existing portable object.
+     *
+     * @param portableObj Portable object to initialize builder.
+     * @return Portable builder.
+     */
+    public PortableBuilder builder(PortableObject portableObj);
+
+    /**
+     * Gets metadata for provided class.
+     *
+     * @param cls Class.
+     * @return Metadata.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public PortableMetadata metadata(Class<?> cls) throws PortableException;
+
+    /**
+     * Gets metadata for provided class name.
+     *
+     * @param typeName Type name.
+     * @return Metadata.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public PortableMetadata metadata(String typeName) throws PortableException;
+
+    /**
+     * Gets metadata for provided type ID.
+     *
+     * @param typeId Type ID.
+     * @return Metadata.
+     * @throws PortableException In case of error.
+     */
+    @Nullable public PortableMetadata metadata(int typeId) throws PortableException;
+
+    /**
+     * Gets metadata for all known types.
+     *
+     * @return Metadata.
+     * @throws PortableException In case of error.
+     */
+    public Collection<PortableMetadata> metadata() throws PortableException;
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
new file mode 100644
index 0000000..c819f46
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
+ * <p>
+ * Here is an example of how a portable object can be built dynamically:
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
+ *
+ * builder.setField("fieldA", "A");
+ * builder.setField("fieldB", "B");
+ *
+ * PortableObject portableObj = builder.build();
+ * </pre>
+ *
+ * <p>
+ * Also builder can be initialized by existing portable object. This allows changing some fields without affecting
+ * other fields.
+ * <pre name=code class=java>
+ * PortableBuilder builder = Ignition.ignite().portables().builder(person);
+ *
+ * builder.setField("name", "John");
+ *
+ * person = builder.build();
+ * </pre>
+ * </p>
+ *
+ * If you need to modify nested portable object you can get builder for nested object using
+ * {@link #getField(String)}, changes made on nested builder will affect parent object,
+ * for example:
+ *
+ * <pre name=code class=java>
+ * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
+ * PortableBuilder addressBuilder = personBuilder.setField("address");
+ *
+ * addressBuilder.setField("city", "New York");
+ *
+ * personPortableObj = personBuilder.build();
+ *
+ * // Should be "New York".
+ * String city = personPortableObj.getField("address").getField("city");
+ * </pre>
+ *
+ * @see IgnitePortables#builder(int)
+ * @see IgnitePortables#builder(String)
+ * @see IgnitePortables#builder(PortableObject)
+ */
+public interface PortableBuilder {
+    /**
+     * Returns value assigned to the specified field.
+     * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
+     * which can be modified.
+     * <p>
+     * Collections and maps returned from this method are modifiable.
+     *
+     * @param name Field name.
+     * @return Filed value.
+     */
+    public <T> T getField(String name);
+
+    /**
+     * Sets field value.
+     *
+     * @param name Field name.
+     * @param val Field value (cannot be {@code null}).
+     * @see PortableObject#metaData()
+     */
+    public PortableBuilder setField(String name, Object val);
+
+    /**
+     * Sets field value with value type specification.
+     * <p>
+     * Field type is needed for proper metadata update.
+     *
+     * @param name Field name.
+     * @param val Field value.
+     * @param type Field type.
+     * @see PortableObject#metaData()
+     */
+    public <T> PortableBuilder setField(String name, @Nullable T val, Class<? super T> type);
+
+    /**
+     * Sets field value.
+     * <p>
+     * This method should be used if field is portable object.
+     *
+     * @param name Field name.
+     * @param builder Builder for object field.
+     */
+    public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
+
+    /**
+     * Removes field from this builder.
+     *
+     * @param fieldName Field name.
+     * @return {@code this} instance for chaining.
+     */
+    public PortableBuilder removeField(String fieldName);
+
+    /**
+     * Sets hash code for resulting portable object returned by {@link #build()} method.
+     * <p>
+     * If not set {@code 0} is used.
+     *
+     * @param hashCode Hash code.
+     * @return {@code this} instance for chaining.
+     */
+    public PortableBuilder hashCode(int hashCode);
+
+    /**
+     * Builds portable object.
+     *
+     * @return Portable object.
+     * @throws PortableException In case of error.
+     */
+    public PortableObject build() throws PortableException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
new file mode 100644
index 0000000..f230182
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import org.apache.ignite.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating portable object serialization error.
+ */
+public class PortableException extends IgniteException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Creates portable exception with error message.
+     *
+     * @param msg Error message.
+     */
+    public PortableException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Creates portable exception with {@link Throwable} as a cause.
+     *
+     * @param cause Cause.
+     */
+    public PortableException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Creates portable exception with error message and {@link Throwable} as a cause.
+     *
+     * @param msg Error message.
+     * @param cause Cause.
+     */
+    public PortableException(String msg, @Nullable Throwable cause) {
+        super(msg, cause);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
new file mode 100644
index 0000000..1e20f8e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+/**
+ * Type and field ID mapper for portable objects. Ignite never writes full
+ * strings for field or type names. Instead, for performance reasons, Ignite
+ * writes integer hash codes for type and field names. It has been tested that
+ * hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide {@code PortableIdMapper} allows to override the automatically
+ * generated hash code IDs for the type and field names.
+ * <p>
+ * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
+ * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
+ */
+public interface PortableIdMapper {
+    /**
+     * Gets type ID for provided class name.
+     * <p>
+     * If {@code 0} is returned, hash code of class simple name will be used.
+     *
+     * @param clsName Class name.
+     * @return Type ID.
+     */
+    public int typeId(String clsName);
+
+    /**
+     * Gets ID for provided field.
+     * <p>
+     * If {@code 0} is returned, hash code of field name will be used.
+     *
+     * @param typeId Type ID.
+     * @param fieldName Field name.
+     * @return Field ID.
+     */
+    public int fieldId(int typeId, String fieldName);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
new file mode 100644
index 0000000..82e6697
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating that class needed for deserialization of portable object does not exist.
+ * <p>
+ * Thrown from {@link PortableObject#deserialize()} method.
+ */
+public class PortableInvalidClassException extends PortableException {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Creates invalid class exception with error message.
+     *
+     * @param msg Error message.
+     */
+    public PortableInvalidClassException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Creates invalid class exception with {@link Throwable} as a cause.
+     *
+     * @param cause Cause.
+     */
+    public PortableInvalidClassException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Creates invalid class exception with error message and {@link Throwable} as a cause.
+     *
+     * @param msg Error message.
+     * @param cause Cause.
+     */
+    public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
+        super(msg, cause);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
new file mode 100644
index 0000000..f304afb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable.api;
+
+/**
+ * Interface that allows to implement custom serialization
+ * logic for portable objects. Portable objects are not required
+ * to implement this interface, in which case Ignite will automatically
+ * serialize portable objects using reflection.
+ * <p>
+ * This interface, in a way, is analogous to {@link java.io.Externalizable}
+ * interface, which allows users to override default serialization logic,
+ * usually for performance reasons. The only difference here is that portable
+ * serialization is already very fast and implementing custom serialization
+ * logic for portables does not provide significant performance gains.
+ */
+public interface PortableMarshalAware {
+    /**
+     * Writes fields to provided writer.
+     *
+     * @param writer Portable object writer.
+     * @throws PortableException In case of error.
+     */
+    public void writePortable(PortableWriter writer) throws PortableException;
+
+    /**
+     * Reads fields from provided reader.
+     *
+     * @param reader Portable object reader.
+     * @throws PortableException In case of error.
+     */
+    public void readPortable(PortableReader reader) throws PortableException;
+}
\ No newline at end of file


[18/41] ignite git commit: ignite-1250 JDBC driver: migration to embedded Ignite client node

Posted by ag...@apache.org.
ignite-1250 JDBC driver: migration to embedded Ignite client node

Signed-off-by: Valentin Kulichenko <va...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ebb9e2e9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ebb9e2e9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ebb9e2e9

Branch: refs/heads/ignite-1400
Commit: ebb9e2e9d3e05ba65c06ec301bee040b3a74fd3b
Parents: 1ff4a52
Author: Andrey Gura <ag...@gridgain.com>
Authored: Fri Sep 11 18:32:54 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Fri Sep 11 18:32:54 2015 -0700

----------------------------------------------------------------------
 modules/clients/pom.xml                         |    7 +
 modules/clients/src/test/config/jdbc-config.xml |   55 +
 .../jdbc2/JdbcComplexQuerySelfTest.java         |  316 ++++
 .../internal/jdbc2/JdbcConnectionSelfTest.java  |  268 +++
 .../internal/jdbc2/JdbcEmptyCacheSelfTest.java  |  140 ++
 .../internal/jdbc2/JdbcLocalCachesSelfTest.java |  156 ++
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |  334 ++++
 .../jdbc2/JdbcPreparedStatementSelfTest.java    |  730 +++++++++
 .../internal/jdbc2/JdbcResultSetSelfTest.java   |  751 +++++++++
 .../internal/jdbc2/JdbcStatementSelfTest.java   |  292 ++++
 .../jdbc/suite/IgniteJdbcDriverTestSuite.java   |   11 +
 .../org/apache/ignite/IgniteJdbcDriver.java     |  281 +++-
 .../apache/ignite/IgniteSystemProperties.java   |    5 +-
 .../ignite/internal/jdbc/JdbcConnection.java    |    4 +
 .../internal/jdbc/JdbcConnectionInfo.java       |   91 --
 .../internal/jdbc/JdbcDatabaseMetadata.java     |    4 +
 .../internal/jdbc/JdbcPreparedStatement.java    |    4 +
 .../ignite/internal/jdbc/JdbcResultSet.java     |    4 +
 .../internal/jdbc/JdbcResultSetMetadata.java    |    4 +
 .../ignite/internal/jdbc/JdbcStatement.java     |    4 +
 .../apache/ignite/internal/jdbc/JdbcUtils.java  |    4 +
 .../ignite/internal/jdbc2/JdbcConnection.java   |  777 +++++++++
 .../internal/jdbc2/JdbcDatabaseMetadata.java    | 1401 ++++++++++++++++
 .../internal/jdbc2/JdbcPreparedStatement.java   |  411 +++++
 .../ignite/internal/jdbc2/JdbcQueryTask.java    |  361 +++++
 .../ignite/internal/jdbc2/JdbcResultSet.java    | 1520 ++++++++++++++++++
 .../internal/jdbc2/JdbcResultSetMetadata.java   |  171 ++
 .../ignite/internal/jdbc2/JdbcStatement.java    |  456 ++++++
 .../apache/ignite/internal/jdbc2/JdbcUtils.java |  155 ++
 .../resources/META-INF/classnames.properties    |   12 +-
 .../yardstick/config/benchmark-query.properties |    5 +-
 modules/yardstick/config/ignite-base-config.xml |    2 +-
 modules/yardstick/config/ignite-jdbc-config.xml |   55 +
 33 files changed, 8606 insertions(+), 185 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/pom.xml
----------------------------------------------------------------------
diff --git a/modules/clients/pom.xml b/modules/clients/pom.xml
index 61f6694..6e690dc 100644
--- a/modules/clients/pom.xml
+++ b/modules/clients/pom.xml
@@ -56,6 +56,13 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-indexing</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/config/jdbc-config.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/config/jdbc-config.xml b/modules/clients/src/test/config/jdbc-config.xml
new file mode 100644
index 0000000..980eaf1
--- /dev/null
+++ b/modules/clients/src/test/config/jdbc-config.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+    Ignite Spring configuration file.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="clientMode" value="true"/>
+
+        <property name="localHost" value="127.0.0.1"/>
+
+        <property name="marshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
+                <property name="requireSerializable" value="false"/>
+            </bean>
+        </property>
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47549</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+
+        <property name="peerClassLoadingEnabled" value="true"/>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
new file mode 100644
index 0000000..d126d34
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.sql.*;
+
+import static org.apache.ignite.IgniteJdbcDriver.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Tests for complex queries (joins, etc.).
+ */
+public class JdbcComplexQuerySelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** JDBC URL. */
+    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+
+    /** Statement. */
+    private Statement stmt;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration<?,?> cache = defaultCacheConfiguration();
+
+        cache.setCacheMode(PARTITIONED);
+        cache.setBackups(1);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setAtomicityMode(TRANSACTIONAL);
+        cache.setIndexedTypes(String.class, Organization.class, AffinityKey.class, Person.class);
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrids(3);
+
+        IgniteCache<String, Organization> orgCache = grid(0).cache(null);
+
+        assert orgCache != null;
+
+        orgCache.put("o1", new Organization(1, "A"));
+        orgCache.put("o2", new Organization(2, "B"));
+
+        IgniteCache<AffinityKey<String>, Person> personCache = grid(0).cache(null);
+
+        assert personCache != null;
+
+        personCache.put(new AffinityKey<>("p1", "o1"), new Person(1, "John White", 25, 1));
+        personCache.put(new AffinityKey<>("p2", "o1"), new Person(2, "Joe Black", 35, 1));
+        personCache.put(new AffinityKey<>("p3", "o2"), new Person(3, "Mike Green", 40, 2));
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stmt = DriverManager.getConnection(BASE_URL).createStatement();
+
+        assert stmt != null;
+        assert !stmt.isClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        if (stmt != null) {
+            stmt.getConnection().close();
+            stmt.close();
+
+            assert stmt.isClosed();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoin() throws Exception {
+        ResultSet rs = stmt.executeQuery(
+            "select p.id, p.name, o.name as orgName from Person p, Organization o where p.orgId = o.id");
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            int id = rs.getInt("id");
+
+            if (id == 1) {
+                assert "John White".equals(rs.getString("name"));
+                assert "A".equals(rs.getString("orgName"));
+            }
+            else if (id == 2) {
+                assert "Joe Black".equals(rs.getString("name"));
+                assert "A".equals(rs.getString("orgName"));
+            }
+            else if (id == 3) {
+                assert "Mike Green".equals(rs.getString("name"));
+                assert "B".equals(rs.getString("orgName"));
+            }
+            else
+                assert false : "Wrong ID: " + id;
+
+            cnt++;
+        }
+
+        assert cnt == 3;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinWithoutAlias() throws Exception {
+        ResultSet rs = stmt.executeQuery(
+            "select p.id, p.name, o.name from Person p, Organization o where p.orgId = o.id");
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            int id = rs.getInt(1);
+
+            if (id == 1) {
+                assert "John White".equals(rs.getString("name"));
+                assert "John White".equals(rs.getString(2));
+                assert "A".equals(rs.getString(3));
+            }
+            else if (id == 2) {
+                assert "Joe Black".equals(rs.getString("name"));
+                assert "Joe Black".equals(rs.getString(2));
+                assert "A".equals(rs.getString(3));
+            }
+            else if (id == 3) {
+                assert "Mike Green".equals(rs.getString("name"));
+                assert "Mike Green".equals(rs.getString(2));
+                assert "B".equals(rs.getString(3));
+            }
+            else
+                assert false : "Wrong ID: " + id;
+
+            cnt++;
+        }
+
+        assert cnt == 3;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIn() throws Exception {
+        ResultSet rs = stmt.executeQuery("select name from Person where age in (25, 35)");
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            assert "John White".equals(rs.getString("name")) ||
+                "Joe Black".equals(rs.getString("name"));
+
+            cnt++;
+        }
+
+        assert cnt == 2;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBetween() throws Exception {
+        ResultSet rs = stmt.executeQuery("select name from Person where age between 24 and 36");
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            assert "John White".equals(rs.getString("name")) ||
+                "Joe Black".equals(rs.getString("name"));
+
+            cnt++;
+        }
+
+        assert cnt == 2;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCalculatedValue() throws Exception {
+        ResultSet rs = stmt.executeQuery("select age * 2 from Person");
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            assert rs.getInt(1) == 50 ||
+                rs.getInt(1) == 70 ||
+                rs.getInt(1) == 80;
+
+            cnt++;
+        }
+
+        assert cnt == 3;
+    }
+
+    /**
+     * Person.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class Person implements Serializable {
+        /** ID. */
+        @QuerySqlField
+        private final int id;
+
+        /** Name. */
+        @QuerySqlField(index = false)
+        private final String name;
+
+        /** Age. */
+        @QuerySqlField
+        private final int age;
+
+        /** Organization ID. */
+        @QuerySqlField
+        private final int orgId;
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         * @param age Age.
+         * @param orgId Organization ID.
+         */
+        private Person(int id, String name, int age, int orgId) {
+            assert !F.isEmpty(name);
+            assert age > 0;
+            assert orgId > 0;
+
+            this.id = id;
+            this.name = name;
+            this.age = age;
+            this.orgId = orgId;
+        }
+    }
+
+    /**
+     * Organization.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class Organization implements Serializable {
+        /** ID. */
+        @QuerySqlField
+        private final int id;
+
+        /** Name. */
+        @QuerySqlField(index = false)
+        private final String name;
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         */
+        private Organization(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
new file mode 100644
index 0000000..951890e
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
+
+/**
+ * Connection test.
+ */
+public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Custom cache name. */
+    private static final String CUSTOM_CACHE_NAME = "custom-cache";
+
+    /** Ignite configuration URL. */
+    private static final String CFG_URL = "modules/clients/src/test/config/jdbc-config.xml";
+
+    /** Grid count. */
+    private static final int GRID_CNT = 2;
+
+    /** Daemon node flag. */
+    private boolean daemon;
+
+    /** Client node flag. */
+    private boolean client;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CUSTOM_CACHE_NAME));
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setDaemon(daemon);
+
+        cfg.setClientMode(client);
+
+        return cfg;
+    }
+
+    /**
+     * @param name Cache name.
+     * @return Cache configuration.
+     * @throws Exception In case of error.
+     */
+    private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+        CacheConfiguration cfg = defaultCacheConfiguration();
+
+        cfg.setName(name);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(GRID_CNT);
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDefaults() throws Exception {
+        String url = CFG_URL_PREFIX + CFG_URL;
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            assertNotNull(conn);
+        }
+
+        try (Connection conn = DriverManager.getConnection(url + '/')) {
+            assertNotNull(conn);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNodeId() throws Exception {
+        String url = CFG_URL_PREFIX + "nodeId=" + grid(0).localNode().id() + '@' + CFG_URL;
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            assertNotNull(conn);
+        }
+
+        url = CFG_URL_PREFIX + "cache=" + CUSTOM_CACHE_NAME + ":nodeId=" + grid(0).localNode().id() + '@' + CFG_URL;
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            assertNotNull(conn);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testWrongNodeId() throws Exception {
+        UUID wrongId = UUID.randomUUID();
+
+        final String url = CFG_URL_PREFIX + "nodeId=" + wrongId + '@' + CFG_URL;
+
+        GridTestUtils.assertThrows(
+                log,
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        try (Connection conn = DriverManager.getConnection(url)) {
+                            return conn;
+                        }
+                    }
+                },
+                SQLException.class,
+                "Failed to establish connection with node (is it a server node?): " + wrongId
+        );
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClientNodeId() throws Exception {
+        client = true;
+
+        IgniteEx client = (IgniteEx)startGrid();
+
+        UUID clientId = client.localNode().id();
+
+        final String url = CFG_URL_PREFIX + "nodeId=" + clientId + '@' + CFG_URL;
+
+        GridTestUtils.assertThrows(
+                log,
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        try (Connection conn = DriverManager.getConnection(url)) {
+                            return conn;
+                        }
+                    }
+                },
+                SQLException.class,
+                "Failed to establish connection with node (is it a server node?): " + clientId
+        );
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDaemonNodeId() throws Exception {
+        daemon = true;
+
+        IgniteEx daemon = startGrid(GRID_CNT);
+
+        UUID daemonId = daemon.localNode().id();
+
+        final String url = CFG_URL_PREFIX + "nodeId=" + daemonId + '@' + CFG_URL;
+
+        GridTestUtils.assertThrows(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    try (Connection conn = DriverManager.getConnection(url)) {
+                        return conn;
+                    }
+                }
+            },
+            SQLException.class,
+            "Failed to establish connection with node (is it a server node?): " + daemonId
+        );
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCustomCache() throws Exception {
+        String url = CFG_URL_PREFIX + "cache=" + CUSTOM_CACHE_NAME + '@' + CFG_URL;
+
+        try (Connection conn = DriverManager.getConnection(url)) {
+            assertNotNull(conn);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testWrongCache() throws Exception {
+        final String url = CFG_URL_PREFIX + "cache=wrongCacheName@" + CFG_URL;
+
+        GridTestUtils.assertThrows(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    try (Connection conn = DriverManager.getConnection(url)) {
+                        return conn;
+                    }
+                }
+            },
+            SQLException.class,
+            "Client is invalid. Probably cache name is wrong."
+        );
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClose() throws Exception {
+        String url = CFG_URL_PREFIX + CFG_URL;
+
+        try(final Connection conn = DriverManager.getConnection(url)) {
+            assertNotNull(conn);
+            assertFalse(conn.isClosed());
+
+            conn.close();
+
+            assertTrue(conn.isClosed());
+
+            GridTestUtils.assertThrows(
+                log,
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        conn.isValid(2);
+
+                        return null;
+                    }
+                },
+                SQLException.class,
+                "Connection is closed."
+            );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcEmptyCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcEmptyCacheSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcEmptyCacheSelfTest.java
new file mode 100644
index 0000000..adf1368
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcEmptyCacheSelfTest.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.sql.*;
+
+import static org.apache.ignite.IgniteJdbcDriver.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Tests for empty cache.
+ */
+public class JdbcEmptyCacheSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "cache";
+
+    /** JDBC URL. */
+    private static final String BASE_URL =
+        CFG_URL_PREFIX + "cache=" + CACHE_NAME + "@modules/clients/src/test/config/jdbc-config.xml";
+
+    /** Statement. */
+    private Statement stmt;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration cache = defaultCacheConfiguration();
+
+        cache.setName(CACHE_NAME);
+        cache.setCacheMode(PARTITIONED);
+        cache.setBackups(1);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setIndexedTypes(
+            Byte.class, Byte.class
+        );
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid();
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stmt = DriverManager.getConnection(BASE_URL).createStatement();
+
+        assert stmt != null;
+        assert !stmt.isClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        if (stmt != null) {
+            stmt.getConnection().close();
+            stmt.close();
+
+            assert stmt.isClosed();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSelectNumber() throws Exception {
+        ResultSet rs = stmt.executeQuery("select 1");
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            assert rs.getInt(1) == 1;
+            assert "1".equals(rs.getString(1));
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSelectString() throws Exception {
+        ResultSet rs = stmt.executeQuery("select 'str'");
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            assertEquals("str", rs.getString(1));
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcLocalCachesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcLocalCachesSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcLocalCachesSelfTest.java
new file mode 100644
index 0000000..a8988f9
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcLocalCachesSelfTest.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.sql.*;
+import java.util.*;
+
+import static org.apache.ignite.IgniteJdbcDriver.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Test JDBC with several local caches.
+ */
+public class JdbcLocalCachesSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Cache name. */
+    private static final String CACHE_NAME = "cache";
+
+    /** JDBC URL. */
+    private static final String BASE_URL =
+        CFG_URL_PREFIX + "cache=" + CACHE_NAME + "@modules/clients/src/test/config/jdbc-config.xml";
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration cache = defaultCacheConfiguration();
+
+        cache.setName(CACHE_NAME);
+        cache.setCacheMode(LOCAL);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setIndexedTypes(
+            String.class, Integer.class
+        );
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(2);
+
+        IgniteCache<Object, Object> cache1 = grid(0).cache(CACHE_NAME);
+
+        assert cache1 != null;
+
+        cache1.put("key1", 1);
+        cache1.put("key2", 2);
+
+        IgniteCache<Object, Object> cache2 = grid(1).cache(CACHE_NAME);
+
+        assert cache2 != null;
+
+        cache2.put("key1", 3);
+        cache2.put("key2", 4);
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCache1() throws Exception {
+        Properties cfg = new Properties();
+
+        cfg.setProperty(PROP_NODE_ID, grid(0).localNode().id().toString());
+
+        Connection conn = null;
+
+        try {
+            conn = DriverManager.getConnection(BASE_URL, cfg);
+
+            ResultSet rs = conn.createStatement().executeQuery("select _val from Integer order by _val");
+
+            int cnt = 0;
+
+            while (rs.next())
+                assertEquals(++cnt, rs.getInt(1));
+
+            assertEquals(2, cnt);
+        }
+        finally {
+            if (conn != null)
+                conn.close();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCache2() throws Exception {
+        Properties cfg = new Properties();
+
+        cfg.setProperty(PROP_NODE_ID, grid(1).localNode().id().toString());
+
+        Connection conn = null;
+
+        try {
+            conn = DriverManager.getConnection(BASE_URL, cfg);
+
+            ResultSet rs = conn.createStatement().executeQuery("select _val from Integer order by _val");
+
+            int cnt = 0;
+
+            while (rs.next())
+                assertEquals(++cnt + 2, rs.getInt(1));
+
+            assertEquals(2, cnt);
+        }
+        finally {
+            if (conn != null)
+                conn.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
new file mode 100644
index 0000000..f601dbc
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -0,0 +1,334 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+
+import static java.sql.Types.*;
+import static org.apache.ignite.IgniteJdbcDriver.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Metadata tests.
+ */
+public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** JDBC URL. */
+    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration<?,?> cache = defaultCacheConfiguration();
+
+        cache.setCacheMode(PARTITIONED);
+        cache.setBackups(1);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setIndexedTypes(String.class, Organization.class, AffinityKey.class, Person.class);
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(3);
+
+        IgniteCache<String, Organization> orgCache = grid(0).cache(null);
+
+        orgCache.put("o1", new Organization(1, "A"));
+        orgCache.put("o2", new Organization(2, "B"));
+
+        IgniteCache<AffinityKey<String>, Person> personCache = grid(0).cache(null);
+
+        personCache.put(new AffinityKey<>("p1", "o1"), new Person("John White", 25, 1));
+        personCache.put(new AffinityKey<>("p2", "o1"), new Person("Joe Black", 35, 1));
+        personCache.put(new AffinityKey<>("p3", "o2"), new Person("Mike Green", 40, 2));
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testResultSetMetaData() throws Exception {
+        try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+            Statement stmt = conn.createStatement();
+
+            ResultSet rs = stmt.executeQuery(
+                "select p.name, o.id as orgId from Person p, Organization o where p.orgId = o.id");
+
+            assertNotNull(rs);
+
+            ResultSetMetaData meta = rs.getMetaData();
+
+            assertNotNull(meta);
+
+            assertEquals(2, meta.getColumnCount());
+
+            assertTrue("Person".equalsIgnoreCase(meta.getTableName(1)));
+            assertTrue("name".equalsIgnoreCase(meta.getColumnName(1)));
+            assertTrue("name".equalsIgnoreCase(meta.getColumnLabel(1)));
+            assertEquals(VARCHAR, meta.getColumnType(1));
+            assertEquals("VARCHAR", meta.getColumnTypeName(1));
+            assertEquals("java.lang.String", meta.getColumnClassName(1));
+
+            assertTrue("Organization".equalsIgnoreCase(meta.getTableName(2)));
+            assertTrue("orgId".equalsIgnoreCase(meta.getColumnName(2)));
+            assertTrue("orgId".equalsIgnoreCase(meta.getColumnLabel(2)));
+            assertEquals(INTEGER, meta.getColumnType(2));
+            assertEquals("INTEGER", meta.getColumnTypeName(2));
+            assertEquals("java.lang.Integer", meta.getColumnClassName(2));
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetTables() throws Exception {
+        try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+            DatabaseMetaData meta = conn.getMetaData();
+
+            Collection<String> names = new ArrayList<>(2);
+
+            names.add("PERSON");
+            names.add("ORGANIZATION");
+
+            ResultSet rs = meta.getTables("", "PUBLIC", "%", new String[]{"TABLE"});
+
+            assertNotNull(rs);
+
+            int cnt = 0;
+
+            while (rs.next()) {
+                assertEquals("TABLE", rs.getString("TABLE_TYPE"));
+                assertTrue(names.remove(rs.getString("TABLE_NAME")));
+
+                cnt++;
+            }
+
+            assertTrue(names.isEmpty());
+            assertEquals(2, cnt);
+
+            names.add("PERSON");
+            names.add("ORGANIZATION");
+
+            rs = meta.getTables("", "PUBLIC", "%", null);
+
+            assertNotNull(rs);
+
+            cnt = 0;
+
+            while (rs.next()) {
+                assertEquals("TABLE", rs.getString("TABLE_TYPE"));
+                assertTrue(names.remove(rs.getString("TABLE_NAME")));
+
+                cnt++;
+            }
+
+            assertTrue(names.isEmpty());
+            assertEquals(2, cnt);
+
+            rs = meta.getTables("", "PUBLIC", "", new String[]{"WRONG"});
+
+            assertFalse(rs.next());
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetColumns() throws Exception {
+        try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+            DatabaseMetaData meta = conn.getMetaData();
+
+            ResultSet rs = meta.getColumns("", "PUBLIC", "Person", "%");
+
+            assertNotNull(rs);
+
+            Collection<String> names = new ArrayList<>(2);
+
+            names.add("NAME");
+            names.add("AGE");
+            names.add("ORGID");
+            names.add("_KEY");
+            names.add("_VAL");
+
+            int cnt = 0;
+
+            while (rs.next()) {
+                String name = rs.getString("COLUMN_NAME");
+
+                assertTrue(names.remove(name));
+
+                if ("NAME".equals(name)) {
+                    assertEquals(VARCHAR, rs.getInt("DATA_TYPE"));
+                    assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
+                    assertEquals(1, rs.getInt("NULLABLE"));
+                } else if ("AGE".equals(name) || "ORGID".equals(name)) {
+                    assertEquals(INTEGER, rs.getInt("DATA_TYPE"));
+                    assertEquals("INTEGER", rs.getString("TYPE_NAME"));
+                    assertEquals(0, rs.getInt("NULLABLE"));
+                }
+                if ("_KEY".equals(name)) {
+                    assertEquals(OTHER, rs.getInt("DATA_TYPE"));
+                    assertEquals("OTHER", rs.getString("TYPE_NAME"));
+                    assertEquals(0, rs.getInt("NULLABLE"));
+                }
+                if ("_VAL".equals(name)) {
+                    assertEquals(OTHER, rs.getInt("DATA_TYPE"));
+                    assertEquals("OTHER", rs.getString("TYPE_NAME"));
+                    assertEquals(0, rs.getInt("NULLABLE"));
+                }
+
+                cnt++;
+            }
+
+            assertTrue(names.isEmpty());
+            assertEquals(5, cnt);
+
+            rs = meta.getColumns("", "PUBLIC", "Organization", "%");
+
+            assertNotNull(rs);
+
+            names.add("ID");
+            names.add("NAME");
+            names.add("_KEY");
+            names.add("_VAL");
+
+            cnt = 0;
+
+            while (rs.next()) {
+                String name = rs.getString("COLUMN_NAME");
+
+                assertTrue(names.remove(name));
+
+                if ("id".equals(name)) {
+                    assertEquals(INTEGER, rs.getInt("DATA_TYPE"));
+                    assertEquals("INTEGER", rs.getString("TYPE_NAME"));
+                    assertEquals(0, rs.getInt("NULLABLE"));
+                } else if ("name".equals(name)) {
+                    assertEquals(VARCHAR, rs.getInt("DATA_TYPE"));
+                    assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
+                    assertEquals(1, rs.getInt("NULLABLE"));
+                }
+                if ("_KEY".equals(name)) {
+                    assertEquals(VARCHAR, rs.getInt("DATA_TYPE"));
+                    assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
+                    assertEquals(0, rs.getInt("NULLABLE"));
+                }
+                if ("_VAL".equals(name)) {
+                    assertEquals(OTHER, rs.getInt("DATA_TYPE"));
+                    assertEquals("OTHER", rs.getString("TYPE_NAME"));
+                    assertEquals(0, rs.getInt("NULLABLE"));
+                }
+
+                cnt++;
+            }
+
+            assertTrue(names.isEmpty());
+            assertEquals(4, cnt);
+        }
+    }
+
+    /**
+     * Person.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class Person implements Serializable {
+        /** Name. */
+        @QuerySqlField(index = false)
+        private final String name;
+
+        /** Age. */
+        @QuerySqlField
+        private final int age;
+
+        /** Organization ID. */
+        @QuerySqlField
+        private final int orgId;
+
+        /**
+         * @param name Name.
+         * @param age Age.
+         * @param orgId Organization ID.
+         */
+        private Person(String name, int age, int orgId) {
+            assert !F.isEmpty(name);
+            assert age > 0;
+            assert orgId > 0;
+
+            this.name = name;
+            this.age = age;
+            this.orgId = orgId;
+        }
+    }
+
+    /**
+     * Organization.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class Organization implements Serializable {
+        /** ID. */
+        @QuerySqlField
+        private final int id;
+
+        /** Name. */
+        @QuerySqlField(index = false)
+        private final String name;
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         */
+        private Organization(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
new file mode 100644
index 0000000..ea586b2
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
@@ -0,0 +1,730 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.annotations.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.math.*;
+import java.net.*;
+import java.sql.*;
+import java.util.Date;
+
+import static java.sql.Types.*;
+import static org.apache.ignite.IgniteJdbcDriver.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ * Prepared statement test.
+ */
+public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** JDBC URL. */
+    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+
+    /** Connection. */
+    private Connection conn;
+
+    /** Statement. */
+    private PreparedStatement stmt;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration<?,?> cache = defaultCacheConfiguration();
+
+        cache.setCacheMode(PARTITIONED);
+        cache.setBackups(1);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setIndexedTypes(
+            Integer.class, TestObject.class
+        );
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(3);
+
+        IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+
+        assert cache != null;
+
+        TestObject o = new TestObject(1);
+
+        o.boolVal = true;
+        o.byteVal = 1;
+        o.shortVal = 1;
+        o.intVal = 1;
+        o.longVal = 1L;
+        o.floatVal = 1.0f;
+        o.doubleVal = 1.0d;
+        o.bigVal = new BigDecimal(1);
+        o.strVal = "str";
+        o.arrVal = new byte[] {1};
+        o.dateVal = new Date(1);
+        o.timeVal = new Time(1);
+        o.tsVal = new Timestamp(1);
+        o.urlVal = new URL("http://abc.com/");
+
+        cache.put(1, o);
+        cache.put(2, new TestObject(2));
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        conn = DriverManager.getConnection(BASE_URL);
+
+        assert conn != null;
+        assert !conn.isClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        if (stmt != null) {
+            stmt.close();
+
+            assert stmt.isClosed();
+        }
+
+        if (conn != null) {
+            conn.close();
+
+            assert conn.isClosed();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBoolean() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where boolVal is not distinct from ?");
+
+        stmt.setBoolean(1, true);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, BOOLEAN);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testByte() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where byteVal is not distinct from ?");
+
+        stmt.setByte(1, (byte)1);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, TINYINT);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testShort() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where shortVal is not distinct from ?");
+
+        stmt.setShort(1, (short)1);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, SMALLINT);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInteger() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where intVal is not distinct from ?");
+
+        stmt.setInt(1, 1);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, INTEGER);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLong() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where longVal is not distinct from ?");
+
+        stmt.setLong(1, 1L);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, BIGINT);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFloat() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where floatVal is not distinct from ?");
+
+        stmt.setFloat(1, 1.0f);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, FLOAT);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDouble() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where doubleVal is not distinct from ?");
+
+        stmt.setDouble(1, 1.0d);
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, DOUBLE);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBigDecimal() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where bigVal is not distinct from ?");
+
+        stmt.setBigDecimal(1, new BigDecimal(1));
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, OTHER);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testString() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where strVal is not distinct from ?");
+
+        stmt.setString(1, "str");
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, VARCHAR);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testArray() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where arrVal is not distinct from ?");
+
+        stmt.setBytes(1, new byte[] {1});
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, BINARY);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDate() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where dateVal is not distinct from ?");
+
+        stmt.setObject(1, new Date(1));
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, DATE);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTime() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where timeVal is not distinct from ?");
+
+        stmt.setTime(1, new Time(1));
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, TIME);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTimestamp() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where tsVal is not distinct from ?");
+
+        stmt.setTimestamp(1, new Timestamp(1));
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, TIMESTAMP);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testUrl() throws Exception {
+        stmt = conn.prepareStatement("select * from TestObject where urlVal is not distinct from ?");
+
+        stmt.setURL(1, new URL("http://abc.com/"));
+
+        ResultSet rs = stmt.executeQuery();
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 1;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setNull(1, DATALINK);
+
+        rs = stmt.executeQuery();
+
+        cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0)
+                assert rs.getInt("id") == 2;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * Test object.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class TestObject implements Serializable {
+        /** */
+        @QuerySqlField(index = false)
+        private final int id;
+
+        /** */
+        @QuerySqlField
+        private Boolean boolVal;
+
+        /** */
+        @QuerySqlField
+        private Byte byteVal;
+
+        /** */
+        @QuerySqlField
+        private Short shortVal;
+
+        /** */
+        @QuerySqlField
+        private Integer intVal;
+
+        /** */
+        @QuerySqlField
+        private Long longVal;
+
+        /** */
+        @QuerySqlField
+        private Float floatVal;
+
+        /** */
+        @QuerySqlField
+        private Double doubleVal;
+
+        /** */
+        @QuerySqlField
+        private BigDecimal bigVal;
+
+        /** */
+        @QuerySqlField
+        private String strVal;
+
+        /** */
+        @QuerySqlField
+        private byte[] arrVal;
+
+        /** */
+        @QuerySqlField
+        private Date dateVal;
+
+        /** */
+        @QuerySqlField
+        private Time timeVal;
+
+        /** */
+        @QuerySqlField
+        private Timestamp tsVal;
+
+        /** */
+        @QuerySqlField
+        private URL urlVal;
+
+        /**
+         * @param id ID.
+         */
+        private TestObject(int id) {
+            this.id = id;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
new file mode 100644
index 0000000..3607f53
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
@@ -0,0 +1,751 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.Date;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Result set test.
+ */
+@SuppressWarnings("FloatingPointEquality")
+public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** JDBC URL. */
+    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+
+    /** SQL query. */
+    private static final String SQL =
+        "select id, boolVal, byteVal, shortVal, intVal, longVal, floatVal, " +
+            "doubleVal, bigVal, strVal, arrVal, dateVal, timeVal, tsVal, urlVal, f1, f2, f3, _val " +
+            "from TestObject where id = 1";
+
+    /** Statement. */
+    private Statement stmt;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration<?,?> cache = defaultCacheConfiguration();
+
+        cache.setCacheMode(PARTITIONED);
+        cache.setBackups(1);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setIndexedTypes(
+            Integer.class, TestObject.class
+        );
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(3);
+
+        IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+
+        assert cache != null;
+
+        TestObject o = createObjectWithData(1);
+
+        cache.put(1, o);
+        cache.put(2, new TestObject(2));
+        cache.put(3, new TestObject(3));
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        stmt = DriverManager.getConnection(BASE_URL).createStatement();
+
+        assert stmt != null;
+        assert !stmt.isClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        if (stmt != null) {
+            stmt.getConnection().close();
+            stmt.close();
+
+            assert stmt.isClosed();
+        }
+    }
+
+    /**
+     * @param id ID.
+     * @return Object.
+     * @throws MalformedURLException If URL in incorrect.
+     */
+    @SuppressWarnings("deprecation")
+    private TestObject createObjectWithData(int id) throws MalformedURLException {
+        TestObject o = new TestObject(id);
+
+        o.boolVal = true;
+        o.byteVal = 1;
+        o.shortVal = 1;
+        o.intVal = 1;
+        o.longVal = 1L;
+        o.floatVal = 1.0f;
+        o.doubleVal = 1.0d;
+        o.bigVal = new BigDecimal(1);
+        o.strVal = "str";
+        o.arrVal = new byte[] {1};
+        o.dateVal = new Date(1, 1, 1);
+        o.timeVal = new Time(1, 1, 1);
+        o.tsVal = new Timestamp(1);
+        o.urlVal = new URL("http://abc.com/");
+
+        return o;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBoolean() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getBoolean("boolVal");
+                assert rs.getBoolean(2);
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testByte() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getByte("byteVal") == 1;
+                assert rs.getByte(3) == 1;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testShort() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getShort("shortVal") == 1;
+                assert rs.getShort(4) == 1;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInteger() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getInt("intVal") == 1;
+                assert rs.getInt(5) == 1;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLong() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getLong("longVal") == 1;
+                assert rs.getLong(6) == 1;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFloat() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getFloat("floatVal") == 1.0;
+                assert rs.getFloat(7) == 1.0;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDouble() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getDouble("doubleVal") == 1.0;
+                assert rs.getDouble(8) == 1.0;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testBigDecimal() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getBigDecimal("bigVal").intValue() == 1;
+                assert rs.getBigDecimal(9).intValue() == 1;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testString() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert "str".equals(rs.getString("strVal"));
+                assert "str".equals(rs.getString(10));
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testArray() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert Arrays.equals(rs.getBytes("arrVal"), new byte[] {1});
+                assert Arrays.equals(rs.getBytes(11), new byte[] {1});
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("deprecation")
+    public void testDate() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getDate("dateVal").equals(new Date(1, 1, 1));
+                assert rs.getDate(12).equals(new Date(1, 1, 1));
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("deprecation")
+    public void testTime() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getTime("timeVal").equals(new Time(1, 1, 1));
+                assert rs.getTime(13).equals(new Time(1, 1, 1));
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTimestamp() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert rs.getTimestamp("tsVal").getTime() == 1;
+                assert rs.getTimestamp(14).getTime() == 1;
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testUrl() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            if (cnt == 0) {
+                assert "http://abc.com/".equals(rs.getURL("urlVal").toString());
+                assert "http://abc.com/".equals(rs.getURL(15).toString());
+            }
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testObject() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        TestObjectField f1 = new TestObjectField(100, "AAAA");
+        TestObjectField f2 = new TestObjectField(500, "BBBB");
+
+        TestObject o = createObjectWithData(1);
+
+        assertTrue(rs.next());
+
+        assertEquals(f1.toString(), rs.getObject("f1"));
+        assertEquals(f1.toString(), rs.getObject(16));
+
+        assertEquals(f2.toString(), rs.getObject("f2"));
+        assertEquals(f2.toString(), rs.getObject(17));
+
+        assertNull(rs.getObject("f3"));
+        assertTrue(rs.wasNull());
+        assertNull(rs.getObject(18));
+        assertTrue(rs.wasNull());
+
+        assertEquals(o.toString(), rs.getObject("_val"));
+        assertEquals(o.toString(), rs.getObject(19));
+
+        assertFalse(rs.next());
+    }
+
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNavigation() throws Exception {
+        ResultSet rs = stmt.executeQuery("select * from TestObject where id > 0");
+
+        assertTrue(rs.isBeforeFirst());
+        assertFalse(rs.isAfterLast());
+        assertFalse(rs.isFirst());
+        assertFalse(rs.isLast());
+        assertEquals(0, rs.getRow());
+
+        assertTrue(rs.next());
+
+        assertFalse(rs.isBeforeFirst());
+        assertFalse(rs.isAfterLast());
+        assertTrue(rs.isFirst());
+        assertFalse(rs.isLast());
+        assertEquals(1, rs.getRow());
+
+        assertTrue(rs.next());
+
+        assertFalse(rs.isBeforeFirst());
+        assertFalse(rs.isAfterLast());
+        assertFalse(rs.isFirst());
+        assertFalse(rs.isLast());
+        assertEquals(2, rs.getRow());
+
+        assertTrue(rs.next());
+
+        assertFalse(rs.isBeforeFirst());
+        assertFalse(rs.isAfterLast());
+        assertFalse(rs.isFirst());
+        assertTrue(rs.isLast());
+        assertEquals(3, rs.getRow());
+
+        assertFalse(rs.next());
+
+        assertFalse(rs.isBeforeFirst());
+        assertTrue(rs.isAfterLast());
+        assertFalse(rs.isFirst());
+        assertFalse(rs.isLast());
+        assertEquals(0, rs.getRow());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFetchSize() throws Exception {
+        stmt.setFetchSize(1);
+
+        ResultSet rs = stmt.executeQuery("select * from TestObject where id > 0");
+
+        assertTrue(rs.next());
+        assertTrue(rs.next());
+        assertTrue(rs.next());
+
+        stmt.setFetchSize(0);
+    }
+
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testFindColumn() throws Exception {
+        final ResultSet rs = stmt.executeQuery(SQL);
+
+        assertNotNull(rs);
+        assertTrue(rs.next());
+
+        assert rs.findColumn("id") == 1;
+
+        GridTestUtils.assertThrows(
+            log,
+            new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    rs.findColumn("wrong");
+
+                    return null;
+                }
+            },
+            SQLException.class,
+            "Column not found: wrong"
+        );
+    }
+
+    /**
+     * Test object.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class TestObject implements Serializable {
+        /** */
+        @QuerySqlField
+        private final int id;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Boolean boolVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Byte byteVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Short shortVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Integer intVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Long longVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Float floatVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Double doubleVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private BigDecimal bigVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private String strVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private byte[] arrVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Date dateVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Time timeVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private Timestamp tsVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private URL urlVal;
+
+        /** */
+        @QuerySqlField(index = false)
+        private TestObjectField f1 = new TestObjectField(100, "AAAA");
+
+        /** */
+        @QuerySqlField(index = false)
+        private TestObjectField f2 = new TestObjectField(500, "BBBB");
+
+        /** */
+        @QuerySqlField(index = false)
+        private TestObjectField f3;
+
+        /**
+         * @param id ID.
+         */
+        private TestObject(int id) {
+            this.id = id;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(TestObject.class, this);
+        }
+
+        /** {@inheritDoc} */
+        @SuppressWarnings({"BigDecimalEquals", "EqualsHashCodeCalledOnUrl", "RedundantIfStatement"})
+        @Override public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            TestObject that = (TestObject)o;
+
+            if (id != that.id) return false;
+            if (!Arrays.equals(arrVal, that.arrVal)) return false;
+            if (bigVal != null ? !bigVal.equals(that.bigVal) : that.bigVal != null) return false;
+            if (boolVal != null ? !boolVal.equals(that.boolVal) : that.boolVal != null) return false;
+            if (byteVal != null ? !byteVal.equals(that.byteVal) : that.byteVal != null) return false;
+            if (dateVal != null ? !dateVal.equals(that.dateVal) : that.dateVal != null) return false;
+            if (doubleVal != null ? !doubleVal.equals(that.doubleVal) : that.doubleVal != null) return false;
+            if (f1 != null ? !f1.equals(that.f1) : that.f1 != null) return false;
+            if (f2 != null ? !f2.equals(that.f2) : that.f2 != null) return false;
+            if (f3 != null ? !f3.equals(that.f3) : that.f3 != null) return false;
+            if (floatVal != null ? !floatVal.equals(that.floatVal) : that.floatVal != null) return false;
+            if (intVal != null ? !intVal.equals(that.intVal) : that.intVal != null) return false;
+            if (longVal != null ? !longVal.equals(that.longVal) : that.longVal != null) return false;
+            if (shortVal != null ? !shortVal.equals(that.shortVal) : that.shortVal != null) return false;
+            if (strVal != null ? !strVal.equals(that.strVal) : that.strVal != null) return false;
+            if (timeVal != null ? !timeVal.equals(that.timeVal) : that.timeVal != null) return false;
+            if (tsVal != null ? !tsVal.equals(that.tsVal) : that.tsVal != null) return false;
+            if (urlVal != null ? !urlVal.equals(that.urlVal) : that.urlVal != null) return false;
+
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @SuppressWarnings("EqualsHashCodeCalledOnUrl")
+        @Override public int hashCode() {
+            int res = id;
+
+            res = 31 * res + (boolVal != null ? boolVal.hashCode() : 0);
+            res = 31 * res + (byteVal != null ? byteVal.hashCode() : 0);
+            res = 31 * res + (shortVal != null ? shortVal.hashCode() : 0);
+            res = 31 * res + (intVal != null ? intVal.hashCode() : 0);
+            res = 31 * res + (longVal != null ? longVal.hashCode() : 0);
+            res = 31 * res + (floatVal != null ? floatVal.hashCode() : 0);
+            res = 31 * res + (doubleVal != null ? doubleVal.hashCode() : 0);
+            res = 31 * res + (bigVal != null ? bigVal.hashCode() : 0);
+            res = 31 * res + (strVal != null ? strVal.hashCode() : 0);
+            res = 31 * res + (arrVal != null ? Arrays.hashCode(arrVal) : 0);
+            res = 31 * res + (dateVal != null ? dateVal.hashCode() : 0);
+            res = 31 * res + (timeVal != null ? timeVal.hashCode() : 0);
+            res = 31 * res + (tsVal != null ? tsVal.hashCode() : 0);
+            res = 31 * res + (urlVal != null ? urlVal.hashCode() : 0);
+            res = 31 * res + (f1 != null ? f1.hashCode() : 0);
+            res = 31 * res + (f2 != null ? f2.hashCode() : 0);
+            res = 31 * res + (f3 != null ? f3.hashCode() : 0);
+
+            return res;
+        }
+    }
+
+    /**
+     * Test object field.
+     */
+    @SuppressWarnings("PackageVisibleField")
+    private static class TestObjectField implements Serializable {
+        /** */
+        final int a;
+
+        /** */
+        final String b;
+
+        /**
+         * @param a A.
+         * @param b B.
+         */
+        private TestObjectField(int a, String b) {
+            this.a = a;
+            this.b = b;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            TestObjectField that = (TestObjectField)o;
+
+            return a == that.a && !(b != null ? !b.equals(that.b) : that.b != null);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            int res = a;
+
+            res = 31 * res + (b != null ? b.hashCode() : 0);
+
+            return res;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(TestObjectField.class, this);
+        }
+    }
+}


[28/41] ignite git commit: ignite-1462: hid portable API in 1.4 release

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java
deleted file mode 100644
index 9ba38d9..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractDataStreamerSelfTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
-
-/**
- * Test for portable objects stored in cache.
- */
-public abstract class GridCachePortableObjectsAbstractDataStreamerSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int THREAD_CNT = 64;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration cacheCfg = new CacheConfiguration();
-
-        cacheCfg.setCacheMode(cacheMode());
-        cacheCfg.setAtomicityMode(atomicityMode());
-        cacheCfg.setNearConfiguration(nearConfiguration());
-        cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
-
-        cfg.setCacheConfiguration(cacheCfg);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject.class.getName())));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /**
-     * @return Sync mode.
-     */
-    protected CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return PRIMARY_SYNC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGridsMultiThreaded(gridCount());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @return Cache mode.
-     */
-    protected abstract CacheMode cacheMode();
-
-    /**
-     * @return Atomicity mode.
-     */
-    protected abstract CacheAtomicityMode atomicityMode();
-
-    /**
-     * @return Near configuration.
-     */
-    protected abstract NearCacheConfiguration nearConfiguration();
-
-    /**
-     * @return Grid count.
-     */
-    protected int gridCount() {
-        return 1;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("BusyWait")
-    public void testGetPut() throws Exception {
-        final AtomicBoolean flag = new AtomicBoolean();
-
-        final LongAdder8 cnt = new LongAdder8();
-
-        try (IgniteDataStreamer<Object, Object> ldr = grid(0).dataStreamer(null)) {
-            IgniteInternalFuture<?> f = multithreadedAsync(
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
-                        while (!flag.get()) {
-                            ldr.addData(rnd.nextInt(10000), new TestObject(rnd.nextInt(10000)));
-
-                            cnt.add(1);
-                        }
-
-                        return null;
-                    }
-                },
-                THREAD_CNT
-            );
-
-            for (int i = 0; i < 30 && !f.isDone(); i++)
-                Thread.sleep(1000);
-
-            flag.set(true);
-
-            f.get();
-        }
-
-        info("Operations in 30 sec: " + cnt.sum());
-    }
-
-    /**
-     */
-    private static class TestObject implements PortableMarshalAware, Serializable {
-        /** */
-        private int val;
-
-        /**
-         */
-        private TestObject() {
-            // No-op.
-        }
-
-        /**
-         * @param val Value.
-         */
-        private TestObject(int val) {
-            this.val = val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object obj) {
-            return obj instanceof TestObject && ((TestObject)obj).val == val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeInt("val", val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            val = reader.readInt("val");
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java
deleted file mode 100644
index 67f0e52..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractMultiThreadedSelfTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheWriteSynchronizationMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jsr166.LongAdder8;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.PRIMARY_SYNC;
-
-/**
- * Test for portable objects stored in cache.
- */
-public abstract class GridCachePortableObjectsAbstractMultiThreadedSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int THREAD_CNT = 64;
-
-    /** */
-    private static final AtomicInteger idxGen = new AtomicInteger();
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        CacheConfiguration cacheCfg = new CacheConfiguration();
-
-        cacheCfg.setCacheMode(cacheMode());
-        cacheCfg.setAtomicityMode(atomicityMode());
-        cacheCfg.setNearConfiguration(nearConfiguration());
-        cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
-
-        cfg.setCacheConfiguration(cacheCfg);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject.class.getName())));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /**
-     * @return Sync mode.
-     */
-    protected CacheWriteSynchronizationMode writeSynchronizationMode() {
-        return PRIMARY_SYNC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGridsMultiThreaded(gridCount());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @return Cache mode.
-     */
-    protected abstract CacheMode cacheMode();
-
-    /**
-     * @return Atomicity mode.
-     */
-    protected abstract CacheAtomicityMode atomicityMode();
-
-    /**
-     * @return Distribution mode.
-     */
-    protected abstract NearCacheConfiguration nearConfiguration();
-
-    /**
-     * @return Grid count.
-     */
-    protected int gridCount() {
-        return 1;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("BusyWait") public void testGetPut() throws Exception {
-        final AtomicBoolean flag = new AtomicBoolean();
-
-        final LongAdder8 cnt = new LongAdder8();
-
-        IgniteInternalFuture<?> f = multithreadedAsync(
-            new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    int threadId = idxGen.getAndIncrement() % 2;
-
-                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
-                    while (!flag.get()) {
-                        IgniteCache<Object, Object> c = jcache(rnd.nextInt(gridCount()));
-
-                        switch (threadId) {
-                            case 0:
-                                // Put/get/remove portable -> portable.
-
-                                c.put(new TestObject(rnd.nextInt(10000)), new TestObject(rnd.nextInt(10000)));
-
-                                IgniteCache<Object, Object> p2 = ((IgniteCacheProxy<Object, Object>)c).keepPortable();
-
-                                PortableObject v = (PortableObject)p2.get(new TestObject(rnd.nextInt(10000)));
-
-                                if (v != null)
-                                    v.deserialize();
-
-                                c.remove(new TestObject(rnd.nextInt(10000)));
-
-                                break;
-
-                            case 1:
-                                // Put/get int -> portable.
-                                c.put(rnd.nextInt(10000), new TestObject(rnd.nextInt(10000)));
-
-                                IgniteCache<Integer, PortableObject> p4 = ((IgniteCacheProxy<Object, Object>)c).keepPortable();
-
-                                PortableObject v1 = p4.get(rnd.nextInt(10000));
-
-                                if (v1 != null)
-                                    v1.deserialize();
-
-                                p4.remove(rnd.nextInt(10000));
-
-                                break;
-
-                            default:
-                                assert false;
-                        }
-
-                        cnt.add(3);
-                    }
-
-                    return null;
-                }
-            },
-            THREAD_CNT
-        );
-
-        for (int i = 0; i < 30 && !f.isDone(); i++)
-            Thread.sleep(1000);
-
-        flag.set(true);
-
-        f.get();
-
-        info("Operations in 30 sec: " + cnt.sum());
-    }
-
-    /**
-     */
-    private static class TestObject implements PortableMarshalAware, Serializable {
-        /** */
-        private int val;
-
-        /**
-         */
-        private TestObject() {
-            // No-op.
-        }
-
-        /**
-         * @param val Value.
-         */
-        private TestObject(int val) {
-            this.val = val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object obj) {
-            return obj instanceof TestObject && ((TestObject)obj).val == val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeInt("val", val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            val = reader.readInt("val");
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java
deleted file mode 100644
index 7ac8712..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableObjectsAbstractSelfTest.java
+++ /dev/null
@@ -1,978 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import javax.cache.Cache;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.MutableEntry;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.portable.PortableObjectImpl;
-import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.internal.util.typedef.P2;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.transactions.Transaction;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-
-/**
- * Test for portable objects stored in cache.
- */
-public abstract class GridCachePortableObjectsAbstractSelfTest extends GridCommonAbstractTest {
-    /** */
-    public static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final int ENTRY_CNT = 100;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        CacheConfiguration cacheCfg = new CacheConfiguration();
-
-        cacheCfg.setCacheMode(cacheMode());
-        cacheCfg.setAtomicityMode(atomicityMode());
-        cacheCfg.setNearConfiguration(nearConfiguration());
-        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
-        cacheCfg.setCacheStoreFactory(singletonFactory(new TestStore()));
-        cacheCfg.setReadThrough(true);
-        cacheCfg.setWriteThrough(true);
-        cacheCfg.setLoadPreviousValue(true);
-        cacheCfg.setBackups(1);
-
-        if (offheapTiered()) {
-            cacheCfg.setMemoryMode(OFFHEAP_TIERED);
-            cacheCfg.setOffHeapMaxMemory(0);
-        }
-
-        cfg.setCacheConfiguration(cacheCfg);
-
-        cfg.setMarshaller(new PortableMarshaller());
-
-        return cfg;
-    }
-
-    /**
-     * @return {@code True} if should use OFFHEAP_TIERED mode.
-     */
-    protected boolean offheapTiered() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGridsMultiThreaded(gridCount());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        for (int i = 0; i < gridCount(); i++) {
-            GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache();
-
-            for (GridCacheEntryEx e : c.map().entries0()) {
-                Object key = e.key().value(c.context().cacheObjectContext(), false);
-                Object val = CU.value(e.rawGet(), c.context(), false);
-
-                if (key instanceof PortableObject)
-                    assert ((PortableObjectImpl)key).detached() : val;
-
-                if (val instanceof PortableObject)
-                    assert ((PortableObjectImpl)val).detached() : val;
-            }
-        }
-
-        IgniteCache<Object, Object> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.remove(i);
-
-        if (offheapTiered()) {
-            for (int k = 0; k < 100; k++)
-                c.remove(k);
-        }
-
-        assertEquals(0, c.size());
-    }
-
-    /**
-     * @return Cache mode.
-     */
-    protected abstract CacheMode cacheMode();
-
-    /**
-     * @return Atomicity mode.
-     */
-    protected abstract CacheAtomicityMode atomicityMode();
-
-    /**
-     * @return Distribution mode.
-     */
-    protected abstract NearCacheConfiguration nearConfiguration();
-
-    /**
-     * @return Grid count.
-     */
-    protected abstract int gridCount();
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("unchecked")
-    public void testCircularReference() throws Exception {
-        IgniteCache c = keepPortableCache();
-
-        TestReferenceObject obj1 = new TestReferenceObject();
-
-        obj1.obj = new TestReferenceObject(obj1);
-
-        c.put(1, obj1);
-
-        PortableObject po = (PortableObject)c.get(1);
-
-        String str = po.toString();
-
-        log.info("toString: " + str);
-
-        assertNotNull(str);
-
-        assertTrue("Unexpected toString: " + str,
-            str.startsWith("TestReferenceObject") && str.contains("obj=TestReferenceObject ["));
-
-        TestReferenceObject obj1_r = po.deserialize();
-
-        assertNotNull(obj1_r);
-
-        TestReferenceObject obj2_r = obj1_r.obj;
-
-        assertNotNull(obj2_r);
-
-        assertSame(obj1_r, obj2_r.obj);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGet() throws Exception {
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            TestObject obj = c.get(i);
-
-            assertEquals(i, obj.val);
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            PortableObject po = kpc.get(i);
-
-            assertEquals(i, (int)po.field("val"));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIterator() throws Exception {
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        Map<Integer, TestObject> entries = new HashMap<>();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            TestObject val = new TestObject(i);
-
-            c.put(i, val);
-
-            entries.put(i, val);
-        }
-
-        IgniteCache<Integer, PortableObject> prj = ((IgniteCacheProxy)c).keepPortable();
-
-        Iterator<Cache.Entry<Integer, PortableObject>> it = prj.iterator();
-
-        assertTrue(it.hasNext());
-
-        while (it.hasNext()) {
-            Cache.Entry<Integer, PortableObject> entry = it.next();
-
-            assertTrue(entries.containsKey(entry.getKey()));
-
-            TestObject o = entries.get(entry.getKey());
-
-            PortableObject po = entry.getValue();
-
-            assertEquals(o.val, (int)po.field("val"));
-
-            entries.remove(entry.getKey());
-        }
-
-        assertEquals(0, entries.size());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollection() throws Exception {
-        IgniteCache<Integer, Collection<TestObject>> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            Collection<TestObject> col = new ArrayList<>(3);
-
-            for (int j = 0; j < 3; j++)
-                col.add(new TestObject(i * 10 + j));
-
-            c.put(i, col);
-        }
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            Collection<TestObject> col = c.get(i);
-
-            assertEquals(3, col.size());
-
-            Iterator<TestObject> it = col.iterator();
-
-            for (int j = 0; j < 3; j++) {
-                assertTrue(it.hasNext());
-
-                assertEquals(i * 10 + j, it.next().val);
-            }
-        }
-
-        IgniteCache<Integer, Collection<PortableObject>> kpc = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            Collection<PortableObject> col = kpc.get(i);
-
-            assertEquals(3, col.size());
-
-            Iterator<PortableObject> it = col.iterator();
-
-            for (int j = 0; j < 3; j++) {
-                assertTrue(it.hasNext());
-
-                assertEquals(i * 10 + j, (int)it.next().field("val"));
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMap() throws Exception {
-        IgniteCache<Integer, Map<Integer, TestObject>> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            Map<Integer, TestObject> map = U.newHashMap(3);
-
-            for (int j = 0; j < 3; j++) {
-                int idx = i * 10 + j;
-
-                map.put(idx, new TestObject(idx));
-            }
-
-            c.put(i, map);
-        }
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            Map<Integer, TestObject> map = c.get(i);
-
-            assertEquals(3, map.size());
-
-            for (int j = 0; j < 3; j++) {
-                int idx = i * 10 + j;
-
-                assertEquals(idx, map.get(idx).val);
-            }
-        }
-
-        IgniteCache<Integer, Map<Integer, PortableObject>> kpc = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            Map<Integer, PortableObject> map = kpc.get(i);
-
-            assertEquals(3, map.size());
-
-            for (int j = 0; j < 3; j++) {
-                int idx = i * 10 + j;
-
-                assertEquals(idx, (int)map.get(idx).field("val"));
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAsync() throws Exception {
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            cacheAsync.get(i);
-            TestObject obj = cacheAsync.<TestObject>future().get();
-
-            assertEquals(i, obj.val);
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
-        IgniteCache<Integer, PortableObject> cachePortableAsync = kpc.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            cachePortableAsync.get(i);
-
-            PortableObject po = cachePortableAsync.<PortableObject>future().get();
-
-            assertEquals(i, (int)po.field("val"));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetTx() throws Exception {
-        if (atomicityMode() != TRANSACTIONAL)
-            return;
-
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                TestObject obj = c.get(i);
-
-                assertEquals(i, obj.val);
-
-                tx.commit();
-            }
-        }
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
-                TestObject obj = c.get(i);
-
-                assertEquals(i, obj.val);
-
-                tx.commit();
-            }
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                PortableObject po = kpc.get(i);
-
-                assertEquals(i, (int)po.field("val"));
-
-                tx.commit();
-            }
-        }
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
-                PortableObject po = kpc.get(i);
-
-                assertEquals(i, (int)po.field("val"));
-
-                tx.commit();
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAsyncTx() throws Exception {
-        if (atomicityMode() != TRANSACTIONAL)
-            return;
-
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                cacheAsync.get(i);
-
-                TestObject obj = cacheAsync.<TestObject>future().get();
-
-                assertEquals(i, obj.val);
-
-                tx.commit();
-            }
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-        IgniteCache<Integer, PortableObject> cachePortableAsync = kpc.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; i++) {
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                cachePortableAsync.get(i);
-
-                PortableObject po = cachePortableAsync.<PortableObject>future().get();
-
-                assertEquals(i, (int)po.field("val"));
-
-                tx.commit();
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAll() throws Exception {
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            Map<Integer, TestObject> objs = c.getAll(keys);
-
-            assertEquals(10, objs.size());
-
-            for (Map.Entry<Integer, TestObject> e : objs.entrySet())
-                assertEquals(e.getKey().intValue(), e.getValue().val);
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            Map<Integer, PortableObject> objs = kpc.getAll(keys);
-
-            assertEquals(10, objs.size());
-
-            for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
-                assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAllAsync() throws Exception {
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            cacheAsync.getAll(keys);
-
-            Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get();
-
-            assertEquals(10, objs.size());
-
-            for (Map.Entry<Integer, TestObject> e : objs.entrySet())
-                assertEquals(e.getKey().intValue(), e.getValue().val);
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-        IgniteCache<Integer, PortableObject> cachePortableAsync = kpc.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-
-            cachePortableAsync.getAll(keys);
-
-            Map<Integer, PortableObject> objs = cachePortableAsync.<Map<Integer, PortableObject>>future().get();
-
-            assertEquals(10, objs.size());
-
-            for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
-                assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAllTx() throws Exception {
-        if (atomicityMode() != TRANSACTIONAL)
-            return;
-
-        IgniteCache<Integer, TestObject> c = jcache(0);
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                Map<Integer, TestObject> objs = c.getAll(keys);
-
-                assertEquals(10, objs.size());
-
-                for (Map.Entry<Integer, TestObject> e : objs.entrySet())
-                    assertEquals(e.getKey().intValue(), e.getValue().val);
-
-                tx.commit();
-            }
-
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
-                Map<Integer, TestObject> objs = c.getAll(keys);
-
-                assertEquals(10, objs.size());
-
-                for (Map.Entry<Integer, TestObject> e : objs.entrySet())
-                    assertEquals(e.getKey().intValue(), e.getValue().val);
-
-                tx.commit();
-            }
-        }
-
-        IgniteCache<Integer, PortableObject> kpc = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                Map<Integer, PortableObject> objs = kpc.getAll(keys);
-
-                assertEquals(10, objs.size());
-
-                for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
-                    assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-
-                tx.commit();
-            }
-
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, READ_COMMITTED)) {
-                Map<Integer, PortableObject> objs = kpc.getAll(keys);
-
-                assertEquals(10, objs.size());
-
-                for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
-                    assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-
-                tx.commit();
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAllAsyncTx() throws Exception {
-        if (atomicityMode() != TRANSACTIONAL)
-            return;
-
-        IgniteCache<Integer, TestObject> c = jcache(0);
-        IgniteCache<Integer, TestObject> cacheAsync = c.withAsync();
-
-        for (int i = 0; i < ENTRY_CNT; i++)
-            c.put(i, new TestObject(i));
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                cacheAsync.getAll(keys);
-
-                Map<Integer, TestObject> objs = cacheAsync.<Map<Integer, TestObject>>future().get();
-
-                assertEquals(10, objs.size());
-
-                for (Map.Entry<Integer, TestObject> e : objs.entrySet())
-                    assertEquals(e.getKey().intValue(), e.getValue().val);
-
-                tx.commit();
-            }
-        }
-
-        IgniteCache<Integer, PortableObject> cache = keepPortableCache();
-
-        for (int i = 0; i < ENTRY_CNT; ) {
-            Set<Integer> keys = new HashSet<>();
-
-            for (int j = 0; j < 10; j++)
-                keys.add(i++);
-
-            IgniteCache<Integer, PortableObject> asyncCache = cache.withAsync();
-
-            try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                asyncCache.getAll(keys);
-
-                Map<Integer, PortableObject> objs = asyncCache.<Map<Integer, PortableObject>>future().get();
-
-                assertEquals(10, objs.size());
-
-                for (Map.Entry<Integer, PortableObject> e : objs.entrySet())
-                    assertEquals(new Integer(e.getKey().intValue()), e.getValue().field("val"));
-
-                tx.commit();
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLoadCache() throws Exception {
-        for (int i = 0; i < gridCount(); i++)
-            jcache(i).localLoadCache(null);
-
-        IgniteCache<Integer, TestObject> cache = jcache(0);
-
-        assertEquals(3, cache.size(CachePeekMode.PRIMARY));
-
-        assertEquals(1, cache.get(1).val);
-        assertEquals(2, cache.get(2).val);
-        assertEquals(3, cache.get(3).val);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLoadCacheAsync() throws Exception {
-        for (int i = 0; i < gridCount(); i++) {
-            IgniteCache<Object, Object> jcache = jcache(i).withAsync();
-
-            jcache.loadCache(null);
-
-            jcache.future().get();
-        }
-
-        IgniteCache<Integer, TestObject> cache = jcache(0);
-
-        assertEquals(3, cache.size(CachePeekMode.PRIMARY));
-
-        assertEquals(1, cache.get(1).val);
-        assertEquals(2, cache.get(2).val);
-        assertEquals(3, cache.get(3).val);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLoadCacheFilteredAsync() throws Exception {
-        for (int i = 0; i < gridCount(); i++) {
-            IgniteCache<Integer, TestObject> c = this.<Integer, TestObject>jcache(i).withAsync();
-
-            c.loadCache(new P2<Integer, TestObject>() {
-                @Override public boolean apply(Integer key, TestObject val) {
-                    return val.val < 3;
-                }
-            });
-
-            c.future().get();
-        }
-
-        IgniteCache<Integer, TestObject> cache = jcache(0);
-
-        assertEquals(2, cache.size(CachePeekMode.PRIMARY));
-
-        assertEquals(1, cache.get(1).val);
-        assertEquals(2, cache.get(2).val);
-
-        assertNull(cache.get(3));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTransform() throws Exception {
-        IgniteCache<Integer, PortableObject> c = keepPortableCache();
-
-        checkTransform(primaryKey(c));
-
-        if (cacheMode() != CacheMode.LOCAL) {
-            checkTransform(backupKey(c));
-
-            if (nearConfiguration() != null)
-                checkTransform(nearKey(c));
-        }
-    }
-
-    /**
-     * @return Cache with keep portable flag.
-     */
-    private <K, V> IgniteCache<K, V> keepPortableCache() {
-        return ignite(0).cache(null).withKeepPortable();
-    }
-
-    /**
-     * @param key Key.
-     * @throws Exception If failed.
-     */
-    private void checkTransform(Integer key) throws Exception {
-        log.info("Transform: " + key);
-
-        IgniteCache<Integer, PortableObject> c = keepPortableCache();
-
-        try {
-            c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
-                @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
-                    PortableObject val = e.getValue();
-
-                    assertNull("Unexpected value: " + val, val);
-
-                    return null;
-                }
-            });
-
-            jcache(0).put(key, new TestObject(1));
-
-            c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
-                @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
-                    PortableObject val = e.getValue();
-
-                    assertNotNull("Unexpected value: " + val, val);
-
-                    assertEquals(new Integer(1), val.field("val"));
-
-                    Ignite ignite = e.unwrap(Ignite.class);
-
-                    IgnitePortables portables = ignite.portables();
-
-                    PortableBuilder builder = portables.builder(val);
-
-                    builder.setField("val", 2);
-
-                    e.setValue(builder.build());
-
-                    return null;
-                }
-            });
-
-            PortableObject obj = c.get(key);
-
-            assertEquals(new Integer(2), obj.field("val"));
-
-            c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
-                @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
-                    PortableObject val = e.getValue();
-
-                    assertNotNull("Unexpected value: " + val, val);
-
-                    assertEquals(new Integer(2), val.field("val"));
-
-                    e.setValue(val);
-
-                    return null;
-                }
-            });
-
-            obj = c.get(key);
-
-            assertEquals(new Integer(2), obj.field("val"));
-
-            c.invoke(key, new EntryProcessor<Integer, PortableObject, Void>() {
-                @Override public Void process(MutableEntry<Integer, PortableObject> e, Object... args) {
-                    PortableObject val = e.getValue();
-
-                    assertNotNull("Unexpected value: " + val, val);
-
-                    assertEquals(new Integer(2), val.field("val"));
-
-                    e.remove();
-
-                    return null;
-                }
-            });
-
-            assertNull(c.get(key));
-        }
-        finally {
-            c.remove(key);
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestObject implements PortableMarshalAware {
-        /** */
-        private int val;
-
-        /**
-         */
-        private TestObject() {
-            // No-op.
-        }
-
-        /**
-         * @param val Value.
-         */
-        private TestObject(int val) {
-            this.val = val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeInt("val", val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            val = reader.readInt("val");
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestReferenceObject implements PortableMarshalAware {
-        /** */
-        private TestReferenceObject obj;
-
-        /**
-         */
-        private TestReferenceObject() {
-            // No-op.
-        }
-
-        /**
-         * @param obj Object.
-         */
-        private TestReferenceObject(TestReferenceObject obj) {
-            this.obj = obj;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeObject("obj", obj);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            obj = reader.readObject("obj");
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestStore extends CacheStoreAdapter<Integer, Object> {
-        /** {@inheritDoc} */
-        @Override public void loadCache(IgniteBiInClosure<Integer, Object> clo, Object... args) {
-            for (int i = 1; i <= 3; i++)
-                clo.apply(i, new TestObject(i));
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Object load(Integer key) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void write(Cache.Entry<? extends Integer, ?> e) {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public void delete(Object key) {
-            // No-op.
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java
deleted file mode 100644
index 7c605b5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreAbstractSelfTest.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import com.google.common.collect.ImmutableSet;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import javax.cache.Cache;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.jetbrains.annotations.Nullable;
-import org.jsr166.ConcurrentHashMap8;
-
-/**
- * Tests for cache store with portables.
- */
-public abstract class GridCachePortableStoreAbstractSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final TestStore STORE = new TestStore();
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(Key.class.getName(), Value.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        CacheConfiguration cacheCfg = new CacheConfiguration();
-
-        cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
-        cacheCfg.setKeepPortableInStore(keepPortableInStore());
-        cacheCfg.setReadThrough(true);
-        cacheCfg.setWriteThrough(true);
-        cacheCfg.setLoadPreviousValue(true);
-
-        cfg.setCacheConfiguration(cacheCfg);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        return cfg;
-    }
-
-    /**
-     * @return Keep portables in store flag.
-     */
-    protected abstract boolean keepPortableInStore();
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        STORE.map().clear();
-
-        jcache().clear();
-
-        assert jcache().size() == 0;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPut() throws Exception {
-        jcache().put(new Key(1), new Value(1));
-
-        checkMap(STORE.map(), 1);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutAll() throws Exception {
-        Map<Object, Object> map = new HashMap<>();
-
-        for (int i = 1; i <= 3; i++)
-            map.put(new Key(i), new Value(i));
-
-        jcache().putAll(map);
-
-        checkMap(STORE.map(), 1, 2, 3);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLoad() throws Exception {
-        populateMap(STORE.map(), 1);
-
-        Object val = jcache().get(new Key(1));
-
-        assertTrue(String.valueOf(val), val instanceof Value);
-
-        assertEquals(1, ((Value)val).index());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLoadAll() throws Exception {
-        populateMap(STORE.map(), 1, 2, 3);
-
-        Set<Object> keys = new HashSet<>();
-
-        for (int i = 1; i <= 3; i++)
-            keys.add(new Key(i));
-
-        Map<Object, Object> res = jcache().getAll(keys);
-
-        assertEquals(3, res.size());
-
-        for (int i = 1; i <= 3; i++) {
-            Object val = res.get(new Key(i));
-
-            assertTrue(String.valueOf(val), val instanceof Value);
-
-            assertEquals(i, ((Value)val).index());
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemove() throws Exception {
-        for (int i = 1; i <= 3; i++)
-            jcache().put(new Key(i), new Value(i));
-
-        jcache().remove(new Key(1));
-
-        checkMap(STORE.map(), 2, 3);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemoveAll() throws Exception {
-        for (int i = 1; i <= 3; i++)
-            jcache().put(new Key(i), new Value(i));
-
-        jcache().removeAll(ImmutableSet.of(new Key(1), new Key(2)));
-
-        checkMap(STORE.map(), 3);
-    }
-
-    /**
-     * @param map Map.
-     * @param idxs Indexes.
-     */
-    protected abstract void populateMap(Map<Object, Object> map, int... idxs);
-
-    /**
-     * @param map Map.
-     * @param idxs Indexes.
-     */
-    protected abstract void checkMap(Map<Object, Object> map, int... idxs);
-
-    /**
-     */
-    protected static class Key {
-        /** */
-        private int idx;
-
-        /**
-         * @param idx Index.
-         */
-        public Key(int idx) {
-            this.idx = idx;
-        }
-
-        /**
-         * @return Index.
-         */
-        int index() {
-            return idx;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            Key key = (Key)o;
-
-            return idx == key.idx;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return idx;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return "Key [idx=" + idx + ']';
-        }
-    }
-
-    /**
-     */
-    protected static class Value {
-        /** */
-        private int idx;
-
-        /**
-         * @param idx Index.
-         */
-        public Value(int idx) {
-            this.idx = idx;
-        }
-
-        /**
-         * @return Index.
-         */
-        int index() {
-            return idx;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return "Value [idx=" + idx + ']';
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestStore extends CacheStoreAdapter<Object, Object> {
-        /** */
-        private final Map<Object, Object> map = new ConcurrentHashMap8<>();
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Object load(Object key) {
-            return map.get(key);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void write(Cache.Entry<?, ?> e) {
-            map.put(e.getKey(), e.getValue());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void delete(Object key) {
-            map.remove(key);
-        }
-
-        /**
-         * @return Map.
-         */
-        Map<Object, Object> map() {
-            return map;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java
deleted file mode 100644
index 1c1c99e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStoreObjectsSelfTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.util.Map;
-
-/**
- * Tests for cache store with portables.
- */
-public class GridCachePortableStoreObjectsSelfTest extends GridCachePortableStoreAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean keepPortableInStore() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void populateMap(Map<Object, Object> map, int... idxs) {
-        assert map != null;
-        assert idxs != null;
-
-        for (int idx : idxs)
-            map.put(new Key(idx), new Value(idx));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void checkMap(Map<Object, Object> map, int... idxs) {
-        assert map != null;
-        assert idxs != null;
-
-        assertEquals(idxs.length, map.size());
-
-        for (int idx : idxs) {
-            Object val = map.get(new Key(idx));
-
-            assertTrue(String.valueOf(val), val instanceof Value);
-
-            assertEquals(idx, ((Value)val).index());
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java
deleted file mode 100644
index 5c0fc8e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCachePortableStorePortablesSelfTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.util.Map;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Tests for cache store with portables.
- */
-public class GridCachePortableStorePortablesSelfTest extends GridCachePortableStoreAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean keepPortableInStore() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void populateMap(Map<Object, Object> map, int... idxs) {
-        assert map != null;
-        assert idxs != null;
-
-        for (int idx : idxs)
-            map.put(portable(new Key(idx)), portable(new Value(idx)));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void checkMap(Map<Object, Object> map, int... idxs) {
-        assert map != null;
-        assert idxs != null;
-
-        assertEquals(idxs.length, map.size());
-
-        for (int idx : idxs) {
-            Object val = map.get(portable(new Key(idx)));
-
-            assertTrue(String.valueOf(val), val instanceof PortableObject);
-
-            PortableObject po = (PortableObject)val;
-
-            assertEquals("Value", po.metaData().typeName());
-            assertEquals(new Integer(idx), po.field("idx"));
-        }
-    }
-
-    /**
-     * @param obj Object.
-     * @return Portable object.
-     */
-    private Object portable(Object obj) {
-        return grid().portables().toPortable(obj);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java
deleted file mode 100644
index 0db650e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableCacheEntryMemorySizeSelfTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.internal.portable.PortableMetaDataHandler;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-
-/**
- *
- */
-public class GridPortableCacheEntryMemorySizeSelfTest extends GridCacheEntryMemorySizeSelfTest {
-    /** {@inheritDoc} */
-    @Override protected Marshaller createMarshaller() throws IgniteCheckedException {
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setContext(new MarshallerContextTestImpl(null));
-
-        PortableContext pCtx = new PortableContext(new PortableMetaDataHandler() {
-            @Override public void addMeta(int typeId, PortableMetadata meta) throws PortableException {
-                // No-op
-            }
-
-            @Override public PortableMetadata metadata(int typeId) throws PortableException {
-                return null;
-            }
-        }, null);
-
-        IgniteUtils.invoke(PortableMarshaller.class, marsh, "setPortableContext", pCtx);
-
-        return marsh;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java
deleted file mode 100644
index a1a623b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridPortableDuplicateIndexObjectsAbstractSelfTest.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAbstractSelfTest;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Tests that portable object is the same in cache entry and in index.
- */
-public abstract class GridPortableDuplicateIndexObjectsAbstractSelfTest extends GridCacheAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 1;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Collections.singletonList(TestPortable.class.getName()));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
-        CacheConfiguration ccfg = super.cacheConfiguration(gridName);
-
-        ccfg.setCopyOnRead(false);
-
-        CacheTypeMetadata meta = new CacheTypeMetadata();
-
-        meta.setKeyType(Integer.class);
-        meta.setValueType(TestPortable.class.getName());
-
-        Map<String, Class<?>> idx = new HashMap<>();
-
-        idx.put("fieldOne", String.class);
-        idx.put("fieldTwo", Integer.class);
-
-        meta.setAscendingFields(idx);
-
-        ccfg.setTypeMetadata(Collections.singletonList(meta));
-
-        return ccfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override public abstract CacheAtomicityMode atomicityMode();
-
-    /** {@inheritDoc} */
-    @Override public abstract CacheMode cacheMode();
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIndexReferences() throws Exception {
-        IgniteCache<Integer, TestPortable> cache = grid(0).cache(null);
-
-        String fieldOneVal = "123";
-        int fieldTwoVal = 123;
-        int key = 0;
-
-        cache.put(key, new TestPortable(fieldOneVal, fieldTwoVal));
-
-        IgniteCache<Integer, PortableObject> prj = grid(0).cache(null).withKeepPortable();
-
-        PortableObject cacheVal = prj.get(key);
-
-        assertEquals(fieldOneVal, cacheVal.field("fieldOne"));
-        assertEquals(new Integer(fieldTwoVal), cacheVal.field("fieldTwo"));
-
-        List<?> row = F.first(prj.query(new SqlFieldsQuery("select _val from " +
-            "TestPortable where _key = ?").setArgs(key)).getAll());
-
-        assertEquals(1, row.size());
-
-        PortableObject qryVal = (PortableObject)row.get(0);
-
-        assertEquals(fieldOneVal, qryVal.field("fieldOne"));
-        assertEquals(new Integer(fieldTwoVal), qryVal.field("fieldTwo"));
-        assertSame(cacheVal, qryVal);
-    }
-
-    /**
-     * Test portable object.
-     */
-    private static class TestPortable {
-        /** */
-        private String fieldOne;
-
-        /** */
-        private int fieldTwo;
-
-        /**
-         *
-         */
-        private TestPortable() {
-            // No-op.
-        }
-
-        /**
-         * @param fieldOne Field one.
-         * @param fieldTwo Field two.
-         */
-        private TestPortable(String fieldOne, int fieldTwo) {
-            this.fieldOne = fieldOne;
-            this.fieldTwo = fieldTwo;
-        }
-
-        /**
-         * @return Field one.
-         */
-        public String fieldOne() {
-            return fieldOne;
-        }
-
-        /**
-         * @return Field two.
-         */
-        public int fieldTwo() {
-            return fieldTwo;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
deleted file mode 100644
index 836440a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/DataStreamProcessorPortableSelfTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.datastreaming;
-
-import java.util.Collection;
-import java.util.Map;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.stream.StreamReceiver;
-
-/**
- *
- */
-public class DataStreamProcessorPortableSelfTest extends DataStreamProcessorSelfTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected StreamReceiver<String, TestObject> getStreamReceiver() {
-        return new TestDataReceiver();
-    }
-
-    /**
-     *
-     */
-    private static class TestDataReceiver implements StreamReceiver<String, TestObject> {
-        /** {@inheritDoc} */
-        @Override public void receive(IgniteCache<String, TestObject> cache,
-            Collection<Map.Entry<String, TestObject>> entries) {
-            for (Map.Entry<String, TestObject> e : entries) {
-                assertTrue(e.getKey() instanceof String);
-                assertTrue(e.getValue() instanceof PortableObject);
-
-                TestObject obj = ((PortableObject)e.getValue()).deserialize();
-
-                cache.put(e.getKey(), new TestObject(obj.val + 1));
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java
deleted file mode 100644
index 2f7bdb0..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/datastreaming/GridDataStreamerImplSelfTest.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.datastreaming;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.Random;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.internal.util.typedef.G;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Tests for {@code IgniteDataStreamerImpl}.
- */
-public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Number of keys to load via data streamer. */
-    private static final int KEYS_COUNT = 1000;
-
-    /** Flag indicating should be cache configured with portables or not.  */
-    private static boolean portables;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        if (portables) {
-            PortableMarshaller marsh = new PortableMarshaller();
-
-            cfg.setMarshaller(marsh);
-        }
-
-        cfg.setCacheConfiguration(cacheConfiguration());
-
-        return cfg;
-    }
-
-    /**
-     * Gets cache configuration.
-     *
-     * @return Cache configuration.
-     */
-    private CacheConfiguration cacheConfiguration() {
-        CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
-        cacheCfg.setCacheMode(PARTITIONED);
-        cacheCfg.setNearConfiguration(null);
-        cacheCfg.setBackups(0);
-        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        return cacheCfg;
-    }
-
-    /**
-     * Data streamer should correctly load entries from HashMap in case of grids with more than one node
-     *  and with GridOptimizedMarshaller that requires serializable.
-     *
-     * @throws Exception If failed.
-     */
-    public void testAddDataFromMap() throws Exception {
-        try {
-            portables = false;
-
-            startGrids(2);
-
-            awaitPartitionMapExchange();
-
-            Ignite g0 = grid(0);
-
-            IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(null);
-
-            Map<Integer, String> map = U.newHashMap(KEYS_COUNT);
-
-            for (int i = 0; i < KEYS_COUNT; i ++)
-                map.put(i, String.valueOf(i));
-
-            dataLdr.addData(map);
-
-            dataLdr.close();
-
-            checkDistribution(grid(0));
-
-            checkDistribution(grid(1));
-
-            // Check several random keys in cache.
-            Random rnd = new Random();
-
-            IgniteCache<Integer, String> c0 = g0.cache(null);
-
-            for (int i = 0; i < 100; i ++) {
-                Integer k = rnd.nextInt(KEYS_COUNT);
-
-                String v = c0.get(k);
-
-                assertEquals(k.toString(), v);
-            }
-        }
-        finally {
-            G.stopAll(true);
-        }
-    }
-
-    /**
-     * Data streamer should add portable object that weren't registered explicitly.
-     *
-     * @throws Exception If failed.
-     */
-    public void testAddMissingPortable() throws Exception {
-        try {
-            portables = true;
-
-            startGrids(2);
-
-            awaitPartitionMapExchange();
-
-            Ignite g0 = grid(0);
-
-            IgniteDataStreamer<Integer, TestObject2> dataLdr = g0.dataStreamer(null);
-
-            dataLdr.perNodeBufferSize(1);
-            dataLdr.autoFlushFrequency(1L);
-
-            Map<Integer, TestObject2> map = U.newHashMap(KEYS_COUNT);
-
-            for (int i = 0; i < KEYS_COUNT; i ++)
-                map.put(i, new TestObject2(i));
-
-            dataLdr.addData(map).get();
-
-            dataLdr.close();
-        }
-        finally {
-            G.stopAll(true);
-        }
-    }
-
-    /**
-     * Data streamer should correctly load portable entries from HashMap in case of grids with more than one node
-     *  and with GridOptimizedMarshaller that requires serializable.
-     *
-     * @throws Exception If failed.
-     */
-    public void testAddPortableDataFromMap() throws Exception {
-        try {
-            portables = true;
-
-            startGrids(2);
-
-            awaitPartitionMapExchange();
-
-            Ignite g0 = grid(0);
-
-            IgniteDataStreamer<Integer, TestObject> dataLdr = g0.dataStreamer(null);
-
-            Map<Integer, TestObject> map = U.newHashMap(KEYS_COUNT);
-
-            for (int i = 0; i < KEYS_COUNT; i ++)
-                map.put(i, new TestObject(i));
-
-            dataLdr.addData(map);
-
-            dataLdr.close(false);
-
-            checkDistribution(grid(0));
-
-            checkDistribution(grid(1));
-
-            // Read random keys. Take values as TestObject.
-            Random rnd = new Random();
-
-            IgniteCache<Integer, TestObject> c = g0.cache(null);
-
-            for (int i = 0; i < 100; i ++) {
-                Integer k = rnd.nextInt(KEYS_COUNT);
-
-                TestObject v = c.get(k);
-
-                assertEquals(k, v.val());
-            }
-
-            // Read random keys. Take values as PortableObject.
-            IgniteCache<Integer, PortableObject> c2 = ((IgniteCacheProxy)c).keepPortable();
-
-            for (int i = 0; i < 100; i ++) {
-                Integer k = rnd.nextInt(KEYS_COUNT);
-
-                PortableObject v = c2.get(k);
-
-                assertEquals(k, v.field("val"));
-            }
-        }
-        finally {
-            G.stopAll(true);
-        }
-    }
-
-    /**
-     * Check that keys correctly destributed by nodes after data streamer.
-     *
-     * @param g Grid to check.
-     */
-    private void checkDistribution(Ignite g) {
-        ClusterNode n = g.cluster().localNode();
-        IgniteCache c = g.cache(null);
-
-        // Check that data streamer correctly split data by nodes.
-        for (int i = 0; i < KEYS_COUNT; i ++) {
-            if (g.affinity(null).isPrimary(n, i))
-                assertNotNull(c.localPeek(i, CachePeekMode.ONHEAP));
-            else
-                assertNull(c.localPeek(i, CachePeekMode.ONHEAP));
-        }
-    }
-
-    /**
-     */
-    private static class TestObject implements PortableMarshalAware, Serializable {
-        /** */
-        private int val;
-
-        /**
-         *
-         */
-        private TestObject() {
-            // No-op.
-        }
-
-        /**
-         * @param val Value.
-         */
-        private TestObject(int val) {
-            this.val = val;
-        }
-
-        public Integer val() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object obj) {
-            return obj instanceof TestObject && ((TestObject)obj).val == val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeInt("val", val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            val = reader.readInt("val");
-        }
-    }
-
-    /**
-     */
-    private static class TestObject2 implements PortableMarshalAware, Serializable {
-        /** */
-        private int val;
-
-        /**
-         */
-        private TestObject2() {
-            // No-op.
-        }
-
-        /**
-         * @param val Value.
-         */
-        private TestObject2(int val) {
-            this.val = val;
-        }
-
-        public Integer val() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object obj) {
-            return obj instanceof TestObject2 && ((TestObject2)obj).val == val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException {
-            writer.writeInt("val", val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException {
-            val = reader.readInt("val");
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java
deleted file mode 100644
index 155ba48..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAffinityRoutingPortableSelfTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-import java.util.Collections;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.processors.cache.GridCacheAffinityRoutingSelfTest;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-
-/**
- *
- */
-public class GridCacheAffinityRoutingPortableSelfTest extends GridCacheAffinityRoutingSelfTest {
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration();
-
-        typeCfg.setClassName(AffinityTestKey.class.getName());
-        typeCfg.setAffinityKeyFieldName("affKey");
-
-        PortableMarshaller marsh = new PortableMarshaller();
-
-        marsh.setTypeConfigurations(Collections.singleton(typeCfg));
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/71379a80/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java
deleted file mode 100644
index b3b988e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/distributed/dht/GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.portable.distributed.dht;
-
-/**
- *
- */
-public class GridCacheAtomicPartitionedOnlyPortableDataStreamerMultiNodeSelfTest extends
-    GridCacheAtomicPartitionedOnlyPortableDataStreamerMultithreadedSelfTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 4;
-    }
-}
\ No newline at end of file


[37/41] ignite git commit: Minor docs improvement.

Posted by ag...@apache.org.
Minor docs improvement.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c01313d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c01313d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c01313d4

Branch: refs/heads/ignite-1400
Commit: c01313d4609bb9a4209e2026b24b09df12935d75
Parents: a0cd9af
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Sep 14 17:33:37 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Sep 14 17:33:37 2015 +0300

----------------------------------------------------------------------
 .../processors/platform/services/PlatformAbstractService.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c01313d4/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
index dd5c28a..0b9ee53 100644
--- a/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
+++ b/modules/platform/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java
@@ -212,9 +212,8 @@ public abstract class PlatformAbstractService implements PlatformService, Extern
     @SuppressWarnings("UnusedDeclaration")
     @IgniteInstanceResource
     public void setIgniteInstance(Ignite ignite) {
-        platformCtx = ignite != null
-            ? PlatformUtils.platformContext(ignite)
-            : null;
+        // Ignite instance can be null here because service processor invokes "cleanup" on resource manager.
+        platformCtx = ignite != null ? PlatformUtils.platformContext(ignite) : null;
     }
 
     /** {@inheritDoc} */


[40/41] ignite git commit: IGNITE-1239 - Added test for reopened ticket.

Posted by ag...@apache.org.
IGNITE-1239 - Added test for reopened ticket.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/866fb415
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/866fb415
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/866fb415

Branch: refs/heads/ignite-1400
Commit: 866fb41525957555231fca11c5853731b9473170
Parents: 06fdd7d
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 16:09:37 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 16:09:37 2015 -0700

----------------------------------------------------------------------
 ...CacheScanPartitionQueryFallbackSelfTest.java | 105 ++++++++++++++++++-
 1 file changed, 104 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/866fb415/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index cb3a3bf..df310b4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -26,13 +26,19 @@ import java.util.TreeSet;
 import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.Cache;
 import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -48,6 +54,7 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryAdapter;
 import org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteClosure;
 import org.apache.ignite.lang.IgniteInClosure;
@@ -67,7 +74,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     private static final int GRID_CNT = 3;
 
     /** Keys count. */
-    private static final int KEYS_CNT = 5000;
+    private static final int KEYS_CNT = 50 * RendezvousAffinityFunction.DFLT_PARTITION_COUNT;
 
     /** Ip finder. */
     private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
@@ -261,6 +268,79 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     }
 
     /**
+     * Scan should activate fallback mechanism when new nodes join topology and rebalancing happens in parallel with
+     * scan query.
+     *
+     * @throws Exception In case of error.
+     */
+    public void testScanFallbackOnRebalancingCursor() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-1239");
+
+        cacheMode = CacheMode.PARTITIONED;
+        clientMode = false;
+        backups = 1;
+        commSpiFactory = new TestFallbackOnRebalancingCommunicationSpiFactory();
+
+        try {
+            Ignite ignite = startGrids(GRID_CNT);
+
+            fillCache(ignite);
+
+            final AtomicBoolean done = new AtomicBoolean(false);
+
+            IgniteInternalFuture fut1 = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        for (int i = 0; i < 5; i++) {
+                            startGrid(GRID_CNT + i);
+
+                            U.sleep(500);
+                        }
+
+                        done.set(true);
+
+                        return null;
+                    }
+                }, 1);
+
+            final AtomicInteger nodeIdx = new AtomicInteger();
+
+            IgniteInternalFuture fut2 = multithreadedAsync(
+                new Callable<Object>() {
+                    @Override public Object call() throws Exception {
+                        int nodeId = nodeIdx.getAndIncrement();
+
+                        IgniteCache<Integer, Integer> cache = grid(nodeId).cache(null);
+
+                        while (!done.get()) {
+                            int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
+
+                            try {
+                                QueryCursor<Cache.Entry<Integer, Integer>> cur =
+                                    cache.query(new ScanQuery<Integer, Integer>(part));
+
+                                U.debug(log, "Running query [node=" + nodeId + ", part=" + part + ']');
+
+                                doTestScanQueryCursor(cur, part);
+                            }
+                            catch (ClusterGroupEmptyCheckedException e) {
+                                log.warning("Invalid partition: " + part, e);
+                            }
+                        }
+
+                        return null;
+                    }
+                }, GRID_CNT);
+
+            fut1.get();
+            fut2.get();
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
      * Scan should try first remote node and fallbacks to second remote node.
      *
      * @throws Exception If failed.
@@ -391,6 +471,29 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
     }
 
     /**
+     * @param cur Query cursor.
+     * @param part Partition number.
+     */
+    protected void doTestScanQueryCursor(
+        QueryCursor<Cache.Entry<Integer, Integer>> cur, int part) throws IgniteCheckedException {
+
+        Map<Integer, Integer> map = entries.get(part);
+
+        assert map != null;
+
+        int cnt = 0;
+
+        for (Cache.Entry<Integer, Integer> e : cur) {
+
+            assertEquals(map.get(e.getKey()), e.getValue());
+
+            cnt++;
+        }
+
+        assertEquals("Invalid number of entries for partition: " + part, map.size(), cnt);
+    }
+
+    /**
      * @param cctx Cctx.
      */
     private static int anyLocalPartition(GridCacheContext<?, ?> cctx) {


[17/41] ignite git commit: ignite-1250 JDBC driver: migration to embedded Ignite client node

Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
new file mode 100644
index 0000000..7898bc8
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Statement test.
+ */
+public class JdbcStatementSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** JDBC URL. */
+    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+
+    /** SQL query. */
+    private static final String SQL = "select * from Person where age > 30";
+
+    /** Connection. */
+    private Connection conn;
+
+    /** Statement. */
+    private Statement stmt;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration<?,?> cache = defaultCacheConfiguration();
+
+        cache.setCacheMode(PARTITIONED);
+        cache.setBackups(1);
+        cache.setWriteSynchronizationMode(FULL_SYNC);
+        cache.setIndexedTypes(
+            String.class, Person.class
+        );
+
+        cfg.setCacheConfiguration(cache);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(3);
+
+        IgniteCache<String, Person> cache = grid(0).cache(null);
+
+        assert cache != null;
+
+        cache.put("p1", new Person(1, "John", "White", 25));
+        cache.put("p2", new Person(2, "Joe", "Black", 35));
+        cache.put("p3", new Person(3, "Mike", "Green", 40));
+
+        Class.forName("org.apache.ignite.IgniteJdbcDriver");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        conn = DriverManager.getConnection(BASE_URL);
+        stmt = conn.createStatement();
+
+        assertNotNull(stmt);
+        assertFalse(stmt.isClosed());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        if (stmt != null && !stmt.isClosed())
+            stmt.close();
+
+        conn.close();
+
+        assertTrue(stmt.isClosed());
+        assertTrue(conn.isClosed());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testExecuteQuery() throws Exception {
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            int id = rs.getInt("id");
+
+            if (id == 2) {
+                assert "Joe".equals(rs.getString("firstName"));
+                assert "Black".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 35;
+            }
+            else if (id == 3) {
+                assert "Mike".equals(rs.getString("firstName"));
+                assert "Green".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 40;
+            }
+            else
+                assert false : "Wrong ID: " + id;
+
+            cnt++;
+        }
+
+        assert cnt == 2;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testExecute() throws Exception {
+        assert stmt.execute(SQL);
+
+        ResultSet rs = stmt.getResultSet();
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            int id = rs.getInt("id");
+
+            if (id == 2) {
+                assert "Joe".equals(rs.getString("firstName"));
+                assert "Black".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 35;
+            }
+            else if (id == 3) {
+                assert "Mike".equals(rs.getString("firstName"));
+                assert "Green".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 40;
+            }
+            else
+                assert false : "Wrong ID: " + id;
+
+            cnt++;
+        }
+
+        assert cnt == 2;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMaxRows() throws Exception {
+        stmt.setMaxRows(1);
+
+        ResultSet rs = stmt.executeQuery(SQL);
+
+        assert rs != null;
+
+        int cnt = 0;
+
+        while (rs.next()) {
+            int id = rs.getInt("id");
+
+            if (id == 2) {
+                assert "Joe".equals(rs.getString("firstName"));
+                assert "Black".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 35;
+            }
+            else if (id == 3) {
+                assert "Mike".equals(rs.getString("firstName"));
+                assert "Green".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 40;
+            }
+            else
+                assert false : "Wrong ID: " + id;
+
+            cnt++;
+        }
+
+        assert cnt == 1;
+
+        stmt.setMaxRows(0);
+
+        rs = stmt.executeQuery(SQL);
+
+        assert rs != null;
+
+        cnt = 0;
+
+        while (rs.next()) {
+            int id = rs.getInt("id");
+
+            if (id == 2) {
+                assert "Joe".equals(rs.getString("firstName"));
+                assert "Black".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 35;
+            }
+            else if (id == 3) {
+                assert "Mike".equals(rs.getString("firstName"));
+                assert "Green".equals(rs.getString("lastName"));
+                assert rs.getInt("age") == 40;
+            }
+            else
+                assert false : "Wrong ID: " + id;
+
+            cnt++;
+        }
+
+        assert cnt == 2;
+    }
+
+    /**
+     * Person.
+     */
+    @SuppressWarnings("UnusedDeclaration")
+    private static class Person implements Serializable {
+        /** ID. */
+        @QuerySqlField
+        private final int id;
+
+        /** First name. */
+        @QuerySqlField(index = false)
+        private final String firstName;
+
+        /** Last name. */
+        @QuerySqlField(index = false)
+        private final String lastName;
+
+        /** Age. */
+        @QuerySqlField
+        private final int age;
+
+        /**
+         * @param id ID.
+         * @param firstName First name.
+         * @param lastName Last name.
+         * @param age Age.
+         */
+        private Person(int id, String firstName, String lastName, int age) {
+            assert !F.isEmpty(firstName);
+            assert !F.isEmpty(lastName);
+            assert age > 0;
+
+            this.id = id;
+            this.firstName = firstName;
+            this.lastName = lastName;
+            this.age = age;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index b0c0c58..bac2f60 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -38,6 +38,7 @@ public class IgniteJdbcDriverTestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Ignite JDBC Driver Test Suite");
 
+        // Thin client based driver tests
         suite.addTest(new TestSuite(JdbcConnectionSelfTest.class));
         suite.addTest(new TestSuite(JdbcStatementSelfTest.class));
         suite.addTest(new TestSuite(JdbcPreparedStatementSelfTest.class));
@@ -47,6 +48,16 @@ public class IgniteJdbcDriverTestSuite extends TestSuite {
         suite.addTest(new TestSuite(JdbcEmptyCacheSelfTest.class));
         suite.addTest(new TestSuite(JdbcLocalCachesSelfTest.class));
 
+        // Ignite client node based driver tests
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcConnectionSelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcStatementSelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcPreparedStatementSelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcResultSetSelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcComplexQuerySelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcMetadataSelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcEmptyCacheSelfTest.class));
+        suite.addTest(new TestSuite(org.apache.ignite.internal.jdbc2.JdbcLocalCachesSelfTest.class));
+
         return suite;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
index 6ba362e..7f8b523 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteJdbcDriver.java
@@ -17,17 +17,19 @@
 
 package org.apache.ignite;
 
-
 import java.sql.Connection;
 import java.sql.Driver;
 import java.sql.DriverManager;
 import java.sql.DriverPropertyInfo;
 import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Properties;
 import java.util.logging.Logger;
 import org.apache.ignite.cache.affinity.AffinityKey;
 import org.apache.ignite.internal.jdbc.JdbcConnection;
+import org.apache.ignite.logger.java.JavaLogger;
 
 /**
  * JDBC driver implementation for In-Memory Data Grid.
@@ -66,8 +68,47 @@ import org.apache.ignite.internal.jdbc.JdbcConnection;
  * {@code IGNITE_HOME/libs} folder. So if you are using JDBC driver in any external tool,
  * you have to add main Ignite JAR will all dependencies to its classpath.
  * <h1 class="header">Configuration</h1>
- * Internally JDBC driver <b>is based on Ignite Java client</b>. Therefore, all client
- * configuration properties can be applied to JDBC connection.
+ *
+ * JDBC driver can return two different types of connection: Ignite Java client based connection and
+ * Ignite client node based connection. Java client best connection is deprecated and left only for
+ * compatibility with previous version, so you should always use Ignite client node based mode.
+ * It is also preferable because it has much better performance.
+ *
+ * The type of returned connection depends on provided JDBC connection URL.
+ *
+ * <h2 class="header">Configuration of Ignite client node based connection</h2>
+ *
+ * JDBC connection URL has the following pattern: {@code jdbc:ignite:cfg://[<params>@]<config_url>}.<br>
+ *
+ * {@code <config_url>} represents any valid URL which points to Ignite configuration file. It is required.<br>
+ *
+ * {@code <params>} are optional and have the following format: {@code param1=value1:param2=value2:...:paramN=valueN}.<br>
+ *
+ * The following parameters are supported:
+ * <ul>
+ *     <li>{@code cache} - cache name. If it is not defined than default cache will be used.</li>
+ *     <li>
+ *         {@code nodeId} - ID of node where query will be executed.
+ *         It can be useful for querying through local caches.
+ *         If node with provided ID doesn't exist, exception is thrown.
+ *     </li>
+ *     <li>
+ *         {@code local} - query will be executed only on local node. Use this parameter with {@code nodeId} parameter.
+ *         Default value is {@code false}.
+ *     </li>
+ *     <li>
+ *          {@code collocated} - flag that used for optimization purposes. Whenever Ignite executes
+ *          a distributed query, it sends sub-queries to individual cluster members.
+ *          If you know in advance that the elements of your query selection are collocated
+ *          together on the same node, usually based on some <b>affinity-key</b>, Ignite
+ *          can make significant performance and network optimizations.
+ *          Default value is {@code false}.
+ *     </li>
+ * </ul>
+ *
+ * <h2 class="header">Configuration of Ignite Java client based connection</h2>
+ *
+ * All Ignite Java client configuration properties can be applied to JDBC connection of this type.
  * <p>
  * JDBC connection URL has the following pattern:
  * {@code jdbc:ignite://<hostname>:<port>/<cache_name>?nodeId=<UUID>}<br>
@@ -197,10 +238,10 @@ import org.apache.ignite.internal.jdbc.JdbcConnection;
  * <h1 class="header">Example</h1>
  * <pre name="code" class="java">
  * // Register JDBC driver.
- * Class.forName("org.apache.ignite.jdbc.IgniteJdbcDriver");
+ * Class.forName("org.apache.ignite.IgniteJdbcDriver");
  *
  * // Open JDBC connection.
- * Connection conn = DriverManager.getConnection("jdbc:ignite://localhost/cache");
+ * Connection conn = DriverManager.getConnection("jdbc:ignite:cfg//cache=persons@file:///etc/configs/ignite-jdbc.xml");
  *
  * // Query persons' names
  * ResultSet rs = conn.createStatement().executeQuery("select name from Person");
@@ -231,6 +272,18 @@ public class IgniteJdbcDriver implements Driver {
     /** Prefix for property names. */
     private static final String PROP_PREFIX = "ignite.jdbc.";
 
+    /** Node ID parameter name. */
+    private static final String PARAM_NODE_ID = "nodeId";
+
+    /** Cache parameter name. */
+    private static final String PARAM_CACHE = "cache";
+
+    /** Local parameter name. */
+    private static final String PARAM_LOCAL = "local";
+
+    /** Collocated parameter name. */
+    private static final String PARAM_COLLOCATED = "collocated";
+
     /** Hostname property name. */
     public static final String PROP_HOST = PROP_PREFIX + "host";
 
@@ -238,14 +291,26 @@ public class IgniteJdbcDriver implements Driver {
     public static final String PROP_PORT = PROP_PREFIX + "port";
 
     /** Cache name property name. */
-    public static final String PROP_CACHE = PROP_PREFIX + "cache";
+    public static final String PROP_CACHE = PROP_PREFIX + PARAM_CACHE;
 
     /** Node ID property name. */
-    public static final String PROP_NODE_ID = PROP_PREFIX + "nodeId";
+    public static final String PROP_NODE_ID = PROP_PREFIX + PARAM_NODE_ID;
+
+    /** Local property name. */
+    public static final String PROP_LOCAL = PROP_PREFIX + PARAM_LOCAL;
+
+    /** Collocated property name. */
+    public static final String PROP_COLLOCATED = PROP_PREFIX + PARAM_COLLOCATED;
+
+    /** Cache name property name. */
+    public static final String PROP_CFG = PROP_PREFIX + "cfg";
 
     /** URL prefix. */
     public static final String URL_PREFIX = "jdbc:ignite://";
 
+    /** Config URL prefix. */
+    public static final String CFG_URL_PREFIX = "jdbc:ignite:cfg://";
+
     /** Default port. */
     public static final int DFLT_PORT = 11211;
 
@@ -255,6 +320,9 @@ public class IgniteJdbcDriver implements Driver {
     /** Minor version. */
     private static final int MINOR_VER = 0;
 
+    /** Logger. */
+    private static final IgniteLogger LOG = new JavaLogger();
+
     /**
      * Register driver.
      */
@@ -272,12 +340,19 @@ public class IgniteJdbcDriver implements Driver {
         if (!parseUrl(url, props))
             throw new SQLException("URL is invalid: " + url);
 
-        return new JdbcConnection(url, props);
+        if (url.startsWith(URL_PREFIX)) {
+            if (props.getProperty(PROP_CFG) != null)
+                LOG.warning(PROP_CFG + " property is not applicable for this URL.");
+
+            return new JdbcConnection(url, props);
+        }
+        else
+            return new org.apache.ignite.internal.jdbc2.JdbcConnection(url, props);
     }
 
     /** {@inheritDoc} */
     @Override public boolean acceptsURL(String url) throws SQLException {
-        return url.startsWith(URL_PREFIX);
+        return url.startsWith(URL_PREFIX) || url.startsWith(CFG_URL_PREFIX);
     }
 
     /** {@inheritDoc} */
@@ -285,49 +360,72 @@ public class IgniteJdbcDriver implements Driver {
         if (!parseUrl(url, info))
             throw new SQLException("URL is invalid: " + url);
 
-        DriverPropertyInfo[] props = new DriverPropertyInfo[20];
-
-        props[0] = new PropertyInfo("Hostname", info.getProperty(PROP_HOST), true);
-        props[1] = new PropertyInfo("Port number", info.getProperty(PROP_PORT), "");
-        props[2] = new PropertyInfo("Cache name", info.getProperty(PROP_CACHE), "");
-        props[3] = new PropertyInfo("Node ID", info.getProperty(PROP_NODE_ID, ""));
-        props[4] = new PropertyInfo("ignite.client.protocol", info.getProperty("ignite.client.protocol", "TCP"),
-            "Communication protocol (TCP or HTTP).");
-        props[5] = new PropertyInfo("ignite.client.connectTimeout", info.getProperty("ignite.client.connectTimeout", "0"),
-            "Socket connection timeout.");
-        props[6] = new PropertyInfo("ignite.client.tcp.noDelay", info.getProperty("ignite.client.tcp.noDelay", "true"),
-            "Flag indicating whether TCP_NODELAY flag should be enabled for outgoing connections.");
-        props[7] = new PropertyInfo("ignite.client.ssl.enabled", info.getProperty("ignite.client.ssl.enabled", "false"),
-            "Flag indicating that SSL is needed for connection.");
-        props[8] = new PropertyInfo("ignite.client.ssl.protocol", info.getProperty("ignite.client.ssl.protocol", "TLS"),
-            "SSL protocol.");
-        props[9] = new PropertyInfo("ignite.client.ssl.key.algorithm", info.getProperty("ignite.client.ssl.key.algorithm",
-            "SunX509"), "Key manager algorithm.");
-        props[10] = new PropertyInfo("ignite.client.ssl.keystore.location",
-            info.getProperty("ignite.client.ssl.keystore.location", ""),
-            "Key store to be used by client to connect with Ignite topology.");
-        props[11] = new PropertyInfo("ignite.client.ssl.keystore.password",
-            info.getProperty("ignite.client.ssl.keystore.password", ""), "Key store password.");
-        props[12] = new PropertyInfo("ignite.client.ssl.keystore.type", info.getProperty("ignite.client.ssl.keystore.type",
-            "jks"), "Key store type.");
-        props[13] = new PropertyInfo("ignite.client.ssl.truststore.location",
-            info.getProperty("ignite.client.ssl.truststore.location", ""),
-            "Trust store to be used by client to connect with Ignite topology.");
-        props[14] = new PropertyInfo("ignite.client.ssl.keystore.password",
-            info.getProperty("ignite.client.ssl.truststore.password", ""), "Trust store password.");
-        props[15] = new PropertyInfo("ignite.client.ssl.truststore.type", info.getProperty("ignite.client.ssl.truststore.type",
-            "jks"), "Trust store type.");
-        props[16] = new PropertyInfo("ignite.client.credentials", info.getProperty("ignite.client.credentials", ""),
-            "Client credentials used in authentication process.");
-        props[17] = new PropertyInfo("ignite.client.cache.top", info.getProperty("ignite.client.cache.top", "false"),
-            "Flag indicating that topology is cached internally. Cache will be refreshed in the background with " +
-                "interval defined by topologyRefreshFrequency property (see below).");
-        props[18] = new PropertyInfo("ignite.client.topology.refresh", info.getProperty("ignite.client.topology.refresh",
-            "2000"), "Topology cache refresh frequency (ms).");
-        props[19] = new PropertyInfo("ignite.client.idleTimeout", info.getProperty("ignite.client.idleTimeout", "30000"),
-            "Maximum amount of time that connection can be idle before it is closed (ms).");
-
-        return props;
+        List<DriverPropertyInfo> props = Arrays.<DriverPropertyInfo>asList(
+            new PropertyInfo("Hostname", info.getProperty(PROP_HOST), ""),
+            new PropertyInfo("Port number", info.getProperty(PROP_PORT), ""),
+            new PropertyInfo("Cache name", info.getProperty(PROP_CACHE), ""),
+            new PropertyInfo("Node ID", info.getProperty(PROP_NODE_ID), ""),
+            new PropertyInfo("Local", info.getProperty(PROP_LOCAL), ""),
+            new PropertyInfo("Collocated", info.getProperty(PROP_COLLOCATED), "")
+        );
+
+        if (info.getProperty(PROP_CFG) != null)
+            props.add(new PropertyInfo("Configuration path", info.getProperty(PROP_CFG), ""));
+        else
+            props.addAll(Arrays.<DriverPropertyInfo>asList(
+                new PropertyInfo("ignite.client.protocol",
+                    info.getProperty("ignite.client.protocol", "TCP"),
+                    "Communication protocol (TCP or HTTP)."),
+                new PropertyInfo("ignite.client.connectTimeout",
+                    info.getProperty("ignite.client.connectTimeout", "0"),
+                    "Socket connection timeout."),
+                new PropertyInfo("ignite.client.tcp.noDelay",
+                    info.getProperty("ignite.client.tcp.noDelay", "true"),
+                    "Flag indicating whether TCP_NODELAY flag should be enabled for outgoing connections."),
+                new PropertyInfo("ignite.client.ssl.enabled",
+                    info.getProperty("ignite.client.ssl.enabled", "false"),
+                    "Flag indicating that SSL is needed for connection."),
+                new PropertyInfo("ignite.client.ssl.protocol",
+                    info.getProperty("ignite.client.ssl.protocol", "TLS"),
+                    "SSL protocol."),
+                new PropertyInfo("ignite.client.ssl.key.algorithm",
+                    info.getProperty("ignite.client.ssl.key.algorithm", "SunX509"),
+                    "Key manager algorithm."),
+                new PropertyInfo("ignite.client.ssl.keystore.location",
+                    info.getProperty("ignite.client.ssl.keystore.location", ""),
+                    "Key store to be used by client to connect with Ignite topology."),
+                new PropertyInfo("ignite.client.ssl.keystore.password",
+                    info.getProperty("ignite.client.ssl.keystore.password", ""),
+                    "Key store password."),
+                new PropertyInfo("ignite.client.ssl.keystore.type",
+                    info.getProperty("ignite.client.ssl.keystore.type", "jks"),
+                    "Key store type."),
+                new PropertyInfo("ignite.client.ssl.truststore.location",
+                    info.getProperty("ignite.client.ssl.truststore.location", ""),
+                    "Trust store to be used by client to connect with Ignite topology."),
+                new PropertyInfo("ignite.client.ssl.keystore.password",
+                    info.getProperty("ignite.client.ssl.truststore.password", ""),
+                    "Trust store password."),
+                new PropertyInfo("ignite.client.ssl.truststore.type",
+                    info.getProperty("ignite.client.ssl.truststore.type", "jks"),
+                    "Trust store type."),
+                new PropertyInfo("ignite.client.credentials",
+                    info.getProperty("ignite.client.credentials", ""),
+                    "Client credentials used in authentication process."),
+                new PropertyInfo("ignite.client.cache.top",
+                    info.getProperty("ignite.client.cache.top", "false"),
+                    "Flag indicating that topology is cached internally. Cache will be refreshed in the " +
+                        "background with interval defined by topologyRefreshFrequency property (see below)."),
+                new PropertyInfo("ignite.client.topology.refresh",
+                    info.getProperty("ignite.client.topology.refresh", "2000"),
+                    "Topology cache refresh frequency (ms)."),
+                new PropertyInfo("ignite.client.idleTimeout",
+                    info.getProperty("ignite.client.idleTimeout", "30000"),
+                    "Maximum amount of time that connection can be idle before it is closed (ms).")
+                )
+            );
+
+        return props.toArray(new DriverPropertyInfo[0]);
     }
 
     /** {@inheritDoc} */
@@ -358,9 +456,44 @@ public class IgniteJdbcDriver implements Driver {
      * @return Whether URL is valid.
      */
     private boolean parseUrl(String url, Properties props) {
-        if (url == null || !url.startsWith(URL_PREFIX) || url.length() == URL_PREFIX.length())
+        if (url == null)
+            return false;
+
+        if (url.startsWith(URL_PREFIX) && url.length() > URL_PREFIX.length())
+            return parseJdbcUrl(url, props);
+        else if (url.startsWith(CFG_URL_PREFIX) && url.length() > CFG_URL_PREFIX.length())
+            return parseJdbcConfigUrl(url, props);
+
+        return false;
+    }
+
+    /**
+     * @param url Url.
+     * @param props Properties.
+     */
+    private boolean parseJdbcConfigUrl(String url, Properties props) {
+        url = url.substring(CFG_URL_PREFIX.length());
+
+        String[] parts = url.split("@");
+
+        if (parts.length > 2)
             return false;
 
+        if (parts.length == 2) {
+            if (!parseParameters(parts[0], ":", props))
+                return false;
+        }
+
+        props.setProperty(PROP_CFG, parts[parts.length - 1]);
+
+        return true;
+    }
+
+    /**
+     * @param url Url.
+     * @param props Properties.
+     */
+    private boolean parseJdbcUrl(String url, Properties props) {
         url = url.substring(URL_PREFIX.length());
 
         String[] parts = url.split("\\?");
@@ -369,7 +502,7 @@ public class IgniteJdbcDriver implements Driver {
             return false;
 
         if (parts.length == 2)
-            if (!parseUrlParameters(parts[1], props))
+            if (!parseParameters(parts[1], "&", props))
                 return false;
 
         parts = parts[0].split("/");
@@ -406,12 +539,13 @@ public class IgniteJdbcDriver implements Driver {
     /**
      * Validates and parses URL parameters.
      *
-     * @param urlParams URL parameters string.
+     * @param val Parameters string.
+     * @param delim Delimiter.
      * @param props Properties.
      * @return Whether URL parameters string is valid.
      */
-    private boolean parseUrlParameters(String urlParams, Properties props) {
-        String[] params = urlParams.split("&");
+    private boolean parseParameters(String val, String delim, Properties props) {
+        String[] params = val.split(delim);
 
         for (String param : params) {
             String[] pair = param.split("=");
@@ -430,13 +564,6 @@ public class IgniteJdbcDriver implements Driver {
      * convenient constructors.
      */
     private static class PropertyInfo extends DriverPropertyInfo {
-        /**
-         * @param name Name.
-         * @param val Value.
-         */
-        private PropertyInfo(String name, String val) {
-            super(name, val);
-        }
 
         /**
          * @param name Name.
@@ -448,29 +575,5 @@ public class IgniteJdbcDriver implements Driver {
 
             description = desc;
         }
-
-        /**
-         * @param name Name.
-         * @param val Value.
-         * @param required Required flag.
-         */
-        private PropertyInfo(String name, String val, boolean required) {
-            super(name, val);
-
-            this.required = required;
-        }
-
-        /**
-         * @param name Name.
-         * @param val Value.
-         * @param desc Description.
-         * @param required Required flag.
-         */
-        private PropertyInfo(String name, String val, String desc, boolean required) {
-            super(name, val);
-
-            description = desc;
-            this.required = required;
-        }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 546a33d..1e4c8b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -356,6 +356,9 @@ public final class IgniteSystemProperties {
     /** Number of times pending cache objects will be dumped to the log in case of partition exchange timeout. */
     public static final String IGNITE_DUMP_PENDING_OBJECTS_THRESHOLD = "IGNITE_DUMP_PENDING_OBJECTS_THRESHOLD";
 
+    /** JDBC driver cursor remove delay. */
+    public static final String IGNITE_JDBC_DRIVER_CURSOR_REMOVE_DELAY = "IGNITE_JDBC_DRIVER_CURSOR_RMV_DELAY";
+
     /**
      * Enforces singleton.
      */
@@ -517,4 +520,4 @@ public final class IgniteSystemProperties {
     public static Properties snapshot() {
         return (Properties)System.getProperties().clone();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
index 0116ace..a4be6f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
@@ -56,7 +56,11 @@ import static org.apache.ignite.IgniteJdbcDriver.PROP_PORT;
 
 /**
  * JDBC connection implementation.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
+@Deprecated
 public class JdbcConnection implements Connection {
     /** Validation task name. */
     private static final String VALID_TASK_NAME =

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionInfo.java
deleted file mode 100644
index 36fa0aa..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnectionInfo.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.jdbc;
-
-/**
- * Connection properties.
- */
-public class JdbcConnectionInfo {
-    /** URL. */
-    private final String url;
-
-    /** Hostname. */
-    private String hostname;
-
-    /** Port number. */
-    private int port;
-
-    /** Cache name. */
-    private String cacheName;
-
-    /**
-     * @param url URL.
-     */
-    JdbcConnectionInfo(String url) {
-        this.url = url;
-    }
-
-    /**
-     * @return URL.
-     */
-    public String url() {
-        return url;
-    }
-
-    /**
-     * @return Hostname.
-     */
-    public String hostname() {
-        return hostname;
-    }
-
-    /**
-     * @param hostname Hostname.
-     */
-    public void hostname(String hostname) {
-        this.hostname = hostname;
-    }
-
-    /**
-     * @return Port number.
-     */
-    public int port() {
-        return port;
-    }
-
-    /**
-     * @param port Port number.
-     */
-    public void port(int port) {
-        this.port = port;
-    }
-
-    /**
-     * @return Cache name.
-     */
-    public String cacheName() {
-        return cacheName;
-    }
-
-    /**
-     * @param cacheName Cache name.
-     */
-    public void cacheName(String cacheName) {
-        this.cacheName = cacheName;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
index df26412..e2fbe05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
@@ -39,8 +39,12 @@ import static java.sql.RowIdLifetime.ROWID_UNSUPPORTED;
 
 /**
  * JDBC database metadata implementation.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
 @SuppressWarnings("RedundantCast")
+@Deprecated
 public class JdbcDatabaseMetadata implements DatabaseMetaData {
     /** Task name. */
     private static final String TASK_NAME =

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
index 6dfaa18..7e5358b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcPreparedStatement.java
@@ -41,7 +41,11 @@ import java.util.Calendar;
 
 /**
  * JDBC prepared statement implementation.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
+@Deprecated
 public class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement {
     /** SQL query. */
     private final String sql;

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
index 1566006..5961279 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSet.java
@@ -49,7 +49,11 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
  * JDBC result set implementation.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
+@Deprecated
 public class JdbcResultSet implements ResultSet {
     /** Task name. */
     private static final String TASK_NAME =

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java
index afe1d28..75fe522 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcResultSetMetadata.java
@@ -23,7 +23,11 @@ import java.util.List;
 
 /**
  * JDBC result set metadata implementation.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
+@Deprecated
 public class JdbcResultSetMetadata implements ResultSetMetaData {
     /** Column width. */
     private static final int COL_WIDTH = 30;

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
index caa8495..0f4e08c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcStatement.java
@@ -36,7 +36,11 @@ import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
 
 /**
  * JDBC statement implementation.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
+@Deprecated
 public class JdbcStatement implements Statement {
     /** Task name. */
     private static final String TASK_NAME =

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
index 46e3cfa..ecea21f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcUtils.java
@@ -47,7 +47,11 @@ import static java.sql.Types.VARCHAR;
 
 /**
  * Utility methods for JDBC driver.
+ *
+ * @deprecated Using Ignite client node based JDBC driver is preferable.
+ * See documentation of {@link org.apache.ignite.IgniteJdbcDriver} for details.
  */
+@Deprecated
 class JdbcUtils {
     /** Marshaller. */
     private static final Marshaller MARSHALLER = new JdkMarshaller();

http://git-wip-us.apache.org/repos/asf/ignite/blob/ebb9e2e9/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
new file mode 100644
index 0000000..00eb6b5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcConnection.java
@@ -0,0 +1,777 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.jdbc2;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteClientDisconnectedException;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteJdbcDriver;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.compute.ComputeTaskTimeoutException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+import static java.sql.ResultSet.CONCUR_READ_ONLY;
+import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
+import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.apache.ignite.IgniteJdbcDriver.PROP_CACHE;
+import static org.apache.ignite.IgniteJdbcDriver.PROP_CFG;
+import static org.apache.ignite.IgniteJdbcDriver.PROP_COLLOCATED;
+import static org.apache.ignite.IgniteJdbcDriver.PROP_LOCAL;
+import static org.apache.ignite.IgniteJdbcDriver.PROP_NODE_ID;
+
+/**
+ * JDBC connection implementation.
+ */
+public class JdbcConnection implements Connection {
+    /**
+     * Ignite nodes cache.
+     *
+     * The key is result of concatenation of the following properties:
+     * <ol>
+     *     <li>{@link IgniteJdbcDriver#PROP_CFG}</li>
+     * </ol>
+     */
+    private static final ConcurrentMap<String, IgniteNodeFuture> NODES = new ConcurrentHashMap<>();
+
+    /** Ignite ignite. */
+    private final Ignite ignite;
+
+    /** Node key. */
+    private final String cfg;
+
+    /** Cache name. */
+    private String cacheName;
+
+    /** Closed flag. */
+    private boolean closed;
+
+    /** URL. */
+    private String url;
+
+    /** Node ID. */
+    private UUID nodeId;
+
+    /** Local query flag. */
+    private boolean locQry;
+
+    /** Collocated query flag. */
+    private boolean collocatedQry;
+
+    /** Statements. */
+    final Set<JdbcStatement> statements = new HashSet<>();
+
+    /**
+     * Creates new connection.
+     *
+     * @param url Connection URL.
+     * @param props Additional properties.
+     * @throws SQLException In case Ignite node failed to start.
+     */
+    public JdbcConnection(String url, Properties props) throws SQLException {
+        assert url != null;
+        assert props != null;
+
+        this.url = url;
+
+        this.cacheName = props.getProperty(PROP_CACHE);
+        this.locQry = Boolean.parseBoolean(props.getProperty(PROP_LOCAL));
+        this.collocatedQry = Boolean.parseBoolean(props.getProperty(PROP_COLLOCATED));
+
+        String nodeIdProp = props.getProperty(PROP_NODE_ID);
+
+        if (nodeIdProp != null)
+            this.nodeId = UUID.fromString(nodeIdProp);
+
+        try {
+            cfg = props.getProperty(PROP_CFG);
+
+            ignite = getIgnite(cfg);
+
+            if (!isValid(2))
+                throw new SQLException("Client is invalid. Probably cache name is wrong.");
+        }
+        catch (Exception e) {
+            close();
+
+            if (e instanceof SQLException)
+                throw (SQLException)e;
+            else
+                throw new SQLException("Failed to start Ignite node.", e);
+        }
+    }
+
+    /**
+     * @param cfgUrl Config url.
+     */
+    private Ignite getIgnite(String cfgUrl) throws IgniteCheckedException {
+        while (true) {
+            IgniteNodeFuture fut = NODES.get(cfg);
+
+            if (fut == null) {
+                fut = new IgniteNodeFuture();
+
+                IgniteNodeFuture old = NODES.putIfAbsent(cfg, fut);
+
+                if (old != null)
+                    fut = old;
+                else {
+                    try {
+                        Ignite ignite = Ignition.start(loadConfiguration(cfgUrl));
+
+                        fut.onDone(ignite);
+                    }
+                    catch (IgniteException e) {
+                        fut.onDone(e);
+                    }
+
+                    return fut.get();
+                }
+            }
+
+            if (fut.acquire())
+                return fut.get();
+            else
+                NODES.remove(cfg, fut);
+        }
+    }
+
+    /**
+     * @param cfgUrl Config URL.
+     */
+    private IgniteConfiguration loadConfiguration(String cfgUrl) {
+        try {
+            IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap =
+                IgnitionEx.loadConfigurations(cfgUrl);
+
+            IgniteConfiguration cfg = F.first(cfgMap.get1());
+
+            if (cfg.getGridName() == null)
+                cfg.setGridName("ignite-jdbc-driver-" + UUID.randomUUID().toString());
+
+            return cfg;
+        }
+        catch (IgniteCheckedException e) {
+            throw new IgniteException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement createStatement() throws SQLException {
+        return createStatement(TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql) throws SQLException {
+        ensureNotClosed();
+
+        return prepareStatement(sql, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CallableStatement prepareCall(String sql) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String nativeSQL(String sql) throws SQLException {
+        ensureNotClosed();
+
+        return sql;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setAutoCommit(boolean autoCommit) throws SQLException {
+        ensureNotClosed();
+
+        if (!autoCommit)
+            throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean getAutoCommit() throws SQLException {
+        ensureNotClosed();
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void commit() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void rollback() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws SQLException {
+        if (closed)
+            return;
+
+        closed = true;
+
+        IgniteNodeFuture fut = NODES.get(cfg);
+
+        if (fut != null && fut.release()) {
+            NODES.remove(cfg);
+
+            if (ignite != null)
+                ignite.close();
+        }
+
+        for (Iterator<JdbcStatement> it = statements.iterator(); it.hasNext();) {
+            JdbcStatement stmt = it.next();
+
+            stmt.closeInternal();
+
+            it.remove();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isClosed() throws SQLException {
+        return closed;
+    }
+
+    /** {@inheritDoc} */
+    @Override public DatabaseMetaData getMetaData() throws SQLException {
+        ensureNotClosed();
+
+        return new JdbcDatabaseMetadata(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setReadOnly(boolean readOnly) throws SQLException {
+        ensureNotClosed();
+
+        if (!readOnly)
+            throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadOnly() throws SQLException {
+        ensureNotClosed();
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setCatalog(String catalog) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Catalogs are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getCatalog() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTransactionIsolation(int level) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTransactionIsolation() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLWarning getWarnings() throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearWarnings() throws SQLException {
+        ensureNotClosed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement createStatement(int resSetType, int resSetConcurrency) throws SQLException {
+        return createStatement(resSetType, resSetConcurrency, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int resSetType,
+        int resSetConcurrency) throws SQLException {
+        ensureNotClosed();
+
+        return prepareStatement(sql, resSetType, resSetConcurrency, HOLD_CURSORS_OVER_COMMIT);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CallableStatement prepareCall(String sql, int resSetType,
+        int resSetConcurrency) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map<String, Class<?>> getTypeMap() throws SQLException {
+        throw new SQLFeatureNotSupportedException("Types mapping is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Types mapping is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setHoldability(int holdability) throws SQLException {
+        ensureNotClosed();
+
+        if (holdability != HOLD_CURSORS_OVER_COMMIT)
+            throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getHoldability() throws SQLException {
+        ensureNotClosed();
+
+        return HOLD_CURSORS_OVER_COMMIT;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Savepoint setSavepoint() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Savepoint setSavepoint(String name) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void rollback(Savepoint savepoint) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Transactions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Statement createStatement(int resSetType, int resSetConcurrency,
+        int resSetHoldability) throws SQLException {
+        ensureNotClosed();
+
+        if (resSetType != TYPE_FORWARD_ONLY)
+            throw new SQLFeatureNotSupportedException("Invalid result set type (only forward is supported.)");
+
+        if (resSetConcurrency != CONCUR_READ_ONLY)
+            throw new SQLFeatureNotSupportedException("Invalid concurrency (updates are not supported).");
+
+        if (resSetHoldability != HOLD_CURSORS_OVER_COMMIT)
+            throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
+
+        JdbcStatement stmt = new JdbcStatement(this);
+
+        statements.add(stmt);
+
+        return stmt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int resSetType, int resSetConcurrency,
+        int resSetHoldability) throws SQLException {
+        ensureNotClosed();
+
+        if (resSetType != TYPE_FORWARD_ONLY)
+            throw new SQLFeatureNotSupportedException("Invalid result set type (only forward is supported.)");
+
+        if (resSetConcurrency != CONCUR_READ_ONLY)
+            throw new SQLFeatureNotSupportedException("Invalid concurrency (updates are not supported).");
+
+        if (resSetHoldability != HOLD_CURSORS_OVER_COMMIT)
+            throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
+
+        JdbcPreparedStatement stmt = new JdbcPreparedStatement(this, sql);
+
+        statements.add(stmt);
+
+        return stmt;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CallableStatement prepareCall(String sql, int resSetType, int resSetConcurrency,
+        int resSetHoldability) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Callable functions are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, int[] colIndexes) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public PreparedStatement prepareStatement(String sql, String[] colNames) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("Updates are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Clob createClob() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Blob createBlob() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public NClob createNClob() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public SQLXML createSQLXML() throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isValid(int timeout) throws SQLException {
+        ensureNotClosed();
+
+        if (timeout < 0)
+            throw new SQLException("Invalid timeout: " + timeout);
+
+        try {
+            JdbcConnectionValidationTask task = new JdbcConnectionValidationTask(cacheName,
+                nodeId == null ? ignite : null);
+
+            if (nodeId != null) {
+                ClusterGroup grp = ignite.cluster().forServers().forNodeId(nodeId);
+
+                if (grp.nodes().isEmpty())
+                    throw new SQLException("Failed to establish connection with node (is it a server node?): " +
+                        nodeId);
+
+                assert grp.nodes().size() == 1;
+
+                if (grp.node().isDaemon())
+                    throw new SQLException("Failed to establish connection with node (is it a server node?): " +
+                        nodeId);
+
+                IgniteCompute compute = ignite.compute(grp).withAsync();
+
+                compute.call(task);
+
+                return compute.<Boolean>future().get(timeout, SECONDS);
+            }
+            else
+                return task.call();
+        }
+        catch (IgniteClientDisconnectedException | ComputeTaskTimeoutException e) {
+            throw new SQLException("Failed to establish connection.", e);
+        }
+        catch (IgniteException ignored) {
+            return false;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClientInfo(String name, String val) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("Client info is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setClientInfo(Properties props) throws SQLClientInfoException {
+        throw new UnsupportedOperationException("Client info is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getClientInfo(String name) throws SQLException {
+        ensureNotClosed();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Properties getClientInfo() throws SQLException {
+        ensureNotClosed();
+
+        return new Properties();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Struct createStruct(String typeName, Object[] attrs) throws SQLException {
+        ensureNotClosed();
+
+        throw new SQLFeatureNotSupportedException("SQL-specific types are not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+        if (!isWrapperFor(iface))
+            throw new SQLException("Connection is not a wrapper for " + iface.getName());
+
+        return (T)this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+        return iface != null && iface == Connection.class;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setSchema(String schema) throws SQLException {
+        cacheName = schema;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getSchema() throws SQLException {
+        return cacheName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void abort(Executor executor) throws SQLException {
+        close();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void setNetworkTimeout(Executor executor, int ms) throws SQLException {
+        throw new SQLFeatureNotSupportedException("Network timeout is not supported.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getNetworkTimeout() throws SQLException {
+        throw new SQLFeatureNotSupportedException("Network timeout is not supported.");
+    }
+
+    /**
+     * @return Ignite node.
+     */
+    Ignite ignite() {
+        return ignite;
+    }
+
+    /**
+     * @return Cache name.
+     */
+    String cacheName() {
+        return cacheName;
+    }
+
+    /**
+     * @return URL.
+     */
+    String url() {
+        return url;
+    }
+
+    /**
+     * @return Node ID.
+     */
+    UUID nodeId() {
+        return nodeId;
+    }
+
+    /**
+     * @return Local query flag.
+     */
+    boolean isLocalQuery() {
+        return locQry;
+    }
+
+    /**
+     * @return Collocated query flag.
+     */
+    boolean isCollocatedQuery() {
+        return collocatedQry;
+    }
+
+    /**
+     * Ensures that connection is not closed.
+     *
+     * @throws SQLException If connection is closed.
+     */
+    private void ensureNotClosed() throws SQLException {
+        if (closed)
+            throw new SQLException("Connection is closed.");
+    }
+
+    /**
+     * @return Internal statement.
+     * @throws SQLException In case of error.
+     */
+    JdbcStatement createStatement0() throws SQLException {
+        return (JdbcStatement)createStatement();
+    }
+
+    /**
+     * JDBC connection validation task.
+     */
+    private static class JdbcConnectionValidationTask implements IgniteCallable<Boolean> {
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /** Cache name. */
+        private final String cacheName;
+
+        /** Ignite. */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /**
+         * @param cacheName Cache name.
+         * @param ignite Ignite instance.
+         */
+        public JdbcConnectionValidationTask(String cacheName, Ignite ignite) {
+            this.cacheName = cacheName;
+            this.ignite = ignite;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Boolean call() {
+            return ignite.cache(cacheName) != null;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class IgniteNodeFuture extends GridFutureAdapter<Ignite> {
+        /** Reference count. */
+        private final AtomicInteger refCnt = new AtomicInteger(1);
+
+        /**
+         *
+         */
+        public boolean acquire() {
+            while (true) {
+                int cur = refCnt.get();
+
+                if (cur == 0)
+                    return false;
+
+                if (refCnt.compareAndSet(cur, cur + 1))
+                    return true;
+            }
+        }
+
+        /**
+         *
+         */
+        public boolean release() {
+            while (true) {
+                int cur = refCnt.get();
+
+                assert cur > 0;
+
+                if (refCnt.compareAndSet(cur, cur - 1))
+                    // CASed to 0.
+                    return cur == 1;
+            }
+        }
+    }
+}


[23/41] ignite git commit: Disabled test.

Posted by ag...@apache.org.
Disabled test.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/095d4b3f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/095d4b3f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/095d4b3f

Branch: refs/heads/ignite-1400
Commit: 095d4b3f4060832069f6a20efc27abae885db5c0
Parents: 02d398c
Author: sboikov <sb...@gridgain.com>
Authored: Mon Sep 14 11:33:22 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Sep 14 11:33:22 2015 +0300

----------------------------------------------------------------------
 .../distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java     | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/095d4b3f/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
index 71f764b..9e903d1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest2.java
@@ -185,6 +185,8 @@ public class IgniteCacheQueryNodeRestartSelfTest2 extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testRestarts() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-1452");
+
         int duration = 90 * 1000;
         int qryThreadNum = 4;
         int restartThreadsNum = 2; // 4 + 2 = 6 nodes


[03/41] ignite git commit: IGNITE-264 - Check backup node for one-phase transaction when primary node crashes.

Posted by ag...@apache.org.
IGNITE-264 - Check backup node for one-phase transaction when primary node crashes.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1707b68
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1707b68
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1707b68

Branch: refs/heads/ignite-1400
Commit: e1707b6852f9d7c3e4999ea1d3967db68e7d8634
Parents: 071586e
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Sep 10 23:29:33 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Sep 10 23:29:33 2015 -0700

----------------------------------------------------------------------
 .../internal/portable/PortableContext.java      |  18 +-
 .../processors/cache/GridCacheAdapter.java      |   6 +
 .../processors/cache/GridCacheContext.java      |   4 +-
 .../processors/cache/GridCacheIoManager.java    |   4 +-
 .../processors/cache/GridCacheMvcc.java         |   5 +-
 .../distributed/GridCacheTxRecoveryFuture.java  |  11 +-
 .../distributed/GridDistributedCacheEntry.java  |   6 +-
 .../GridDistributedTxFinishRequest.java         |  13 +-
 .../GridDistributedTxRemoteAdapter.java         |  10 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   | 514 +++++++++----------
 .../distributed/dht/GridDhtTxFinishFuture.java  |  15 +-
 .../distributed/dht/GridDhtTxFinishRequest.java |  84 ++-
 .../dht/GridDhtTxFinishResponse.java            |  89 +++-
 .../cache/distributed/dht/GridDhtTxLocal.java   |   4 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |  67 ++-
 .../distributed/dht/GridDhtTxPrepareFuture.java |  32 +-
 .../cache/distributed/dht/GridDhtTxRemote.java  |  40 +-
 .../dht/GridPartitionedGetFuture.java           |   4 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   4 +-
 .../colocated/GridDhtColocatedLockFuture.java   |  11 +-
 .../distributed/near/GridNearLockFuture.java    |  11 +-
 .../distributed/near/GridNearLockRequest.java   |  18 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |  52 +-
 .../GridNearPessimisticTxPrepareFuture.java     |  11 +-
 .../near/GridNearTxFinishFuture.java            | 319 ++++++++++--
 .../near/GridNearTxFinishRequest.java           |  20 +-
 .../cache/distributed/near/GridNearTxLocal.java |  64 +--
 .../distributed/near/GridNearTxRemote.java      |  38 +-
 .../cache/transactions/IgniteTxAdapter.java     |   5 +-
 .../cache/transactions/IgniteTxHandler.java     | 281 +++++-----
 .../transactions/IgniteTxLocalAdapter.java      |  37 +-
 .../cache/transactions/IgniteTxManager.java     |  48 +-
 .../datastructures/DataStructuresProcessor.java | 102 ++--
 .../GridTransactionalCacheQueueImpl.java        |  15 +-
 .../processors/igfs/IgfsFileAffinityRange.java  |   4 +-
 .../portable/GridPortableMetaDataSelfTest.java  |   2 +
 .../CacheStoreUsageMultinodeAbstractTest.java   |  16 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  50 +-
 .../processors/cache/GridCacheMvccSelfTest.java |   4 +-
 .../cache/GridCachePutAllFailoverSelfTest.java  |  28 +-
 .../cache/IgniteCachePutAllRestartTest.java     |   2 +
 .../cache/IgniteInternalCacheTypesTest.java     |   4 +-
 .../cache/IgniteOnePhaseCommitNearSelfTest.java | 243 +++++++++
 ...ridCachePartitionNotLoadedEventSelfTest.java |  27 +-
 .../GridCacheTransformEventSelfTest.java        |   5 +-
 .../dht/GridCacheTxNodeFailureSelfTest.java     | 400 +++++++++++++++
 .../dht/GridNearCacheTxNodeFailureSelfTest.java |  31 ++
 ...gniteAtomicLongChangingTopologySelfTest.java | 283 ++++++++++
 .../near/IgniteCacheNearOnlyTxTest.java         |  14 +-
 .../IgniteCacheFailoverTestSuite.java           |   9 +-
 50 files changed, 2350 insertions(+), 734 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index c64adc8..165ad9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -440,7 +440,7 @@ public class PortableContext implements Externalizable {
         PortableClassDescriptor desc = descByCls.get(cls);
 
         if (desc == null || !desc.registered())
-            desc = registerClassDescriptor(cls);
+            desc = registerClassDescriptor(cls, true);
 
         return desc;
     }
@@ -485,7 +485,7 @@ public class PortableContext implements Externalizable {
         }
 
         if (desc == null) {
-            desc = registerClassDescriptor(cls);
+            desc = registerClassDescriptor(cls, false);
 
             assert desc.typeId() == typeId;
         }
@@ -499,7 +499,7 @@ public class PortableContext implements Externalizable {
      * @param cls Class.
      * @return Class descriptor.
      */
-    private PortableClassDescriptor registerClassDescriptor(Class<?> cls) {
+    private PortableClassDescriptor registerClassDescriptor(Class<?> cls, boolean registerMetadata) {
         PortableClassDescriptor desc;
 
         String clsName = cls.getName();
@@ -525,7 +525,7 @@ public class PortableContext implements Externalizable {
                 desc = old;
         }
         else
-            desc = registerUserClassDescriptor(cls);
+            desc = registerUserClassDescriptor(cls, registerMetadata);
 
         return desc;
     }
@@ -536,9 +536,7 @@ public class PortableContext implements Externalizable {
      * @param cls Class.
      * @return Class descriptor.
      */
-    private PortableClassDescriptor registerUserClassDescriptor(Class<?> cls) {
-        PortableClassDescriptor desc;
-
+    private PortableClassDescriptor registerUserClassDescriptor(Class<?> cls, boolean registerMetadata) {
         boolean registered;
 
         String typeName = typeName(cls.getName());
@@ -555,7 +553,7 @@ public class PortableContext implements Externalizable {
             throw new PortableException("Failed to register class.", e);
         }
 
-        desc = new PortableClassDescriptor(this,
+        PortableClassDescriptor desc = new PortableClassDescriptor(this,
             cls,
             true,
             typeId,
@@ -573,6 +571,10 @@ public class PortableContext implements Externalizable {
         userTypes.put(typeId, desc);
         descByCls.put(cls, desc);
 
+        // TODO uncomment for https://issues.apache.org/jira/browse/IGNITE-1377
+//        if (registerMetadata && isMetaDataEnabled(typeId))
+//            metaHnd.addMeta(typeId, new PortableMetaDataImpl(typeName, desc.fieldsMeta(), null));
+
         return desc;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 79c5e4b..4460a2a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -4230,6 +4230,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                                     try {
                                         return tFut.get();
                                     }
+                                    catch (IgniteTxRollbackCheckedException e) {
+                                        throw e;
+                                    }
                                     catch (IgniteCheckedException e1) {
                                         tx0.rollbackAsync();
 
@@ -4253,6 +4256,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                     try {
                         return tFut.get();
                     }
+                    catch (IgniteTxRollbackCheckedException e) {
+                        throw e;
+                    }
                     catch (IgniteCheckedException e1) {
                         tx0.rollbackAsync();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 3d0f1ae..86ba3e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -480,7 +480,7 @@ public class GridCacheContext<K, V> implements Externalizable {
      * @return {@code True} if should use system transactions which are isolated from user transactions.
      */
     public boolean systemTx() {
-        return cacheType == CacheType.UTILITY;
+        return cacheType == CacheType.UTILITY || (cacheType == CacheType.INTERNAL && transactional());
     }
 
     /**
@@ -1977,4 +1977,4 @@ public class GridCacheContext<K, V> implements Externalizable {
     @Override public String toString() {
         return "GridCacheContext: " + name();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index a935b26..b55c84d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -643,7 +643,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
                 if (!cctx.discovery().alive(node.id()) || !cctx.discovery().pingNode(node.id()))
                     throw new ClusterTopologyCheckedException("Node left grid while sending message to: " + node.id(), e);
 
-                if (cnt == retryCnt)
+                if (cnt == retryCnt || cctx.kernalContext().isStopping())
                     throw e;
                 else if (log.isDebugEnabled())
                     log.debug("Failed to send message to node (will retry): " + node.id());
@@ -1107,4 +1107,4 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
             return res;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
index d1393ce..c2102bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
@@ -527,7 +527,8 @@ public final class GridCacheMvcc {
             /*reenter*/false,
             tx,
             implicitSingle,
-            /*near-local*/false, dhtLoc
+            /*near-local*/false,
+            dhtLoc
         );
 
         cctx.mvcc().addLocal(cand);
@@ -1271,4 +1272,4 @@ public final class GridCacheMvcc {
     @Override public String toString() { // Synchronize to ensure one-thread at a time.
         return S.toString(GridCacheMvcc.class, this);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
index eaaff67..d6f6a18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryFuture.java
@@ -167,7 +167,7 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
                 try {
                     cctx.io().send(nearNodeId, req, tx.ioPolicy());
                 }
-                catch (ClusterTopologyCheckedException e) {
+                catch (ClusterTopologyCheckedException ignore) {
                     fut.onNodeLeft();
                 }
                 catch (IgniteCheckedException e) {
@@ -374,14 +374,11 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
             if (isMini(fut)) {
                 MiniFuture f = (MiniFuture)fut;
 
-                if (f.nodeId().equals(nodeId)) {
+                if (f.nodeId().equals(nodeId))
                     f.onNodeLeft();
-
-                    return true;
-                }
             }
 
-        return false;
+        return true;
     }
 
     /** {@inheritDoc} */
@@ -509,4 +506,4 @@ public class GridCacheTxRecoveryFuture extends GridCompoundIdentityFuture<Boolea
             return S.toString(MiniFuture.class, this, "done", isDone(), "err", error());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index 3fada86..6904e56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -186,8 +186,8 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
         long timeout,
         boolean tx,
         boolean implicitSingle,
-        @Nullable GridCacheVersion owned) throws GridDistributedLockCancelledException,
-        GridCacheEntryRemovedException {
+        @Nullable GridCacheVersion owned
+    ) throws GridDistributedLockCancelledException, GridCacheEntryRemovedException {
         GridCacheMvccCandidate prev;
         GridCacheMvccCandidate owner;
 
@@ -872,4 +872,4 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
     @Override public synchronized String toString() {
         return S.toString(GridDistributedCacheEntry.class, this, super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
index fdd59be..ddf6799 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxFinishRequest.java
@@ -210,17 +210,6 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMessage {
         return commit ? syncCommit : syncRollback;
     }
 
-    /** {@inheritDoc}
-     * @param ctx*/
-    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
-        super.prepareMarshal(ctx);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
-    }
-
     /** {@inheritDoc} */
     @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
         writer.setBuffer(buf);
@@ -426,4 +415,4 @@ public class GridDistributedTxFinishRequest extends GridDistributedBaseMessage {
         return GridToStringBuilder.toString(GridDistributedTxFinishRequest.class, this,
             "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
index 41f9872..c930d88 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxRemoteAdapter.java
@@ -458,17 +458,17 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
                 assert txEntry != null : "Missing transaction entry for tx: " + this;
 
                 while (true) {
-                    GridCacheEntryEx Entry = txEntry.cached();
+                    GridCacheEntryEx entry = txEntry.cached();
 
-                    assert Entry != null : "Missing cached entry for transaction entry: " + txEntry;
+                    assert entry != null : "Missing cached entry for transaction entry: " + txEntry;
 
                     try {
                         GridCacheVersion ver = txEntry.explicitVersion() != null ? txEntry.explicitVersion() : xidVer;
 
                         // If locks haven't been acquired yet, keep waiting.
-                        if (!Entry.lockedBy(ver)) {
+                        if (!entry.lockedBy(ver)) {
                             if (log.isDebugEnabled())
-                                log.debug("Transaction does not own lock for entry (will wait) [entry=" + Entry +
+                                log.debug("Transaction does not own lock for entry (will wait) [entry=" + entry +
                                     ", tx=" + this + ']');
 
                             return;
@@ -802,4 +802,4 @@ public class GridDistributedTxRemoteAdapter extends IgniteTxAdapter
     @Override public String toString() {
         return GridToStringBuilder.toString(GridDistributedTxRemoteAdapter.class, this, "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index d81b72c..b9514a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -709,337 +709,311 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
         @Nullable final CacheEntryPredicate[] filter0) {
         final List<KeyCacheObject> keys = req.keys();
 
-        IgniteInternalFuture<Object> keyFut = null;
+        CacheEntryPredicate[] filter = filter0;
 
-        if (req.onePhaseCommit()) {
-            boolean forceKeys = req.hasTransforms() || req.filter() != null;
+        // Set message into thread context.
+        GridDhtTxLocal tx = null;
 
-            if (!forceKeys) {
-                for (int i = 0; i < req.keysCount() && !forceKeys; i++)
-                    forceKeys |= req.returnValue(i);
-            }
-
-            if (forceKeys)
-                keyFut = ctx.dht().dhtPreloader().request(keys, req.topologyVersion());
-        }
+        try {
+            int cnt = keys.size();
 
-        if (keyFut == null)
-            keyFut = new GridFinishedFuture<>();
+            if (req.inTx()) {
+                GridCacheVersion dhtVer = ctx.tm().mappedVersion(req.version());
 
-        return new GridEmbeddedFuture<>(keyFut,
-            new C2<Object, Exception, IgniteInternalFuture<GridNearLockResponse>>() {
-                @Override public IgniteInternalFuture<GridNearLockResponse> apply(Object o, Exception exx) {
-                    if (exx != null)
-                        return new GridDhtFinishedFuture<>(exx);
+                if (dhtVer != null)
+                    tx = ctx.tm().tx(dhtVer);
+            }
 
-                    CacheEntryPredicate[] filter = filter0;
+            final List<GridCacheEntryEx> entries = new ArrayList<>(cnt);
 
-                    // Set message into thread context.
-                    GridDhtTxLocal tx = null;
+            // Unmarshal filter first.
+            if (filter == null)
+                filter = req.filter();
 
-                    try {
-                        int cnt = keys.size();
+            GridDhtLockFuture fut = null;
 
-                        if (req.inTx()) {
-                            GridCacheVersion dhtVer = ctx.tm().mappedVersion(req.version());
+            if (!req.inTx()) {
+                GridDhtPartitionTopology top = null;
 
-                            if (dhtVer != null)
-                                tx = ctx.tm().tx(dhtVer);
-                        }
+                if (req.firstClientRequest()) {
+                    assert CU.clientNode(nearNode);
 
-                        final List<GridCacheEntryEx> entries = new ArrayList<>(cnt);
+                    top = topology();
 
-                        // Unmarshal filter first.
-                        if (filter == null)
-                            filter = req.filter();
+                    topology().readLock();
+                }
 
-                        GridDhtLockFuture fut = null;
+                try {
+                    if (top != null && needRemap(req.topologyVersion(), top.topologyVersion())) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Client topology version mismatch, need remap lock request [" +
+                                "reqTopVer=" + req.topologyVersion() +
+                                ", locTopVer=" + top.topologyVersion() +
+                                ", req=" + req + ']');
+                        }
 
-                        if (!req.inTx()) {
-                            GridDhtPartitionTopology top = null;
+                        GridNearLockResponse res = sendClientLockRemapResponse(nearNode,
+                            req,
+                            top.topologyVersion());
 
-                            if (req.firstClientRequest()) {
-                                assert CU.clientNode(nearNode);
+                        return new GridFinishedFuture<>(res);
+                    }
 
-                                top = topology();
+                    fut = new GridDhtLockFuture(ctx,
+                        nearNode.id(),
+                        req.version(),
+                        req.topologyVersion(),
+                        cnt,
+                        req.txRead(),
+                        req.needReturnValue(),
+                        req.timeout(),
+                        tx,
+                        req.threadId(),
+                        req.accessTtl(),
+                        filter,
+                        req.skipStore());
+
+                    // Add before mapping.
+                    if (!ctx.mvcc().addFuture(fut))
+                        throw new IllegalStateException("Duplicate future ID: " + fut);
+                }
+                finally {
+                    if (top != null)
+                        top.readUnlock();
+                }
+            }
 
-                                topology().readLock();
-                            }
+            boolean timedout = false;
 
-                            try {
-                                if (top != null && needRemap(req.topologyVersion(), top.topologyVersion())) {
-                                    if (log.isDebugEnabled()) {
-                                        log.debug("Client topology version mismatch, need remap lock request [" +
-                                            "reqTopVer=" + req.topologyVersion() +
-                                            ", locTopVer=" + top.topologyVersion() +
-                                            ", req=" + req + ']');
-                                    }
+            for (KeyCacheObject key : keys) {
+                if (timedout)
+                    break;
 
-                                    GridNearLockResponse res = sendClientLockRemapResponse(nearNode,
-                                        req,
-                                        top.topologyVersion());
+                while (true) {
+                    // Specify topology version to make sure containment is checked
+                    // based on the requested version, not the latest.
+                    GridDhtCacheEntry entry = entryExx(key, req.topologyVersion());
 
-                                    return new GridFinishedFuture<>(res);
-                                }
+                    try {
+                        if (fut != null) {
+                            // This method will add local candidate.
+                            // Entry cannot become obsolete after this method succeeded.
+                            fut.addEntry(key == null ? null : entry);
 
-                                fut = new GridDhtLockFuture(ctx,
-                                    nearNode.id(),
-                                    req.version(),
-                                    req.topologyVersion(),
-                                    cnt,
-                                    req.txRead(),
-                                    req.needReturnValue(),
-                                    req.timeout(),
-                                    tx,
-                                    req.threadId(),
-                                    req.accessTtl(),
-                                    filter,
-                                    req.skipStore());
+                            if (fut.isDone()) {
+                                timedout = true;
 
-                                // Add before mapping.
-                                if (!ctx.mvcc().addFuture(fut))
-                                    throw new IllegalStateException("Duplicate future ID: " + fut);
-                            }
-                            finally {
-                                if (top != null)
-                                    top.readUnlock();
+                                break;
                             }
                         }
 
-                        boolean timedout = false;
-
-                        for (KeyCacheObject key : keys) {
-                            if (timedout)
-                                break;
+                        entries.add(entry);
 
-                            while (true) {
-                                // Specify topology version to make sure containment is checked
-                                // based on the requested version, not the latest.
-                                GridDhtCacheEntry entry = entryExx(key, req.topologyVersion());
+                        break;
+                    }
+                    catch (GridCacheEntryRemovedException ignore) {
+                        if (log.isDebugEnabled())
+                            log.debug("Got removed entry when adding lock (will retry): " + entry);
+                    }
+                    catch (GridDistributedLockCancelledException e) {
+                        if (log.isDebugEnabled())
+                            log.debug("Got lock request for cancelled lock (will ignore): " +
+                                entry);
 
-                                try {
-                                    if (fut != null) {
-                                        // This method will add local candidate.
-                                        // Entry cannot become obsolete after this method succeeded.
-                                        fut.addEntry(key == null ? null : entry);
+                        fut.onError(e);
 
-                                        if (fut.isDone()) {
-                                            timedout = true;
+                        return new GridDhtFinishedFuture<>(e);
+                    }
+                }
+            }
 
-                                            break;
-                                        }
-                                    }
+            // Handle implicit locks for pessimistic transactions.
+            if (req.inTx()) {
+                if (tx == null) {
+                    GridDhtPartitionTopology top = null;
 
-                                    entries.add(entry);
+                    if (req.firstClientRequest()) {
+                        assert CU.clientNode(nearNode);
 
-                                    break;
-                                }
-                                catch (GridCacheEntryRemovedException ignore) {
-                                    if (log.isDebugEnabled())
-                                        log.debug("Got removed entry when adding lock (will retry): " + entry);
-                                }
-                                catch (GridDistributedLockCancelledException e) {
-                                    if (log.isDebugEnabled())
-                                        log.debug("Got lock request for cancelled lock (will ignore): " +
-                                            entry);
+                        top = topology();
 
-                                    fut.onError(e);
+                        topology().readLock();
+                    }
 
-                                    return new GridDhtFinishedFuture<>(e);
-                                }
+                    try {
+                        if (top != null && needRemap(req.topologyVersion(), top.topologyVersion())) {
+                            if (log.isDebugEnabled()) {
+                                log.debug("Client topology version mismatch, need remap lock request [" +
+                                    "reqTopVer=" + req.topologyVersion() +
+                                    ", locTopVer=" + top.topologyVersion() +
+                                    ", req=" + req + ']');
                             }
-                        }
 
-                        // Handle implicit locks for pessimistic transactions.
-                        if (req.inTx()) {
-                            if (tx == null) {
-                                GridDhtPartitionTopology top = null;
+                            GridNearLockResponse res = sendClientLockRemapResponse(nearNode,
+                                req,
+                                top.topologyVersion());
 
-                                if (req.firstClientRequest()) {
-                                    assert CU.clientNode(nearNode);
+                            return new GridFinishedFuture<>(res);
+                        }
 
-                                    top = topology();
+                        tx = new GridDhtTxLocal(
+                            ctx.shared(),
+                            nearNode.id(),
+                            req.version(),
+                            req.futureId(),
+                            req.miniId(),
+                            req.threadId(),
+                            req.implicitTx(),
+                            req.implicitSingleTx(),
+                            ctx.systemTx(),
+                            false,
+                            ctx.ioPolicy(),
+                            PESSIMISTIC,
+                            req.isolation(),
+                            req.timeout(),
+                            req.isInvalidate(),
+                            !req.skipStore(),
+                            false,
+                            req.txSize(),
+                            null,
+                            req.subjectId(),
+                            req.taskNameHash());
 
-                                    topology().readLock();
-                                }
+                        tx.syncCommit(req.syncCommit());
 
-                                try {
-                                    if (top != null && needRemap(req.topologyVersion(), top.topologyVersion())) {
-                                        if (log.isDebugEnabled()) {
-                                            log.debug("Client topology version mismatch, need remap lock request [" +
-                                                "reqTopVer=" + req.topologyVersion() +
-                                                ", locTopVer=" + top.topologyVersion() +
-                                                ", req=" + req + ']');
-                                        }
+                        tx = ctx.tm().onCreated(null, tx);
 
-                                        GridNearLockResponse res = sendClientLockRemapResponse(nearNode,
-                                            req,
-                                            top.topologyVersion());
+                        if (tx == null || !tx.init()) {
+                            String msg = "Failed to acquire lock (transaction has been completed): " +
+                                req.version();
 
-                                        return new GridFinishedFuture<>(res);
-                                    }
+                            U.warn(log, msg);
 
-                                    tx = new GridDhtTxLocal(
-                                        ctx.shared(),
-                                        nearNode.id(),
-                                        req.version(),
-                                        req.futureId(),
-                                        req.miniId(),
-                                        req.threadId(),
-                                        req.implicitTx(),
-                                        req.implicitSingleTx(),
-                                        ctx.systemTx(),
-                                        false,
-                                        ctx.ioPolicy(),
-                                        PESSIMISTIC,
-                                        req.isolation(),
-                                        req.timeout(),
-                                        req.isInvalidate(),
-                                        true,
-                                        req.txSize(),
-                                        null,
-                                        req.subjectId(),
-                                        req.taskNameHash());
-
-                                    tx.syncCommit(req.syncCommit());
-
-                                    tx = ctx.tm().onCreated(null, tx);
-
-                                    if (tx == null || !tx.init()) {
-                                        String msg = "Failed to acquire lock (transaction has been completed): " +
-                                            req.version();
-
-                                        U.warn(log, msg);
-
-                                        if (tx != null)
-                                            tx.rollback();
-
-                                        return new GridDhtFinishedFuture<>(new IgniteCheckedException(msg));
-                                    }
+                            if (tx != null)
+                                tx.rollback();
 
-                                    tx.topologyVersion(req.topologyVersion());
-                                }
-                                finally {
-                                    if (top != null)
-                                        top.readUnlock();
-                                }
-                            }
+                            return new GridDhtFinishedFuture<>(new IgniteCheckedException(msg));
+                        }
 
-                            ctx.tm().txContext(tx);
+                        tx.topologyVersion(req.topologyVersion());
+                    }
+                    finally {
+                        if (top != null)
+                            top.readUnlock();
+                    }
+                }
 
-                            if (log.isDebugEnabled())
-                                log.debug("Performing DHT lock [tx=" + tx + ", entries=" + entries + ']');
+                ctx.tm().txContext(tx);
 
-                            IgniteInternalFuture<GridCacheReturn> txFut = tx.lockAllAsync(
-                                cacheCtx,
+                if (log.isDebugEnabled())
+                    log.debug("Performing DHT lock [tx=" + tx + ", entries=" + entries + ']');
+
+                IgniteInternalFuture<GridCacheReturn> txFut = tx.lockAllAsync(
+                    cacheCtx,
+                    entries,
+                    req.messageId(),
+                    req.txRead(),
+                    req.needReturnValue(),
+                    req.accessTtl(),
+                    req.skipStore());
+
+                final GridDhtTxLocal t = tx;
+
+                return new GridDhtEmbeddedFuture(
+                    txFut,
+                    new C2<GridCacheReturn, Exception, IgniteInternalFuture<GridNearLockResponse>>() {
+                        @Override public IgniteInternalFuture<GridNearLockResponse> apply(
+                            GridCacheReturn o, Exception e) {
+                            if (e != null)
+                                e = U.unwrap(e);
+
+                            assert !t.empty();
+
+                            // Create response while holding locks.
+                            final GridNearLockResponse resp = createLockReply(nearNode,
                                 entries,
-                                req.onePhaseCommit(),
-                                req.messageId(),
-                                req.txRead(),
-                                req.needReturnValue(),
-                                req.accessTtl(),
-                                req.skipStore());
+                                req,
+                                t,
+                                t.xidVersion(),
+                                e);
+
+                            if (resp.error() == null && t.onePhaseCommit()) {
+                                assert t.implicit();
+
+                                return t.commitAsync().chain(
+                                    new C1<IgniteInternalFuture<IgniteInternalTx>, GridNearLockResponse>() {
+                                        @Override public GridNearLockResponse apply(IgniteInternalFuture<IgniteInternalTx> f) {
+                                            try {
+                                                // Check for error.
+                                                f.get();
+                                            }
+                                            catch (IgniteCheckedException e1) {
+                                                resp.error(e1);
+                                            }
 
-                            final GridDhtTxLocal t = tx;
-
-                            return new GridDhtEmbeddedFuture(
-                                txFut,
-                                new C2<GridCacheReturn, Exception, IgniteInternalFuture<GridNearLockResponse>>() {
-                                    @Override public IgniteInternalFuture<GridNearLockResponse> apply(
-                                        GridCacheReturn o, Exception e) {
-                                        if (e != null)
-                                            e = U.unwrap(e);
-
-                                        assert !t.empty();
-
-                                        // Create response while holding locks.
-                                        final GridNearLockResponse resp = createLockReply(nearNode,
-                                            entries,
-                                            req,
-                                            t,
-                                            t.xidVersion(),
-                                            e);
-
-                                        if (resp.error() == null && t.onePhaseCommit()) {
-                                            assert t.implicit();
-
-                                            return t.commitAsync().chain(
-                                                new C1<IgniteInternalFuture<IgniteInternalTx>, GridNearLockResponse>() {
-                                                    @Override public GridNearLockResponse apply(IgniteInternalFuture<IgniteInternalTx> f) {
-                                                        try {
-                                                            // Check for error.
-                                                            f.get();
-                                                        }
-                                                        catch (IgniteCheckedException e1) {
-                                                            resp.error(e1);
-                                                        }
-
-                                                        sendLockReply(nearNode, t, req, resp);
-
-                                                        return resp;
-                                                    }
-                                                });
-                                        }
-                                        else {
                                             sendLockReply(nearNode, t, req, resp);
 
-                                            return new GridFinishedFuture<>(resp);
+                                            return resp;
                                         }
-                                    }
-                                }
-                            );
+                                    });
+                            }
+                            else {
+                                sendLockReply(nearNode, t, req, resp);
+
+                                return new GridFinishedFuture<>(resp);
+                            }
                         }
-                        else {
-                            assert fut != null;
+                    }
+                );
+            }
+            else {
+                assert fut != null;
 
-                            // This will send remote messages.
-                            fut.map();
+                // This will send remote messages.
+                fut.map();
 
-                            final GridCacheVersion mappedVer = fut.version();
+                final GridCacheVersion mappedVer = fut.version();
 
-                            return new GridDhtEmbeddedFuture<>(
-                                new C2<Boolean, Exception, GridNearLockResponse>() {
-                                    @Override public GridNearLockResponse apply(Boolean b, Exception e) {
-                                        if (e != null)
-                                            e = U.unwrap(e);
-                                        else if (!b)
-                                            e = new GridCacheLockTimeoutException(req.version());
+                return new GridDhtEmbeddedFuture<>(
+                    new C2<Boolean, Exception, GridNearLockResponse>() {
+                        @Override public GridNearLockResponse apply(Boolean b, Exception e) {
+                            if (e != null)
+                                e = U.unwrap(e);
+                            else if (!b)
+                                e = new GridCacheLockTimeoutException(req.version());
 
-                                        GridNearLockResponse res = createLockReply(nearNode,
-                                            entries,
-                                            req,
-                                            null,
-                                            mappedVer,
-                                            e);
+                            GridNearLockResponse res = createLockReply(nearNode,
+                                entries,
+                                req,
+                                null,
+                                mappedVer,
+                                e);
 
-                                        sendLockReply(nearNode, null, req, res);
+                            sendLockReply(nearNode, null, req, res);
 
-                                        return res;
-                                    }
-                                },
-                                fut);
+                            return res;
                         }
-                    }
-                    catch (IgniteCheckedException e) {
-                        String err = "Failed to unmarshal at least one of the keys for lock request message: " + req;
-
-                        U.error(log, err, e);
+                    },
+                    fut);
+            }
+        }
+        catch (IgniteCheckedException | RuntimeException e) {
+            String err = "Failed to unmarshal at least one of the keys for lock request message: " + req;
 
-                        if (tx != null) {
-                            try {
-                                tx.rollback();
-                            }
-                            catch (IgniteCheckedException ex) {
-                                U.error(log, "Failed to rollback the transaction: " + tx, ex);
-                            }
-                        }
+            U.error(log, err, e);
 
-                        return new GridDhtFinishedFuture<>(
-                            new IgniteCheckedException(err, e));
-                    }
+            if (tx != null) {
+                try {
+                    tx.rollback();
+                }
+                catch (IgniteCheckedException ex) {
+                    U.error(log, "Failed to rollback the transaction: " + tx, ex);
                 }
             }
-        );
+
+            return new GridDhtFinishedFuture<>(
+                new IgniteCheckedException(err, e));
+        }
     }
 
     /**
@@ -1626,4 +1600,4 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
         if (nearEntry != null)
             nearEntry.markObsolete(ctx.versions().next());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
index a7ec20f..79bccc2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishFuture.java
@@ -219,7 +219,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
     @Override public boolean onDone(IgniteInternalTx tx, Throwable err) {
         if (initialized() || err != null) {
             if (this.tx.onePhaseCommit() && (this.tx.state() == COMMITTING))
-                this.tx.tmCommit();
+                this.tx.tmFinish(err == null);
 
             Throwable e = this.err.get();
 
@@ -255,7 +255,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
     /**
      * Initializes future.
      */
-    @SuppressWarnings("SimplifiableIfStatement")
+    @SuppressWarnings({"SimplifiableIfStatement", "IfMayBeConditional"})
     public void finish() {
         boolean sync;
 
@@ -277,7 +277,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
      * @param nodes Nodes.
      * @return {@code True} in case there is at least one synchronous {@code MiniFuture} to wait for.
      */
-    private boolean rollbackLockTransactions(Set<ClusterNode> nodes) {
+    private boolean rollbackLockTransactions(Collection<ClusterNode> nodes) {
         assert !commit;
         assert !F.isEmpty(nodes);
 
@@ -399,6 +399,8 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
                 tx.subjectId(),
                 tx.taskNameHash());
 
+            req.writeVersion(tx.writeVersion() != null ? tx.writeVersion() : tx.xidVersion());
+
             try {
                 cctx.io().send(n, req, tx.ioPolicy());
 
@@ -450,8 +452,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
                     tx.subjectId(),
                     tx.taskNameHash());
 
-                if (tx.onePhaseCommit())
-                    req.writeVersion(tx.writeVersion());
+                req.writeVersion(tx.writeVersion());
 
                 try {
                     cctx.io().send(nearMapping.node(), req, tx.ioPolicy());
@@ -516,7 +517,7 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
         /**
          * @param node Node.
          */
-        public MiniFuture(ClusterNode node) {
+        private MiniFuture(ClusterNode node) {
             this.node = node;
         }
 
@@ -582,4 +583,4 @@ public final class GridDhtTxFinishFuture<K, V> extends GridCompoundIdentityFutur
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index a9cb299..f859314 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@ -63,6 +63,9 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
     @GridDirectCollection(GridCacheVersion.class)
     private Collection<GridCacheVersion> pendingVers;
 
+    /** Check comitted flag. */
+    private boolean checkCommitted;
+
     /** One phase commit write version. */
     private GridCacheVersion writeVer;
 
@@ -126,8 +129,21 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(xidVer, futId, commitVer, threadId, commit, invalidate, sys, plc, syncCommit, syncRollback, baseVer,
-            committedVers, rolledbackVers, txSize);
+        super(
+            xidVer,
+            futId,
+            commitVer,
+            threadId,
+            commit,
+            invalidate,
+            sys,
+            plc,
+            syncCommit,
+            syncRollback,
+            baseVer,
+            committedVers,
+            rolledbackVers,
+            txSize);
 
         assert miniId != null;
         assert nearNodeId != null;
@@ -221,6 +237,20 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
         return pendingVers == null ? Collections.<GridCacheVersion>emptyList() : pendingVers;
     }
 
+    /**
+     * @return Check committed flag.
+     */
+    public boolean checkCommitted() {
+        return checkCommitted;
+    }
+
+    /**
+     * @param checkCommitted Check committed flag.
+     */
+    public void checkCommitted(boolean checkCommitted) {
+        this.checkCommitted = checkCommitted;
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridDhtTxFinishRequest.class, this, super.toString());
@@ -242,54 +272,60 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
         switch (writer.state()) {
             case 18:
-                if (!writer.writeByte("isolation", isolation != null ? (byte)isolation.ordinal() : -1))
+                if (!writer.writeBoolean("checkCommitted", checkCommitted))
                     return false;
 
                 writer.incrementState();
 
             case 19:
-                if (!writer.writeIgniteUuid("miniId", miniId))
+                if (!writer.writeByte("isolation", isolation != null ? (byte)isolation.ordinal() : -1))
                     return false;
 
                 writer.incrementState();
 
             case 20:
-                if (!writer.writeUuid("nearNodeId", nearNodeId))
+                if (!writer.writeIgniteUuid("miniId", miniId))
                     return false;
 
                 writer.incrementState();
 
             case 21:
-                if (!writer.writeCollection("pendingVers", pendingVers, MessageCollectionItemType.MSG))
+                if (!writer.writeUuid("nearNodeId", nearNodeId))
                     return false;
 
                 writer.incrementState();
 
             case 22:
-                if (!writer.writeUuid("subjId", subjId))
+                if (!writer.writeCollection("pendingVers", pendingVers, MessageCollectionItemType.MSG))
                     return false;
 
                 writer.incrementState();
 
             case 23:
-                if (!writer.writeBoolean("sysInvalidate", sysInvalidate))
+                if (!writer.writeUuid("subjId", subjId))
                     return false;
 
                 writer.incrementState();
 
             case 24:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
+                if (!writer.writeBoolean("sysInvalidate", sysInvalidate))
                     return false;
 
                 writer.incrementState();
 
             case 25:
-                if (!writer.writeMessage("topVer", topVer))
+                if (!writer.writeInt("taskNameHash", taskNameHash))
                     return false;
 
                 writer.incrementState();
 
             case 26:
+                if (!writer.writeMessage("topVer", topVer))
+                    return false;
+
+                writer.incrementState();
+
+            case 27:
                 if (!writer.writeMessage("writeVer", writeVer))
                     return false;
 
@@ -312,6 +348,14 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
         switch (reader.state()) {
             case 18:
+                checkCommitted = reader.readBoolean("checkCommitted");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 19:
                 byte isolationOrd;
 
                 isolationOrd = reader.readByte("isolation");
@@ -323,7 +367,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 19:
+            case 20:
                 miniId = reader.readIgniteUuid("miniId");
 
                 if (!reader.isLastRead())
@@ -331,7 +375,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 20:
+            case 21:
                 nearNodeId = reader.readUuid("nearNodeId");
 
                 if (!reader.isLastRead())
@@ -339,7 +383,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 21:
+            case 22:
                 pendingVers = reader.readCollection("pendingVers", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
@@ -347,7 +391,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 22:
+            case 23:
                 subjId = reader.readUuid("subjId");
 
                 if (!reader.isLastRead())
@@ -355,7 +399,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 23:
+            case 24:
                 sysInvalidate = reader.readBoolean("sysInvalidate");
 
                 if (!reader.isLastRead())
@@ -363,7 +407,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 24:
+            case 25:
                 taskNameHash = reader.readInt("taskNameHash");
 
                 if (!reader.isLastRead())
@@ -371,7 +415,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 25:
+            case 26:
                 topVer = reader.readMessage("topVer");
 
                 if (!reader.isLastRead())
@@ -379,7 +423,7 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
                 reader.incrementState();
 
-            case 26:
+            case 27:
                 writeVer = reader.readMessage("writeVer");
 
                 if (!reader.isLastRead())
@@ -399,6 +443,6 @@ public class GridDhtTxFinishRequest extends GridDistributedTxFinishRequest {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 27;
+        return 28;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
index d696c05..ec0f234 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishResponse.java
@@ -19,6 +19,10 @@ package org.apache.ignite.internal.processors.cache.distributed.dht;
 
 import java.io.Externalizable;
 import java.nio.ByteBuffer;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.GridDirectTransient;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishResponse;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -36,6 +40,16 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
     /** Mini future ID. */
     private IgniteUuid miniId;
 
+    /** Error. */
+    @GridDirectTransient
+    private Throwable checkCommittedErr;
+
+    /** Serialized error. */
+    private byte[] checkCommittedErrBytes;
+
+    /** Flag indicating if this is a check-committed response. */
+    private boolean checkCommitted;
+
     /**
      * Empty constructor required by {@link Externalizable}.
      */
@@ -63,6 +77,51 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
         return miniId;
     }
 
+    /**
+     * @return Error for check committed backup requests.
+     */
+    public Throwable checkCommittedError() {
+        return checkCommittedErr;
+    }
+
+    /**
+     * @param checkCommittedErr Error for check committed backup requests.
+     */
+    public void checkCommittedError(Throwable checkCommittedErr) {
+        this.checkCommittedErr = checkCommittedErr;
+    }
+
+    /**
+     * @return Check committed flag.
+     */
+    public boolean checkCommitted() {
+        return checkCommitted;
+    }
+
+    /**
+     * @param checkCommitted Check committed flag.
+     */
+    public void checkCommitted(boolean checkCommitted) {
+        this.checkCommitted = checkCommitted;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
+        super.prepareMarshal(ctx);
+
+        if (checkCommittedErr != null)
+            checkCommittedErrBytes = ctx.marshaller().marshal(checkCommittedErr);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr)
+        throws IgniteCheckedException {
+        super.finishUnmarshal(ctx, ldr);
+
+        if (checkCommittedErrBytes != null)
+            checkCommittedErr = ctx.marshaller().unmarshal(checkCommittedErrBytes, ldr);
+    }
+
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridDhtTxFinishResponse.class, this, super.toString());
@@ -84,6 +143,18 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
 
         switch (writer.state()) {
             case 5:
+                if (!writer.writeBoolean("checkCommitted", checkCommitted))
+                    return false;
+
+                writer.incrementState();
+
+            case 6:
+                if (!writer.writeByteArray("checkCommittedErrBytes", checkCommittedErrBytes))
+                    return false;
+
+                writer.incrementState();
+
+            case 7:
                 if (!writer.writeIgniteUuid("miniId", miniId))
                     return false;
 
@@ -106,6 +177,22 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
 
         switch (reader.state()) {
             case 5:
+                checkCommitted = reader.readBoolean("checkCommitted");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 6:
+                checkCommittedErrBytes = reader.readByteArray("checkCommittedErrBytes");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 7:
                 miniId = reader.readIgniteUuid("miniId");
 
                 if (!reader.isLastRead())
@@ -125,6 +212,6 @@ public class GridDhtTxFinishResponse extends GridDistributedTxFinishResponse {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 6;
+        return 8;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index b23b3e1..4f8469f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -128,6 +128,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         Map<UUID, Collection<UUID>> txNodes,
         UUID subjId,
@@ -146,6 +147,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
             timeout,
             invalidate,
             storeEnabled,
+            onePhaseCommit,
             txSize,
             subjId,
             taskNameHash);
@@ -700,4 +702,4 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
     @Override public String toString() {
         return GridToStringBuilder.toString(GridDhtTxLocal.class, this, "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 762d26f..8c7d985 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -98,6 +98,9 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     /** Versions of pending locks for entries of this tx. */
     private Collection<GridCacheVersion> pendingVers;
 
+    /** Flag indicating that originating node has near cache. */
+    private boolean nearOnOriginatingNode;
+
     /** Nodes where transactions were started on lock step. */
     private Set<ClusterNode> lockTxNodes;
 
@@ -132,12 +135,28 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
         long timeout,
         boolean invalidate,
         boolean storeEnabled,
+        boolean onePhaseCommit,
         int txSize,
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(cctx, xidVer, implicit, implicitSingle, sys, plc, concurrency, isolation, timeout, invalidate,
-            storeEnabled, txSize, subjId, taskNameHash);
+        super(
+            cctx, 
+            xidVer, 
+            implicit, 
+            implicitSingle, 
+            sys, 
+            plc, 
+            concurrency, 
+            isolation, 
+            timeout, 
+            invalidate,
+            storeEnabled,
+            onePhaseCommit,
+            txSize, 
+            subjId, 
+            taskNameHash
+        );
 
         assert cctx != null;
 
@@ -161,6 +180,29 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     }
 
     /**
+     * Sets flag that indicates that originating node has a near cache that participates in this transaction.
+     *
+     * @param hasNear Has near cache flag.
+     */
+    public void nearOnOriginatingNode(boolean hasNear) {
+        nearOnOriginatingNode = hasNear;
+    }
+
+    /**
+     * @return {@code True} if explicit lock transaction.
+     */
+    public boolean explicitLock() {
+        return explicitLock;
+    }
+
+    /**
+     * @param explicitLock Explicit lock flag.
+     */
+    public void explicitLock(boolean explicitLock) {
+        this.explicitLock = explicitLock;
+    }
+
+    /**
      * @return Nodes where transactions were started on lock step.
      */
     @Nullable public Set<ClusterNode> lockTransactionNodes() {
@@ -229,20 +271,6 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     }
 
     /**
-     * @return Explicit lock flag.
-     */
-    public boolean explicitLock() {
-        return explicitLock;
-    }
-
-    /**
-     * @param explicitLock Explicit lock flag.
-     */
-    public void explicitLock(boolean explicitLock) {
-        this.explicitLock = explicitLock;
-    }
-
-    /**
      * @return DHT thread ID.
      */
     long dhtThreadId() {
@@ -570,7 +598,6 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     /**
      * @param cacheCtx Cache context.
      * @param entries Entries to lock.
-     * @param onePhaseCommit One phase commit flag.
      * @param msgId Message ID.
      * @param read Read flag.
      * @param accessTtl TTL for read operation.
@@ -582,7 +609,6 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
     IgniteInternalFuture<GridCacheReturn> lockAllAsync(
         GridCacheContext cacheCtx,
         List<GridCacheEntryEx> entries,
-        boolean onePhaseCommit,
         long msgId,
         final boolean read,
         final boolean needRetVal,
@@ -864,13 +890,14 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
      * @return {@code True} if transaction is finished on prepare step.
      */
     protected final boolean commitOnPrepare() {
-        return onePhaseCommit() && !near();
+        return onePhaseCommit() && !near() && !nearOnOriginatingNode;
     }
 
     /**
      * @param prepFut Prepare future.
      * @return If transaction if finished on prepare step returns future which is completed after transaction finish.
      */
+    @SuppressWarnings("TypeMayBeWeakened")
     protected final IgniteInternalFuture<GridNearTxPrepareResponse> chainOnePhasePrepare(
         final GridDhtTxPrepareFuture prepFut) {
         if (commitOnPrepare()) {
@@ -901,4 +928,4 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
         return GridToStringBuilder.toString(GridDhtTxLocalAdapter.class, this, "nearNodes", nearMap.keySet(),
             "dhtNodes", dhtMap.keySet(), "explicitLock", explicitLock, "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 6e8460f..89fc0ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -73,6 +73,7 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteFutureCancelledException;
 import org.apache.ignite.lang.IgniteReducer;
 import org.apache.ignite.lang.IgniteUuid;
 import org.jetbrains.annotations.Nullable;
@@ -338,15 +339,13 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                 boolean hasFilters = !F.isEmptyOrNulls(txEntry.filters()) && !F.isAlwaysTrue(txEntry.filters());
 
                 if (hasFilters || retVal || txEntry.op() == DELETE || txEntry.op() == TRANSFORM) {
-                    CacheObject val;
-
                     cached.unswap(retVal);
 
                     boolean readThrough = (retVal || hasFilters) &&
                         cacheCtx.config().isLoadPreviousValue() &&
                         !txEntry.skipStore();
 
-                    val = cached.innerGet(
+                    CacheObject val = cached.innerGet(
                         tx,
                         /*swap*/true,
                         readThrough,
@@ -561,7 +560,8 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
         if (tx.optimistic())
             tx.clearPrepareFuture(this);
 
-        if (tx.onePhaseCommit()) {
+        // Do not commit one-phase commit transaction if originating node has near cache enabled.
+        if (tx.onePhaseCommit() && tx.commitOnPrepare()) {
             assert last;
 
             // Must create prepare response before transaction is committed to grab correct return value.
@@ -639,8 +639,14 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
      * @throws IgniteCheckedException If failed to send response.
      */
     private void sendPrepareResponse(GridNearTxPrepareResponse res) throws IgniteCheckedException {
-        if (!tx.nearNodeId().equals(cctx.localNodeId()))
+        if (!tx.nearNodeId().equals(cctx.localNodeId())) {
+            Throwable err = this.err.get();
+
+            if (err != null && err instanceof IgniteFutureCancelledException)
+                return;
+
             cctx.io().send(tx.nearNodeId(), res, tx.ioPolicy());
+        }
     }
 
     /**
@@ -902,6 +908,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
             // We are holding transaction-level locks for entries here, so we can get next write version.
             onEntriesLocked();
 
+            // We are holding transaction-level locks for entries here, so we can get next write version.
             tx.writeVersion(cctx.versions().next(tx.topologyVersion()));
 
             {
@@ -978,9 +985,10 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                             if (entry.explicitVersion() == null) {
                                 GridCacheMvccCandidate added = cached.candidate(version());
 
-                                assert added == null || added.dhtLocal() :
-                                    "Got non-dht-local candidate for prepare future " +
-                                        "[added=" + added + ", entry=" + entry + ']';
+                                assert added != null : "Null candidate for non-group-lock entry " +
+                                    "[added=" + added + ", entry=" + entry + ']';
+                                assert added.dhtLocal() : "Got non-dht-local candidate for prepare future" +
+                                    "[added=" + added + ", entry=" + entry + ']';
 
                                 if (added != null && added.ownerVersion() != null)
                                     req.owned(entry.txKey(), added.ownerVersion());
@@ -1070,8 +1078,10 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                                 if (entry.explicitVersion() == null) {
                                     GridCacheMvccCandidate added = entry.cached().candidate(version());
 
-                                    assert added == null || added.dhtLocal() : "Got non-dht-local candidate for prepare future" +
-                                        "[added=" + added + ", entry=" + entry + ']';
+                                assert added != null : "Null candidate for non-group-lock entry " +
+                                    "[added=" + added + ", entry=" + entry + ']';
+                                assert added.dhtLocal() : "Got non-dht-local candidate for prepare future" +
+                                    "[added=" + added + ", entry=" + entry + ']';
 
                                     if (added != null && added.ownerVersion() != null)
                                         req.owned(entry.txKey(), added.ownerVersion());
@@ -1473,4 +1483,4 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
             return S.toString(MiniFuture.class, this, "done", isDone(), "cancelled", isCancelled(), "err", error());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
index 2ff34a9..f8be2a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxRemote.java
@@ -111,8 +111,22 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(ctx, nodeId, rmtThreadId, xidVer, commitVer, sys, plc, concurrency, isolation, invalidate, timeout,
-            txSize, subjId, taskNameHash);
+        super(
+            ctx, 
+            nodeId, 
+            rmtThreadId, 
+            xidVer, 
+            commitVer, 
+            sys,
+            plc,
+            concurrency, 
+            isolation, 
+            invalidate, 
+            timeout, 
+            txSize,
+            subjId, 
+            taskNameHash
+        );
 
         assert nearNodeId != null;
         assert rmtFutId != null;
@@ -168,8 +182,22 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
         @Nullable UUID subjId,
         int taskNameHash
     ) {
-        super(ctx, nodeId, rmtThreadId, xidVer, commitVer, sys, plc, concurrency, isolation, invalidate, timeout,
-            txSize, subjId, taskNameHash);
+        super(
+            ctx, 
+            nodeId, 
+            rmtThreadId, 
+            xidVer, 
+            commitVer, 
+            sys,
+            plc,
+            concurrency, 
+            isolation, 
+            invalidate, 
+            timeout, 
+            txSize,
+            subjId, 
+            taskNameHash
+        );
 
         assert nearNodeId != null;
         assert rmtFutId != null;
@@ -224,7 +252,7 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
     /**
      * @return Near node ID.
      */
-    UUID nearNodeId() {
+    public UUID nearNodeId() {
         return nearNodeId;
     }
 
@@ -334,4 +362,4 @@ public class GridDhtTxRemote extends GridDistributedTxRemoteAdapter {
     @Override public String toString() {
         return GridToStringBuilder.toString(GridDhtTxRemote.class, this, "super", super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 3ddf6d3..0202c53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -306,7 +306,7 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
     ) {
         if (CU.affinityNodes(cctx, topVer).isEmpty()) {
             onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for cache " +
-                "(all partition nodes left the grid)."));
+                "(all partition nodes left the grid) [topVer=" + topVer + ", cache=" + cctx.name() + ']'));
 
             return;
         }
@@ -816,4 +816,4 @@ public class GridPartitionedGetFuture<K, V> extends GridCompoundIdentityFuture<M
             return S.toString(MiniFuture.class, this);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 65b1d38..d93f68f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -279,7 +279,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
     public void map() {
         AffinityTopologyVersion topVer = null;
 
-        IgniteInternalTx tx = cctx.tm().anyActiveThreadTx();
+        IgniteInternalTx tx = cctx.tm().anyActiveThreadTx(null);
 
         if (tx != null && tx.topologyVersionSnapshot() != null)
             topVer = tx.topologyVersionSnapshot();
@@ -1188,4 +1188,4 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
     public String toString() {
         return S.toString(GridNearAtomicUpdateFuture.class, this, super.toString());
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index f7093b8..596ec77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -47,6 +47,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLock
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockResponse;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -547,6 +548,14 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
         // Obtain the topology version to use.
         AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(threadId);
 
+        // If there is another system transaction in progress, use it's topology version to prevent deadlock.
+        if (topVer == null && tx != null && tx.system()) {
+            IgniteInternalTx tx0 = cctx.tm().anyActiveThreadTx(tx);
+
+            if (tx0 != null)
+                topVer = tx0.topologyVersionSnapshot();
+        }
+
         if (topVer != null && tx != null)
             tx.topologyVersion(topVer);
 
@@ -1425,4 +1434,4 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
             return S.toString(MiniFuture.class, this, "node", node.id(), "super", super.toString());
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/e1707b68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index 26276f0..f3e5ca3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -45,6 +45,7 @@ import org.apache.ignite.internal.processors.cache.distributed.GridDistributedCa
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
@@ -685,6 +686,14 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
         // Obtain the topology version to use.
         AffinityTopologyVersion topVer = cctx.mvcc().lastExplicitLockTopologyVersion(Thread.currentThread().getId());
 
+        // If there is another system transaction in progress, use it's topology version to prevent deadlock.
+        if (topVer == null && tx != null && tx.system()) {
+            IgniteInternalTx tx0 = cctx.tm().anyActiveThreadTx(tx);
+
+            if (tx0 != null)
+                topVer = tx0.topologyVersionSnapshot();
+        }
+
         if (topVer != null && tx != null)
             tx.topologyVersion(topVer);
 
@@ -1566,4 +1575,4 @@ public final class GridNearLockFuture extends GridCompoundIdentityFuture<Boolean
             return S.toString(MiniFuture.class, this, "node", node.id(), "super", super.toString());
         }
     }
-}
\ No newline at end of file
+}