import java.io.IOException;
import java.util.Collections;
-import java.util.Set;
import javax.ws.rs.WebApplicationException;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
-import org.opendaylight.controller.sal.restconf.impl.test.*;
-import org.opendaylight.yangtools.yang.data.api.*;
+import org.opendaylight.controller.sal.restconf.impl.test.DummyType;
+import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
+import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode;
import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
dataLoad("/cnsn-to-json/simple-data-types");
}
- // FIXME
- @Ignore
@Test
- public void incorrectTopLevelElementTest() {
-
+ public void incorrectTopLevelElementTest() throws WebApplicationException, IOException {
String jsonOutput = null;
- try {
- jsonOutput = TestUtils
- .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
- (Set<Module>) Collections.EMPTY_SET, prepareDataSchemaNode(),
- StructuredDataToJsonProvider.INSTANCE);
- } catch (WebApplicationException | IOException e) {
- LOG.error("WebApplicationException or IOException was raised");
- }
+ jsonOutput = TestUtils
+ .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
+ Collections.<Module>emptySet(), prepareDataSchemaNode(),
+ StructuredDataToJsonProvider.INSTANCE);
assertNotNull(jsonOutput);
assertTrue(jsonOutput.contains("\"lf1\": \"\""));
}
TestUtils.buildQName("cont", "simple:uri", "2012-12-17"), null, null, ModifyAction.CREATE, null);
MutableSimpleNode<?> lf1 = NodeFactory.createMutableSimpleNode(
TestUtils.buildQName("lf1", "simple:uri", "2012-12-17"), cont, "any value", ModifyAction.CREATE, null);
- cont.getChildren().add(lf1);
+ cont.getValue().add(lf1);
cont.init();
return cont;
}