Development of NETCONF RPCs for tr-069 adapter to
[oam/tr069-adapter.git] / netconf-server / src / test / java / org / commscope / tr069adapter / netconf / rpc / XmlUtilityTest.java
index 91d420b..dae2f81 100644 (file)
@@ -1,55 +1,56 @@
-/*\r
- * ============LICENSE_START========================================================================\r
- * ONAP : tr-069-adapter\r
- * =================================================================================================\r
- * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
- * =================================================================================================\r
- * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
- * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
- * may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
- * either express or implied. See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ===============LICENSE_END=======================================================================\r
- */\r
-\r
-package org.commscope.tr069adapter.netconf.rpc;\r
-\r
-import static org.junit.Assert.assertTrue;\r
-import static org.junit.Assert.fail;\r
-\r
-import org.junit.jupiter.api.Test;\r
-import org.w3c.dom.Element;\r
-\r
-class XmlUtilityTest {\r
-\r
-  @Test\r
-  void testConvertDocumentToStringXmlElement() {\r
-\r
-    String xmlStr =\r
-        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><source><running /></source><filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\"><device xmlns=\"urn:onf:otcc:wireless:yang:radio-access-186\"><services><fap-service xmlns=\"urn:onf:otcc:wireless:yang:radio-access\"><index>1</index><cell-config><lte><epc/></lte></cell-config></fap-service></services></device></filter></get-config>";\r
-    try {\r
-      Element el = XmlUtility.convertStringToDocument(xmlStr);\r
-      String result = XmlUtility.convertDocumentToString(el);\r
-      assertTrue(result != null);\r
-    } catch (Exception e) {\r
-      fail("Failed to convert string into document.");\r
-    }\r
-  }\r
-\r
-  @Test\r
-  void testConvertStringToDocument() {\r
-    String xmlStr =\r
-        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rpc-reply xmlns=\"URN\" xmlns:junos=\"URL\"><data/></rpc-reply>";\r
-    try {\r
-      XmlUtility.convertStringToDocument(xmlStr);\r
-    } catch (Exception e) {\r
-      fail("Failed to convert string into document.");\r
-    }\r
-    assertTrue(true);\r
-  }\r
-\r
-}\r
+/*
+ * ============LICENSE_START========================================================================
+ * ONAP : tr-069-adapter
+ * =================================================================================================
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.
+ * =================================================================================================
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=======================================================================
+ */
+
+package org.commscope.tr069adapter.netconf.rpc;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.jupiter.api.Test;
+import org.w3c.dom.Element;
+
+class XmlUtilityTest {
+
+  @Test
+  void testConvertDocumentToStringXmlElement() {
+
+    String xmlStr =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><source><running /></source><filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\"><device xmlns=\"urn:onf:otcc:wireless:yang:radio-access-186\"><services><fap-service xmlns=\"urn:onf:otcc:wireless:yang:radio-access\"><index>1</index><cell-config><lte><epc/></lte></cell-config></fap-service></services></device></filter></get-config>";
+    try {
+      Element el = XmlUtility.convertStringToDocument(xmlStr);
+      String result = XmlUtility.convertDocumentToString(el);
+      assertNotNull(result);
+    } catch (Exception e) {
+      fail("Failed to convert string into document.");
+    }
+  }
+
+  @Test
+  void testConvertStringToDocument() {
+    String xmlStr =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rpc-reply xmlns=\"URN\" xmlns:junos=\"URL\"><data/></rpc-reply>";
+    try {
+      XmlUtility.convertStringToDocument(xmlStr);
+    } catch (Exception e) {
+      fail("Failed to convert string into document.");
+    }
+    assertTrue(true);
+  }
+
+}