http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonArraySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonArraySelfTest.java
 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonArraySelfTest.java
new file mode 100644
index 0000000..d80445f
--- /dev/null
+++ 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonArraySelfTest.java
@@ -0,0 +1,807 @@
+/*
+ * 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.processors.json;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.concurrent.Callable;
+import javax.json.JsonArray;
+import javax.json.JsonString;
+import javax.json.JsonValue;
+import javax.json.spi.JsonProvider;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.json.IgniteJson;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests for {@link IgniteJsonArray} implementation.
+ */
+public class IgniteJsonArraySelfTest extends GridCommonAbstractTest {
+    /** JSON provider. */
+    private static JsonProvider json;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        json = IgniteJson.jsonProvider(startGrid());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIsNull() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.isNull(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(42)
+            .addNull()
+            .build();
+
+        assertFalse(arr.isNull(0));
+        assertTrue(arr.isNull(1));
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.isNull(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.isNull(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetBoolean() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.getBoolean(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(true)
+            .add(false)
+            .add(42)
+            .addNull()
+            .build();
+
+        assertTrue(arr.getBoolean(0));
+        assertFalse(arr.getBoolean(1));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getBoolean(2);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getBoolean(3);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getBoolean(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getBoolean(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetBooleanWithDefault() throws Exception {
+        JsonArray emptyArr = json.createArrayBuilder().build();
+
+        assertTrue(emptyArr.getBoolean(0, true));
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(true)
+            .add(false)
+            .add(42)
+            .addNull()
+            .build();
+
+        assertTrue(arr.getBoolean(0, false));
+        assertFalse(arr.getBoolean(1, true));
+        assertTrue(arr.getBoolean(2, true));
+        assertTrue(arr.getBoolean(3, true));
+        assertTrue(arr.getBoolean(arr.size(), true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetInt() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.getInt(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(42)
+            .add("string")
+            .addNull()
+            .build();
+
+        assertEquals(42, arr.getInt(0));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getInt(1);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getInt(2);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getInt(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getInt(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetIntWithDefault() throws Exception {
+        JsonArray emptyArr = json.createArrayBuilder().build();
+
+        assertEquals(42, emptyArr.getInt(0, 42));
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(42)
+            .add("string")
+            .addNull()
+            .build();
+
+        assertEquals(42, arr.getInt(0, 666));
+        assertEquals(51, arr.getInt(1, 51));
+        assertEquals(51, arr.getInt(2, 51));
+        assertEquals(51, arr.getInt(arr.size(), 51));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetString() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.getString(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add("string")
+            .add(42)
+            .addNull()
+            .build();
+
+        assertEquals("string", arr.getString(0));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getString(1);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getString(2);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getString(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getString(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetStringWithDefault() throws Exception {
+        JsonArray emptyArr = json.createArrayBuilder().build();
+
+        assertEquals("default", emptyArr.getString(0, "default"));
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add("string")
+            .add(42)
+            .addNull()
+            .build();
+
+        assertEquals("string", arr.getString(0, "default"));
+        assertEquals("default", arr.getString(1, "default"));
+        assertEquals("default", arr.getString(2, "default"));
+        assertEquals("default", arr.getString(arr.size(), "default"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonNumber() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.getJsonNumber(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(42)
+            .add("string")
+            .addNull()
+            .build();
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(42)), 
arr.getJsonNumber(0));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonNumber(1);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonNumber(2);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonNumber(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonNumber(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonString() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.getJsonString(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add("string")
+            .add(42)
+            .addNull()
+            .build();
+
+        assertEquals(new IgniteJsonString("string"), arr.getJsonString(0));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonString(1);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonString(2);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonString(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonString(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonObject() throws Exception {
+        final JsonArray emptyArr = json.createArrayBuilder().build();
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyArr.getJsonObject(0);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        final JsonArray arr = json.createArrayBuilder()
+            .add(json.createObjectBuilder().add("key", "val").build())
+            .add(42)
+            .addNull()
+            .build();
+
+        assertEquals(json.createObjectBuilder().add("key", "val").build(), 
arr.getJsonObject(0));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonObject(1);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonObject(2);
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonObject(-1);
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                arr.getJsonObject(arr.size());
+
+                return null;
+            }
+        }, IndexOutOfBoundsException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetValuesAs() throws Exception {
+        JsonArray emptyArr = json.createArrayBuilder().build();
+
+        assertTrue(emptyArr.getValuesAs(JsonString.class).isEmpty());
+
+        JsonArray strArr = json.createArrayBuilder().add("1").add("2").build();
+
+        List<JsonString> expStrs = F.<JsonString>asList(new 
IgniteJsonString("1"), new IgniteJsonString("2"));
+        assertEquals(expStrs, strArr.getValuesAs(JsonString.class));
+
+        JsonArray arr = json.createArrayBuilder().add(1).add("2").build();
+
+        final List<JsonString> actStrs = arr.getValuesAs(JsonString.class);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                for (JsonString ignored : actStrs) {
+                    // No-op.
+                }
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSubList() throws Exception {
+        JsonArray strArr = 
json.createArrayBuilder().add("1").add("2").add("3").add("4").build();
+
+        List<JsonString> expStrs = F.<JsonString>asList(new 
IgniteJsonString("2"), new IgniteJsonString("3"));
+        assertEquals(expStrs, strArr.subList(1, 3));
+    }
+
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContains() throws Exception {
+        JsonArray arr = json.createArrayBuilder().build();
+        assertFalse(arr.contains(JsonValue.TRUE));
+
+        arr = json.createArrayBuilder().add(true).build();
+        assertTrue(arr.contains(JsonValue.TRUE));
+
+        arr = json.createArrayBuilder().add(false).build();
+        assertTrue(arr.contains(JsonValue.FALSE));
+
+        arr = json.createArrayBuilder().addNull().build();
+        assertTrue(arr.contains(JsonValue.NULL));
+
+        arr = json.createArrayBuilder().add("value").build();
+        assertTrue(arr.contains(new IgniteJsonString("value")));
+
+        arr = json.createArrayBuilder().add("value").build();
+        assertTrue(arr.contains(new IgniteJsonString("value")));
+
+        arr = json.createArrayBuilder().add(1).build();
+        assertTrue(arr.contains(new IgniteJsonNumber(new BigDecimal(1L))));
+
+        arr = json.createArrayBuilder().add(1L).build();
+        assertTrue(arr.contains(new IgniteJsonNumber(new BigDecimal(1))));
+
+        arr = json.createArrayBuilder().add(1.0).build();
+        assertTrue(arr.contains(new IgniteJsonNumber(new BigDecimal(1))));
+
+        arr = json.createArrayBuilder().add(new BigInteger("1")).build();
+        assertTrue(arr.contains(new IgniteJsonNumber(new BigDecimal(1))));
+
+        arr = json.createArrayBuilder().add(new BigDecimal(1)).build();
+        assertTrue(arr.contains(new IgniteJsonNumber(new BigDecimal(1))));
+
+        arr = json.createArrayBuilder().add(
+            json.createArrayBuilder()
+                .addNull()
+                .add(JsonValue.TRUE)
+                .add(JsonValue.FALSE)
+                .add("string")
+                .add(1)
+                .add(1L)
+                .add(1.0)
+                .add(new BigInteger("1"))
+                .add(new BigDecimal(1))
+                .build()
+        ).build();
+
+        assertTrue(arr.contains(
+            json.createArrayBuilder()
+                .addNull()
+                .add(JsonValue.TRUE)
+                .add(JsonValue.FALSE)
+                .add("string")
+                .add(1)
+                .add(1L)
+                .add(1.0)
+                .add(new BigInteger("1"))
+                .add(new BigDecimal(1))
+                .build()
+        ));
+
+        arr = json.createArrayBuilder().add(
+            json.createObjectBuilder()
+                .addNull("nullField")
+                .add("trueField", true)
+                .add("falseField", false)
+                .add("strField", "string")
+                .add("intField", 1)
+                .add("longField", 1L)
+                .add("doubleField", 1L)
+                .add("bigIntField", new BigInteger("1"))
+                .add("bigDecimalField", new BigDecimal(1))
+                .build()
+        ).build();
+
+        assertTrue(arr.contains(
+            json.createObjectBuilder()
+                .addNull("nullField")
+                .add("trueField", true)
+                .add("falseField", false)
+                .add("strField", "string")
+                .add("intField", 1)
+                .add("longField", 1L)
+                .add("doubleField", 1L)
+                .add("bigIntField", new BigInteger("1"))
+                .add("bigDecimalField", new BigDecimal(1))
+                .build()
+            )
+        );
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContainsAll() throws Exception {
+        JsonArray emptyArr = json.createArrayBuilder().build();
+
+        assertFalse(emptyArr.containsAll(F.asList(JsonValue.TRUE, 
JsonValue.NULL)));
+
+        JsonArray arr = json.createArrayBuilder()
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add(JsonValue.FALSE)
+            .add("string")
+            .add(1)
+            .add(1L)
+            .add(1.0)
+            .add(new BigInteger("1"))
+            .add(new BigDecimal(1))
+            .build();
+
+        assertTrue(arr.containsAll(F.asList(JsonValue.TRUE, JsonValue.NULL, 
new IgniteJsonString("string"))));
+        assertFalse(arr.containsAll(F.asList(JsonValue.TRUE, JsonValue.NULL, 
new IgniteJsonString("value"))));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testToArray() throws Exception {
+        JsonArray jsonArr = json.createArrayBuilder()
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .build();
+
+        Object[] arr = jsonArr.toArray();
+
+        assertEquals(JsonValue.NULL, arr[0]);
+        assertEquals(JsonValue.TRUE, arr[1]);
+        assertEquals(new IgniteJsonString("string"), arr[2]);
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), arr[3]);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIterator() throws Exception {
+        JsonArray arr = json.createArrayBuilder()
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .build();
+
+        final Iterator<JsonValue> it = arr.iterator();
+
+        assertTrue(it.hasNext());
+        assertEquals(JsonValue.NULL, it.next());
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                it.remove();
+
+                return null;
+            }
+        }, UnsupportedOperationException.class, null);
+
+        assertTrue(it.hasNext());
+        assertEquals(JsonValue.TRUE, it.next());
+
+        assertTrue(it.hasNext());
+        assertEquals(new IgniteJsonString("string"), it.next());
+
+        assertTrue(it.hasNext());
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), it.next());
+
+        assertFalse(it.hasNext());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testListIterator() throws Exception {
+        JsonArray arr = json.createArrayBuilder()
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .build();
+
+        final ListIterator<JsonValue> it = arr.listIterator();
+
+        assertTrue(it.hasNext());
+        assertEquals(-1, it.previousIndex());
+        assertEquals(0, it.nextIndex());
+        assertEquals(JsonValue.NULL, it.next());
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                it.remove();
+
+                return null;
+            }
+        }, UnsupportedOperationException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                it.add(JsonValue.TRUE);
+
+                return null;
+            }
+        }, UnsupportedOperationException.class, null);
+
+        GridTestUtils.assertThrowsInherited(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                it.add(JsonValue.TRUE);
+
+                return null;
+            }
+        }, UnsupportedOperationException.class, null);
+
+        assertTrue(it.hasNext());
+        assertEquals(0, it.previousIndex());
+        assertEquals(1, it.nextIndex());
+        assertEquals(JsonValue.TRUE, it.next());
+
+        assertTrue(it.hasNext());
+        assertEquals(1, it.previousIndex());
+        assertEquals(2, it.nextIndex());
+        assertEquals(new IgniteJsonString("string"), it.next());
+
+        assertTrue(it.hasNext());
+        assertEquals(2, it.previousIndex());
+        assertEquals(3, it.nextIndex());
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), it.next());
+
+        assertFalse(it.hasNext());
+        assertEquals(3, it.previousIndex());
+        assertEquals(4, it.nextIndex());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIndexOf() throws Exception {
+        JsonArray arr = json.createArrayBuilder()
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .build();
+
+        assertEquals(0, arr.indexOf(JsonValue.NULL));
+        assertEquals(1, arr.indexOf(JsonValue.TRUE));
+        assertEquals(2, arr.indexOf(new IgniteJsonString("string")));
+        assertEquals(3, arr.indexOf(new IgniteJsonNumber(new BigDecimal(1))));
+        assertEquals(-1, arr.indexOf(JsonValue.FALSE));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLastIndexOf() throws Exception {
+        JsonArray arr = json.createArrayBuilder()
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .addNull()
+            .add(JsonValue.TRUE)
+            .add("string")
+            .add(1)
+            .build();
+
+        assertEquals(4, arr.lastIndexOf(JsonValue.NULL));
+        assertEquals(5, arr.lastIndexOf(JsonValue.TRUE));
+        assertEquals(6, arr.lastIndexOf(new IgniteJsonString("string")));
+        assertEquals(7, arr.lastIndexOf(new IgniteJsonNumber(new 
BigDecimal(1))));
+        assertEquals(-1, arr.lastIndexOf(JsonValue.FALSE));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonCacheTest.java
----------------------------------------------------------------------
diff --git 
a/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonCacheTest.java
 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonCacheTest.java
index 0e9b50b..cb5a53a 100644
--- 
a/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonCacheTest.java
+++ 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonCacheTest.java
@@ -17,21 +17,26 @@
 
 package org.apache.ignite.internal.processors.json;
 
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.query.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.json.*;
-import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import javax.cache.*;
-import javax.json.*;
-import javax.json.spi.*;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import javax.cache.Cache;
+import javax.json.JsonObject;
+import javax.json.JsonObjectBuilder;
+import javax.json.spi.JsonProvider;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.json.IgniteJson;
+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;
 
 /**
  *
@@ -51,25 +56,27 @@ public class IgniteJsonCacheTest extends 
GridCommonAbstractTest {
 
         CacheConfiguration ccfg = new CacheConfiguration();
 
-/*
         QueryEntity qryEntity = new QueryEntity();
 
+        qryEntity.setKeyType(JsonObject.class.getName());
         qryEntity.setValueType(JsonObject.class.getName());
 
         qryEntity.setIndexes(Arrays.asList(
             new QueryIndex("name"),
             new QueryIndex("id"),
-            new QueryIndex("address.street")));
+            new QueryIndex("street")));
 
         LinkedHashMap<String, String> fields = new LinkedHashMap<>();
 
+        fields.put("id", Integer.class.getName());
+        fields.put("name", String.class.getName());
         fields.put("salary", Integer.class.getName());
         fields.put("address", JsonObject.class.getName());
+        fields.put("address.street", String.class.getName());
 
         qryEntity.setFields(fields);
 
         ccfg.setQueryEntities(Collections.singleton(qryEntity));
-*/
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -110,19 +117,38 @@ public class IgniteJsonCacheTest extends 
GridCommonAbstractTest {
 
         JsonObject key = provider.createObjectBuilder()
             .add("name", "a")
+            .addNull("n1")
             .build();
 
+/*
+        System.out.println("!!! key " + (key.get("n1") == null));
+        System.out.println("!!! key " + (key.get("n2") == null));
+*/
+
         JsonObject obj = provider.createObjectBuilder()
             .add("salary", 1)
             .add("id", 1)
+            .addNull("n2")
             .build();
 
+/*
+        System.out.println("!!! key " + (key.get("n1") == null));
+        System.out.println("!!! key " + (key.get("n2") == null));
+
+        System.out.println("!!! obj " + (obj.get("n1") == null));
+        System.out.println("!!! obj " + (obj.get("n2") == null));
+*/
+
         cache.put(key, obj);
 
         JsonObject key1 = provider.createObjectBuilder()
             .add("name", "a")
+            .addNull("n1")
             .build();
 
+        System.out.println("!!! key.hashCode " + key.hashCode());
+        System.out.println("!!! key1.hashCode " + key1.hashCode());
+
         assertEquals(key, key1);
 
         JsonObject actual = cache.get(key1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectBuilderSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectBuilderSelfTest.java
 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectBuilderSelfTest.java
new file mode 100644
index 0000000..5110e0e
--- /dev/null
+++ 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectBuilderSelfTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.processors.json;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.List;
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import javax.json.JsonValue;
+import javax.json.spi.JsonProvider;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.json.IgniteJson;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests for {@link IgniteJsonObjectBuilder} implementation.
+ */
+public class IgniteJsonObjectBuilderSelfTest extends GridCommonAbstractTest {
+    /** JSON provider. */
+    private static JsonProvider json;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        json = IgniteJson.jsonProvider(startGrid());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAddJavaObjects() throws Exception {
+        JsonObject jsonObj = json.createObjectBuilder()
+            .add("0", true)
+            .add("1", false)
+            .add("2", 1)
+            .add("3", 1L)
+            .add("4", 1.0)
+            .add("5", new BigInteger("1"))
+            .add("6", new BigDecimal(1))
+            .add("7", "string")
+            .build();
+
+        BinaryObject binObj = ((IgniteJsonObject)jsonObj).binaryObject();
+
+        assertEquals(JsonValue.TRUE, jsonObj.get("0"));
+        assertEquals(Boolean.TRUE, binObj.field("0"));
+
+        assertEquals(JsonValue.FALSE, jsonObj.get("1"));
+        assertEquals(Boolean.FALSE, binObj.field("1"));
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), 
jsonObj.get("2"));
+        assertEquals(1, binObj.field("2"));
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), 
jsonObj.get("3"));
+        assertEquals(1L, binObj.field("3"));
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), 
jsonObj.get("4"));
+        assertEquals(1.0, (Double)binObj.field("4"), 0);
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), 
jsonObj.get("5"));
+        assertEquals(new BigInteger("1"), binObj.field("5"));
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), 
jsonObj.get("6"));
+        assertEquals(new BigDecimal(1), binObj.field("6"));
+
+        assertEquals(new IgniteJsonString("string"), jsonObj.get("7"));
+        assertEquals("string", binObj.field("7"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAddJsonObjects() throws Exception {
+        JsonObject jsonObj = json.createObjectBuilder()
+            .addNull("0")
+            .add("1", JsonValue.NULL)
+            .add("2", JsonValue.TRUE)
+            .add("3", JsonValue.FALSE)
+            .add("4", new IgniteJsonNumber(new BigDecimal(1)))
+            .add("5", new IgniteJsonString("string"))
+            .add("6", json.createArrayBuilder().add(1).add(2).build())
+            .add("7", json.createArrayBuilder().add(1).add(2))
+            .add("8", json.createObjectBuilder().add("k1", 1).add("k2", 
2).build())
+            .add("9", json.createObjectBuilder().add("k1", 1).add("k2", 2))
+            .build();
+
+        BinaryObject binObj = ((IgniteJsonObject)jsonObj).binaryObject();
+
+        assertEquals(JsonValue.NULL, jsonObj.get("0"));
+        assertNull(binObj.field("0"));
+
+        assertEquals(JsonValue.NULL, jsonObj.get("1"));
+        assertNull(binObj.field("1"));
+
+        assertEquals(JsonValue.TRUE, jsonObj.get("2"));
+        assertEquals(Boolean.TRUE, binObj.field("2"));
+
+        assertEquals(JsonValue.FALSE, jsonObj.get("3"));
+        assertEquals(Boolean.FALSE, binObj.field("3"));
+
+        assertEquals(new IgniteJsonNumber(new BigDecimal(1)), 
jsonObj.get("4"));
+        assertEquals(new BigDecimal(1), binObj.field("4"));
+
+        assertEquals(new IgniteJsonString("string"), jsonObj.get("5"));
+        assertEquals("string", binObj.field("5"));
+
+        assertEquals(json.createArrayBuilder().add(1).add(2).build(), 
jsonObj.get("6"));
+        assertEqualsCollections(F.asList(1, 2), (List)binObj.field("6"));
+
+        assertEquals(json.createArrayBuilder().add(1).add(2).build(), 
jsonObj.get("7"));
+        assertEqualsCollections(F.asList(1, 2), (List)binObj.field("7"));
+
+        JsonObject obj0 = json.createObjectBuilder().add("k1", 1).add("k2", 
2).build();
+        assertEquals(obj0, jsonObj.get("8"));
+        assertEquals(((IgniteJsonObject)obj0).binaryObject(), 
binObj.field("8"));
+
+        JsonObject obj1 = json.createObjectBuilder().add("k1", 1).add("k2", 
2).build();
+        assertEquals(obj1, jsonObj.get("9"));
+        assertEquals(((IgniteJsonObject)obj1).binaryObject(), 
binObj.field("9"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectSelfTest.java
 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectSelfTest.java
new file mode 100644
index 0000000..706aee2
--- /dev/null
+++ 
b/modules/json/src/test/java/org/apache/ignite/internal/processors/json/IgniteJsonObjectSelfTest.java
@@ -0,0 +1,637 @@
+/*
+ * 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.processors.json;
+
+import java.math.BigDecimal;
+import java.util.AbstractMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.json.JsonObject;
+import javax.json.JsonValue;
+import javax.json.spi.JsonProvider;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.json.IgniteJson;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Tests for {@link IgniteJsonObject} implementation.
+ */
+public class IgniteJsonObjectSelfTest extends GridCommonAbstractTest {
+    /** JSON provider. */
+    private static JsonProvider json;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        json = IgniteJson.jsonProvider(startGrid());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIsNull() throws Exception {
+        final JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("notNullField", "notNullField")
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyObj.isNull("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+
+        // for obj
+        assertFalse(obj.isNull("notNullField"));
+        assertTrue(obj.isNull("nullField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.isNull("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetBoolean() throws Exception {
+        final JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("trueField", true)
+            .add("falseField", false)
+            .add("otherTypeField", "string")
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyObj.getBoolean("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+
+
+        // for obj
+        assertTrue(obj.getBoolean("trueField"));
+        assertFalse(obj.getBoolean("falseField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getBoolean("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getBoolean("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getBoolean("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetBooleanWithDefault() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("trueField", true)
+            .add("falseField", false)
+            .add("otherTypeField", "string")
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertTrue(emptyObj.getBoolean("notExistingField", true));
+
+        // for obj
+        assertTrue(obj.getBoolean("trueField", false));
+        assertFalse(obj.getBoolean("falseField", true));
+        assertTrue(obj.getBoolean("otherTypeField", true));
+        assertTrue(obj.getBoolean("nullField", true));
+        assertTrue(obj.getBoolean("notExistingField", true));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetInt() throws Exception {
+        final JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("intField", 42)
+            .add("otherTypeField", "string")
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyObj.getInt("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+
+
+        // for obj
+        assertEquals(42, obj.getInt("intField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getInt("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getInt("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getInt("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetIntWithDefault() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("intField", 42)
+            .add("otherTypeField", "string")
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertEquals(42, emptyObj.getInt("notExistingField", 42));
+
+        // for obj
+        assertEquals(42, obj.getInt("intField", 666));
+        assertEquals(42, obj.getInt("otherTypeField", 42));
+        assertEquals(42, obj.getInt("nullField", 42));
+        assertEquals(42, obj.getInt("notExistingField", 42));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetString() throws Exception {
+        final JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("strField", "string")
+            .add("otherTypeField", 42)
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyObj.getString("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+
+        // for obj
+        assertEquals("string", obj.getString("strField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getString("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getString("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getString("notExistingField");
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetStringWithDefault() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("strField", "string")
+            .add("otherTypeField", 42)
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertEquals("default", emptyObj.getString("notExistingField", 
"default"));
+
+        // for obj
+        assertEquals("string", obj.getString("strField", "default"));
+        assertEquals("default", obj.getString("otherTypeField", "default"));
+        assertEquals("default", obj.getString("nullField", "default"));
+        assertEquals("default", obj.getString("notExistingField", "default"));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonNumber() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("numField", 42)
+            .add("otherTypeField", "string")
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertNull(emptyObj.getJsonNumber("notExistingField"));
+
+        // for obj
+        assertEquals(new IgniteJsonNumber(new BigDecimal(42)), 
obj.getJsonNumber("numField"));
+
+        assertNull(obj.getJsonNumber("notExistingField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonNumber("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonNumber("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonString() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("strField", "string")
+            .add("otherTypeField", 42)
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertNull(emptyObj.getJsonString("notExistingField"));
+
+        // for obj
+        assertEquals(new IgniteJsonString("string"), 
obj.getJsonString("strField"));
+
+        assertNull(obj.getJsonString("notExistingField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonString("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonString("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonObject() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("objField", json.createObjectBuilder().add("key", 
"val").build())
+            .add("otherTypeField", 42)
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertNull(emptyObj.getJsonObject("notExistingField"));
+
+        // for obj
+        assertEquals(json.createObjectBuilder().add("key", "val").build(), 
obj.getJsonObject("objField"));
+
+        assertNull(obj.getJsonObject("notExistingField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonObject("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonObject("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetJsonArray() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        final JsonObject obj = json.createObjectBuilder()
+            .add("arrField", json.createArrayBuilder().add(1).add(2).build())
+            .add("otherTypeField", 42)
+            .addNull("nullField")
+            .build();
+
+        // for emptyObj
+        assertNull(emptyObj.getJsonArray("notExistingField"));
+
+        // for emptyObj
+        assertEquals(json.createArrayBuilder().add(1).add(2).build(), 
obj.getJsonArray("arrField"));
+
+        assertNull(obj.getJsonArray("notExistingField"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonArray("otherTypeField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                obj.getJsonArray("nullField");
+
+                return null;
+            }
+        }, ClassCastException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIsEmptyAndSize() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        JsonObject obj1 = json.createObjectBuilder().add("k1", "v1").build();
+
+        JsonObject obj2 = json.createObjectBuilder().add("k2", "v2").build();
+
+        JsonObject obj3 = json.createObjectBuilder()
+            .add("k1", "v1")
+            .add("k2", "v2")
+            .build();
+
+        JsonObject obj4 = json.createObjectBuilder()
+            .add("k1", "v1")
+            .addNull("nullField")
+            .build();
+
+        assertEquals(0, emptyObj.size());
+        assertTrue(emptyObj.isEmpty());
+
+        assertEquals(1, obj1.size());
+        assertFalse(obj1.isEmpty());
+
+        assertEquals(1, obj2.size());
+        assertFalse(obj2.isEmpty());
+
+        assertEquals(2, obj3.size());
+        assertFalse(obj3.isEmpty());
+
+        assertEquals(2, obj4.size());
+        assertFalse(obj4.isEmpty());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContainsKey() throws Exception {
+        final JsonObject emptyObj = json.createObjectBuilder().build();
+
+        JsonObject obj1 = json.createObjectBuilder().add("k1", "v1").build();
+
+        JsonObject obj2 = json.createObjectBuilder().add("k2", "v2").build();
+
+        JsonObject obj3 = json.createObjectBuilder()
+            .add("k1", "v1")
+            .add("k2", "v2")
+            .build();
+
+        JsonObject obj4 = json.createObjectBuilder()
+            .add("k1", "v1")
+            .addNull("nullField")
+            .build();
+
+        assertFalse(emptyObj.containsKey("key"));
+
+        assertTrue(obj1.containsKey("k1"));
+        assertFalse(obj1.containsKey("k2"));
+
+        assertTrue(obj2.containsKey("k2"));
+        assertFalse(obj2.containsKey("k1"));
+
+        assertTrue(obj3.containsKey("k1"));
+        assertTrue(obj3.containsKey("k2"));
+        assertFalse(obj3.containsKey("key"));
+
+        assertTrue(obj4.containsKey("k1"));
+        assertTrue(obj4.containsKey("nullField"));
+        assertFalse(obj4.containsKey("key"));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyObj.containsKey(null);
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContainsValue() throws Exception {
+        final JsonObject emptyObj = json.createObjectBuilder().build();
+
+        JsonObject obj1 = json.createObjectBuilder().add("k1", "v1").build();
+
+        JsonObject obj2 = json.createObjectBuilder().add("k2", "v2").build();
+
+        JsonObject obj3 = json.createObjectBuilder()
+            .add("k1", "v1")
+            .add("k2", "v2")
+            .build();
+
+        JsonObject obj4 = json.createObjectBuilder()
+            .add("k1", "v1")
+            .addNull("nullField")
+            .build();
+
+        assertFalse(emptyObj.containsValue(new IgniteJsonString("value")));
+
+        assertTrue(obj1.containsValue(new IgniteJsonString("v1")));
+        assertFalse(obj1.containsValue(new IgniteJsonString("v2")));
+
+        assertTrue(obj2.containsValue(new IgniteJsonString("v2")));
+        assertFalse(obj2.containsValue(new IgniteJsonString("v1")));
+
+        assertTrue(obj3.containsValue(new IgniteJsonString("v1")));
+        assertTrue(obj3.containsValue(new IgniteJsonString("v2")));
+        assertFalse(obj3.containsValue(new IgniteJsonString("value")));
+
+        assertTrue(obj4.containsValue(new IgniteJsonString("v1")));
+        assertTrue(obj4.containsValue(JsonValue.NULL));
+        assertFalse(obj4.containsValue(new IgniteJsonString("value")));
+
+        GridTestUtils.assertThrows(null, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                emptyObj.containsValue(null);
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testKeySet() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        JsonObject obj = json.createObjectBuilder()
+            .add("k1", "v1")
+            .add("k2", "v2")
+            .addNull("k3")
+            .build();
+
+        assertTrue(emptyObj.keySet().isEmpty());
+
+        assertEquals(F.asSet("k1", "k2", "k3"), obj.keySet());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testValues() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        JsonObject obj = json.createObjectBuilder()
+            .add("k1", "v1")
+            .add("k2", "v2")
+            .addNull("k3")
+            .build();
+
+        assertTrue(emptyObj.values().isEmpty());
+
+        Set<JsonValue> exp = F.asSet(new IgniteJsonString("v1"), new 
IgniteJsonString("v2"), JsonValue.NULL);
+        assertEquals(exp, new HashSet<>(obj.values()));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEntrySet() throws Exception {
+        JsonObject emptyObj = json.createObjectBuilder().build();
+
+        JsonObject obj = json.createObjectBuilder()
+            .add("k1", "v1")
+            .add("k2", "v2")
+            .addNull("k3")
+            .build();
+
+        assertTrue(emptyObj.entrySet().isEmpty());
+
+        Set<Map.Entry<String, JsonValue>> exp = new HashSet<>();
+        exp.add(new AbstractMap.SimpleImmutableEntry<String, JsonValue>("k1", 
new IgniteJsonString("v1")));
+        exp.add(new AbstractMap.SimpleImmutableEntry<String, JsonValue>("k2", 
new IgniteJsonString("v2")));
+        exp.add(new AbstractMap.SimpleImmutableEntry<>("k3", JsonValue.NULL));
+
+        assertEquals(exp, obj.entrySet());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/json/src/test/java/org/apache/ignite/testsuites/IgniteJsonTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/json/src/test/java/org/apache/ignite/testsuites/IgniteJsonTestSuite.java
 
b/modules/json/src/test/java/org/apache/ignite/testsuites/IgniteJsonTestSuite.java
new file mode 100644
index 0000000..485a6fc
--- /dev/null
+++ 
b/modules/json/src/test/java/org/apache/ignite/testsuites/IgniteJsonTestSuite.java
@@ -0,0 +1,48 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import 
org.apache.ignite.internal.processors.json.IgniteJsonArrayBuilderSelfTest;
+import org.apache.ignite.internal.processors.json.IgniteJsonArraySelfTest;
+import org.apache.ignite.internal.processors.json.IgniteJsonCacheTest;
+import 
org.apache.ignite.internal.processors.json.IgniteJsonObjectBuilderSelfTest;
+import org.apache.ignite.internal.processors.json.IgniteJsonObjectSelfTest;
+
+/**
+ * JSON support test suite.
+ */
+public class IgniteJsonTestSuite extends TestSuite {
+    /**
+     * @return Suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Ignite JSON Test Suite");
+
+        suite.addTest(new TestSuite(IgniteJsonArrayBuilderSelfTest.class));
+        suite.addTest(new TestSuite(IgniteJsonObjectBuilderSelfTest.class));
+
+        suite.addTest(new TestSuite(IgniteJsonObjectSelfTest.class));
+        suite.addTest(new TestSuite(IgniteJsonArraySelfTest.class));
+
+        suite.addTest(new TestSuite(IgniteJsonCacheTest.class));
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
 
b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
index 006af78..117f478 100644
--- 
a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
+++ 
b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsComputeSelfTest.java
@@ -163,7 +163,7 @@ public class NodeJsComputeSelfTest extends 
NodeJsAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testRestartGrid() throws Exception {
+    public void testRestartGrid() throws Exception {
         final AtomicInteger id = new AtomicInteger(2);
         IgniteInternalFuture<Long> fut = 
GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
 
b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
index 3bbdb9c..5d6253d 100644
--- 
a/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
+++ 
b/modules/nodejs/src/test/java/org/apache/ignite/internal/NodeJsSqlQuerySelfTest.java
@@ -47,7 +47,7 @@ public class NodeJsSqlQuerySelfTest extends 
NodeJsAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testSqlQuery() throws Exception {
+    public void testSqlQuery() throws Exception {
         //TODO: fix query for simple strings.
         runJsScript("testSqlQuery");
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/2560c885/modules/nodejs/src/test/js/test-compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-compute.js 
b/modules/nodejs/src/test/js/test-compute.js
index d6381d7..20d6746 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -30,7 +30,6 @@ testComputeRunScript = function() {
             var comp = ignite.compute();
 
             var f = function (args) {
-                print("!!!!" + args + " " + ignite.name());
                 return args + " " + ignite.name();
             }
 
@@ -128,8 +127,6 @@ testComputeCacheSizeExecute = function() {
             var map = function(nodes, arg) {
                 for (var i = 0; i < nodes.length; i++) {
                     var f = function (args) {
-                        print("!!!!!Node id " + ignite.localNode().id());
-
                         return ignite.cache("mycache").localSize();
                     };
 

Reply via email to