X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=restconf%2Frestconf-nb-bierman02%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2Ftest%2Fproviders%2FTestJsonBodyWriter.java;fp=restconf%2Frestconf-nb-bierman02%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2Ftest%2Fproviders%2FTestJsonBodyWriter.java;h=0000000000000000000000000000000000000000;hb=e299375e295bf17cbc7292469c6f3e013d0d7aab;hp=121a7d6492a0a7fd4754e5c3a899c43862188363;hpb=09c1d18add7cfc310f3d190a1a02a523159162ce;p=netconf.git diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyWriter.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyWriter.java deleted file mode 100644 index 121a7d6492..0000000000 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/rest/impl/test/providers/TestJsonBodyWriter.java +++ /dev/null @@ -1,65 +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.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Collection; -import javax.ws.rs.core.MediaType; -import org.junit.BeforeClass; -import org.junit.Test; -import org.opendaylight.controller.md.sal.rest.common.TestRestconfUtils; -import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader; -import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext; -import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeJsonBodyWriter; -import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; -import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; - -public class TestJsonBodyWriter extends AbstractBodyReaderTest { - - private final JsonNormalizedNodeBodyReader jsonBodyReader; - private final NormalizedNodeJsonBodyWriter jsonBodyWriter; - private static EffectiveModelContext schemaContext; - - public TestJsonBodyWriter() { - super(schemaContext, null); - this.jsonBodyWriter = new NormalizedNodeJsonBodyWriter(); - this.jsonBodyReader = new JsonNormalizedNodeBodyReader(controllerContext); - } - - @Override - protected MediaType getMediaType() { - return new MediaType(MediaType.APPLICATION_XML, null); - } - - @BeforeClass - public static void initialization() throws Exception { - final Collection testFiles = TestRestconfUtils.loadFiles("/instanceidentifier/yang"); - testFiles.addAll(TestRestconfUtils.loadFiles("/invoke-rpc")); - schemaContext = YangParserTestUtils.parseYangFiles(testFiles); - } - - @Test - public void rpcModuleInputTest() throws Exception { - final String uri = "invoke-rpc-module:rpc-test"; - mockBodyReader(uri, this.jsonBodyReader, true); - final InputStream inputStream = TestJsonBodyWriter.class - .getResourceAsStream("/invoke-rpc/json/rpc-output.json"); - final NormalizedNodeContext returnValue = this.jsonBodyReader.readFrom(null, - null, null, this.mediaType, null, inputStream); - final OutputStream output = new ByteArrayOutputStream(); - this.jsonBodyWriter.writeTo(returnValue, null, null, null, this.mediaType, null, - output); - assertTrue(output.toString().contains("lf-test")); - } -}