summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/application/src/test
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-21 04:11:57 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-08-21 04:11:57 +0000
commit5285007a4e66bc18c69cef96aa32326a139d7642 (patch)
tree898fb3f81a7981c0dc2332dc5d42b87523d15162 /ms/controllerblueprints/application/src/test
parenta3c9519d6aa7eb8e1f450a7d041047f2c0a5cc07 (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')
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java22
-rw-r--r--ms/controllerblueprints/application/src/test/resources/application.properties2
-rw-r--r--ms/controllerblueprints/application/src/test/resources/logback.xml3
3 files changed, 20 insertions, 7 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());
}
}
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index 55ffeaf16..a147034f8 100644
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ b/ms/controllerblueprints/application/src/test/resources/application.properties
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
+spring.jackson.default-property-inclusion=non_null
#Load Blueprints
# blueprints.load.initial-data may be overridden by ENV variables
blueprints.load.initial-data=true
diff --git a/ms/controllerblueprints/application/src/test/resources/logback.xml b/ms/controllerblueprints/application/src/test/resources/logback.xml
index b9b97dc89..53388bc9e 100644
--- a/ms/controllerblueprints/application/src/test/resources/logback.xml
+++ b/ms/controllerblueprints/application/src/test/resources/logback.xml
@@ -24,8 +24,7 @@
</appender>
- <logger name="org.springframework" level="info"/>
- <logger name="org.springframework.web" level="debug"/>
+ <logger name="org.springframework" level="warn"/>
<logger name="org.hibernate" level="info"/>
<logger name="org.onap.ccsdk.apps.controllerblueprints" level="info"/>