ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dma...@apache.org
Subject ignite git commit: ignite-1272: fixed deployment of entry processors for portable caches in transaction mode
Date Fri, 23 Oct 2015 18:01:49 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1272 436e724d7 -> 659389ee0


ignite-1272: fixed deployment of entry processors for portable caches in transaction mode


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

Branch: refs/heads/ignite-1272
Commit: 659389ee062e8020aee08faa696f6f596073c1fa
Parents: 436e724
Author: Denis Magda <dmagda@gridgain.com>
Authored: Fri Oct 23 20:59:36 2015 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Fri Oct 23 20:59:36 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheIoManager.java    |   2 +-
 .../processors/cache/GridCacheMessage.java      |   7 +
 .../distributed/dht/GridDhtCacheAdapter.java    |   2 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |   9 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   2 +-
 .../near/GridNearOptimisticTxPrepareFuture.java |   3 +-
 .../GridNearPessimisticTxPrepareFuture.java     |   3 +-
 .../cache/transactions/IgniteTxHandler.java     |   4 +-
 ...eAtomicEntryProcessorDeploymentSelfTest.java | 211 +++++++++++++++++++
 ...idCacheEntryProcessorDeploymentSelfTest.java | 206 ------------------
 ...ctionalEntryProcessorDeploymentSelfTest.java |  31 +++
 .../testsuites/IgniteCacheTestSuite3.java       |   6 +-
 12 files changed, 268 insertions(+), 218 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/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 03810f5..ec34f41 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
@@ -422,7 +422,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter
{
                     req.futureId(),
                     req.miniId(),
                     req.version(),
-                    ctx.deploymentEnabled());
+                    req.deployInfo() != null);
 
                 res.error(req.classError());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index f68c204..28b74c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.processor.EntryProcessor;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.managers.deployment.GridDeployment;
@@ -30,6 +31,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.T2;
 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;
@@ -357,6 +359,11 @@ public abstract class GridCacheMessage implements Message {
 
                     if (e.value() != null)
                         prepareObject(e.value().value(cctx.cacheObjectContext(), false),
cctx);
+
+                    if (e.entryProcessors() != null) {
+                        for (T2<EntryProcessor<Object, Object, Object>, Object[]>
entProc : e.entryProcessors())
+                            prepareObject(entProc.get1(), cctx);
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index ba1d753..9d02705 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -695,7 +695,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
                     req.futureId(),
                     req.miniId(),
                     req.version(),
-                    ctx.deploymentEnabled());
+                    req.deployInfo() != null);
 
                 GridDhtFuture<Collection<GridCacheEntryInfo>> fut =
                     (GridDhtFuture<Collection<GridCacheEntryInfo>>)f;

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/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 a15a334..6a29bc7 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
@@ -671,7 +671,8 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
             ret,
             prepErr,
             null,
-            tx.activeCachesDeploymentEnabled());
+            // force addition of deployment info for entry processors.
+            tx.activeCachesDeploymentEnabled() || (cctx.deploymentEnabled() && tx.hasTransforms()));
 
         if (prepErr == null) {
             addDhtValues(res);
@@ -978,7 +979,8 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                         tx.onePhaseCommit(),
                         tx.subjectId(),
                         tx.taskNameHash(),
-                        tx.activeCachesDeploymentEnabled());
+                        // force addition of deployment info for entry processors.
+                        tx.activeCachesDeploymentEnabled() || (cctx.deploymentEnabled() &&
tx.hasTransforms()));
 
                     int idx = 0;
 
@@ -1078,7 +1080,8 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                             tx.onePhaseCommit(),
                             tx.subjectId(),
                             tx.taskNameHash(),
-                            tx.activeCachesDeploymentEnabled());
+                            // force addition of deployment info for entry processors.
+                            tx.activeCachesDeploymentEnabled() || (cctx.deploymentEnabled()
&& tx.hasTransforms()));
 
                         for (IgniteTxEntry entry : nearMapping.writes()) {
                             try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 40b4a3b..06d8713 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -2372,7 +2372,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
             req.skipStore(),
             MAX_RETRIES,
             true,
-            ctx.shared().deploymentEnabled() && req.deployInfo() != null);
+            req.deployInfo() != null);
 
         updateFut.map();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/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 6db00ab..f46cd76 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
@@ -589,7 +589,8 @@ public class GridNearOptimisticTxPrepareFuture extends GridNearTxPrepareFutureAd
             tx.subjectId(),
             tx.taskNameHash(),
             m.clientFirst(),
-            tx.activeCachesDeploymentEnabled());
+            // force addition of deployment info for entry processors.
+            tx.activeCachesDeploymentEnabled() || (cctx.deploymentEnabled() && tx.hasTransforms()));
 
         for (IgniteTxEntry txEntry : m.writes()) {
             if (txEntry.op() == TRANSFORM)

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/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 62f9bb3..68f415a 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
@@ -208,7 +208,8 @@ public class GridNearPessimisticTxPrepareFuture extends GridNearTxPrepareFutureA
                 tx.subjectId(),
                 tx.taskNameHash(),
                 false,
-                tx.activeCachesDeploymentEnabled());
+                // force addition of deployment info for entry processors.
+                tx.activeCachesDeploymentEnabled() || (cctx.deploymentEnabled() &&
tx.hasTransforms()));
 
             for (IgniteTxEntry txEntry : m.writes()) {
                 if (txEntry.op() == TRANSFORM)

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/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 8da6367..530fbdf 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
@@ -835,8 +835,8 @@ public class IgniteTxHandler {
             if (nearTx != null)
                 nearTx.rollback();
 
-            res = new GridDhtTxPrepareResponse(req.version(), req.futureId(), req.miniId(),
e, req.deployInfo()
-                != null);
+            res = new GridDhtTxPrepareResponse(req.version(), req.futureId(), req.miniId(),
e,
+                req.deployInfo() != null);
         }
 
         try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
new file mode 100644
index 0000000..0873d2d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
@@ -0,0 +1,211 @@
+/*
+ * 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 java.util.HashSet;
+import java.util.Map;
+import javax.cache.processor.EntryProcessorResult;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DeploymentMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+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.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Cache EntryProcessor + Deployment.
+ */
+public class GridCacheAtomicEntryProcessorDeploymentSelfTest extends GridCommonAbstractTest
{
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Entry processor */
+    protected static String TEST_ENT_PROCESSOR = "org.apache.ignite.tests.p2p.CacheDeploymentEntryProcessor";
+
+    /** Test value. */
+    protected static String TEST_VALUE = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
+
+    /** */
+    private DeploymentMode depMode;
+
+    /** */
+    private boolean cliendMode;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (cliendMode)
+            cfg.setClientMode(cliendMode);
+
+        cfg.setDeploymentMode(depMode);
+
+        cfg.setCacheConfiguration(cacheConfiguration());
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        cfg.setConnectorConfiguration(null);
+
+        return cfg;
+    }
+
+    /**
+     * @return Cache configuration.
+     * @throws Exception In case of error.
+     */
+    protected CacheConfiguration cacheConfiguration() throws Exception {
+        CacheConfiguration cfg = defaultCacheConfiguration();
+
+        cfg.setCacheMode(PARTITIONED);
+        cfg.setWriteSynchronizationMode(FULL_SYNC);
+        cfg.setRebalanceMode(SYNC);
+        cfg.setAtomicityMode(atomicityMode());
+        cfg.setNearConfiguration(new NearCacheConfiguration());
+        cfg.setBackups(1);
+
+        return cfg;
+    }
+
+    protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testInvokeDeployment() throws Exception {
+        depMode = DeploymentMode.CONTINUOUS;
+
+        doTestInvoke();
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testInvokeDeployment2() throws Exception {
+        depMode = DeploymentMode.SHARED;
+
+        doTestInvoke();
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testInvokeAllDeployment() throws Exception {
+        depMode = DeploymentMode.CONTINUOUS;
+
+        doTestInvokeAll();
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testInvokeAllDeployment2() throws Exception {
+        depMode = DeploymentMode.SHARED;
+
+        doTestInvokeAll();
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    private void doTestInvoke() throws Exception {
+        try {
+            cliendMode = false;
+            startGrid(0);
+
+            cliendMode = true;
+            startGrid(1);
+
+            ClassLoader ldr = getExternalClassLoader();
+
+            Class procCls = ldr.loadClass(TEST_ENT_PROCESSOR);
+            Class valCls = ldr.loadClass(TEST_VALUE);
+
+            assertTrue(grid(1).configuration().isClientMode());
+
+            IgniteCache cache = grid(1).cache(null);
+
+            cache.put("key", valCls.newInstance());
+
+            Boolean res = (Boolean)cache.invoke("key", (CacheEntryProcessor)procCls.newInstance());
+
+            assertTrue(res);
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    private void doTestInvokeAll() throws Exception {
+        try {
+            cliendMode = false;
+            startGrid(0);
+
+            cliendMode = true;
+            startGrid(1);
+
+            ClassLoader ldr = getExternalClassLoader();
+
+            Class procCls = ldr.loadClass(TEST_ENT_PROCESSOR);
+            Class valCls = ldr.loadClass(TEST_VALUE);
+
+            assertTrue(grid(1).configuration().isClientMode());
+
+            IgniteCache cache = grid(1).cache(null);
+
+            HashSet keys = new HashSet();
+
+            for (int i = 0; i < 3; i++) {
+                String key = "key" + i;
+
+                cache.put(key, valCls.newInstance());
+
+                keys.add(key);
+            }
+
+            Map<String, EntryProcessorResult> res = (Map<String, EntryProcessorResult>)cache.invokeAll(keys,
+                (CacheEntryProcessor)procCls.newInstance());
+
+            assertEquals(3, res.size());
+
+            for (EntryProcessorResult result : res.values())
+                assertTrue((Boolean)result.get());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryProcessorDeploymentSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryProcessorDeploymentSelfTest.java
deleted file mode 100644
index 494ea42..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryProcessorDeploymentSelfTest.java
+++ /dev/null
@@ -1,206 +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;
-
-import java.util.HashSet;
-import java.util.Map;
-import javax.cache.processor.EntryProcessorResult;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheEntryProcessor;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.DeploymentMode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-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.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Cache EntryProcessor + Deployment.
- */
-public class GridCacheEntryProcessorDeploymentSelfTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** Entry processor */
-    protected static String TEST_ENT_PROCESSOR = "org.apache.ignite.tests.p2p.CacheDeploymentEntryProcessor";
-
-    /** Test value. */
-    protected static String TEST_VALUE = "org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
-
-    /** */
-    private DeploymentMode depMode;
-
-    /** */
-    private boolean cliendMode;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        if (cliendMode)
-            cfg.setClientMode(cliendMode);
-
-        cfg.setDeploymentMode(depMode);
-
-        cfg.setCacheConfiguration(cacheConfiguration());
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        cfg.setConnectorConfiguration(null);
-
-        return cfg;
-    }
-
-    /**
-     * @return Cache configuration.
-     * @throws Exception In case of error.
-     */
-    protected CacheConfiguration cacheConfiguration() throws Exception {
-        CacheConfiguration cfg = defaultCacheConfiguration();
-
-        cfg.setCacheMode(PARTITIONED);
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-        cfg.setRebalanceMode(SYNC);
-        cfg.setAtomicityMode(ATOMIC);
-        cfg.setNearConfiguration(new NearCacheConfiguration());
-        cfg.setBackups(1);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    public void testInvokeDeployment() throws Exception {
-        depMode = DeploymentMode.CONTINUOUS;
-
-        doTestInvoke();
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    public void testInvokeDeployment2() throws Exception {
-        depMode = DeploymentMode.SHARED;
-
-        doTestInvoke();
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    public void testInvokeAllDeployment() throws Exception {
-        depMode = DeploymentMode.CONTINUOUS;
-
-        doTestInvokeAll();
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    public void testInvokeAllDeployment2() throws Exception {
-        depMode = DeploymentMode.SHARED;
-
-        doTestInvokeAll();
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    private void doTestInvoke() throws Exception {
-        try {
-            cliendMode = false;
-            startGrid(0);
-
-            cliendMode = true;
-            startGrid(1);
-
-            ClassLoader ldr = getExternalClassLoader();
-
-            Class procCls = ldr.loadClass(TEST_ENT_PROCESSOR);
-            Class valCls = ldr.loadClass(TEST_VALUE);
-
-            assertTrue(grid(1).configuration().isClientMode());
-
-            IgniteCache cache = grid(1).cache(null);
-
-            cache.put("key", valCls.newInstance());
-
-            Boolean res = (Boolean)cache.invoke("key", (CacheEntryProcessor)procCls.newInstance());
-
-            assertTrue(res);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    private void doTestInvokeAll() throws Exception {
-        try {
-            cliendMode = false;
-            startGrid(0);
-
-            cliendMode = true;
-            startGrid(1);
-
-            ClassLoader ldr = getExternalClassLoader();
-
-            Class procCls = ldr.loadClass(TEST_ENT_PROCESSOR);
-            Class valCls = ldr.loadClass(TEST_VALUE);
-
-            assertTrue(grid(1).configuration().isClientMode());
-
-            IgniteCache cache = grid(1).cache(null);
-
-            HashSet keys = new HashSet();
-
-            for (int i = 0; i < 3; i++) {
-                String key = "key" + i;
-
-                cache.put(key, valCls.newInstance());
-
-                keys.add(key);
-            }
-
-            Map<String, EntryProcessorResult> res = (Map<String, EntryProcessorResult>)cache.invokeAll(keys,
-                (CacheEntryProcessor)procCls.newInstance());
-
-            assertEquals(3, res.size());
-
-            for (EntryProcessorResult result : res.values())
-                assertTrue((Boolean)result.get());
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.java
new file mode 100644
index 0000000..bf8cc7a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalEntryProcessorDeploymentSelfTest.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;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+
+/**
+ * Cache EntryProcessor + Deployment for transactional cache.
+ */
+public class GridCacheTransactionalEntryProcessorDeploymentSelfTest extends
+    GridCacheAtomicEntryProcessorDeploymentSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/659389ee/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index 5ef6fa7..796c531 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -18,15 +18,16 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
+import org.apache.ignite.internal.processors.cache.GridCacheAtomicEntryProcessorDeploymentSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheConditionalDeploymentSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheDeploymentOffHeapSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheDeploymentSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryProcessorDeploymentSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheEntryVersionSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheOrderedPreloadingSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReferenceCleanupSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReloadSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheReplicatedSynchronousCommitTest;
+import org.apache.ignite.internal.processors.cache.GridCacheTransactionalEntryProcessorDeploymentSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheValueBytesPreloadingSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalNearEnabledSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalSelfTest;
@@ -119,7 +120,8 @@ public class IgniteCacheTestSuite3 extends TestSuite {
         suite.addTestSuite(GridCacheDeploymentSelfTest.class);
         suite.addTestSuite(GridCacheDeploymentOffHeapSelfTest.class);
         suite.addTestSuite(GridCacheConditionalDeploymentSelfTest.class);
-        suite.addTestSuite(GridCacheEntryProcessorDeploymentSelfTest.class);
+        suite.addTestSuite(GridCacheAtomicEntryProcessorDeploymentSelfTest.class);
+        suite.addTestSuite(GridCacheTransactionalEntryProcessorDeploymentSelfTest.class);
 
         suite.addTestSuite(GridCachePutArrayValueSelfTest.class);
         suite.addTestSuite(GridCacheReplicatedUnswapAdvancedSelfTest.class);


Mime
View raw message