diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-21 04:11:57 +0000 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-21 04:11:57 +0000 |
commit | 5285007a4e66bc18c69cef96aa32326a139d7642 (patch) | |
tree | 898fb3f81a7981c0dc2332dc5d42b87523d15162 /ms/controllerblueprints/application/src/test/java | |
parent | a3c9519d6aa7eb8e1f450a7d041047f2c0a5cc07 (diff) |
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) <bs2796@att.com>
Diffstat (limited to 'ms/controllerblueprints/application/src/test/java')
-rw-r--r-- | ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java | 22 |
1 files changed, 18 insertions, 4 deletions
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 95639bd32..26b943b61 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<String> entity = this.restTemplate
- .getForEntity("/api/v1/config-model/1", String.class);
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
+ ResponseEntity<ConfigModel> 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<ConfigModel> 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());
}
}
|