Search in sources :

Example 11 with NavigableJsonInputAdapter

use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.

the class JsonSchemaHelperTest method testQueryToNonTerminalValueCreatesPattern.

@Test
public void testQueryToNonTerminalValueCreatesPattern() throws IOException {
    JsonObject object = Json.object().add("a", Json.object().add("x", 1).add("y", 2)).add("b", false);
    NavigableJsonInputAdapter input = toAdapter(new HazelcastJsonValue(object.toString()));
    JsonSchemaNode description = JsonSchemaHelper.createSchema(createParserFromInput(input));
    JsonPattern pattern = JsonSchemaHelper.createPattern(input, description, splitPath("a"));
    assertEquals(new JsonPattern(asList(0)), pattern);
}
Also used : NavigableJsonInputAdapter(com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter) 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 12 with NavigableJsonInputAdapter

use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.

the class JsonSchemaHelperTest method testEmptyStringReturnsNullSchema.

@Test
public void testEmptyStringReturnsNullSchema() throws IOException {
    NavigableJsonInputAdapter input = toAdapter(new HazelcastJsonValue(""));
    JsonSchemaNode description = JsonSchemaHelper.createSchema(createParserFromInput(input));
    assertNull(description);
}
Also used : NavigableJsonInputAdapter(com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter) HazelcastJsonValue(com.hazelcast.core.HazelcastJsonValue) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

HazelcastJsonValue (com.hazelcast.core.HazelcastJsonValue)12 NavigableJsonInputAdapter (com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter)12 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 JsonObject (com.hazelcast.internal.json.JsonObject)6 JsonArray (com.hazelcast.internal.json.JsonArray)2 JsonValue (com.hazelcast.internal.json.JsonValue)2