import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.BluePrintModelHandler
import org.springframework.core.io.Resource
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.controller
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
-import org.springframework.web.bind.annotation.RestControllerAdvice
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.service.common.ErrorMessage
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ExceptionHandler
+import org.springframework.web.bind.annotation.RestControllerAdvice
/**
* ControllerBlueprintExceptionHandler Purpose: Handle exceptions in controllerBlueprint API and provide the right
@ExceptionHandler
fun ControllerBlueprintExceptionHandler(e: BluePrintException): ResponseEntity<ErrorMessage> {
- var errorCode = ErrorCode.valueOf(e.code)
+ val errorCode = ErrorCode.valueOf(e.code)
val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
LOG.error("Error: $errorCode ${e.message}")
return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
@ExceptionHandler
fun ControllerBlueprintExceptionHandler(e: Exception): ResponseEntity<ErrorMessage> {
- var errorCode = ErrorCode.GENERIC_FAILURE
+ val errorCode = ErrorCode.GENERIC_FAILURE
val errorMessage = ErrorMessage(errorCode?.message(e.message!!), errorCode?.value, "ControllerBluePrint_Error_Message")
LOG.error("Error: $errorCode ${e.message}")
return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode!!.httpCode))
* 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.blueprintsprocessor.designer.api.handler.ModelTypeHandler
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
-import org.onap.ccsdk.cds.controllerblueprints.service.handler.ModelTypeHandler
-import kotlinx.coroutines.runBlocking
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.*
* 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.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary
-import org.onap.ccsdk.cds.controllerblueprints.service.handler.ResourceDictionaryHandler
-import kotlinx.coroutines.runBlocking
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.*
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
import org.springframework.stereotype.Service
@Service
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateEnhancer
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
-import org.onap.ccsdk.cds.controllerblueprints.service.ResourceDefinitionRepoService
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
-import org.onap.ccsdk.cds.controllerblueprints.service.ResourceDefinitionRepoService
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.springframework.stereotype.Service
interface ResourceDefinitionEnhancerService {
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelContentRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelRepository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.ControllerBlueprintModelSearchRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.*
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
-import org.onap.ccsdk.cds.controllerblueprints.service.utils.BluePrintEnhancerUtils
import org.slf4j.LoggerFactory
import org.springframework.core.io.ByteArrayResource
import org.springframework.core.io.Resource
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.handler
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.ModelTypeValidator
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
-import org.onap.ccsdk.cds.controllerblueprints.service.repository.ModelTypeRepository
-import org.onap.ccsdk.cds.controllerblueprints.service.validator.ModelTypeValidator
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.handler
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler
import com.google.common.base.Preconditions
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.lang3.StringUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary
-import org.onap.ccsdk.cds.controllerblueprints.service.repository.ResourceDictionaryRepository
import org.springframework.stereotype.Service
@Service
import kotlinx.coroutines.coroutineScope
import org.apache.commons.io.FilenameUtils
import org.apache.commons.lang3.text.StrBuilder
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.*
import org.onap.ccsdk.cds.controllerblueprints.core.readNBText
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
-import org.onap.ccsdk.cds.controllerblueprints.service.handler.ModelTypeHandler
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
import kotlinx.coroutines.coroutineScope
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.text.StrBuilder
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.readNBText
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary
-import org.onap.ccsdk.cds.controllerblueprints.service.handler.ResourceDictionaryHandler
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
/*
- * Copyright © 2018 IBM.
+ * 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.
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.repository
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
import org.springframework.stereotype.Service
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import reactor.core.scheduler.Schedulers
-
+// TODO("Convert into coroutines")
/**
* ModelTypeReactRepository.
*
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.repository
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
import org.springframework.data.jpa.repository.JpaRepository
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.repository
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary
import org.springframework.data.jpa.repository.JpaRepository
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service
import com.google.common.base.Preconditions
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.lang3.StringUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary
import org.onap.ccsdk.cds.controllerblueprints.service.model.AutoMapResponse
-import org.onap.ccsdk.cds.controllerblueprints.service.repository.ResourceDictionaryRepository
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.util.*
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service
import com.fasterxml.jackson.databind.JsonNode
import com.google.common.base.Preconditions
import org.apache.commons.lang3.StringUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.*
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
-import org.onap.ccsdk.cds.controllerblueprints.service.repository.ModelTypeRepository
-import org.onap.ccsdk.cds.controllerblueprints.service.repository.ResourceDictionaryRepository
import org.springframework.stereotype.Service
interface ResourceDefinitionRepoService : BluePrintRepoService {
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.utils
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.reactive.awaitSingle
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.validator
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.controller
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import org.junit.Assert
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.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
import org.springframework.test.annotation.Commit
import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
-@DataJpaTest
-@ContextConfiguration(classes = [TestApplication::class])
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ModelTypeControllerTest {
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.controller
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
+import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.controllerblueprints.TestApplication
+import org.junit.runners.MethodSorters
+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.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [TestApplication::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@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)
class ResourceDictionaryControllerTest {
@Autowired
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler
import kotlinx.coroutines.runBlocking
import org.junit.Assert
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.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
-import org.onap.ccsdk.cds.controllerblueprints.service.handler.ModelTypeHandler
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
import org.springframework.test.annotation.Commit
import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.transaction.annotation.Propagation
-import org.springframework.transaction.annotation.Transactional
@RunWith(SpringRunner::class)
-@DataJpaTest
-@Transactional(propagation = Propagation.NOT_SUPPORTED)
-@ContextConfiguration(classes = [TestApplication::class])
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ModelTypeServiceTest {
@Autowired
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.controller.mock
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.mock
import org.apache.commons.io.FilenameUtils
import org.slf4j.LoggerFactory
--- /dev/null
+/*
+ * 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.repository
+
+import org.junit.Assert
+import org.junit.FixMethodOrder
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.MethodSorters
+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.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.annotation.Commit
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
+import org.springframework.test.context.junit4.SpringRunner
+import java.nio.charset.Charset
+import java.util.*
+
+/**
+ * ModelTypeReactRepositoryTest.
+ *
+ * @author Brinda Santh
+ */
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class ModelTypeReactRepositoryTest {
+
+ @Autowired
+ private val modelTypeReactRepository: ModelTypeReactRepository? = null
+
+ internal var modelName = "test-datatype"
+
+ @Test
+ @Commit
+ fun test01Save() {
+ val content = normalizedFile("./src/test/resources/model_type/data_type/datatype-property.json")
+ .readText(Charset.defaultCharset())
+ val modelType = ModelType()
+ modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
+ modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT
+ modelType.description = "Definition for Sample Datatype "
+ modelType.definition = JacksonUtils.jsonNode(content)
+ modelType.modelName = modelName
+ modelType.version = "1.0.0"
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.updatedBy = "xxxxxx@xxx.com"
+
+ val dbModelType = modelTypeReactRepository!!.save(modelType).block()
+ Assert.assertNotNull("Failed to get Saved ModelType", dbModelType)
+ }
+
+ @Test
+ fun test02Finds() {
+ val dbFindByModelName = modelTypeReactRepository!!.findByModelName(modelName).block()
+ Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName)
+
+ val dbFindByDefinitionType = modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block()
+ Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType)
+ Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType!!.size > 0)
+
+ val dbFindByDerivedFrom = modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block()
+ Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom)
+ Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom!!.size > 0)
+
+ val dbFindByModelNameIn = modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block()
+ Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn)
+ Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn!!.size > 0)
+
+ val dbFindByDefinitionTypeIn = modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block()
+ Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn)
+ Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn!!.size > 0)
+
+ val dbFindByDerivedFromIn = modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block()
+ Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn)
+ Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn!!.size > 0)
+ }
+
+ @Test
+ @Commit
+ fun test03Delete() {
+ modelTypeReactRepository!!.deleteByModelName(modelName).block()
+ }
+
+}
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.repository
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository
-import kotlinx.coroutines.runBlocking
import org.junit.Assert
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.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.service.domain.ResourceDictionary
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
import org.springframework.test.annotation.Commit
import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.transaction.annotation.Transactional
@RunWith(SpringRunner::class)
-@DataJpaTest
-@ContextConfiguration(classes = [TestApplication::class])
+@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
+ BlueprintPropertyConfiguration::class, BluePrintProperties::class, BluePrintDBLibConfiguration::class])
+@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ResourceDictionaryReactRepositoryTest {
@Test
@Commit
fun test01Save() {
- val resourceDefinition = JacksonUtils.readValueFromFile("./../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json", ResourceDefinition::class.java)
+ val resourceDefinition = JacksonUtils
+ .readValueFromFile("./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
+ ResourceDefinition::class.java)
Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition)
resourceDefinition!!.name = sourceName
}
@Test
+ @Transactional
@Commit
fun test05Delete() {
- runBlocking {
- resourceDictionaryRepository.deleteByName(sourceName)
- }
+ resourceDictionaryRepository.deleteByName(sourceName)
}
private fun transformResourceDictionary(resourceDefinition: ResourceDefinition): ResourceDictionary {
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.utils
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Before
import org.junit.Test
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.mock.MockFilePart
import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.service.controller.mock.MockFilePart
import java.nio.file.Paths
import java.util.*
import kotlin.test.assertTrue
* limitations under the License.
*/
-package org.onap.ccsdk.cds.controllerblueprints.service.validator
+package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
import com.fasterxml.jackson.databind.JsonNode
import org.junit.Test
-[\r
- {\r
- "name": "rs-db-source",\r
- "input-param": true,\r
- "property": {\r
- "type": "string",\r
- "required": true\r
- },\r
- "dictionary-name": "sample-db-source",\r
- "dictionary-source": "processor-db",\r
- "dependencies": [\r
- "input-source"\r
- ]\r
- },\r
- {\r
- "name": "ra-default-source",\r
- "input-param": true,\r
- "property": {\r
- "type": "string",\r
- "required": true\r
- },\r
- "dictionary-name": "sample-default-source",\r
- "dictionary-source": "default",\r
- "dependencies": []\r
- },\r
- {\r
- "name": "ra-input-source",\r
- "input-param": true,\r
- "property": {\r
- "type": "string",\r
- "required": true\r
- },\r
- "dictionary-name": "sample-input-source",\r
- "dictionary-source": "input",\r
- "dependencies": []\r
- },\r
- {\r
- "name": "ra-list-input-source",\r
- "input-param": true,\r
- "property": {\r
- "type": "list",\r
- "required": true,\r
- "entry_schema": {\r
- "type": "string"\r
- }\r
- },\r
- "dictionary-name": "ra-list-input-source",\r
- "dictionary-source": "input",\r
- "dependencies": []\r
- },\r
- {\r
- "name": "ra-complex-input-source",\r
- "input-param": true,\r
- "property": {\r
- "type": "dt-v4-aggregate",\r
- "required": true\r
- },\r
- "dictionary-name": "sample-mdsal-source",\r
- "dictionary-source": "sdnc",\r
- "dependencies": []\r
- }\r
-]\r
+[
+ {
+ "name": "rs-db-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "sample-db-source",
+ "dictionary-source": "processor-db",
+ "dependencies": [
+ "input-source"
+ ]
+ },
+ {
+ "name": "ra-default-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "sample-default-source",
+ "dictionary-source": "default",
+ "dependencies": []
+ },
+ {
+ "name": "ra-input-source",
+ "input-param": true,
+ "property": {
+ "type": "string",
+ "required": true
+ },
+ "dictionary-name": "sample-input-source",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "ra-list-input-source",
+ "input-param": true,
+ "property": {
+ "type": "list",
+ "required": true,
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "dictionary-name": "ra-list-input-source",
+ "dictionary-source": "input",
+ "dependencies": []
+ },
+ {
+ "name": "ra-complex-input-source",
+ "input-param": true,
+ "property": {
+ "type": "dt-v4-aggregate",
+ "required": true
+ },
+ "dictionary-name": "sample-mdsal-source",
+ "dictionary-source": "sdnc",
+ "dependencies": []
+ }
+]
-{\r
- "metadata": {\r
- "template_author": "Brinda Santh",\r
- "template_name": "enhance-template",\r
- "template_version": "1.0.0",\r
- "template_tags": "brinda, VPE",\r
- "service-type": "Sample Service",\r
- "release": "1806",\r
- "vnf-type": "VPE"\r
- },\r
- "topology_template": {\r
- "inputs": {\r
- "request-id": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "service-instance-id": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "scope-type": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "action-name": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "hostname": {\r
- "required": true,\r
- "type": "string"\r
- }\r
- },\r
- "node_templates": {\r
- "vpe-netconf-device": {\r
- "capabilities": {\r
- "netconf": {\r
- "properties": {\r
- "login-key": "sdnc",\r
- "login-account": "sndc-local",\r
- "source": "local",\r
- "target-ip-address": {\r
- "get_attribute": [\r
- "SELF",\r
- "lo0-local-ipv4-address"\r
- ]\r
- },\r
- "port-number": 22,\r
- "connection-time-out": 30\r
- }\r
- }\r
- },\r
- "type": "vnf-netconf-device"\r
- },\r
- "activate-netconf-component": {\r
- "capabilities": {\r
- "component-node": {}\r
- },\r
- "requirements": {\r
- "netconf-connection": {\r
- "capability": "netconf",\r
- "node": "vpe-netconf-device",\r
- "relationship": "tosca.relationships.ConnectsTo"\r
- }\r
- },\r
- "interfaces": {\r
- "NetconfExecutorComponent": {\r
- "operations": {\r
- "process": {\r
- "inputs": {\r
- "action-name": {\r
- "get_input": "action-name"\r
- },\r
- "template-name": {\r
- "get_input": "template_name"\r
- },\r
- "template-version": {\r
- "get_input": "template_version"\r
- },\r
- "resource-type": "vnf-type",\r
- "request-id": {\r
- "get_input": "request-id"\r
- },\r
- "resource-id": {\r
- "get_input": "hostname"\r
- },\r
- "execution-script": "execution-script"\r
- },\r
- "outputs": {\r
- "response-data": {\r
- "get_attribute": [\r
- "SELF",\r
- "netconf-executor-baseconfig.response-data"\r
- ]\r
- },\r
- "status": {\r
- "get_attribute": [\r
- "SELF",\r
- "netconf-executor-baseconfig.status"\r
- ]\r
- }\r
- },\r
- "implementation": {\r
- "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "type": "component-netconf-executor"\r
- },\r
- "resource-assignment-ra-component": {\r
- "capabilities": {\r
- "component-node": {}\r
- },\r
- "interfaces": {\r
- "ResourceAssignmentComponent": {\r
- "operations": {\r
- "process": {\r
- "inputs": {\r
- "template-names": [\r
- "base-config-template",\r
- "licence-template"\r
- ],\r
- "action-name": {\r
- "get_input": "action-name"\r
- },\r
- "template-name": {\r
- "get_input": "template_name"\r
- },\r
- "template-version": {\r
- "get_input": "template-version"\r
- },\r
- "resource-type": "vnf-type",\r
- "request-id": {\r
- "get_input": "request-id"\r
- },\r
- "resource-id": {\r
- "get_input": "hostname"\r
- }\r
- },\r
- "outputs": {\r
- "resource-assignment-params": "success",\r
- "status": "status"\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "type": "component-resource-assignment"\r
- },\r
- "resource-assignment-action": {\r
- "properties": {\r
- "mode": "sync",\r
- "version": "LATEST",\r
- "is-start-flow": false\r
- },\r
- "requirements": {\r
- "component-dependency": {\r
- "capability": "component-node",\r
- "node": "resource-assignment-ra-component",\r
- "relationship": "tosca.relationships.DependsOn"\r
- }\r
- },\r
- "capabilities": {\r
- "dg-node": {}\r
- },\r
- "interfaces": {\r
- "CONFIG": {\r
- "operations": {\r
- "ResourceAssignment": {\r
- "inputs": {\r
- "params": []\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "type": "dg-resource-assignment"\r
- },\r
- "activate-action": {\r
- "properties": {\r
- "mode": "sync",\r
- "version": "LATEST",\r
- "is-start-flow": false\r
- },\r
- "requirements": {\r
- "component-dependency": {\r
- "capability": "component-node",\r
- "node": "activate-netconf-component",\r
- "relationship": "tosca.relationships.DependsOn"\r
- }\r
- },\r
- "capabilities": {\r
- "dg-node": {}\r
- },\r
- "interfaces": {\r
- "CONFIG": {\r
- "operations": {\r
- "ActivateNetconf": {\r
- "inputs": {\r
- "params": []\r
- }\r
- }\r
- }\r
- }\r
- },\r
- "type": "dg-activate-netconf"\r
- },\r
- "base-config-template": {\r
- "capabilities": {\r
- "content": {\r
- "properties": {\r
- "content": "db://base-config-template"\r
- }\r
- },\r
- "mapping": {\r
- "properties": {\r
- "mapping": [\r
- {\r
- "name": "rs-db-source",\r
- "property": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "input-param": false,\r
- "dictionary-name": "sample-db-source",\r
- "dictionary-source": "processor-db",\r
- "dependencies": [\r
- "hostname"\r
- ],\r
- "version": 0\r
- },\r
- {\r
- "name": "mdsal-source",\r
- "property": {\r
- "description": "",\r
- "required": true,\r
- "type": "list",\r
- "entry_schema": {\r
- "type": "dt-v4-aggregate"\r
- }\r
- },\r
- "input-param": false,\r
- "dictionary-name": "sample-mdsal-source",\r
- "dictionary-source": "sdnc",\r
- "dependencies": [\r
- "service-instance-id"\r
- ],\r
- "version": 0\r
- },\r
- {\r
- "name": "hostname",\r
- "property": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "dictionary-name": "hostname",\r
- "dictionary-source": "input",\r
- "version": 0,\r
- "input-param": false\r
- },\r
- {\r
- "name": "service",\r
- "property": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "dictionary-name": "service",\r
- "dictionary-source": "input",\r
- "version": 0,\r
- "input-param": false\r
- },\r
- {\r
- "name": "service-instance-id",\r
- "property": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "dictionary-name": "service-instance-id",\r
- "dictionary-source": "input",\r
- "version": 0,\r
- "input-param": false\r
- }\r
- ]\r
- }\r
- }\r
- },\r
- "properties": {\r
- "action-names": [\r
- "resource-assignment-action"\r
- ]\r
- },\r
- "type": "artifact-config-template"\r
- },\r
- "licence-template": {\r
- "capabilities": {\r
- "content": {\r
- "properties": {\r
- "content": "db://licence-template"\r
- }\r
- },\r
- "mapping": {\r
- "properties": {\r
- "mapping": [\r
- {\r
- "name": "licenses",\r
- "property": {\r
- "required": true,\r
- "type": "list",\r
- "entry_schema": {\r
- "type": "dt-license-key"\r
- }\r
- },\r
- "input-param": false,\r
- "dictionary-name": "sample-licenses",\r
- "dictionary-source": "sdnc",\r
- "dependencies": [\r
- "service-instance-id"\r
- ],\r
- "version": 0\r
- },\r
- {\r
- "name": "service-instance-id",\r
- "property": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "dictionary-name": "service-instance-id",\r
- "dictionary-source": "input",\r
- "version": 0,\r
- "input-param": false\r
- }\r
- ]\r
- }\r
- }\r
- },\r
- "properties": {\r
- "action-names": [\r
- "resource-assignment-action"\r
- ]\r
- },\r
- "type": "artifact-config-template"\r
- }\r
- }\r
- },\r
- "node_types": {\r
- },\r
- "data_types": {\r
- }\r
-}\r
+{
+ "metadata": {
+ "template_author": "Brinda Santh",
+ "template_name": "enhance-template",
+ "template_version": "1.0.0",
+ "template_tags": "brinda, VPE",
+ "service-type": "Sample Service",
+ "release": "1806",
+ "vnf-type": "VPE"
+ },
+ "topology_template": {
+ "inputs": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "service-instance-id": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "node_templates": {
+ "vpe-netconf-device": {
+ "capabilities": {
+ "netconf": {
+ "properties": {
+ "login-key": "sdnc",
+ "login-account": "sndc-local",
+ "source": "local",
+ "target-ip-address": {
+ "get_attribute": [
+ "SELF",
+ "lo0-local-ipv4-address"
+ ]
+ },
+ "port-number": 22,
+ "connection-time-out": 30
+ }
+ }
+ },
+ "type": "vnf-netconf-device"
+ },
+ "activate-netconf-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "requirements": {
+ "netconf-connection": {
+ "capability": "netconf",
+ "node": "vpe-netconf-device",
+ "relationship": "tosca.relationships.ConnectsTo"
+ }
+ },
+ "interfaces": {
+ "NetconfExecutorComponent": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template_version"
+ },
+ "resource-type": "vnf-type",
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ },
+ "execution-script": "execution-script"
+ },
+ "outputs": {
+ "response-data": {
+ "get_attribute": [
+ "SELF",
+ "netconf-executor-baseconfig.response-data"
+ ]
+ },
+ "status": {
+ "get_attribute": [
+ "SELF",
+ "netconf-executor-baseconfig.status"
+ ]
+ }
+ },
+ "implementation": {
+ "primary": "file://netconf_adaptor/DefaultBaseLicenceConfig.py"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-netconf-executor"
+ },
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
+ },
+ "interfaces": {
+ "ResourceAssignmentComponent": {
+ "operations": {
+ "process": {
+ "inputs": {
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template-version"
+ },
+ "resource-type": "vnf-type",
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ }
+ },
+ "outputs": {
+ "resource-assignment-params": "success",
+ "status": "status"
+ }
+ }
+ }
+ }
+ },
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": false
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {}
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ResourceAssignment": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-resource-assignment"
+ },
+ "activate-action": {
+ "properties": {
+ "mode": "sync",
+ "version": "LATEST",
+ "is-start-flow": false
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "activate-netconf-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {}
+ },
+ "interfaces": {
+ "CONFIG": {
+ "operations": {
+ "ActivateNetconf": {
+ "inputs": {
+ "params": []
+ }
+ }
+ }
+ }
+ },
+ "type": "dg-activate-netconf"
+ },
+ "base-config-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://base-config-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "rs-db-source",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "input-param": false,
+ "dictionary-name": "sample-db-source",
+ "dictionary-source": "processor-db",
+ "dependencies": [
+ "hostname"
+ ],
+ "version": 0
+ },
+ {
+ "name": "mdsal-source",
+ "property": {
+ "description": "",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "sample-mdsal-source",
+ "dictionary-source": "sdnc",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "hostname",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "hostname",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ },
+ "licence-template": {
+ "capabilities": {
+ "content": {
+ "properties": {
+ "content": "db://licence-template"
+ }
+ },
+ "mapping": {
+ "properties": {
+ "mapping": [
+ {
+ "name": "licenses",
+ "property": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "dt-license-key"
+ }
+ },
+ "input-param": false,
+ "dictionary-name": "sample-licenses",
+ "dictionary-source": "sdnc",
+ "dependencies": [
+ "service-instance-id"
+ ],
+ "version": 0
+ },
+ {
+ "name": "service-instance-id",
+ "property": {
+ "required": true,
+ "type": "string"
+ },
+ "dictionary-name": "service-instance-id",
+ "dictionary-source": "input",
+ "version": 0,
+ "input-param": false
+ }
+ ]
+ }
+ }
+ },
+ "properties": {
+ "action-names": [
+ "resource-assignment-action"
+ ]
+ },
+ "type": "artifact-config-template"
+ }
+ }
+ },
+ "node_types": {
+ },
+ "data_types": {
+ }
+}
-{\r
- "version": "1.0.0",\r
- "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",\r
- "properties": {\r
- "type": {\r
- "required": true,\r
- "type": "string"\r
- },\r
- "description": {\r
- "required": false,\r
- "type": "string"\r
- },\r
- "required": {\r
- "required": false,\r
- "type": "boolean"\r
- },\r
- "default": {\r
- "required": false,\r
- "type": "string"\r
- },\r
- "entry_schema": {\r
- "required": false,\r
- "type": "string"\r
- }\r
- },\r
- "derived_from": "tosca.datatypes.Root"\r
+{
+ "version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
+ "properties": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
+ "required": false,
+ "type": "string"
+ },
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
+ "required": false,
+ "type": "string"
+ },
+ "entry_schema": {
+ "required": false,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
}
\ No newline at end of file
-[\r
- {\r
- "name": "sample-input-source"\r
- },\r
- {\r
- "name": "sample-default-source"\r
- },\r
- {\r
- "name": "sample-db-source"\r
- },\r
- {\r
- "name": "sample-mdsal-source"\r
- }\r
+[
+ {
+ "name": "sample-input-source"
+ },
+ {
+ "name": "sample-default-source"
+ },
+ {
+ "name": "sample-db-source"
+ },
+ {
+ "name": "sample-mdsal-source"
+ }
]
\ No newline at end of file
-{\r
- "name": "ipaddress",\r
- "property": {\r
- "description": "name of the ",\r
- "type": "list",\r
- "entry_schema": {\r
- "type": "dt-v4-aggregate"\r
- }\r
- },\r
- "updated-by": "Brinda Santh (bs2796)",\r
- "tags": "ipaddress",\r
- "sources": {\r
- "input": {\r
- "type": "source-input"\r
- }\r
- }\r
+{
+ "name": "ipaddress",
+ "property": {
+ "description": "name of the ",
+ "type": "list",
+ "entry_schema": {
+ "type": "dt-v4-aggregate"
+ }
+ },
+ "updated-by": "Brinda Santh (bs2796)",
+ "tags": "ipaddress",
+ "sources": {
+ "input": {
+ "type": "source-input"
+ }
+ }
}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright © 2018 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.controllerblueprints.service.repository;
-
-import org.junit.Assert;
-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.controllerblueprints.core.BluePrintConstants;
-import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils;
-import org.onap.ccsdk.cds.controllerblueprints.service.domain.ModelType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
-import org.springframework.test.annotation.Commit;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * ModelTypeReactRepositoryTest.
- *
- * @author Brinda Santh
- */
-
-@RunWith(SpringRunner.class)
-@DataJpaTest
-@ContextConfiguration(classes = {TestApplication.class})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ModelTypeReactRepositoryTest {
-
- @Autowired
- private ModelTypeReactRepository modelTypeReactRepository;
-
- String modelName = "test-datatype";
-
- @Test
- @Commit
- public void test01Save() {
- String content = JacksonUtils.Companion.getClassPathFileContent("model_type/data_type/datatype-property.json");
- ModelType modelType = new ModelType();
- modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- modelType.setDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT);
- modelType.setDescription("Definition for Sample Datatype ");
- modelType.setDefinition(JacksonUtils.Companion.jsonNode(content));
- modelType.setModelName(modelName);
- modelType.setVersion("1.0.0");
- modelType.setTags("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
- modelType.setUpdatedBy("xxxxxx@xxx.com");
-
- ModelType dbModelType = modelTypeReactRepository.save(modelType).block();
- Assert.assertNotNull("Failed to get Saved ModelType", dbModelType);
- }
-
- @Test
- public void test02Finds() {
- ModelType dbFindByModelName = modelTypeReactRepository.findByModelName(modelName).block();
- Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName);
-
- List<ModelType> dbFindByDefinitionType =
- modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block();
- Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType);
- Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType.size() > 0);
-
- List<ModelType> dbFindByDerivedFrom =
- modelTypeReactRepository.findByDerivedFrom(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT).collectList().block();
- Assert.assertNotNull("Failed to find findByDerivedFrom", dbFindByDerivedFrom);
- Assert.assertTrue("Failed to find findByDerivedFrom by count", dbFindByDerivedFrom.size() > 0);
-
- List<ModelType> dbFindByModelNameIn =
- modelTypeReactRepository.findByModelNameIn(Arrays.asList(modelName)).collectList().block();
- Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn);
- Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn.size() > 0);
-
- List<ModelType> dbFindByDefinitionTypeIn =
- modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block();
- Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn);
- Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn.size() > 0);
-
- List<ModelType> dbFindByDerivedFromIn =
- modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block();
- Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn);
- Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn.size() > 0);
- }
-
- @Test
- @Commit
- public void test03Delete() {
- modelTypeReactRepository.deleteByModelName(modelName).block();
- }
-
-}