- @Test
- public void test_getLogicLink() throws CorrelationException {
- mockGetMethod();
- EasyMock.expect(response.readEntity(String.class)).andReturn(data.get("logic-link").toString());
- EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
-
- PowerMock.replayAll();
-
- String linkId = aai.getLogicLink("network-1", "pnf-1", "interface-1", "DOWN");
-
- PowerMock.verifyAll();
-
- assertThat(linkId, equalTo("logic-link-1"));
-
- }
-
- @Test
- public void test_getServiceInstances_exception() {
- mockGetMethod();
- EasyMock.expect(response.readEntity(String.class)).andReturn(data.get("vpn-binding").toString());
- EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
-
- mockGetMethod();
- EasyMock.expect(response.readEntity(String.class)).andReturn(data.get("connectivity").toString());
- EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
-
- mockGetMethod();
- EasyMock.expect(response.readEntity(String.class))
- .andReturn(data.get("service-instance-by-connectivity").toString());
- EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.OK);
-
- mockGetMethod();
- EasyMock.expect(response.readEntity(String.class))
- .andReturn(data.get("service-instances-by-service-type").toString());
- EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
-
- mockGetMethod();
- EasyMock.expect(response.readEntity(String.class)).andReturn(data.get("service-instance").toString());
- EasyMock.expect(response.getStatusInfo()).andReturn(Response.Status.NOT_FOUND).times(2);
-
- thrown.expect(RuntimeException.class);
-
- PowerMock.replayAll();
-
- JsonObject instance = aai.getServiceInstance("network-1", "pnf-1", "interface-1", "DOWN");
-
- PowerMock.verifyAll();
-
- assertThat(instance, equalTo("logic-link-1"));
-
- }