diff options
Diffstat (limited to 'catalog-be/src')
29 files changed, 20 insertions, 731 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java index 15cde435ed..51199e62a9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java @@ -28,7 +28,6 @@ import org.openecomp.sdc.be.components.impl.CsarValidationUtils; import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; -import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.Component; @@ -236,19 +235,6 @@ public class CsarBusinessLogic extends BaseBusinessLogic { throw new ByResponseFormatComponentException(errorResponse, params); } - private Map<String, byte[]> getCsar(User user, Map<String, byte[]> payload, String csarUUID) { - if (payload != null) { - return payload; - } - Either<Map<String, byte[]>, StorageOperationStatus> csar = csarOperation.getCsar(csarUUID, user); - if (csar.isRight()) { - StorageOperationStatus value = csar.right().value(); - log.debug("#getCsar - failed to fetch csar with ID {}, error: {}", csarUUID, value); - throw new StorageException(value); - } - return csar.left().value(); - } - private Either<ImmutablePair<String, String>, ResponseFormat> validateAndParseCsar(Service service, User user, Map<String, byte[]> payload, String csarUUID) { Map<String, byte[]> csar = getCsar(service, user, payload, csarUUID); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java index f4eb081b99..2fa6190c44 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngine.java @@ -32,15 +32,12 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry; import org.openecomp.sdc.common.log.wrappers.Logger; -import org.openecomp.sdc.common.util.YamlToObjectConverter; -import org.openecomp.sdc.exception.YamlConversionException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -73,26 +70,6 @@ public class DistributionEngine implements IDistributionEngine { private Map<String, DistributionEnginePollingTask> envNamePerPollingTask = new HashMap<>(); private Map<String, AtomicBoolean> envNamePerStatus = new HashMap<>(); - /** - * The main method for testing only - * @param args - */ - public static void main(String[] args) throws YamlConversionException { - - List<String> servers = new ArrayList<>(); - String server = "uebsb91kcdc.it.att.com:3904"; - servers.add(server); - servers.add(server); - servers.add(server); - - YamlToObjectConverter converter = new YamlToObjectConverter(); - DistributionEngineConfiguration distributionEngineConfiguration = converter.convert("src/test/resources/config/catalog-be/distribEngine1/distribution-engine-configuration.yaml", DistributionEngineConfiguration.class); - - DistributionEngineInitTask distributionEngineInitTask = new DistributionEngineInitTask(2l, distributionEngineConfiguration, "PROD", new AtomicBoolean(false), null, null, null); - distributionEngineInitTask.startTask(); - - } - @Override public boolean isActive() { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java index 5d98006dec..70ec37ce48 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformation.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.annotations.VisibleForTesting; import org.openecomp.sdc.be.model.Service; /** @@ -31,9 +30,6 @@ public class ActivationRequestInformation { private String workloadContext; private String tenant; - @VisibleForTesting - ActivationRequestInformation() {} - public ActivationRequestInformation(Service serviceToActivate, String workloadContext, String tenant) { this.serviceToActivate = serviceToActivate; this.workloadContext = workloadContext; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java index 712cba74b7..ee6878e7d7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java @@ -28,7 +28,6 @@ import org.openecomp.sdc.be.dao.graph.datatype.AdditionalInformationEnum; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; @@ -43,15 +42,12 @@ import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.converters.StringConvertor; import org.openecomp.sdc.be.model.tosca.validators.StringValidator; -import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; import java.util.List; @Component("additionalInformationBusinessLogic") @@ -84,14 +80,6 @@ public class AdditionalInformationBusinessLogic extends BaseBusinessLogic { this.additionalInformationOperation = additionalInformationOperation; } - protected static IElementOperation getElementDao(Class<IElementOperation> class1, ServletContext context) { - WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); - - WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - - return webApplicationContext.getBean(class1); - } - /** * Create new additional information on resource/service on graph * @param nodeType diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index 374e98e61f..046ad22159 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -29,8 +29,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import fj.data.Either; import io.vavr.control.Option; -import java.io.ByteArrayInputStream; -import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collections; @@ -49,10 +47,6 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; import org.apache.commons.codec.binary.Base64; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -145,11 +139,6 @@ import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.common.util.YamlToObjectConverter; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.XMLReader; import org.yaml.snakeyaml.Yaml; @org.springframework.stereotype.Component("artifactBusinessLogic") @@ -2068,33 +2057,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { } } - private boolean isValidXml(byte[] xmlToParse) { - boolean isXmlValid = true; - try { - SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); - saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); - saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); - XMLReader reader = saxParser.getXMLReader(); - setFeatures(reader); - reader.parse(new InputSource(new ByteArrayInputStream(xmlToParse))); - } - catch (ParserConfigurationException | IOException | SAXException e) { - log.debug("Xml is invalid : {}", e.getMessage(), e); - isXmlValid = false; - } - return isXmlValid; - } - - private void setFeatures(XMLReader reader) throws SAXNotSupportedException { - try { - reader.setFeature("http://apache.org/xml/features/validation/schema", false); - reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - } - catch (SAXNotRecognizedException e) { - log.debug("Xml parser couldn't set feature: \"http://apache.org/xml/features/validation/schema\", false", e.getMessage(), e); - } - } - private void validateSingleDeploymentArtifactName(final String artifactName, final Component parentComponent) { boolean artifactNameFound = false; final Iterator<ArtifactDefinition> parentDeploymentArtifactsItr = diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index c7da584fe8..a640de0be7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -38,7 +38,6 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; -import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.validation.UserValidations; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; @@ -767,16 +766,6 @@ public abstract class BaseBusinessLogic { } - protected void rollbackWithException(StorageException e) { - janusGraphDao.rollback(); - throw e; - } - - protected void rollbackWithException(ComponentException e) { - janusGraphDao.rollback(); - throw e; - } - protected void unlockRollbackWithException(Component component, RuntimeException e) { janusGraphDao.rollback(); graphLockOperation.unlockComponent(component.getUniqueId(), component.getComponentType().getNodeType()); @@ -798,18 +787,10 @@ public abstract class BaseBusinessLogic { throw new StorageException(storageOperationStatus); } - protected PolicyDefinition storageExceptionPolicyDefinition(StorageOperationStatus storageOperationStatus) { - throw new StorageException(storageOperationStatus); - } - protected PolicyDefinition componentExceptionPolicyDefinition(ResponseFormat responseFormat) { throw new ByResponseFormatComponentException(responseFormat); } - protected Component componentException(ResponseFormat responseFormat) { - throw new ByResponseFormatComponentException(responseFormat); - } - protected List<ComponentInstanceProperty> componentInstancePropertyListException(StorageOperationStatus storageOperationStatus) { throw new StorageException(storageOperationStatus); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java index 0b04f70779..efab8592c1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.be.components.impl; import fj.data.Either; -import io.vavr.Function3; import java.util.Optional; import java.util.function.BiFunction; import java.util.function.BooleanSupplier; @@ -185,8 +184,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(ComponentBusinessLogic.class.getName()); - private static final String TAG_FIELD_LABEL = "tag"; - public abstract Either<List<String>, ResponseFormat> deleteMarkedComponents(); public abstract ComponentInstanceBusinessLogic getComponentInstanceBL(); @@ -424,23 +421,6 @@ public abstract class ComponentBusinessLogic extends BaseBusinessLogic { } } - private Boolean isHighest(HighestFilterEnum highestFilter) { - Boolean isHighest = null; - switch (highestFilter) { - case ALL: - break; - case HIGHEST_ONLY: - isHighest = true; - break; - case NON_HIGHEST_ONLY: - isHighest = false; - break; - default: - break; - } - return isHighest; - } - public Either<List<Component>, ResponseFormat> getLatestVersionNotAbstractComponentsMetadata(boolean isAbstractAbstract, HighestFilterEnum highestFilter, ComponentTypeEnum componentTypeEnum, String internalComponentType, String userId) { try{ validateUserExists(userId); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java index 5f1e6a100f..1e0f6863f9 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogicProvider.java @@ -50,7 +50,7 @@ public class ComponentBusinessLogicProvider { case RESOURCE_INSTANCE: return resourceBusinessLogic; default: - BeEcompErrorManager.getInstance().logBeSystemError("getComponentBL"); + BeEcompErrorManager.getInstance().logBeSystemError("getInstance"); throw new ByActionStatusComponentException(ActionStatus.INVALID_CONTENT, componentTypeEnum.getValue()); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java index 9c092da300..631daefff8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java @@ -208,10 +208,6 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return response; } - private Either<Map<String, Set<? extends Component>>, ResponseFormat> handleGovernor() { - return handleFollowedCertifiedServices(null); - } - private Either<Map<String, Set<? extends Component>>, ResponseFormat> handleProductStrategist() { // Should be empty list according to Ella, 13/03/16 Map<String, Set<? extends Component>> result = new HashMap<>(); @@ -232,20 +228,6 @@ public class ElementBusinessLogic extends BaseBusinessLogic { return response; } - private Either<Map<String, Set<? extends Component>>, ResponseFormat> handleFollowedCertifiedServices(Set<DistributionStatusEnum> distStatus) { - - Either<List<Service>, StorageOperationStatus> services = toscaOperationFacade.getCertifiedServicesWithDistStatus(distStatus); - if (services.isLeft()) { - Map<String, Set<? extends Component>> result = new HashMap<>(); - Set<Service> set = new HashSet<>(); - set.addAll(services.left().value()); - result.put(SERVICES, set); - return Either.left(result); - } else { - return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(services.right().value()))); - } - } - private Either<Map<String, Set<? extends Component>>, ResponseFormat> getFollowedResourcesAndServices(String userId, Set<LifecycleStateEnum> lifecycleStates, Set<LifecycleStateEnum> lastStateStates) { try { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java index c74520f825..b8541f18f2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeBusinessLogic.java @@ -20,7 +20,6 @@ package org.openecomp.sdc.be.components.impl; -import fj.data.Either; import org.apache.commons.lang.StringUtils; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.validation.UserValidations; @@ -31,8 +30,6 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.PolicyTypeOperation; -import org.openecomp.sdc.common.log.wrappers.Logger; -import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -45,7 +42,6 @@ import static java.util.Collections.emptySet; @Component public class PolicyTypeBusinessLogic { - private static final Logger log = Logger.getLogger(PolicyTypeBusinessLogic.class); private PolicyTypeOperation policyTypeOperation; private JanusGraphDao janusGraphDao; private ComponentsUtils componentsUtils; @@ -84,11 +80,6 @@ public class PolicyTypeBusinessLogic { return policyTypeOperation.getAllPolicyTypes(excludedTypes); } - private Either<List<PolicyTypeDefinition>, ResponseFormat> convertToResponseFormatOrNotFoundErrorToEmptyList(StorageOperationStatus err) { - log.debug("error when trying to fetch policy types: {}", err); - return componentsUtils.convertToResponseFormatOrNotFoundErrorToEmptyList(err); - } - private PolicyTypeDefinition failOnPolicyType(StorageOperationStatus status, String policyType) { janusGraphDao.rollback(); if (status == StorageOperationStatus.INVALID_ID) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java index b271ea0137..66a6a27e16 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java @@ -24,23 +24,19 @@ import com.google.gson.JsonElement; import fj.data.Either; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; -import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceInterface; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DataTypeDefinition; -import org.openecomp.sdc.be.model.IComplexDefaultValue; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; @@ -58,20 +54,16 @@ import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; import org.openecomp.sdc.be.model.tosca.validators.PropertyTypeValidator; import org.openecomp.sdc.be.resources.data.EntryData; -import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.context.WebApplicationContext; -import javax.servlet.ServletContext; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.function.Supplier; @org.springframework.stereotype.Component("propertyBusinessLogic") @@ -95,14 +87,6 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); } - protected static IElementOperation getElementDao(Class<IElementOperation> class1, ServletContext context) { - WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); - - WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - - return webApplicationContext.getBean(class1); - } - public Map<String, DataTypeDefinition> getAllDataTypes() { return getAllDataTypes(applicationDataTypeCache); } @@ -604,76 +588,6 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { return propertyCandidate.isPresent(); } - private StorageOperationStatus validateAndUpdateProperty(IComplexDefaultValue propertyDefinition, Map<String, DataTypeDefinition> dataTypes) { - - log.trace("Going to validate property type and value. {}", propertyDefinition); - - String propertyType = propertyDefinition.getType(); - String value = propertyDefinition.getDefaultValue(); - - ToscaPropertyType type = getType(propertyType); - - if (type == null) { - DataTypeDefinition dataTypeDefinition = dataTypes.get(propertyType); - if (dataTypeDefinition == null) { - log.debug("The type {} of property cannot be found.", propertyType); - return StorageOperationStatus.INVALID_TYPE; - } - return validateAndUpdateComplexValue(propertyDefinition, propertyType, value, dataTypeDefinition, dataTypes); - } - String innerType; - - Either<String, JanusGraphOperationStatus> checkInnerType = getInnerType(type, propertyDefinition::getSchema); - if (checkInnerType.isRight()) { - return StorageOperationStatus.INVALID_TYPE; - } - innerType = checkInnerType.left().value(); - - log.trace("After validating property type {}", propertyType); - - boolean isValidProperty = isValidValue(type, value, innerType, dataTypes); - if (!isValidProperty) { - log.info("The value {} of property from type {} is invalid", value, type); - return StorageOperationStatus.INVALID_VALUE; - } - - PropertyValueConverter converter = type.getConverter(); - - if (isEmptyValue(value)) { - log.debug("Default value was not sent for property {}. Set default value to {}", propertyDefinition.getName(), EMPTY_VALUE); - propertyDefinition.setDefaultValue(EMPTY_VALUE); - } else if (!isEmptyValue(value)) { - String convertedValue = converter.convert(value, innerType, dataTypes); - propertyDefinition.setDefaultValue(convertedValue); - } - return StorageOperationStatus.OK; - } - - private StorageOperationStatus validateAndUpdateComplexValue(IComplexDefaultValue propertyDefinition, String propertyType, - String value, DataTypeDefinition dataTypeDefinition, Map<String, DataTypeDefinition> dataTypes) { - - ImmutablePair<JsonElement, Boolean> validateResult = dataTypeValidatorConverter.validateAndUpdate(value, dataTypeDefinition, dataTypes); - - if (validateResult.right) { - log.debug("The value {} of property from type {} is invalid", propertyType, propertyType); - return StorageOperationStatus.INVALID_VALUE; - } - - JsonElement jsonElement = validateResult.left; - - log.trace("Going to update value in property definition {} {}" , propertyDefinition.getName() , jsonElement); - - updateValue(propertyDefinition, jsonElement); - - return StorageOperationStatus.OK; - } - - private void updateValue(IComplexDefaultValue propertyDefinition, JsonElement jsonElement) { - - propertyDefinition.setDefaultValue(getValueFromJsonElement(jsonElement)); - - } - @Override protected String getValueFromJsonElement(JsonElement jsonElement) { if (jsonElement == null || jsonElement.isJsonNull()) { @@ -685,25 +599,6 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { return jsonElement.toString(); } - private Either<String, JanusGraphOperationStatus> getInnerType(ToscaPropertyType type, Supplier<SchemaDefinition> schemeGen) { - String innerType = null; - if (type == ToscaPropertyType.LIST || type == ToscaPropertyType.MAP) { - - SchemaDefinition def = schemeGen.get(); - if (def == null) { - log.debug("Schema doesn't exists for property of type {}", type); - return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); - } - PropertyDataDefinition propDef = def.getProperty(); - if (propDef == null) { - log.debug("Property in Schema Definition inside property of type {} doesn't exist", type); - return Either.right(JanusGraphOperationStatus.ILLEGAL_ARGUMENT); - } - innerType = propDef.getType(); - } - return Either.left(innerType); - } - @Override protected boolean isValidValue(ToscaPropertyType type, String value, String innerType, Map<String, DataTypeDefinition> dataTypes) { if (isEmptyValue(value)) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 3676844516..a3d746da89 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -50,7 +50,6 @@ import java.util.Set; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; -import javax.servlet.ServletContext; import org.apache.commons.codec.binary.Base64; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -107,7 +106,6 @@ import org.openecomp.sdc.be.datatypes.enums.CreatedFrom; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.info.NodeTypeInfoToUpdateArtifacts; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.AttributeDefinition; @@ -186,7 +184,6 @@ import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; -import org.springframework.web.context.WebApplicationContext; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; @@ -3768,17 +3765,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { resourcesInstancesMap.put(componentInstance, origResource); } - private ComponentParametersView getComponentWithInstancesFilter() { - ComponentParametersView parametersView = new ComponentParametersView(); - parametersView.disableAll(); - parametersView.setIgnoreComponentInstances(false); - parametersView.setIgnoreInputs(false); - // inputs are read when creating - // property values on instances - parametersView.setIgnoreUsers(false); - return parametersView; - } - private void setCapabilityNamesTypes(Map<String, List<CapabilityDefinition>> originCapabilities, Map<String, List<UploadCapInfo>> uploadedCapabilities) { for (Entry<String, List<UploadCapInfo>> currEntry : uploadedCapabilities.entrySet()) { @@ -5632,17 +5618,6 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } - /**** Auditing *******************/ - - protected static IElementOperation getElementDao(Class<IElementOperation> class1, ServletContext context) { - WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context - .getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); - - WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - - return webApplicationContext.getBean(class1); - } - public ICapabilityTypeOperation getCapabilityTypeOperation() { return capabilityTypeOperation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java index 383d7cda95..8ea1c2a28f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java @@ -29,7 +29,6 @@ import static org.openecomp.sdc.be.utils.TypeUtils.setField; import fj.data.Either; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -245,17 +244,6 @@ public class ResourceImportManager { return responsePair; } - private ResponseFormat getResponseFormatFromComponentException(RuntimeException e) { - if (e instanceof ComponentException) { - return ((ComponentException) e).getResponseFormat() == null ? - componentsUtils - .getResponseFormat(((ComponentException) e).getActionStatus(), ((ComponentException) e).getParams()) - : - ((ComponentException) e).getResponseFormat(); - } - return null; - } - private String getLatestCertifiedResourceId(Resource resource) { Map<String, String> allVersions = resource.getAllVersions(); Double latestCertifiedVersion = 0.0; @@ -890,17 +878,6 @@ public class ResourceImportManager { } } - private Map<String, Object> getDataTypes(final String payloadData) { - final Map<String, Object> mappedToscaTemplate = decodePayload(payloadData); - final Either<Map<String, Object>, ResultStatusEnum> findFirstToscaStringElement = - ImportUtils.findFirstToscaMapElement(mappedToscaTemplate, ToscaTagNamesEnum.DATA_TYPES); - if (findFirstToscaStringElement.isLeft()) { - return findFirstToscaStringElement.left().value(); - } else { - return Collections.EMPTY_MAP; - } - } - private void calculateResourceIsAbstract(Resource resource, List<CategoryDefinition> categories) { if (categories != null && !categories.isEmpty()) { CategoryDefinition categoryDef = categories.get(0); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 9eb9c3418a..ad1f818da6 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -54,6 +54,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; +import lombok.Getter; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.collections4.ListUtils; @@ -67,7 +68,6 @@ import org.openecomp.sdc.be.components.health.HealthCheckBusinessLogic; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; -import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.components.path.ForwardingPathValidator; import org.openecomp.sdc.be.components.utils.InterfaceOperationUtils; import org.openecomp.sdc.be.components.utils.PropertiesUtils; @@ -114,7 +114,6 @@ import org.openecomp.sdc.be.model.ComponentInstanceInterface; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DistributionStatusEnum; -import org.openecomp.sdc.be.model.DistributionTransitionEnum; import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.GroupInstanceProperty; import org.openecomp.sdc.be.model.InputDefinition; @@ -170,7 +169,6 @@ import org.springframework.web.context.WebApplicationContext; @org.springframework.stereotype.Component("serviceBusinessLogic") public class ServiceBusinessLogic extends ComponentBusinessLogic { - private static final String CHANGE_SERVICE_DISTRIBUTION = "Change Service Distribution"; private static final String THE_SERVICE_WITH_SYSTEM_NAME_LOCKED = "The service with system name {} locked. "; private static final String FAILED_TO_LOCK_SERVICE_RESPONSE_IS = "Failed to lock service {}. Response is {}. "; private static final String AUDIT_BEFORE_SENDING_RESPONSE = "audit before sending response"; @@ -1698,51 +1696,6 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { return artifactInfo; } - private DistributionTransitionEnum validateTransitionEnum(String distributionTransition) { - DistributionTransitionEnum transitionEnum; - - transitionEnum = DistributionTransitionEnum.getFromDisplayName(distributionTransition); - if (transitionEnum == null) { - BeEcompErrorManager.getInstance().logBeSystemError(CHANGE_SERVICE_DISTRIBUTION); - log.info("state operation is not valid. operations allowed are: {}", DistributionTransitionEnum.valuesAsString()); - throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(ActionStatus.UNSUPPORTED_DISTRIBUTION_STATUS, distributionTransition)); - } - - return transitionEnum; - } - - private String validateComment(LifecycleChangeInfoWithAction comment) { - if (comment==null || StringUtils.isEmpty(comment.getUserRemarks())) { - return ""; - } - String data = comment.getUserRemarks(); - data = ValidationUtils.removeNoneUtf8Chars(data); - data = ValidationUtils.removeHtmlTags(data); - data = ValidationUtils.normaliseWhitespace(data); - data = ValidationUtils.stripOctets(data); - - if (!ValidationUtils.validateLength(data, ValidationUtils.COMMENT_MAX_LENGTH)) { - BeEcompErrorManager.getInstance().logBeInvalidJsonInput(CHANGE_SERVICE_DISTRIBUTION); - log.debug("user comment exceeds limit."); - throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(ActionStatus.EXCEEDS_LIMIT, "comment", String.valueOf(ValidationUtils.COMMENT_MAX_LENGTH))); - } - if (!ValidationUtils.validateCommentPattern(data)) { - throw new ByResponseFormatComponentException(componentsUtils.getResponseFormat(ActionStatus.INVALID_CONTENT)); - } - - return data; - } - - private void createAudit(User user, AuditingActionEnum auditAction, String comment, Service component, ResponseFormat responseFormat) { - log.debug(AUDIT_BEFORE_SENDING_RESPONSE); - componentsUtils.auditComponent(responseFormat, user, component, auditAction, new ResourceCommonInfo(ComponentTypeEnum.SERVICE.getValue()), - ResourceVersionInfo.newBuilder() - .state(component.getLifecycleState().name()) - .version(component.getVersion()) - .build(), - comment); - } - private String getEnvNameFromConfiguration() { String configuredEnvName = ConfigurationManager.getConfigurationManager().getDistributionEngineConfiguration().getEnvironments().get(0); log.trace("Update environment name to be {}", configuredEnvName); @@ -2101,14 +2054,15 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } + @Getter class HeatEnvArtifactGenerator extends ArtifactGenerator<ArtifactDefinition> { - ArtifactDefinition artifactDefinition; - Service service; - String resourceInstanceName; - User modifier; - String instanceId; - boolean shouldLock; - boolean inTransaction; + private ArtifactDefinition artifactDefinition; + private Service service; + private String resourceInstanceName; + private User modifier; + private String instanceId; + private boolean shouldLock; + private boolean inTransaction; HeatEnvArtifactGenerator(ArtifactDefinition artifactDefinition, Service service, String resourceInstanceName, User modifier, boolean shouldLock, boolean inTransaction, String instanceId) { this.artifactDefinition = artifactDefinition; @@ -2125,10 +2079,6 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { return artifactsBusinessLogic.forceGenerateHeatEnvArtifact(artifactDefinition, ComponentTypeEnum.RESOURCE_INSTANCE, service, resourceInstanceName, modifier, shouldLock, inTransaction, instanceId); } - public ArtifactDefinition getArtifactDefinition() { - return artifactDefinition; - } - } class VfModuleArtifactGenerator extends ArtifactGenerator<ArtifactDefinition> { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java index 1fff794750..b876782ce4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/InterfaceOperationValidation.java @@ -121,33 +121,6 @@ public class InterfaceOperationValidation { return Either.left(Boolean.TRUE); } - private Either<Boolean, ResponseFormat> validateAllowedOperationCountOnLocalInterfaceType( - InterfaceDefinition inputInterfaceDefinition, InterfaceDefinition storedInterfaceDefinition, - Map<String, InterfaceDefinition> globalInterfaceTypes, boolean isUpdate) { - - boolean isInterfaceTypeExistInGlobalType = - globalInterfaceTypes.values().stream().map(InterfaceDefinition::getType) - .anyMatch(type -> type.equalsIgnoreCase(inputInterfaceDefinition.getType())); - if (!isInterfaceTypeExistInGlobalType - && isValidOperationOnLocalInterfaceType(inputInterfaceDefinition, storedInterfaceDefinition, - isUpdate)) { - return Either.right(getResponseFormatManager() - .getResponseFormat(ActionStatus.INTERFACE_OPERATION_INVALID_FOR_LOCAL_TYPE, - inputInterfaceDefinition.getType())); - } - - return Either.left(Boolean.TRUE); - } - - private boolean isValidOperationOnLocalInterfaceType(InterfaceDefinition inputInterfaceDefinition, - InterfaceDefinition storedInterfaceDefinition, - boolean isUpdate) { - return inputInterfaceDefinition.getOperations().size() > 1 - || (!isUpdate && storedInterfaceDefinition != null - && storedInterfaceDefinition.getType() - .equalsIgnoreCase(inputInterfaceDefinition.getType())); - } - private Either<Boolean, ResponseFormat> validateAllowedOperationsOnGlobalInterfaceType( InterfaceDefinition interfaceDefinition, Map<String, InterfaceDefinition> globalInterfaceTypes) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java index eb514bf088..6b24867ad5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/AbstractTemplateServlet.java @@ -16,7 +16,6 @@ package org.openecomp.sdc.be.externalapi.servlet; -import com.fasterxml.jackson.databind.ObjectMapper; import com.jcabi.aspects.Loggable; import fj.data.Either; import io.swagger.v3.oas.annotations.Operation; @@ -26,9 +25,7 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.servers.Server; -import io.swagger.v3.oas.annotations.servers.Servers; import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.tags.Tags; import java.io.IOException; import java.util.List; @@ -58,7 +55,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo; import org.openecomp.sdc.be.servlets.*; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.log.elements.LoggerSupportability; import org.openecomp.sdc.common.log.enums.LoggerSupportabilityActions; import org.openecomp.sdc.common.log.enums.StatusCode; @@ -74,8 +70,8 @@ import org.springframework.stereotype.Controller; @Loggable(prepend = true, value = Loggable.DEBUG, trim = false) @Path("/v1/catalog") -@Tags({@Tag(name = "SDC External APIs")}) -@Servers({@Server(url = "/sdc")}) +@Tag(name = "SDC External APIs") +@Server(url = "/sdc") @Controller public class AbstractTemplateServlet extends AbstractValidationsServlet { @@ -105,17 +101,6 @@ public class AbstractTemplateServlet extends AbstractValidationsServlet { this.resourceBusinessLogic = resourceBusinessLogic; } - private Wrapper<ResponseFormat> validateRequestHeaders(String instanceIdHeader, String userId) { - Wrapper<ResponseFormat> responseWrapper = new Wrapper<>(); - if (responseWrapper.isEmpty()) { - validateXECOMPInstanceIDHeader(instanceIdHeader, responseWrapper); - } - if (responseWrapper.isEmpty()) { - validateHttpCspUserIdHeader(userId, responseWrapper); - } - return responseWrapper; - } - /** * @param requestId * @param instanceIdHeader @@ -306,13 +291,4 @@ public class AbstractTemplateServlet extends AbstractValidationsServlet { return getComponentsUtils().convertJsonToObjectUsingObjectMapper(serviceJson, user, CopyServiceInfo.class, AuditingActionEnum.CREATE_RESOURCE, ComponentTypeEnum.SERVICE); } - private CopyServiceInfo convertJsonToServiceInfo(String data) { - ObjectMapper mapper = new ObjectMapper(); - try { - return mapper.readValue(data, CopyServiceInfo.class); - } catch (IOException e) { - log.error("#convertJsonToServiceInfo - json deserialization failed with error: ", e); - return new CopyServiceInfo(); - } - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java index cc4a11f6d9..5d34f468aa 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/BasicAuthenticationFilter.java @@ -22,20 +22,16 @@ package org.openecomp.sdc.be.filters; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import fj.data.Either; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; import org.apache.commons.codec.binary.Base64; import org.glassfish.jersey.server.ContainerRequest; -import org.onap.sdc.security.Passwords; -import org.openecomp.sdc.be.components.impl.ConsumerBusinessLogic; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; -import org.openecomp.sdc.be.model.ConsumerDefinition; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.enums.LogLevel; import org.openecomp.sdc.common.log.enums.Severity; @@ -63,7 +59,6 @@ public class BasicAuthenticationFilter implements ContainerRequestFilter { private static LoggerSdcAudit audit = new LoggerSdcAudit(BasicAuthenticationFilter.class); private static final Logger log = Logger.getLogger(BasicAuthenticationFilter.class); private static final String COMPONENT_UTILS_FAILED = "Authentication Filter Failed to get component utils."; - private static final String CONSUMER_BL_FAILED = "Authentication Filter Failed to get consumerBL."; private static final ConfigurationManager configurationManager = ConfigurationManager.getConfigurationManager(); private static final Configuration.BasicAuthConfig basicAuthConf = configurationManager.getConfiguration().getBasicAuth(); @@ -129,21 +124,6 @@ public class BasicAuthenticationFilter implements ContainerRequestFilter { } } - private void validatePassword(ContainerRequestContext requestContext, String userName, String password, Either<ConsumerDefinition, ResponseFormat> result) { - if (result.isRight()) { - Integer status = result.right().value().getStatus(); - if (status == Status.NOT_FOUND.getStatusCode()) { - log.error("Authentication Filter Failed Couldn't find user"); - authUserNotFoundError(requestContext, userName); - } else { - abortWith(requestContext, CONSUMER_BL_FAILED, Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build()); - } - } else { - ConsumerDefinition consumerCredentials = result.left().value(); - - } - } - private void authSuccessful(ContainerRequestContext requestContext, String userName) { ComponentsUtils componentUtils = getComponentsUtils(); if (componentUtils == null) { @@ -167,16 +147,6 @@ public class BasicAuthenticationFilter implements ContainerRequestFilter { } } - private void authUserNotFoundError(ContainerRequestContext requestContext, String userName) { - ComponentsUtils componentUtils = getComponentsUtils(); - if (componentUtils == null) { - abortWith(requestContext, COMPONENT_UTILS_FAILED, Response.status(Status.INTERNAL_SERVER_ERROR).build()); - } - getComponentsUtils().auditAuthEvent(requestContext.getUriInfo().getPath(), userName, AuthStatus.AUTH_FAILED_USER_NOT_FOUND.toString(), realm); - ResponseFormat responseFormat = getComponentsUtils().getResponseFormat(ActionStatus.AUTH_FAILED); - abortWith(requestContext, responseFormat.getFormattedMessage(), buildErrorResponse(responseFormat, false)); - } - private void authInvalidHeaderError(ContainerRequestContext requestContext) { ComponentsUtils componentUtils = getComponentsUtils(); if (componentUtils == null) { @@ -204,13 +174,6 @@ public class BasicAuthenticationFilter implements ContainerRequestFilter { return webApplicationContext.getBean(ComponentsUtils.class); } - private ConsumerBusinessLogic getConsumerBusinessLogic() { - ServletContext context = sr.getSession().getServletContext(); - WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); - WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - return webApplicationContext.getBean(ConsumerBusinessLogic.class); - } - public enum AuthStatus { AUTH_REQUIRED, AUTH_FAILED_USER_NOT_FOUND, AUTH_FAILED_INVALID_PASSWORD, AUTH_FAILED_INVALID_AUTHENTICATION_HEADER, AUTH_SUCCESS } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/GatewayFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/GatewayFilter.java index 3ed14f139f..9b9fd6dbcf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/GatewayFilter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/GatewayFilter.java @@ -21,10 +21,8 @@ package org.openecomp.sdc.be.filters; import org.apache.http.HttpStatus; -import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.servlets.exception.ComponentExceptionMapper; import org.openecomp.sdc.common.api.FilterDecisionEnum; import org.openecomp.sdc.common.log.wrappers.Logger; @@ -38,11 +36,9 @@ import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; -import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.HttpHeaders; import java.io.IOException; import java.util.List; import java.util.stream.Stream; @@ -78,13 +74,6 @@ public class GatewayFilter implements Filter { ThreadLocalsHolder.setApiType(FilterDecisionEnum.NA); threadLocalUtils.setUserContextFromDB(httpRequest); filterChain.doFilter(httpRequest, res); -// } else if (isCookieExist(httpRequest, authCookieConf.getCookieName())) { -// ThreadLocalsHolder.setApiType(FilterDecisionEnum.INTERNAL); -// filterChain.doFilter(httpRequest, res); -// } else { -// validateAuthHeaderExist(httpRequest); -// ThreadLocalsHolder.setApiType(FilterDecisionEnum.EXTERNAL); -// filterChain.doFilter(httpRequest, res); } } catch (ComponentException ce) { componentExceptionMapper.writeToResponse(ce, httpResponse); @@ -106,27 +95,6 @@ public class GatewayFilter implements Filter { httpResponse.setCharacterEncoding("UTF-8"); } - private boolean isCookieExist(HttpServletRequest httpRequest, String cookieName) { - Cookie[] cookies = httpRequest.getCookies(); - if (cookies != null) { - for (Cookie cookie : cookies) { - if (cookie.getName().equals(cookieName)) { - return true; - } - } - } - return false; - } - - private boolean isHeaderExist(HttpServletRequest req, String headerName) { - return req.getHeader(headerName) != null; - } - - private void validateAuthHeaderExist(HttpServletRequest req) { - boolean authHeader = isHeaderExist(req, HttpHeaders.AUTHORIZATION); - if (!authHeader) throw new ByActionStatusComponentException(ActionStatus.AUTH_FAILED); - } - private boolean isUrlFromWhiteList(HttpServletRequest httpRequest) { String pathInfo; List<String> excludedUrls = authCookieConf.getExcludedUrls(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/PortalConfiguration.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/PortalConfiguration.java index 81920ce13c..2ed10dc771 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/PortalConfiguration.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/PortalConfiguration.java @@ -20,16 +20,11 @@ package org.openecomp.sdc.be.filters; -import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.lang.StringUtils; -import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; import org.onap.sdc.security.IPortalConfiguration; import org.onap.sdc.security.PortalClient; -import java.security.InvalidParameterException; - public class PortalConfiguration implements IPortalConfiguration { - private static final String PROPERTY_NOT_SET = "%s property value is not set in portal.properties file"; + private String portalUser; private String portalPassword; private String ecompPortalRestURL; @@ -44,15 +39,6 @@ public class PortalConfiguration implements IPortalConfiguration { this.uebKey = org.onap.portalsdk.core.onboarding.util.PortalApiProperties.getProperty(org.onap.sdc.security.PortalClient.PortalPropertiesEnum.UEB_APP_KEY.value()); } - @VisibleForTesting - String getPortalProperty(String key) { - String value = PortalApiProperties.getProperty(key); - if (StringUtils.isEmpty(value)) { - throw new InvalidParameterException(String.format(PROPERTY_NOT_SET, key)); - } - return value; - } - @Override public String getPortalApiPrefix() { return null; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ThreadLocalUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ThreadLocalUtils.java index 3eb067c8a9..3df33c5362 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ThreadLocalUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/filters/ThreadLocalUtils.java @@ -81,11 +81,6 @@ public class ThreadLocalUtils implements IUsersThreadLocalHolder { } else log.debug("user_id value in req header is null, userContext will not be initialized"); } - protected void setUserContextFromDB(AuthenticationCookie authenticationCookie) { - String user_id = authenticationCookie.getUserID(); - updateUserContext(user_id); - } - private void updateUserContext(String user_id) { User user = userBusinessLogic.getUser(user_id, false); Set<String> roles = new HashSet<>(Arrays.asList(user.getRole())); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java index d7ccc62c6a..6ef64d4f24 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ForwardingPathUtils.java @@ -25,7 +25,6 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.SetMultimap; import org.apache.commons.collections.CollectionUtils; import org.javatuples.Pair; -import org.openecomp.sdc.be.components.impl.ResponseFormatManager; import org.openecomp.sdc.be.components.merge.instance.DataForMergeHolder; import org.openecomp.sdc.be.datamodel.NameIdPair; import org.openecomp.sdc.be.datamodel.NameIdPairWrapper; @@ -127,10 +126,6 @@ public class ForwardingPathUtils { } - protected ResponseFormatManager getResponseFormatManager() { - return ResponseFormatManager.getInstance(); - } - public Set<String> findForwardingPathNamesToDeleteOnComponentInstanceDeletion(Service containerService, String componentInstanceId) { return findForwardingPathToDeleteOnCIDeletion(containerService, componentInstanceId).values().stream() diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java index 09ac6747f4..bf01436a38 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ServiceVersionInfo.java @@ -20,19 +20,17 @@ package org.openecomp.sdc.be.info; -import com.google.common.annotations.VisibleForTesting; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; @Getter @Setter +@NoArgsConstructor public class ServiceVersionInfo { private String version; private String url; - @VisibleForTesting - ServiceVersionInfo() {} - public ServiceVersionInfo(String serviceName, String serviceVersion, String context) { super(); this.version = serviceVersion; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java index 1b8ed5fab6..ffaf8a8399 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeGenericServlet.java @@ -37,31 +37,21 @@ import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; -import org.openecomp.sdc.be.components.impl.CapabilitiesBusinessLogic; -import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic; import org.openecomp.sdc.be.components.impl.ElementBusinessLogic; import org.openecomp.sdc.be.components.impl.GenericArtifactBrowserBusinessLogic; import org.openecomp.sdc.be.components.impl.InputsBusinessLogic; -import org.openecomp.sdc.be.components.impl.InterfaceOperationBusinessLogic; import org.openecomp.sdc.be.components.impl.OutputsBusinessLogic; import org.openecomp.sdc.be.components.impl.PolicyBusinessLogic; -import org.openecomp.sdc.be.components.impl.ProductBusinessLogic; -import org.openecomp.sdc.be.components.impl.RelationshipTypeBusinessLogic; -import org.openecomp.sdc.be.components.impl.RequirementBusinessLogic; import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; -import org.openecomp.sdc.be.components.lifecycle.LifecycleBusinessLogic; -import org.openecomp.sdc.be.components.scheduledtasks.ComponentsCleanBusinessLogic; -import org.openecomp.sdc.be.components.upgrade.UpgradeBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.DeclarationTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; -import org.openecomp.sdc.be.ecomp.converters.AssetMetadataConverter; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.ComponentInstInputsMap; @@ -196,51 +186,18 @@ public class BeGenericServlet extends BasicServlet { return getClassFromWebAppContext(context, () -> ResourceBusinessLogic.class); } - InterfaceOperationBusinessLogic getInterfaceOperationBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> InterfaceOperationBusinessLogic.class); - } - - protected CapabilitiesBusinessLogic getCapabilitiesBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> CapabilitiesBusinessLogic.class); - } - - protected RelationshipTypeBusinessLogic getRelationshipTypeBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> RelationshipTypeBusinessLogic.class); - } - protected RequirementBusinessLogic getRequirementBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> RequirementBusinessLogic.class); - } - ComponentsCleanBusinessLogic getComponentCleanerBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> ComponentsCleanBusinessLogic.class); - } - protected ServiceBusinessLogic getServiceBL(ServletContext context) { return getClassFromWebAppContext(context, () -> ServiceBusinessLogic.class); } - ProductBusinessLogic getProductBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> ProductBusinessLogic.class); - } - protected ArtifactsBusinessLogic getArtifactBL(ServletContext context) { return getClassFromWebAppContext(context, () -> ArtifactsBusinessLogic.class); } - protected UpgradeBusinessLogic getUpgradeBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> UpgradeBusinessLogic.class); - } protected ElementBusinessLogic getElementBL(ServletContext context) { return getClassFromWebAppContext(context, () -> ElementBusinessLogic.class); } - protected AssetMetadataConverter getAssetUtils(ServletContext context) { - return getClassFromWebAppContext(context, () -> AssetMetadataConverter.class); - } - - protected LifecycleBusinessLogic getLifecycleBL(ServletContext context) { - return getClassFromWebAppContext(context, () -> LifecycleBusinessLogic.class); - } - <T> T getClassFromWebAppContext(final ServletContext context, final Supplier<Class<T>> businessLogicClassGen) { return getWebAppContext(context).getBean(businessLogicClassGen.get()); } @@ -274,28 +231,6 @@ public class BeGenericServlet extends BasicServlet { return new StringBuilder().append("attachment; filename=\"").append(artifactFileName).append("\"").toString(); } - protected ComponentBusinessLogic getComponentBL(ComponentTypeEnum componentTypeEnum, ServletContext context) { - ComponentBusinessLogic businessLogic; - switch (componentTypeEnum) { - case RESOURCE: - businessLogic = getResourceBL(context); - break; - case SERVICE: - businessLogic = getServiceBL(context); - break; - case PRODUCT: - businessLogic = getProductBL(context); - break; - case RESOURCE_INSTANCE: - businessLogic = getResourceBL(context); - break; - default: - BeEcompErrorManager.getInstance().logBeSystemError("getComponentBL"); - throw new IllegalArgumentException("Illegal component type:" + componentTypeEnum.getValue()); - } - return businessLogic; - } - <T> T convertJsonToObjectOfClass(String json, Class<T> clazz) { T object = null; ObjectMapper mapper = new ObjectMapper() diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java index 89456ccca6..fb32038d6e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/BeMonitoringServlet.java @@ -29,22 +29,18 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.servers.Server; -import io.swagger.v3.oas.annotations.servers.Servers; import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.tags.Tags; import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.be.components.health.HealthCheckBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.impl.ComponentsUtils; -import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.api.HealthCheckInfo; import org.openecomp.sdc.common.api.HealthCheckWrapper; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.stereotype.Controller; -import org.springframework.web.context.WebApplicationContext; import javax.inject.Inject; import javax.servlet.ServletContext; @@ -60,14 +56,14 @@ import java.util.List; @Loggable(prepend = true, value = Loggable.TRACE, trim = false) @Path("/") -@Tags({@Tag(name = "SDC Internal APIs")}) -@Servers({@Server(url = "/sdc2/rest")}) +@Tag(name = "SDC Internal APIs") +@Server(url = "/sdc2/rest") @Controller public class BeMonitoringServlet extends BeGenericServlet { - Gson prettyGson = new GsonBuilder().setPrettyPrinting().create(); + private final Gson prettyGson = new GsonBuilder().setPrettyPrinting().create(); - private static final Logger log = Logger.getLogger(ConfigServlet.class); + private static final Logger log = Logger.getLogger(BeMonitoringServlet.class); private final HealthCheckBusinessLogic healthCheckBusinessLogic; @Inject @@ -111,48 +107,9 @@ public class BeMonitoringServlet extends BeGenericServlet { } } - - //TODO remove after UI alignment and tests after API consolidation ASDC-191 - /*@GET - @Path("/version") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "return the ASDC application version", notes = "return the ASDC application version", response = String.class) - @ApiResponses(value = { @ApiResponse(code = 200, message = "return ASDC version"), @ApiResponse(code = 500, message = "Internal Error") }) - public Response getSdcVersion(@Context final HttpServletRequest request) { - try { - String url = request.getMethod() + " " + request.getRequestURI(); - log.debug("Start handle request of {}", url); - - String version = getVersionFromContext(request); - log.debug("asdc version from manifest is: {}", version); - if (version == null || version.isEmpty()) { - return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.ASDC_VERSION_NOT_FOUND)); - } - - HealthCheckInfo versionInfo = new HealthCheckInfo(); - versionInfo.setVersion(version); - - // The response can be either with 200 or 500 aggregate status - the - // body of individual statuses is returned either way - return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), versionInfo); - - } catch (Exception e) { - BeEcompErrorManager.getInstance().logBeRestApiGeneralError("getSDCVersion"); - log.debug("BE get ASDC version unexpected exception", e); - return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); - } - }*/ - private String getVersionFromContext(HttpServletRequest request) { ServletContext servletContext = request.getSession().getServletContext(); return (String) servletContext.getAttribute(Constants.ASDC_RELEASE_VERSION_ATTR); } - private HealthCheckBusinessLogic getHealthCheckBL(ServletContext context) { - WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); - WebApplicationContext webApplicationContext = webApplicationContextWrapper.getWebAppContext(context); - return webApplicationContext.getBean(HealthCheckBusinessLogic.class); - } - } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java index 764213209b..fe802f9534 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/CsarUtils.java @@ -336,7 +336,7 @@ public class CsarUtils { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'"); format.setTimeZone(TimeZone.getTimeZone("UTC")); - //String createDate = format.format(new Date(component.getCreationDate())); + Date date = new Date(); String releaseTime = format.format(date); @@ -1317,9 +1317,6 @@ public class CsarUtils { public Map<String, ArtifactsInfo> getComponentInstancesArtifacts() { return componentInstancesArtifacts; } - public void setComponentInstancesArtifacts(Map<String, ArtifactsInfo> componentInstancesArtifacts) { - this.componentInstancesArtifacts = componentInstancesArtifacts; - } public void addComponentInstancesArtifacts(String normalizedName, ArtifactsInfo artifactsInfo) { componentInstancesArtifacts.put(normalizedName, artifactsInfo); @@ -1350,9 +1347,6 @@ public class CsarUtils { return componentTypeArtifacts; } - public void setComponentTypeArtifacts(Map<String, ComponentTypeArtifacts> componentTypeArtifacts) { - this.componentTypeArtifacts = componentTypeArtifacts; - } } private class CsarDefinition { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java b/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java deleted file mode 100644 index 4698c0eea9..0000000000 --- a/catalog-be/src/test/java/org/openecomp/sdc/TestExternalConfiguration.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc; - -import org.openecomp.sdc.be.config.Configuration; -import org.openecomp.sdc.common.api.BasicConfiguration; -import org.openecomp.sdc.common.api.ConfigurationListener; -import org.openecomp.sdc.common.api.ConfigurationSource; -import org.openecomp.sdc.common.api.FileChangeCallback; -import org.openecomp.sdc.common.impl.ConfigFileChangeListener; -import org.openecomp.sdc.common.impl.ExternalConfiguration; -import org.openecomp.sdc.common.impl.FSConfigurationSource; - -import java.io.IOException; - -public class TestExternalConfiguration<T extends Object> { - - public static void main(String[] args) throws IOException { - - ExternalConfiguration.setAppName("catalog-server"); - ExternalConfiguration.setConfigDir("C:\\Users\\esofer\\workspaceLuna\\catalog-server\\src\\test\\resources\\config"); - ExternalConfiguration.listenForChanges(); - - ConfigurationListener configurationListener = new ConfigurationListener(Configuration.class, new FileChangeCallback() { - - @Override - public void reconfigure(BasicConfiguration obj) { - // TODO Auto-generated method stub - - } - }); - - ConfigurationSource configurationSource1 = new FSConfigurationSource(new ConfigFileChangeListener(), ExternalConfiguration.getConfigDir()); - configurationSource1.getAndWatchConfiguration(Configuration.class, configurationListener); - - try { - Thread.currentThread().sleep(100 * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - -} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformationTest.java index 68c1036575..d3706d3e53 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ActivationRequestInformationTest.java @@ -32,11 +32,6 @@ public class ActivationRequestInformationTest { private static final String WORKLOAD_CONTEXT = "workloadContext"; @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ActivationRequestInformation.class, hasValidGettersAndSetters()); - } - - @Test public void testFullArgConstructor() { Service serviceToActivate = new Service(); ActivationRequestInformation activationRequestInformation = new ActivationRequestInformation(serviceToActivate, diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java index d6995d1750..834964b5a2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogicTest.java @@ -1253,19 +1253,6 @@ public class ArtifactsBusinessLogicTest extends BaseBusinessLogicMock { testSubject.fillArtifactPayload(payloadWrapper, artifactDefinition); } - - - @Test - public void testIsValidXml() throws Exception { - ArtifactsBusinessLogic testSubject; - byte[] xmlToParse = new byte[]{' '}; - boolean result; - - // default test - testSubject = createTestSubject(); - result = Deencapsulation.invoke(testSubject, "isValidXml", new Object[]{xmlToParse}); - } - @Test(expected = ByActionStatusComponentException.class) public void testHeatTimeoutValue() { final ArtifactsBusinessLogic artifactsBusinessLogic = createTestSubject(); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ForwardingPathUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ForwardingPathUtilsTest.java index ee374878e9..19b5949664 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ForwardingPathUtilsTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/impl/ForwardingPathUtilsTest.java @@ -85,17 +85,6 @@ public class ForwardingPathUtilsTest { } @Test - public void testGetResponseFormatManager() { - ForwardingPathUtils testSubject; - ResponseFormatManager result; - - // default test - testSubject = createTestSubject(); - result = Deencapsulation.invoke(testSubject, "getResponseFormatManager"); - assertThat(result).isInstanceOf(ResponseFormatManager.class); - } - - @Test public void testFindForwardingPathNamesToDeleteOnComponentInstanceDeletion() throws Exception { ForwardingPathUtils testSubject; Service containerService = new Service(); |