X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2FNormalizedNodeToNodeCodecTest.java;h=c42865c659192e0584ebe93a147fee655ab284c4;hp=bdad86ddc1e8fb5521607fbb91a575a99e677d38;hb=56a9f42fe2b4a62cd2fed644e5c71d7a21176c7f;hpb=ee146664ac8ae45439c14a84fe769633c3ebf847 diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java index bdad86ddc1..c42865c659 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java @@ -13,9 +13,9 @@ package org.opendaylight.controller.cluster.datastore.node; import junit.framework.Assert; import org.junit.Before; import org.junit.Test; -import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory; import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter; import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeNavigator; +import org.opendaylight.controller.cluster.datastore.node.utils.PathUtils; import org.opendaylight.controller.cluster.datastore.util.TestModel; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container; import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node; @@ -24,7 +24,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import java.util.ArrayList; import java.util.List; import static junit.framework.Assert.assertEquals; @@ -43,21 +42,9 @@ public class NormalizedNodeToNodeCodecTest { } private YangInstanceIdentifier instanceIdentifierFromString(String s) { - - String[] ids = s.split("/"); - - List pathArguments = new ArrayList<>(); - for (String nodeId : ids) { - if (!"".equals(nodeId)) { - pathArguments.add(NodeIdentifierFactory.getArgument(nodeId)); - } - } - final YangInstanceIdentifier instanceIdentifier = - YangInstanceIdentifier.create(pathArguments); - return instanceIdentifier; + return PathUtils.toYangInstanceIdentifier(s); } - @Test public void testNormalizeNodeAttributesToProtoBuffNode() { final NormalizedNode documentOne = TestModel.createTestContainer(); @@ -69,7 +56,7 @@ public class NormalizedNodeToNodeCodecTest { NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id); new NormalizedNodeNavigator(normalizedNodeGetter).navigate( - YangInstanceIdentifier.builder().build().toString(), documentOne); + PathUtils.toString(YangInstanceIdentifier.builder().build()), documentOne); // Validate the value of id can be retrieved from the normalized node NormalizedNode output = normalizedNodeGetter.getOutput();