[ONOS-7491] Change deletion API let app use hostname as input param

Change-Id: Iba2d929a0d308bd39ae9ba14ac39c235d3bc56c5
diff --git a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/web/OpenstackNodeWebResourceTest.java b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/web/OpenstackNodeWebResourceTest.java
index ed8cd9a..5ed0f1d 100644
--- a/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/web/OpenstackNodeWebResourceTest.java
+++ b/apps/openstacknode/app/src/test/java/org/onosproject/openstacknode/web/OpenstackNodeWebResourceTest.java
@@ -94,7 +94,7 @@
     }
 
     /**
-     * Tests the results of the REST API POST with creating new nodes operation.
+     * Tests the results of the REST API POST method with creating new nodes operation.
      */
     @Test
     public void testCreateNodesWithCreateOperation() {
@@ -118,7 +118,7 @@
     }
 
     /**
-     * Tests the results of the REST API POST without creating new nodes operation.
+     * Tests the results of the REST API POST method without creating new nodes operation.
      */
     @Test
     public void testCreateNodesWithoutCreateOperation() {
@@ -138,7 +138,7 @@
     }
 
     /**
-     * Tests the results of the REST API PUT with modifying the nodes.
+     * Tests the results of the REST API PUT method with modifying the nodes.
      */
     @Test
     public void testUpdateNodesWithoutModifyOperation() {
@@ -162,7 +162,7 @@
     }
 
     /**
-     * Tests the results of the REST API PUT without modifying the nodes.
+     * Tests the results of the REST API PUT method without modifying the nodes.
      */
     @Test
     public void testUpdateNodesWithModifyOperation() {
@@ -180,4 +180,50 @@
 
         verify(mockOpenstackNodeService);
     }
+
+    /**
+     * Tests the results of the REST API DELETE method with deleting the nodes.
+     */
+    @Test
+    public void testDeleteNodesWithDeletionOperation() {
+        expect(mockOpenstackNodeService.node(anyString())).andReturn(openstackNode).once();
+        replay(mockOpenstackNodeService);
+
+        expect(mockOpenstackNodeAdminService.removeNode(anyString())).andReturn(openstackNode).once();
+        replay(mockOpenstackNodeAdminService);
+
+        String location = PATH + "/gateway-node";
+
+        final WebTarget wt = target();
+        Response response = wt.path(location).request(
+                            MediaType.APPLICATION_JSON_TYPE).delete();
+
+        final int status = response.getStatus();
+
+        assertThat(status, is(204));
+
+        verify(mockOpenstackNodeService);
+        verify(mockOpenstackNodeAdminService);
+    }
+
+    /**
+     * Tests the results of the REST API DELETE method without deleting the nodes.
+     */
+    @Test
+    public void testDeleteNodesWithoutDeletionOperation() {
+        expect(mockOpenstackNodeService.node(anyString())).andReturn(null).once();
+        replay(mockOpenstackNodeService);
+
+        String location = PATH + "/gateway-node";
+
+        final WebTarget wt = target();
+        Response response = wt.path(location).request(
+                MediaType.APPLICATION_JSON_TYPE).delete();
+
+        final int status = response.getStatus();
+
+        assertThat(status, is(304));
+
+        verify(mockOpenstackNodeService);
+    }
 }