Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9865618622 for ; Thu, 16 Jul 2015 22:59:44 +0000 (UTC) Received: (qmail 91820 invoked by uid 500); 16 Jul 2015 22:59:41 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 91791 invoked by uid 500); 16 Jul 2015 22:59:41 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 91782 invoked by uid 99); 16 Jul 2015 22:59:41 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2015 22:59:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 0E06F18286D for ; Thu, 16 Jul 2015 22:59:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.771 X-Spam-Level: X-Spam-Status: No, score=0.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id UJ6vUYnrwjlO for ; Thu, 16 Jul 2015 22:59:32 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 359592C6C3 for ; Thu, 16 Jul 2015 22:59:17 +0000 (UTC) Received: (qmail 88291 invoked by uid 99); 16 Jul 2015 22:58:02 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2015 22:58:02 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E5A77E6830; Thu, 16 Jul 2015 22:58:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sevdokimov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 16 Jul 2015 22:58:46 -0000 Message-Id: <2f49fa476b054043bd91836117642203@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [46/50] [abbrv] incubator-ignite git commit: #ignite-961: add java tests for rest commands. #ignite-961: add java tests for rest commands. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/cbc2738f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/cbc2738f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/cbc2738f Branch: refs/heads/ignite-1121 Commit: cbc2738fb86edf709f7460bb56f866719d664fbe Parents: b039fd3 Author: ivasilinets Authored: Thu Jul 16 17:31:35 2015 +0300 Committer: ivasilinets Committed: Thu Jul 16 17:31:35 2015 +0300 ---------------------------------------------------------------------- .../rest/AbstractRestProcessorSelfTest.java | 1 + .../JettyRestProcessorAbstractSelfTest.java | 420 ++++++++++++++++++- .../ignite/internal/NodeJsCacheApiSelfTest.java | 227 ++++++++++ .../internal/ScriptingJsCacheApiSelfTest.java | 227 ---------- .../testsuites/IgniteNodeJsTestSuite.java | 2 +- .../http/jetty/GridJettyRestHandler.java | 2 +- 6 files changed, 649 insertions(+), 230 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbc2738f/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java index 4f1969f..8310b0f 100644 --- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java +++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java @@ -84,6 +84,7 @@ abstract class AbstractRestProcessorSelfTest extends GridCommonAbstractTest { CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setStatisticsEnabled(true); + ccfg.setIndexedTypes(String.class, String.class); cfg.setCacheConfiguration(ccfg); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbc2738f/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 d5a3cc1..75468a0 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,11 +17,15 @@ package org.apache.ignite.internal.processors.rest; +import net.sf.json.*; +import org.apache.ignite.*; import org.apache.ignite.cache.*; +import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.typedef.*; import java.io.*; import java.net.*; +import java.nio.charset.*; import java.util.*; import java.util.regex.*; @@ -92,6 +96,56 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS return buf.toString(); } + private String makePostRequest(Map params, String urlParameters) throws Exception { + String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?"; + + for (Map.Entry e : params.entrySet()) + addr += e.getKey() + '=' + e.getValue() + '&'; + + URL url = new URL(addr); + + byte[] data = urlParameters.getBytes(Charset.forName("UTF-8")); + + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + + conn.setRequestMethod("POST"); + + conn.setRequestProperty("Content-Type", "application/POST"); + + String signature = signature(); + + if (signature != null) + conn.setRequestProperty("X-Signature", signature); + + conn.setRequestProperty("Content-Length", Integer.toString(data.length)); + + conn.setRequestProperty("JSONObject", "true"); + + conn.setRequestProperty( "charset", "utf-8"); + + conn.setUseCaches(false); + conn.setDoOutput(true); + + try (OutputStream wr = conn.getOutputStream()) { + wr.write(data); + wr.flush(); + wr.close(); + } + + InputStream in = conn.getInputStream(); + + LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in)); + + StringBuilder buf = new StringBuilder(256); + + for (String line = rdr.readLine(); line != null; line = rdr.readLine()) + buf.append(line); + + in.close(); + + return buf.toString(); + } + /** * @param json JSON response. * @param ptrn Pattern to match. @@ -115,6 +169,18 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS } /** + * @param success Success flag. + * @return Regex pattern for JSON. + */ + private String cacheNullPattern(boolean success) { + return "\\{\\\"affinityNodeId\\\":\\\"\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}\\\"\\," + + "\\\"error\\\":\\\"\\\"\\," + + "\\\"response\\\":null\\," + + "\\\"sessionToken\\\":\\\"\\\"," + + "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}"; + } + + /** * @param res Response. * @param success Success flag. * @return Regex pattern for JSON. @@ -144,6 +210,19 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS * @param success Success flag. * @return Regex pattern for JSON. */ + private String cacheBulkPattern(int res, boolean success) { + return "\\{\\\"affinityNodeId\\\":\\\"\\\"\\," + + "\\\"error\\\":\\\"\\\"\\," + + "\\\"response\\\":" + res + "\\," + + "\\\"sessionToken\\\":\\\"\\\"," + + "\\\"successStatus\\\":" + (success ? 0 : 1) + "\\}"; + } + + /** + * @param res Response. + * @param success Success flag. + * @return Regex pattern for JSON. + */ private String cachePattern(boolean res, boolean success) { return "\\{\\\"affinityNodeId\\\":\\\"\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}\\\"\\," + "\\\"error\\\":\\\"\\\"\\," + @@ -221,6 +300,247 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS /** * @throws Exception If failed. */ + public void testCacheSize() throws Exception { + jcache().removeAll(); + + jcache().put("getKey", "getVal"); + + String ret = content(F.asMap("cmd", "cachesize")); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Size command result: " + ret); + + jsonEquals(ret, cacheBulkPattern(1, true)); + } + + /** + * @throws Exception If failed. + */ + public void testIgniteName() throws Exception { + String ret = content(F.asMap("cmd", "name")); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Name command result: " + ret); + + jsonEquals(ret, stringPattern(getTestGridName(0), true)); + } + + + /** + * @throws Exception If failed. + */ + public void testGetOrCreateCache() throws Exception { + String ret = content(F.asMap("cmd", "getorcreatecache", "cacheName", "testCache")); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Name command result: " + ret); + + grid(0).cache("testCache").put("1", "1"); + + ret = content(F.asMap("cmd", "destroycache", "cacheName", "testCache")); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + assertNull(grid(0).cache("testCache")); + } + + /** + * @throws Exception If failed. + */ + public void testGetPost() throws Exception { + jcache().put("key0", "val0"); + + String val = "{'key':'key0'}"; + String ret = makePostRequest(F.asMap("cmd", "get"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Get command result: " + ret); + + jsonEquals(ret, cachePattern("val0", true)); + } + + /** + * @throws Exception If failed. + */ + public void testReplacePost() throws Exception { + jcache().put("key0", "val0"); + + String val = "{'key':'key0', 'val':'val2', 'oldVal':'val1'}"; + String ret = makePostRequest(F.asMap("cmd", "repval"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Get command result: " + ret); + + jsonEquals(ret, cachePattern(false, true)); + + val = "{'key':'key0', 'val':'val2'}"; + ret = makePostRequest(F.asMap("cmd", "getandreplace"), val); + + jsonEquals(ret, cachePattern("val0", true)); + + assertEquals("val2", grid(0).cache(null).get("key0")); + + val = "{'key':'key0', 'val':'val3'}"; + ret = makePostRequest(F.asMap("cmd", "rep"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Get command result: " + ret); + + assertEquals("val3", grid(0).cache(null).get("key0")); + } + + /** + * @throws Exception If failed. + */ + public void testRemovePost() throws Exception { + jcache().put("key0", "val0"); + + String val = "{'key':'key0', 'val':'val2'}"; + String ret = makePostRequest(F.asMap("cmd", "rmvvalue"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + info("Get command result: " + ret); + + jsonEquals(ret, cachePattern(false, true)); + + assertEquals("val0", grid(0).cache(null).get("key0")); + + val = "{'key':'key0'}"; + ret = makePostRequest(F.asMap("cmd", "getandrmv"), val); + + jsonEquals(ret, cachePattern("val0", true)); + + assertNull(grid(0).cache(null).get("key0")); + } + + /** + * @throws Exception If failed. + */ + public void testRemoveAllPost() throws Exception { + jcache().put("key0", "val0"); + jcache().put("key1", "val1"); + + String val = "{'keys': ['key0', 'key1']}"; + String ret = makePostRequest(F.asMap("cmd", "rmvall"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + assertEquals(0, grid(0).cache(null).size()); + } + + /** + * @throws Exception If failed. + */ + public void testPutPost() throws Exception { + String val = "{'key':'key0', 'val':'val0'}"; + String ret = makePostRequest(F.asMap("cmd", "put"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + assertNotNull(grid(0).cache(null).get("key0")); + + val = "{'key':'key0'}"; + ret = makePostRequest(F.asMap("cmd", "containskey"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, cachePattern(true, true)); + } + + /** + * @throws Exception If failed. + */ + public void testGetAndPut() throws Exception { + String val = "{'key':'key0', 'val':'val0'}"; + String ret = makePostRequest(F.asMap("cmd", "getandput"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, cacheNullPattern(true)); + + assertNotNull(grid(0).cache(null).get("key0")); + + val = "{'key': 'key0', 'val':'val1'}"; + ret = makePostRequest(F.asMap("cmd", "getandputifabsent"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, cachePattern("val0", true)); + + assertEquals("val0", grid(0).cache(null).get("key0")); + + val = "{'key': 'key0'}"; + ret = makePostRequest(F.asMap("cmd", "rmv"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + assertNull(grid(0).cache(null).get("key0")); + + val = "{'key': 'key0', 'val':'val1'}"; + ret = makePostRequest(F.asMap("cmd", "putifabsent"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, cachePattern(true, true)); + + assertEquals("val1", grid(0).cache(null).get("key0")); + } + + /** + * @throws Exception If failed. + */ + public void testPutAllPost() throws Exception { + String val = "{'entries': [{'key':'key0', 'value': 'val0'}, {'key':'key1', 'value':'val1'}]}"; + String ret = makePostRequest(F.asMap("cmd", "putAll"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + assertNotNull(grid(0).cache(null).get("key0")); + + val = "{'keys': ['key0','key1']}"; + ret = makePostRequest(F.asMap("cmd", "containskeys"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, cacheBulkPattern(true, true)); + + ret = makePostRequest(F.asMap("cmd", "getAll"), val); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, cacheBulkPattern( + "\\[\\{\\\"key\\\":\\\"key0\\\",\\\"value\\\":\\\"val0\\\"\\}," + + "\\{\\\"key\\\":\\\"key1\\\",\\\"value\\\":\\\"val1\\\"\\}\\]", true)); + } + + /** + * @throws Exception If failed. + */ public void testGetAll() throws Exception { jcache().put("getKey1", "getVal1"); jcache().put("getKey2", "getVal2"); @@ -235,7 +555,7 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS jsonEquals(ret, // getKey[12] is used since the order is not determined. cacheBulkPattern("\\{\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\,\\\"getKey[12]\\\":\\\"getVal[12]\\\"\\}", - true)); + true)); } /** @@ -722,5 +1042,103 @@ abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorS jsonEquals(ret, stringPattern(".+", true)); } + /** + * @throws Exception If failed. + */ + public void testRunScript() throws Exception { + String f = "function(){return ignite.name();}"; + String ret = makePostRequest(F.asMap("cmd", "runscript", "func", URLEncoder.encode(f)), "{arg:[]}"); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, stringPattern(getTestGridName(1), true)); + } + + /** + * @throws Exception If failed. + */ + public void testRunAffinityScript() throws Exception { + String f = "function(){return ignite.name();}"; + String ret = makePostRequest(F.asMap("cmd", "affrun", "func", URLEncoder.encode(f)), "{'arg':[],'key':'key0'}"); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + ClusterNode node = grid(0).affinity(null).mapKeyToNode("key0"); + + Ignite ignite = null; + + for (int i = 0; i < GRID_CNT; ++i) { + if (grid(i).localNode().equals(node)) + ignite = grid(i); + } + + assertNotNull(ignite); + + jsonEquals(ret, stringPattern(ignite.name(), true)); + } + + /** + * @throws Exception If failed. + */ + public void testMapReduceScript() throws Exception { + String map = "function(nodes, arg) {" + + "var words = arg.split(' ');" + + "for (var i = 0; i < words.length; i++) {" + + "var f = function (word) {" + + "return word.length;" + + "};" + + "emit(f, words[i], nodes[i % nodes.length]);" + + "}"+ + "};"; + + String reduce = "function(results) {"+ + "var sum = 0;"+ + "for (var i = 0; i < results.length; ++i) {"+ + "sum += results[i];"+ + "}" + + "return sum;" + + "};"; + + String ret = makePostRequest(F.asMap("cmd", "excmapreduce", "map", URLEncoder.encode(map), + "reduce", URLEncoder.encode(reduce)), "{'arg': 'Hello world!'}"); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + jsonEquals(ret, integerPattern(11, true)); + } + + /** + * @throws Exception If failed. + */ + public void testQuery() throws Exception { + grid(0).cache(null).put("1", "1"); + grid(0).cache(null).put("2", "2"); + grid(0).cache(null).put("3", "3"); + + String ret = makePostRequest(F.asMap("cmd", "qryexecute", "type", "String", "psz", "1", + "qry", URLEncoder.encode("select * from String")), + "{'arg': []}"); + + assertNotNull(ret); + assertTrue(!ret.isEmpty()); + + JSONObject json = JSONObject.fromObject(ret); + + Integer qryId = (Integer)((Map)json.get("response")).get("queryId"); + + assertNotNull(qryId); + + ret = content(F.asMap("cmd", "qryfetch", "psz", "1", "qryId", String.valueOf(qryId))); + + json = JSONObject.fromObject(ret); + + Integer qryId0 = (Integer)((Map)json.get("response")).get("queryId"); + + assertEquals(qryId0, qryId); + } + protected abstract String signature() throws Exception; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbc2738f/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java new file mode 100644 index 0000000..cd55500 --- /dev/null +++ b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsCacheApiSelfTest.java @@ -0,0 +1,227 @@ +/* + * 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; + +/** + * Test node js client put/get. + */ +public class NodeJsCacheApiSelfTest extends NodeJsAbstractTest { + /** + * Constructor. + */ + public NodeJsCacheApiSelfTest() { + super("test-cache-api.js"); + } + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + startGrid(0); + } + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + stopAllGrids(); + } + + /** {@inheritDoc} */ + @Override protected void beforeTest() throws Exception { + grid(0).cache(NodeJsAbstractTest.CACHE_NAME).removeAll(); + } + + /** + * @throws Exception If failed. + */ + public void testPutGet() throws Exception { + runJsScript("testPutGet"); + } + + /** + * @throws Exception If failed. + */ + public void testPutGetObject() throws Exception { + runJsScript("testPutGetObject"); + } + + /** + * @throws Exception If failed. + */ + public void testIncorrectCache() throws Exception { + runJsScript("testIncorrectCacheName"); + } + + /** + * @throws Exception If failed. + */ + public void testGetOrCreateCacheName() throws Exception { + runJsScript("testGetOrCreateCacheName"); + } + + /** + * @throws Exception If failed. + */ + public void testRemove() throws Exception { + runJsScript("testRemove"); + } + + /** + * @throws Exception If failed. + */ + public void testRemoveNoKey() throws Exception { + runJsScript("testRemoveNoKey"); + } + + /** + * @throws Exception If failed. + */ + public void testRemoveAll() throws Exception { + runJsScript("testRemoveAll"); + } + + /** + * @throws Exception If failed. + */ + public void testPutAllGetAll() throws Exception { + runJsScript("testPutAllGetAll"); + } + + /** + * @throws Exception If failed. + */ + public void testPutAllObjectGetAll() throws Exception { + runJsScript("testPutAllObjectGetAll"); + } + + /** + * @throws Exception If failed. + */ + public void testRemoveAllObjectGetAll() throws Exception { + runJsScript("testRemoveAllObjectGetAll"); + } + + /** + * @throws Exception If failed. + */ + public void testContains() throws Exception { + runJsScript("testContains"); + } + + /** + * @throws Exception If failed. + */ + public void testPutContains() throws Exception { + runJsScript("testPutContains"); + } + + /** + * @throws Exception If failed. + */ + public void testPutContainsAll() throws Exception { + runJsScript("testPutContainsAll"); + } + + /** + * @throws Exception If failed. + */ + public void testNotContainsAll() throws Exception { + runJsScript("testNotContainsAll"); + } + + /** + * @throws Exception If failed. + */ + public void testGetAndPut() throws Exception { + runJsScript("testGetAndPut"); + } + + /** + * @throws Exception If failed. + */ + public void testGetAndPutIfAbsent() throws Exception { + runJsScript("testGetAndPutIfAbsent"); + } + + /** + * @throws Exception If failed. + */ + public void testPutIfAbsent() throws Exception { + runJsScript("testPutIfAbsent"); + } + + /** + * @throws Exception If failed. + */ + public void testGetAndRemove() throws Exception { + runJsScript("testGetAndRemove"); + } + + /** + * @throws Exception If failed. + */ + public void testRemoveValue() throws Exception { + runJsScript("testRemoveValue"); + } + + /** + * @throws Exception If failed. + */ + public void testRemoveAllFromCache() throws Exception { + runJsScript("testRemoveAllFromCache"); + } + + /** + * @throws Exception If failed. + */ + public void testReplace() throws Exception { + runJsScript("testReplace"); + } + + /** + * @throws Exception If failed. + */ + public void testIncorrectReplaceObject() throws Exception { + runJsScript("testIncorrectReplaceObject"); + } + + /** + * @throws Exception If failed. + */ + public void testReplaceObject() throws Exception { + runJsScript("testReplaceObject"); + } + + /** + * @throws Exception If failed. + */ + public void testGetAndReplaceObject() throws Exception { + runJsScript("testGetAndReplaceObject"); + } + + /** + * @throws Exception If failed. + */ + public void testReplaceValueObject() throws Exception { + runJsScript("testReplaceValueObject"); + } + + /** + * @throws Exception If failed. + */ + public void testSize() throws Exception { + runJsScript("testSize"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbc2738f/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java b/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java deleted file mode 100644 index 445d6d3..0000000 --- a/modules/nodejs/src/test/java/org/apache/ignite/internal/ScriptingJsCacheApiSelfTest.java +++ /dev/null @@ -1,227 +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; - -/** - * Test node js client put/get. - */ -public class ScriptingJsCacheApiSelfTest extends NodeJsAbstractTest { - /** - * Constructor. - */ - public ScriptingJsCacheApiSelfTest() { - super("test-cache-api.js"); - } - - /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - startGrid(0); - } - - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - stopAllGrids(); - } - - /** {@inheritDoc} */ - @Override protected void beforeTest() throws Exception { - grid(0).cache(NodeJsAbstractTest.CACHE_NAME).removeAll(); - } - - /** - * @throws Exception If failed. - */ - public void testPutGet() throws Exception { - runJsScript("testPutGet"); - } - - /** - * @throws Exception If failed. - */ - public void testPutGetObject() throws Exception { - runJsScript("testPutGetObject"); - } - - /** - * @throws Exception If failed. - */ - public void testIncorrectCache() throws Exception { - runJsScript("testIncorrectCacheName"); - } - - /** - * @throws Exception If failed. - */ - public void testGetOrCreateCacheName() throws Exception { - runJsScript("testGetOrCreateCacheName"); - } - - /** - * @throws Exception If failed. - */ - public void testRemove() throws Exception { - runJsScript("testRemove"); - } - - /** - * @throws Exception If failed. - */ - public void testRemoveNoKey() throws Exception { - runJsScript("testRemoveNoKey"); - } - - /** - * @throws Exception If failed. - */ - public void testRemoveAll() throws Exception { - runJsScript("testRemoveAll"); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllGetAll() throws Exception { - runJsScript("testPutAllGetAll"); - } - - /** - * @throws Exception If failed. - */ - public void testPutAllObjectGetAll() throws Exception { - runJsScript("testPutAllObjectGetAll"); - } - - /** - * @throws Exception If failed. - */ - public void testRemoveAllObjectGetAll() throws Exception { - runJsScript("testRemoveAllObjectGetAll"); - } - - /** - * @throws Exception If failed. - */ - public void testContains() throws Exception { - runJsScript("testContains"); - } - - /** - * @throws Exception If failed. - */ - public void testPutContains() throws Exception { - runJsScript("testPutContains"); - } - - /** - * @throws Exception If failed. - */ - public void testPutContainsAll() throws Exception { - runJsScript("testPutContainsAll"); - } - - /** - * @throws Exception If failed. - */ - public void testNotContainsAll() throws Exception { - runJsScript("testNotContainsAll"); - } - - /** - * @throws Exception If failed. - */ - public void testGetAndPut() throws Exception { - runJsScript("testGetAndPut"); - } - - /** - * @throws Exception If failed. - */ - public void testGetAndPutIfAbsent() throws Exception { - runJsScript("testGetAndPutIfAbsent"); - } - - /** - * @throws Exception If failed. - */ - public void testPutIfAbsent() throws Exception { - runJsScript("testPutIfAbsent"); - } - - /** - * @throws Exception If failed. - */ - public void testGetAndRemove() throws Exception { - runJsScript("testGetAndRemove"); - } - - /** - * @throws Exception If failed. - */ - public void testRemoveValue() throws Exception { - runJsScript("testRemoveValue"); - } - - /** - * @throws Exception If failed. - */ - public void testRemoveAllFromCache() throws Exception { - runJsScript("testRemoveAllFromCache"); - } - - /** - * @throws Exception If failed. - */ - public void testReplace() throws Exception { - runJsScript("testReplace"); - } - - /** - * @throws Exception If failed. - */ - public void testIncorrectReplaceObject() throws Exception { - runJsScript("testIncorrectReplaceObject"); - } - - /** - * @throws Exception If failed. - */ - public void testReplaceObject() throws Exception { - runJsScript("testReplaceObject"); - } - - /** - * @throws Exception If failed. - */ - public void testGetAndReplaceObject() throws Exception { - runJsScript("testGetAndReplaceObject"); - } - - /** - * @throws Exception If failed. - */ - public void testReplaceValueObject() throws Exception { - runJsScript("testReplaceValueObject"); - } - - /** - * @throws Exception If failed. - */ - public void testSize() throws Exception { - runJsScript("testSize"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbc2738f/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java b/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java index c52799c..f6ab879 100644 --- a/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java +++ b/modules/nodejs/src/test/java/org/apache/ignite/testsuites/IgniteNodeJsTestSuite.java @@ -32,7 +32,7 @@ public class IgniteNodeJsTestSuite extends TestSuite { TestSuite suite = new TestSuite("Ignite Node JS Test Suite"); suite.addTest(new TestSuite(NodeJsIgnitionSelfTest.class)); - suite.addTest(new TestSuite(ScriptingJsCacheApiSelfTest.class)); + suite.addTest(new TestSuite(NodeJsCacheApiSelfTest.class)); suite.addTest(new TestSuite(NodeJsSecretKeySelfTest.class)); suite.addTest(new TestSuite(NodeJsComputeSelfTest.class)); suite.addTest(new TestSuite(NodeJsIgniteSelfTest.class)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cbc2738f/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java ---------------------------------------------------------------------- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java index 69108a4..1d40cbd 100644 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java @@ -857,7 +857,7 @@ public class GridJettyRestHandler extends AbstractHandler { Scanner reader; try { - reader = new Scanner(req.getReader()); + reader = new Scanner(req.getInputStream()); } catch (IOException e) { throw new IgniteCheckedException(e);