Search in sources :

Example 66 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class Mocking_Test method mockValue.

@Test
public void mockValue() {
    JsonValue jsonValue = Mockito.mock(JsonValue.class);
    assertNotNull(jsonValue);
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 67 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class JsonParser_Test method parse_doesNotFailWithManyObjects.

@Test
public void parse_doesNotFailWithManyObjects() {
    JsonArray array = new JsonArray();
    for (int i = 0; i < 1001; i++) {
        array.add(new JsonObject().add("a", 7));
    }
    final String input = array.toString();
    JsonValue result = parse(input);
    assertTrue(result.isArray());
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) JsonValue(com.hazelcast.internal.json.JsonValue) JsonObject(com.hazelcast.internal.json.JsonObject) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 68 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class JsonParser_Test method parse_doesNotFailWithManyArrays.

@Test
public void parse_doesNotFailWithManyArrays() {
    JsonArray array = new JsonArray();
    for (int i = 0; i < 1001; i++) {
        array.add(new JsonArray().add(7));
    }
    final String input = array.toString();
    JsonValue result = parse(input);
    assertTrue(result.isArray());
}
Also used : JsonArray(com.hazelcast.internal.json.JsonArray) JsonValue(com.hazelcast.internal.json.JsonValue) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 69 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class MapPredicateJsonTest method testNestedQuery_whenOneObjectMissingFirstLevelProperty.

@Test
public void testNestedQuery_whenOneObjectMissingFirstLevelProperty() {
    JsonObject object1 = Json.object();
    JsonObject nested1 = Json.object();
    JsonObject object2 = Json.object();
    JsonObject nested2 = Json.object();
    nested1.add("lim", 5);
    nested2.add("someotherlim", 6);
    object1.add("inner", nested1);
    object2.add("inner", nested2);
    IMap<String, JsonValue> map = instance.getMap(randomMapName());
    HazelcastJsonValue p1 = putJsonString(map, "one", object1);
    HazelcastJsonValue p2 = putJsonString(map, "two", object2);
    Collection<JsonValue> vals = map.values(Predicates.lessEqual("inner.lim", 6));
    assertEquals(1, vals.size());
    assertTrue(vals.contains(p1));
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue) HazelcastJsonValue(com.hazelcast.core.HazelcastJsonValue) HazelcastJsonValue(com.hazelcast.core.HazelcastJsonValue) JsonObject(com.hazelcast.internal.json.JsonObject) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 70 with JsonValue

use of com.hazelcast.internal.json.JsonValue in project hazelcast by hazelcast.

the class MapPredicateJsonTest method testQueryOnNumberProperty.

@Test
public void testQueryOnNumberProperty() {
    IMap<String, JsonValue> map = instance.getMap(randomMapName());
    HazelcastJsonValue p1 = putJsonString(map, "a", 30, true);
    HazelcastJsonValue p2 = putJsonString(map, "b", 20, false);
    HazelcastJsonValue p3 = putJsonString(map, "c", 10, true);
    Collection<JsonValue> vals = map.values(Predicates.greaterEqual("age", 20));
    assertEquals(2, vals.size());
    assertTrue(vals.contains(p1));
    assertTrue(vals.contains(p2));
}
Also used : JsonValue(com.hazelcast.internal.json.JsonValue) HazelcastJsonValue(com.hazelcast.core.HazelcastJsonValue) HazelcastJsonValue(com.hazelcast.core.HazelcastJsonValue) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

JsonValue (com.hazelcast.internal.json.JsonValue)85 Test (org.junit.Test)36 JsonObject (com.hazelcast.internal.json.JsonObject)35 QuickTest (com.hazelcast.test.annotation.QuickTest)30 JsonArray (com.hazelcast.internal.json.JsonArray)28 HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)25 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)20 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 KubernetesApiProvider.convertToString (com.hazelcast.kubernetes.KubernetesApiProvider.convertToString)6 EndpointAddress (com.hazelcast.kubernetes.KubernetesClient.EndpointAddress)6 HashSet (java.util.HashSet)6 ConnectionResponse (com.hazelcast.internal.ascii.HTTPCommunicator.ConnectionResponse)5 SlowTest (com.hazelcast.test.annotation.SlowTest)5 Address (com.hazelcast.cluster.Address)4 CPMember (com.hazelcast.cp.CPMember)4 IOException (java.io.IOException)4 JsonUtil.fromJsonObject (com.hazelcast.internal.util.JsonUtil.fromJsonObject)3 JsonUtil.getString (com.hazelcast.internal.util.JsonUtil.getString)3