You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/01/12 08:01:45 UTC
[19/24] ignite git commit: ignite-gg-8.0.2.ea2
ClusterStateAbstractTest fix test
ignite-gg-8.0.2.ea2 ClusterStateAbstractTest fix test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6c6cbd32
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6c6cbd32
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6c6cbd32
Branch: refs/heads/ignite-gg-11810
Commit: 6c6cbd327d67c05278a3617a0cfc4b0f90e0bffc
Parents: f5fd34e
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Wed Jan 11 11:23:33 2017 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Wed Jan 11 11:23:33 2017 +0300
----------------------------------------------------------------------
.../cluster/GridClusterStateProcessor.java | 6 ++-
.../cache/ClusterStateAbstractTest.java | 45 ++++++++++----------
.../internal/websession/WebSessionSelfTest.java | 4 ++
3 files changed, 30 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6c6cbd32/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index d60243b..fa6910d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -449,12 +449,14 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
for (CacheConfiguration cfg : cfgs) {
if (CU.isSystemCache(cfg.getName()))
- sharedCtx.pageStore().initializeForCache(cfg);
+ if (sharedCtx.pageStore() != null)
+ sharedCtx.pageStore().initializeForCache(cfg);
}
for (CacheConfiguration cfg : cfgs) {
if (!CU.isSystemCache(cfg.getName()))
- sharedCtx.pageStore().initializeForCache(cfg);
+ if (sharedCtx.pageStore() != null)
+ sharedCtx.pageStore().initializeForCache(cfg);
}
sharedCtx.database().onActivate(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/6c6cbd32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
index 7969426..a454270 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
@@ -19,11 +19,10 @@
package org.apache.ignite.internal.processors.cache;
import java.util.Collection;
-import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
-import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
@@ -120,20 +119,20 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
startGrids(GRID_CNT);
- IgniteCache<Object, Object> cache2 = grid(0).createCache(new CacheConfiguration<>("cache2"));
-
- checkInactive("cache2", GRID_CNT);
+ checkInactive(GRID_CNT);
forbidden.clear();
grid(0).active(true);
+ IgniteCache<Object, Object> cache2 = grid(0).createCache(new CacheConfiguration<>("cache2"));
+
for (int k = 0; k < ENTRY_CNT; k++)
cache2.put(k, k);
grid(0).active(false);
- checkInactive("cache2", GRID_CNT);
+ checkInactive(GRID_CNT);
stopAllGrids();
}
@@ -281,8 +280,12 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
* @throws Exception If fails.
*/
public void testDeactivationWithPendingLock() throws Exception {
+ fail("Safe way for deactivate cluster must be implemented.");
+
startGrids(GRID_CNT);
+ final CountDownLatch finishedLatch = new CountDownLatch(1);
+
Lock lock = grid(0).cache(CACHE_NAME).lock(1);
IgniteInternalFuture<?> fut;
@@ -293,6 +296,8 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
fut = multithreadedAsync(new Runnable() {
@Override public void run() {
grid(1).active(false);
+
+ finishedLatch.countDown();
}
}, 1);
@@ -322,6 +327,8 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
fut.get(getTestTimeout(), TimeUnit.MILLISECONDS);
checkInactive(GRID_CNT);
+
+ finishedLatch.await();
}
/**
@@ -330,8 +337,12 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
* @throws Exception If fails.
*/
public void testDeactivationWithPendingTransaction() throws Exception {
+ fail("Safe way for deactivate cluster must be implemented.");
+
startGrids(GRID_CNT);
+ final CountDownLatch finishedLatch = new CountDownLatch(1);
+
final Ignite ignite0 = grid(0);
final IgniteCache<Object, Object> cache0 = ignite0.cache(CACHE_NAME);
@@ -344,6 +355,8 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
fut = multithreadedAsync(new Runnable() {
@Override public void run() {
ignite0.active(false);
+
+ finishedLatch.countDown();
}
}, 1);
@@ -379,30 +392,16 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest {
for (int g = 0; g < GRID_CNT; g++)
assertEquals(2, grid(g).cache(CACHE_NAME).get(1));
- }
- /**
- *
- */
- private void checkInactive(int cnt) {
- checkInactive(CACHE_NAME, cnt);
+ finishedLatch.await();
}
/**
*
*/
- private void checkInactive(String cacheName, int cnt) {
- for (int g = 0; g < cnt; g++) {
+ private void checkInactive(int cnt) {
+ for (int g = 0; g < cnt; g++)
assertFalse(grid(g).active());
-
- final IgniteCache<Object, Object> cache0 = grid(g).cache(cacheName);
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return cache0.get("testKey");
- }
- }, CacheException.class, null);
- }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/6c6cbd32/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java b/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
index bfa12a2..67eedcf 100644
--- a/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
+++ b/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
@@ -200,6 +200,10 @@ public class WebSessionSelfTest extends GridCommonAbstractTest {
}
}
+ /**
+ * @param reqMarker Request marker.
+ * @param sesId Session id.
+ */
private String sendRequestAndCheckMarker(String reqMarker, String sesId) throws IOException, IgniteCheckedException {
URLConnection conn = new URL("http://localhost:" + TEST_JETTY_PORT +
"/ignitetest/test?marker=" + reqMarker).openConnection();