Merge "netconf-executor: NetconfSessionImplTest"
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/resource-mapping/resource-mapping.component.html b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/resource-mapping/resource-mapping.component.html
index b369e01..f5e7e84 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/resource-mapping/resource-mapping.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/resource-mapping/resource-mapping.component.html
@@ -65,102 +65,6 @@
                     <input type="text" />
                 </td>
             </tr>
-
-            <tr>
-                <td>
-                    <input type="checkbox" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>Name</td>
-                <td>
-                    <input type="text" />
-                    <i class="fa fa-search" aria-hidden="true"></i>
-                </td>
-                <td>
-                    <select>
-            <option value="volvo">Input</option>
-            <option value="saab">Output</option>
-          </select>
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-            </tr>
-
-            <tr>
-                <td>
-                    <input type="checkbox" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>Name</td>
-                <td>
-                    <input type="text" />
-                    <i class="fa fa-search" aria-hidden="true"></i>
-                </td>
-                <td>
-                    <select>
-            <option value="volvo">Input</option>
-            <option value="saab">Output</option>
-          </select>
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-            </tr>
-
-            <tr>
-                <td>
-                    <input type="checkbox" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>Name</td>
-                <td>
-                    <input type="text" />
-                    <i class="fa fa-search" aria-hidden="true"></i>
-                </td>
-                <td>
-                    <select>
-            <option value="volvo">Input</option>
-            <option value="saab">Output</option>
-          </select>
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-                <td>
-                    <input type="text" />
-                </td>
-            </tr>
         </tbody>
     </table>
 </div>
\ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
index 1ffc9a6..bb5cdb0 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
@@ -396,7 +396,7 @@
 
         fun checkReply(reply: String?): Boolean {
             return if (reply != null) {
-                !reply.contains("rpc-error>") || reply.contains("warning") || reply.contains("ok/>")
+                !reply.contains("rpc-error>") || reply.contains("ok/>")
             } else false
         }
     }
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
index a4ef441..ffbf730 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
@@ -17,8 +17,11 @@
 
 import org.junit.Assert
 import org.junit.Assert.assertTrue
+import org.junit.Ignore
 import org.junit.Test
 import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException
+import kotlin.test.assertFailsWith
+import kotlin.test.assertFalse
 import kotlin.test.fail
 
 class RpcMessageUtilsTest {
@@ -214,6 +217,15 @@
     }
 
     @Test
+    fun deleteConfigThrowsNetconfExceptionOnRunningDataStore() {
+        assertFailsWith(exceptionClass = NetconfException::class) {
+            val netconfTargetConfig = NetconfDatastore.RUNNING.datastore
+            val msgId = "35"
+            NetconfMessageUtils.deleteConfig(msgId, netconfTargetConfig)
+        }
+    }
+
+    @Test
     fun discardChanges() {
         val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                 + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
@@ -277,11 +289,21 @@
     }
 
     @Test
-    fun checkReply(){
+    fun `checkReply should return true on ok msg`() {
         assertTrue(NetconfMessageUtils.checkReply("ok"))
     }
 
     @Test
+    fun `checkReply on rpc-error should return false`() {
+        assertFalse { NetconfMessageUtils.checkReply("something something rpc-error>") }
+    }
+
+    @Test
+    fun `checkReply on null input should return false`() {
+        assertFalse { NetconfMessageUtils.checkReply(null) }
+    }
+
+    @Test
     fun formatRPCRequest(){
         val checkString = ("#199" +
                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">  <capabilities>    <capability>hi</capability>    <capability>hello</capability>  </capabilities></hello>" +
@@ -296,11 +318,17 @@
 
         val result = NetconfMessageUtils.formatRPCRequest(request,messageId,capabilities).replace("[\n\r\t]".toRegex(), "")
         Assert.assertEquals(checkString, result)
-
-
     }
 
+    @Test
+    fun `validateRPCXML on empty input returns false`() {
+        assertFalse { NetconfMessageUtils.validateRPCXML("") }
+    }
 
-
+    @Test
+    fun `validateRPCXML on bad input returns false`() {
+        println("Don't fear \"[Fatal Error] :1:1: Content is not allowed in prolog.\" TODO: adjust logging for NetconfMessageUtils")
+        assertFalse { NetconfMessageUtils.validateRPCXML("really bad XML ~~~input") }
+    }
 
 }
\ No newline at end of file
diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml
index c2ec8b9..cbf8ca8 100644
--- a/ms/cds-sdc-listener/application/pom.xml
+++ b/ms/cds-sdc-listener/application/pom.xml
@@ -18,6 +18,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.onap.ccsdk.cds</groupId>
   <artifactId>cds-sdc-listener-application</artifactId>
+  <version>0.4.2-SNAPSHOT</version>
   <name>CDS-SDC Listener Application </name>
 
   <properties>
diff --git a/ms/cds-sdc-listener/distribution/pom.xml b/ms/cds-sdc-listener/distribution/pom.xml
index d4ce041..59e3824 100644
--- a/ms/cds-sdc-listener/distribution/pom.xml
+++ b/ms/cds-sdc-listener/distribution/pom.xml
@@ -10,7 +10,7 @@
   <parent>
     <artifactId>cds-sdc-listener</artifactId>
     <groupId>org.onap.ccsdk.cds</groupId>
-    <version>0.4.1-SNAPSHOT</version>
+    <version>0.4.2-SNAPSHOT</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>