classes().that().resideInAPackage("org.onap.cps.rest..").should().onlyDependOnClassesThat()
.resideInAnyPackage(commonAndListedPackages("org.onap.cps.rest..",
"org.onap.cps.api..",
- "org.onap.cps.utils..",
- // Breaks arch rules
- "org.onap.cps.spi.."));
+ "org.onap.cps.utils.."));
@ArchTest
static final ArchRule cpsServiceApiShouldNotDependOnAnything =
.onlyDependOnClassesThat()
.resideInAnyPackage(commonAndListedPackages("org.onap.cps.ncmp.api..",
"org.onap.cps.ncmp.rest..",
+ "org.onap.cps.api..",
// Below packages are breaking the agreed dependencies
// and need to be removed from this rule.
// This will be handled in a separate user story
- "org.onap.cps.spi..",
"org.onap.cps.utils..",
"org.onap.cps.ncmp.impl.."));
@ArchTest
static final ArchRule ncmpServiceApiShouldOnlyDependOnThirdPartyPackages =
classes().that().resideInAPackage("org.onap.cps.ncmp.api..").should().onlyDependOnClassesThat()
- .resideInAnyPackage(commonAndListedPackages(// Below packages are breaking the agreed dependencies
+ .resideInAnyPackage(commonAndListedPackages("org.onap.cps.api..",
+ // Below packages are breaking the agreed dependencies
// and need to be removed from this rule.
// This will be handled in a separate user story
"org.onap.cps.ncmp.api..",
"org.onap.cps.ncmp.impl..",
"org.onap.cps.ncmp.config",
- "org.onap.cps.spi..",
"org.onap.cps.utils.."));
@ArchTest
"org.onap.cps.ncmp.utils..",
"org.onap.cps.ncmp.config..",
"org.onap.cps.ncmp.exceptions..",
+ "org.onap.cps.spi.api..",
// Below packages are breaking the agreed dependencies
// and need to be removed from this rule.
// This will be handled in a separate user story
"org.onap.cps.cpspath..",
"org.onap.cps.events..",
"org.onap.cps.impl..",
- "org.onap.cps.spi..",
"org.onap.cps.utils.."));
}
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.ModuleDefinition;
import org.onap.cps.ncmp.api.data.exceptions.InvalidDatastoreException;
import org.onap.cps.ncmp.api.data.models.CmResourceAddress;
import org.onap.cps.ncmp.api.data.models.DatastoreType;
import org.onap.cps.ncmp.rest.util.DataOperationRequestMapper;
import org.onap.cps.ncmp.rest.util.DeprecationHelper;
import org.onap.cps.ncmp.rest.util.NcmpRestInputMapper;
-import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.spi.model.ModuleDefinition;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.exceptions.CpsException;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.ncmp.api.data.exceptions.InvalidDatastoreException;
import org.onap.cps.ncmp.api.data.exceptions.InvalidOperationException;
import org.onap.cps.ncmp.api.data.exceptions.OperationNotSupportedException;
import org.onap.cps.ncmp.rest.model.DmiErrorMessage;
import org.onap.cps.ncmp.rest.model.DmiErrorMessageDmiResponse;
import org.onap.cps.ncmp.rest.model.ErrorMessage;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.exceptions.CpsException;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-import org.onap.cps.spi.exceptions.DataValidationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters;
import org.onap.cps.ncmp.api.inventory.models.DmiPluginRegistration;
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
import org.onap.cps.ncmp.rest.model.RestInputCmHandle;
import org.onap.cps.ncmp.rest.model.RestModuleDefinition;
import org.onap.cps.ncmp.rest.model.RestModuleReference;
-import org.onap.cps.spi.model.ModuleDefinition;
-import org.onap.cps.spi.model.ModuleReference;
@Mapper(componentModel = "spring")
public interface NcmpRestInputMapper {
import org.onap.cps.ncmp.rest.util.DataOperationRequestMapper
import org.onap.cps.ncmp.rest.util.DeprecationHelper
import org.onap.cps.ncmp.rest.util.NcmpRestInputMapper
-import org.onap.cps.spi.model.ModuleDefinition
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.model.ModuleDefinition
+import org.onap.cps.api.model.ModuleReference
import org.onap.cps.utils.JsonObjectMapper
import org.slf4j.LoggerFactory
import org.spockframework.spring.SpringBean
import org.onap.cps.ncmp.rest.util.DataOperationRequestMapper
import org.onap.cps.ncmp.rest.util.DeprecationHelper
import org.onap.cps.ncmp.rest.util.NcmpRestInputMapper
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.CpsException
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.CpsException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataValidationException
import org.onap.cps.utils.JsonObjectMapper
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.onap.cps.ncmp.rest.model.RestInputCmHandle
import org.onap.cps.ncmp.rest.model.RestModuleDefinition
import org.onap.cps.ncmp.rest.model.RestModuleReference
-import org.onap.cps.spi.model.ModuleDefinition
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.model.ModuleDefinition
+import org.onap.cps.api.model.ModuleReference
import spock.lang.Specification
class NcmpRestInputMapperSpec extends Specification {
import java.util.Collections;
import java.util.Map;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException;
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryApiParameters;
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters;
import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager;
import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
-import org.onap.cps.spi.model.ModuleDefinition;
-import org.onap.cps.spi.model.ModuleReference;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.stereotype.Service;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
-import org.onap.cps.spi.model.ConditionProperties;
+import org.onap.cps.api.model.ConditionProperties;
@Setter
@Getter
package org.onap.cps.ncmp.api.inventory.models;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.api.inventory.models.CompositeState.DataStores;
import org.onap.cps.ncmp.api.inventory.models.CompositeState.LockReason;
import org.onap.cps.ncmp.api.inventory.models.CompositeState.Operational;
import org.onap.cps.ncmp.impl.inventory.DataStoreSyncState;
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState;
import org.onap.cps.ncmp.impl.inventory.models.LockReasonCategory;
-import org.onap.cps.spi.model.DataNode;
public class CompositeStateBuilder {
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.Dataspace;
import org.springframework.beans.factory.annotation.Value;
/**
private Config defineInstanceConfig(final String instanceConfigName, final NamedConfig namedConfig) {
final Config config = getHazelcastInstanceConfig(instanceConfigName);
config.setClusterName(clusterName);
- config.setClassLoader(org.onap.cps.spi.model.Dataspace.class.getClassLoader());
+ config.setClassLoader(Dataspace.class.getClassLoader());
configureDataStructures(namedConfig, config);
exposeClusterInformation(config);
updateDiscoveryMode(config);
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.impl.cmnotificationsubscription.cache.DmiCacheHandler;
import org.onap.cps.ncmp.impl.cmnotificationsubscription.dmi.DmiCmSubscriptionDetailsPerDmiMapper;
import org.onap.cps.ncmp.impl.cmnotificationsubscription.dmi.DmiInEventMapper;
import org.onap.cps.ncmp.impl.cmnotificationsubscription_1_0_0.ncmp_to_client.NcmpOutEvent;
import org.onap.cps.ncmp.impl.cmnotificationsubscription_1_0_0.ncmp_to_dmi.DmiInEvent;
import org.onap.cps.ncmp.impl.inventory.InventoryPersistence;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.stereotype.Service;
@Service
package org.onap.cps.ncmp.impl.cmnotificationsubscription.utils;
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY;
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS;
import java.io.Serializable;
import java.time.OffsetDateTime;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsQueryService;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.api.data.models.DatastoreType;
-import org.onap.cps.spi.model.DataNode;
import org.onap.cps.utils.ContentType;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.stereotype.Service;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.exceptions.CpsException;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.ncmp.api.NcmpResponseStatus;
import org.onap.cps.ncmp.api.data.models.CmResourceAddress;
import org.onap.cps.ncmp.api.data.models.DataOperationRequest;
import org.onap.cps.ncmp.impl.models.DmiRequestBody;
import org.onap.cps.ncmp.impl.utils.http.RestServiceUrlTemplateBuilder;
import org.onap.cps.ncmp.impl.utils.http.UrlTemplateParameters;
-import org.onap.cps.spi.exceptions.CpsException;
-import org.onap.cps.spi.exceptions.DataValidationException;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsDataService;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.ncmp.api.data.models.CmResourceAddress;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.api.data.models.CmResourceAddress;
import org.onap.cps.ncmp.api.data.models.DataOperationRequest;
import org.onap.cps.ncmp.api.data.models.DatastoreType;
import org.onap.cps.ncmp.api.data.models.OperationType;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.stereotype.Service;
@Service
package org.onap.cps.ncmp.impl.data;
import java.util.Collection;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
/*
* Datastore interface for handling cached CPS data query requests.
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.api.CpsQueryService;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.springframework.stereotype.Service;
@Slf4j
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
import org.springframework.stereotype.Service;
@Service
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters;
-import org.onap.cps.spi.exceptions.DataValidationException;
@Slf4j
@NoArgsConstructor(access = AccessLevel.PRIVATE)
import java.util.Collection;
import java.util.Map;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
public interface CmHandleQueryService {
package org.onap.cps.ncmp.impl.inventory;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT;
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
import java.util.Collection;
import java.util.Collections;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsQueryService;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
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.ModelledDmiServiceLeaves;
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.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.onap.cps.api.CpsDataService;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.exceptions.CpsException;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.ncmp.api.inventory.models.CmHandleRegistrationResponse;
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.sync.ModuleOperationsUtils;
import org.onap.cps.ncmp.impl.inventory.sync.lcm.LcmEventsCmHandleStateHandler;
import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.exceptions.CpsException;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-import org.onap.cps.spi.exceptions.DataValidationException;
import org.springframework.stereotype.Service;
@Slf4j
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.onap.cps.api.CpsDataService;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
+import org.onap.cps.api.exceptions.DataValidationException;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DataNodeBuilder;
import org.onap.cps.ncmp.api.inventory.models.CmHandleRegistrationResponse;
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-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.utils.ContentType;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
import org.onap.cps.ncmp.api.inventory.models.CompositeState;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
-import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.spi.model.ModuleDefinition;
-import org.onap.cps.spi.model.ModuleReference;
public interface InventoryPersistence extends NcmpPersistence {
package org.onap.cps.ncmp.impl.inventory;
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS;
import com.google.common.collect.Lists;
import java.time.OffsetDateTime;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
+import org.onap.cps.api.exceptions.DataValidationException;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.impl.utils.CpsValidator;
import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException;
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;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-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.utils.ContentType;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.stereotype.Component;
import java.time.OffsetDateTime;
import java.util.Collection;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
/**
* DmiRegistryConstants class to be strictly used for DMI Related constants only.
package org.onap.cps.ncmp.impl.inventory;
-import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED;
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+import static org.onap.cps.api.parameters.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
import io.micrometer.core.annotation.Timed;
import java.util.Collection;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.exceptions.SchemaSetNotFoundException;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
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.utils.JsonObjectMapper;
import org.springframework.stereotype.Component;
package org.onap.cps.ncmp.impl.inventory;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY;
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS;
import static org.onap.cps.ncmp.impl.inventory.CmHandleQueryParametersValidator.validateCpsPathConditionProperties;
import static org.onap.cps.ncmp.impl.inventory.CmHandleQueryParametersValidator.validateModuleNameConditionProperties;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT;
import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.WITH_CPS_PATH;
import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.WITH_TRUST_LEVEL;
import static org.onap.cps.ncmp.impl.utils.YangDataConverter.toNcmpServiceCmHandle;
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY;
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS;
import java.util.ArrayList;
import java.util.Collection;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.exceptions.DataValidationException;
+import org.onap.cps.api.model.ConditionProperties;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.cpspath.parser.PathParsingException;
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters;
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
import org.onap.cps.ncmp.impl.inventory.models.PropertyType;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
-import org.onap.cps.spi.exceptions.DataValidationException;
-import org.onap.cps.spi.model.ConditionProperties;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.stereotype.Service;
@Service
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.model.ModuleReference;
import org.onap.cps.ncmp.api.inventory.models.YangResource;
import org.onap.cps.ncmp.impl.dmi.DmiProperties;
import org.onap.cps.ncmp.impl.dmi.DmiRestClient;
import org.onap.cps.ncmp.impl.models.DmiRequestBody;
import org.onap.cps.ncmp.impl.utils.http.RestServiceUrlTemplateBuilder;
import org.onap.cps.ncmp.impl.utils.http.UrlTemplateParameters;
-import org.onap.cps.spi.model.ModuleReference;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.regex.Pattern;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.ncmp.api.inventory.models.CompositeState;
import org.onap.cps.ncmp.impl.data.DmiDataOperations;
import org.onap.cps.ncmp.impl.inventory.CmHandleQueryService;
import org.onap.cps.ncmp.impl.inventory.models.LockReasonCategory;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.exceptions.SchemaSetNotFoundException;
+import org.onap.cps.api.model.ModuleReference;
+import org.onap.cps.api.parameters.CascadeDeleteAllowed;
import org.onap.cps.ncmp.api.exceptions.NcmpException;
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
-import org.onap.cps.spi.CascadeDeleteAllowed;
-import org.onap.cps.spi.exceptions.SchemaSetNotFoundException;
-import org.onap.cps.spi.model.ModuleReference;
import org.onap.cps.utils.ContentType;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.stereotype.Service;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.api.inventory.models.CompositeState;
import org.onap.cps.ncmp.impl.inventory.InventoryPersistence;
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.inventory.sync.lcm.LcmEventsCmHandleStateHandler;
import org.onap.cps.ncmp.impl.utils.YangDataConverter;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
import org.onap.cps.ncmp.impl.utils.Sleeper;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.locks.Lock;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.impl.cache.HazelcastCacheConfig;
-import org.onap.cps.spi.model.DataNode;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.ncmp.api.inventory.models.CompositeState;
import org.onap.cps.ncmp.api.inventory.models.CompositeStateBuilder;
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
-import org.onap.cps.spi.model.DataNode;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@Slf4j
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsDataspaceService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.parameters.CascadeDeleteAllowed;
import org.onap.cps.ncmp.exceptions.NcmpStartUpException;
-import org.onap.cps.spi.CascadeDeleteAllowed;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
import org.onap.cps.utils.JsonObjectMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsDataspaceService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
import org.onap.cps.ncmp.api.data.models.DatastoreType;
import org.onap.cps.ncmp.exceptions.NcmpStartUpException;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
import org.springframework.stereotype.Service;
@Slf4j
import org.onap.cps.ncmp.impl.inventory.DataStoreSyncState
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState
import org.onap.cps.ncmp.impl.inventory.models.LockReasonCategory
-import org.onap.cps.spi.model.DataNode
-import org.onap.cps.spi.model.DataNodeBuilder
+import org.onap.cps.api.model.DataNode
+import org.onap.cps.api.model.DataNodeBuilder
import spock.lang.Specification
import java.time.OffsetDateTime
import org.onap.cps.ncmp.impl.inventory.InventoryPersistence
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.utils.TestUtils
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Specification
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsQueryService
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Specification
import static CmSubscriptionPersistenceService.CPS_PATH_QUERY_FOR_CM_SUBSCRIPTION_WITH_ID
import static org.onap.cps.ncmp.api.data.models.DatastoreType.PASSTHROUGH_OPERATIONAL
import static org.onap.cps.ncmp.api.data.models.DatastoreType.PASSTHROUGH_RUNNING
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class CmSubscriptionPersistenceServiceSpec extends Specification {
import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher
import org.onap.cps.ncmp.impl.utils.http.UrlTemplateParameters
import org.onap.cps.ncmp.utils.TestUtils
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataValidationException
import org.onap.cps.utils.JsonObjectMapper
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
package org.onap.cps.ncmp.impl.data
import org.onap.cps.api.CpsDataService
-import org.onap.cps.events.EventsPublisher
import org.onap.cps.ncmp.api.data.models.CmResourceAddress
import org.onap.cps.ncmp.config.CpsApplicationContext
-import org.onap.cps.ncmp.impl.dmi.DmiProperties
import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import org.spockframework.spring.SpringBean
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.ApplicationContext
import reactor.core.publisher.Mono
import spock.lang.Specification
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
@SpringBootTest
@ContextConfiguration(classes = [CpsApplicationContext])
import org.onap.cps.ncmp.api.data.models.CmResourceAddress
import org.onap.cps.ncmp.api.data.models.DataOperationRequest
-import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import reactor.core.publisher.Mono
import spock.lang.Specification
package org.onap.cps.ncmp.impl.data
import org.onap.cps.api.CpsQueryService
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.model.DataNode
import spock.lang.Specification
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
import spock.lang.Specification
class AlternateIdCheckerSpec extends Specification {
package org.onap.cps.ncmp.impl.inventory
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters
-import org.onap.cps.spi.exceptions.DataValidationException
-import org.onap.cps.spi.model.ConditionProperties
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.model.ConditionProperties
import spock.lang.Specification
class CmHandleQueryParametersValidatorSpec extends Specification {
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.api.model.DataNode
import spock.lang.Shared
import spock.lang.Specification
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class CmHandleQueryServiceImplSpec extends Specification {
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.cps.api.CpsDataService
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-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.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.model.DataNode
+import org.onap.cps.api.model.DataNodeBuilder
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.JsonObjectMapper
import org.slf4j.LoggerFactory
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.inventory.sync.lcm.LcmEventsCmHandleStateHandler
import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.CpsException
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.exceptions.DataValidationException
-import org.onap.cps.spi.exceptions.SchemaSetNotFoundException
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.CpsException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.SchemaSetNotFoundException
import spock.lang.Specification
import static org.onap.cps.ncmp.api.NcmpResponseStatus.CM_HANDLES_NOT_FOUND
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.utils.YangDataConverter
-import org.onap.cps.spi.CascadeDeleteAllowed
-import org.onap.cps.spi.FetchDescendantsOption
-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.api.parameters.CascadeDeleteAllowed
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.model.DataNode
+import org.onap.cps.api.model.ModuleDefinition
+import org.onap.cps.api.model.ModuleReference
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Shared
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NO_TIMESTAMP
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class InventoryPersistenceImplSpec extends Specification {
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager
import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher
-import org.onap.cps.spi.model.ConditionProperties
+import org.onap.cps.api.model.ConditionProperties
import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Specification
import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters
import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.exceptions.DataInUseException
-import org.onap.cps.spi.exceptions.DataValidationException
-import org.onap.cps.spi.model.ConditionProperties
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.exceptions.DataInUseException
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.model.ConditionProperties
+import org.onap.cps.api.model.DataNode
import spock.lang.Specification
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT
import org.onap.cps.ncmp.impl.dmi.DmiOperationsBaseSpec
import org.onap.cps.ncmp.impl.dmi.DmiProperties
import org.onap.cps.ncmp.impl.utils.http.UrlTemplateParameters
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.model.ModuleReference
import org.onap.cps.utils.JsonObjectMapper
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.onap.cps.ncmp.impl.inventory.CmHandleQueryService
import org.onap.cps.ncmp.impl.inventory.DataStoreSyncState
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.model.DataNode
import org.onap.cps.utils.JsonObjectMapper
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.inventory.sync.ModuleSyncService.ModuleDelta
-import org.onap.cps.spi.CascadeDeleteAllowed
-import org.onap.cps.spi.exceptions.SchemaSetNotFoundException
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.parameters.CascadeDeleteAllowed
+import org.onap.cps.api.exceptions.SchemaSetNotFoundException
+import org.onap.cps.api.model.ModuleReference
import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Specification
import org.onap.cps.ncmp.impl.inventory.models.CmHandleState
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.inventory.sync.lcm.LcmEventsCmHandleStateHandler
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.model.DataNode
import org.slf4j.LoggerFactory
import spock.lang.Ignore
import spock.lang.Specification
import com.hazelcast.map.IMap
import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle
import org.onap.cps.ncmp.impl.utils.Sleeper
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import spock.lang.Specification
import java.util.concurrent.ArrayBlockingQueue
import com.hazelcast.config.Config
import com.hazelcast.core.Hazelcast
import com.hazelcast.map.IMap
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ContextConfiguration
package org.onap.cps.ncmp.impl.utils
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import spock.lang.Specification
class YangDataConverterSpec extends Specification{
import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.api.CpsModuleService
import org.onap.cps.ncmp.exceptions.NcmpStartUpException
-import org.onap.cps.spi.CascadeDeleteAllowed
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
+import org.onap.cps.api.parameters.CascadeDeleteAllowed
+import org.onap.cps.api.exceptions.AlreadyDefinedException
import org.slf4j.LoggerFactory
import org.springframework.boot.SpringApplication
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.api.CpsModuleService
import org.onap.cps.ncmp.exceptions.NcmpStartUpException
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.model.Dataspace
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.model.Dataspace
import org.slf4j.LoggerFactory
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.api.CpsModuleService
-import org.onap.cps.spi.model.Dataspace
+import org.onap.cps.api.model.Dataspace
import org.slf4j.LoggerFactory
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.springframework.context.annotation.AnnotationConfigApplicationContext
package org.onap.cps.rest.controller;
+import static org.onap.cps.api.parameters.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED;
import static org.onap.cps.rest.utils.MultipartFileUtil.extractYangResourcesMap;
-import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED;
import io.micrometer.core.annotation.Timed;
import jakarta.validation.Valid;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataspaceService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.Dataspace;
+import org.onap.cps.api.model.SchemaSet;
import org.onap.cps.rest.api.CpsAdminApi;
import org.onap.cps.rest.model.AnchorDetails;
import org.onap.cps.rest.model.DataspaceDetails;
import org.onap.cps.rest.model.SchemaSetDetails;
-import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.Dataspace;
-import org.onap.cps.spi.model.SchemaSet;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.mapstruct.Mapping;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.Dataspace;
+import org.onap.cps.api.model.SchemaSet;
import org.onap.cps.rest.model.AnchorDetails;
import org.onap.cps.rest.model.DataspaceDetails;
import org.onap.cps.rest.model.SchemaSetDetails;
-import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.Dataspace;
-import org.onap.cps.spi.model.SchemaSet;
@Mapper(componentModel = "spring")
public interface CpsRestInputMapper {
import org.apache.commons.lang3.StringUtils;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DeltaReport;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.rest.api.CpsDataApi;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.spi.model.DeltaReport;
import org.onap.cps.utils.ContentType;
import org.onap.cps.utils.DataMapUtils;
import org.onap.cps.utils.JsonObjectMapper;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsQueryService;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
+import org.onap.cps.api.parameters.PaginationOption;
import org.onap.cps.rest.api.CpsQueryApi;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.PaginationOption;
-import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.DataNode;
import org.onap.cps.utils.ContentType;
import org.onap.cps.utils.DataMapUtils;
import org.onap.cps.utils.JsonObjectMapper;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.exceptions.CpsAdminException;
+import org.onap.cps.api.exceptions.CpsException;
+import org.onap.cps.api.exceptions.CpsPathException;
+import org.onap.cps.api.exceptions.DataInUseException;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
+import org.onap.cps.api.exceptions.DataValidationException;
+import org.onap.cps.api.exceptions.ModelValidationException;
+import org.onap.cps.api.exceptions.NotFoundInDataspaceException;
import org.onap.cps.rest.controller.AdminRestController;
import org.onap.cps.rest.controller.DataRestController;
import org.onap.cps.rest.controller.QueryRestController;
import org.onap.cps.rest.model.ErrorMessage;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.exceptions.CpsAdminException;
-import org.onap.cps.spi.exceptions.CpsException;
-import org.onap.cps.spi.exceptions.CpsPathException;
-import org.onap.cps.spi.exceptions.DataInUseException;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-import org.onap.cps.spi.exceptions.DataValidationException;
-import org.onap.cps.spi.exceptions.ModelValidationException;
-import org.onap.cps.spi.exceptions.NotFoundInDataspaceException;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.util.zip.ZipInputStream;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.onap.cps.spi.exceptions.CpsException;
-import org.onap.cps.spi.exceptions.ModelValidationException;
+import org.onap.cps.api.exceptions.CpsException;
+import org.onap.cps.api.exceptions.ModelValidationException;
import org.springframework.web.multipart.MultipartFile;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
import lombok.Getter;
import lombok.Setter;
-import org.onap.cps.spi.exceptions.ModelValidationException;
+import org.onap.cps.api.exceptions.ModelValidationException;
@Setter
@Getter
import org.onap.cps.api.CpsAnchorService
-import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED
+import static org.onap.cps.api.parameters.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart
import org.mapstruct.factory.Mappers
import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.api.CpsModuleService
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.SchemaSetInUseException
-import org.onap.cps.spi.model.Anchor
-import org.onap.cps.spi.model.Dataspace
-import org.onap.cps.spi.model.SchemaSet
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.SchemaSetInUseException
+import org.onap.cps.api.model.Anchor
+import org.onap.cps.api.model.Dataspace
+import org.onap.cps.api.model.SchemaSet
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.mapstruct.factory.Mappers
import org.onap.cps.rest.model.AnchorDetails
import org.onap.cps.rest.model.SchemaSetDetails
-import org.onap.cps.spi.model.Anchor
+import org.onap.cps.api.model.Anchor
import org.onap.cps.rest.model.ModuleReferences
-import org.onap.cps.spi.model.ModuleReference
-import org.onap.cps.spi.model.SchemaSet
+import org.onap.cps.api.model.ModuleReference
+import org.onap.cps.api.model.SchemaSet
import spock.lang.Specification
class CpsRestInputMapperSpec extends Specification {
import groovy.json.JsonSlurper
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDataService
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.model.DataNode
-import org.onap.cps.spi.model.DataNodeBuilder
-import org.onap.cps.spi.model.DeltaReportBuilder
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.model.DataNode
+import org.onap.cps.api.model.DataNodeBuilder
+import org.onap.cps.api.model.DeltaReportBuilder
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.DateTimeUtility
import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Shared
import spock.lang.Specification
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsQueryService
-import org.onap.cps.spi.PaginationOption
-import org.onap.cps.spi.model.DataNodeBuilder
+import org.onap.cps.api.parameters.PaginationOption
+import org.onap.cps.api.model.DataNodeBuilder
import org.onap.cps.utils.JsonObjectMapper
import org.onap.cps.utils.PrefixResolver
import org.spockframework.spring.SpringBean
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Specification
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
@WebMvcTest(QueryRestController)
import org.onap.cps.api.CpsModuleService
import org.onap.cps.api.CpsQueryService
import org.onap.cps.rest.controller.CpsRestInputMapper
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.CpsException
-import org.onap.cps.spi.exceptions.CpsPathException
-import org.onap.cps.spi.exceptions.DataInUseException
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.exceptions.DataValidationException
-import org.onap.cps.spi.exceptions.ModelValidationException
-import org.onap.cps.spi.exceptions.NotFoundInDataspaceException
-import org.onap.cps.spi.exceptions.SchemaSetInUseException
-import org.onap.cps.spi.exceptions.DataspaceInUseException
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.CpsException
+import org.onap.cps.api.exceptions.CpsPathException
+import org.onap.cps.api.exceptions.DataInUseException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.ModelValidationException
+import org.onap.cps.api.exceptions.NotFoundInDataspaceException
+import org.onap.cps.api.exceptions.SchemaSetInUseException
+import org.onap.cps.api.exceptions.DataspaceInUseException
import org.onap.cps.utils.JsonObjectMapper
import org.onap.cps.utils.PrefixResolver
import org.spockframework.spring.SpringBean
package org.onap.cps.rest.utils
-import org.onap.cps.spi.exceptions.CpsException
-import org.onap.cps.spi.exceptions.ModelValidationException
+import org.onap.cps.api.exceptions.CpsException
+import org.onap.cps.api.exceptions.ModelValidationException
import org.springframework.mock.web.MockMultipartFile
import org.springframework.web.multipart.MultipartFile
import spock.lang.Specification
package org.onap.cps.rest.utils
-import org.onap.cps.spi.exceptions.ModelValidationException
+import org.onap.cps.api.exceptions.ModelValidationException
import spock.lang.Specification
class ZipFileSizeValidatorSpec extends Specification {
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.exceptions.DataspaceInUseException;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.Dataspace;
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.DataspaceRepository;
import org.onap.cps.ri.repository.SchemaSetRepository;
import org.onap.cps.spi.CpsAdminPersistenceService;
-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.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Component;
package org.onap.cps.ri;
-import static org.onap.cps.spi.PaginationOption.NO_PAGINATION;
+import static org.onap.cps.api.parameters.PaginationOption.NO_PAGINATION;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.StaleStateException;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.exceptions.ConcurrencyException;
+import org.onap.cps.api.exceptions.CpsAdminException;
+import org.onap.cps.api.exceptions.CpsPathException;
+import org.onap.cps.api.exceptions.DataNodeNotFoundException;
+import org.onap.cps.api.exceptions.DataNodeNotFoundExceptionBatch;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DataNodeBuilder;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
+import org.onap.cps.api.parameters.PaginationOption;
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.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.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.exceptions.ConcurrencyException;
-import org.onap.cps.spi.exceptions.CpsAdminException;
-import org.onap.cps.spi.exceptions.CpsPathException;
-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.utils.JsonObjectMapper;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.exception.ConstraintViolationException;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.exceptions.DuplicatedYangResourceException;
+import org.onap.cps.api.exceptions.ModelValidationException;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
+import org.onap.cps.api.model.SchemaSet;
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.repository.SchemaSetRepository;
import org.onap.cps.ri.repository.YangResourceRepository;
import org.onap.cps.spi.CpsModulePersistenceService;
-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.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import java.util.Collection;
import java.util.Optional;
+import org.onap.cps.api.exceptions.AnchorNotFoundException;
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;
import org.springframework.data.jpa.repository.Query;
package org.onap.cps.ri.repository;
import java.util.Optional;
+import org.onap.cps.api.exceptions.DataspaceNotFoundException;
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;
package org.onap.cps.ri.repository;
import java.util.Collection;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.ri.models.FragmentEntity;
-import org.onap.cps.spi.FetchDescendantsOption;
public interface FragmentPrefetchRepository {
Collection<FragmentEntity> prefetchDescendantsOfFragmentEntities(
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.ri.models.AnchorEntity;
import org.onap.cps.ri.models.FragmentEntity;
-import org.onap.cps.spi.FetchDescendantsOption;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowMapper;
import java.util.Queue;
import lombok.RequiredArgsConstructor;
import org.apache.commons.text.StringSubstitutor;
+import org.onap.cps.api.exceptions.CpsPathException;
+import org.onap.cps.api.parameters.PaginationOption;
import org.onap.cps.cpspath.parser.CpsPathPrefixType;
import org.onap.cps.cpspath.parser.CpsPathQuery;
import org.onap.cps.cpspath.parser.CpsPathUtil;
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.exceptions.CpsPathException;
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
package org.onap.cps.ri.repository;
import java.util.List;
+import org.onap.cps.api.parameters.PaginationOption;
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;
public interface FragmentRepositoryCpsPathQuery {
List<FragmentEntity> findByAnchorAndCpsPath(AnchorEntity anchorEntity, CpsPathQuery cpsPathQuery);
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.parameters.PaginationOption;
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;
@RequiredArgsConstructor
@Slf4j
import java.util.Collection;
import java.util.Map;
-import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.api.model.ModuleReference;
/**
* This interface is used in conjunction with {@link ModuleReferenceRepository} to create native sql queries.
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
-import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.api.model.ModuleReference;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
import java.util.Collection;
import java.util.List;
import java.util.Optional;
+import org.onap.cps.api.exceptions.SchemaSetNotFoundException;
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;
import org.springframework.data.jpa.repository.Query;
import org.hibernate.Session;
import org.springframework.transaction.annotation.Transactional;
-
@Transactional
public class SchemaSetYangResourceRepositoryImpl implements SchemaSetYangResourceRepository {
import java.util.Collection;
import java.util.List;
-import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.api.model.ModuleReference;
public interface YangResourceNativeRepository {
import java.util.StringJoiner;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.type.StandardBasicTypes;
-import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.api.model.ModuleReference;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.exceptions.DataValidationException;
+import org.onap.cps.api.parameters.PaginationOption;
import org.onap.cps.impl.utils.CpsValidator;
-import org.onap.cps.spi.PaginationOption;
-import org.onap.cps.spi.exceptions.DataValidationException;
import org.springframework.stereotype.Component;
@Slf4j
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.Session;
+import org.onap.cps.api.exceptions.SessionManagerException;
+import org.onap.cps.api.exceptions.SessionTimeoutException;
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.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
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.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.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.exceptions.ConcurrencyException
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.model.DataNode
+import org.onap.cps.api.model.DataNodeBuilder
import org.onap.cps.utils.JsonObjectMapper
import org.springframework.dao.DataIntegrityViolationException
import spock.lang.Specification
import org.onap.cps.ri.repository.YangResourceRepository
import org.onap.cps.spi.CpsAdminPersistenceService
import org.onap.cps.spi.CpsModulePersistenceService
-import org.onap.cps.spi.exceptions.DuplicatedYangResourceException
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.exceptions.DuplicatedYangResourceException
+import org.onap.cps.api.model.ModuleReference
import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
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.exceptions.DuplicatedYangResourceException
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.exceptions.DuplicatedYangResourceException
+import org.onap.cps.api.model.ModuleReference
import org.springframework.dao.DataIntegrityViolationException
import spock.lang.Specification
package org.onap.cps.ri.utils
-import org.onap.cps.spi.PaginationOption
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.parameters.PaginationOption
+import org.onap.cps.api.exceptions.DataValidationException
import spock.lang.Specification
class CpsValidatorImplSpec extends Specification {
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.api.exceptions.SessionManagerException
import spock.lang.Specification
class SessionManagerSpec extends Specification {
package org.onap.cps.api;
import java.util.Collection;
-import org.onap.cps.spi.exceptions.CpsException;
-import org.onap.cps.spi.model.Anchor;
+import org.onap.cps.api.exceptions.CpsException;
+import org.onap.cps.api.model.Anchor;
public interface CpsAnchorService {
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.spi.model.DeltaReport;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DeltaReport;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
import org.onap.cps.utils.ContentType;
/*
package org.onap.cps.api;
import java.util.Collection;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.model.Dataspace;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.model.Dataspace;
/**
* CPS Admin Service.
import java.util.Collection;
import java.util.List;
-import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.spi.model.DeltaReport;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DeltaReport;
public interface CpsDeltaService {
import java.util.Collection;
import java.util.Map;
-import org.onap.cps.spi.CascadeDeleteAllowed;
-import org.onap.cps.spi.exceptions.DataInUseException;
-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.api.exceptions.DataInUseException;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
+import org.onap.cps.api.model.SchemaSet;
+import org.onap.cps.api.parameters.CascadeDeleteAllowed;
/**
* Responsible for managing module sets.
import java.util.Collection;
import java.util.Set;
-import org.onap.cps.spi.FetchDescendantsOption;
-import org.onap.cps.spi.PaginationOption;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
+import org.onap.cps.api.parameters.PaginationOption;
/*
* Query interface for handling cps queries.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
import java.util.Collection;
import java.util.Collections;
-/*\r
- * ============LICENSE_START=======================================================\r
- * Copyright (C) 2021 Nordix Foundation.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *\r
- * SPDX-License-Identifier: Apache-2.0\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.onap.cps.spi.exceptions;\r
-\r
-@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions\r
-public class AnchorNotFoundException extends CpsAdminException {\r
-\r
- private static final long serialVersionUID = -1821064664642194882L;\r
-\r
- /**\r
- * Constructor.\r
- *\r
- * @param anchorName the name of the anchor\r
- * @param dataspaceName the dataspace name\r
- */\r
- public AnchorNotFoundException(final String anchorName, final String dataspaceName) {\r
- super("Anchor not found",\r
- String.format("Anchor with name %s does not exist in dataspace %s.", anchorName,\r
- dataspaceName));\r
- }\r
-}\r
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 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.api.exceptions;
+
+@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
+public class AnchorNotFoundException extends CpsAdminException {
+
+ private static final long serialVersionUID = -1821064664642194882L;
+
+ /**
+ * Constructor.
+ *
+ * @param anchorName the name of the anchor
+ * @param dataspaceName the dataspace name
+ */
+ public AnchorNotFoundException(final String anchorName, final String dataspaceName) {
+ super("Anchor not found",
+ String.format("Anchor with name %s does not exist in dataspace %s.", anchorName,
+ dataspaceName));
+ }
+}
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
public class ConcurrencyException extends CpsException {
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* CPS Admin exception.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
import lombok.Getter;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
public class CpsPathException extends CpsException {
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Runtime exception. Thrown when data record rejected to be deleted because it's being referenced by other data.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* DataNode Not Found Exception. Indicates the requested data being absent.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
import java.util.Collection;
import lombok.Getter;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
public class DataValidationException extends CpsException {
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Runtime exception.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Dataspace Not Found Exception. Indicates the requested data being absent.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
import lombok.Getter;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Yang Model Validation exception.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
import java.util.Collection;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Not found in dataspace exception. Indicates the requested data being absent in a given dataspace
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Runtime exception. Thrown when schema set record rejected to be deleted because it has anchor records associated.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
/**
* Schema set not found exception. Indicates the schema set is not found in a given dataspace
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
public class SessionManagerException extends CpsException {
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions;
+package org.onap.cps.api.exceptions;
@SuppressWarnings("squid:S110") // Team agreed to accept 6 levels of inheritance for CPS Exceptions
public class SessionTimeoutException extends SessionManagerException {
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsAnchorService;
+import org.onap.cps.api.model.Anchor;
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.springframework.stereotype.Service;
@Service
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsDeltaService;
+import org.onap.cps.api.exceptions.DataValidationException;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DataNodeBuilder;
+import org.onap.cps.api.model.DeltaReport;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
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;
-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.utils.ContentType;
import org.onap.cps.utils.DataMapUtils;
import org.onap.cps.utils.JsonObjectMapper;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsDataspaceService;
+import org.onap.cps.api.model.Dataspace;
import org.onap.cps.impl.utils.CpsValidator;
import org.onap.cps.spi.CpsAdminPersistenceService;
-import org.onap.cps.spi.model.Dataspace;
import org.springframework.stereotype.Service;
@Service
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.api.CpsDeltaService;
-import org.onap.cps.spi.model.DataNode;
-import org.onap.cps.spi.model.DeltaReport;
-import org.onap.cps.spi.model.DeltaReportBuilder;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.model.DeltaReport;
+import org.onap.cps.api.model.DeltaReportBuilder;
import org.springframework.stereotype.Service;
@Slf4j
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsModuleService;
+import org.onap.cps.api.exceptions.SchemaSetInUseException;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
+import org.onap.cps.api.model.SchemaSet;
+import org.onap.cps.api.parameters.CascadeDeleteAllowed;
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;
-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;
import org.onap.cps.yang.YangTextSchemaSourceSet;
import org.springframework.stereotype.Service;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsQueryService;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
+import org.onap.cps.api.parameters.PaginationOption;
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.springframework.stereotype.Service;
@Service
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import java.io.Serializable;
import java.util.Collection;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
-import org.onap.cps.spi.exceptions.DataValidationException;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.utils.YangUtils;
import org.opendaylight.yangtools.yang.common.Ordering;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import java.io.Serializable;
import java.util.Map;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model;
+package org.onap.cps.api.model;
import java.io.Serializable;
import java.util.List;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi;
+package org.onap.cps.api.parameters;
/**
* Cascade delete option.
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi;
+package org.onap.cps.api.parameters;
import com.google.common.base.Strings;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lombok.RequiredArgsConstructor;
-import org.onap.cps.spi.exceptions.DataValidationException;
+import org.onap.cps.api.exceptions.DataValidationException;
@RequiredArgsConstructor
public class FetchDescendantsOption {
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi;
+package org.onap.cps.api.parameters;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.model.Anchor;
import org.onap.cps.events.model.CpsDataUpdatedEvent;
import org.onap.cps.events.model.Data;
import org.onap.cps.events.model.Data.Operation;
-import org.onap.cps.spi.model.Anchor;
import org.onap.cps.utils.DateTimeUtility;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
package org.onap.cps.impl.utils;
-import org.onap.cps.spi.PaginationOption;
+import org.onap.cps.api.parameters.PaginationOption;
public interface CpsValidator {
package org.onap.cps.spi;
import java.util.Collection;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
-import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.Dataspace;
+import org.onap.cps.api.exceptions.AlreadyDefinedException;
+import org.onap.cps.api.model.Anchor;
+import org.onap.cps.api.model.Dataspace;
/*
Service for handling CPS admin data.
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.api.model.DataNode;
+import org.onap.cps.api.parameters.FetchDescendantsOption;
+import org.onap.cps.api.parameters.PaginationOption;
/*
Data Store interface that is responsible for handling yang data.
import java.util.Collection;
import java.util.Map;
-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.api.model.ModuleDefinition;
+import org.onap.cps.api.model.ModuleReference;
+import org.onap.cps.api.model.SchemaSet;
/**
* Service to manage modules.
import java.util.Map;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
+import org.onap.cps.api.model.DataNode;
import org.onap.cps.cpspath.parser.CpsPathQuery;
import org.onap.cps.cpspath.parser.CpsPathUtil;
-import org.onap.cps.spi.model.DataNode;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class DataMapUtils {
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.onap.cps.spi.exceptions.DataValidationException;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.springframework.stereotype.Component;
@Slf4j
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.impl.YangTextSchemaSourceSetCache;
+import org.onap.cps.api.model.Anchor;
import org.onap.cps.cpspath.parser.CpsPathPrefixType;
import org.onap.cps.cpspath.parser.CpsPathQuery;
import org.onap.cps.cpspath.parser.CpsPathUtil;
-import org.onap.cps.spi.model.Anchor;
import org.onap.cps.yang.YangTextSchemaSourceSet;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import javax.xml.transform.stream.StreamResult;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.onap.cps.spi.exceptions.DataValidationException;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.w3c.dom.DOMException;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.api.impl.YangTextSchemaSourceSetCache;
-import org.onap.cps.spi.exceptions.DataValidationException;
-import org.onap.cps.spi.model.Anchor;
+import org.onap.cps.api.model.Anchor;
import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.TransformerException;
import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.exceptions.DataValidationException;
import org.onap.cps.cpspath.parser.CpsPathUtil;
import org.onap.cps.cpspath.parser.PathParsingException;
-import org.onap.cps.spi.exceptions.DataValidationException;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
package org.onap.cps.yang;
import java.util.List;
-import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.api.model.ModuleReference;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
/**
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import lombok.NoArgsConstructor;
-import org.onap.cps.spi.exceptions.ModelValidationException;
-import org.onap.cps.spi.model.ModuleReference;
+import org.onap.cps.api.exceptions.ModelValidationException;
+import org.onap.cps.api.model.ModuleReference;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.exceptions
+package org.onap.cps.api.exceptions
+
import spock.lang.Specification
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.api.exceptions.ModuleNamesNotFoundException
+import org.onap.cps.api.model.Anchor
import spock.lang.Specification
class CpsAnchorServiceImplSpec extends Specification {
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
-import org.onap.cps.spi.exceptions.DataNodeNotFoundExceptionBatch
-import org.onap.cps.spi.exceptions.DataValidationException
-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.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.exceptions.ConcurrencyException
+import org.onap.cps.api.exceptions.DataNodeNotFoundExceptionBatch
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.SessionManagerException
+import org.onap.cps.api.exceptions.SessionTimeoutException
+import org.onap.cps.api.model.Anchor
+import org.onap.cps.api.model.DataNodeBuilder
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.JsonObjectMapper
import org.onap.cps.utils.PrefixResolver
import org.onap.cps.impl.utils.CpsValidator
import org.onap.cps.spi.CpsAdminPersistenceService
-import org.onap.cps.spi.model.Dataspace
+import org.onap.cps.api.model.Dataspace
import spock.lang.Specification
class CpsDataspaceServiceImplSpec extends Specification {
package org.onap.cps.api.impl
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import spock.lang.Specification
class CpsDeltaServiceImplSpec extends Specification{
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.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.api.exceptions.DuplicatedYangResourceException
+import org.onap.cps.api.exceptions.ModelValidationException
+import org.onap.cps.api.exceptions.SchemaSetInUseException
+import org.onap.cps.api.model.Anchor
+import org.onap.cps.api.model.ModuleDefinition
+import org.onap.cps.api.model.ModuleReference
+import org.onap.cps.api.model.SchemaSet
import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder
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
+import static org.onap.cps.api.parameters.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED
+import static org.onap.cps.api.parameters.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED
class CpsModuleServiceImplSpec extends Specification {
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.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.parameters.PaginationOption
import spock.lang.Specification
class CpsQueryServiceImplSpec extends Specification {
import org.onap.cps.impl.utils.CpsValidator\r
import org.onap.cps.spi.CpsDataPersistenceService\r
import org.onap.cps.spi.CpsModulePersistenceService\r
-import org.onap.cps.spi.model.Anchor\r
+import org.onap.cps.api.model.Anchor\r
import org.onap.cps.utils.ContentType\r
import org.onap.cps.utils.JsonObjectMapper\r
import org.onap.cps.utils.PrefixResolver\r
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model
+package org.onap.cps.api.model
import com.fasterxml.jackson.databind.ObjectMapper
-import org.onap.cps.utils.JsonObjectMapper
import spock.lang.Specification
class ConditionPropertiesSpec extends Specification {
def 'Condition Properties JSON conversion.'() {
given: 'a condition properties'
- def objectUnderTest = new ConditionProperties(conditionName: 'test', conditionParameters: [ [ key : 'value' ] ])
+ def objectUnderTest = new ConditionProperties(conditionName: 'test', conditionParameters: [[key: 'value' ] ])
expect: 'the name is blank'
assert objectMapper.writeValueAsString(objectUnderTest) == '{"conditionName":"test","conditionParameters":[{"key":"value"}]}'
}
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model
+package org.onap.cps.api.model
import org.onap.cps.TestUtils
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.DataValidationException
import org.onap.cps.utils.ContentType
import org.onap.cps.utils.DataMapUtils
import org.onap.cps.utils.YangParserHelper
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi.model
+package org.onap.cps.api.model
+
import spock.lang.Specification
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi
+package org.onap.cps.api.parameters
-import org.onap.cps.spi.exceptions.DataValidationException
+
+import org.onap.cps.api.exceptions.DataValidationException
import spock.lang.Specification
class FetchDescendantsOptionSpec extends Specification {
* ============LICENSE_END=========================================================
*/
-package org.onap.cps.spi
+package org.onap.cps.api.parameters
+
import spock.lang.Specification
import io.cloudevents.core.CloudEventUtils
import io.cloudevents.jackson.PojoCloudEventDataMapper
import org.onap.cps.events.model.CpsDataUpdatedEvent
-import org.onap.cps.spi.model.Anchor
+import org.onap.cps.api.model.Anchor
import org.onap.cps.utils.JsonObjectMapper
import org.springframework.test.context.ContextConfiguration
import spock.lang.Specification
package org.onap.cps.utils
-import org.onap.cps.spi.model.DataNodeBuilder
+import org.onap.cps.api.model.DataNodeBuilder
import spock.lang.Specification
class DataMapUtilsSpec extends Specification {
import com.fasterxml.jackson.databind.SerializationFeature
import groovy.json.JsonSlurper
import org.onap.cps.TestUtils
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.DataValidationException
import spock.lang.Specification
class JsonObjectMapperSpec extends Specification {
import org.onap.cps.TestUtils
import org.onap.cps.api.impl.YangTextSchemaSourceSetCache
-import org.onap.cps.spi.model.Anchor
+import org.onap.cps.api.model.Anchor
import org.onap.cps.yang.YangTextSchemaSourceSet
import org.onap.cps.yang.YangTextSchemaSourceSetBuilder
import spock.lang.Specification
package org.onap.cps.utils
import org.onap.cps.TestUtils
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.DataValidationException
import org.onap.cps.yang.YangTextSchemaSourceSetBuilder
import org.w3c.dom.DOMException
import org.xml.sax.SAXParseException
package org.onap.cps.utils
import org.onap.cps.TestUtils
-import org.onap.cps.spi.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.DataValidationException
import org.onap.cps.yang.YangTextSchemaSourceSetBuilder
import org.opendaylight.yangtools.yang.common.QName
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode
package org.onap.cps.utils
import org.onap.cps.TestUtils
-import org.onap.cps.spi.exceptions.DataValidationException
-import org.onap.cps.spi.model.Anchor
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.model.Anchor
import org.onap.cps.yang.TimedYangTextSchemaSourceSetBuilder
import org.onap.cps.yang.YangTextSchemaSourceSet
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode
package org.onap.cps.yang
import org.onap.cps.TestUtils
-import org.onap.cps.spi.exceptions.ModelValidationException
+import org.onap.cps.api.exceptions.ModelValidationException
import org.opendaylight.yangtools.yang.common.Revision
import spock.lang.Specification
import java.io.IOException;
import java.nio.file.Files;
import java.util.Map;
-import org.onap.cps.spi.model.DataNode;
+import org.onap.cps.api.model.DataNode;
/**
* Common convenience methods for testing.
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.api.exceptions.DataspaceNotFoundException
+import org.onap.cps.api.model.DataNode
import org.onap.cps.utils.JsonObjectMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.integration.base.FunctionalSpecBase
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.AnchorNotFoundException
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.AnchorNotFoundException
import org.onap.cps.utils.ContentType
class AnchorServiceIntegrationSpec extends FunctionalSpecBase {
import org.onap.cps.api.CpsDataService
import org.onap.cps.integration.base.FunctionalSpecBase
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.AnchorNotFoundException
-import org.onap.cps.spi.exceptions.CpsAdminException
-import org.onap.cps.spi.exceptions.CpsPathException
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.exceptions.DataNodeNotFoundExceptionBatch
-import org.onap.cps.spi.exceptions.DataValidationException
-import org.onap.cps.spi.exceptions.DataspaceNotFoundException
-import org.onap.cps.spi.model.DeltaReport
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.AnchorNotFoundException
+import org.onap.cps.api.exceptions.CpsAdminException
+import org.onap.cps.api.exceptions.CpsPathException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataNodeNotFoundExceptionBatch
+import org.onap.cps.api.exceptions.DataValidationException
+import org.onap.cps.api.exceptions.DataspaceNotFoundException
+import org.onap.cps.api.model.DeltaReport
import org.onap.cps.utils.ContentType
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class DataServiceIntegrationSpec extends FunctionalSpecBase {
import org.onap.cps.api.CpsDataspaceService
import org.onap.cps.integration.base.FunctionalSpecBase
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.DataspaceInUseException
-import org.onap.cps.spi.exceptions.DataspaceNotFoundException
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.DataspaceInUseException
+import org.onap.cps.api.exceptions.DataspaceNotFoundException
class DataspaceServiceIntegrationSpec extends FunctionalSpecBase {
import org.onap.cps.api.CpsModuleService
import org.onap.cps.integration.base.FunctionalSpecBase
-import org.onap.cps.spi.CascadeDeleteAllowed
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.DataspaceNotFoundException
-import org.onap.cps.spi.exceptions.ModelValidationException
-import org.onap.cps.spi.exceptions.SchemaSetInUseException
-import org.onap.cps.spi.exceptions.SchemaSetNotFoundException
-import org.onap.cps.spi.model.ModuleDefinition
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.parameters.CascadeDeleteAllowed
+import org.onap.cps.api.exceptions.AlreadyDefinedException
+import org.onap.cps.api.exceptions.DataspaceNotFoundException
+import org.onap.cps.api.exceptions.ModelValidationException
+import org.onap.cps.api.exceptions.SchemaSetInUseException
+import org.onap.cps.api.exceptions.SchemaSetNotFoundException
+import org.onap.cps.api.model.ModuleDefinition
+import org.onap.cps.api.model.ModuleReference
class ModuleServiceIntegrationSpec extends FunctionalSpecBase {
import java.time.OffsetDateTime
import org.onap.cps.api.CpsQueryService
import org.onap.cps.integration.base.FunctionalSpecBase
-import org.onap.cps.spi.FetchDescendantsOption
-import org.onap.cps.spi.PaginationOption
-import org.onap.cps.spi.exceptions.CpsPathException
+import org.onap.cps.api.parameters.FetchDescendantsOption
+import org.onap.cps.api.parameters.PaginationOption
+import org.onap.cps.api.exceptions.CpsPathException
import spock.lang.Ignore
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
-import static org.onap.cps.spi.PaginationOption.NO_PAGINATION
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.PaginationOption.NO_PAGINATION
class QueryServiceIntegrationSpec extends FunctionalSpecBase {
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.api.exceptions.SessionManagerException
class SessionManagerIntegrationSpec extends FunctionalSpecBase {
import org.onap.cps.integration.ResourceMeter
import org.onap.cps.rest.utils.MultipartFileUtil
-import org.onap.cps.spi.FetchDescendantsOption
+import org.onap.cps.api.parameters.FetchDescendantsOption
import org.springframework.web.multipart.MultipartFile
class CpsPerfTestBase extends PerfTestBase {
package org.onap.cps.integration.performance.base
import org.onap.cps.integration.ResourceMeter
-import org.onap.cps.spi.FetchDescendantsOption
+import org.onap.cps.api.parameters.FetchDescendantsOption
import org.onap.cps.utils.ContentType
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME
import org.onap.cps.api.CpsDataService
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class CpsDataServiceLimitsPerfTest extends CpsPerfTestBase {
import org.onap.cps.api.CpsModuleService
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.model.ModuleReference
import org.springframework.util.StopWatch
import java.util.concurrent.ThreadLocalRandom
package org.onap.cps.integration.performance.cps
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
+import org.onap.cps.api.exceptions.DataNodeNotFoundException
import java.time.OffsetDateTime
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsDataService
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class GetPerfTest extends CpsPerfTestBase {
package org.onap.cps.integration.performance.cps
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.api.model.ModuleReference
class ModuleQueryPerfTest extends CpsPerfTestBase {
import org.onap.cps.api.CpsQueryService
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import org.onap.cps.spi.PaginationOption
+import org.onap.cps.api.parameters.PaginationOption
-import static org.onap.cps.spi.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.DIRECT_CHILDREN_ONLY
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class QueryPerfTest extends CpsPerfTestBase {
import org.onap.cps.utils.ContentType
import org.onap.cps.integration.performance.base.CpsPerfTestBase
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class UpdatePerfTest extends CpsPerfTestBase {
static final def UPDATE_TEST_ANCHOR = 'updateTestAnchor'
import org.onap.cps.api.CpsQueryService
import org.onap.cps.integration.performance.base.NcmpPerfTestBase
-import org.onap.cps.spi.model.DataNode
+import org.onap.cps.api.model.DataNode
import org.onap.cps.utils.ContentType
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
class CmDataSubscriptionsPerfTest extends NcmpPerfTestBase {
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class CmHandleQueryByAlternateIdPerfTest extends NcmpPerfTestBase {
import java.util.stream.Collectors
-import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
-import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS
+import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS
class CmHandleQueryPerfTest extends NcmpPerfTestBase {
--- /dev/null
+import os
+
+def sort_imports(java_file_path):
+ with open(java_file_path, 'r', encoding='utf-8') as file:
+ lines = file.readlines()
+
+ # Separate license block
+ license_block = []
+ package_line = None
+ static_imports = []
+ normal_imports = []
+ other_lines = []
+
+ i = 0
+
+ # Process license block
+ if lines and lines[0].startswith('/**'):
+ for i, line in enumerate(lines):
+ license_block.append(line)
+ if line.strip().startswith('*/'):
+ i += 1 # Move past the license block
+ break
+ else:
+ license_block = []
+
+ # Process remaining lines
+ while i < len(lines):
+ line = lines[i]
+ if line.startswith('package '):
+ package_line = line
+ elif line.startswith('import static '):
+ static_imports.append(line)
+ elif line.startswith('import '):
+ normal_imports.append(line)
+ else:
+ other_lines.append(line)
+ i += 1
+
+ # Sort imports
+ static_imports.sort()
+ normal_imports.sort()
+
+ # Build the new file content
+ new_content = []
+
+ # Add license block (always at the top)
+ if license_block:
+ new_content.extend(license_block)
+ if not license_block[-1].endswith('\n'):
+ new_content.append('\n')
+
+ # Add package line
+ if package_line:
+ new_content.append(package_line)
+ if not package_line.endswith('\n'):
+ new_content.append('\n')
+
+ # Add imports
+ if static_imports:
+ new_content.append('\n') # Separate static imports
+ new_content.extend(static_imports)
+ if normal_imports:
+ new_content.append('\n') # Separate normal imports
+ new_content.extend(normal_imports)
+
+ # Add remaining lines (code, comments, etc.)
+ if other_lines:
+ if not new_content[-1].endswith('\n'):
+ new_content.append('\n')
+ new_content.extend(other_lines)
+
+ # Write back to file
+ with open(java_file_path, 'w', encoding='utf-8') as file:
+ file.writelines(new_content)
+
+def process_java_files(root_dir):
+ for subdir, _, files in os.walk(root_dir):
+ for file in files:
+ if file.endswith('.java'):
+ java_file_path = os.path.join(subdir, file)
+ print(f"Processing: {java_file_path}")
+ sort_imports(java_file_path)
+
+if __name__ == "__main__":
+ project_root = input("Enter the root directory of the Java project: ")
+ process_java_files(project_root)
+