use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.
the class JsonSchemaHelperNullTest method test_givenInvalidPattern_createNullPattern.
private void test_givenInvalidPattern_createNullPattern(String jsonString, String path) throws IOException {
NavigableJsonInputAdapter inputAdapter = toAdapter(new HazelcastJsonValue(jsonString));
JsonSchemaNode schemaNode = JsonSchemaHelper.createSchema(createParserFromInput(inputAdapter));
JsonPattern pattern = JsonSchemaHelper.createPattern(inputAdapter, schemaNode, splitPath(path));
assertNull(pattern);
}
use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.
the class JsonSchemaHelperMultiValueTest method testAnyPattern_whenNotArrayOrObject_returnsNull.
@Test
public void testAnyPattern_whenNotArrayOrObject_returnsNull() throws IOException {
JsonObject object = Json.object().add("scalarValue", 4);
NavigableJsonInputAdapter input = toAdapter(new HazelcastJsonValue(object.toString()));
JsonSchemaNode description = JsonSchemaHelper.createSchema(createParserFromInput(input));
JsonPattern pattern = JsonSchemaHelper.createPattern(input, description, splitPath("scalarValue[any]"));
assertNull(pattern);
}
use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.
the class JsonSchemaHelperMultiValueTest method testAnyPattern_partsAfterAnyIsOmitted.
@Test
public void testAnyPattern_partsAfterAnyIsOmitted() throws IOException {
JsonObject object = Json.object().add("array", Json.array().add(1).add(2).add(3));
NavigableJsonInputAdapter input = toAdapter(new HazelcastJsonValue(object.toString()));
JsonSchemaNode description = JsonSchemaHelper.createSchema(createParserFromInput(input));
JsonPattern pattern = JsonSchemaHelper.createPattern(input, description, splitPath("array[any].a"));
assertEquals(1, pattern.depth());
assertEquals(0, pattern.get(0));
assertTrue(pattern.hasAny());
}
use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.
the class JsonSchemaHelperMultiValueTest method testAnyPattern__whenFirstItem_partsAfterAnyIsOmitted.
@Test
public void testAnyPattern__whenFirstItem_partsAfterAnyIsOmitted() throws IOException {
JsonArray object = Json.array().add(1).add(2).add(3);
NavigableJsonInputAdapter input = toAdapter(new HazelcastJsonValue(object.toString()));
JsonSchemaNode description = JsonSchemaHelper.createSchema(createParserFromInput(input));
JsonPattern pattern = JsonSchemaHelper.createPattern(input, description, splitPath("[any].abc.de"));
assertEquals(0, pattern.depth());
assertTrue(pattern.hasAny());
}
use of com.hazelcast.internal.serialization.impl.NavigableJsonInputAdapter in project hazelcast by hazelcast.
the class JsonSchemaHelperMultiValueTest method testAnyPattern_whenFirstItem.
@Test
public void testAnyPattern_whenFirstItem() throws IOException {
JsonArray object = Json.array().add(1).add(2).add(3);
NavigableJsonInputAdapter input = toAdapter(new HazelcastJsonValue(object.toString()));
JsonSchemaNode description = JsonSchemaHelper.createSchema(createParserFromInput(input));
JsonPattern pattern = JsonSchemaHelper.createPattern(input, description, splitPath("[any]"));
assertEquals(0, pattern.depth());
assertTrue(pattern.hasAny());
}
Aggregations