2 * Copyright © 2018-2019 AT&T Intellectual Property.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization
19 import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
20 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db.MessagePrioritization
21 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessageAggregateProcessor
22 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessageOutputProcessor
23 import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessagePrioritizeProcessor
24 import org.springframework.boot.autoconfigure.EnableAutoConfiguration
25 import org.springframework.context.annotation.Bean
26 import org.springframework.context.annotation.ComponentScan
27 import org.springframework.context.annotation.Configuration
28 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
29 import org.springframework.stereotype.Service
30 import javax.sql.DataSource
33 @ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db"])
34 @EnableAutoConfiguration
35 open class TestDatabaseConfiguration {
37 @Bean("primaryDBLibGenericService")
38 open fun primaryDBLibGenericService(dataSource: DataSource): PrimaryDBLibGenericService {
39 return PrimaryDBLibGenericService(
40 NamedParameterJdbcTemplate(dataSource)
45 @Service(MessagePrioritizationConstants.PROCESSOR_PRIORITIZE)
46 open class TestMessagePrioritizeProcessor : MessagePrioritizeProcessor() {
48 override fun getGroupCorrelationTypes(messagePrioritization: MessagePrioritization): List<String>? {
49 return when (messagePrioritization.group) {
50 "group-typed" -> arrayListOf("type-0", "type-1", "type-2")
56 @Service(MessagePrioritizationConstants.PROCESSOR_AGGREGATE)
57 open class DefaultMessageAggregateProcessor() : MessageAggregateProcessor()
59 @Service(MessagePrioritizationConstants.PROCESSOR_OUTPUT)
60 open class DefaultMessageOutputProcessor : MessageOutputProcessor()