summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
bc96b23)
Since commit
7624eedc495e85d12c2c2c56efb09dfd9406f977 changed XML
resolution rules such that XML namespace is required to properly
identify a node.
This broke serialization tests, which did not provide module/revision
identification -- which meant serialized data was being handled by
String encoder. The string encoder does not do the right thing for
arrays -- which broke the bits and binary encoding tests.
Fix the tests to specify module/revision, thus matching conforming to
schema.
Change-Id: I5cbee0e19b85ebe3a5cf181a0e2d2ca044bfe07e
Signed-off-by: Robert Varga <rovarga@cisco.com>
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.List;
import java.io.IOException;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.BeforeClass;
import org.junit.Test;
-
-import static org.mockito.Mockito.*;
-
import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
serializeToXml(
prepareCnStructForYangData(
TypeDefinitionAwareCodec.from(BinaryType.getInstance())
serializeToXml(
prepareCnStructForYangData(
TypeDefinitionAwareCodec.from(BinaryType.getInstance())
- .deserialize("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567"),
+ .deserialize("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567"),
elName), "<" + elName + ">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567</"
elName), "<" + elName + ">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567</"
String elName = "lfBits";
serializeToXml(
prepareCnStructForYangData(TypeDefinitionAwareCodec.from(
String elName = "lfBits";
serializeToXml(
prepareCnStructForYangData(TypeDefinitionAwareCodec.from(
- BitsType.create( mock( SchemaPath.class ), bitList ) )
- .deserialize("one two"), elName),
- "<" + elName + ">one two</" + elName + ">", "<" + elName + ">two one</" + elName + ">");
+ BitsType.create( mock( SchemaPath.class ), bitList ) )
+ .deserialize("one two"), elName),
+ "<" + elName + ">one two</" + elName + ">", "<" + elName + ">two one</" + elName + ">");
String elName = "lfEnumeration";
serializeToXml(
prepareCnStructForYangData(TypeDefinitionAwareCodec.from(
String elName = "lfEnumeration";
serializeToXml(
prepareCnStructForYangData(TypeDefinitionAwareCodec.from(
- EnumerationType.create( mock( SchemaPath.class ), enumList,
- Optional.<EnumTypeDefinition.EnumPair>absent() ) )
- .deserialize("enum2"),
- elName), "<" + elName + ">enum2</" + elName + ">");
+ EnumerationType.create( mock( SchemaPath.class ), enumList,
+ Optional.<EnumTypeDefinition.EnumPair>absent() ) )
+ .deserialize("enum2"),
+ elName), "<" + elName + ">enum2</" + elName + ">");
List<BitsTypeDefinition.Bit> bitList = Lists.newArrayList( mockBit1, mockBit2 );
List<TypeDefinition<?>> types = Lists.<TypeDefinition<?>>newArrayList(
List<BitsTypeDefinition.Bit> bitList = Lists.newArrayList( mockBit1, mockBit2 );
List<TypeDefinition<?>> types = Lists.<TypeDefinition<?>>newArrayList(
- Int8.getInstance(),
- BitsType.create( mock( SchemaPath.class ) , bitList ),
- BooleanType.getInstance() );
+ Int8.getInstance(),
+ BitsType.create( mock( SchemaPath.class ) , bitList ),
+ BooleanType.getInstance() );
UnionType unionType = UnionType.create( types );
String elName = "lfUnion";
UnionType unionType = UnionType.create( types );
String elName = "lfUnion";
+ elName + ">str</" + elName + ">");
}
+ elName + ">str</" + elName + ">");
}
- private void serializeToXml(CompositeNode compositeNode, String... xmlRepresentation)
+ private void serializeToXml(final CompositeNode compositeNode, final String... xmlRepresentation)
throws TransformerFactoryConfigurationError {
String xmlString = "";
try {
throws TransformerFactoryConfigurationError {
String xmlString = "";
try {
- private CompositeNode prepareIdentityrefData(String prefix, boolean valueAsQName) {
+ private CompositeNode prepareIdentityrefData(final String prefix, final boolean valueAsQName) {
MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(
TestUtils.buildQName("cont", "basic:module", "2013-12-2"), null, null, ModifyAction.CREATE, null);
MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(
MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(
TestUtils.buildQName("cont", "basic:module", "2013-12-2"), null, null, ModifyAction.CREATE, null);
MutableCompositeNode cont1 = NodeFactory.createMutableCompositeNode(
}
private CompositeNode prepareCnStructForYangData(final Object data, final String leafName) {
}
private CompositeNode prepareCnStructForYangData(final Object data, final String leafName) {
- MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont"), null, null,
- ModifyAction.CREATE, null);
+ MutableCompositeNode cont = NodeFactory.createMutableCompositeNode(
+ TestUtils.buildQName("cont", "basic:module", "2013-12-2"), null, null, ModifyAction.CREATE, null);
- MutableSimpleNode<Object> lf1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName(leafName), cont, data,
- ModifyAction.CREATE, null);
+ MutableSimpleNode<Object> lf1 = NodeFactory.createMutableSimpleNode(
+ TestUtils.buildQName(leafName, "basic:module", "2013-12-2"), cont, data, ModifyAction.CREATE, null);
cont.getValue().add(lf1);
cont.init();
cont.getValue().add(lf1);
cont.init();