Get subscribers rewritten to new rest client
[vid.git] / vid-app-common / src / test / java / org / onap / vid / aai / AaiOverTLSClientTest.java
index 5b631a6..4e0e70e 100644 (file)
@@ -33,11 +33,13 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.onap.vid.aai.model.AaiNodeQueryResponse;
 import org.onap.vid.aai.model.ResourceType;
 import org.onap.vid.client.SyncRestClient;
+import org.onap.vid.model.SubscriberList;
 
 @RunWith(MockitoJUnitRunner.class)
 public class AaiOverTLSClientTest {
 
-    public static final String SEARCH_NODES_QUERY_SEARCH_NODE_TYPE = "search/nodes-query?search-node-type=generic-vnf&filter=vnf-name:EQUALS:name";
+    private static final String SEARCH_NODES_QUERY_SEARCH_NODE_TYPE = "search/nodes-query?search-node-type=generic-vnf&filter=vnf-name:EQUALS:name";
+    private static final String SUBSCRIBERS = "business/customers?subscriber-type=INFRA&depth=0";
     private AaiOverTLSClient aaiRestClient;
 
     @Mock
@@ -51,7 +53,7 @@ public class AaiOverTLSClientTest {
     }
 
     @Test
-    public void searchNodeTypeByName() {
+    public void testSearchNodeTypeByName() {
         mockPropertyReader();
 
         aaiRestClient.searchNodeTypeByName("name", ResourceType.GENERIC_VNF);
@@ -59,6 +61,15 @@ public class AaiOverTLSClientTest {
             Matchers.eq(getHeaders()), Matchers.eq(Collections.emptyMap()), Matchers.eq(AaiNodeQueryResponse.class));
     }
 
+    @Test
+    public void  testGetAllSubscribers(){
+        mockPropertyReader();
+
+        aaiRestClient.getAllSubscribers();
+        Mockito.verify(syncRestClient).get(Matchers.contains(SUBSCRIBERS),
+            Matchers.eq(getHeaders()), Matchers.eq(Collections.emptyMap()), Matchers.eq(SubscriberList.class));
+    }
+
     private void mockPropertyReader() {
         Mockito.when(propertySupplier.getPassword()).thenReturn("Pass");
         Mockito.when(propertySupplier.getUsername()).thenReturn("User");