From 6392515d91c00df8cb925ec9e99273a2f9e4744f Mon Sep 17 00:00:00 2001 From: sarada prasad sahoo Date: Mon, 7 Oct 2019 12:34:49 +0530 Subject: SO Distribution Error on Allotted Resource SO Distribution Error on Allotted Resource - duplicate primary Issue-ID: SO-2351 Signed-off-by: sarada prasad sahoo Change-Id: Iae7bda27ac4975b5ede657ac485472bbc6e88c56 --- .../client/test/rest/ASDCRestInterfaceTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'asdc-controller/src/test/java') diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 7171fff812..9294677b95 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -366,6 +366,30 @@ public class ASDCRestInterfaceTest extends BaseTest { assertEquals("PublicNS", service.get().getModelName()); } + @Test + public void test_Vcperescust_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/vcpe-rescust/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue( + new File(resourceLocation + "demo-vcpe-rescust-notification.json"), NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity entity = new HttpEntity(request, headers); + ResponseEntity response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional service = serviceRepo.findById("d3aac917-543d-4421-b6d7-ba2b65884eb7"); + assertTrue(service.isPresent()); + assertEquals("vCPEResCust 2019-10-01 _2364", service.get().getModelName()); + } + protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } -- cgit