IgniteClientTestSuite = /*only*/ JettyRestProcessorUnsignedSelfTest#testGet()
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6612993f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6612993f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6612993f Branch: refs/heads/ignite-tc-jclient Commit: 6612993f9b1eb3851e31463b5ae8fe5b2d22fce1 Parents: 36172ce Author: Artem Shutak <ashu...@gridgain.com> Authored: Wed Mar 25 14:56:56 2015 +0300 Committer: Artem Shutak <ashu...@gridgain.com> Committed: Wed Mar 25 14:56:56 2015 +0300 ---------------------------------------------------------------------- .../client/suite/IgniteClientTestSuite.java | 148 ++- .../JettyRestProcessorAbstractSelfTest.java | 1040 +++++++++--------- 2 files changed, 586 insertions(+), 602 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6612993f/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java index 5fdafb1..33c4c36 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/suite/IgniteClientTestSuite.java @@ -18,13 +18,7 @@ package org.apache.ignite.internal.client.suite; import junit.framework.*; -import org.apache.ignite.internal.client.*; -import org.apache.ignite.internal.client.impl.*; -import org.apache.ignite.internal.client.integration.*; -import org.apache.ignite.internal.client.router.*; -import org.apache.ignite.internal.client.util.*; import org.apache.ignite.internal.processors.rest.*; -import org.apache.ignite.internal.processors.rest.protocols.tcp.*; /** * Test suite includes all test that concern REST processors. @@ -36,80 +30,80 @@ public class IgniteClientTestSuite extends TestSuite { public static TestSuite suite() { TestSuite suite = new TestSuite("Ignite Clients Test Suite"); - suite.addTest(new TestSuite(RouterFactorySelfTest.class)); - - // Parser standalone test. - suite.addTest(new TestSuite(TcpRestParserSelfTest.class)); - - // Test memcache protocol with custom test client. - suite.addTest(new TestSuite(RestMemcacheProtocolSelfTest.class)); - - // Test custom binary protocol with test client. - suite.addTest(new TestSuite(RestBinaryProtocolSelfTest.class)); +// suite.addTest(new TestSuite(RouterFactorySelfTest.class)); +// +// // Parser standalone test. +// suite.addTest(new TestSuite(TcpRestParserSelfTest.class)); +// +// // Test memcache protocol with custom test client. +// suite.addTest(new TestSuite(RestMemcacheProtocolSelfTest.class)); +// +// // Test custom binary protocol with test client. +// suite.addTest(new TestSuite(RestBinaryProtocolSelfTest.class)); // Test jetty rest processor - suite.addTest(new TestSuite(JettyRestProcessorSignedSelfTest.class)); +// suite.addTest(new TestSuite(JettyRestProcessorSignedSelfTest.class)); suite.addTest(new TestSuite(JettyRestProcessorUnsignedSelfTest.class)); - - // Test TCP rest processor with original memcache client. - suite.addTest(new TestSuite(ClientMemcachedProtocolSelfTest.class)); - - suite.addTest(new TestSuite(RestProcessorStartSelfTest.class)); - - // Test cache flag conversion. - suite.addTest(new TestSuite(ClientCacheFlagsCodecTest.class)); - - // Test multi-start. - suite.addTest(new TestSuite(RestProcessorMultiStartSelfTest.class)); - - // Test clients. - suite.addTest(new TestSuite(ClientDataImplSelfTest.class)); - suite.addTest(new TestSuite(ClientComputeImplSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpDirectSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpSslSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpSslDirectSelfTest.class)); - - // Test client with many nodes. - suite.addTest(new TestSuite(ClientTcpMultiNodeSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpDirectMultiNodeSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpSslMultiNodeSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpSslDirectMultiNodeSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpUnreachableMultiNodeSelfTest.class)); - suite.addTest(new TestSuite(ClientPreferDirectSelfTest.class)); - - // Test client with many nodes and in multithreaded scenarios - suite.addTest(new TestSuite(ClientTcpMultiThreadedSelfTest.class)); - suite.addTest(new TestSuite(ClientTcpSslMultiThreadedSelfTest.class)); - - // Test client authentication. - suite.addTest(new TestSuite(ClientTcpSslAuthenticationSelfTest.class)); - - suite.addTest(new TestSuite(ClientTcpConnectivitySelfTest.class)); - suite.addTest(new TestSuite(ClientReconnectionSelfTest.class)); - - // Rest task command handler test. - suite.addTest(new TestSuite(TaskCommandHandlerSelfTest.class)); - - // Default cache only test. - suite.addTest(new TestSuite(ClientDefaultCacheSelfTest.class)); - - suite.addTestSuite(ClientFutureAdapterSelfTest.class); - suite.addTestSuite(ClientPropertiesConfigurationSelfTest.class); - suite.addTestSuite(ClientConsistentHashSelfTest.class); - suite.addTestSuite(ClientJavaHasherSelfTest.class); - - suite.addTestSuite(ClientByteUtilsTest.class); - - // Router tests. - suite.addTest(new TestSuite(TcpRouterSelfTest.class)); - // TODO uncomment when fixed https://issues.apache.org/jira/browse/IGNITE-433 - // suite.addTest(new TestSuite(TcpSslRouterSelfTest.class)); - suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class)); - - suite.addTest(new TestSuite(ClientFailedInitSelfTest.class)); - - suite.addTest(new TestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class)); +// +// // Test TCP rest processor with original memcache client. +// suite.addTest(new TestSuite(ClientMemcachedProtocolSelfTest.class)); +// +// suite.addTest(new TestSuite(RestProcessorStartSelfTest.class)); +// +// // Test cache flag conversion. +// suite.addTest(new TestSuite(ClientCacheFlagsCodecTest.class)); +// +// // Test multi-start. +// suite.addTest(new TestSuite(RestProcessorMultiStartSelfTest.class)); +// +// // Test clients. +// suite.addTest(new TestSuite(ClientDataImplSelfTest.class)); +// suite.addTest(new TestSuite(ClientComputeImplSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpDirectSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpSslSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpSslDirectSelfTest.class)); +// +// // Test client with many nodes. +// suite.addTest(new TestSuite(ClientTcpMultiNodeSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpDirectMultiNodeSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpSslMultiNodeSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpSslDirectMultiNodeSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpUnreachableMultiNodeSelfTest.class)); +// suite.addTest(new TestSuite(ClientPreferDirectSelfTest.class)); +// +// // Test client with many nodes and in multithreaded scenarios +// suite.addTest(new TestSuite(ClientTcpMultiThreadedSelfTest.class)); +// suite.addTest(new TestSuite(ClientTcpSslMultiThreadedSelfTest.class)); +// +// // Test client authentication. +// suite.addTest(new TestSuite(ClientTcpSslAuthenticationSelfTest.class)); +// +// suite.addTest(new TestSuite(ClientTcpConnectivitySelfTest.class)); +// suite.addTest(new TestSuite(ClientReconnectionSelfTest.class)); +// +// // Rest task command handler test. +// suite.addTest(new TestSuite(TaskCommandHandlerSelfTest.class)); +// +// // Default cache only test. +// suite.addTest(new TestSuite(ClientDefaultCacheSelfTest.class)); +// +// suite.addTestSuite(ClientFutureAdapterSelfTest.class); +// suite.addTestSuite(ClientPropertiesConfigurationSelfTest.class); +// suite.addTestSuite(ClientConsistentHashSelfTest.class); +// suite.addTestSuite(ClientJavaHasherSelfTest.class); +// +// suite.addTestSuite(ClientByteUtilsTest.class); +// +// // Router tests. +// suite.addTest(new TestSuite(TcpRouterSelfTest.class)); +// // TODO uncomment when fixed https://issues.apache.org/jira/browse/IGNITE-433 +// // suite.addTest(new TestSuite(TcpSslRouterSelfTest.class)); +// suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class)); +// +// suite.addTest(new TestSuite(ClientFailedInitSelfTest.class)); +// +// suite.addTest(new TestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class)); return suite; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6612993f/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java index 8526230..7a1b687 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java @@ -17,7 +17,6 @@ package org.apache.ignite.internal.processors.rest; -import org.apache.ignite.cache.*; import org.apache.ignite.internal.util.typedef.*; import java.io.*; @@ -49,15 +48,6 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS System.clearProperty(IGNITE_JETTY_PORT); } - @Override protected void beforeTest() throws Exception { - fail("See https://issues.apache.org/jira/browse/IGNITE-572"); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - fail("See https://issues.apache.org/jira/browse/IGNITE-572"); - } - /** {@inheritDoc} */ @Override protected int gridCount() { return GRID_CNT; @@ -251,521 +241,521 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS jsonEquals(ret, cachePattern("getVal", true)); } - - /** - * @throws Exception If failed. - */ - public void testGetAll() throws Exception { - jcache().put("getKey1", "getVal1"); - jcache().put("getKey2", "getVal2"); - - String ret = content(F.asMap("cmd", "getall", "k1", "getKey1", "k2", "getKey2")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Get all command result: " + ret); - - jsonEquals(ret, - // getKey[12] is used since the order is not determined. - cacheBulkPattern("\\{\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\,\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\}", - true)); - } - - /** - * @throws Exception If failed. - */ - public void testPut() throws Exception { - String ret = content(F.asMap("cmd", "put", "key", "putKey", "val", "putVal")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Put command result: " + ret); - - assertEquals("putVal", jcache().localPeek("putKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testPutWithExpiration() throws Exception { - String ret = content(F.asMap("cmd", "put", "key", "putKey", "val", "putVal", "exp", "2000")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, cachePattern(true, true)); - - assertEquals("putVal", jcache().get("putKey")); - - Thread.sleep(2100); - - assertNull(jcache().get("putKey")); - } - - /** - * @throws Exception If failed. - */ - public void testAdd() throws Exception { - log.info("Start testAdd"); - - jcache().put("addKey1", "addVal1"); - - log.info("testAdd step 1"); - - String ret = content(F.asMap("cmd", "add", "key", "addKey2", "val", "addVal2")); - - log.info("testAdd step 2"); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - log.info("testAdd step 3"); - - jsonEquals(ret, cachePattern(true, true)); - - log.info("testAdd step 4"); - - assertEquals("addVal1", jcache().localPeek("addKey1", CachePeekMode.ONHEAP)); - assertEquals("addVal2", jcache().localPeek("addKey2", CachePeekMode.ONHEAP)); - log.info("End testAdd"); - } - - /** - * @throws Exception If failed. - */ - public void testAddWithExpiration() throws Exception { - String ret = content(F.asMap("cmd", "add", "key", "addKey", "val", "addVal", "exp", "2000")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, cachePattern(true, true)); - - assertEquals("addVal", jcache().get("addKey")); - - Thread.sleep(2100); - - assertNull(jcache().get("addKey")); - } - - /** - * @throws Exception If failed. - */ - public void testPutAll() throws Exception { - String ret = content(F.asMap("cmd", "putall", "k1", "putKey1", "k2", "putKey2", - "v1", "putVal1", "v2", "putVal2")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Put all command result: " + ret); - - assertEquals("putVal1", jcache().localPeek("putKey1", CachePeekMode.ONHEAP)); - assertEquals("putVal2", jcache().localPeek("putKey2", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cacheBulkPattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testRemove() throws Exception { - jcache().put("rmvKey", "rmvVal"); - - assertEquals("rmvVal", jcache().localPeek("rmvKey", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "rmv", "key", "rmvKey")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Remove command result: " + ret); - - assertNull(jcache().localPeek("rmvKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testRemoveAll() throws Exception { - jcache().put("rmvKey1", "rmvVal1"); - jcache().put("rmvKey2", "rmvVal2"); - jcache().put("rmvKey3", "rmvVal3"); - jcache().put("rmvKey4", "rmvVal4"); - - assertEquals("rmvVal1", jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP)); - assertEquals("rmvVal2", jcache().localPeek("rmvKey2", CachePeekMode.ONHEAP)); - assertEquals("rmvVal3", jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP)); - assertEquals("rmvVal4", jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "rmvall", "k1", "rmvKey1", "k2", "rmvKey2")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Remove all command result: " + ret); - - assertNull(jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP)); - assertNull(jcache().localPeek("rmvKey2", CachePeekMode.ONHEAP)); - assertEquals("rmvVal3", jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP)); - assertEquals("rmvVal4", jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cacheBulkPattern(true, true)); - - ret = content(F.asMap("cmd", "rmvall")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Remove all command result: " + ret); - - assertNull(jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP)); - assertNull(jcache().localPeek("rmvKey2", CachePeekMode.ONHEAP)); - assertNull(jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP)); - assertNull(jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP)); - assertTrue(jcache().localSize() == 0); - - jsonEquals(ret, cacheBulkPattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testCas() throws Exception { - jcache().put("casKey", "casOldVal"); - - assertEquals("casOldVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val2", "casOldVal", "val1", "casNewVal")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("CAS command result: " + ret); - - assertEquals("casNewVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - - jcache().remove("casKey"); - } - - /** - * @throws Exception If failed. - */ - public void testReplace() throws Exception { - jcache().put("repKey", "repOldVal"); - - assertEquals("repOldVal", jcache().localPeek("repKey", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "rep", "key", "repKey", "val", "repVal")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Replace command result: " + ret); - - assertEquals("repVal", jcache().localPeek("repKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testReplaceWithExpiration() throws Exception { - jcache().put("replaceKey", "replaceVal"); - - assertEquals("replaceVal", jcache().get("replaceKey")); - - String ret = content(F.asMap("cmd", "rep", "key", "replaceKey", "val", "replaceValNew", "exp", "2000")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, cachePattern(true, true)); - - assertEquals("replaceValNew", jcache().get("replaceKey")); - - // Use larger value to avoid false positives. - Thread.sleep(2100); - - assertNull(jcache().get("replaceKey")); - } - - /** - * @throws Exception If failed. - */ - public void testAppend() throws Exception { - jcache().put("appendKey", "appendVal"); - - String ret = content(F.asMap("cmd", "append", "key", "appendKey", "val", "_suffix")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, cachePattern(true, true)); - - assertEquals("appendVal_suffix", jcache().get("appendKey")); - } - - /** - * @throws Exception If failed. - */ - public void testPrepend() throws Exception { - jcache().put("prependKey", "prependVal"); - - String ret = content(F.asMap("cmd", "prepend", "key", "prependKey", "val", "prefix_")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, cachePattern(true, true)); - - assertEquals("prefix_prependVal", jcache().get("prependKey")); - } - - /** - * @throws Exception If failed. - */ - public void testIncrement() throws Exception { - String ret = content(F.asMap("cmd", "incr", "key", "incrKey", "init", "2", "delta", "3")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, integerPattern(5, true)); - - assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get()); - - ret = content(F.asMap("cmd", "incr", "key", "incrKey", "delta", "10")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, integerPattern(15, true)); - - assertEquals(15, grid(0).atomicLong("incrKey", 0, true).get()); - } - - /** - * @throws Exception If failed. - */ - public void testDecrement() throws Exception { - String ret = content(F.asMap("cmd", "decr", "key", "decrKey", "init", "15", "delta", "10")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, integerPattern(5, true)); - - assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get()); - - ret = content(F.asMap("cmd", "decr", "key", "decrKey", "delta", "3")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, integerPattern(2, true)); - - assertEquals(2, grid(0).atomicLong("decrKey", 0, true).get()); - } - - /** - * @throws Exception If failed. - */ - public void testCar() throws Exception { - jcache().put("casKey", "casOldVal"); - - assertEquals("casOldVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val2", "casOldVal")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("CAR command result: " + ret); - - assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testPutIfAbsent() throws Exception { - assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val1", "casNewVal")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("PutIfAbsent command result: " + ret); - - assertEquals("casNewVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testCasRemove() throws Exception { - jcache().put("casKey", "casVal"); - - assertEquals("casVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - String ret = content(F.asMap("cmd", "cas", "key", "casKey")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("CAS Remove command result: " + ret); - - assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP)); - - jsonEquals(ret, cachePattern(true, true)); - } - - /** - * @throws Exception If failed. - */ - public void testMetrics() throws Exception { - String ret = content(F.asMap("cmd", "cache")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Cache metrics command result: " + ret); - - jsonEquals(ret, cacheMetricsPattern("\\{.+\\}", true)); - } - - /** - * @throws Exception If failed. - */ - public void testTopology() throws Exception { - String ret = content(F.asMap("cmd", "top", "attr", "false", "mtr", "false")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Topology command result: " + ret); - - jsonEquals(ret, pattern("\\[\\{.+\\}\\]", true)); - } - - /** - * @throws Exception If failed. - */ - public void testNode() throws Exception { - String ret = content(F.asMap("cmd", "node", "attr", "true", "mtr", "true", "id", - grid(0).localNode().id().toString())); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Topology command result: " + ret); - - jsonEquals(ret, pattern("\\{.+\\}", true)); - - ret = content(F.asMap("cmd", "node", "attr", "false", "mtr", "false", "ip", LOC_HOST)); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Topology command result: " + ret); - - jsonEquals(ret, pattern("\\{.+\\}", true)); - - ret = content(F.asMap("cmd", "node", "attr", "false", "mtr", "false", "ip", LOC_HOST, "id", - UUID.randomUUID().toString())); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Topology command result: " + ret); - - jsonEquals(ret, pattern("null", true)); - } - - /** - * Tests {@code exe} command. - * <p> - * Note that attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. - * - * @throws Exception If failed. - */ - public void testExe() throws Exception { - String ret = content(F.asMap("cmd", "exe")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Exe command result: " + ret); - - jsonEquals(ret, pattern("null", false)); - - // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. - ret = content(F.asMap("cmd", "exe", "name", "UNKNOWN_TASK")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Exe command result: " + ret); - - jsonEquals(ret, pattern("null", false)); - - grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader()); - grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader()); - - ret = content(F.asMap("cmd", "exe", "name", TestTask1.class.getName())); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Exe command result: " + ret); - - jsonEquals(ret, pattern("\\{.+\\}", true)); - - ret = content(F.asMap("cmd", "exe", "name", TestTask2.class.getName())); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Exe command result: " + ret); - - jsonEquals(ret, pattern("\\{.+" + TestTask2.RES + ".+\\}", true)); - - ret = content(F.asMap("cmd", "res")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - info("Exe command result: " + ret); - - jsonEquals(ret, pattern("null", false)); - } - - /** - * @throws Exception If failed. - */ - public void testVersion() throws Exception { - String ret = content(F.asMap("cmd", "version")); - - assertNotNull(ret); - assertTrue(!ret.isEmpty()); - - jsonEquals(ret, stringPattern(".+", true)); - } +// +// /** +// * @throws Exception If failed. +// */ +// public void testGetAll() throws Exception { +// jcache().put("getKey1", "getVal1"); +// jcache().put("getKey2", "getVal2"); +// +// String ret = content(F.asMap("cmd", "getall", "k1", "getKey1", "k2", "getKey2")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Get all command result: " + ret); +// +// jsonEquals(ret, +// // getKey[12] is used since the order is not determined. +// cacheBulkPattern("\\{\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\,\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\}", +// true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testPut() throws Exception { +// String ret = content(F.asMap("cmd", "put", "key", "putKey", "val", "putVal")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Put command result: " + ret); +// +// assertEquals("putVal", jcache().localPeek("putKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testPutWithExpiration() throws Exception { +// String ret = content(F.asMap("cmd", "put", "key", "putKey", "val", "putVal", "exp", "2000")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// assertEquals("putVal", jcache().get("putKey")); +// +// Thread.sleep(2100); +// +// assertNull(jcache().get("putKey")); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testAdd() throws Exception { +// log.info("Start testAdd"); +// +// jcache().put("addKey1", "addVal1"); +// +// log.info("testAdd step 1"); +// +// String ret = content(F.asMap("cmd", "add", "key", "addKey2", "val", "addVal2")); +// +// log.info("testAdd step 2"); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// log.info("testAdd step 3"); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// log.info("testAdd step 4"); +// +// assertEquals("addVal1", jcache().localPeek("addKey1", CachePeekMode.ONHEAP)); +// assertEquals("addVal2", jcache().localPeek("addKey2", CachePeekMode.ONHEAP)); +// log.info("End testAdd"); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testAddWithExpiration() throws Exception { +// String ret = content(F.asMap("cmd", "add", "key", "addKey", "val", "addVal", "exp", "2000")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// assertEquals("addVal", jcache().get("addKey")); +// +// Thread.sleep(2100); +// +// assertNull(jcache().get("addKey")); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testPutAll() throws Exception { +// String ret = content(F.asMap("cmd", "putall", "k1", "putKey1", "k2", "putKey2", +// "v1", "putVal1", "v2", "putVal2")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Put all command result: " + ret); +// +// assertEquals("putVal1", jcache().localPeek("putKey1", CachePeekMode.ONHEAP)); +// assertEquals("putVal2", jcache().localPeek("putKey2", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cacheBulkPattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testRemove() throws Exception { +// jcache().put("rmvKey", "rmvVal"); +// +// assertEquals("rmvVal", jcache().localPeek("rmvKey", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "rmv", "key", "rmvKey")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Remove command result: " + ret); +// +// assertNull(jcache().localPeek("rmvKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testRemoveAll() throws Exception { +// jcache().put("rmvKey1", "rmvVal1"); +// jcache().put("rmvKey2", "rmvVal2"); +// jcache().put("rmvKey3", "rmvVal3"); +// jcache().put("rmvKey4", "rmvVal4"); +// +// assertEquals("rmvVal1", jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP)); +// assertEquals("rmvVal2", jcache().localPeek("rmvKey2", CachePeekMode.ONHEAP)); +// assertEquals("rmvVal3", jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP)); +// assertEquals("rmvVal4", jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "rmvall", "k1", "rmvKey1", "k2", "rmvKey2")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Remove all command result: " + ret); +// +// assertNull(jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP)); +// assertNull(jcache().localPeek("rmvKey2", CachePeekMode.ONHEAP)); +// assertEquals("rmvVal3", jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP)); +// assertEquals("rmvVal4", jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cacheBulkPattern(true, true)); +// +// ret = content(F.asMap("cmd", "rmvall")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Remove all command result: " + ret); +// +// assertNull(jcache().localPeek("rmvKey1", CachePeekMode.ONHEAP)); +// assertNull(jcache().localPeek("rmvKey2", CachePeekMode.ONHEAP)); +// assertNull(jcache().localPeek("rmvKey3", CachePeekMode.ONHEAP)); +// assertNull(jcache().localPeek("rmvKey4", CachePeekMode.ONHEAP)); +// assertTrue(jcache().localSize() == 0); +// +// jsonEquals(ret, cacheBulkPattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testCas() throws Exception { +// jcache().put("casKey", "casOldVal"); +// +// assertEquals("casOldVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val2", "casOldVal", "val1", "casNewVal")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("CAS command result: " + ret); +// +// assertEquals("casNewVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// jcache().remove("casKey"); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testReplace() throws Exception { +// jcache().put("repKey", "repOldVal"); +// +// assertEquals("repOldVal", jcache().localPeek("repKey", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "rep", "key", "repKey", "val", "repVal")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Replace command result: " + ret); +// +// assertEquals("repVal", jcache().localPeek("repKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testReplaceWithExpiration() throws Exception { +// jcache().put("replaceKey", "replaceVal"); +// +// assertEquals("replaceVal", jcache().get("replaceKey")); +// +// String ret = content(F.asMap("cmd", "rep", "key", "replaceKey", "val", "replaceValNew", "exp", "2000")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// assertEquals("replaceValNew", jcache().get("replaceKey")); +// +// // Use larger value to avoid false positives. +// Thread.sleep(2100); +// +// assertNull(jcache().get("replaceKey")); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testAppend() throws Exception { +// jcache().put("appendKey", "appendVal"); +// +// String ret = content(F.asMap("cmd", "append", "key", "appendKey", "val", "_suffix")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// assertEquals("appendVal_suffix", jcache().get("appendKey")); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testPrepend() throws Exception { +// jcache().put("prependKey", "prependVal"); +// +// String ret = content(F.asMap("cmd", "prepend", "key", "prependKey", "val", "prefix_")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, cachePattern(true, true)); +// +// assertEquals("prefix_prependVal", jcache().get("prependKey")); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testIncrement() throws Exception { +// String ret = content(F.asMap("cmd", "incr", "key", "incrKey", "init", "2", "delta", "3")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, integerPattern(5, true)); +// +// assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get()); +// +// ret = content(F.asMap("cmd", "incr", "key", "incrKey", "delta", "10")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, integerPattern(15, true)); +// +// assertEquals(15, grid(0).atomicLong("incrKey", 0, true).get()); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testDecrement() throws Exception { +// String ret = content(F.asMap("cmd", "decr", "key", "decrKey", "init", "15", "delta", "10")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, integerPattern(5, true)); +// +// assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get()); +// +// ret = content(F.asMap("cmd", "decr", "key", "decrKey", "delta", "3")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, integerPattern(2, true)); +// +// assertEquals(2, grid(0).atomicLong("decrKey", 0, true).get()); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testCar() throws Exception { +// jcache().put("casKey", "casOldVal"); +// +// assertEquals("casOldVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val2", "casOldVal")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("CAR command result: " + ret); +// +// assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testPutIfAbsent() throws Exception { +// assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "cas", "key", "casKey", "val1", "casNewVal")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("PutIfAbsent command result: " + ret); +// +// assertEquals("casNewVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testCasRemove() throws Exception { +// jcache().put("casKey", "casVal"); +// +// assertEquals("casVal", jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// String ret = content(F.asMap("cmd", "cas", "key", "casKey")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("CAS Remove command result: " + ret); +// +// assertNull(jcache().localPeek("casKey", CachePeekMode.ONHEAP)); +// +// jsonEquals(ret, cachePattern(true, true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testMetrics() throws Exception { +// String ret = content(F.asMap("cmd", "cache")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Cache metrics command result: " + ret); +// +// jsonEquals(ret, cacheMetricsPattern("\\{.+\\}", true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testTopology() throws Exception { +// String ret = content(F.asMap("cmd", "top", "attr", "false", "mtr", "false")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Topology command result: " + ret); +// +// jsonEquals(ret, pattern("\\[\\{.+\\}\\]", true)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testNode() throws Exception { +// String ret = content(F.asMap("cmd", "node", "attr", "true", "mtr", "true", "id", +// grid(0).localNode().id().toString())); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Topology command result: " + ret); +// +// jsonEquals(ret, pattern("\\{.+\\}", true)); +// +// ret = content(F.asMap("cmd", "node", "attr", "false", "mtr", "false", "ip", LOC_HOST)); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Topology command result: " + ret); +// +// jsonEquals(ret, pattern("\\{.+\\}", true)); +// +// ret = content(F.asMap("cmd", "node", "attr", "false", "mtr", "false", "ip", LOC_HOST, "id", +// UUID.randomUUID().toString())); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Topology command result: " + ret); +// +// jsonEquals(ret, pattern("null", true)); +// } +// +// /** +// * Tests {@code exe} command. +// * <p> +// * Note that attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. +// * +// * @throws Exception If failed. +// */ +// public void testExe() throws Exception { +// String ret = content(F.asMap("cmd", "exe")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Exe command result: " + ret); +// +// jsonEquals(ret, pattern("null", false)); +// +// // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. +// ret = content(F.asMap("cmd", "exe", "name", "UNKNOWN_TASK")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Exe command result: " + ret); +// +// jsonEquals(ret, pattern("null", false)); +// +// grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader()); +// grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader()); +// +// ret = content(F.asMap("cmd", "exe", "name", TestTask1.class.getName())); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Exe command result: " + ret); +// +// jsonEquals(ret, pattern("\\{.+\\}", true)); +// +// ret = content(F.asMap("cmd", "exe", "name", TestTask2.class.getName())); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Exe command result: " + ret); +// +// jsonEquals(ret, pattern("\\{.+" + TestTask2.RES + ".+\\}", true)); +// +// ret = content(F.asMap("cmd", "res")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// info("Exe command result: " + ret); +// +// jsonEquals(ret, pattern("null", false)); +// } +// +// /** +// * @throws Exception If failed. +// */ +// public void testVersion() throws Exception { +// String ret = content(F.asMap("cmd", "version")); +// +// assertNotNull(ret); +// assertTrue(!ret.isEmpty()); +// +// jsonEquals(ret, stringPattern(".+", true)); +// } protected abstract String signature() throws Exception; }