diff options
Diffstat (limited to 'common-app-api/src/main/java')
6 files changed, 92 insertions, 10 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 7d37de7965..c962500c2b 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 @@ -82,6 +82,7 @@ public class Configuration extends BasicConfiguration { private List<String> resourceTypes; private List<String> excludeResourceCategory; + private List<String> excludeResourceType; private Map<String, Object> deploymentResourceArtifacts; private Map<String, Object> deploymentResourceInstanceArtifacts; private Map<String, Object> toscaArtifacts; @@ -361,6 +362,15 @@ public class Configuration extends BasicConfiguration { public void setExcludeResourceCategory(List<String> excludeResourceCategory) { this.excludeResourceCategory = excludeResourceCategory; } + + public List<String> getExcludeResourceType() { + return excludeResourceType; + } + + public void setExcludeResourceType(List<String> excludeResourceType) { + this.excludeResourceType = excludeResourceType; + } + public Map<String, Object> getToscaArtifacts() { return toscaArtifacts; @@ -842,6 +852,7 @@ public class Configuration extends BasicConfiguration { String host; Integer port; String downloadCsarUri; + String healthCheckUri; public String getProtocol() { return protocol; @@ -875,6 +886,14 @@ public class Configuration extends BasicConfiguration { this.downloadCsarUri = downloadCsarUri; } + public String getHealthCheckUri() { + return healthCheckUri; + } + + public void setHealthCheckUri(String healthCheckUri) { + this.healthCheckUri = healthCheckUri; + } + @Override public String toString() { return "OnboardingConfig [protocol=" + protocol + ", host=" + host + ", port=" + port + ", downloadCsarUri=" 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 04640e7fc7..fcde7f13ac 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 @@ -125,5 +125,6 @@ public interface Constants { public static final String VF_LICENSE_DESCRIPTION = "VF license file"; public static final String GET_INPUT = "get_input"; public static final String SERVICE_TEMPLATE_FILE_POSTFIX = "ServiceTemplate.yaml"; + public static final String SERVICE_TEMPLATES_CONTAINING_FOLDER = "Definitions/"; public static final String UNBOUNDED = "unbounded"; } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java index 653b8b0866..2e4f54f153 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java @@ -20,12 +20,19 @@ package org.openecomp.sdc.common.api; +import java.lang.reflect.Type; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + public class HealthCheckInfo { private HealthCheckComponent healthCheckComponent; private HealthCheckStatus healthCheckStatus; private String version; private String description; + private List<HealthCheckInfo> componentsInfo; public HealthCheckInfo(HealthCheckComponent healthCheckComponent, HealthCheckStatus healthCheckStatus, String version, String description) { @@ -36,6 +43,16 @@ public class HealthCheckInfo { this.description = description; } + public HealthCheckInfo(HealthCheckComponent healthCheckComponent, HealthCheckStatus healthCheckStatus, + String version, String description, List<HealthCheckInfo> componentsInfo) { + super(); + this.healthCheckComponent = healthCheckComponent; + this.healthCheckStatus = healthCheckStatus; + this.version = version; + this.description = description; + this.componentsInfo = componentsInfo; + } + public HealthCheckInfo() { super(); } @@ -48,6 +65,14 @@ public class HealthCheckInfo { return healthCheckStatus; } + public List<HealthCheckInfo> getComponentsInfo() { + return componentsInfo; + } + + public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) { + this.componentsInfo = componentsInfo; + } + public String getVersion() { return version; } @@ -61,7 +86,8 @@ public class HealthCheckInfo { } public enum HealthCheckComponent { - FE, BE, TITAN, ES, DE; + FE, BE, TITAN, DE, ON_BOARDING, CASSANDRA, + CAS, ZU;//Amdocs components } public enum HealthCheckStatus { @@ -71,6 +97,14 @@ public class HealthCheckInfo { @Override public String toString() { return "HealthCheckInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus=" - + healthCheckStatus + ", version=" + version + ", description=" + description + "]"; + + healthCheckStatus + ", version=" + version + ", description=" + description + ", componentsInfo=" + + componentsInfo + "]"; + } + + public static void main(String[] args) { + String des = "[{healthCheckComponent=BE4, healthCheckStatus=UP, version=0.0.1-SNAPSHOT, description=OK}, {healthCheckComponent=BE, healthCheckStatus=UP, version=1710.0.0-SNAPSHOT, description=OK}, {healthCheckComponent=BE5, healthCheckStatus=UP, version=2.1.9, description=OK}]"; + Type listType = new TypeToken<List<HealthCheckInfo>>(){}.getType(); + List<HealthCheckInfo> componentsInfo = new Gson().fromJson(des.toString(), listType); + System.out.println(componentsInfo.toString()); } } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java index 0f45d34886..aaee26004f 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java @@ -26,7 +26,7 @@ public enum EcompErrorCode { "An Authentication failure occured during access to UEB server. Please check that UEB keys are configured correctly in ASDC BE distribution configuration."), E_199( "Internal authentication problem. Description: %s"), - E_200("ASDC Backend probably lost connectivity to either one of the following components: Titan DB, Elasticsearch, UEB Cluster. Please check the logs for more information."), E_201( + E_200("ASDC Backend probably lost connectivity to either one of the following components: Titan DB, Cassandra, Onboarding, UEB Cluster. Please check the logs for more information."), E_201( "ASDC Backend probably lost connectivity to Titan DB. Please check the logs for more information."), E_202( "ASDC Backend probably lost connectivity to ElasticSearch. Please check the logs for more information."), E_203( "ASDC Backend probably lost connectivity to UEB Cluster. Please check the logs for more information.", @@ -34,7 +34,7 @@ public enum EcompErrorCode { "Unable to connect to a valid ASDC Backend Server", "Please check connectivity from this FE instance towards BE or BE Load Balancer. Please check that parameters in FE configuration.yaml: beHost, beHttpPort and beSslPort point to a valid host and port values."), - E_205("ASDC Backend Recovery to either one of the following components: Titan DB, Elasticsearch, UEB Cluster."), E_206( + E_205("ASDC Backend Recovery to either one of the following components: Titan DB, Cassandra, Onboarding, UEB Cluster."), E_206( "ASDC Backend connection recovery to Titan DB."), E_207( "ASDC Backend connection recovery to ElasticSearch."), E_208( "ASDC Backend connection recovery to UEB Cluster."), E_209( 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 c89eeaf535..0b55fd1845 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 @@ -153,4 +153,14 @@ public class GeneralUtility { byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes()); return new String(encodeBase64); } + + + /** + * + * @param String + * @return String is null or Empty + */ + public static boolean isEmptyString(String str) { + return str == null || str.trim().isEmpty(); + } } 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 3ea780a7f9..6c47659dad 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 @@ -66,14 +66,18 @@ public class ValidationUtils { public final static Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$"); public final static Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024; + public final static Integer SERVICE_TYPE_MAX_LENGTH = 400; + public final static Integer SERVICE_ROLE_MAX_LENGTH = 400; + 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 Integer VENDOR_NAME_MAX_LENGTH = 60; 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 Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65; public final static Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+"); @@ -318,14 +322,18 @@ public class ValidationUtils { return true; } - public static boolean validateVendorName(String ventorName) { - return VENDOR_NAME_PATTERN.matcher(ventorName).matches(); + public static boolean validateVendorName(String vendorName) { + return VENDOR_NAME_PATTERN.matcher(vendorName).matches(); } - public static boolean validateVendorNameLength(String ventorName) { - return ventorName.length() <= VENDOR_NAME_MAX_LENGTH; + public static boolean validateVendorNameLength(String vendorName) { + return vendorName.length() <= VENDOR_NAME_MAX_LENGTH; } + public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) { + return resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH; + } + public static boolean validateVendorRelease(String vendorRelease) { return VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches(); } @@ -333,6 +341,16 @@ public class ValidationUtils { public static boolean validateVendorReleaseLength(String vendorRelease) { return vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH; } + + public static boolean validateServiceTypeLength(String serviceType) { + return serviceType.length() <= SERVICE_TYPE_MAX_LENGTH; + } + + public static boolean validateServiceRoleLength(String serviceRole) { + return serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH; + } + + public static boolean hasBeenCertified(String version) { return NumberUtils.toDouble(version) >= 1; @@ -509,5 +527,5 @@ public class ValidationUtils { String stripped = HtmlCleaner.stripHtml(htmlText, false); return stripped; } - + } |