/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
+ * Modifications Copyright © 2018 IBM.\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
\r
package org.onap.ccsdk.apps.controllerblueprints;\r
\r
+import static org.assertj.core.api.Assertions.assertThat;\r
+\r
import org.junit.Assert;\r
import org.junit.Before;\r
import org.junit.Test;\r
import org.junit.runner.RunWith;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.boot.test.context.SpringBootTest;\r
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;\r
import org.springframework.boot.test.web.client.TestRestTemplate;\r
-import org.springframework.http.*;\r
+import org.springframework.http.HttpEntity;\r
+import org.springframework.http.HttpHeaders;\r
+import org.springframework.http.HttpMethod;\r
+import org.springframework.http.HttpStatus;\r
+import org.springframework.http.MediaType;\r
+import org.springframework.http.ResponseEntity;\r
import org.springframework.test.context.junit4.SpringRunner;\r
\r
-import static org.assertj.core.api.Assertions.assertThat;\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
\r
@RunWith(SpringRunner.class)\r
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
\r
@Autowired\r
private TestRestTemplate restTemplate;\r
+ private HttpHeaders headers;\r
+ private ResponseEntity<ConfigModel> entity;\r
\r
@Before\r
public void setUp(){\r
-\r
+ headers = new HttpHeaders();\r
+ headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
+ entity = this.restTemplate\r
+ .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
+ \r
}\r
\r
@Test\r
public void testConfigModel() {\r
- HttpHeaders headers = new HttpHeaders();\r
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
- ResponseEntity<ConfigModel> entity = this.restTemplate\r
- .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);\r
Assert.assertNotNull("failed to get response Config model",entity.getBody());\r
}\r
\r
@Test\r
public void testConfigModelFailure() {\r
- HttpHeaders headers = new HttpHeaders();\r
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
- ResponseEntity<ConfigModel> entity = this.restTemplate\r
- .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);\r
Assert.assertNotNull("failed to get response Config model",entity.getBody());\r
}\r