Repository: incubator-ignite Updated Branches: refs/heads/ignite-635 6fc116934 -> 3be59d5af
ignite-635: fix tests Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3be59d5a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3be59d5a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3be59d5a Branch: refs/heads/ignite-635 Commit: 3be59d5afffc1798cf8be63bd849a6b856114a29 Parents: 6fc1169 Author: Artem Shutak <ashu...@gridgain.com> Authored: Wed Apr 8 17:00:16 2015 +0300 Committer: Artem Shutak <ashu...@gridgain.com> Committed: Wed Apr 8 17:00:16 2015 +0300 ---------------------------------------------------------------------- ...gniteProjectionStartStopRestartSelfTest.java | 261 +++++++++---------- 1 file changed, 130 insertions(+), 131 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3be59d5a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java index d4c5fc5..7fa5b4b 100644 --- a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java +++ b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java @@ -20,7 +20,6 @@ package org.apache.ignite.internal; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.events.*; -import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.nodestart.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; @@ -178,19 +177,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartOneNode() throws Exception { joinedLatch = new CountDownLatch(1); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 1; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -208,19 +207,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartThreeNodes() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, DFLT_TIMEOUT, 1); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -238,19 +237,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartThreeNodesAndDoEmptyCall() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -279,19 +278,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartThreeNodesAndTryToStartOneNode() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -320,19 +319,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartFiveNodesInTwoCalls() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -351,12 +350,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract assert res.size() == 2; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -374,7 +373,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartFiveWithTwoSpecs() throws Exception { joinedLatch = new CountDownLatch(5); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), F.asList(map(HOST, SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_NO_ATTR, null), map(HOST, SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null)), @@ -382,12 +381,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract assert res.size() == 5; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -405,19 +404,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStartThreeNodesAndRestart() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -437,12 +436,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -465,19 +464,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract script = Paths.get(U.getIgniteHome()).relativize(U.resolveIgnitePath(script).toPath()).toString(); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 1, U.getIgniteHome(), null, script), null, false, 0, 16); assert res.size() == 1; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -497,19 +496,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStopNodes() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, null, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -532,19 +531,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStopNodesFiltered() throws Exception { joinedLatch = new CountDownLatch(2); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null), null, false, 0, 16); assert res.size() == 2; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -558,12 +557,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract assert res.size() == 1; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -595,19 +594,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStopNodeById() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -630,19 +629,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStopNodesByIds() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -672,19 +671,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testStopNodesByIdsC() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -709,19 +708,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testRestartNodes() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -746,19 +745,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testRestartNodesFiltered() throws Exception { joinedLatch = new CountDownLatch(2); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 2, U.getIgniteHome(), CFG_ATTR, null), null, false, 0, 16); assert res.size() == 2; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -772,12 +771,12 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract assert res.size() == 1; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -812,19 +811,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testRestartNodeById() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -849,19 +848,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testRestartNodesByIds() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -888,19 +887,19 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract public void testRestartNodesByIdsC() throws Exception { joinedLatch = new CountDownLatch(3); - Collection<GridTuple3<String, Boolean, String>> res = + Collection<ClusterStartNodeResult> res = startNodes(ignite.cluster(), maps(Collections.singleton(HOST), SSH_UNAME, pwd, key, 3, U.getIgniteHome(), CFG_NO_ATTR, null), null, false, 0, 16); assert res.size() == 3; - F.forEach(res, new CI1<GridTuple3<String, Boolean, String>>() { - @Override public void apply(GridTuple3<String, Boolean, String> t) { - assert t.get1().equals(HOST); + F.forEach(res, new CI1<ClusterStartNodeResult>() { + @Override public void apply(ClusterStartNodeResult t) { + assert t.getHostName().equals(HOST); - if (!t.get2()) - throw new IgniteException(t.get3()); + if (!t.isSuccess()) + throw new IgniteException(t.getError()); } }); @@ -1016,7 +1015,7 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract * @param maxConn Maximum connections. * @return Results collection. */ - private Collection<GridTuple3<String, Boolean, String>> startNodes(IgniteCluster cluster, + private Collection<ClusterStartNodeResult> startNodes(IgniteCluster cluster, Collection<Map<String, Object>> hosts, @Nullable Map<String, Object> dflts, boolean restart, @@ -1026,6 +1025,6 @@ public class IgniteProjectionStartStopRestartSelfTest extends GridCommonAbstract assertNull(cluster.startNodes(hosts, dflts, restart, timeout, maxConn)); - return cluster.<Collection<GridTuple3<String, Boolean, String>>>future().get(WAIT_TIMEOUT); + return cluster.<Collection<ClusterStartNodeResult>>future().get(WAIT_TIMEOUT); } }