From 545a3ab71bc48b56d538bba3e0fb11a5e41b398f Mon Sep 17 00:00:00 2001 From: Steve Alphonse Siani Date: Mon, 21 Jan 2019 11:55:48 -0500 Subject: ControllerBlueprint blueprintsProcessor container Change-Id: I77df77757c276fca705091c1566c386f842269c4 Issue-ID: CCSDK-949 Signed-off-by: Steve Alphonse Siani --- .../ControllerBlueprintsApplicationTest.java | 62 ++++++++++++++++++++++ .../ControllerBluprintsApplicationTest.java | 62 ---------------------- .../src/test/resources/application.properties | 5 +- 3 files changed, 66 insertions(+), 63 deletions(-) create mode 100644 ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java delete mode 100644 ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java (limited to 'ms/controllerblueprints/application/src/test') diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java new file mode 100644 index 00000000..cf9b3e71 --- /dev/null +++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java @@ -0,0 +1,62 @@ +/* + * Copyright © 2017-2018 AT&T Intellectual Property. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.apps.controllerblueprints; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +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.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.client.support.BasicAuthorizationInterceptor; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class ControllerBlueprintsApplicationTest { + @Autowired + private TestRestTemplate restTemplate; + + @Before + public void setUp(){ + BasicAuthorizationInterceptor bai = new BasicAuthorizationInterceptor("ccsdkapps", "ccsdkapps"); + this.restTemplate.getRestTemplate().getInterceptors().add(bai); + } + + @Test + public void testConfigModel() { + 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),BlueprintModel.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),BlueprintModel.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/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java deleted file mode 100644 index 969f8042..00000000 --- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.apps.controllerblueprints; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -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.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.client.support.BasicAuthorizationInterceptor; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -public class ControllerBluprintsApplicationTest { - @Autowired - private TestRestTemplate restTemplate; - - @Before - public void setUp(){ - BasicAuthorizationInterceptor bai = new BasicAuthorizationInterceptor("ccsdkapps", "ccsdkapps"); - this.restTemplate.getRestTemplate().getInterceptors().add(bai); - } - - @Test - public void testConfigModel() { - 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),BlueprintModel.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),BlueprintModel.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 13b2aa75..9aebd793 100755 --- a/ms/controllerblueprints/application/src/test/resources/application.properties +++ b/ms/controllerblueprints/application/src/test/resources/application.properties @@ -52,4 +52,7 @@ controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model- controllerblueprints.loadCbaExtension=zip # CBA examples for tests cases -controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprints \ No newline at end of file +controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprints + +# Web server config +server.port=8080 \ No newline at end of file -- cgit 1.2.3-korg