diff options
author | MichaelMorris <michael.morris@est.tech> | 2019-04-08 13:59:09 +0000 |
---|---|---|
committer | MichaelMorris <michael.morris@est.tech> | 2019-04-08 13:59:09 +0000 |
commit | 67e46b382de7ae15bdb2062e62bbc8725d3d113e (patch) | |
tree | c5a37d360b012b5920b02f59558772c9f77cb2f1 /adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test | |
parent | e757e801c665a1758cf4c976b24df13adda38b2b (diff) |
Add subscription for notifications
Issue-ID: SO-1628
Change-Id: I302e5c65f9b01a8608053b6f83696d0161cd2bf2
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test')
2 files changed, 19 insertions, 1 deletions
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java index 64ce25c991..78b2116311 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java @@ -27,7 +27,9 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.content; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest; import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus; import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; import com.google.gson.Gson; @@ -50,6 +52,7 @@ import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200; +import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201; import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException; import org.onap.so.client.aai.AAIResourcesClient; @@ -123,6 +126,13 @@ public class VnfmAdapterControllerTest { setUpVnfmsInMockAai(); setUpVimInMockAai(); + final String expectedsubscriptionRequest = + "{\"filter\":{\"vnfInstanceSubscriptionFilter\":{\"vnfInstanceIds\":[\"vnfId\"]},\"notificationTypes\":[\"VnfLcmOperationOccurrenceNotification\"]},\"callbackUri\":\"https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/lcn/VnfLcmOperationOccurrenceNotification\",\"authentication\":{\"authType\":[\"BASIC\"],\"paramsBasic\":{\"userName\":\"vnfm\",\"password\":\"$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke\"}}}"; + final InlineResponse2001 subscriptionResponse = new InlineResponse2001(); + mockRestServer.expect(requestTo("http://vnfm2:8080/subscriptions")) + .andExpect(content().json(expectedsubscriptionRequest)) + .andRespond(withSuccess(gson.toJson(subscriptionResponse), MediaType.APPLICATION_JSON)); + mockRestServer.expect(requestTo("http://dummy.value/until/create/implememted/vnfId/instantiate")) .andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON) .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456"))); @@ -215,6 +225,8 @@ public class VnfmAdapterControllerTest { setUpVnfmsInMockAai(); setUpVimInMockAai(); + mockRestServer.expect(requestTo("http://vnfm2:8080/subscriptions")).andRespond(withBadRequest()); + mockRestServer.expect(requestTo("http://dummy.value/until/create/implememted/vnfId/instantiate")) .andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON) .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456"))); diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml index 2b51181f46..e69e90173d 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml @@ -17,6 +17,9 @@ spring: - username: test password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' role: BPEL-Client + - username: vnfm + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client mso: key: 07a7159d3bf51a0e53be7a8f89699be7 @@ -24,4 +27,7 @@ mso: aai: auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586 endpoint: https://aai.onap:8443 - version: v15
\ No newline at end of file + version: v15 + +vnfmadapter: + endpoint: https://so-vnfm-adapter.onap:30406
\ No newline at end of file |