summaryrefslogtreecommitdiffstats
path: root/integration-test/src
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2024-01-16 08:40:51 +0000
committerToineSiebelink <toine.siebelink@est.tech>2024-01-17 14:56:53 +0000
commit6229cfeafade160ed281fc410454c7498b8a21dc (patch)
tree714247ebb871c00fce2b60fd5f0dcbdcebf1a233 /integration-test/src
parent2dce7ab2fd627450550666e3993e28e10f6a8548 (diff)
Clear instance based Schema Context Cache upon validation errors
- retry yang parser exceptions one time by clearing cache - split yangUtils into YangParserHelper (instance based) and YangUtils for non-parsering static methods - removed public methods only used from test. Refactored to use variation with (empty) parent path - removed use of optional for parentPath, easier to handle with just an empty string! - make methods no longer used in production code in YangUtils are private - udpate testware to use proper public methods instead of private methods of yang utils / parser (helper) Issue-ID:CPS-2000 Signed-off-by: ToineSiebelink <toine.siebelink@est.tech> Change-Id: I0c7590a5e1495d047006e7136f1bd873be37f7b0
Diffstat (limited to 'integration-test/src')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/FunctionalSpecBase.groovy4
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/TestConfig.groovy24
2 files changed, 22 insertions, 6 deletions
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 b10194560a..20687c3ea3 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
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * Copyright (C) 2023-2024 Nordix Foundation
* Modifications Copyright (C) 2022-2023 TechMahindra Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the 'License');
@@ -75,7 +75,7 @@ class FunctionalSpecBase extends CpsIntegrationSpecBase {
def anchorName = 'bookstoreAnchor' + anchorNumber
cpsAnchorService.deleteAnchor(FUNCTIONAL_TEST_DATASPACE_1, anchorName)
cpsAnchorService.createAnchor(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_SCHEMA_SET, anchorName)
- cpsDataService.saveData(FUNCTIONAL_TEST_DATASPACE_1, anchorName, bookstoreJsonData.replace("Easons", "Easons-"+anchorNumber.toString()), OffsetDateTime.now())
+ cpsDataService.saveData(FUNCTIONAL_TEST_DATASPACE_1, anchorName, bookstoreJsonData.replace('Easons', 'Easons-'+anchorNumber.toString()), OffsetDateTime.now())
}
}
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
index e1ccdaa6ee..69c2d17445 100644
--- 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
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2023 Nordix Foundation
+ * 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.
@@ -21,6 +21,7 @@
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
@@ -35,7 +36,8 @@ 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.TimedYangParser
+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
@@ -77,6 +79,15 @@ class TestConfig extends Specification{
@Lazy
SessionManager sessionManager
+ @Autowired
+ @Lazy
+ YangParserHelper yangParserHelper
+
+ @Autowired
+ @Lazy
+ YangTextSchemaSourceSetCache YangTextSchemaSourceSetCache
+
+
@Bean
CpsAdminPersistenceServiceImpl cpsAdminPersistenceService() {
new CpsAdminPersistenceServiceImpl(dataspaceRepository, anchorRepository, schemaSetRepository, yangResourceRepository)
@@ -98,8 +109,13 @@ class TestConfig extends Specification{
}
@Bean
- TimedYangParser timedYangParser() {
- return new TimedYangParser()
+ YangParserHelper yangParserHelper() {
+ return new YangParserHelper()
+ }
+
+ @Bean
+ YangParser yangParser() {
+ return new YangParser(yangParserHelper, yangTextSchemaSourceSetCache)
}
@Bean