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%2Frestconf%2Fimpl%2Fnn%2Fto%2Fxml%2Ftest%2FNnToXmlNotExistingLeafTypeTest.java;fp=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Fnn%2Fto%2Fxml%2Ftest%2FNnToXmlNotExistingLeafTypeTest.java;h=0000000000000000000000000000000000000000;hp=50ca667f00e70a5fcfb1f5df22e68f56690b136b;hb=89b8b59cd26fd4810293ff14386eb29a71da9fac;hpb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4 diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnToXmlNotExistingLeafTypeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnToXmlNotExistingLeafTypeTest.java deleted file mode 100644 index 50ca667f00..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/xml/test/NnToXmlNotExistingLeafTypeTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014 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.restconf.impl.nn.to.xml.test; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; -import javax.ws.rs.core.MediaType; -import org.junit.Test; -import org.opendaylight.controller.sal.rest.impl.NormalizedNodeXmlBodyWriter; -import org.opendaylight.controller.sal.rest.impl.test.providers.AbstractBodyReaderTest; -import org.opendaylight.controller.sal.restconf.impl.InstanceIdentifierContext; -import org.opendaylight.controller.sal.restconf.impl.NormalizedNodeContext; -import org.opendaylight.controller.sal.restconf.impl.test.DummyType; -import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; -import org.opendaylight.yangtools.yang.data.impl.schema.Builders; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder; -import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder; -import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder; - -public class NnToXmlNotExistingLeafTypeTest extends AbstractBodyReaderTest { - - public NnToXmlNotExistingLeafTypeTest() throws NoSuchFieldException, - SecurityException { - super(); - } - - @Test(expected = NullPointerException.class) - public void incorrectTopLevelElementTest() throws Exception { - final NormalizedNodeXmlBodyWriter xmlBodyWriter = new NormalizedNodeXmlBodyWriter(); - final OutputStream output = new ByteArrayOutputStream(); - - final NormalizedNodeContext normalizedNodeContext = prepareNNC(prepareDataSchemaNode()); - xmlBodyWriter.writeTo(normalizedNodeContext, null, null, null, - mediaType, null, output); - - } - - private NormalizedNodeContext prepareNNC(final DataSchemaNode dataSchemaNode) { - final QName cont = QName.create("simple:uri", "2012-12-17", "cont"); - final QName lf = QName.create("simple:uri", "2012-12-17", "lf1"); - - final DataSchemaNode contSchema = ((ContainerSchemaNode) dataSchemaNode) - .getDataChildByName(cont); - final DataContainerNodeAttrBuilder dataCont = Builders - .containerBuilder((ContainerSchemaNode) contSchema); - - final DataSchemaNode lfSchema = ((ContainerSchemaNode) dataSchemaNode) - .getDataChildByName(lf); - - dataCont.withChild(Builders.leafBuilder((LeafSchemaNode) lfSchema) - .withValue("any value").build()); - - final NormalizedNodeContext testNormalizedNodeContext = new NormalizedNodeContext( - new InstanceIdentifierContext(null, contSchema, - null, (SchemaContext) dataSchemaNode), dataCont.build()); - - return testNormalizedNodeContext; - } - - private DataSchemaNode prepareDataSchemaNode() { - final ContainerSchemaNodeBuilder contBuild = new ContainerSchemaNodeBuilder( - "module", 1, TestUtils.buildQName("cont", "simple:uri", - "2012-12-17"), null); - final LeafSchemaNodeBuilder leafBuild = new LeafSchemaNodeBuilder("module", - 2, TestUtils.buildQName("lf1", "simple:uri", "2012-12-17"), - null); - leafBuild.setType(new DummyType()); - leafBuild.setConfiguration(true); - - contBuild.addChildNode(leafBuild); - return contBuild.build(); - } - - @Override - protected MediaType getMediaType() { - return null; - } - -}