@Test public void testDeserialize_in() throws Exception { Optional<RpcDefinition> loadRpc = ConverterUtils.loadRpc(schemaContext, SIMPLE_IO_RPC_QNAME); String loadIoRpcIn = loadResourceAsString("input-output-rpc-in.json"); NormalizedNode<?, ?> deserializeRpc = bindingSerializer.deserialize(loadRpc.get(), new StringReader(loadIoRpcIn)); Assert.assertNotNull(deserializeRpc); LOG.info(deserializeRpc.toString()); }
@Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } JsonNodeConverter(final SchemaContext schemaContext); }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } JsonNodeConverter(final SchemaContext schemaContext); @Override Writer serializeData(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override Writer serializeRpc(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData); }
JsonNodeConverter implements NodeConverter { @Override public NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData) throws SerializationException { NormalizedNodeResult result = new NormalizedNodeResult(); JSONCodecFactory jsonCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.createLazy(schemaContext); try (JsonReader reader = new JsonReader(inputData); NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result); JsonParserStream jsonParser = JsonParserStream.create(streamWriter, jsonCodecFactory, schemaNode)) { jsonParser.parse(reader); } catch (IOException e) { throw new SerializationException(e); } return result.getResult(); } JsonNodeConverter(final SchemaContext schemaContext); @Override Writer serializeData(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override Writer serializeRpc(final SchemaNode schemaNode, final NormalizedNode<?, ?> normalizedNode); @Override NormalizedNode<?, ?> deserialize(final SchemaNode schemaNode, final Reader inputData);  }