diff options
62 files changed, 295 insertions, 298 deletions
diff --git a/cps-application/src/test/java/org/onap/cps/architecture/LayeredArchitectureTest.java b/cps-application/src/test/java/org/onap/cps/architecture/LayeredArchitectureTest.java index 91452a7fc5..82fdc7f487 100644 --- a/cps-application/src/test/java/org/onap/cps/architecture/LayeredArchitectureTest.java +++ b/cps-application/src/test/java/org/onap/cps/architecture/LayeredArchitectureTest.java @@ -38,9 +38,9 @@ public class LayeredArchitectureTest { private static final String REST_CONTROLLER_PACKAGE = "org.onap.cps.rest.."; private static final String NCMP_REST_PACKAGE = "org.onap.cps.ncmp.rest.."; private static final String API_SERVICE_PACKAGE = "org.onap.cps.api.."; - private static final String SPI_SERVICE_PACKAGE = "org.onap.cps.spi.."; + private static final String SPI_SERVICE_PACKAGE = "org.onap.cps.ri.."; private static final String NCMP_SERVICE_PACKAGE = "org.onap.cps.ncmp.api.."; - private static final String SPI_REPOSITORY_PACKAGE = "org.onap.cps.spi.repository.."; + private static final String SPI_REPOSITORY_PACKAGE = "org.onap.cps.ri.repository.."; private static final String YANG_SCHEMA_PACKAGE = "org.onap.cps.yang.."; private static final String NOTIFICATION_PACKAGE = "org.onap.cps.notification.."; private static final String CPS_UTILS_PACKAGE = "org.onap.cps.utils.."; diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java index f32008d482..71e7384208 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImpl.java @@ -36,6 +36,7 @@ import lombok.RequiredArgsConstructor; import org.onap.cps.api.CpsDataService; import org.onap.cps.api.CpsQueryService; import org.onap.cps.cpspath.parser.CpsPathUtil; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.ncmp.api.inventory.models.TrustLevel; import org.onap.cps.ncmp.impl.inventory.models.CmHandleState; import org.onap.cps.ncmp.impl.inventory.models.ModelledDmiServiceLeaves; @@ -43,7 +44,6 @@ import org.onap.cps.ncmp.impl.inventory.models.PropertyType; import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelCacheConfig; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.model.DataNode; -import org.onap.cps.spi.utils.CpsValidator; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java index 13cde86b6e..06c3f8d2f4 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImpl.java @@ -37,6 +37,7 @@ import lombok.extern.slf4j.Slf4j; import org.onap.cps.api.CpsAnchorService; import org.onap.cps.api.CpsDataService; import org.onap.cps.api.CpsModuleService; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.ncmp.api.inventory.models.CompositeState; import org.onap.cps.ncmp.api.inventory.models.CompositeStateBuilder; import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle; @@ -47,7 +48,6 @@ import org.onap.cps.spi.exceptions.DataValidationException; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.model.ModuleDefinition; import org.onap.cps.spi.model.ModuleReference; -import org.onap.cps.spi.utils.CpsValidator; import org.onap.cps.utils.ContentType; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.stereotype.Component; diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/NcmpPersistenceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/NcmpPersistenceImpl.java index e44b6ba342..905b09ef74 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/NcmpPersistenceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/NcmpPersistenceImpl.java @@ -29,10 +29,10 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.cps.api.CpsDataService; import org.onap.cps.api.CpsModuleService; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.exceptions.SchemaSetNotFoundException; import org.onap.cps.spi.model.DataNode; -import org.onap.cps.spi.utils.CpsValidator; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.stereotype.Component; diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImplSpec.groovy index cb3c4ffec1..7e34fe2822 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImplSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/CmHandleQueryServiceImplSpec.groovy @@ -23,10 +23,10 @@ package org.onap.cps.ncmp.impl.inventory import org.onap.cps.api.CpsDataService import org.onap.cps.api.CpsQueryService +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.ncmp.api.inventory.models.TrustLevel import org.onap.cps.ncmp.impl.inventory.models.CmHandleState import org.onap.cps.spi.model.DataNode -import org.onap.cps.spi.utils.CpsValidator import spock.lang.Shared import spock.lang.Specification diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy index fdf12a880d..1830f1331d 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/InventoryPersistenceImplSpec.groovy @@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper import org.onap.cps.api.CpsAnchorService import org.onap.cps.api.CpsDataService import org.onap.cps.api.CpsModuleService +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.ncmp.api.inventory.models.CompositeState import org.onap.cps.ncmp.impl.inventory.models.CmHandleState import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle @@ -35,7 +36,6 @@ import org.onap.cps.spi.exceptions.DataNodeNotFoundException import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.ModuleDefinition import org.onap.cps.spi.model.ModuleReference -import org.onap.cps.spi.utils.CpsValidator import org.onap.cps.utils.ContentType import org.onap.cps.utils.JsonObjectMapper import spock.lang.Shared diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java index 13710dbec0..b85b0f9b98 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java @@ -21,24 +21,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl; +package org.onap.cps.ri; import jakarta.transaction.Transactional; import java.util.Collection; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; +import org.onap.cps.ri.repository.AnchorRepository; +import org.onap.cps.ri.repository.DataspaceRepository; +import org.onap.cps.ri.repository.SchemaSetRepository; import org.onap.cps.spi.CpsAdminPersistenceService; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.DataspaceInUseException; import org.onap.cps.spi.model.Anchor; import org.onap.cps.spi.model.Dataspace; -import org.onap.cps.spi.repository.AnchorRepository; -import org.onap.cps.spi.repository.DataspaceRepository; -import org.onap.cps.spi.repository.SchemaSetRepository; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Component; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java index fd47793a7a..ec46fea4cb 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java @@ -21,7 +21,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl; +package org.onap.cps.ri; import static org.onap.cps.spi.PaginationOption.NO_PAGINATION; @@ -48,12 +48,16 @@ import org.hibernate.StaleStateException; import org.onap.cps.cpspath.parser.CpsPathQuery; import org.onap.cps.cpspath.parser.CpsPathUtil; import org.onap.cps.cpspath.parser.PathParsingException; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; +import org.onap.cps.ri.repository.AnchorRepository; +import org.onap.cps.ri.repository.DataspaceRepository; +import org.onap.cps.ri.repository.FragmentRepository; +import org.onap.cps.ri.utils.SessionManager; import org.onap.cps.spi.CpsDataPersistenceService; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.ConcurrencyException; import org.onap.cps.spi.exceptions.CpsAdminException; @@ -62,10 +66,6 @@ import org.onap.cps.spi.exceptions.DataNodeNotFoundException; import org.onap.cps.spi.exceptions.DataNodeNotFoundExceptionBatch; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.model.DataNodeBuilder; -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.utils.SessionManager; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Service; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java index 2c4cc7486b..6f491ba3b7 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java @@ -21,7 +21,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl; +package org.onap.cps.ri; import static com.google.common.base.Preconditions.checkNotNull; @@ -48,21 +48,21 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.hibernate.exception.ConstraintViolationException; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; +import org.onap.cps.ri.models.YangResourceEntity; +import org.onap.cps.ri.models.YangResourceModuleReference; +import org.onap.cps.ri.repository.DataspaceRepository; +import org.onap.cps.ri.repository.ModuleReferenceRepository; +import org.onap.cps.ri.repository.SchemaSetRepository; +import org.onap.cps.ri.repository.YangResourceRepository; import org.onap.cps.spi.CpsModulePersistenceService; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; -import org.onap.cps.spi.entities.YangResourceEntity; -import org.onap.cps.spi.entities.YangResourceModuleReference; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.DuplicatedYangResourceException; import org.onap.cps.spi.exceptions.ModelValidationException; import org.onap.cps.spi.model.ModuleDefinition; import org.onap.cps.spi.model.ModuleReference; import org.onap.cps.spi.model.SchemaSet; -import org.onap.cps.spi.repository.DataspaceRepository; -import org.onap.cps.spi.repository.ModuleReferenceRepository; -import org.onap.cps.spi.repository.SchemaSetRepository; -import org.onap.cps.spi.repository.YangResourceRepository; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier; import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/AnchorEntity.java index ac06b0b5a4..bf9e25daf1 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/AnchorEntity.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/DataspaceEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/DataspaceEntity.java index ddfb09c942..689ae2c000 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/DataspaceEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/DataspaceEntity.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/FragmentEntity.java index c763f61f8f..2c851b60a5 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/FragmentEntity.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/SchemaSetEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/SchemaSetEntity.java index e07f766ed0..e99f79e330 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/SchemaSetEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/SchemaSetEntity.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceEntity.java index 0c54baa4df..2b2d7924db 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceEntity.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceModuleReference.java b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceModuleReference.java index 3c39c6baac..28ef56d38a 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceModuleReference.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceModuleReference.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import org.springframework.beans.factory.annotation.Value; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java index d78a016c2e..7fe14b3173 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.Optional; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; import org.onap.cps.spi.exceptions.AnchorNotFoundException; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/DataspaceRepository.java index b1ce127c4a..b79d802d95 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/DataspaceRepository.java @@ -18,10 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Optional; -import org.onap.cps.spi.entities.DataspaceEntity; +import org.onap.cps.ri.models.DataspaceEntity; import org.onap.cps.spi.exceptions.DataspaceNotFoundException; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepository.java index 2460db869a..6813995d99 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepository.java @@ -18,11 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.FetchDescendantsOption; -import org.onap.cps.spi.entities.FragmentEntity; public interface FragmentPrefetchRepository { Collection<FragmentEntity> prefetchDescendantsOfFragmentEntities( diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepositoryImpl.java index c187f20ea9..bcf01b3d76 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.sql.Connection; import java.util.Collection; @@ -29,9 +29,9 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; import lombok.RequiredArgsConstructor; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.FetchDescendantsOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.FragmentEntity; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.PreparedStatementSetter; import org.springframework.jdbc.core.RowMapper; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentQueryBuilder.java index eb61d56632..b8bbf59c23 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentQueryBuilder.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; @@ -32,12 +32,12 @@ import java.util.Queue; import lombok.RequiredArgsConstructor; import org.onap.cps.cpspath.parser.CpsPathPrefixType; import org.onap.cps.cpspath.parser.CpsPathQuery; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; +import org.onap.cps.ri.utils.EscapeUtils; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; import org.onap.cps.spi.exceptions.CpsPathException; -import org.onap.cps.spi.utils.EscapeUtils; import org.springframework.stereotype.Component; @RequiredArgsConstructor diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java index 1a31d2b499..8edc3f2311 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java @@ -1,140 +1,140 @@ -/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
- * Modifications Copyright (C) 2020-2021 Bell Canada.
- * Modifications Copyright (C) 2020-2021 Pantheon.tech.
- * Modifications Copyright (C) 2023 TechMahindra Ltd.
- * ================================================================================
- * 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.spi.repository;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Optional;
-import org.onap.cps.spi.entities.AnchorEntity;
-import org.onap.cps.spi.entities.DataspaceEntity;
-import org.onap.cps.spi.entities.FragmentEntity;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-import org.onap.cps.spi.utils.EscapeUtils;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>, FragmentRepositoryCpsPathQuery,
- FragmentPrefetchRepository {
-
- Optional<FragmentEntity> findByAnchorAndXpath(AnchorEntity anchorEntity, String xpath);
-
- default FragmentEntity getByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) {
- return findByAnchorAndXpath(anchorEntity, xpath).orElseThrow(() ->
- new DataNodeNotFoundException(anchorEntity.getDataspace().getName(), anchorEntity.getName(), xpath));
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)",
- nativeQuery = true)
- List<FragmentEntity> findByAnchorIdAndXpathIn(@Param("anchorId") long anchorId,
- @Param("xpaths") String[] xpaths);
-
- default List<FragmentEntity> findByAnchorAndXpathIn(final AnchorEntity anchorEntity,
- final Collection<String> xpaths) {
- return findByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0]));
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId \n"
- + "AND xpath LIKE :escapedXpath||'[@%]' AND xpath NOT LIKE :escapedXpath||'[@%]/%[@%]'",
- nativeQuery = true)
- List<FragmentEntity> findListByAnchorIdAndEscapedXpath(@Param("anchorId") long anchorId,
- @Param("escapedXpath") String escapedXpath);
-
- default List<FragmentEntity> findListByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) {
- final String escapedXpath = EscapeUtils.escapeForSqlLike(xpath);
- return findListByAnchorIdAndEscapedXpath(anchorEntity.getId(), escapedXpath);
- }
-
- @Query(value = "SELECT fragment.* FROM fragment JOIN anchor ON anchor.id = fragment.anchor_id "
- + "WHERE dataspace_id = :dataspaceId AND xpath = ANY (:xpaths)", nativeQuery = true)
- List<FragmentEntity> findByDataspaceIdAndXpathIn(@Param("dataspaceId") int dataspaceId,
- @Param("xpaths") String[] xpaths);
-
- default List<FragmentEntity> findByDataspaceAndXpathIn(final DataspaceEntity dataspaceEntity,
- final Collection<String> xpaths) {
- return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths.toArray(new String[0]));
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id IN (:anchorIds)"
- + " AND xpath = ANY (:xpaths)", nativeQuery = true)
- List<FragmentEntity> findByAnchorIdsAndXpathIn(@Param("anchorIds") Long[] anchorIds,
- @Param("xpaths") String[] xpaths);
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId LIMIT 1", nativeQuery = true)
- Optional<FragmentEntity> findOneByAnchorId(@Param("anchorId") long anchorId);
-
- @Modifying
- @Query(value = "DELETE FROM fragment WHERE anchor_id = ANY (:anchorIds)", nativeQuery = true)
- void deleteByAnchorIdIn(@Param("anchorIds") long[] anchorIds);
-
- default void deleteByAnchorIn(final Collection<AnchorEntity> anchorEntities) {
- deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToLong(id -> id).toArray());
- }
-
- @Modifying
- @Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", nativeQuery = true)
- void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") String[] xpaths);
-
- default void deleteByAnchorIdAndXpaths(final long anchorId, final Collection<String> xpaths) {
- deleteByAnchorIdAndXpaths(anchorId, xpaths.toArray(new String[0]));
- }
-
- @Modifying
- @Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE ANY (:xpathPatterns)",
- nativeQuery = true)
- void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") long anchorId,
- @Param("xpathPatterns") String[] xpathPatterns);
-
- default void deleteListsByAnchorIdAndXpaths(long anchorId, Collection<String> xpaths) {
- deleteByAnchorIdAndXpathLikeAny(anchorId,
- xpaths.stream().map(xpath -> EscapeUtils.escapeForSqlLike(xpath) + "[@%").toArray(String[]::new));
- }
-
- @Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)",
- nativeQuery = true)
- List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") long anchorId,
- @Param("xpaths") String[] xpaths);
-
- default List<String> findAllXpathByAnchorAndXpathIn(final AnchorEntity anchorEntity,
- final Collection<String> xpaths) {
- return findAllXpathByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0]));
- }
-
- @Query(value = "SELECT EXISTS(SELECT 1 FROM fragment WHERE anchor_id = :anchorId"
- + " AND xpath LIKE :xpathPattern LIMIT 1)", nativeQuery = true)
- boolean existsByAnchorIdAndParentXpathAndXpathLike(@Param("anchorId") long anchorId,
- @Param("xpathPattern") String xpathPattern);
-
- default boolean existsByAnchorAndXpathStartsWith(final AnchorEntity anchorEntity, final String xpath) {
- return existsByAnchorIdAndParentXpathAndXpathLike(anchorEntity.getId(),
- EscapeUtils.escapeForSqlLike(xpath) + "%");
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND parent_id IS NULL", nativeQuery = true)
- List<FragmentEntity> findRootsByAnchorId(@Param("anchorId") long anchorId);
-
-}
+/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2023 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Bell Canada. + * Modifications Copyright (C) 2020-2021 Pantheon.tech. + * Modifications Copyright (C) 2023 TechMahindra Ltd. + * ================================================================================ + * 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.ri.repository; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; +import org.onap.cps.ri.utils.EscapeUtils; +import org.onap.cps.spi.exceptions.DataNodeNotFoundException; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +@Repository +public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>, FragmentRepositoryCpsPathQuery, + FragmentPrefetchRepository { + + Optional<FragmentEntity> findByAnchorAndXpath(AnchorEntity anchorEntity, String xpath); + + default FragmentEntity getByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) { + return findByAnchorAndXpath(anchorEntity, xpath).orElseThrow(() -> + new DataNodeNotFoundException(anchorEntity.getDataspace().getName(), anchorEntity.getName(), xpath)); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", + nativeQuery = true) + List<FragmentEntity> findByAnchorIdAndXpathIn(@Param("anchorId") long anchorId, + @Param("xpaths") String[] xpaths); + + default List<FragmentEntity> findByAnchorAndXpathIn(final AnchorEntity anchorEntity, + final Collection<String> xpaths) { + return findByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0])); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId \n" + + "AND xpath LIKE :escapedXpath||'[@%]' AND xpath NOT LIKE :escapedXpath||'[@%]/%[@%]'", + nativeQuery = true) + List<FragmentEntity> findListByAnchorIdAndEscapedXpath(@Param("anchorId") long anchorId, + @Param("escapedXpath") String escapedXpath); + + default List<FragmentEntity> findListByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) { + final String escapedXpath = EscapeUtils.escapeForSqlLike(xpath); + return findListByAnchorIdAndEscapedXpath(anchorEntity.getId(), escapedXpath); + } + + @Query(value = "SELECT fragment.* FROM fragment JOIN anchor ON anchor.id = fragment.anchor_id " + + "WHERE dataspace_id = :dataspaceId AND xpath = ANY (:xpaths)", nativeQuery = true) + List<FragmentEntity> findByDataspaceIdAndXpathIn(@Param("dataspaceId") int dataspaceId, + @Param("xpaths") String[] xpaths); + + default List<FragmentEntity> findByDataspaceAndXpathIn(final DataspaceEntity dataspaceEntity, + final Collection<String> xpaths) { + return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths.toArray(new String[0])); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id IN (:anchorIds)" + + " AND xpath = ANY (:xpaths)", nativeQuery = true) + List<FragmentEntity> findByAnchorIdsAndXpathIn(@Param("anchorIds") Long[] anchorIds, + @Param("xpaths") String[] xpaths); + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId LIMIT 1", nativeQuery = true) + Optional<FragmentEntity> findOneByAnchorId(@Param("anchorId") long anchorId); + + @Modifying + @Query(value = "DELETE FROM fragment WHERE anchor_id = ANY (:anchorIds)", nativeQuery = true) + void deleteByAnchorIdIn(@Param("anchorIds") long[] anchorIds); + + default void deleteByAnchorIn(final Collection<AnchorEntity> anchorEntities) { + deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToLong(id -> id).toArray()); + } + + @Modifying + @Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", nativeQuery = true) + void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") String[] xpaths); + + default void deleteByAnchorIdAndXpaths(final long anchorId, final Collection<String> xpaths) { + deleteByAnchorIdAndXpaths(anchorId, xpaths.toArray(new String[0])); + } + + @Modifying + @Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE ANY (:xpathPatterns)", + nativeQuery = true) + void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") long anchorId, + @Param("xpathPatterns") String[] xpathPatterns); + + default void deleteListsByAnchorIdAndXpaths(long anchorId, Collection<String> xpaths) { + deleteByAnchorIdAndXpathLikeAny(anchorId, + xpaths.stream().map(xpath -> EscapeUtils.escapeForSqlLike(xpath) + "[@%").toArray(String[]::new)); + } + + @Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", + nativeQuery = true) + List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") long anchorId, + @Param("xpaths") String[] xpaths); + + default List<String> findAllXpathByAnchorAndXpathIn(final AnchorEntity anchorEntity, + final Collection<String> xpaths) { + return findAllXpathByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0])); + } + + @Query(value = "SELECT EXISTS(SELECT 1 FROM fragment WHERE anchor_id = :anchorId" + + " AND xpath LIKE :xpathPattern LIMIT 1)", nativeQuery = true) + boolean existsByAnchorIdAndParentXpathAndXpathLike(@Param("anchorId") long anchorId, + @Param("xpathPattern") String xpathPattern); + + default boolean existsByAnchorAndXpathStartsWith(final AnchorEntity anchorEntity, final String xpath) { + return existsByAnchorIdAndParentXpathAndXpathLike(anchorEntity.getId(), + EscapeUtils.escapeForSqlLike(xpath) + "%"); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND parent_id IS NULL", nativeQuery = true) + List<FragmentEntity> findRootsByAnchorId(@Param("anchorId") long anchorId); + +} diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQuery.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQuery.java index 9c279618b0..49c8e76ab5 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQuery.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQuery.java @@ -19,14 +19,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.List; import org.onap.cps.cpspath.parser.CpsPathQuery; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; public interface FragmentRepositoryCpsPathQuery { List<FragmentEntity> findByAnchorAndCpsPath(AnchorEntity anchorEntity, CpsPathQuery cpsPathQuery); diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQueryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java index 9c98f7f7d9..01b2813cd3 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQueryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.Query; import jakarta.transaction.Transactional; @@ -27,10 +27,10 @@ import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.cps.cpspath.parser.CpsPathQuery; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; @RequiredArgsConstructor @Slf4j diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceQuery.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceQuery.java index 4082307384..ad0f9c5c61 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceQuery.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceQuery.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.Map; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepository.java index 15ffa372f9..e9b866cc19 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepository.java @@ -18,9 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; -import org.onap.cps.spi.entities.YangResourceEntity; +import org.onap.cps.ri.models.YangResourceEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java index 6cc8234c90..c160fb1e38 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java index 3c5f973cb0..9357a5c6a7 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java @@ -19,13 +19,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.List; import java.util.Optional; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; import org.onap.cps.spi.exceptions.SchemaSetNotFoundException; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepository.java index aacebd63b3..8350d5728c 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepository.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.List; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepositoryImpl.java index c786a62d0c..287bcda01b 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/TempTableCreator.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java index 5804b2dc5d..cc83ab7d94 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/TempTableCreator.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; @@ -31,7 +31,7 @@ import java.util.UUID; import java.util.stream.Collectors; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.onap.cps.spi.utils.EscapeUtils; +import org.onap.cps.ri.utils.EscapeUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepository.java index 9ae32b3e78..ef7b12dc9c 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepository.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.List; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepositoryImpl.java index c84ff427e6..c65ab7d6fa 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java index 8be0d9a33b..9a11592310 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.List; import java.util.Set; -import org.onap.cps.spi.entities.YangResourceEntity; -import org.onap.cps.spi.entities.YangResourceModuleReference; +import org.onap.cps.ri.models.YangResourceEntity; +import org.onap.cps.ri.models.YangResourceModuleReference; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/config/CpsSessionFactory.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsSessionFactory.java index 5241ea0096..c0291176f4 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/config/CpsSessionFactory.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsSessionFactory.java @@ -18,15 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.config; +package org.onap.cps.ri.utils; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; -import org.onap.cps.spi.entities.YangResourceEntity; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; +import org.onap.cps.ri.models.YangResourceEntity; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/utils/CpsValidatorImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsValidatorImpl.java index c727388b25..4f942a37ea 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/utils/CpsValidatorImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsValidatorImpl.java @@ -18,16 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl.utils; +package org.onap.cps.ri.utils; import com.google.common.collect.Lists; import java.util.Arrays; import java.util.Collection; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.PaginationOption; import org.onap.cps.spi.exceptions.DataValidationException; -import org.onap.cps.spi.utils.CpsValidator; import org.springframework.stereotype.Component; @Slf4j diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/EscapeUtils.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/EscapeUtils.java index 2b61d39503..5323ae6bc9 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/utils/EscapeUtils.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/EscapeUtils.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.ri.utils; import lombok.AccessLevel; import lombok.NoArgsConstructor; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/SessionManager.java index 6150bf9dbe..b81a0bd39d 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/SessionManager.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.ri.utils; import com.google.common.util.concurrent.TimeLimiter; import com.google.common.util.concurrent.UncheckedExecutionException; @@ -36,13 +36,12 @@ import lombok.extern.slf4j.Slf4j; import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.Session; -import org.onap.cps.spi.config.CpsSessionFactory; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.repository.AnchorRepository; +import org.onap.cps.ri.repository.DataspaceRepository; import org.onap.cps.spi.exceptions.SessionManagerException; import org.onap.cps.spi.exceptions.SessionTimeoutException; -import org.onap.cps.spi.repository.AnchorRepository; -import org.onap.cps.spi.repository.DataspaceRepository; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/TimeLimiterProvider.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/TimeLimiterProvider.java index 2bd7ac3763..10031c0b28 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/utils/TimeLimiterProvider.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/TimeLimiterProvider.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.ri.utils; import com.google.common.util.concurrent.SimpleTimeLimiter; import com.google.common.util.concurrent.TimeLimiter; diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsDataPersistenceServiceImplSpec.groovy index c72c3046e8..36bf55e2db 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsDataPersistenceServiceImplSpec.groovy @@ -18,29 +18,29 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl +package org.onap.cps.ri import com.fasterxml.jackson.databind.ObjectMapper import org.hibernate.StaleStateException +import org.onap.cps.ri.models.AnchorEntity +import org.onap.cps.ri.models.DataspaceEntity +import org.onap.cps.ri.models.FragmentEntity +import org.onap.cps.ri.repository.AnchorRepository +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.repository.FragmentRepository +import org.onap.cps.ri.utils.SessionManager import org.onap.cps.spi.FetchDescendantsOption -import org.onap.cps.spi.entities.AnchorEntity -import org.onap.cps.spi.entities.DataspaceEntity -import org.onap.cps.spi.entities.FragmentEntity - import org.onap.cps.spi.exceptions.ConcurrencyException import org.onap.cps.spi.exceptions.DataValidationException import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.DataNodeBuilder -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.utils.SessionManager import org.onap.cps.utils.JsonObjectMapper import org.springframework.dao.DataIntegrityViolationException import spock.lang.Specification + import java.util.stream.Collectors -class CpsDataPersistenceServiceSpec extends Specification { +class CpsDataPersistenceServiceImplSpec extends Specification { def mockDataspaceRepository = Mock(DataspaceRepository) def mockAnchorRepository = Mock(AnchorRepository) diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceConcurrencySpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceConcurrencySpec.groovy index 2e4dba2e9b..b892fe4dae 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceConcurrencySpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceConcurrencySpec.groovy @@ -18,19 +18,19 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl +package org.onap.cps.ri import org.hibernate.exception.ConstraintViolationException +import org.onap.cps.ri.models.DataspaceEntity +import org.onap.cps.ri.models.SchemaSetEntity +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.repository.ModuleReferenceRepository +import org.onap.cps.ri.repository.SchemaSetRepository +import org.onap.cps.ri.repository.YangResourceRepository import org.onap.cps.spi.CpsAdminPersistenceService import org.onap.cps.spi.CpsModulePersistenceService -import org.onap.cps.spi.entities.DataspaceEntity -import org.onap.cps.spi.entities.SchemaSetEntity import org.onap.cps.spi.exceptions.DuplicatedYangResourceException import org.onap.cps.spi.model.ModuleReference -import org.onap.cps.spi.repository.DataspaceRepository -import org.onap.cps.spi.repository.ModuleReferenceRepository -import org.onap.cps.spi.repository.SchemaSetRepository -import org.onap.cps.spi.repository.YangResourceRepository import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy index 3447a1c599..1b61ff39c0 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy @@ -17,25 +17,26 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl +package org.onap.cps.ri import org.hibernate.exception.ConstraintViolationException +import org.onap.cps.ri.models.SchemaSetEntity +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.repository.ModuleReferenceRepository +import org.onap.cps.ri.repository.SchemaSetRepository +import org.onap.cps.ri.repository.YangResourceRepository import org.onap.cps.spi.CpsModulePersistenceService -import org.onap.cps.spi.entities.SchemaSetEntity import org.onap.cps.spi.exceptions.DuplicatedYangResourceException import org.onap.cps.spi.model.ModuleReference -import org.onap.cps.spi.repository.DataspaceRepository -import org.onap.cps.spi.repository.ModuleReferenceRepository -import org.onap.cps.spi.repository.SchemaSetRepository -import org.onap.cps.spi.repository.YangResourceRepository import org.springframework.dao.DataIntegrityViolationException import spock.lang.Specification + import java.sql.SQLException /** * Specification unit test class for CPS module persistence service. */ -class CpsModulePersistenceServiceSpec extends Specification { +class CpsModulePersistenceServiceImplSpec extends Specification { CpsModulePersistenceService objectUnderTest diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/CpsValidatorImplSpec.groovy index 8d348443c7..d57bf25058 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/CpsValidatorImplSpec.groovy @@ -18,13 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl.utils +package org.onap.cps.ri.utils + import org.onap.cps.spi.PaginationOption import org.onap.cps.spi.exceptions.DataValidationException import spock.lang.Specification -class CpsValidatorSpec extends Specification { +class CpsValidatorImplSpec extends Specification { def objectUnderTest = new CpsValidatorImpl() diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/EscapeUtilsSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/EscapeUtilsSpec.groovy index 52330e6251..8afd9695a7 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/EscapeUtilsSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/EscapeUtilsSpec.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils +package org.onap.cps.ri.utils import spock.lang.Specification diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/SessionManagerSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/SessionManagerSpec.groovy index feda338b80..b50a20c124 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/SessionManagerSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/SessionManagerSpec.groovy @@ -18,20 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils +package org.onap.cps.ri.utils import com.google.common.util.concurrent.TimeLimiter import com.google.common.util.concurrent.UncheckedExecutionException import org.hibernate.HibernateException +import org.hibernate.Session import org.hibernate.Transaction -import org.onap.cps.spi.config.CpsSessionFactory -import org.onap.cps.spi.entities.AnchorEntity +import org.onap.cps.ri.models.AnchorEntity +import org.onap.cps.ri.repository.AnchorRepository +import org.onap.cps.ri.repository.DataspaceRepository import org.onap.cps.spi.exceptions.SessionManagerException -import org.onap.cps.spi.repository.AnchorRepository -import org.onap.cps.spi.repository.DataspaceRepository import spock.lang.Specification -import org.hibernate.Session -import java.util.concurrent.ExecutionException class SessionManagerSpec extends Specification { diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java index c31e51b174..5ca0fe63d4 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java @@ -23,10 +23,10 @@ package org.onap.cps.api.impl; import java.util.Collection; import lombok.RequiredArgsConstructor; import org.onap.cps.api.CpsAnchorService; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.CpsAdminPersistenceService; import org.onap.cps.spi.CpsDataPersistenceService; import org.onap.cps.spi.model.Anchor; -import org.onap.cps.spi.utils.CpsValidator; import org.springframework.stereotype.Service; @Service diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java index 165d62cede..951770b053 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java @@ -42,6 +42,7 @@ import org.onap.cps.api.CpsDeltaService; import org.onap.cps.cpspath.parser.CpsPathUtil; import org.onap.cps.events.CpsDataUpdateEventsService; import org.onap.cps.events.model.Data.Operation; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.CpsDataPersistenceService; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.exceptions.DataValidationException; @@ -49,7 +50,6 @@ import org.onap.cps.spi.model.Anchor; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.model.DataNodeBuilder; import org.onap.cps.spi.model.DeltaReport; -import org.onap.cps.spi.utils.CpsValidator; import org.onap.cps.utils.ContentType; import org.onap.cps.utils.DataMapUtils; import org.onap.cps.utils.JsonObjectMapper; diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java index a7f5da4874..6bccf2a865 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java @@ -26,9 +26,9 @@ package org.onap.cps.api.impl; import java.util.Collection; import lombok.RequiredArgsConstructor; import org.onap.cps.api.CpsDataspaceService; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.CpsAdminPersistenceService; import org.onap.cps.spi.model.Dataspace; -import org.onap.cps.spi.utils.CpsValidator; import org.springframework.stereotype.Service; @Service diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDeltaServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDeltaServiceImpl.java index 4df3a28145..7819568ae1 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDeltaServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDeltaServiceImpl.java @@ -20,7 +20,6 @@ package org.onap.cps.api.impl; - import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java index 34610f3455..a600b22b61 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java @@ -30,6 +30,7 @@ import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.onap.cps.api.CpsAnchorService; import org.onap.cps.api.CpsModuleService; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.CascadeDeleteAllowed; import org.onap.cps.spi.CpsModulePersistenceService; import org.onap.cps.spi.exceptions.SchemaSetInUseException; @@ -37,7 +38,6 @@ import org.onap.cps.spi.model.Anchor; import org.onap.cps.spi.model.ModuleDefinition; import org.onap.cps.spi.model.ModuleReference; import org.onap.cps.spi.model.SchemaSet; -import org.onap.cps.spi.utils.CpsValidator; import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder; import org.onap.cps.yang.YangTextSchemaSourceSet; import org.springframework.stereotype.Service; diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsQueryServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsQueryServiceImpl.java index 1d7a7ceeb0..d1c98986e6 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsQueryServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsQueryServiceImpl.java @@ -25,11 +25,11 @@ import io.micrometer.core.annotation.Timed; import java.util.Collection; import lombok.RequiredArgsConstructor; import org.onap.cps.api.CpsQueryService; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.CpsDataPersistenceService; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.PaginationOption; import org.onap.cps.spi.model.DataNode; -import org.onap.cps.spi.utils.CpsValidator; import org.springframework.stereotype.Service; @Service diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/YangTextSchemaSourceSetCache.java b/cps-service/src/main/java/org/onap/cps/api/impl/YangTextSchemaSourceSetCache.java index 4fdae5a307..8b85dfca32 100644 --- a/cps-service/src/main/java/org/onap/cps/api/impl/YangTextSchemaSourceSetCache.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/YangTextSchemaSourceSetCache.java @@ -27,8 +27,8 @@ import io.micrometer.core.instrument.Metrics; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import lombok.RequiredArgsConstructor; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.CpsModulePersistenceService; -import org.onap.cps.spi.utils.CpsValidator; import org.onap.cps.yang.YangTextSchemaSourceSet; import org.onap.cps.yang.YangTextSchemaSourceSetBuilder; import org.springframework.cache.annotation.CacheConfig; diff --git a/cps-service/src/main/java/org/onap/cps/spi/utils/CpsValidator.java b/cps-service/src/main/java/org/onap/cps/impl/utils/CpsValidator.java index ceb75c09b2..fd677eb2d2 100644 --- a/cps-service/src/main/java/org/onap/cps/spi/utils/CpsValidator.java +++ b/cps-service/src/main/java/org/onap/cps/impl/utils/CpsValidator.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.impl.utils; import org.onap.cps.spi.PaginationOption; diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy index e58a5024b5..ccf943a470 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy @@ -20,11 +20,11 @@ package org.onap.cps.api.impl +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.spi.CpsAdminPersistenceService import org.onap.cps.spi.CpsDataPersistenceService import org.onap.cps.spi.exceptions.ModuleNamesNotFoundException import org.onap.cps.spi.model.Anchor -import org.onap.cps.spi.utils.CpsValidator import spock.lang.Specification class CpsAnchorServiceImplSpec extends Specification { diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy index a296716b59..9846b30158 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy @@ -23,14 +23,15 @@ package org.onap.cps.api.impl -import com.fasterxml.jackson.databind.ObjectMapper import ch.qos.logback.classic.Level import ch.qos.logback.classic.Logger import ch.qos.logback.core.read.ListAppender +import com.fasterxml.jackson.databind.ObjectMapper import org.onap.cps.TestUtils import org.onap.cps.api.CpsAnchorService import org.onap.cps.api.CpsDeltaService import org.onap.cps.events.CpsDataUpdateEventsService +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.spi.CpsDataPersistenceService import org.onap.cps.spi.FetchDescendantsOption import org.onap.cps.spi.exceptions.ConcurrencyException @@ -40,12 +41,11 @@ import org.onap.cps.spi.exceptions.SessionManagerException import org.onap.cps.spi.exceptions.SessionTimeoutException import org.onap.cps.spi.model.Anchor import org.onap.cps.spi.model.DataNodeBuilder -import org.onap.cps.spi.utils.CpsValidator import org.onap.cps.utils.ContentType -import org.onap.cps.utils.YangParser -import org.onap.cps.utils.YangParserHelper import org.onap.cps.utils.JsonObjectMapper import org.onap.cps.utils.PrefixResolver +import org.onap.cps.utils.YangParser +import org.onap.cps.utils.YangParserHelper import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder import org.onap.cps.yang.YangTextSchemaSourceSet import org.onap.cps.yang.YangTextSchemaSourceSetBuilder @@ -53,6 +53,7 @@ import org.slf4j.LoggerFactory import org.springframework.context.annotation.AnnotationConfigApplicationContext import spock.lang.Shared import spock.lang.Specification + import java.time.OffsetDateTime import static org.onap.cps.events.model.Data.Operation.DELETE diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy index 8e17594bd1..ac7d4c0aa7 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy @@ -20,9 +20,9 @@ package org.onap.cps.api.impl +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.spi.CpsAdminPersistenceService import org.onap.cps.spi.model.Dataspace -import org.onap.cps.spi.utils.CpsValidator import spock.lang.Specification class CpsDataspaceServiceImplSpec extends Specification { diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy index 62eba0c397..1831506563 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy @@ -23,19 +23,15 @@ package org.onap.cps.api.impl -import org.onap.cps.api.CpsAnchorService - -import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED -import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED - import org.onap.cps.TestUtils +import org.onap.cps.api.CpsAnchorService +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.spi.CpsModulePersistenceService import org.onap.cps.spi.exceptions.DuplicatedYangResourceException import org.onap.cps.spi.exceptions.ModelValidationException import org.onap.cps.spi.exceptions.SchemaSetInUseException -import org.onap.cps.spi.model.ModuleDefinition -import org.onap.cps.spi.utils.CpsValidator import org.onap.cps.spi.model.Anchor +import org.onap.cps.spi.model.ModuleDefinition import org.onap.cps.spi.model.ModuleReference import org.onap.cps.spi.model.SchemaSet import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder @@ -43,6 +39,9 @@ import org.onap.cps.yang.YangTextSchemaSourceSet import org.onap.cps.yang.YangTextSchemaSourceSetBuilder import spock.lang.Specification +import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED +import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED + class CpsModuleServiceImplSpec extends Specification { def mockCpsModulePersistenceService = Mock(CpsModulePersistenceService) diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy index 1ad5017919..3b10669ddb 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy @@ -21,10 +21,10 @@ package org.onap.cps.api.impl +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.spi.CpsDataPersistenceService import org.onap.cps.spi.FetchDescendantsOption import org.onap.cps.spi.PaginationOption -import org.onap.cps.spi.utils.CpsValidator import spock.lang.Specification class CpsQueryServiceImplSpec extends Specification { diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy index 9e55e8f10a..05c8983fc2 100755 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy @@ -28,13 +28,13 @@ import org.onap.cps.TestUtils import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDeltaService
import org.onap.cps.events.CpsDataUpdateEventsService
+import org.onap.cps.impl.utils.CpsValidator
import org.onap.cps.spi.CpsDataPersistenceService
import org.onap.cps.spi.CpsModulePersistenceService
import org.onap.cps.spi.model.Anchor
-import org.onap.cps.spi.utils.CpsValidator
+import org.onap.cps.utils.ContentType
import org.onap.cps.utils.JsonObjectMapper
import org.onap.cps.utils.PrefixResolver
-import org.onap.cps.utils.ContentType
import org.onap.cps.utils.YangParser
import org.onap.cps.utils.YangParserHelper
import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/YangTextSchemaSourceSetCacheSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/YangTextSchemaSourceSetCacheSpec.groovy index a9f50ee5b0..189e28521b 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/YangTextSchemaSourceSetCacheSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/YangTextSchemaSourceSetCacheSpec.groovy @@ -22,6 +22,7 @@ package org.onap.cps.api.impl import org.onap.cps.TestUtils +import org.onap.cps.impl.utils.CpsValidator import org.onap.cps.spi.CpsModulePersistenceService import org.onap.cps.yang.YangTextSchemaSourceSet import org.onap.cps.yang.YangTextSchemaSourceSetBuilder @@ -34,8 +35,6 @@ import org.springframework.cache.annotation.EnableCaching import org.springframework.cache.caffeine.CaffeineCacheManager import org.springframework.test.context.ContextConfiguration import spock.lang.Specification -import org.onap.cps.spi.utils.CpsValidator - @SpringBootTest @EnableCaching diff --git a/docs/admin-guide.rst b/docs/admin-guide.rst index 1c4d7455f0..4a40f9b29c 100644 --- a/docs/admin-guide.rst +++ b/docs/admin-guide.rst @@ -111,9 +111,9 @@ Execute CPS service that you want to calculate total elapsed time and log as sho .. code-block:: - 2022-01-28 18:39:17.679 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : DataspaceRepository.getByName() with argument[s] = [test42] having result = org.onap.cps.spi.entities.DataspaceEntity@68ded236 :: 205 ms + 2022-01-28 18:39:17.679 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : DataspaceRepository.getByName() with argument[s] = [test42] having result = org.onap.cps.impl.models.DataspaceEntity@68ded236 :: 205 ms - 2022-01-28 18:39:17.726 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : AnchorRepository.getByDataspaceAndName() with argument[s] = [org.onap.cps.spi.entities.DataspaceEntity@68ded236, bookstore] having result = org.onap.cps.spi.entities.AnchorEntity@71c47fb1 :: 46 ms + 2022-01-28 18:39:17.726 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : AnchorRepository.getByDataspaceAndName() with argument[s] = [org.onap.cps.impl.models.DataspaceEntity@68ded236, bookstore] having result = org.onap.cps.impl.models.AnchorEntity@71c47fb1 :: 46 ms 2022-01-28 18:39:17.768 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService : Execution time of : CpsAdminPersistenceServiceImpl.getAnchor() with argument[s] = [test42, bookstore] having result = Anchor(name=bookstore, dataspaceName=test42, schemaSetName=bookstore) :: 299 ms 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 bd53c4ea13..587cbae619 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 @@ -39,10 +39,10 @@ import org.onap.cps.ncmp.impl.inventory.ParameterizedCmHandleQueryService import org.onap.cps.ncmp.impl.inventory.models.CmHandleState import org.onap.cps.ncmp.impl.inventory.sync.ModuleSyncWatchdog import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.utils.SessionManager 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.utils.SessionManager import org.onap.cps.utils.ContentType import org.onap.cps.utils.JsonObjectMapper import org.springframework.beans.factory.annotation.Autowired @@ -72,7 +72,7 @@ import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY @AutoConfigureMockMvc @EnableJpaRepositories(basePackageClasses = [DataspaceRepository]) @ComponentScan(basePackages = ['org.onap.cps']) -@EntityScan('org.onap.cps.spi.entities') +@EntityScan('org.onap.cps.ri.models') abstract class CpsIntegrationSpecBase extends Specification { @Shared diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/SessionManagerIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/SessionManagerIntegrationSpec.groovy index 428d5f9014..ad153d6a4a 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/SessionManagerIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/SessionManagerIntegrationSpec.groovy @@ -21,8 +21,8 @@ package org.onap.cps.integration.functional.cps import org.onap.cps.integration.base.FunctionalSpecBase +import org.onap.cps.ri.utils.SessionManager import org.onap.cps.spi.exceptions.SessionManagerException -import org.onap.cps.spi.utils.SessionManager class SessionManagerIntegrationSpec extends FunctionalSpecBase { |