BUG-865: do not use QName constructor 10/8610/1
authorRobert Varga <rovarga@cisco.com>
Thu, 3 Jul 2014 12:33:07 +0000 (14:33 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 3 Jul 2014 12:33:07 +0000 (14:33 +0200)
This is a mas replace of 'new QName()'.

Change-Id: I810be523769f13b7eb10a2161e28499d17aa1378
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/NodeFactoryTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/NodeHelper.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/NodeUtilsTest.java

index ed6d709c35216a6a61768a3dba23784752835d1c..4cf32cd0a4a7e46fb625deac494c517cefd82659 100644 (file)
@@ -45,7 +45,7 @@ public class NodeFactoryTest {
     @Before
     public void setUp() throws Exception {
         ns = "urn:ietf:params:xml:ns:netconf:base:1.0";
-        qName = new QName(
+        qName = QName.create(
                 new URI(ns),
                 new Date(42), "node");
         network = NodeHelper.buildTestConfigTree(qName);
@@ -92,31 +92,32 @@ public class NodeFactoryTest {
 
 
         List<Node<?>> value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "name"), null, "Ethernet0/0"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "mtu"), null, 1500));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "name"), null, "Ethernet0/0"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "mtu"), null, 1500));
 
         MutableCompositeNode ifNode = NodeFactory.createMutableCompositeNode(
-                new QName(qName, "interface"), null, value, ModifyAction.DELETE, null);
+                QName.create(qName, "interface"), null,
+                value, ModifyAction.DELETE, null);
         ifNode.init();
         NodeHelper.assignParentToChildren(ifNode);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "name"), null, "Ethernet1/0"));
-        value.add(NodeFactory.createMutableSimpleNode(new QName(qName, "mtu"), null, 1501, ModifyAction.REMOVE, null));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "name"), null, "Ethernet1/0"));
+        value.add(NodeFactory.createMutableSimpleNode(QName.create(qName, "mtu"), null, 1501, ModifyAction.REMOVE, null));
 
-        CompositeNode ifNode2 = NodeFactory.createImmutableCompositeNode(new QName(qName, "interface"), null, value);
+        CompositeNode ifNode2 = NodeFactory.createImmutableCompositeNode(QName.create(qName, "interface"), null, value);
         NodeHelper.assignParentToChildren(ifNode2);
 
         value = new ArrayList<Node<?>>();
         value.add(ifNode);
         value.add(ifNode2);
 
-        CompositeNode topNode = NodeFactory.createImmutableCompositeNode(new QName(qName, "top"), null, value);
+        CompositeNode topNode = NodeFactory.createImmutableCompositeNode(QName.create(qName, "top"), null, value);
         NodeHelper.assignParentToChildren(topNode);
         value = new ArrayList<Node<?>>();
         value.add(topNode);
 
-        CompositeNode root = NodeFactory.createImmutableCompositeNode(new QName(qName, "config"), null, value);
+        CompositeNode root = NodeFactory.createImmutableCompositeNode(QName.create(qName, "config"), null, value);
         Document shadowConfig = NodeUtils.buildShadowDomTree(root);
         NodeHelper.compareXmlTree(shadowConfig, "./mutableNodesConfig.xml", getClass());
 
index 02fe73d2abbd20e61ffca36f707f2b369621992a..74e9e8ed1b1c918af7d5953d9954b8b647d6fd22 100644 (file)
@@ -56,78 +56,78 @@ public abstract class NodeHelper {
 
     /** xml source of example network configuration */
     public static final String NETWORK_XML =
-      "<network xmlns=\"urn:opendaylight:controller:network\">\n" +
-      //"<network>\n" +
-      "    <topologies>\n" +
-      "        <topology>\n" +
-      "            <topology-id>topId_01</topology-id>\n" +
-      "            <nodes>\n" +
-      "                <node>\n" +
-      "                    <node-id>nodeId_02</node-id>\n" +
-      "                    <supporting-ne>networkId_02</supporting-ne>\n" +
-      "                    <termination-points>\n" +
-      "                        <termination-point>\n" +
-      "                            <tp-id>tpId_03</tp-id>\n" +
-      "                        </termination-point>\n" +
-      "                    </termination-points>\n" +
-      "                </node>\n" +
-      "                <node>\n" +
-      "                    <node-id>nodeId_16</node-id>\n" +
-      "                    <supporting-ne>networkId_17</supporting-ne>\n" +
-      "                    <termination-points>\n" +
-      "                        <termination-point>\n" +
-      "                            <tp-id>tpId_18</tp-id>\n" +
-      "                        </termination-point>\n" +
-      "                    </termination-points>\n" +
-      "                </node>\n" +
-      "                <node>\n" +
-      "                    <node-id>nodeId_19</node-id>\n" +
-      "                    <supporting-ne>networkId_20</supporting-ne>\n" +
-      "                    <termination-points>\n" +
-      "                        <termination-point>\n" +
-      "                            <tp-id>tpId_18</tp-id>\n" +
-      "                        </termination-point>\n" +
-      "                        <termination-point>\n" +
-      "                            <tp-id>tpId_19</tp-id>\n" +
-      "                        </termination-point>\n" +
-      "                    </termination-points>\n" +
-      "                </node>\n" +
-      "            </nodes>\n" +
-      "            <links>\n" +
-      "                <link>\n" +
-      "                    <link-id>linkId_04</link-id>\n" +
-      "                    <source>\n" +
-      "                        <source-node>nodeId_05</source-node>\n" +
-      "                        <source-tp>tpId_06</source-tp>\n" +
-      "                    </source>\n" +
-      "                    <destination>\n" +
-      "                        <dest-node>nodeId_07</dest-node>\n" +
-      "                        <dest-tp>tpId_08</dest-tp>\n" +
-      "                    </destination>\n" +
-      "                </link>\n" +
-      "                <link>\n" +
-      "                    <link-id>linkId_11</link-id>\n" +
-      "                    <source>\n" +
-      "                        <source-node>nodeId_12</source-node>\n" +
-      "                        <source-tp>tpId_13</source-tp>\n" +
-      "                    </source>\n" +
-      "                    <destination>\n" +
-      "                        <dest-node>nodeId_14</dest-node>\n" +
-      "                        <dest-tp>tpId_15</dest-tp>\n" +
-      "                    </destination>\n" +
-      "                </link>\n" +
-      "            </links>\n" +
-      "        </topology>\n" +
-      "    </topologies>\n" +
-      "    <network-elements>\n" +
-      "        <network-element>\n" +
-      "            <element-id>ntElementId_09</element-id>\n" +
-      "        </network-element>\n" +
-      "        <network-element>\n" +
-      "            <element-id>ntElementId_10</element-id>\n" +
-      "        </network-element>\n" +
-      "    </network-elements>\n" +
-      "</network>";
+            "<network xmlns=\"urn:opendaylight:controller:network\">\n" +
+                    //"<network>\n" +
+                    "    <topologies>\n" +
+                    "        <topology>\n" +
+                    "            <topology-id>topId_01</topology-id>\n" +
+                    "            <nodes>\n" +
+                    "                <node>\n" +
+                    "                    <node-id>nodeId_02</node-id>\n" +
+                    "                    <supporting-ne>networkId_02</supporting-ne>\n" +
+                    "                    <termination-points>\n" +
+                    "                        <termination-point>\n" +
+                    "                            <tp-id>tpId_03</tp-id>\n" +
+                    "                        </termination-point>\n" +
+                    "                    </termination-points>\n" +
+                    "                </node>\n" +
+                    "                <node>\n" +
+                    "                    <node-id>nodeId_16</node-id>\n" +
+                    "                    <supporting-ne>networkId_17</supporting-ne>\n" +
+                    "                    <termination-points>\n" +
+                    "                        <termination-point>\n" +
+                    "                            <tp-id>tpId_18</tp-id>\n" +
+                    "                        </termination-point>\n" +
+                    "                    </termination-points>\n" +
+                    "                </node>\n" +
+                    "                <node>\n" +
+                    "                    <node-id>nodeId_19</node-id>\n" +
+                    "                    <supporting-ne>networkId_20</supporting-ne>\n" +
+                    "                    <termination-points>\n" +
+                    "                        <termination-point>\n" +
+                    "                            <tp-id>tpId_18</tp-id>\n" +
+                    "                        </termination-point>\n" +
+                    "                        <termination-point>\n" +
+                    "                            <tp-id>tpId_19</tp-id>\n" +
+                    "                        </termination-point>\n" +
+                    "                    </termination-points>\n" +
+                    "                </node>\n" +
+                    "            </nodes>\n" +
+                    "            <links>\n" +
+                    "                <link>\n" +
+                    "                    <link-id>linkId_04</link-id>\n" +
+                    "                    <source>\n" +
+                    "                        <source-node>nodeId_05</source-node>\n" +
+                    "                        <source-tp>tpId_06</source-tp>\n" +
+                    "                    </source>\n" +
+                    "                    <destination>\n" +
+                    "                        <dest-node>nodeId_07</dest-node>\n" +
+                    "                        <dest-tp>tpId_08</dest-tp>\n" +
+                    "                    </destination>\n" +
+                    "                </link>\n" +
+                    "                <link>\n" +
+                    "                    <link-id>linkId_11</link-id>\n" +
+                    "                    <source>\n" +
+                    "                        <source-node>nodeId_12</source-node>\n" +
+                    "                        <source-tp>tpId_13</source-tp>\n" +
+                    "                    </source>\n" +
+                    "                    <destination>\n" +
+                    "                        <dest-node>nodeId_14</dest-node>\n" +
+                    "                        <dest-tp>tpId_15</dest-tp>\n" +
+                    "                    </destination>\n" +
+                    "                </link>\n" +
+                    "            </links>\n" +
+                    "        </topology>\n" +
+                    "    </topologies>\n" +
+                    "    <network-elements>\n" +
+                    "        <network-element>\n" +
+                    "            <element-id>ntElementId_09</element-id>\n" +
+                    "        </network-element>\n" +
+                    "        <network-element>\n" +
+                    "            <element-id>ntElementId_10</element-id>\n" +
+                    "        </network-element>\n" +
+                    "    </network-elements>\n" +
+                    "</network>";
 
     private static String domTreeString(final Document domTree) throws TransformerException {
         TransformerFactory transformerFact = TransformerFactory.newInstance();
@@ -147,12 +147,12 @@ public abstract class NodeHelper {
      * @throws Exception
      */
     private static void dumpDoc(final Document domTree, final PrintStream out) throws Exception {
-      out.println(domTreeString(domTree));
+        out.println(domTreeString(domTree));
     }
 
-       public static void dumpDoc(final Document domTree, final Logger logger) throws TransformerException {
-               logger.info("{}", domTreeString(domTree));
-       }
+    public static void dumpDoc(final Document domTree, final Logger logger) throws TransformerException {
+        logger.info("{}", domTreeString(domTree));
+    }
 
     /**
      * @param qName
@@ -160,139 +160,146 @@ public abstract class NodeHelper {
      */
     public static CompositeNode buildTestConfigTree(final QName qName) {
         List<Node<?>> value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "element-id"), null, "ntElementId_09"));
-        CompositeNode ntElementNode1 = NodeFactory.createImmutableCompositeNode(new QName(qName, "network-element"), null, value);
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "element-id"), null, "ntElementId_09"));
+        CompositeNode ntElementNode1 = NodeFactory.createImmutableCompositeNode(QName.create(qName, "network-element"),
+                null, value);
         assignParentToChildren(ntElementNode1);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "element-id"), null, "ntElementId_10"));
-        CompositeNode ntElementNode2 = NodeFactory.createImmutableCompositeNode(new QName(qName, "network-element"), null, value);
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "element-id"), null, "ntElementId_10"));
+        CompositeNode ntElementNode2 = NodeFactory.createImmutableCompositeNode(QName.create(qName, "network-element"),
+                null, value);
         assignParentToChildren(ntElementNode2);
 
         value = new ArrayList<Node<?>>();
         value.add(ntElementNode1);
         value.add(ntElementNode2);
         CompositeNode ntElementsNode = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "network-elements"), null, value);
+                QName.create(qName, "network-elements"), null, value);
         assignParentToChildren(ntElementsNode);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "dest-node"), null, "nodeId_07"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "dest-tp"), null, "tpId_08"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "dest-node"), null, "nodeId_07"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "dest-tp"), null, "tpId_08"));
         CompositeNode destination = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "destination"), null, value);
+                QName.create(qName, "destination"), null,
+                value);
         assignParentToChildren(destination);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "source-node"), null, "nodeId_05"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "source-tp"), null, "tpId_06"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "source-node"), null, "nodeId_05"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "source-tp"), null, "tpId_06"));
         CompositeNode source = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "source"), null, value);
+                QName.create(qName, "source"), null, value);
         assignParentToChildren(source);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "link-id"), null, "linkId_04"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "link-id"), null, "linkId_04"));
         value.add(source);
         value.add(destination);
         CompositeNode link1 = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "link"), null, value);
+                QName.create(qName, "link"), null, value);
         assignParentToChildren(link1);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "dest-node"), null, "nodeId_14"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "dest-tp"), null, "tpId_15"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "dest-node"), null, "nodeId_14"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "dest-tp"), null, "tpId_15"));
         destination = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "destination"), null, value);
+                QName.create(qName, "destination"), null, value);
         assignParentToChildren(destination);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "source-node"), null, "nodeId_12"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "source-tp"), null, "tpId_13"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "source-node"), null, "nodeId_12"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "source-tp"), null, "tpId_13"));
         source = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "source"), null, value);
+                QName.create(qName, "source"), null, value);
         assignParentToChildren(source);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "link-id"), null, "linkId_11"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "link-id"), null, "linkId_11"));
         value.add(source);
         value.add(destination);
         CompositeNode link2 = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "link"), null, value);
+                QName.create(qName, "link"), null, value);
         assignParentToChildren(link2);
 
         value = new ArrayList<Node<?>>();
         value.add(link1);
         value.add(link2);
         CompositeNode links = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "links"), null, value);
+                QName.create(qName, "links"), null, value);
         assignParentToChildren(links);
 
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "tp-id"), null, "tpId_03"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "tp-id"), null, "tpId_03"));
         CompositeNode terminationPointNode1 = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-point"), null, value);
+                QName.create(qName, "termination-point"), null, value);
         assignParentToChildren(terminationPointNode1);
 
         value = new ArrayList<Node<?>>();
         value.add(terminationPointNode1);
         CompositeNode terminationPointsNode = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-points"), null, value);
+                QName.create(qName, "termination-points"), null, value);
         assignParentToChildren(terminationPointsNode);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "node-id"), null, "nodeId_02"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "supporting-ne"), null, "networkId_02"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "node-id"), null, "nodeId_02"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "supporting-ne"), null, "networkId_02"));
         value.add(terminationPointsNode);
         CompositeNode node1Node = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "node"), null, value);
+                QName.create(qName, "node"), null, value);
         assignParentToChildren(node1Node);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "tp-id"), null, "tpId_18"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "tp-id"), null, "tpId_18"));
         terminationPointNode1 = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-point"), null, value);
+                QName.create(qName, "termination-point"),
+                null, value);
         assignParentToChildren(terminationPointNode1);
 
         value = new ArrayList<Node<?>>();
         value.add(terminationPointNode1);
         terminationPointsNode = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-points"), null, value);
+                QName.create(qName, "termination-points"),
+                null, value);
         assignParentToChildren(terminationPointsNode);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "node-id"), null, "nodeId_16"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "supporting-ne"), null, "networkId_17"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "node-id"), null, "nodeId_16"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "supporting-ne"), null, "networkId_17"));
         value.add(terminationPointsNode);
         CompositeNode node2Node = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "node"), null, value);
+                QName.create(qName, "node"), null, value);
         assignParentToChildren(node2Node);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "tp-id"), null, "tpId_18"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "tp-id"), null, "tpId_18"));
         terminationPointNode1 = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-point"), null, value);
+                QName.create(qName, "termination-point"),
+                null, value);
         assignParentToChildren(terminationPointNode1);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "tp-id"), null, "tpId_19"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "tp-id"), null, "tpId_19"));
         CompositeNode terminationPointNode2 = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-point"), null, value);
+                QName.create(qName, "termination-point"), null, value);
         assignParentToChildren(terminationPointNode2);
 
         value = new ArrayList<Node<?>>();
         value.add(terminationPointNode1);
         value.add(terminationPointNode2);
         terminationPointsNode = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "termination-points"), null, value);
+                QName.create(qName, "termination-points"),
+                null, value);
         assignParentToChildren(terminationPointsNode);
 
         value = new ArrayList<Node<?>>();
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "node-id"), null, "nodeId_19"));
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "supporting-ne"), null, "networkId_20"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "node-id"), null, "nodeId_19"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "supporting-ne"), null, "networkId_20"));
         value.add(terminationPointsNode);
         CompositeNode node3Node = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "node"), null, value);
+                QName.create(qName, "node"), null, value);
         assignParentToChildren(node3Node);
 
         value = new ArrayList<Node<?>>();
@@ -300,28 +307,29 @@ public abstract class NodeHelper {
         value.add(node2Node);
         value.add(node3Node);
         CompositeNode nodesNode = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "nodes"), null, value);
+                QName.create(qName, "nodes"), null, value);
         assignParentToChildren(nodesNode);
 
         value = new ArrayList<Node<?>>();
         value.add(links);
         value.add(nodesNode);
-        value.add(NodeFactory.createImmutableSimpleNode(new QName(qName, "topology-id"), null, "topId_01"));
+        value.add(NodeFactory.createImmutableSimpleNode(QName.create(qName, "topology-id"), null, "topId_01"));
         CompositeNode topology = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "topology"), null, value);
+                QName.create(qName, "topology"), null, value);
         assignParentToChildren(topology);
 
         value = new ArrayList<Node<?>>();
         value.add(topology);
         CompositeNode topologies = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "topologies"), null, value);
+                QName.create(qName, "topologies"), null,
+                value);
         assignParentToChildren(topologies);
 
         value = new ArrayList<Node<?>>();
         value.add(topologies);
         value.add(ntElementsNode);
         CompositeNode network = NodeFactory.createImmutableCompositeNode(
-                new QName(qName, "network"), null, value);
+                QName.create(qName, "network"), null, value);
         assignParentToChildren(network);
 
         return network;
@@ -357,20 +365,20 @@ public abstract class NodeHelper {
      * @throws Exception
      */
     public static CompositeNode loadConfigByGroovy(final String scriptName) throws Exception {
-       InputStream configStream = NodeHelper.class.getResourceAsStream(scriptName);
-       Binding binding = new Binding();
-       GroovyShell gShell = new GroovyShell(binding);
-       LOG.debug("groovy: starting script parse..  " + scriptName);
-               Script configScript = gShell.parse(new InputStreamReader(configStream));
-               LOG.debug("groovy: starting script..  " + scriptName);
-               configScript.run();
-               LOG.debug("groovy: digging result");
-       Object xmlGen = binding.getVariable("xmlGen");
-       LOG.debug("xmlGen = " + xmlGen);
-       Method getter = xmlGen.getClass().getDeclaredMethod("getBuilder", new Class[0]);
-       MyNodeBuilder builder = (MyNodeBuilder) getter.invoke(xmlGen, new Object[0]);
-
-       return builder.getRootNode();
+        InputStream configStream = NodeHelper.class.getResourceAsStream(scriptName);
+        Binding binding = new Binding();
+        GroovyShell gShell = new GroovyShell(binding);
+        LOG.debug("groovy: starting script parse..  {}", scriptName);
+        Script configScript = gShell.parse(new InputStreamReader(configStream));
+        LOG.debug("groovy: starting script..  {}", scriptName);
+        configScript.run();
+        LOG.debug("groovy: digging result");
+        Object xmlGen = binding.getVariable("xmlGen");
+        LOG.debug("xmlGen = {}", xmlGen);
+        Method getter = xmlGen.getClass().getDeclaredMethod("getBuilder", new Class[0]);
+        MyNodeBuilder builder = (MyNodeBuilder) getter.invoke(xmlGen, new Object[0]);
+
+        return builder.getRootNode();
     }
 
     /**
@@ -400,7 +408,7 @@ public abstract class NodeHelper {
      * @throws IOException
      */
     public static void compareXmlTree(final Document tree, final String xmlFile, final Class<?> clazz) throws Exception,
-            SAXException, IOException {
+    SAXException, IOException {
         ByteArrayOutputStream actualRaw = new ByteArrayOutputStream();
         dumpDoc(tree, new PrintStream(actualRaw));
         Reader actualReader = new InputStreamReader(new ByteArrayInputStream(actualRaw.toByteArray()));
index 285cdb0b30705e3128c76fe282a91586b62fbad7..f243f7183ca7ba359e9e2bf162c358e76329210d 100644 (file)
@@ -48,7 +48,7 @@ public class NodeUtilsTest {
     @Before
     public void setUp() throws Exception {
         ns = "urn:ietf:params:xml:ns:netconf:base:1.0";
-        qName = new QName(
+        qName = QName.create(
                 new URI(ns),
                 new Date(42), "yang-data-impl-mutableTest");
         network = NodeHelper.buildTestConfigTree(qName);
@@ -61,8 +61,8 @@ public class NodeUtilsTest {
     @Test
     public void testBuildPath() throws Exception {
         SimpleNode<?> needle = network.getCompositesByName("topologies").iterator().next()
-            .getCompositesByName("topology").iterator().next()
-            .getSimpleNodesByName("topology-id").iterator().next();
+                .getCompositesByName("topology").iterator().next()
+                .getSimpleNodesByName("topology-id").iterator().next();
         String breadCrumbs = NodeUtils.buildPath(needle);
 
         Assert.assertEquals("network.topologies.topology.topology-id", breadCrumbs);
@@ -109,7 +109,7 @@ public class NodeUtilsTest {
     @Test
     public void testBuildNodeMap() {
         CompositeNode topology = network.getCompositesByName("topologies").iterator().next()
-            .getCompositesByName("topology").iterator().next();
+                .getCompositesByName("topology").iterator().next();
 
         Map<QName, List<Node<?>>> nodeMap = NodeUtils.buildNodeMap(topology.getValue());
         Assert.assertEquals(3, nodeMap.size());
@@ -132,16 +132,16 @@ public class NodeUtilsTest {
      */
     @Test
     public void testLoadConfigByGroovy() throws IOException, Exception {
-       CompositeNode treeRoot = NodeHelper.loadConfigByGroovy("./config02.groovy");
-       Document shadowTree = NodeUtils.buildShadowDomTree(treeRoot);
-       try {
+        CompositeNode treeRoot = NodeHelper.loadConfigByGroovy("./config02.groovy");
+        Document shadowTree = NodeUtils.buildShadowDomTree(treeRoot);
+        try {
             checkFamilyBinding(treeRoot);
         } catch (Exception e) {
             LOG.error(e.getMessage());
             throw e;
         }
 
-       NodeHelper.compareXmlTree(shadowTree, "./config02g-shadow.xml", getClass());
+        NodeHelper.compareXmlTree(shadowTree, "./config02g-shadow.xml", getClass());
     }
 
     private static void checkFamilyBinding(final CompositeNode treeRoot) throws Exception {