summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-08-29 16:46:22 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-08-29 23:43:47 -0400
commitb8539cca6f2bc572801640b3fcefe83dcecf5ef5 (patch)
tree73fd650fa51807d664528ba53f53a4602aec2c30
parent0fbfc6eab2d42c8ee2f8601db43813a4e33ffc4d (diff)
Refactor Blueprint model controller to designer api.
Change-Id: I6e729aab24262f6bdef4b92febf9f65a4819d142 Issue-ID: CCSDK-1663 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintModelHandler.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt (renamed from ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelController.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt (renamed from ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt)21
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt27
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties41
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml39
7 files changed, 121 insertions, 20 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
index 2586be255..7c1576e95 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/pom.xml
@@ -23,12 +23,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>designer-api</artifactId>
<packaging>jar</packaging>
- <name>Blueprints Designer API</name>
- <description>Blueprints Designer API</description>
-
- <properties>
- <sonar.skip>true</sonar.skip>
- </properties>
+ <name>Blueprints Processor Designer API</name>
+ <description>Blueprints Processor Designer API</description>
<dependencies>
<dependency>
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintModelHandler.kt
index f40da68f6..d4bcd8e94 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintModelHandler.kt
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.handler
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index a214f961e..98f521222 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.controller
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch
-import org.onap.ccsdk.cds.controllerblueprints.service.handler.BluePrintModelHandler
import org.springframework.core.io.Resource
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
index 1ef717a5c..cd49870ae 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/service/controller/BlueprintModelControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.controller
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.runBlocking
@@ -26,21 +26,21 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.controllerblueprints.TestApplication
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.service.BluePrintDesignerCoreConfiguration
import org.onap.ccsdk.cds.controllerblueprints.service.domain.BlueprintModelSearch
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.context.annotation.ComponentScan
import org.springframework.core.io.ByteArrayResource
import org.springframework.http.HttpMethod
import org.springframework.http.HttpStatus
import org.springframework.http.client.MultipartBodyBuilder
import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient
import org.springframework.test.web.reactive.server.returnResult
@@ -48,7 +48,6 @@ import org.springframework.util.Base64Utils
import org.springframework.web.reactive.function.BodyInserters
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
-import java.nio.file.Paths
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@@ -62,10 +61,10 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = [TestApplication::class, BluePrintDesignerCoreConfiguration::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-@EnableAutoConfiguration
class BlueprintModelControllerTest {
private val log = LoggerFactory.getLogger(BlueprintModelControllerTest::class.java)!!
@@ -79,7 +78,7 @@ class BlueprintModelControllerTest {
private var bluePrintLoadConfiguration: BluePrintLoadConfiguration? = null
- private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ private val blueprintDir = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
private var zipBlueprintFileName: String? = null
private var testZipFile: File? = null
@@ -99,7 +98,7 @@ class BlueprintModelControllerTest {
val archiveDir = normalizedFile(bluePrintLoadConfiguration!!.blueprintArchivePath).reCreateDirs()
assertTrue(archiveDir.exists(), "failed to create archiveDir(${archiveDir.absolutePath}")
- val blueprintFile = Paths.get(blueprintDir).toFile().normalize()
+ val blueprintFile = normalizedFile(blueprintDir)
testZipFile = blueprintFile.compress(zipBlueprintFileName!!)
assertNotNull(testZipFile, "test zip is null")
assertTrue(testZipFile!!.exists(), "Failed to create blueprint test zip(${testZipFile!!.absolutePath}")
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
new file mode 100644
index 000000000..03e016b8e
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
@@ -0,0 +1,27 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * 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.cds.blueprintsprocessor.designer.api
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor"])
+@EnableAutoConfiguration
+open class DesignerApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties
new file mode 100755
index 000000000..e22e522ee
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/application-test.properties
@@ -0,0 +1,41 @@
+#
+# Copyright © 2019 IBM.
+#
+# 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.
+#
+
+spring.main.banner-mode=off
+spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
+logging.level.org.springframework.web=INFO
+logging.level.org.hibernate.SQL=warn
+logging.level.org.hibernate.type.descriptor.sql=debug
+
+blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
+blueprintsprocessor.db.username=sa
+blueprintsprocessor.db.password=
+blueprintsprocessor.db.driverClassName=org.h2.Driver
+blueprintsprocessor.db.hibernateHbm2ddlAuto=create-drop
+blueprintsprocessor.db.hibernateDDLAuto=update
+blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
+blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.H2Dialect
+
+# Load Resource Source Mappings
+resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability
+# Controller Blueprints Core Configuration
+blueprintsprocessor.blueprintDeployPath=./target/blueprints/deploy
+blueprintsprocessor.blueprintArchivePath=./target/blueprints/archive
+blueprintsprocessor.blueprintWorkingPath=./target/blueprints/work
+
+# Python executor
+blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints
+blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml
new file mode 100644
index 000000000..feb4514d6
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/resources/logback-test.xml
@@ -0,0 +1,39 @@
+<!--
+ ~ Copyright © 2018 IBM.
+ ~ Modifications 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.
+ -->
+
+<configuration>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level [%thread] %logger{50} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="warn"/>
+ <logger name="org.springframework.web" level="warn"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.cds.controllerblueprints.core" level="warn"/>
+ <logger name="org.onap.ccsdk.cds.controllerblueprints" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>