You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2017/04/28 06:57:40 UTC
[19/59] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as
cache name. This closes #1790.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/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 1321929..9a59338 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
@@ -150,7 +150,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- grid(0).cache(null).removeAll();
+ grid(0).cache(DEFAULT_CACHE_NAME).removeAll();
}
/** {@inheritDoc} */
@@ -333,7 +333,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
public void testGet() throws Exception {
jcache().put("getKey", "getVal");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "getKey"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "getKey"));
info("Get command result: " + ret);
@@ -350,7 +350,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("mapKey1", map1);
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "mapKey1"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "mapKey1"));
info("Get command result: " + ret);
@@ -364,7 +364,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("mapKey2", map2);
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "mapKey2"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "mapKey2"));
info("Get command result: " + ret);
@@ -381,7 +381,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("simplePersonKey", p);
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey"));
info("Get command result: " + ret);
@@ -408,7 +408,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("utilDateKey", utilDate);
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "utilDateKey"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "utilDateKey"));
info("Get command result: " + ret);
@@ -418,7 +418,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("sqlDateKey", sqlDate);
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey"));
info("Get SQL result: " + ret);
@@ -426,7 +426,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("timestampKey", new java.sql.Timestamp(utilDate.getTime()));
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "timestampKey"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "timestampKey"));
info("Get timestamp: " + ret);
@@ -441,7 +441,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("uuidKey", uuid);
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "uuidKey"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "uuidKey"));
info("Get command result: " + ret);
@@ -451,7 +451,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("igniteUuidKey", igniteUuid);
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey"));
info("Get command result: " + ret);
@@ -466,7 +466,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("tupleKey", t);
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "tupleKey"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "tupleKey"));
info("Get command result: " + ret);
@@ -484,7 +484,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().put("getKey", "getVal");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_SIZE.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_SIZE.key()));
info("Size command result: " + ret);
@@ -495,7 +495,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testIgniteName() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.NAME.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.NAME.key()));
info("Name command result: " + ret);
@@ -506,13 +506,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testGetOrCreateCache() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
info("Name command result: " + ret);
grid(0).cache("testCache").put("1", "1");
- ret = content(F.asMap("cmd", GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
assertTrue(jsonResponse(ret).isNull());
@@ -527,7 +527,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
jcache().putAll(entries);
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
info("Get all command result: " + ret);
@@ -542,7 +542,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testIncorrectPut() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
assertResponseContainsError(ret,
"Failed to handle request: [req=CACHE_PUT, err=Failed to find mandatory parameter in request: val]");
@@ -552,9 +552,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testContainsKey() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
assertCacheOperation(ret, true);
}
@@ -563,10 +563,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testContainesKeys() throws Exception {
- grid(0).cache(null).put("key0", "val0");
- grid(0).cache(null).put("key1", "val1");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key1", "val1");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
"k1", "key0", "k2", "key1"));
assertCacheBulkOperation(ret, true);
@@ -576,116 +576,116 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testGetAndPut() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
assertCacheOperation(ret, "val0");
- assertEquals("val1", grid(0).cache(null).get("key0"));
+ assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testGetAndPutIfAbsent() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
"key", "key0", "val", "val1"));
assertCacheOperation(ret, "val0");
- assertEquals("val0", grid(0).cache(null).get("key0"));
+ assertEquals("val0", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testPutIfAbsent2() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
"key", "key0", "val", "val1"));
assertCacheOperation(ret, true);
- assertEquals("val1", grid(0).cache(null).get("key0"));
+ assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testRemoveValue() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
"key", "key0", "val", "val1"));
assertCacheOperation(ret, false);
- assertEquals("val0", grid(0).cache(null).get("key0"));
+ assertEquals("val0", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
"key", "key0", "val", "val0"));
assertCacheOperation(ret, true);
- assertNull(grid(0).cache(null).get("key0"));
+ assertNull(grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testGetAndRemove() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
"key", "key0"));
assertCacheOperation(ret, "val0");
- assertNull(grid(0).cache(null).get("key0"));
+ assertNull(grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testReplaceValue() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
"key", "key0", "val", "val1", "val2", "val2"));
assertCacheOperation(ret, false);
- assertEquals("val0", grid(0).cache(null).get("key0"));
+ assertEquals("val0", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
"key", "key0", "val", "val1", "val2", "val0"));
assertCacheOperation(ret, true);
- assertEquals("val1", grid(0).cache(null).get("key0"));
+ assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testGetAndReplace() throws Exception {
- grid(0).cache(null).put("key0", "val0");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
"key", "key0", "val", "val1"));
assertCacheOperation(ret, "val0");
- assertEquals("val1", grid(0).cache(null).get("key0"));
+ assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
}
/**
* @throws Exception If failed.
*/
public void testPut() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PUT.key(),
"key", "putKey", "val", "putVal"));
info("Put command result: " + ret);
@@ -699,7 +699,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testPutWithExpiration() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PUT.key(),
"key", "putKey", "val", "putVal", "exp", "2000"));
assertCacheOperation(ret, true);
@@ -717,7 +717,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
public void testAdd() throws Exception {
jcache().put("addKey1", "addVal1");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_ADD.key(),
"key", "addKey2", "val", "addVal2"));
assertCacheOperation(ret, true);
@@ -730,7 +730,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testAddWithExpiration() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_ADD.key(),
"key", "addKey", "val", "addVal", "exp", "2000"));
assertCacheOperation(ret, true);
@@ -746,9 +746,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testPutAll() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_ALL.key(),
- "k1", "putKey1", "k2", "putKey2",
- "v1", "putVal1", "v2", "putVal2"));
+ Map<String, String> map = F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT_ALL.key());
+
+ map.put("k1", "putKey1");
+ map.put("k2", "putKey2");
+ map.put("v1", "putVal1");
+ map.put("v2", "putVal2");
+
+ String ret = content(map);
info("Put all command result: " + ret);
@@ -766,7 +771,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("rmvVal", jcache().localPeek("rmvKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE.key(),
"key", "rmvKey"));
info("Remove command result: " + ret);
@@ -790,7 +795,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("rmvVal3", jcache().localPeek("rmvKey3"));
assertEquals("rmvVal4", jcache().localPeek("rmvKey4"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE_ALL.key(),
"k1", "rmvKey1", "k2", "rmvKey2"));
info("Remove all command result: " + ret);
@@ -802,7 +807,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertCacheBulkOperation(ret, true);
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE_ALL.key()));
info("Remove all command result: " + ret);
@@ -823,7 +828,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("casOldVal", jcache().localPeek("casKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(),
"key", "casKey", "val2", "casOldVal", "val1", "casNewVal"));
info("CAS command result: " + ret);
@@ -843,7 +848,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("repOldVal", jcache().localPeek("repKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REPLACE.key(),
"key", "repKey", "val", "repVal"));
info("Replace command result: " + ret);
@@ -861,7 +866,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("replaceVal", jcache().get("replaceKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REPLACE.key(),
"key", "replaceKey", "val", "replaceValNew", "exp", "2000"));
assertCacheOperation(ret, true);
@@ -880,7 +885,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
public void testAppend() throws Exception {
jcache().put("appendKey", "appendVal");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_APPEND.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_APPEND.key(),
"key", "appendKey", "val", "_suffix"));
assertCacheOperation(ret, true);
@@ -894,7 +899,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
public void testPrepend() throws Exception {
jcache().put("prependKey", "prependVal");
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PREPEND.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PREPEND.key(),
"key", "prependKey", "val", "prefix_"));
assertCacheOperation(ret, true);
@@ -906,7 +911,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testIncrement() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_INCREMENT.key(),
"key", "incrKey", "init", "2", "delta", "3"));
JsonNode res = jsonResponse(ret);
@@ -914,7 +919,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals(5, res.asInt());
assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get());
- ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10"));
res = jsonResponse(ret);
@@ -926,7 +931,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testDecrement() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_DECREMENT.key(),
"key", "decrKey", "init", "15", "delta", "10"));
JsonNode res = jsonResponse(ret);
@@ -934,7 +939,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals(5, res.asInt());
assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get());
- ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_DECREMENT.key(),
"key", "decrKey", "delta", "3"));
res = jsonResponse(ret);
@@ -951,7 +956,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("casOldVal", jcache().localPeek("casKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(),
"key", "casKey", "val2", "casOldVal"));
info("CAR command result: " + ret);
@@ -967,7 +972,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
public void testPutIfAbsent() throws Exception {
assertNull(jcache().localPeek("casKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(),
"key", "casKey", "val1", "casNewVal"));
info("PutIfAbsent command result: " + ret);
@@ -985,7 +990,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals("casVal", jcache().localPeek("casKey"));
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(), "key", "casKey"));
info("CAS Remove command result: " + ret);
@@ -998,7 +1003,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testMetrics() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METRICS.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METRICS.key()));
info("Cache metrics command result: " + ret);
@@ -1096,13 +1101,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Collection<GridCacheSqlMetadata> metas = cache.context().queries().sqlMetadata();
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key()));
info("Cache metadata: " + ret);
testMetadata(metas, ret);
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
info("Cache metadata with cacheName parameter: " + ret);
@@ -1122,13 +1127,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
Collection<GridCacheSqlMetadata> metas = c.context().queries().sqlMetadata();
- String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key()));
info("Cache metadata: " + ret);
testMetadata(metas, ret);
- ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
info("Cache metadata with cacheName parameter: " + ret);
@@ -1139,7 +1144,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testTopology() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false"));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false"));
info("Topology command result: " + ret);
@@ -1183,7 +1188,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testNode() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id",
+ String ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id",
grid(0).localNode().id().toString()));
info("Topology command result: " + ret);
@@ -1193,7 +1198,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertTrue(res.get("attributes").isObject());
assertTrue(res.get("metrics").isObject());
- ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
+ ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
info("Topology command result: " + ret);
@@ -1202,7 +1207,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertTrue(res.get("attributes").isNull());
assertTrue(res.get("metrics").isNull());
- ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
+ ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
UUID.randomUUID().toString()));
info("Topology command result: " + ret);
@@ -1220,14 +1225,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testExe() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.EXE.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key()));
info("Exe command result: " + ret);
assertResponseContainsError(ret);
// Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server.
- ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK"));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK"));
info("Exe command result: " + ret);
@@ -1236,7 +1241,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader());
grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader());
- ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName()));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", TestTask1.class.getName()));
info("Exe command result: " + ret);
@@ -1244,7 +1249,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertTrue(res.isNull());
- ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
info("Exe command result: " + ret);
@@ -1252,7 +1257,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals(TestTask2.RES, res.asText());
- ret = content(F.asMap("cmd", GridRestCommand.RESULT.key()));
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.RESULT.key()));
info("Exe command result: " + ret);
@@ -1563,7 +1568,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @throws Exception If failed.
*/
public void testVersion() throws Exception {
- String ret = content(F.asMap("cmd", GridRestCommand.VERSION.key()));
+ String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.VERSION.key()));
JsonNode res = jsonResponse(ret);
@@ -1652,11 +1657,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
* @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");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("1", "1");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("2", "2");
+ grid(0).cache(DEFAULT_CACHE_NAME).put("3", "3");
Map<String, String> params = new HashMap<>();
+ params.put("cacheName", DEFAULT_CACHE_NAME);
params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
params.put("type", "String");
params.put("pageSize", "1");
@@ -1668,7 +1674,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertFalse(jsonResponse(ret).get("queryId").isNull());
- ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.FETCH_SQL_QUERY.key(),
"pageSize", "1", "qryId", qryId.asText()));
JsonNode res = jsonResponse(ret);
@@ -1678,7 +1684,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
assertEquals(qryId0, qryId);
assertFalse(res.get("last").asBoolean());
- ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+ ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.FETCH_SQL_QUERY.key(),
"pageSize", "1", "qryId", qryId.asText()));
res = jsonResponse(ret);
@@ -1820,7 +1826,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
String qryId = res.get("queryId").asText();
- content(F.asMap("cmd", GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId));
+ content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId));
assertFalse(queryCursorFound());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
index 0073471..4dc8eeb 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
@@ -53,7 +53,7 @@ public class JettyRestProcessorSignedSelfTest extends JettyRestProcessorAbstract
* @throws Exception If failed.
*/
public void testUnauthorized() throws Exception {
- String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cmd=top";
+ String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cacheName=default&cmd=top";
URL url = new URL(addr);
@@ -65,7 +65,7 @@ public class JettyRestProcessorSignedSelfTest extends JettyRestProcessorAbstract
assert ((HttpURLConnection)conn).getResponseCode() == 401;
// Request with authentication info.
- addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cmd=top";
+ addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cacheName=default&cmd=top";
url = new URL(addr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
index b6781d9..284cffc 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
@@ -44,6 +44,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -88,7 +89,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
@Override protected void afterTest() throws Exception {
client.shutdown();
- grid().cache(null).clear();
+ grid().cache(DEFAULT_CACHE_NAME).clear();
grid().cache(CACHE_NAME).clear();
}
@@ -112,7 +113,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(disco);
- cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CACHE_NAME));
+ cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CACHE_NAME));
return cfg;
}
@@ -122,7 +123,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @return Cache configuration.
* @throws Exception In case of error.
*/
- private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+ private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(LOCAL);
@@ -145,8 +146,8 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testPut() throws Exception {
- assertTrue(client.cachePut(null, "key1", "val1"));
- assertEquals("val1", grid().cache(null).get("key1"));
+ assertTrue(client.cachePut(DEFAULT_CACHE_NAME, "key1", "val1"));
+ assertEquals("val1", grid().cache(DEFAULT_CACHE_NAME).get("key1"));
assertTrue(client.cachePut(CACHE_NAME, "key1", "val1"));
assertEquals("val1", grid().cache(CACHE_NAME).get("key1"));
@@ -156,9 +157,9 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testPutAll() throws Exception {
- client.cachePutAll(null, F.asMap("key1", "val1", "key2", "val2"));
+ client.cachePutAll(DEFAULT_CACHE_NAME, F.asMap("key1", "val1", "key2", "val2"));
- Map<String, String> map = grid().<String, String>cache(null).getAll(F.asSet("key1", "key2"));
+ Map<String, String> map = grid().<String, String>cache(DEFAULT_CACHE_NAME).getAll(F.asSet("key1", "key2"));
assertEquals(2, map.size());
assertEquals("val1", map.get("key1"));
@@ -177,9 +178,9 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testGet() throws Exception {
- grid().cache(null).put("key", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
- assertEquals("val", client.cacheGet(null, "key"));
+ assertEquals("val", client.cacheGet(DEFAULT_CACHE_NAME, "key"));
grid().cache(CACHE_NAME).put("key", "val");
@@ -210,7 +211,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
log,
new Callable<Object>() {
@Override public Object call() throws Exception {
- return client.cacheGet(null, "key");
+ return client.cacheGet(DEFAULT_CACHE_NAME, "key");
}
},
IgniteCheckedException.class,
@@ -225,13 +226,13 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testGetAll() throws Exception {
- IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+ IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);
jcacheDflt.put("key1", "val1");
jcacheDflt.put("key2", "val2");
- Map<String, String> map = client.cacheGetAll(null, "key1", "key2");
+ Map<String, String> map = client.cacheGetAll(DEFAULT_CACHE_NAME, "key1", "key2");
assertEquals(2, map.size());
assertEquals("val1", map.get("key1"));
@@ -240,7 +241,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
jcacheDflt.put("key3", "val3");
jcacheDflt.put("key4", "val4");
- map = client.cacheGetAll(null, "key3", "key4");
+ map = client.cacheGetAll(DEFAULT_CACHE_NAME, "key3", "key4");
assertEquals(2, map.size());
assertEquals("val3", map.get("key3"));
@@ -269,13 +270,13 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testRemove() throws Exception {
- IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+ IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);
jcacheDflt.put("key", "val");
- assertTrue(client.cacheRemove(null, "key"));
- assertFalse(client.cacheRemove(null, "wrongKey"));
+ assertTrue(client.cacheRemove(DEFAULT_CACHE_NAME, "key"));
+ assertFalse(client.cacheRemove(DEFAULT_CACHE_NAME, "wrongKey"));
assertNull(jcacheDflt.get("key"));
@@ -292,14 +293,14 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testRemoveAll() throws Exception {
- IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+ IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
jcacheDflt.put("key1", "val1");
jcacheDflt.put("key2", "val2");
jcacheDflt.put("key3", "val3");
jcacheDflt.put("key4", "val4");
- client.cacheRemoveAll(null, "key1", "key2");
+ client.cacheRemoveAll(DEFAULT_CACHE_NAME, "key1", "key2");
assertNull(jcacheDflt.get("key1"));
assertNull(jcacheDflt.get("key2"));
@@ -325,16 +326,16 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testReplace() throws Exception {
- assertFalse(client.cacheReplace(null, "key1", "val1"));
+ assertFalse(client.cacheReplace(DEFAULT_CACHE_NAME, "key1", "val1"));
- IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+ IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
jcacheDflt.put("key1", "val1");
- assertTrue(client.cacheReplace(null, "key1", "val2"));
+ assertTrue(client.cacheReplace(DEFAULT_CACHE_NAME, "key1", "val2"));
- assertFalse(client.cacheReplace(null, "key2", "val1"));
+ assertFalse(client.cacheReplace(DEFAULT_CACHE_NAME, "key2", "val1"));
jcacheDflt.put("key2", "val1");
- assertTrue(client.cacheReplace(null, "key2", "val2"));
+ assertTrue(client.cacheReplace(DEFAULT_CACHE_NAME, "key2", "val2"));
jcacheDflt.clear();
@@ -347,32 +348,32 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testCompareAndSet() throws Exception {
- assertFalse(client.cacheCompareAndSet(null, "key", null, null));
+ assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, null));
- IgniteCache<Object, Object> jcache = grid().cache(null);
+ IgniteCache<Object, Object> jcache = grid().cache(DEFAULT_CACHE_NAME);
jcache.put("key", "val");
- assertTrue(client.cacheCompareAndSet(null, "key", null, null));
+ assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, null));
assertNull(jcache.get("key"));
- assertFalse(client.cacheCompareAndSet(null, "key", null, "val"));
+ assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, "val"));
jcache.put("key", "val");
- assertFalse(client.cacheCompareAndSet(null, "key", null, "wrongVal"));
+ assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, "wrongVal"));
assertEquals("val", jcache.get("key"));
- assertTrue(client.cacheCompareAndSet(null, "key", null, "val"));
+ assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, "val"));
assertNull(jcache.get("key"));
- assertTrue(client.cacheCompareAndSet(null, "key", "val", null));
+ assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val", null));
assertEquals("val", jcache.get("key"));
- assertFalse(client.cacheCompareAndSet(null, "key", "newVal", null));
+ assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "newVal", null));
assertEquals("val", jcache.get("key"));
jcache.remove("key");
- assertFalse(client.cacheCompareAndSet(null, "key", "val1", "val2"));
+ assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val1", "val2"));
jcache.put("key", "val2");
- assertFalse(client.cacheCompareAndSet(null, "key", "val1", "wrongVal"));
+ assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val1", "wrongVal"));
assertEquals("val2", jcache.get("key"));
- assertTrue(client.cacheCompareAndSet(null, "key", "val1", "val2"));
+ assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val1", "val2"));
assertEquals("val1", jcache.get("key"));
jcache.remove("key");
@@ -409,7 +410,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testMetrics() throws Exception {
- IgniteCache<Object, Object> jcacheDft = grid().cache(null);
+ IgniteCache<Object, Object> jcacheDft = grid().cache(DEFAULT_CACHE_NAME);
IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);
jcacheDft.localMxBean().clear();
@@ -432,7 +433,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
jcacheName.get("key2");
jcacheName.get("key2");
- Map<String, Long> m = client.cacheMetrics(null);
+ Map<String, Long> m = client.cacheMetrics(DEFAULT_CACHE_NAME);
assertNotNull(m);
assertEquals(4, m.size());
@@ -451,19 +452,19 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testAppend() throws Exception {
- grid().cache(null).remove("key");
+ grid().cache(DEFAULT_CACHE_NAME).remove("key");
grid().cache(CACHE_NAME).remove("key");
- assertFalse(client.cacheAppend(null, "key", ".val"));
+ assertFalse(client.cacheAppend(DEFAULT_CACHE_NAME, "key", ".val"));
assertFalse(client.cacheAppend(CACHE_NAME, "key", ".val"));
- grid().cache(null).put("key", "orig");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "orig");
grid().cache(CACHE_NAME).put("key", "orig");
- assertTrue(client.cacheAppend(null, "key", ".val"));
- assertEquals("orig.val", grid().cache(null).get("key"));
- assertTrue(client.cacheAppend(null, "key", ".newVal"));
- assertEquals("orig.val.newVal", grid().cache(null).get("key"));
+ assertTrue(client.cacheAppend(DEFAULT_CACHE_NAME, "key", ".val"));
+ assertEquals("orig.val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
+ assertTrue(client.cacheAppend(DEFAULT_CACHE_NAME, "key", ".newVal"));
+ assertEquals("orig.val.newVal", grid().cache(DEFAULT_CACHE_NAME).get("key"));
assertTrue(client.cacheAppend(CACHE_NAME, "key", ".val"));
assertEquals("orig.val", grid().cache(CACHE_NAME).get("key"));
@@ -475,19 +476,19 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testPrepend() throws Exception {
- grid().cache(null).remove("key");
+ grid().cache(DEFAULT_CACHE_NAME).remove("key");
grid().cache(CACHE_NAME).remove("key");
- assertFalse(client.cachePrepend(null, "key", ".val"));
+ assertFalse(client.cachePrepend(DEFAULT_CACHE_NAME, "key", ".val"));
assertFalse(client.cachePrepend(CACHE_NAME, "key", ".val"));
- grid().cache(null).put("key", "orig");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "orig");
grid().cache(CACHE_NAME).put("key", "orig");
- assertTrue(client.cachePrepend(null, "key", "val."));
- assertEquals("val.orig", grid().cache(null).get("key"));
- assertTrue(client.cachePrepend(null, "key", "newVal."));
- assertEquals("newVal.val.orig", grid().cache(null).get("key"));
+ assertTrue(client.cachePrepend(DEFAULT_CACHE_NAME, "key", "val."));
+ assertEquals("val.orig", grid().cache(DEFAULT_CACHE_NAME).get("key"));
+ assertTrue(client.cachePrepend(DEFAULT_CACHE_NAME, "key", "newVal."));
+ assertEquals("newVal.val.orig", grid().cache(DEFAULT_CACHE_NAME).get("key"));
assertTrue(client.cachePrepend(CACHE_NAME, "key", "val."));
assertEquals("val.orig", grid().cache(CACHE_NAME).get("key"));
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
index 87540c2..02b7584 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -71,7 +72,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
@Override protected void afterTest() throws Exception {
client.shutdown();
- grid().cache(null).clear();
+ grid().cache(DEFAULT_CACHE_NAME).clear();
grid().cache(CACHE_NAME).clear();
}
@@ -95,7 +96,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(disco);
- cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CACHE_NAME));
+ cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CACHE_NAME));
return cfg;
}
@@ -105,7 +106,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
* @return Cache configuration.
* @throws Exception In case of error.
*/
- private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+ private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(LOCAL);
@@ -129,7 +130,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
*/
public void testPut() throws Exception {
assertTrue(client.cachePut(null, "key1", "val1"));
- assertEquals("val1", grid().cache(null).get("key1"));
+ assertEquals("val1", grid().cache(DEFAULT_CACHE_NAME).get("key1"));
assertTrue(client.cachePut(CACHE_NAME, "key1", "val1"));
assertEquals("val1", grid().cache(CACHE_NAME).get("key1"));
@@ -139,7 +140,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testGet() throws Exception {
- grid().cache(null).put("key", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
Assert.assertEquals("val", client.cacheGet(null, "key"));
@@ -152,12 +153,12 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testRemove() throws Exception {
- grid().cache(null).put("key", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
assertTrue(client.cacheRemove(null, "key"));
assertFalse(client.cacheRemove(null, "wrongKey"));
- assertNull(grid().cache(null).get("key"));
+ assertNull(grid().cache(DEFAULT_CACHE_NAME).get("key"));
grid().cache(CACHE_NAME).put("key", "val");
@@ -172,9 +173,9 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
*/
public void testAdd() throws Exception {
assertTrue(client.cacheAdd(null, "key", "val"));
- assertEquals("val", grid().cache(null).get("key"));
+ assertEquals("val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
assertFalse(client.cacheAdd(null, "key", "newVal"));
- assertEquals("val", grid().cache(null).get("key"));
+ assertEquals("val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
assertTrue(client.cacheAdd(CACHE_NAME, "key", "val"));
assertEquals("val", grid().cache(CACHE_NAME).get("key"));
@@ -187,14 +188,14 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
*/
public void testReplace() throws Exception {
assertFalse(client.cacheReplace(null, "key1", "val1"));
- grid().cache(null).put("key1", "val1");
+ grid().cache(DEFAULT_CACHE_NAME).put("key1", "val1");
assertTrue(client.cacheReplace(null, "key1", "val2"));
assertFalse(client.cacheReplace(null, "key2", "val1"));
- grid().cache(null).put("key2", "val1");
+ grid().cache(DEFAULT_CACHE_NAME).put("key2", "val1");
assertTrue(client.cacheReplace(null, "key2", "val2"));
- grid().cache(null).clear();
+ grid().cache(DEFAULT_CACHE_NAME).clear();
assertFalse(client.cacheReplace(CACHE_NAME, "key1", "val1"));
grid().cache(CACHE_NAME).put("key1", "val1");
@@ -205,16 +206,16 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testMetrics() throws Exception {
- grid().cache(null).localMxBean().clear();
+ grid().cache(DEFAULT_CACHE_NAME).localMxBean().clear();
grid().cache(CACHE_NAME).localMxBean().clear();
- grid().cache(null).put("key1", "val");
- grid().cache(null).put("key2", "val");
- grid().cache(null).put("key2", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key1", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key2", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key2", "val");
- grid().cache(null).get("key1");
- grid().cache(null).get("key2");
- grid().cache(null).get("key2");
+ grid().cache(DEFAULT_CACHE_NAME).get("key1");
+ grid().cache(DEFAULT_CACHE_NAME).get("key2");
+ grid().cache(DEFAULT_CACHE_NAME).get("key2");
grid().cache(CACHE_NAME).put("key1", "val");
grid().cache(CACHE_NAME).put("key2", "val");
@@ -292,9 +293,9 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
assertFalse(client.cacheAppend(null, "wrongKey", "_suffix"));
assertFalse(client.cacheAppend(CACHE_NAME, "wrongKey", "_suffix"));
- grid().cache(null).put("key", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
assertTrue(client.cacheAppend(null, "key", "_suffix"));
- assertEquals("val_suffix", grid().cache(null).get("key"));
+ assertEquals("val_suffix", grid().cache(DEFAULT_CACHE_NAME).get("key"));
grid().cache(CACHE_NAME).put("key", "val");
assertTrue(client.cacheAppend(CACHE_NAME, "key", "_suffix"));
@@ -308,9 +309,9 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
assertFalse(client.cachePrepend(null, "wrongKey", "prefix_"));
assertFalse(client.cachePrepend(CACHE_NAME, "wrongKey", "prefix_"));
- grid().cache(null).put("key", "val");
+ grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
assertTrue(client.cachePrepend(null, "key", "prefix_"));
- assertEquals("prefix_val", grid().cache(null).get("key"));
+ assertEquals("prefix_val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
grid().cache(CACHE_NAME).put("key", "val");
assertTrue(client.cachePrepend(CACHE_NAME, "key", "prefix_"));
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
index ad62e6d..5b4ce53 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
@@ -140,7 +140,7 @@ public class RestProcessorTest extends GridCommonAbstractTest {
*
*/
private void populateCache() {
- IgniteCache<String, Object> cache = G.ignite().cache(null);
+ IgniteCache<String, Object> cache = G.ignite().cache(DEFAULT_CACHE_NAME);
cache.put("int", intValue());
cache.put("string", "cacheString");
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
index 7f47e77..f6acd56 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
@@ -45,6 +45,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentLinkedHashMap;
@@ -120,7 +121,7 @@ public class TaskCommandHandlerSelfTest extends GridCommonAbstractTest {
cfg.setDiscoverySpi(disco);
- cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration("replicated"),
+ cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration("replicated"),
cacheConfiguration("partitioned"), cacheConfiguration(CACHE_NAME));
return cfg;
@@ -131,10 +132,10 @@ public class TaskCommandHandlerSelfTest extends GridCommonAbstractTest {
* @return Cache configuration.
* @throws Exception In case of error.
*/
- private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+ private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
- cfg.setCacheMode(cacheName == null || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
+ cfg.setCacheMode(DEFAULT_CACHE_NAME.equals(cacheName) || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
REPLICATED : PARTITIONED);
cfg.setName(cacheName);
cfg.setWriteSynchronizationMode(FULL_SYNC);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
index d71883b..badfd64 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.util.GridClientByteUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.logger.java.JavaLogger;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest.GridCacheOperation.APPEND;
@@ -320,7 +321,7 @@ final class TestBinaryClient {
* @return If value was actually put.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> boolean cachePut(@Nullable String cacheName, K key, V val)
+ public <K, V> boolean cachePut(@NotNull String cacheName, K key, V val)
throws IgniteCheckedException {
return cachePutAll(cacheName, Collections.singletonMap(key, val));
}
@@ -332,7 +333,7 @@ final class TestBinaryClient {
* {@code false} otherwise
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> boolean cachePutAll(@Nullable String cacheName, Map<K, V> entries)
+ public <K, V> boolean cachePutAll(@NotNull String cacheName, Map<K, V> entries)
throws IgniteCheckedException {
assert entries != null;
@@ -351,7 +352,7 @@ final class TestBinaryClient {
* @return Value.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> V cacheGet(@Nullable String cacheName, K key)
+ public <K, V> V cacheGet(@NotNull String cacheName, K key)
throws IgniteCheckedException {
assert key != null;
@@ -371,7 +372,7 @@ final class TestBinaryClient {
* @return Entries.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> Map<K, V> cacheGetAll(@Nullable String cacheName, K... keys)
+ public <K, V> Map<K, V> cacheGetAll(@NotNull String cacheName, K... keys)
throws IgniteCheckedException {
assert keys != null;
@@ -391,7 +392,7 @@ final class TestBinaryClient {
* @throws IgniteCheckedException In case of error.
*/
@SuppressWarnings("unchecked")
- public <K> boolean cacheRemove(@Nullable String cacheName, K key) throws IgniteCheckedException {
+ public <K> boolean cacheRemove(@NotNull String cacheName, K key) throws IgniteCheckedException {
assert key != null;
GridClientCacheRequest req = new GridClientCacheRequest(RMV);
@@ -409,7 +410,7 @@ final class TestBinaryClient {
* @return Whether entries were actually removed
* @throws IgniteCheckedException In case of error.
*/
- public <K> boolean cacheRemoveAll(@Nullable String cacheName, K... keys)
+ public <K> boolean cacheRemoveAll(@NotNull String cacheName, K... keys)
throws IgniteCheckedException {
assert keys != null;
@@ -429,7 +430,7 @@ final class TestBinaryClient {
* @return Whether value was actually replaced.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> boolean cacheReplace(@Nullable String cacheName, K key, V val)
+ public <K, V> boolean cacheReplace(@NotNull String cacheName, K key, V val)
throws IgniteCheckedException {
assert key != null;
assert val != null;
@@ -452,7 +453,7 @@ final class TestBinaryClient {
* @return Whether new value was actually set.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> boolean cacheCompareAndSet(@Nullable String cacheName, K key, @Nullable V val1, @Nullable V val2)
+ public <K, V> boolean cacheCompareAndSet(@NotNull String cacheName, K key, @Nullable V val1, @Nullable V val2)
throws IgniteCheckedException {
assert key != null;
@@ -472,7 +473,7 @@ final class TestBinaryClient {
* @return Metrics.
* @throws IgniteCheckedException In case of error.
*/
- public <K> Map<String, Long> cacheMetrics(@Nullable String cacheName) throws IgniteCheckedException {
+ public <K> Map<String, Long> cacheMetrics(@NotNull String cacheName) throws IgniteCheckedException {
GridClientCacheRequest metrics = new GridClientCacheRequest(METRICS);
metrics.requestId(idCntr.getAndIncrement());
@@ -488,7 +489,7 @@ final class TestBinaryClient {
* @return Whether entry was appended.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> boolean cacheAppend(@Nullable String cacheName, K key, V val)
+ public <K, V> boolean cacheAppend(@NotNull String cacheName, K key, V val)
throws IgniteCheckedException {
assert key != null;
assert val != null;
@@ -510,7 +511,7 @@ final class TestBinaryClient {
* @return Whether entry was prepended.
* @throws IgniteCheckedException In case of error.
*/
- public <K, V> boolean cachePrepend(@Nullable String cacheName, K key, V val)
+ public <K, V> boolean cachePrepend(@NotNull String cacheName, K key, V val)
throws IgniteCheckedException {
assert key != null;
assert val != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
index 79896ea..691996c 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
@@ -114,7 +114,7 @@ public class RedisProtocolSelfTest extends GridCommonAbstractTest {
* @return Cache.
*/
@Override protected <K, V> IgniteCache<K, V> jcache() {
- return grid(0).cache(null);
+ return grid(0).cache(DEFAULT_CACHE_NAME);
}
/** {@inheritDoc} */
@@ -221,8 +221,8 @@ public class RedisProtocolSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testSet() throws Exception {
- long EXPIRE_MS = 5000L;
- int EXPIRE_SEC = 5;
+ long EXPIRE_MS = 1000L;
+ int EXPIRE_SEC = 1;
try (Jedis jedis = pool.getResource()) {
jedis.set("setKey1", "1");
@@ -245,7 +245,7 @@ public class RedisProtocolSelfTest extends GridCommonAbstractTest {
Assert.assertNull(jcache().get("setKey4"));
// wait for expiration.
- Thread.sleep(EXPIRE_MS);
+ Thread.sleep((long)(EXPIRE_MS * 1.2));
Assert.assertNull(jcache().get("setKey1"));
Assert.assertNull(jcache().get("setKey3"));
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
index a150574..6492eb0 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
@@ -108,7 +108,7 @@ public abstract class AbstractJdbcPojoQuerySelfTest extends GridCommonAbstractTe
BinaryObject binObj = builder.build();
- IgniteCache<String, BinaryObject> cache = grid(0).cache(null);
+ IgniteCache<String, BinaryObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
cache.put("0", binObj);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
index cc06180..a2a83ee 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -54,7 +55,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CUSTOM_CACHE_NAME));
+ cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CUSTOM_CACHE_NAME));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
@@ -79,7 +80,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
* @return Cache configuration.
* @throws Exception In case of error.
*/
- private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+ private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setName(name);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
index 1506295..2d27637 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -74,7 +75,7 @@ public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest {
* @throws Exception In case of error.
*/
@SuppressWarnings("unchecked")
- private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+ private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setIndexedTypes(Integer.class, Integer.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
index c2af8a1..6729d04 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
@@ -26,7 +26,7 @@ import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
*/
public class JdbcPojoQuerySelfTest extends AbstractJdbcPojoQuerySelfTest {
/** URL. */
- private static final String URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-bin-config.xml";
+ private static final String URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-bin-config.xml";
/**
* @throws Exception If failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
index 5351b6a..67ccdb1 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
@@ -100,7 +100,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest {
@Override protected void beforeTestsStarted() throws Exception {
startGridsMultiThreaded(3);
- IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+ IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
assert cache != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
index 05f7f04..140ff36 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
@@ -95,7 +95,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
@Override protected void beforeTestsStarted() throws Exception {
startGridsMultiThreaded(3);
- IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+ IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
assert cache != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
index eb77ec6..360d118 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
@@ -85,7 +85,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest {
@Override protected void beforeTestsStarted() throws Exception {
startGridsMultiThreaded(3);
- IgniteCache<String, Person> cache = grid(0).cache(null);
+ IgniteCache<String, Person> cache = grid(0).cache(DEFAULT_CACHE_NAME);
assert cache != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index d8addcd..7445264 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -340,7 +340,7 @@ public interface Ignite extends AutoCloseable {
* @return Cache instance.
* @throws CacheException If error occurs.
*/
- public <K, V> IgniteCache<K, V> createNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V> nearCfg)
+ public <K, V> IgniteCache<K, V> createNearCache(String cacheName, NearCacheConfiguration<K, V> nearCfg)
throws CacheException;
/**
@@ -351,7 +351,7 @@ public interface Ignite extends AutoCloseable {
* @return {@code IgniteCache} instance.
* @throws CacheException If error occurs.
*/
- public <K, V> IgniteCache<K, V> getOrCreateNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V> nearCfg)
+ public <K, V> IgniteCache<K, V> getOrCreateNearCache(String cacheName, NearCacheConfiguration<K, V> nearCfg)
throws CacheException;
/**
@@ -378,7 +378,7 @@ public interface Ignite extends AutoCloseable {
* @return Instance of the cache for the specified name.
* @throws CacheException If error occurs.
*/
- public <K, V> IgniteCache<K, V> cache(@Nullable String name) throws CacheException;
+ public <K, V> IgniteCache<K, V> cache(String name) throws CacheException;
/**
* Gets the collection of names of currently available caches.
@@ -402,11 +402,11 @@ public interface Ignite extends AutoCloseable {
* is responsible for loading external data into in-memory data grid. For more information
* refer to {@link IgniteDataStreamer} documentation.
*
- * @param cacheName Cache name ({@code null} for default cache).
+ * @param cacheName Cache name.
* @return Data streamer.
* @throws IllegalStateException If node is stopping.
*/
- public <K, V> IgniteDataStreamer<K, V> dataStreamer(@Nullable String cacheName) throws IllegalStateException;
+ public <K, V> IgniteDataStreamer<K, V> dataStreamer(String cacheName) throws IllegalStateException;
/**
* Gets an instance of IGFS (Ignite In-Memory File System). If one is not
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
index f0e6039..98a9eb6 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
@@ -138,7 +138,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @throws IgniteException If job failed.
*/
@IgniteAsyncSupported
- public void affinityRun(@Nullable String cacheName, Object affKey, IgniteRunnable job) throws IgniteException;
+ public void affinityRun(String cacheName, Object affKey, IgniteRunnable job) throws IgniteException;
/**
* Executes given job asynchronously on the node where data for provided affinity key is located
@@ -151,7 +151,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @return a Future representing pending completion of the affinity run.
* @throws IgniteException If job failed.
*/
- public IgniteFuture<Void> affinityRunAsync(@Nullable String cacheName, Object affKey, IgniteRunnable job)
+ public IgniteFuture<Void> affinityRunAsync(String cacheName, Object affKey, IgniteRunnable job)
throws IgniteException;
/**
@@ -231,7 +231,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @throws IgniteException If job failed.
*/
@IgniteAsyncSupported
- public <R> R affinityCall(@Nullable String cacheName, Object affKey, IgniteCallable<R> job) throws IgniteException;
+ public <R> R affinityCall(String cacheName, Object affKey, IgniteCallable<R> job) throws IgniteException;
/**
* Executes given job asynchronously on the node where data for provided affinity key is located
@@ -244,7 +244,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
* @return a Future representing pending completion of the affinity call.
* @throws IgniteException If job failed.
*/
- public <R> IgniteFuture<R> affinityCallAsync(@Nullable String cacheName, Object affKey, IgniteCallable<R> job)
+ public <R> IgniteFuture<R> affinityCallAsync(String cacheName, Object affKey, IgniteCallable<R> job)
throws IgniteException;
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 275a21e..b0fcbc0 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -473,12 +473,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
/**
* Sets cache name.
*
- * @param name Cache name. May be <tt>null</tt>, but may not be empty string.
+ * @param name Cache name. Can not be <tt>null</tt> or empty.
* @return {@code this} for chaining.
*/
public CacheConfiguration<K, V> setName(String name) {
- A.ensure(name == null || !name.isEmpty(), "Name cannot be empty.");
-
this.name = name;
return this;
@@ -499,7 +497,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @return {@code this} for chaining.
*/
public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) {
- A.ensure(name == null || !name.isEmpty(), "Name cannot be empty.");
+ A.ensure(memPlcName == null || !memPlcName.isEmpty(), "Name cannot be empty.");
this.memPlcName = memPlcName;