aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--integration-test/pom.xml5
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy48
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy2
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/TestConfig.groovy131
-rw-r--r--integration-test/src/test/resources/application.yml94
5 files changed, 104 insertions, 176 deletions
diff --git a/integration-test/pom.xml b/integration-test/pom.xml
index 6947a94aaa..c3a5eee29c 100644
--- a/integration-test/pom.xml
+++ b/integration-test/pom.xml
@@ -78,11 +78,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.springframework.kafka</groupId>
- <artifactId>spring-kafka-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>test</scope>
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
index b59e0ff553..27a9877472 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
@@ -20,64 +20,54 @@
package org.onap.cps.integration.base
+import java.time.OffsetDateTime
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.api.CpsModuleService
import org.onap.cps.api.CpsQueryService
import org.onap.cps.integration.DatabaseTestContainer
-import org.onap.cps.spi.config.CpsSessionFactory
import org.onap.cps.spi.exceptions.DataspaceNotFoundException
import org.onap.cps.spi.model.DataNode
import org.onap.cps.spi.repository.DataspaceRepository
-import org.onap.cps.spi.impl.utils.CpsValidatorImpl
import org.onap.cps.spi.utils.SessionManager
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.domain.EntityScan
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Lazy
import org.springframework.data.jpa.repository.config.EnableJpaRepositories
import org.testcontainers.spock.Testcontainers
import spock.lang.Shared
import spock.lang.Specification
-import java.time.OffsetDateTime
-
-@SpringBootTest(classes = [TestConfig, CpsValidatorImpl, SessionManager, CpsSessionFactory])
+@SpringBootTest(classes = [CpsDataspaceService])
@Testcontainers
@EnableAutoConfiguration
@EnableJpaRepositories(basePackageClasses = [DataspaceRepository])
-@ComponentScan(basePackages = ['org.onap.cps.api', 'org.onap.cps.spi.repository'])
+@ComponentScan(basePackages = ['org.onap.cps'])
@EntityScan('org.onap.cps.spi.entities')
-class CpsIntegrationSpecBase extends Specification {
+abstract class CpsIntegrationSpecBase extends Specification {
@Shared
DatabaseTestContainer databaseTestContainer = DatabaseTestContainer.getInstance()
@Autowired
- @Lazy
CpsDataspaceService cpsDataspaceService
@Autowired
- @Lazy
CpsAnchorService cpsAnchorService
@Autowired
- @Lazy
CpsDataService cpsDataService
@Autowired
- @Lazy
CpsModuleService cpsModuleService
@Autowired
- @Lazy
CpsQueryService cpsQueryService
@Autowired
- @Lazy
SessionManager sessionManager
def static GENERAL_TEST_DATASPACE = 'generalTestDataspace'
@@ -90,7 +80,7 @@ class CpsIntegrationSpecBase extends Specification {
if (!initialized) {
cpsDataspaceService.createDataspace(GENERAL_TEST_DATASPACE)
createStandardBookStoreSchemaSet(GENERAL_TEST_DATASPACE)
- initialized = true;
+ initialized = true
}
}
@@ -127,7 +117,7 @@ class CpsIntegrationSpecBase extends Specification {
def dataspaceExists(dataspaceName) {
try {
cpsDataspaceService.getDataspace(dataspaceName)
- } catch (DataspaceNotFoundException dataspaceNotFoundException) {
+ } catch (DataspaceNotFoundException ignored) {
return false
}
return true
@@ -141,29 +131,15 @@ class CpsIntegrationSpecBase extends Specification {
}
def createJsonArray(name, numberOfElements, keyName, keyValuePrefix, dataPerKey) {
- def json = '{"' + name + '":['
- (1..numberOfElements).each {
- json += '{"' + keyName + '":"' + keyValuePrefix + '-' + it + '"'
- if (!dataPerKey.isEmpty()) {
- json += ',' + dataPerKey
- }
- json += '}'
- if (it < numberOfElements) {
- json += ','
- }
- }
- json += ']}'
+ def innerJson = (1..numberOfElements).collect {
+ '{"' + keyName + '":"' + keyValuePrefix + '-' + it + '"' + (dataPerKey.empty? '': ',' + dataPerKey) + '}'
+ }.join(',')
+ return '{"' + name + '":[' + innerJson + ']}'
}
def createLeafList(name, numberOfElements, valuePrefix) {
- def json = '"' + name + '":['
- (1..numberOfElements).each {
- json += '"' + valuePrefix + '-' + it + '"'
- if (it < numberOfElements) {
- json += ','
- }
- }
- json += ']'
+ def innerJson = (1..numberOfElements).collect {'"' + valuePrefix + '-' + it + '"'}.join(',')
+ return '"' + name + '":[' + innerJson + ']'
}
}
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy
index b3b5842142..6929a2b678 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy
@@ -23,7 +23,7 @@ package org.onap.cps.integration.base
import java.time.OffsetDateTime
-class FunctionalSpecBase extends CpsIntegrationSpecBase {
+abstract class FunctionalSpecBase extends CpsIntegrationSpecBase {
def static FUNCTIONAL_TEST_DATASPACE_1 = 'functionalTestDataspace1'
def static FUNCTIONAL_TEST_DATASPACE_2 = 'functionalTestDataspace2'
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/TestConfig.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/TestConfig.groovy
deleted file mode 100644
index 69c2d17445..0000000000
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/TestConfig.groovy
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2023-2024 Nordix Foundation
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.cps.integration.base
-
-import com.fasterxml.jackson.databind.ObjectMapper
-import org.onap.cps.api.impl.YangTextSchemaSourceSetCache
-import org.onap.cps.spi.CpsDataPersistenceService
-import org.onap.cps.spi.CpsModulePersistenceService
-import org.onap.cps.spi.impl.CpsAdminPersistenceServiceImpl
-import org.onap.cps.spi.impl.CpsDataPersistenceServiceImpl
-import org.onap.cps.spi.impl.CpsModulePersistenceServiceImpl
-import org.onap.cps.spi.repository.AnchorRepository
-import org.onap.cps.spi.repository.DataspaceRepository
-import org.onap.cps.spi.repository.FragmentRepository
-import org.onap.cps.spi.repository.ModuleReferenceRepository
-import org.onap.cps.spi.repository.SchemaSetRepository
-import org.onap.cps.spi.repository.YangResourceRepository
-import org.onap.cps.spi.utils.SessionManager
-import org.onap.cps.spi.utils.TimeLimiterProvider
-import org.onap.cps.utils.JsonObjectMapper
-import org.onap.cps.utils.YangParser
-import org.onap.cps.utils.YangParserHelper
-import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.context.annotation.Lazy
-import spock.lang.Specification
-
-@Configuration
-class TestConfig extends Specification{
- @Autowired
- @Lazy
- DataspaceRepository dataspaceRepository
-
- @Autowired
- @Lazy
- AnchorRepository anchorRepository
-
- @Autowired
- @Lazy
- SchemaSetRepository schemaSetRepository
-
- @Autowired
- @Lazy
- YangResourceRepository yangResourceRepository
-
- @Autowired
- @Lazy
- FragmentRepository fragmentRepository
-
- @Autowired
- @Lazy
- ModuleReferenceRepository moduleReferenceRepository
-
- @Autowired
- @Lazy
- JsonObjectMapper jsonObjectMapper
-
- @Autowired
- @Lazy
- SessionManager sessionManager
-
- @Autowired
- @Lazy
- YangParserHelper yangParserHelper
-
- @Autowired
- @Lazy
- YangTextSchemaSourceSetCache YangTextSchemaSourceSetCache
-
-
- @Bean
- CpsAdminPersistenceServiceImpl cpsAdminPersistenceService() {
- new CpsAdminPersistenceServiceImpl(dataspaceRepository, anchorRepository, schemaSetRepository, yangResourceRepository)
- }
-
- @Bean
- CpsDataPersistenceService cpsDataPersistenceService() {
- return (CpsDataPersistenceService) new CpsDataPersistenceServiceImpl(dataspaceRepository, anchorRepository, fragmentRepository, jsonObjectMapper, sessionManager)
- }
-
- @Bean
- CpsModulePersistenceService cpsModulePersistenceService() {
- return (CpsModulePersistenceService) new CpsModulePersistenceServiceImpl(yangResourceRepository, schemaSetRepository, dataspaceRepository, moduleReferenceRepository)
- }
-
- @Bean
- JsonObjectMapper jsonObjectMapper() {
- return new JsonObjectMapper(new ObjectMapper())
- }
-
- @Bean
- YangParserHelper yangParserHelper() {
- return new YangParserHelper()
- }
-
- @Bean
- YangParser yangParser() {
- return new YangParser(yangParserHelper, yangTextSchemaSourceSetCache)
- }
-
- @Bean
- TimedYangTextSchemaSourceSetBuilder textSchemaSourceSetBuilder() {
- return new TimedYangTextSchemaSourceSetBuilder()
- }
-
- @Bean
- TimeLimiterProvider timeLimiterProvider() {
- return new TimeLimiterProvider()
- }
-
-}
diff --git a/integration-test/src/test/resources/application.yml b/integration-test/src/test/resources/application.yml
index dbff207dde..1a08e542b6 100644
--- a/integration-test/src/test/resources/application.yml
+++ b/integration-test/src/test/resources/application.yml
@@ -15,14 +15,24 @@
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
+rest:
+ api:
+ cps-base-path: /cps/api
+ ncmp-base-path: /ncmp
+ ncmp-inventory-base-path: /ncmpInventory
+
spring:
+ main:
+ banner-mode: off
+
+ application:
+ name: cps-integration-test
+
jpa:
- ddl-auto: create
- show-sql: false
properties:
hibernate.enable_lazy_load_no_trans: true
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
- hibernate.format_sql: true
+ hibernate.format_sql: false
hibernate.show_sql: false
# Please ensure these values match those used in cps-application/src/main/resources/application.yml
hibernate.id.new_generator_mappings: true
@@ -34,6 +44,84 @@ spring:
password: ${DB_PASSWORD}
driverClassName: org.postgresql.Driver
initialization-mode: always
+ hikari:
+ minimumIdle: 5
+ maximumPoolSize: 80
+ idleTimeout: 60000
+ connectionTimeout: 120000
+ leakDetectionThreshold: 30000
+ pool-name: CpsDatabasePool
+
+ cache:
+ type: caffeine
+ cache-names: yangSchema
+ caffeine:
+ spec: maximumSize=10000,expireAfterAccess=10m
liquibase:
change-log: classpath:changelog/changelog-master.yaml
+
+ servlet:
+ multipart:
+ enabled: true
+ max-file-size: 100MB
+ max-request-size: 100MB
+
+ jackson:
+ default-property-inclusion: NON_NULL
+ serialization:
+ FAIL_ON_EMPTY_BEANS: false
+
+ sql:
+ init:
+ mode: ALWAYS
+
+notification:
+ enabled: false
+
+springdoc:
+ swagger-ui:
+ disable-swagger-default-url: true
+ urlsPrimaryName: cps-core
+ urls:
+ - name: cps-core
+ url: /api-docs/cps-core/openapi.yaml
+ - name: cps-ncmp
+ url: /api-docs/cps-ncmp/openapi.yaml
+ - name: cps-ncmp-inventory
+ url: /api-docs/cps-ncmp/openapi-inventory.yaml
+
+security:
+ # comma-separated uri patterns which do not require authorization
+ permit-uri: /actuator/**,/swagger-ui.html,/swagger-ui/**,/swagger-resources/**,/api-docs/**,/v3/api-docs/**
+ auth:
+ username: cps
+ password: cpsr0cks!
+
+# Actuator
+management:
+ endpoints:
+ web:
+ exposure:
+ include: info,health,loggers,prometheus
+ endpoint:
+ health:
+ show-details: always
+ # kubernetes probes: liveness and readiness
+ probes:
+ enabled: false
+
+logging:
+ format: text
+ level:
+ org:
+ springframework: INFO
+ onap:
+ cps: INFO
+
+hazelcast:
+ cluster-name: cps-and-ncmp-test-caches
+ mode:
+ kubernetes:
+ enabled: false
+ service-name: cps-and-ncmp-service