aboutsummaryrefslogtreecommitdiffstats
path: root/common-app-api/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api/src/main')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java110
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java9
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java9
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java9
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java35
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java7
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java10
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java2
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java1
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnum.java1
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java61
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java10
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java60
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java7
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java1
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestClientServiceExeption.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/HttpRestClientServiceImpl.java39
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java38
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java19
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java5
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java51
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java29
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java1
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java3
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java13
30 files changed, 394 insertions, 184 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
index 96505f4e5d..47fd5a28f7 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
@@ -21,6 +21,7 @@
package org.openecomp.sdc.be.config;
import java.util.Date;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -61,11 +62,14 @@ public class Configuration extends BasicConfiguration {
private Date released;
private String version = "1111";
+ private String toscaConformanceLevel = "3.0";
+ private String minToscaConformanceLevel = "3.0";
private List<String> protocols;
private Map<String, String> users;
private Map<String, Object> neo4j;
private ElasticSearchConfig elasticSearch;
private String titanCfgFile;
+ private String titanMigrationKeySpaceCfgFile;
private Boolean titanInMemoryGraph;
private Long titanLockTimeout;
private Long titanReconnectIntervalInSeconds;
@@ -73,7 +77,8 @@ public class Configuration extends BasicConfiguration {
private Long esReconnectIntervalInSeconds;
private Long uebHealthCheckReconnectIntervalInSeconds;
private Long uebHealthCheckReadTimeout;
-
+ private LinkedList<Map<String, Map<String, String>>> defaultImports;
+
private List<String> resourceTypes;
private List<String> excludeResourceCategory;
private Map<String, Object> deploymentResourceArtifacts;
@@ -81,10 +86,11 @@ public class Configuration extends BasicConfiguration {
private Map<String, Object> toscaArtifacts;
private Map<String, Object> informationalResourceArtifacts;
private Map<String, Object> informationalServiceArtifacts;
- private Map<String, DeploymentArtifactTypeConfig> resourceDeploymentArtifacts;
- private Map<String, DeploymentArtifactTypeConfig> serviceDeploymentArtifacts;
- private Map<String, DeploymentArtifactTypeConfig> resourceInstanceDeploymentArtifacts;
- private Map<String, DeploymentArtifactTypeConfig> resourceInformationalDeployedArtifacts;
+ private Map<String, ArtifactTypeConfig> resourceDeploymentArtifacts;
+ private Map<String, ArtifactTypeConfig> serviceDeploymentArtifacts;
+ private Map<String, ArtifactTypeConfig> resourceInstanceDeploymentArtifacts;
+ private Map<String, ArtifactTypeConfig> resourceInformationalArtifacts;
+ private Map<String, ArtifactTypeConfig> resourceInformationalDeployedArtifacts;
private Map<String, Object> serviceApiArtifacts;
private List<String> excludeServiceCategory;
private Map<String, Set<String>> requirementsToFulfillBeforeCert;
@@ -120,6 +126,18 @@ public class Configuration extends BasicConfiguration {
private ToscaValidatorsConfig toscaValidators;
private boolean disableAudit;
+
+ private Map<String, VfModuleProperty> vfModuleProperties;
+
+ private Map<String, String> genericAssetNodeTypes;
+
+ public Map<String, String> getGenericAssetNodeTypes() {
+ return genericAssetNodeTypes;
+ }
+
+ public void setGenericAssetNodeTypes(Map<String, String> genericAssetNodeTypes) {
+ this.genericAssetNodeTypes = genericAssetNodeTypes;
+ }
public SwitchoverDetectorConfig getSwitchoverDetector() {
return switchoverDetector;
@@ -259,6 +277,14 @@ public class Configuration extends BasicConfiguration {
this.titanCfgFile = titanCfgFile;
}
+ public String getTitanMigrationKeySpaceCfgFile() {
+ return titanMigrationKeySpaceCfgFile;
+ }
+
+ public void setTitanMigrationKeySpaceCfgFile(String titanMigrationKeySpaceCfgFile) {
+ this.titanMigrationKeySpaceCfgFile = titanMigrationKeySpaceCfgFile;
+ }
+
public Boolean getTitanInMemoryGraph() {
return titanInMemoryGraph;
}
@@ -359,28 +385,28 @@ public class Configuration extends BasicConfiguration {
this.serviceApiArtifacts = serviceApiArtifacts;
}
- public Map<String, DeploymentArtifactTypeConfig> getServiceDeploymentArtifacts() {
+ public Map<String, ArtifactTypeConfig> getServiceDeploymentArtifacts() {
return serviceDeploymentArtifacts;
}
- public void setServiceDeploymentArtifacts(Map<String, DeploymentArtifactTypeConfig> serviceDeploymentArtifacts) {
+ public void setServiceDeploymentArtifacts(Map<String, ArtifactTypeConfig> serviceDeploymentArtifacts) {
this.serviceDeploymentArtifacts = serviceDeploymentArtifacts;
}
- public Map<String, DeploymentArtifactTypeConfig> getResourceDeploymentArtifacts() {
+ public Map<String, ArtifactTypeConfig> getResourceDeploymentArtifacts() {
return resourceDeploymentArtifacts;
}
- public void setResourceDeploymentArtifacts(Map<String, DeploymentArtifactTypeConfig> resourceDeploymentArtifacts) {
+ public void setResourceDeploymentArtifacts(Map<String, ArtifactTypeConfig> resourceDeploymentArtifacts) {
this.resourceDeploymentArtifacts = resourceDeploymentArtifacts;
}
public void setResourceInstanceDeploymentArtifacts(
- Map<String, DeploymentArtifactTypeConfig> resourceInstanceDeploymentArtifacts) {
+ Map<String, ArtifactTypeConfig> resourceInstanceDeploymentArtifacts) {
this.resourceInstanceDeploymentArtifacts = resourceInstanceDeploymentArtifacts;
}
- public Map<String, DeploymentArtifactTypeConfig> getResourceInstanceDeploymentArtifacts() {
+ public Map<String, ArtifactTypeConfig> getResourceInstanceDeploymentArtifacts() {
return resourceInstanceDeploymentArtifacts;
}
@@ -779,7 +805,7 @@ public class Configuration extends BasicConfiguration {
}
}
- public static class DeploymentArtifactTypeConfig {
+ public static class ArtifactTypeConfig {
List<String> acceptedTypes;
List<String> validForResourceTypes;
@@ -1149,12 +1175,12 @@ public class Configuration extends BasicConfiguration {
this.artifactsIndex = artifactsIndex;
}
- public Map<String, DeploymentArtifactTypeConfig> getResourceInformationalDeployedArtifacts() {
+ public Map<String, ArtifactTypeConfig> getResourceInformationalDeployedArtifacts() {
return resourceInformationalDeployedArtifacts;
}
public void setResourceInformationalDeployedArtifacts(
- Map<String, DeploymentArtifactTypeConfig> resourceInformationalDeployedArtifacts) {
+ Map<String, ArtifactTypeConfig> resourceInformationalDeployedArtifacts) {
this.resourceInformationalDeployedArtifacts = resourceInformationalDeployedArtifacts;
}
@@ -1230,4 +1256,60 @@ public class Configuration extends BasicConfiguration {
this.disableAudit = enableAudit;
}
+ public Map<String, ArtifactTypeConfig> getResourceInformationalArtifacts() {
+ return resourceInformationalArtifacts;
+ }
+
+ public void setResourceInformationalArtifacts(Map<String, ArtifactTypeConfig> resourceInformationalArtifacts) {
+ this.resourceInformationalArtifacts = resourceInformationalArtifacts;
+ }
+
+ public Map<String, VfModuleProperty> getVfModuleProperties() {
+ return vfModuleProperties;
+ }
+
+ public void setVfModuleProperties(Map<String, VfModuleProperty> vfModuleProperties) {
+ this.vfModuleProperties = vfModuleProperties;
+ }
+
+ public String getToscaConformanceLevel() {
+ return toscaConformanceLevel;
+ }
+
+ public void setToscaConformanceLevel(String toscaConformanceLevel) {
+ this.toscaConformanceLevel = toscaConformanceLevel;
+ }
+
+ public String getMinToscaConformanceLevel() {
+ return minToscaConformanceLevel;
+ }
+
+ public void setMinToscaConformanceLevel(String toscaConformanceLevel) {
+ this.minToscaConformanceLevel = toscaConformanceLevel;
+ }
+
+ public static class VfModuleProperty {
+ private String forBaseModule;
+ private String forNonBaseModule;
+ public String getForBaseModule() {
+ return forBaseModule;
+ }
+ public void setForBaseModule(String forBaseModule) {
+ this.forBaseModule = forBaseModule;
+ }
+ public String getForNonBaseModule() {
+ return forNonBaseModule;
+ }
+ public void setForNonBaseModule(String forNonBaseModule) {
+ this.forNonBaseModule = forNonBaseModule;
+ }
+ }
+
+ public LinkedList<Map<String, Map<String, String>>> getDefaultImports() {
+ return defaultImports;
+ }
+
+ public void setDefaultImports(LinkedList<Map<String, Map<String, String>>> defaultImports) {
+ this.defaultImports = defaultImports;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java
index e4a2092e2f..56e26ce55e 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java
@@ -283,7 +283,8 @@ public class DistributionEngineConfiguration extends BasicConfiguration {
@Override
public String toString() {
- return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount + "]";
+ return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount
+ + "]";
}
}
@@ -357,7 +358,8 @@ public class DistributionEngineConfiguration extends BasicConfiguration {
@Override
public String toString() {
- return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec=" + fetchTimeSec + ", consumerGroup=" + consumerGroup + ", consumerId=" + consumerId + "]";
+ return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec="
+ + fetchTimeSec + ", consumerGroup=" + consumerGroup + ", consumerId=" + consumerId + "]";
}
}
@@ -394,7 +396,8 @@ public class DistributionEngineConfiguration extends BasicConfiguration {
@Override
public String toString() {
- return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds + ", maxThreadPoolSize=" + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
+ return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds
+ + ", maxThreadPoolSize=" + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
index ac7391d8cc..1f036678cf 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
@@ -82,8 +82,7 @@ public class BeMonitoringService {
}
public void start(int interval) {
- Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
- .getConfiguration();
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration();
if (config.getSystemMonitoring().getEnabled()) {
log.info("BE monitoring service is enabled, interval is {} seconds", interval);
this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS);
@@ -95,10 +94,8 @@ public class BeMonitoringService {
private void processMonitoringEvent(MonitoringEvent monitoringMetrics) {
CloseableHttpClient httpClient = null;
try {
- Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
- .getConfiguration();
- String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(),
- config.getBeHttpPort());
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR)).getConfiguration();
+ String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(), config.getBeHttpPort());
httpClient = getHttpClient(config);
HttpPost httpPost = new HttpPost(redirectedUrl);
String monitoringMetricsJson = gson.toJson(monitoringMetrics);
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java
index b7968dc53f..c990d43f64 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java
@@ -25,12 +25,7 @@ import java.util.List;
public enum ArtifactGroupTypeEnum {
- INFORMATIONAL("INFORMATIONAL"),
- DEPLOYMENT("DEPLOYMENT"),
- LIFE_CYCLE("LIFE_CYCLE"),
- SERVICE_API("SERVICE_API"),
- TOSCA("TOSCA"),
- OTHER("OTHER");
+ INFORMATIONAL("INFORMATIONAL"), DEPLOYMENT("DEPLOYMENT"), LIFE_CYCLE("LIFE_CYCLE"), SERVICE_API("SERVICE_API"), TOSCA("TOSCA"), OTHER("OTHER");
private String type;
@@ -56,7 +51,7 @@ public enum ArtifactGroupTypeEnum {
}
public static List<String> getAllTypes() {
- List<String> types = new ArrayList<String>();
+ List<String> types = new ArrayList<>();
for (ArtifactGroupTypeEnum ate : ArtifactGroupTypeEnum.values()) {
types.add(ate.getType());
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
index c0fbad006a..6e7ebc1854 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
@@ -24,29 +24,22 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Enum That Represents possible Artifacts Types.
+ * Enum That Represents possible Artifacts Types.
*
*/
public enum ArtifactTypeEnum {
- CHEF("CHEF"), PUPPET("PUPPET"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), ICON( "ICON"),
- UNKNOWN("UNKNOWN"), HEAT("HEAT"), DG_XML("DG_XML"), MURANO_PKG( "MURANO_PKG"), HEAT_ENV("HEAT_ENV"),
- YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"), HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"),
- NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"), TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"),
- VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"),VENDOR_LICENSE("VENDOR_LICENSE"),
- MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"),
- APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"), HEAT_ARTIFACT("HEAT_ARTIFACT"),
- VF_MODULES_METADATA("VF_MODULES_METADATA"),
- //DCAE Artifacts
- DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"),
- DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"), DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
- DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"),
- DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
- //AAI Artifacts
- AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"),
- AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL")
+ CHEF("CHEF"), PUPPET("PUPPET"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), SHELL("SHELL"), ICON("ICON"), UNKNOWN("UNKNOWN"), HEAT("HEAT"), DG_XML("DG_XML"), MURANO_PKG("MURANO_PKG"), HEAT_ENV("HEAT_ENV"), YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"),
+ HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"), NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"), TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"), VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"), BPEL("BPEL"),
+ VENDOR_LICENSE("VENDOR_LICENSE"), MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"), APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"), HEAT_ARTIFACT("HEAT_ARTIFACT"),
+ VF_MODULES_METADATA("VF_MODULES_METADATA"), LIFECYCLE_OPERATIONS("LIFECYCLE_OPERATIONS"), VES_EVENTS("VES_EVENTS"), PERFORMANCE_COUNTER("PERFORMANCE_COUNTER"),
+ // DCAE Artifacts
+ DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"), DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
+ DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"), DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
+ // AAI Artifacts
+ AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
+ // MIB artifacts
+ SNMP_POLL ("SNMP_POLL"), SNMP_TRAP("SNMP_TRAP"), GUIDE("GUIDE");
- ;
-
ArtifactTypeEnum(String type) {
this.type = type;
}
@@ -63,14 +56,14 @@ public enum ArtifactTypeEnum {
public static ArtifactTypeEnum findType(final String type) {
for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- //According to Pavel/Ella
+ // According to Pavel/Ella
if (ate.getType().equalsIgnoreCase(type)) {
return ate;
}
}
return null;
}
-
+
public static List<String> getAllTypes() {
List<String> types = new ArrayList<String>();
for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
index 673060cb0d..812b148984 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
@@ -62,7 +62,7 @@ public interface Constants {
public static final String SERVICE_ARTIFACT_ID_FORMAT = "%s:%s:%s:%s"; // serviceName:serviceVersion:nodeTemplateName:artifactName
public static final String CONTENT_DISPOSITION = "content-disposition";
public static final String DOWNLOAD_ARTIFACT_LOGIC_ATTR = "downloadArtifactLogic";
- public static final String SDC_RELEASE_VERSION_ATTR = "SDC-Version";
+ public static final String ASDC_RELEASE_VERSION_ATTR = "ASDC-Version";
// public static final String AUDITING_MANAGER = "auditingManager";
// public static final String USER_ADMIN_MANAGER = "userAdminManager";
public static final String YEAR = "year";
@@ -110,7 +110,8 @@ public interface Constants {
public static final String REQUIRED_ARTIFACTS = "requiredArtifacts";
public static final String ABSTRACT = "abstract";
- public static final String GLOBAL_SUBSTITUTION_TYPE_SERVICE_TEMPLATE = "Definitions/GlobalSubstitutionTypesServiceTemplate.yaml";
+ public static final String GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE = "Definitions/GlobalSubstitutionTypesServiceTemplate.yaml";
+ public static final String ABSTRACT_SUBSTITUTE_GLOBAL_TYPES_SERVICE_TEMPLATE = "Definitions/AbstractSubstituteGlobalTypesServiceTemplate.yaml";
public static final String VENDOR_LICENSE_MODEL = "vendor-license-model.xml";
public static final String VENDOR_LICENSE_LABEL = "vendorlicense";
@@ -121,6 +122,7 @@ public interface Constants {
public static final String VF_LICENSE_LABEL = "vflicense";
public static final String VF_LICENSE_DISPLAY_NAME = "VF License";
public static final String VF_LICENSE_DESCRIPTION = "VF license file";
- public static final String ARTIFACTS = "Artifacts/";
public static final String GET_INPUT = "get_input";
+ public static final String SERVICE_TEMPLATE_FILE_POSTFIX = "ServiceTemplate.yaml";
+ public static final String UNBOUNDED = "unbounded";
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java
index 337d5d1b8a..2a6b7e7055 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java
@@ -26,12 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class ResponseInfo {
public static enum ResponseStatusEnum {
- SUCCESS("success"),
- LOGIN_FAILED("loginFailed"),
- INTERNAL_ERROR("internalError"),
- MISSING_HEADERS("required headers are missing"),
- TIMEOUT("timeout"),
- PARSING_ERROR("parsingFailed");
+ SUCCESS("success"), LOGIN_FAILED("loginFailed"), INTERNAL_ERROR("internalError"), MISSING_HEADERS("required headers are missing"), TIMEOUT("timeout"), PARSING_ERROR("parsingFailed");
ResponseStatusEnum(String status) {
this.statusDescription = status;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java
index 9e1734135c..110dbf34a2 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java
@@ -26,8 +26,7 @@ public class UploadArtifactInfo {
}
- public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType,
- String artifactDescription) {
+ public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType, String artifactDescription) {
super();
this.artifactName = artifactName;
this.artifactPath = artifactPath;
@@ -35,8 +34,7 @@ public class UploadArtifactInfo {
this.artifactDescription = artifactDescription;
}
- public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType,
- String artifactDescription, String artifactData) {
+ public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType, String artifactDescription, String artifactData) {
super();
this.artifactName = artifactName;
this.artifactPath = artifactPath;
@@ -139,9 +137,7 @@ public class UploadArtifactInfo {
@Override
public String toString() {
- return "UploadArtifactInfo [artifactName=" + artifactName + ", artifactPath=" + artifactPath + ", artifactType="
- + artifactType + ", artifactDescription=" + artifactDescription + ", artifactData=" + artifactData
- + "]";
+ return "UploadArtifactInfo [artifactName=" + artifactName + ", artifactPath=" + artifactPath + ", artifactType=" + artifactType + ", artifactDescription=" + artifactDescription + ", artifactData=" + artifactData + "]";
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java
index 6d333bf457..a750fa454a 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java
@@ -21,13 +21,7 @@
package org.openecomp.sdc.common.api;
public enum UserRoleEnum {
- ADMIN("ADMIN"),
- DESIGNER("DESIGNER"),
- TESTER("TESTER"),
- GOVERNOR("GOVERNOR"),
- OPS("OPS"),
- PRODUCT_MANAGER("PRODUCT_MANAGER"),
- PRODUCT_STRATEGIST("PRODUCT_STRATEGIST");
+ ADMIN("ADMIN"), DESIGNER("DESIGNER"), TESTER("TESTER"), GOVERNOR("GOVERNOR"), OPS("OPS"), PRODUCT_MANAGER("PRODUCT_MANAGER"), PRODUCT_STRATEGIST("PRODUCT_STRATEGIST");
private String name;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java
index 274625aae4..5051d8e645 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java
@@ -110,7 +110,7 @@ public class EcompErrorLogUtil {
logEcompError("logEcompError", mismatchErrorEnum, false, ecompErrorEnum.name().toString());
return;
} else {
- log.info("Failed to log the error code " + mismatchErrorEnum);
+ log.info("Failed to log the error code {}", mismatchErrorEnum);
return;
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java
index 275339ee20..584a1d8ad1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java
@@ -202,7 +202,6 @@ public class GenerateEcompErrorsCsv {
writer.flush();
writer.close();
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnum.java
index 263d446674..53aa2391d5 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKeysEnum.java
@@ -54,6 +54,7 @@ public enum AuditingFieldsKeysEnum {
AUDIT_RESOURCE_DPREV_STATUS(String.class, "DPREV_STATUS"),
AUDIT_RESOURCE_DCURR_STATUS(String.class, "DCURR_STATUS"),
AUDIT_RESOURCE_TOSCA_NODE_TYPE(String.class, "TOSCA_NODE_TYPE"),
+ AUDIT_RESOURCE_URL(String.class, "RESOURCE_URL"),
// Distribution Engine
AUDIT_DISTRIBUTION_ENVRIONMENT_NAME(String.class, "D_ENV"),
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
index 12ba17baa5..de94358ab4 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
@@ -20,9 +20,13 @@
package org.openecomp.sdc.common.datastructure;
+import java.io.Serializable;
+import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
+import fj.data.Either;
+
/**
* Class For Functional interfaces And Functional Methods
*
@@ -32,9 +36,20 @@ import java.util.function.Supplier;
public class FunctionalInterfaces {
private static final int DEFAULT_REDO_INTERVAL_TIME_MS = 50;
private static final int DEFAULT_MAX_WAIT_TIME_MS = 10000;
+
+ /**
+ * This is an interface of a List that implements Serializable
+ * @author mshitrit
+ *
+ * @param <T>
+ */
+ public interface SerializableList<T> extends List<T> , Serializable {
+ }
/**
* @author mshitrit Consumer that takes two parameters
+ * @param <T1>
+ * @param <T2>
*/
public interface ConsumerTwoParam<T1, T2> {
/**
@@ -48,6 +63,9 @@ public class FunctionalInterfaces {
/**
* @author mshitrit Function that takes two parameters
+ * @param <T1>
+ * @param <T2>
+ * @param <R>
*/
public interface FunctionTwoParam<T1, T2, R> {
/**
@@ -62,6 +80,9 @@ public class FunctionalInterfaces {
/**
* @author mshitrit Function that throws an exception
+ * @param <T>
+ * @param <R>
+ * @param <E>
*/
public interface FunctionThrows<T, R, E extends Exception> {
/**
@@ -75,6 +96,8 @@ public class FunctionalInterfaces {
/**
* @author mshitrit Supplier that throws an exception
+ * @param <R>
+ * @param <E>
*/
public interface SupplierThrows<R, E extends Exception> {
/**
@@ -88,6 +111,8 @@ public class FunctionalInterfaces {
/**
* @author mshitrit Consumer that throws an exception
+ * @param <T>
+ * @param <E>
*/
public interface ConsumerThrows<T, E extends Exception> {
/**
@@ -101,6 +126,7 @@ public class FunctionalInterfaces {
/**
* @author mshitrit Runnable that throws an exception
+ * @param <E>
*/
public interface RunnableThrows<E extends Exception> {
/**
@@ -279,4 +305,39 @@ public class FunctionalInterfaces {
}
+ /**
+ * Converts Either containing right value to another either with different
+ * type of left value and the same type of right value.
+ *
+ * @param eitherToConvert
+ * @return
+ */
+ public static <T1,T2,T3> Either<T1,T2> convertEitherRight(Either<T3,T2> eitherToConvert){
+ if( eitherToConvert.isLeft() ){
+ throw new UnsupportedOperationException("Can not convert either right value because it has left value");
+ }
+ else{
+ return Either.right(eitherToConvert.right().value());
+ }
+
+
+ }
+
+ /**
+ * Converts Either containing left value to another either with different
+ * type of right value and the same type of left value.
+ *
+ * @param eitherToConvert
+ * @return
+ */
+ public static <T1,T2,T3> Either<T1,T2> convertEitherLeft(Either<T1,T3> eitherToConvert){
+ if( eitherToConvert.isLeft() ){
+ throw new UnsupportedOperationException("Can not convert either left value because it has right value");
+ }
+ else{
+ return Either.left(eitherToConvert.left().value());
+ }
+
+ }
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
index 9b5debb53a..9364dad476 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
@@ -62,15 +62,13 @@ public class ConfigFileChangeListener extends FileChangeListener {
Class<? extends BasicConfiguration> configClass = configurationListener.getType();
- BasicConfiguration basicConfiguration = yamlToObjectConverter
- .convert(pFile.getAbsolutePath(), configClass);
+ BasicConfiguration basicConfiguration = yamlToObjectConverter.convert(pFile.getAbsolutePath(), configClass);
if (basicConfiguration == null) {
- log.warn(
- "Cannot update the listeners for file Change since the file content is invalid");
+ log.warn("Cannot update the listeners for file Change since the file content is invalid");
continue;
}
- log.debug("Loaded configuration after converting is " + basicConfiguration);
+ log.debug("Loaded configuration after converting is {}", basicConfiguration);
// System.out.println("New configuration is " +
// basicConfiguration);
@@ -80,7 +78,7 @@ public class ConfigFileChangeListener extends FileChangeListener {
}
} else {
- log.warn("Cannot calculate id from file " + pFile.getName());
+ log.warn("Cannot calculate id from file {}", pFile.getName());
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java
index 76f64ca278..a800305958 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java
@@ -45,14 +45,11 @@ public class FSConfigurationSource implements ConfigurationSource {
}
/*
- * get and watch configuration changes. The file name we looking for is the
- * lower case of the class name separated by "-".
+ * get and watch configuration changes. The file name we looking for is the lower case of the class name separated by "-".
*
* (non-Javadoc)
*
- * @see
- * org.openecomp.sdc.common.api.ConfigurationSource#getAndWatchConfiguration
- * (java.lang.Class, org.openecomp.sdc.common.api.ConfigurationListener)
+ * @see org.openecomp.sdc.common.api.ConfigurationSource#getAndWatchConfiguration (java.lang.Class, org.openecomp.sdc.common.api.ConfigurationListener)
*/
public <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
@@ -80,9 +77,7 @@ public class FSConfigurationSource implements ConfigurationSource {
}
/**
- * convert camel case string to list of words separated by "-" where each
- * word is in lower case format. For example, MyClass will be calculated to
- * be my-class.yaml .
+ * convert camel case string to list of words separated by "-" where each word is in lower case format. For example, MyClass will be calculated to be my-class.yaml .
*
* @param className
* @return file name based on the class name
@@ -112,8 +107,7 @@ public class FSConfigurationSource implements ConfigurationSource {
return builder.toString() + Constants.YAML_SUFFIX;
/*
- * } else { return className.getSimpleName().toLowerCase() +
- * Constants.YAML_SUFFIX; }
+ * } else { return className.getSimpleName().toLowerCase() + Constants.YAML_SUFFIX; }
*/
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java b/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java
new file mode 100644
index 0000000000..8f94d8042c
--- /dev/null
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java
@@ -0,0 +1,60 @@
+package org.openecomp.sdc.common.jsongraph.util;
+
+import org.slf4j.Logger;
+
+/**
+ * Provides common utility: functionality, common fields and enumerations
+ *
+ */
+public class CommonUtility {
+ /**
+ * Provides list of logging level names
+ *
+ */
+ public enum LogLevelEnum {
+ ERROR,
+ WARNING,
+ INFO,
+ DEBUG,
+ TRACE,
+ }
+ /**
+ * Adds received message to log according to level in case if specified level is enabled
+ * @param logger
+ * @param logLevel
+ * @param format
+ * @param arguments
+ */
+ public static void addRecordToLog(Logger logger, LogLevelEnum logLevel, String format, Object... arguments ){
+ switch(logLevel){
+ case ERROR:
+ if(logger.isErrorEnabled()){
+ logger.error(format, arguments);
+ }
+ break;
+ case WARNING:
+ if(logger.isWarnEnabled()){
+ logger.warn(format, arguments);
+ }
+ break;
+ case INFO:
+ if(logger.isInfoEnabled()){
+ logger.info(format, arguments);
+ }
+ break;
+ case DEBUG:
+ if(logger.isDebugEnabled()){
+ logger.debug(format, arguments);
+ }
+ break;
+ case TRACE:
+ if(logger.isTraceEnabled()){
+ logger.trace(format, arguments);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java
index 3f588e8aa2..45976c42d1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java
@@ -62,7 +62,8 @@ public class AppContextListener implements ServletContextListener {
String appConfigDir = configHome + File.separator + appName;
// ChangeListener changeListener = new ChangeListener();
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir);
+ ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+ appConfigDir);
context.getServletContext().setAttribute(Constants.CONFIGURATION_SOURCE_ATTR, configurationSource);
@@ -78,7 +79,8 @@ public class AppContextListener implements ServletContextListener {
ExternalConfiguration.stopListenForFileChanges();
}
- private String setAndGetAttributeInContext(ServletContextEvent context, Map<String, String> manifestAttr, String attr) {
+ private String setAndGetAttributeInContext(ServletContextEvent context, Map<String, String> manifestAttr,
+ String attr) {
String name = manifestAttr.get(attr);
if (name != null) {
@@ -116,7 +118,6 @@ public class AppContextListener implements ServletContextListener {
try {
inputStream.close();
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java
index 61651f3ddc..8d96dbd61c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java
@@ -24,8 +24,7 @@ import org.openecomp.sdc.common.datastructure.ESTimeBasedEvent;
public class MonitoringEvent extends ESTimeBasedEvent {
- private static String MONITORING_EVENT_TEMPLATE = "hostid=\"%s\" hostcpu=\"%s\" hostmem=\"%s\" hostdisk=\"%s\" "
- + "jvmid=\"%s\" jvmcpu=\"%s\" jvmmem=\"%s\" jvmtnum=\"%s\" " + "appid=\"%s\" appstat=\"%s\"";
+ private static String MONITORING_EVENT_TEMPLATE = "hostid=\"%s\" hostcpu=\"%s\" hostmem=\"%s\" hostdisk=\"%s\" " + "jvmid=\"%s\" jvmcpu=\"%s\" jvmmem=\"%s\" jvmtnum=\"%s\" " + "appid=\"%s\" appstat=\"%s\"";
private String hostid;
private Long hostcpu;
@@ -120,7 +119,6 @@ public class MonitoringEvent extends ESTimeBasedEvent {
@Override
public String toString() {
- return getFormattedString(MONITORING_EVENT_TEMPLATE, hostid, hostcpu, hostmem, hostdisk, jvmid, jvmcpu, jvmmem,
- jvmtnum, appid, appstat);
+ return getFormattedString(MONITORING_EVENT_TEMPLATE, hostid, hostcpu, hostmem, hostdisk, jvmid, jvmcpu, jvmmem, jvmtnum, appid, appstat);
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java
index 9df1aea983..e5c62d4772 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java
@@ -79,7 +79,6 @@ public class MonitoringMetricsFetcher {
monitoringEvent.setAppid(appName);
// this is probably from healthcheck
- // TODO
monitoringEvent.setAppstat("appStatus");
return monitoringEvent;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestClientServiceExeption.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestClientServiceExeption.java
index b64b651913..6f652cc8a4 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestClientServiceExeption.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestClientServiceExeption.java
@@ -67,12 +67,10 @@ public class RestClientServiceExeption extends Exception {
*
* @param response
*
- * public RSClientServiceExeption(ClientResponse response) {
- * super(); this.response = response; }
+ * public RSClientServiceExeption(ClientResponse response) { super(); this.response = response; }
*
* public ClientResponse getResponse() { return response; }
*
- * public void setResponse(ClientResponse response) {
- * this.response = response; }
+ * public void setResponse(ClientResponse response) { this.response = response; }
*/
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/HttpRestClientServiceImpl.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/HttpRestClientServiceImpl.java
index 7175b41943..eed083ab68 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/HttpRestClientServiceImpl.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/HttpRestClientServiceImpl.java
@@ -94,7 +94,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
boolean initialized = false;
- logger.debug("HttpRestClientServiceImpl::init - start. restConfigurationInfo=" + restConfigurationInfo);
+ logger.debug("HttpRestClientServiceImpl::init - start. restConfigurationInfo= {}", restConfigurationInfo);
try {
createHttpClient(restConfigurationInfo);
@@ -124,8 +124,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
}
- private void createHttpClient(RestConfigurationInfo restConfigurationInfo)
- throws KeyManagementException, NoSuchAlgorithmException {
+ private void createHttpClient(RestConfigurationInfo restConfigurationInfo) throws KeyManagementException, NoSuchAlgorithmException {
PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
@@ -141,10 +140,8 @@ public class HttpRestClientServiceImpl implements IRestClient {
this.httpClient = new DefaultHttpClient(cm);
- int timeoutInSec = restConfigurationInfo.getReadTimeoutInSec() == null ? 0
- : restConfigurationInfo.getReadTimeoutInSec();
- int connectTimeoutInSec = restConfigurationInfo.getConnectTimeoutInSec() == null ? DEFAULT_CONNECT_TIMEOUT
- : restConfigurationInfo.getConnectTimeoutInSec();
+ int timeoutInSec = restConfigurationInfo.getReadTimeoutInSec() == null ? 0 : restConfigurationInfo.getReadTimeoutInSec();
+ int connectTimeoutInSec = restConfigurationInfo.getConnectTimeoutInSec() == null ? DEFAULT_CONNECT_TIMEOUT : restConfigurationInfo.getConnectTimeoutInSec();
HttpParams params = new BasicHttpParams();
params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeoutInSec * 1000);
params.setParameter(CoreConnectionPNames.SO_TIMEOUT, timeoutInSec * 1000);
@@ -212,14 +209,12 @@ public class HttpRestClientServiceImpl implements IRestClient {
protected SSLSocketFactory createSSLSocketFactory() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager easyTrustManager = new javax.net.ssl.X509TrustManager() {
- public void checkClientTrusted(java.security.cert.X509Certificate[] arg0, String arg1)
- throws CertificateException {
+ public void checkClientTrusted(java.security.cert.X509Certificate[] arg0, String arg1) throws CertificateException {
// TODO Auto-generated method stub
}
- public void checkServerTrusted(java.security.cert.X509Certificate[] arg0, String arg1)
- throws CertificateException {
+ public void checkServerTrusted(java.security.cert.X509Certificate[] arg0, String arg1) throws CertificateException {
// TODO Auto-generated method stub
}
@@ -271,7 +266,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
* @return String
*/
public RestResponse doGET(String uri, Properties headers) {
- logger.debug("Before executing uri " + uri + ". headers = " + headers);
+ logger.debug("Before executing uri {}. headers = {}", uri, headers);
HttpGet httpGet = new HttpGet(uri);
@@ -292,8 +287,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
public RestResponse doPOST(String uri, Properties headers, Object objectToCreate) {
- logger.debug("Before executing uri " + uri + ". body = "
- + (objectToCreate != null ? objectToCreate.toString() : null) + ". headers = " + headers);
+ logger.debug("Before executing uri {}. body = {}. headers = {}", uri, (objectToCreate != null ? objectToCreate.toString() : null), headers);
HttpPost httpPost = new HttpPost(uri);
@@ -321,8 +315,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
public RestResponse doPUT(String uri, Properties headers, Object objectToCreate) {
- logger.debug("Before executing uri " + uri + ". body = "
- + (objectToCreate != null ? objectToCreate.toString() : null) + ". headers = " + headers);
+ logger.debug("Before executing uri {}. body = {}. headers = {}", uri, (objectToCreate != null ? objectToCreate.toString() : null), headers);
HttpPut httpPut = new HttpPut(uri);
@@ -373,8 +366,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
} catch (Exception exception) {
httpRequestBase.abort();
- log.error("Failed to execute the " + httpRequestBase.getMethod() + " request " + httpRequestBase.getURI(),
- exception);
+ log.error("Failed to execute the {} request {}", httpRequestBase.getMethod(), httpRequestBase.getURI(), exception);
// processAndThrowException(exception);
return null;
}
@@ -384,7 +376,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
if (logger.isDebugEnabled()) {
URI uri = httpRequestBase.getURI();
String url = uri.toString();
- logger.debug("After executing uri " + url + ". response = " + restResponse);
+ logger.debug("After executing uri {}. response = {}", url, restResponse);
}
return restResponse;
@@ -393,7 +385,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
public RestResponse doDELETE(String uri, Properties headers) {
if (logger.isDebugEnabled()) {
- logger.debug("Before executing uri " + uri + ". headers = " + headers);
+ logger.debug("Before executing uri {}. headers = {}", uri, headers);
}
HttpDelete httpDelete = new HttpDelete(uri);
@@ -413,12 +405,11 @@ public class HttpRestClientServiceImpl implements IRestClient {
* name of method
*/
private void logResponse(String response, String method) {
- logger.debug(method + " response = " + response);
+ logger.debug("{} response = {}", method, response);
}
/**
- * Exception during client invocation usually it happens when status code
- * starting with 400 or 500 is returned
+ * Exception during client invocation usually it happens when status code starting with 400 or 500 is returned
*
* @param exception
* Exception
@@ -427,7 +418,7 @@ public class HttpRestClientServiceImpl implements IRestClient {
private void processAndThrowException(Exception exception) throws RestClientServiceExeption {
logger.debug("\n------------------------");
- logger.debug("FAILURE: " + exception.getMessage());
+ logger.debug("FAILURE: {}", exception.getMessage());
throw new RestClientServiceExeption(exception);
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
index 5e2ff37735..18ec011868 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
@@ -37,7 +37,7 @@ public class RequestHeadersValidator {
public static void validateContentType(HttpServletRequest request, MediaType expectedContentType,
Map<String, String> headersMap) throws RestRequestValidationException {
- log.debug("validateContentType - expected: " + expectedContentType);
+ log.debug("validateContentType - expected: {}", expectedContentType);
if (request == null || expectedContentType == null) {
throw new RestRequestValidationException("request or media-type are null");
}
@@ -58,9 +58,9 @@ public class RequestHeadersValidator {
String headerVal = request.getHeader(requiredHeader);
if (headerVal != null && !headerVal.isEmpty()) {
headersMap.put(requiredHeader, headerVal);
- log.debug("found header - " + requiredHeader + ": " + headerVal);
+ log.debug("found header - {} : {}", requiredHeader, headerVal);
} else {
- log.error("missing identification header: " + requiredHeader);
+ log.error("missing identification header: {}", requiredHeader);
throw new RestRequestValidationException("missing identification header: " + requiredHeader);
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
index 0c62b03d14..c89eeaf535 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
@@ -40,11 +40,21 @@ public class GeneralUtility {
}
return isSuccessfull;
}
-
+
+ /**
+ * Use with care, usage is not advised!!!
+ * The method only checks if String does not contain special characters + length divided by 4 with no remainder.
+ * The methods contained in other common libraries do the same.
+ */
public static boolean isBase64Encoded(byte[] data) {
return Base64.isBase64(data);
}
-
+
+ /**
+ *Use with care, usage is not advised!!!
+ * The method only checks if String does not contain special characters + length divided by 4 with no remainder.
+ * The methods contained in other common libraries do the same.
+ */
public static boolean isBase64Encoded(String str) {
boolean isEncoded = false;
try {
@@ -66,8 +76,8 @@ public class GeneralUtility {
/**
* Checks whether the passed string exceeds a limit of number of characters.
*
- * @param str str
- * @param limit limit
+ * @param str
+ * @param limit
* @return the result of comparison, or false if str is null.
*/
public static boolean isExceedingLimit(String str, int limit) {
@@ -78,14 +88,12 @@ public class GeneralUtility {
}
/**
- * Checks the passed string list whether the cumulative length of strings
- * and delimiters between them exceeds a limit of number of characters. For
- * example for list ("one","two","three") with delimiter "," the length of
- * list is calculated 3+1+3+1+5=13
+ * Checks the passed string list whether the cumulative length of strings and delimiters between them exceeds a limit of number of characters. For example for list ("one","two","three") with delimiter "," the length of list is calculated
+ * 3+1+3+1+5=13
*
- * @param strList strList
- * @param limit Limit
- * @param delimiterLength delimiterLength
+ * @param strList
+ * @param limit
+ * @param delimiterLength
* - 0 if there is no delimeter.
* @return the result of comparison, or false if strList is null.
*/
@@ -110,11 +118,9 @@ public class GeneralUtility {
}
/**
- * Return the extension as the substring from the last dot. For input
- * "kuku.txt", "txt" will be returned. If no dot is found or input is null,
- * empty string is returned.
+ * Return the extension as the substring from the last dot. For input "kuku.txt", "txt" will be returned. If no dot is found or input is null, empty string is returned.
*
- * @param fileName fileName
+ * @param fileName
* @return extension
*/
public static String getFilenameExtension(String fileName) {
@@ -137,7 +143,7 @@ public class GeneralUtility {
/**
*
- * @param data data
+ * @param data
* @return
*/
public static String calculateMD5ByString(String data) {
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java
new file mode 100644
index 0000000000..3dd313b824
--- /dev/null
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java
@@ -0,0 +1,19 @@
+package org.openecomp.sdc.common.util;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class PairUtils {
+
+ public static <L, R> List<L> leftSequence(List<ImmutablePair<L, R>> pairs) {
+ return pairs.stream().map(Pair::getLeft).collect(Collectors.toList());
+ }
+
+ public static <L, R> List<R> rightSequence(List<Pair<L, R>> pairs) {
+ return pairs.stream().map(Pair::getRight).collect(Collectors.toList());
+ }
+
+}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java
index ee2895f9fa..4574d3ff86 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java
@@ -77,9 +77,8 @@ public class SerializationUtils {
T castObject = clazz.cast(object);
return Either.left(castObject);
} catch (Exception e) {
- log.debug("Failed to deserialize object of type " + clazz + " and uid " + componentName, e);
- BeEcompErrorManager.getInstance().logInternalUnexpectedError("DeserializeObjectFromCache",
- "Failed to deserialize object of type " + clazz, ErrorSeverity.WARNING);
+ log.debug("Failed to deserialize object of type {} and uid {}",clazz,componentName, e);
+ BeEcompErrorManager.getInstance().logInternalUnexpectedError("DeserializeObjectFromCache", "Failed to deserialize object of type " + clazz, ErrorSeverity.WARNING);
return Either.right(false);
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java
index b2b0344b39..3ea780a7f9 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java
@@ -40,34 +40,40 @@ import com.google.common.base.CharMatcher;
public class ValidationUtils {
public final static Integer COMPONENT_NAME_MAX_LENGTH = 1024;
- public final static Pattern COMPONENT_NAME_PATTERN = Pattern.compile("^[\\w \\.\\-\\_\\:\\+]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
+ public final static Pattern COMPONENT_NAME_PATTERN = Pattern
+ .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH-1) + "}$");
public final static Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
- public final static Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern.compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
+ public final static Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern
+ .compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
public final static Integer RSI_NAME_MAX_LENGTH = 1024;
- public final static Pattern RSI_NAME_PATTERN = Pattern.compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
+ public final static Pattern RSI_NAME_PATTERN = Pattern
+ .compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
public final static Integer COMMENT_MAX_LENGTH = 256;
public final static Integer ICON_MAX_LENGTH = 25;
public final static Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
- public final static Integer PROJECT_CODE_MAX_LEGTH = 10;
- //public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\d]{5," + PROJECT_CODE_MAX_LEGTH + "}$");
- public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
- public final static Integer CONNTACT_ID_MAX_LENGTH = 6;
- // Format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
- //public final static Pattern CONTACT_ID_PATTERN = Pattern.compile("[mM]{1}[0-9]{5}|[a-zA-Z]{2}[0-9]{4}|[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{1}");
+ public final static Integer PROJECT_CODE_MAX_LEGTH = 50;
+ public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
+
+ // USER_ID format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
+ public final static Integer CONNTACT_ID_MAX_LENGTH = 50;
+// public final static Pattern CONTACT_ID_PATTERN = Pattern
+// .compile("[mM]{1}[0-9]{5}|[a-zA-Z]{2}[0-9]{4}|[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{1}");
public final static Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
public final static Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
public final static Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
- public final static Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");
+ public final static Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");// ,#?&@$<>~^`\\[]{}|")(*!
public final static Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
public final static Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
public final static Integer TAG_MAX_LENGTH = 1024;
public final static Integer TAG_LIST_MAX_LENGTH = 1024;
public final static Integer VENDOR_NAME_MAX_LENGTH = 25;
- public final static Pattern VENDOR_NAME_PATTERN = Pattern.compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
+ public final static Pattern VENDOR_NAME_PATTERN = Pattern
+ .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
public final static Integer VENDOR_RELEASE_MAX_LENGTH = 25;
- public final static Pattern VENDOR_RELEASE_PATTERN = Pattern.compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
+ public final static Pattern VENDOR_RELEASE_PATTERN = Pattern
+ .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
public final static Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
@@ -83,11 +89,13 @@ public class ValidationUtils {
public final static Pattern COLON_PATTERN = Pattern.compile("[:]+");
public final static Pattern AT_PATTERN = Pattern.compile("[@]+");
public final static Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
- public final static Set<String> CATEGORY_CONJUNCTIONS = new HashSet<String>(Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
+ public final static Set<String> CATEGORY_CONJUNCTIONS = new HashSet<String>(
+ Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
public final static Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
public final static Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-+]+$");
- public final static Integer ARTIFACT_LABEL_LENGTH = 25;
+ public final static Integer ARTIFACT_LABEL_LENGTH = 255;
+ public final static Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
public final static Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
public final static Integer CATEGORY_LABEL_MIN_LENGTH = 4;
public final static Integer CATEGORY_LABEL_MAX_LENGTH = 25;
@@ -118,6 +126,10 @@ public class ValidationUtils {
public static boolean validateArtifactLabel(String label) {
return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
}
+
+ public static boolean validateArtifactDisplayName(String displayName) {
+ return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
+ }
public static boolean validateCategoryDisplayNameFormat(String label) {
boolean res = true;
@@ -171,11 +183,13 @@ public class ValidationUtils {
}
public static boolean validateCategoryDisplayNameLength(String label) {
- return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
+ return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH
+ && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
}
public static boolean validateProductFullNameLength(String fullName) {
- return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
+ return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH
+ && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
}
public static boolean validateArtifactLabelLength(String label) {
@@ -291,7 +305,7 @@ public class ValidationUtils {
}
public static boolean validateStringNotEmpty(String value) {
- if ((value == null) || (value.trim().isEmpty())) {
+ if ((value == null) || (value.isEmpty())) {
return false;
}
return true;
@@ -334,7 +348,7 @@ public class ValidationUtils {
}
- public static String normaliseComponentInstanceName(String name) {
+ public static String normalizeComponentInstanceName(String name) {
String[] split = splitComponentInctanceName(name);
StringBuffer sb = new StringBuffer();
for (String splitElement : split) {
@@ -421,6 +435,7 @@ public class ValidationUtils {
str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
str = PLUS_PATTERN.matcher(str).replaceAll("");
str = SPACE_PATTERN.matcher(str).replaceAll("");
+ str = DOT_PATTERN.matcher(str).replaceAll("");
str = str.toLowerCase();
return str;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
index 75ac208432..242d74a9ca 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
@@ -30,17 +30,17 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
-import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheConfig;
import org.openecomp.sdc.be.config.Configuration.ApplicationL2CacheConfig;
+import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig;
import org.openecomp.sdc.be.config.Configuration.BeMonitoringConfig;
-import org.openecomp.sdc.be.config.Configuration.DeploymentArtifactTypeConfig;
import org.openecomp.sdc.be.config.Configuration.EcompPortalConfig;
import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig;
+import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig.IndicesTimeFrequencyEntry;
import org.openecomp.sdc.be.config.Configuration.OnboardingConfig;
import org.openecomp.sdc.be.config.Configuration.SwitchoverDetectorConfig;
import org.openecomp.sdc.be.config.Configuration.ToscaValidatorsConfig;
-import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig.IndicesTimeFrequencyEntry;
+import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.ComponentArtifactTypesConfig;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.CreateTopicConfig;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionNotificationTopicConfig;
@@ -102,9 +102,9 @@ public class YamlToObjectConverter {
// resourceDeploymentArtifacts and serviceDeploymentArtifacts
beConfDescription.putMapPropertyType("resourceDeploymentArtifacts", String.class,
- DeploymentArtifactTypeConfig.class);
+ ArtifactTypeConfig.class);
beConfDescription.putMapPropertyType("serviceDeploymentArtifacts", String.class,
- DeploymentArtifactTypeConfig.class);
+ ArtifactTypeConfig.class);
// onboarding
beConfDescription.putListPropertyType("onboarding", OnboardingConfig.class);
@@ -158,7 +158,7 @@ public class YamlToObjectConverter {
config = convert(fullFileName, className);
} catch (Exception e) {
- log.error("Failed to convert yaml file " + configFileName + " to object.", e);
+ log.error("Failed to convert yaml file {} to object.", configFileName,e);
}
return config;
@@ -214,13 +214,13 @@ public class YamlToObjectConverter {
// System.out.println(config.toString());
} catch (Exception e) {
- log.error("Failed to convert yaml file " + fullFileName + " to object.", e);
+ log.error("Failed to convert yaml file {} to object.", fullFileName, e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
- // TODO Auto-generated catch block
+ log.debug("Failed to close input stream {} ", e.getMessage(), e);
e.printStackTrace();
}
}
@@ -249,7 +249,7 @@ public class YamlToObjectConverter {
try {
in.close();
} catch (IOException e) {
- // TODO Auto-generated catch block
+ log.debug("Failed to close input stream {} ", e.getMessage(), e);
e.printStackTrace();
}
}
@@ -258,11 +258,14 @@ public class YamlToObjectConverter {
return config;
}
+ public boolean isValidYamlEncoded64(byte[] fileContents) {
+ log.trace("Received Base64 data - decoding before validating...");
+ byte[] decodedFileContents = Base64.decodeBase64(fileContents);
+
+ return isValidYaml(decodedFileContents);
+ }
+
public boolean isValidYaml(byte[] fileContents) {
- if (Base64.isBase64(fileContents)) {
- log.trace("Received Base64 data - decoding before validating...");
- fileContents = Base64.decodeBase64(fileContents);
- }
try {
Map<String, Object> mappedToscaTemplate = (Map<String, Object>) defaultYaml
.load(new ByteArrayInputStream(fileContents));
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
index ac25c40cf7..386a66bafe 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
@@ -121,7 +121,6 @@ public class ZipUtil {
ZipUtil.readZip(zipAsBytes);
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java
index 5ccbc25d0e..9058647bdb 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java
@@ -20,6 +20,8 @@
package org.openecomp.sdc.exception;
+import javax.ws.rs.core.Response;
+
/**
* Nested POJOs to express required JSON format of the error
*
@@ -188,4 +190,5 @@ public class ResponseFormat {
public String toString() {
return "ResponseFormat[" + "status=" + status + ", requestErrorWrapper=" + requestErrorWrapper + ']';
}
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java
index 89953d671e..a8420a4834 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java
@@ -48,7 +48,7 @@ public class Configuration extends BasicConfiguration {
private Integer healthCheckSocketTimeoutInMs;
private Integer healthCheckIntervalInSeconds;
-
+
private FeMonitoringConfig systemMonitoring;
private String kibanaHost;
@@ -114,7 +114,7 @@ public class Configuration extends BasicConfiguration {
public void setHealthCheckIntervalInSeconds(Integer healthCheckInterval) {
this.healthCheckIntervalInSeconds = healthCheckInterval;
}
-
+
/**
* be http context
*/
@@ -134,6 +134,7 @@ public class Configuration extends BasicConfiguration {
private List<List<String>> identificationHeaderFields;
private List<List<String>> optionalHeaderFields;
+ private List<String> forwardHeaderFields;
public Date getReleased() {
return released;
@@ -239,6 +240,14 @@ public class Configuration extends BasicConfiguration {
this.optionalHeaderFields = optionalHeaderFields;
}
+ public List<String> getForwardHeaderFields() {
+ return forwardHeaderFields;
+ }
+
+ public void setForwardHeaderFields(List<String> forwardHeaderFields) {
+ this.forwardHeaderFields = forwardHeaderFields;
+ }
+
public String getFeFqdn() {
return feFqdn;
}