From 42b670cfd17dab61dbd6632080c95572ea3b83c8 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 21 Aug 2018 04:11:57 +0000 Subject: Controller Blueprints Microservice Define Controllerblueprint API DataType and Error definitions for Config model, Service Template, Model Type and Resource Dictionary Services Change-Id: I12d8d87292ec101601b0cfb7ba9670730973e318 Issue-ID: CCSDK-469 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../ControllerBluprintsApplicationTest.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'ms/controllerblueprints/application/src/test/java') diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java index 95639bd3..26b943b6 100644 --- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java +++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java @@ -16,17 +16,18 @@ package org.onap.ccsdk.apps.controllerblueprints; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; @@ -46,8 +47,21 @@ public class ControllerBluprintsApplicationTest { @Test public void testConfigModel() { - ResponseEntity entity = this.restTemplate - .getForEntity("/api/v1/config-model/1", String.class); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON_VALUE); + ResponseEntity entity = this.restTemplate + .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + Assert.assertNotNull("failed to get response Config model",entity.getBody()); + } + + @Test + public void testConfigModelFailure() { + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON_VALUE); + ResponseEntity entity = this.restTemplate + .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); + Assert.assertNotNull("failed to get response Config model",entity.getBody()); } } -- cgit 1.2.3-korg