X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2Ftest%2Fproviders%2FTestJsonBodyWriter.java;fp=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2Ftest%2Fproviders%2FTestJsonBodyWriter.java;h=0000000000000000000000000000000000000000;hp=e5cda6c94d12a81edb61815dc4eac4679a7980aa;hb=89b8b59cd26fd4810293ff14386eb29a71da9fac;hpb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4 diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyWriter.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyWriter.java deleted file mode 100644 index e5cda6c94d..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyWriter.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.sal.rest.impl.test.providers; - -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.ws.rs.core.MediaType; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.opendaylight.controller.sal.rest.impl.JsonNormalizedNodeBodyReader; -import org.opendaylight.controller.sal.rest.impl.NormalizedNodeJsonBodyWriter; -import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; - -/** - * sal-rest-connector org.opendaylight.controller.sal.rest.impl.test.providers - * - * - * - * @author Vaclav Demcak - * - * Created: Mar 12, 2015 - */ -public class TestJsonBodyWriter extends AbstractBodyReaderTest { - - private final JsonNormalizedNodeBodyReader jsonBodyReader; - private final NormalizedNodeJsonBodyWriter jsonBodyWriter; - private static SchemaContext schemaContext; - - public TestJsonBodyWriter() throws NoSuchFieldException, SecurityException { - super(); - jsonBodyWriter = new NormalizedNodeJsonBodyWriter(); - jsonBodyReader = new JsonNormalizedNodeBodyReader(); - } - - @Override - protected MediaType getMediaType() { - return new MediaType(MediaType.APPLICATION_XML, null); - } - - @BeforeClass - public static void initialization() throws NoSuchFieldException, - SecurityException { - schemaContext = schemaContextLoader("/instanceidentifier/yang", - schemaContext); - schemaContext = schemaContextLoader("/modules", schemaContext); - schemaContext = schemaContextLoader("/invoke-rpc", schemaContext); - controllerContext.setSchemas(schemaContext); - } - - @Test - public void rpcModuleInputTest() throws Exception { - final String uri = "invoke-rpc-module:rpc-test"; - mockBodyReader(uri, jsonBodyReader, true); - final InputStream inputStream = TestJsonBodyWriter.class - .getResourceAsStream("/invoke-rpc/json/rpc-output.json"); - final NormalizedNodeContext returnValue = jsonBodyReader.readFrom(null, - null, null, mediaType, null, inputStream); - final OutputStream output = new ByteArrayOutputStream(); - jsonBodyWriter.writeTo(returnValue, null, null, null, mediaType, null, - output); - assertTrue(output.toString().contains("lf-test")); - } -}