diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-17 14:57:07 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-18 09:31:22 +0000 |
commit | 49de015b6b49f64516557254e1e3713448ca4e6c (patch) | |
tree | 8ec7fca563a0d7af11c4f4cb1a550c65608f9cc6 | |
parent | a54b7c89ae8441e749cc08489672c50cfbe5786f (diff) |
Improve test coverage
Use Lombok annotations to improve test coverage
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: Iaaed0023960cfe0a31e1b50fb868196ab488cb4c
Issue-ID: SDC-3428
7 files changed, 258 insertions, 2123 deletions
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 5d34f468aa..e12ac92b51 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 @@ -69,12 +69,11 @@ public class BasicAuthenticationFilter implements ContainerRequestFilter { private String realm = "ASDC"; - @Override public void filter(ContainerRequestContext requestContext) throws IOException { audit.startLog(requestContext); - if (!basicAuthConf.getEnabled()) { + if (!basicAuthConf.isEnabled()) { return; } List<String> excludedUrls = Arrays.asList(basicAuthConf.getExcludedUrls().split(",")); diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java index 200684a530..5362b526be 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/FeProxyServlet.java @@ -107,7 +107,7 @@ public class FeProxyServlet extends SSLProxyServlet { return; } BasicAuthConfig basicAuth = config.getBasicAuth(); - if (basicAuth.getEnabled()) { + if (basicAuth.isEnabled()) { proxyRequest.header(HttpHeader.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString((basicAuth.getUserName() + ":" + basicAuth.getUserPass()).getBytes())); } 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 5bfed0dc06..b670bbd959 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 @@ -28,16 +28,22 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.map.CaseInsensitiveMap; import org.openecomp.sdc.common.api.BasicConfiguration; +@Getter +@Setter +@NoArgsConstructor public class Configuration extends BasicConfiguration { private List<String> identificationHeaderFields; /** - * Requests from these Urls will not be logged by - * org.openecomp.sdc.be.filters.BeServletFilter.<br> + * Requests from these Urls will not be logged by org.openecomp.sdc.be.filters.BeServletFilter.<br> **/ private List<String> unLoggedUrls; @@ -164,739 +170,142 @@ public class Configuration extends BasicConfiguration { private List<ArtifactConfiguration> artifacts; private Map<String, Map<String, List<String>>> componentAllowedInstanceTypes; - public List<ArtifactConfiguration> getArtifacts() { - return artifacts; - } - - public void setArtifacts(List<ArtifactConfiguration> artifacts) { - this.artifacts = artifacts; - } - - public Map<String, Map<String, List<String>>> getComponentAllowedInstanceTypes() { - return componentAllowedInstanceTypes; - } - - public void setComponentAllowedInstanceTypes( - final Map<String, Map<String, List<String>>> componentAllowedInstanceTypes) { - this.componentAllowedInstanceTypes = componentAllowedInstanceTypes; - } - - public String getAutoHealingOwner() { - return autoHealingOwner; - } - - public void setAutoHealingOwner(String autoHealingOwner) { - this.autoHealingOwner = autoHealingOwner; - } - - public Integer getMaxDeleteComponents() { - return maxDeleteComponents; - } - - public void setMaxDeleteComponents(Integer maxDeleteComponents) { - this.maxDeleteComponents = maxDeleteComponents; - } - - public void setEnableAutoHealing(boolean enableAutoHealing) { - this.enableAutoHealing = enableAutoHealing; - } - - public boolean isEnableAutoHealing() { - return enableAutoHealing; - } - - public Integer getDeleteLockTimeoutInSeconds() { - return deleteLockTimeoutInSeconds; - } - - public void setDeleteLockTimeoutInSeconds(Integer deleteLockTimeoutInSeconds) { - this.deleteLockTimeoutInSeconds = deleteLockTimeoutInSeconds; - } - - public DmaapConsumerConfiguration getDmaapConsumerConfiguration() { - return dmaapConsumerConfiguration; - } - - public void setDmaapConsumerConfiguration(DmaapConsumerConfiguration dmaapConsumerConfiguration) { - this.dmaapConsumerConfiguration = dmaapConsumerConfiguration; - } - public DmeConfiguration getDmeConfiguration() { - return dmeConfiguration; - } - - public void setDmeConfiguration(DmeConfiguration dmeConfiguration) { - this.dmeConfiguration = dmeConfiguration; - } - - public void setSkipUpgradeVSPs(boolean skipUpgradeVSPs) { this.skipUpgradeVSPs = skipUpgradeVSPs; } - - public boolean getSkipUpgradeVSPsFlag() { return skipUpgradeVSPs; } - - public boolean getSkipUpgradeFailedVfs() { - return skipUpgradeFailedVfs; - } - - public boolean getSupportAllottedResourcesAndProxyFlag() { - return supportAllottedResourcesAndProxy; - } - - public void setSupportAllottedResourcesAndProxy(boolean supportAllottedResourcesAndProxy) { - this.supportAllottedResourcesAndProxy = supportAllottedResourcesAndProxy; - } - - public void setSkipUpgradeFailedVfs(boolean skipUpgradeFailedVfs) { - this.skipUpgradeFailedVfs = skipUpgradeFailedVfs; - } - - public String getAppVersion() { - return appVersion; - } - - public void setAppVersion(String appVersion) { - this.appVersion = appVersion; - } - - public String getArtifactGeneratorConfig() { - return artifactGeneratorConfig; - } - - public void setArtifactGeneratorConfig(String artifactGeneratorConfig) { - this.artifactGeneratorConfig = artifactGeneratorConfig; - } - - public Map<String, String> getGenericAssetNodeTypes() { - return genericAssetNodeTypes; - } - - public void setGenericAssetNodeTypes(Map<String, String> genericAssetNodeTypes) { - this.genericAssetNodeTypes = genericAssetNodeTypes; - } - - public Map<String, String> getServiceNodeTypes(){ - return serviceNodeTypes ; - } - - public void setServiceNodeTypes(Map<String, String> serviceNodeTypes){ - this.serviceNodeTypes = serviceNodeTypes; - } - - public Map<String, Map<String, String>> getResourceNodeTypes(){ - return resourceNodeTypes; - } - - public void setResourceNodeTypes(Map<String, Map<String, String>> resourceNodeTypes){ - this.resourceNodeTypes = resourceNodeTypes; - } - - public SwitchoverDetectorConfig getSwitchoverDetector() { - return switchoverDetector; - } - - public void setSwitchoverDetector(SwitchoverDetectorConfig switchoverDetector) { - this.switchoverDetector = switchoverDetector; - } - - public ApplicationL1CacheConfig getApplicationL1Cache() { - return applicationL1Cache; - } - - public void setApplicationL1Cache(ApplicationL1CacheConfig applicationL1Cache) { - this.applicationL1Cache = applicationL1Cache; - } - - public ApplicationL2CacheConfig getApplicationL2Cache() { - return applicationL2Cache; - } - - public void setApplicationL2Cache(ApplicationL2CacheConfig applicationL2Cache) { - this.applicationL2Cache = applicationL2Cache; - } - - public CassandrConfig getCassandraConfig() { - return cassandraConfig; - } - - public void setCassandraConfig(CassandrConfig cassandraKeySpace) { - this.cassandraConfig = cassandraKeySpace; - } - - public List<String> getIdentificationHeaderFields() { - return identificationHeaderFields; - } - - public void setIdentificationHeaderFields(List<String> identificationHeaderFields) { - this.identificationHeaderFields = identificationHeaderFields; - } - - public Date getReleased() { - return released; - } - - public String getVersion() { - return version; - } - - public void setReleased(Date released) { - this.released = released; - } - - public void setVersion(String version) { - this.version = version; - } - - public List<String> getProtocols() { - return protocols; - } - - public void setProtocols(List<String> protocols) { - this.protocols = protocols; - } - - public Map<String, String> getUsers() { - return users; - } - - public void setUsers(Map<String, String> users) { - this.users = users; - } - - public String getBeFqdn() { - return beFqdn; - } - - public void setBeFqdn(String beHost) { - this.beFqdn = beHost; - } - - public Integer getBeHttpPort() { - return beHttpPort; - } - - public void setBeHttpPort(Integer beHttpPort) { - this.beHttpPort = beHttpPort; - } - - public Integer getBeSslPort() { - return beSslPort; - } - - public void setBeSslPort(Integer beSslPort) { - this.beSslPort = beSslPort; - } - - public String getBeContext() { - return beContext; - } - - public void setBeContext(String beContext) { - this.beContext = beContext; - } - - public String getBeProtocol() { - return beProtocol; - } - - public void setBeProtocol(String beProtocol) { - this.beProtocol = beProtocol; - } - - public Map<String, Object> getNeo4j() { - return neo4j; - } - - public void setNeo4j(Map<String, Object> neo4j) { - this.neo4j = neo4j; - } - - public String getJanusGraphCfgFile() { - return janusGraphCfgFile; - } - - public void setJanusGraphCfgFile(String janusGraphCfgFile) { - this.janusGraphCfgFile = janusGraphCfgFile; - } - - public String getJanusGraphMigrationKeySpaceCfgFile() { - return janusGraphMigrationKeySpaceCfgFile; - } - - public void setJanusGraphMigrationKeySpaceCfgFile(String janusGraphMigrationKeySpaceCfgFile) { - this.janusGraphMigrationKeySpaceCfgFile = janusGraphMigrationKeySpaceCfgFile; - } - - public Boolean getJanusGraphInMemoryGraph() { - return janusGraphInMemoryGraph; - } - - public void setJanusGraphInMemoryGraph(Boolean janusGraphInMemoryGraph) { - this.janusGraphInMemoryGraph = janusGraphInMemoryGraph; - } - - public int getStartMigrationFrom() { - return startMigrationFrom; - } - - public void setStartMigrationFrom(int startMigrationFrom) { - this.startMigrationFrom = startMigrationFrom; - } - - public Long getJanusGraphLockTimeout() { - return janusGraphLockTimeout; - } - - public void setJanusGraphLockTimeout(Long janusGraphLockTimeout) { - this.janusGraphLockTimeout = janusGraphLockTimeout; - } - - public Long getJanusGraphHealthCheckReadTimeout() { - return janusGraphHealthCheckReadTimeout; + @SuppressWarnings("unchecked") + private <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) { + return map == null ? emptyMap() : new CaseInsensitiveMap(map); } public Long getJanusGraphHealthCheckReadTimeout(long defaultVal) { return janusGraphHealthCheckReadTimeout == null ? defaultVal : janusGraphHealthCheckReadTimeout; } - public void setJanusGraphHealthCheckReadTimeout(Long janusGraphHealthCheckReadTimeout) { - this.janusGraphHealthCheckReadTimeout = janusGraphHealthCheckReadTimeout; - } - - public Long getJanusGraphReconnectIntervalInSeconds() { - return janusGraphReconnectIntervalInSeconds; - } - public Long getJanusGraphReconnectIntervalInSeconds(long defaultVal) { return janusGraphReconnectIntervalInSeconds == null ? defaultVal : janusGraphReconnectIntervalInSeconds; } - public void setJanusGraphReconnectIntervalInSeconds(Long janusGraphReconnectIntervalInSeconds) { - this.janusGraphReconnectIntervalInSeconds = janusGraphReconnectIntervalInSeconds; - } - - public List<String> getExcludeResourceCategory() { - return excludeResourceCategory; - } - - 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, Set<String>> getExcludedPolicyTypesMapping() { return safeGetCapsInsensitiveMap(excludedPolicyTypesMapping); } - public void setExcludedPolicyTypesMapping(Map<String, Set<String>> excludedPolicyTypesMapping) { - this.excludedPolicyTypesMapping = excludedPolicyTypesMapping; - } - public Map<String, Set<String>> getExcludedGroupTypesMapping() { return safeGetCapsInsensitiveMap(excludedGroupTypesMapping); } - public void setExcludedGroupTypesMapping(Map<String, Set<String>> excludedGroupTypesMapping) { - this.excludedGroupTypesMapping = excludedGroupTypesMapping; - } - - public Map<String, Object> getToscaArtifacts() { - return toscaArtifacts; - } - - public void setToscaArtifacts(Map<String, Object> toscaArtifacts) { - this.toscaArtifacts = toscaArtifacts; - } - - public Map<String, Object> getInformationalResourceArtifacts() { - return informationalResourceArtifacts; - } - - public void setInformationalResourceArtifacts(Map<String, Object> informationalResourceArtifacts) { - this.informationalResourceArtifacts = informationalResourceArtifacts; - } - - public Map<String, Object> getInformationalServiceArtifacts() { - return informationalServiceArtifacts; - } - - public void setInformationalServiceArtifacts(Map<String, Object> informationalServiceArtifacts) { - this.informationalServiceArtifacts = informationalServiceArtifacts; - } - - public Map<String, Object> getServiceApiArtifacts() { - return serviceApiArtifacts; - } - - public void setServiceApiArtifacts(Map<String, Object> serviceApiArtifacts) { - this.serviceApiArtifacts = serviceApiArtifacts; - } - - public List<String> getExcludeServiceCategory() { - return excludeServiceCategory; - } - - public void setExcludeServiceCategory(List<String> excludeServiceCategory) { - this.excludeServiceCategory = excludeServiceCategory; - } - - public List<String> getLicenseTypes() { - return licenseTypes; - } - - public void setLicenseTypes(List<String> licenseTypes) { - this.licenseTypes = licenseTypes; - } - - public List<String> getDefinedResourceNamespace() { - return definedResourceNamespace; - } - - public void setDefinedResourceNamespace(List<String> definedResourceNamespace) { - this.definedResourceNamespace = definedResourceNamespace; - } - - public List<String> getDirectives() { - return directives; - } - - public void setDirectives(List<String> directives) { - this.directives = directives; - } - - public Integer getAdditionalInformationMaxNumberOfKeys() { - return additionalInformationMaxNumberOfKeys; - } - - public void setAdditionalInformationMaxNumberOfKeys(Integer additionalInformationMaxNumberOfKeys) { - this.additionalInformationMaxNumberOfKeys = additionalInformationMaxNumberOfKeys; - } - - public HeatDeploymentArtifactTimeout getHeatArtifactDeploymentTimeout() { - return heatArtifactDeploymentTimeout; - } - - public void setHeatArtifactDeploymentTimeout(HeatDeploymentArtifactTimeout heatArtifactDeploymentTimeout) { - this.heatArtifactDeploymentTimeout = heatArtifactDeploymentTimeout; - } - - public BeMonitoringConfig getSystemMonitoring() { - return systemMonitoring; - } - - public void setSystemMonitoring(BeMonitoringConfig systemMonitoring) { - this.systemMonitoring = systemMonitoring; - } - - public Long getUebHealthCheckReconnectIntervalInSeconds() { - return uebHealthCheckReconnectIntervalInSeconds; - } - - public void setUebHealthCheckReconnectIntervalInSeconds(Long uebHealthCheckReconnectIntervalInSeconds) { - this.uebHealthCheckReconnectIntervalInSeconds = uebHealthCheckReconnectIntervalInSeconds; - } - - public Long getUebHealthCheckReadTimeout() { - return uebHealthCheckReadTimeout; - } - - public void setUebHealthCheckReadTimeout(Long uebHealthCheckReadTimeout) { - this.uebHealthCheckReadTimeout = uebHealthCheckReadTimeout; - } - - public String getWorkloadContext() { - return workloadContext; - } - - public void setWorkloadContext(String workloadContext) { - this.workloadContext = workloadContext; - } - - public EnvironmentContext getEnvironmentContext() { - return environmentContext; - } - - public void setEnvironmentContext(EnvironmentContext environmentContext) { - this.environmentContext = environmentContext; - } - - public List<GabConfig> getGabConfig() { - return gabConfig; + @Override + public String toString() { + return new StringBuilder().append(format("backend host: %s%n", beFqdn)) + .append(format("backend http port: %s%n", beHttpPort)) + .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext)) + .append(format("backend protocol: %s%n", beProtocol)).append(format("Version: %s%n", version)) + .append(format("Released: %s%n", released)).append(format("Supported protocols: %s%n", protocols)) + .append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j)) + .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile)) + .append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph)) + .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout)) + .append(format("JanusGraph reconnect interval seconds: %s%n", janusGraphReconnectIntervalInSeconds)) + .append(format("excludeResourceCategory: %s%n", excludeResourceCategory)) + .append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts)) + .append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts)) + .append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts)) + .append(format("Supported artifacts types: %s%n", artifacts)) + .append(format("Supported license types: %s%n", licenseTypes)) + .append(format("Additional information Maximum number of preoperties: %s%n", additionalInformationMaxNumberOfKeys)) + .append(format("Heat Artifact Timeout in Minutes: %s%n", heatArtifactDeploymentTimeout)) + .append(format("URLs For HTTP Requests that will not be automatically logged : %s%n", unLoggedUrls)) + .append(format("Service Api Artifacts: %s%n", serviceApiArtifacts)) + .append(format("heat env artifact header: %s%n", heatEnvArtifactHeader)) + .append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter)) + .append(format("onboarding: %s%n", onboarding)).toString(); } - public void setGabConfig(List<GabConfig> gabConfig) { - this.gabConfig = gabConfig; + public List<String> getGlobalCsarImports() { + if (CollectionUtils.isEmpty(globalCsarImports)) { + return Collections.emptyList(); + } + return globalCsarImports; } + @Getter + @Setter + @NoArgsConstructor public static class CookieConfig { - String securityKey = ""; - long maxSessionTimeOut = 600*1000; - long sessionIdleTimeOut = 30*1000; - String cookieName = "AuthenticationCookie"; - String redirectURL = "https://www.e-access.att.com/ecomp_portal_ist/ecompportal/process_csp"; - List<String> excludedUrls; - List<String> onboardingExcludedUrls; - String domain = ""; - String path = ""; - boolean isHttpOnly = true; - - public String getSecurityKey() { - return securityKey; - } - - public void setSecurityKey(String securityKey) { - this.securityKey = securityKey; - } - public long getMaxSessionTimeOut() { - return maxSessionTimeOut; - } - - public void setMaxSessionTimeOut(long maxSessionTimeOut) { - this.maxSessionTimeOut = maxSessionTimeOut; - } - - public long getSessionIdleTimeOut() { - return sessionIdleTimeOut; - } - - public void setSessionIdleTimeOut(long sessionIdleTimeOut) { - this.sessionIdleTimeOut = sessionIdleTimeOut; - } - - public String getCookieName() { - return cookieName; - } - - public void setCookieName(String cookieName) { - this.cookieName = cookieName; - } - - public String getRedirectURL() { - return redirectURL; - } - - public void setRedirectURL(String redirectURL) { - this.redirectURL = redirectURL; - } - - public List<String> getExcludedUrls() { - return excludedUrls; - } - - public void setExcludedUrls(List<String> excludedUrls) { - this.excludedUrls = excludedUrls; - } - - public String getDomain() { - return domain; - } - - public void setDomain(String domain) { - this.domain = domain; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } + private String securityKey = ""; + private long maxSessionTimeOut = 600 * 1000L; + private long sessionIdleTimeOut = 30 * 1000L; + private String cookieName = "AuthenticationCookie"; + private String redirectURL = "https://www.e-access.att.com/ecomp_portal_ist/ecompportal/process_csp"; + private List<String> excludedUrls; + private List<String> onboardingExcludedUrls; + private String domain = ""; + private String path = ""; + private boolean isHttpOnly = true; public boolean isHttpOnly() { return isHttpOnly; } - public void setIsHttpOnly(boolean isHttpOnly) { + public void setIsHttpOnly(final boolean isHttpOnly) { this.isHttpOnly = isHttpOnly; } - public List<String> getOnboardingExcludedUrls() { - return onboardingExcludedUrls; - } - - public void setOnboardingExcludedUrls(List<String> onboardingExcludedUrls) { - this.onboardingExcludedUrls = onboardingExcludedUrls; - } - } - - public CookieConfig getAuthCookie() { - return authCookie; - } - - public void setAuthCookie(CookieConfig authCookie) { - this.authCookie = authCookie; } + @Getter + @Setter + @NoArgsConstructor public static class CassandrConfig { - private static final Integer CASSANDRA_DEFAULT_PORT = 9042; - List<String> cassandraHosts; - Integer cassandraPort; - String localDataCenter; - Long reconnectTimeout; - Integer socketReadTimeout; - Integer socketConnectTimeout; - List<KeyspaceConfig> keySpaces; - boolean authenticate; - String username; - String password; - boolean ssl; - String truststorePath; - String truststorePassword; - int maxWaitSeconds = 120; - - public Integer getCassandraPort() { return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT; } - - public void setCassandraPort(Integer cassandraPort) { this.cassandraPort = cassandraPort; } - - public String getLocalDataCenter() { - return localDataCenter; - } - - public void setLocalDataCenter(String localDataCenter) { - this.localDataCenter = localDataCenter; - } - - public boolean isAuthenticate() { - return authenticate; - } - - public void setAuthenticate(boolean authenticate) { - this.authenticate = authenticate; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public boolean isSsl() { - return ssl; - } - - public void setSsl(boolean ssl) { - this.ssl = ssl; - } - - public String getTruststorePath() { - return truststorePath; - } - - public void setTruststorePath(String truststorePath) { - this.truststorePath = truststorePath; - } - - public String getTruststorePassword() { - return truststorePassword; - } - - public void setTruststorePassword(String truststorePassword) { - this.truststorePassword = truststorePassword; - } - - public Long getReconnectTimeout() { - return reconnectTimeout; - } - - public void setReconnectTimeout(Long reconnectTimeout) { - this.reconnectTimeout = reconnectTimeout; - } - - public Integer getSocketReadTimeout() { return socketReadTimeout; } - - public void setSocketReadTimeout(Integer socketReadTimeout) { this.socketReadTimeout = socketReadTimeout;} - - public Integer getSocketConnectTimeout() { return socketConnectTimeout;} - - public void setSocketConnectTimeout(Integer socketConnectTimeout) { this.socketConnectTimeout = socketConnectTimeout; } - - public List<String> getCassandraHosts() { - return cassandraHosts; - } - - public void setCassandraHosts(List<String> cassandraHosts) { - this.cassandraHosts = cassandraHosts; - } - - public List<KeyspaceConfig> getKeySpaces() { - return keySpaces; - } - - public void setKeySpaces(List<KeyspaceConfig> cassandraConfig) { - this.keySpaces = cassandraConfig; - } - - public int getMaxWaitSeconds() { - return maxWaitSeconds; - } - - public void setMaxWaitSeconds(int maxWaitSeconds) { - this.maxWaitSeconds = maxWaitSeconds; - } + private static final Integer CASSANDRA_DEFAULT_PORT = 9042; + private List<String> cassandraHosts; + private Integer cassandraPort; + private String localDataCenter; + private Long reconnectTimeout; + private Integer socketReadTimeout; + private Integer socketConnectTimeout; + private List<KeyspaceConfig> keySpaces; + private boolean authenticate; + private String username; + private String password; + private boolean ssl; + private String truststorePath; + private String truststorePassword; + private int maxWaitSeconds = 120; + + public Integer getCassandraPort() { + return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT; + } + + @Getter + @Setter + @NoArgsConstructor public static class KeyspaceConfig { - String name; - String replicationStrategy; - List<String> replicationInfo; + private String name; + private String replicationStrategy; + private List<String> replicationInfo; - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getReplicationStrategy() { - return replicationStrategy; - } - - public void setReplicationStrategy(String replicationStrategy) { - this.replicationStrategy = replicationStrategy; - } - - public List<String> getReplicationInfo() { - return replicationInfo; - } - - public void setReplicationInfo(List<String> replicationInfo) { - this.replicationInfo = replicationInfo; - } } } + @Getter + @Setter + @NoArgsConstructor public static class SwitchoverDetectorConfig { - String gBeFqdn; - String gFeFqdn; - String beVip; - String feVip; - int beResolveAttempts; - int feResolveAttempts; - Boolean enabled; - long interval; - String changePriorityUser; - String changePriorityPassword; - String publishNetworkUrl; - String publishNetworkBody; - Map<String, GroupInfo> groups; + private String gBeFqdn; + private String gFeFqdn; + private String beVip; + private String feVip; + private int beResolveAttempts; + private int feResolveAttempts; + private Boolean enabled; + private long interval; + private String changePriorityUser; + private String changePriorityPassword; + private String publishNetworkUrl; + private String publishNetworkBody; + private Map<String, GroupInfo> groups; public String getgBeFqdn() { return gBeFqdn; @@ -914,917 +323,207 @@ public class Configuration extends BasicConfiguration { this.gFeFqdn = gFeFqdn; } - public String getBeVip() { - return beVip; - } - - public void setBeVip(String beVip) { - this.beVip = beVip; - } - - public String getFeVip() { - return feVip; - } - - public void setFeVip(String feVip) { - this.feVip = feVip; - } - - public int getBeResolveAttempts() { - return beResolveAttempts; - } - - public void setBeResolveAttempts(int beResolveAttempts) { - this.beResolveAttempts = beResolveAttempts; - } - - public int getFeResolveAttempts() { - return feResolveAttempts; - } - - public void setFeResolveAttempts(int feResolveAttempts) { - this.feResolveAttempts = feResolveAttempts; - } - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public long getInterval() { - return interval; - } - - public void setInterval(long interval) { - this.interval = interval; - } - - public String getChangePriorityUser() { - return changePriorityUser; - } - - public void setChangePriorityUser(String changePriorityUser) { - this.changePriorityUser = changePriorityUser; - } - - public String getChangePriorityPassword() { - return changePriorityPassword; - } - - public void setChangePriorityPassword(String changePriorityPassword) { - this.changePriorityPassword = changePriorityPassword; - } - - public String getPublishNetworkUrl() { - return publishNetworkUrl; - } - - public void setPublishNetworkUrl(String publishNetworkUrl) { - this.publishNetworkUrl = publishNetworkUrl; - } - - public String getPublishNetworkBody() { - return publishNetworkBody; - } - - public void setPublishNetworkBody(String publishNetworkBody) { - this.publishNetworkBody = publishNetworkBody; - } - - public Map<String, GroupInfo> getGroups() { - return groups; - } - - public void setGroups(Map<String, GroupInfo> groups) { - this.groups = groups; - } - + @Getter + @Setter + @NoArgsConstructor public static class GroupInfo { String changePriorityUrl; String changePriorityBody; - public String getChangePriorityUrl() { - return changePriorityUrl; - } - - public void setChangePriorityUrl(String changePriorityUrl) { - this.changePriorityUrl = changePriorityUrl; - } - - public String getChangePriorityBody() { - return changePriorityBody; - } - - public void setChangePriorityBody(String changePriorityBody) { - this.changePriorityBody = changePriorityBody; - } } - } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class HeatDeploymentArtifactTimeout { - Integer defaultMinutes; - Integer minMinutes; - Integer maxMinutes; - - public Integer getDefaultMinutes() { - return defaultMinutes; - } - - public void setDefaultMinutes(Integer defaultMinutes) { - this.defaultMinutes = defaultMinutes; - } - public Integer getMinMinutes() { - return minMinutes; - } - - public void setMinMinutes(Integer minMinutes) { - this.minMinutes = minMinutes; - } + private Integer defaultMinutes; + private Integer minMinutes; + private Integer maxMinutes; - public Integer getMaxMinutes() { - return maxMinutes; - } - - public void setMaxMinutes(Integer maxMinutes) { - this.maxMinutes = maxMinutes; - } - - @Override - public String toString() { - return "HeatDeploymentArtifactTimeout config [default=" + defaultMinutes + ", min=" + minMinutes + ", max=" + maxMinutes + "]"; - } } + @Getter + @Setter + @NoArgsConstructor public static class BeMonitoringConfig { - Boolean enabled; - Boolean isProxy; - Integer probeIntervalInSeconds; - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Boolean getIsProxy() { - return isProxy; - } - - public void setIsProxy(Boolean isProxy) { - this.isProxy = isProxy; - } - - public Integer getProbeIntervalInSeconds() { - return probeIntervalInSeconds; - } + private Boolean enabled; + private Boolean isProxy; + private Integer probeIntervalInSeconds; public Integer getProbeIntervalInSeconds(int defaultVal) { return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds; } - public void setProbeIntervalInSeconds(Integer probeIntervalInSeconds) { - this.probeIntervalInSeconds = probeIntervalInSeconds; - } } + @Getter + @Setter + @NoArgsConstructor public static class ArtifactTypeConfig { - List<String> acceptedTypes; - List<String> validForResourceTypes; + private List<String> acceptedTypes; + private List<String> validForResourceTypes; - public List<String> getValidForResourceTypes() { - return validForResourceTypes; - } - - public void setValidForResourceTypes(List<String> validForResourceTypes) { - this.validForResourceTypes = validForResourceTypes; - } - - public List<String> getAcceptedTypes() { - return acceptedTypes; - } - - public void setAcceptedTypes(List<String> acceptedTypes) { - this.acceptedTypes = acceptedTypes; - } } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class OnboardingConfig { - String protocol = "http"; - String host; - Integer port; - String downloadCsarUri; - String healthCheckUri; - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getDownloadCsarUri() { - return downloadCsarUri; - } - - public void setDownloadCsarUri(String downloadCsarUri) { - 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=" - + downloadCsarUri + "]"; - } - - } - - public BasicAuthConfig getBasicAuth() { - return basicAuth; - } + private String protocol = "http"; + private String host; + private Integer port; + private String downloadCsarUri; + @ToString.Exclude + private String healthCheckUri; - public void setBasicAuth(BasicAuthConfig basicAuth) { - this.basicAuth = basicAuth; } + @Getter + @Setter + @NoArgsConstructor public static class BasicAuthConfig { - boolean enabled; - String userName; - String userPass; - String excludedUrls; - - public boolean getEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserPass() { - return userPass; - } - public void setUserPass(String userPass) { - this.userPass = userPass; - } - - public String getExcludedUrls() { - return excludedUrls; - } + private boolean enabled; + private String userName; + private String userPass; + private String excludedUrls; - public void setExcludedUrls(String excludedUrls) { - this.excludedUrls = excludedUrls; - } } + @Getter + @Setter + @NoArgsConstructor + @ToString(onlyExplicitlyIncluded = true) public static class EcompPortalConfig { + private String protocol = "https"; private String host; private Integer port; private String healthCheckUri; + @ToString.Include private String defaultFunctionalMenu; private Integer pollingInterval; private Integer timeoutMs; - public void setPollingInterval(Integer pollingInterval) { - this.pollingInterval = pollingInterval; - } - - public void setTimeoutMs(Integer timeoutMs) { - this.timeoutMs = timeoutMs; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getHealthCheckUri() { - return healthCheckUri; - } - - public void setHealthCheckUri(String healthCheckUri) { - this.healthCheckUri = healthCheckUri; - } - - public String getDefaultFunctionalMenu() { - return defaultFunctionalMenu; - } - - public void setDefaultFunctionalMenu(String defaultFunctionalMenu) { - this.defaultFunctionalMenu = defaultFunctionalMenu; - } - - public Integer getPollingInterval() { - return pollingInterval; - } - - public Integer getTimeoutMs() { - return timeoutMs; - } - - @Override - public String toString() { - return "EcompPortalConfig [defaultFunctionalMenu=" + defaultFunctionalMenu + "]"; - } - } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class ApplicationL1CacheConfig { - ApplicationL1CacheInfo datatypes; - - public ApplicationL1CacheInfo getDatatypes() { - return datatypes; - } - - public void setDatatypes(ApplicationL1CacheInfo datatypes) { - this.datatypes = datatypes; - } - - @Override - public String toString() { - return "ApplicationL1CacheConfig [datatypes=" + datatypes + "]"; - } + private ApplicationL1CacheInfo datatypes; } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class ApplicationL2CacheConfig { - boolean enabled; - ApplicationL1CacheCatalogInfo catalogL1Cache; - - QueueInfo queue; - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public ApplicationL1CacheCatalogInfo getCatalogL1Cache() { - return catalogL1Cache; - } - - public void setCatalogL1Cache(ApplicationL1CacheCatalogInfo catalogL1Cache) { - this.catalogL1Cache = catalogL1Cache; - } - - public QueueInfo getQueue() { - return queue; - } - - public void setQueue(QueueInfo queue) { - this.queue = queue; - } - - @Override - public String toString() { - return "ApplicationL2CacheConfig [enabled=" + enabled + ", catalogL1Cache=" + catalogL1Cache + "]"; - } + private boolean enabled; + private ApplicationL1CacheCatalogInfo catalogL1Cache; + @ToString.Exclude + private QueueInfo queue; } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class ToscaValidatorsConfig { private Integer stringMaxLength; - public Integer getStringMaxLength() { - return stringMaxLength; - } - - public void setStringMaxLength(Integer stringMaxLength) { - this.stringMaxLength = stringMaxLength; - } - - @Override - public String toString() { - return "ToscaValidatorsConfig [stringMaxLength=" + stringMaxLength + "]"; - } - } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class ApplicationL1CacheInfo { - Boolean enabled; - Integer firstRunDelay; - Integer pollIntervalInSec; + private Boolean enabled; + private Integer firstRunDelay; + private Integer pollIntervalInSec; - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Integer getFirstRunDelay() { - return firstRunDelay; - } - - public void setFirstRunDelay(Integer firstRunDelay) { - this.firstRunDelay = firstRunDelay; - } - - public Integer getPollIntervalInSec() { - return pollIntervalInSec; - } - - public void setPollIntervalInSec(Integer pollIntervalInSec) { - this.pollIntervalInSec = pollIntervalInSec; - } - - @Override - public String toString() { - return "ApplicationL1CacheInfo [enabled=" + enabled + ", firstRunDelay=" + firstRunDelay - + ", pollIntervalInSec=" + pollIntervalInSec + "]"; - } } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class ApplicationL1CacheCatalogInfo { - Boolean enabled; - Integer resourcesSizeInCache; - Integer servicesSizeInCache; - Integer productsSizeInCache; - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Integer getResourcesSizeInCache() { - return resourcesSizeInCache; - } - - public void setResourcesSizeInCache(Integer resourcesSizeInCache) { - this.resourcesSizeInCache = resourcesSizeInCache; - } - - public Integer getServicesSizeInCache() { - return servicesSizeInCache; - } - - public void setServicesSizeInCache(Integer servicesSizeInCache) { - this.servicesSizeInCache = servicesSizeInCache; - } - - public Integer getProductsSizeInCache() { - return productsSizeInCache; - } - - public void setProductsSizeInCache(Integer productsSizeInCache) { - this.productsSizeInCache = productsSizeInCache; - } - - @Override - public String toString() { - return "ApplicationL1CacheCatalogInfo [enabled=" + enabled + ", resourcesSizeInCache=" - + resourcesSizeInCache + ", servicesSizeInCache=" + servicesSizeInCache + ", productsSizeInCache=" - + productsSizeInCache + "]"; - } + private Boolean enabled; + private Integer resourcesSizeInCache; + private Integer servicesSizeInCache; + private Integer productsSizeInCache; } + @Getter + @Setter + @NoArgsConstructor + @ToString public static class QueueInfo { - Integer numberOfCacheWorkers; - Integer waitOnShutDownInMinutes; - Integer syncIntervalInSecondes; - - public Integer getWaitOnShutDownInMinutes() { - return waitOnShutDownInMinutes; - } - public void setWaitOnShutDownInMinutes(Integer waitOnShutDownInMinutes) { - this.waitOnShutDownInMinutes = waitOnShutDownInMinutes; - } - - public Integer getSyncIntervalInSecondes() { - return syncIntervalInSecondes; - } + private Integer waitOnShutDownInMinutes; + private Integer syncIntervalInSecondes; + private Integer numberOfCacheWorkers; - public void setSyncIntervalInSecondes(Integer syncIntervalInSecondes) { - this.syncIntervalInSecondes = syncIntervalInSecondes; - } - - public Integer getNumberOfCacheWorkers() { - return numberOfCacheWorkers; - } - - public void setNumberOfCacheWorkers(Integer numberOfCacheWorkers) { - this.numberOfCacheWorkers = numberOfCacheWorkers; - } - - @Override - public String toString() { - return "QueueInfo[" + "waitOnShutDownInMinutes=" + waitOnShutDownInMinutes + ", syncIntervalInSecondes=" - + syncIntervalInSecondes + ", numberOfCacheWorkers=" + this.numberOfCacheWorkers + ']'; - } } + @Getter + @Setter + @NoArgsConstructor public static class EnvironmentContext { - String defaultValue; - List<String> validValues; - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public List<String> getValidValues() { - return validValues; - } - - public void setValidValues(List<String> validValues) { - this.validValues = validValues; - } - } - - - public CleanComponentsConfiguration getCleanComponentsConfiguration() { - return cleanComponentsConfiguration; - } - - public void setCleanComponentsConfiguration(CleanComponentsConfiguration cleanComponentsConfiguration) { - this.cleanComponentsConfiguration = cleanComponentsConfiguration; - } - - @Override - public String toString() { - return new StringBuilder().append(format("backend host: %s%n", beFqdn)) - .append(format("backend http port: %s%n", beHttpPort)) - .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext)) - .append(format("backend protocol: %s%n", beProtocol)).append(format("Version: %s%n", version)) - .append(format("Released: %s%n", released)).append(format("Supported protocols: %s%n", protocols)) - .append(format("Users: %s%n", users)).append(format("Neo4j: %s%n", neo4j)) - .append(format("JanusGraph Cfg File: %s%n", janusGraphCfgFile)) - .append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph)) - .append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout)) - .append(format("JanusGraph reconnect interval seconds: %s%n", janusGraphReconnectIntervalInSeconds)) - .append(format("excludeResourceCategory: %s%n", excludeResourceCategory)) - .append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts)) - .append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts)) - .append(format("informationalServiceArtifacts: %s%n", informationalServiceArtifacts)) - .append(format("Supported artifacts types: %s%n", artifacts)) - .append(format("Supported license types: %s%n", licenseTypes)) - .append(format("Additional information Maximum number of preoperties: %s%n", - additionalInformationMaxNumberOfKeys)) - .append(format("Heat Artifact Timeout in Minutes: %s%n", heatArtifactDeploymentTimeout)) - .append(format("URLs For HTTP Requests that will not be automatically logged : %s%n", unLoggedUrls)) - .append(format("Service Api Artifacts: %s%n", serviceApiArtifacts)) - .append(format("heat env artifact header: %s%n", heatEnvArtifactHeader)) - .append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter)) - .append(format("onboarding: %s%n", onboarding)).toString(); - } - - public List<String> getUnLoggedUrls() { - return unLoggedUrls; - } - - public void setUnLoggedUrls(List<String> unLoggedUrls) { - this.unLoggedUrls = unLoggedUrls; - } - - public Map<String, Object> getDeploymentResourceArtifacts() { - return deploymentResourceArtifacts; - } - - public void setDeploymentResourceArtifacts(Map<String, Object> deploymentResourceArtifacts) { - this.deploymentResourceArtifacts = deploymentResourceArtifacts; - } - - public String getHeatEnvArtifactHeader() { - return heatEnvArtifactHeader; - } - - public void setHeatEnvArtifactHeader(String heatEnvArtifactHeader) { - this.heatEnvArtifactHeader = heatEnvArtifactHeader; - } - - public String getHeatEnvArtifactFooter() { - return heatEnvArtifactFooter; - } - - public void setHeatEnvArtifactFooter(String heatEnvArtifactFooter) { - this.heatEnvArtifactFooter = heatEnvArtifactFooter; - } - - public Map<String, Object> getDeploymentResourceInstanceArtifacts() { - return deploymentResourceInstanceArtifacts; - } - - public void setDeploymentResourceInstanceArtifacts(Map<String, Object> deploymentResourceInstanceArtifacts) { - this.deploymentResourceInstanceArtifacts = deploymentResourceInstanceArtifacts; - } - - public String getArtifactsIndex() { - return artifactsIndex; - } - - public void setArtifactsIndex(String artifactsIndex) { - this.artifactsIndex = artifactsIndex; - } - - public List<String> getGlobalCsarImports() { - if (CollectionUtils.isEmpty(globalCsarImports)) { - return Collections.emptyList(); - } - return globalCsarImports; - } - - public void setGlobalCsarImports(List<String> globalCsarImports) { - this.globalCsarImports = globalCsarImports; - } - - public List<String> getResourceTypes() { - return resourceTypes; - } - - public void setResourceTypes(List<String> resourceTypes) { - this.resourceTypes = resourceTypes; - } - - public String getToscaFilesDir() { - return toscaFilesDir; - } - - public void setToscaFilesDir(String toscaFilesDir) { - this.toscaFilesDir = toscaFilesDir; - } - - public String getHeatTranslatorPath() { - return heatTranslatorPath; - } - - public void setHeatTranslatorPath(String heatTranslatorPath) { - this.heatTranslatorPath = heatTranslatorPath; - } - - public OnboardingConfig getOnboarding() { - return onboarding; - } + private String defaultValue; + private List<String> validValues; - public void setOnboarding(OnboardingConfig onboarding) { - this.onboarding = onboarding; - } - - public EcompPortalConfig getEcompPortal() { - return ecompPortal; - } - - public void setEcompPortal(EcompPortalConfig ecompPortal) { - this.ecompPortal = ecompPortal; - } - - public ToscaValidatorsConfig getToscaValidators() { - return toscaValidators; - } - - public void setToscaValidators(ToscaValidatorsConfig toscaValidators) { - this.toscaValidators = toscaValidators; - } - - public boolean isDisableAudit() { - return disableAudit; - } - - public Boolean getConsumerBusinessLogic() { - return consumerBusinessLogic; - } - - public void setConsumerBusinessLogic(Boolean consumerBusinessLogic) { - this.consumerBusinessLogic = consumerBusinessLogic; - } - - public void setDisableAudit(boolean enableAudit) { - this.disableAudit = enableAudit; - } - - 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; } + @Getter + @Setter + @NoArgsConstructor 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 List<Map<String, Map<String, String>>> getDefaultImports() { - return defaultImports; - } - - public void setDefaultImports(List<Map<String, Map<String, String>>> defaultImports) { - this.defaultImports = defaultImports; - } - - public Map<String, List<String>> getResourcesForUpgrade() { - return resourcesForUpgrade; - } - - public void setResourcesForUpgrade(Map<String, List<String>> resourcesForUpgrade) { - this.resourcesForUpgrade = resourcesForUpgrade; - } - - @SuppressWarnings("unchecked") - public static <K,V> Map<K,V> safeGetCapsInsensitiveMap(Map<K,V> map) { - return map == null ? emptyMap() : new CaseInsensitiveMap(map); - } - - - public List<String> getHealthStatusExclude() { - return healthStatusExclude; - } - - public void setHealthStatusExclude(List<String> healthStatusExclude) { - this.healthStatusExclude = healthStatusExclude; - } - - public DmaapProducerConfiguration getDmaapProducerConfiguration() { - return dmaapProducerConfiguration; - } - - public void setDmaapProducerConfiguration(DmaapProducerConfiguration dmaapProducerConfiguration) { - this.dmaapProducerConfiguration = dmaapProducerConfiguration; - } - - public String getAafNamespace() { - return aafNamespace; - } - - public void setAafNamespace(String aafNamespace) { - this.aafNamespace = aafNamespace; - } - - public Boolean getAafAuthNeeded(){ - return aafAuthNeeded; - } - - public void setAafAuthNeeded(Boolean aafAuthNeeded){ - this.aafAuthNeeded = aafAuthNeeded; - } - - public CadiFilterParams getCadiFilterParams() { - return cadiFilterParams; - } - public void setCadiFilterParams(CadiFilterParams cadiFilterParams) { - this.cadiFilterParams = cadiFilterParams; } - + @Getter + @Setter + @NoArgsConstructor public static class PathsAndNamesDefinition { + private String friendlyName; private String path; private Boolean searchable; - public String getFriendlyName() { - return friendlyName; - } - - public String getPath() { - return path; - } - - public Boolean getSearchable() { - return searchable; - } - - public void setFriendlyName(String friendlyName) { - this.friendlyName = friendlyName; - } - - public void setPath(String path) { - this.path = path; - } - - public void setSearchable(Boolean searchable) { - this.searchable = searchable; - } } + @Getter + @Setter + @NoArgsConstructor public static class GabConfig { + private String artifactType; private List<PathsAndNamesDefinition> pathsAndNamesDefinitions; - public String getArtifactType() { - return artifactType; - } - - public List<PathsAndNamesDefinition> getPathsAndNamesDefinitions() { - return pathsAndNamesDefinitions; - } - - public void setArtifactType(String artifactType) { - this.artifactType = artifactType; - } - - public void setPathsAndNamesDefinitions(List<PathsAndNamesDefinition> pathsAndNamesDefinitions) { - this.pathsAndNamesDefinitions = pathsAndNamesDefinitions; - } } } 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 e692b623f4..ca38a46efd 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 @@ -20,14 +20,20 @@ package org.openecomp.sdc.fe.config; -import org.openecomp.sdc.common.api.BasicConfiguration; +import static java.lang.String.format; import java.util.Date; import java.util.List; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.openecomp.sdc.common.api.BasicConfiguration; -import static java.lang.String.format; - +@Getter +@Setter +@NoArgsConstructor public class Configuration extends BasicConfiguration { + /** * fe FQDN */ @@ -81,427 +87,90 @@ public class Configuration extends BasicConfiguration { private List<String> forwardHeaderFields; - public CatalogFacadeMsConfig getCatalogFacadeMs() { - return catalogFacadeMs; - } - - public void setCatalogFacadeMs(CatalogFacadeMsConfig catalogFacadeMs) { - this.catalogFacadeMs = catalogFacadeMs; - } - - public FeMonitoringConfig getSystemMonitoring() { - return systemMonitoring; - } - - public void setSystemMonitoring(FeMonitoringConfig systemMonitoring) { - this.systemMonitoring = systemMonitoring; - } - - public Integer getHealthCheckSocketTimeoutInMs() { - return healthCheckSocketTimeoutInMs; - } - - public void setHealthCheckSocketTimeoutInMs(Integer healthCheckSocketTimeout) { - this.healthCheckSocketTimeoutInMs = healthCheckSocketTimeout; - } - public Integer getHealthCheckSocketTimeoutInMs(int defaultVal) { return healthCheckSocketTimeoutInMs == null ? defaultVal : healthCheckSocketTimeoutInMs; } - public Integer getHealthCheckIntervalInSeconds() { - return healthCheckIntervalInSeconds; - } - - public void setHealthCheckIntervalInSeconds(Integer healthCheckInterval) { - this.healthCheckIntervalInSeconds = healthCheckInterval; - } - public Integer getHealthCheckIntervalInSeconds(int defaultVal) { return healthCheckIntervalInSeconds == null ? defaultVal : healthCheckIntervalInSeconds; } - public Date getReleased() { - return released; - } - - public void setReleased(Date released) { - this.released = released; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public Connection getConnection() { - return connection; - } - - public void setConnection(Connection connection) { - this.connection = connection; - } - - public List<String> getProtocols() { - return protocols; - } - - public void setProtocols(List<String> protocols) { - this.protocols = protocols; - } - - public String getBeHost() { - return beHost; - } - - public void setBeHost(String beHost) { - this.beHost = beHost; - } - - public Integer getBeHttpPort() { - return beHttpPort; - } - - public void setBeHttpPort(Integer beHttpPort) { - this.beHttpPort = beHttpPort; - } - - public Integer getBeSslPort() { - return beSslPort; - } - - public void setBeSslPort(Integer beSslPort) { - this.beSslPort = beSslPort; - } - - public String getBeContext() { - return beContext; - } - - public void setBeContext(String beContext) { - this.beContext = beContext; - } - - public String getBeProtocol() { - return beProtocol; - } - - public void setBeProtocol(String beProtocol) { - this.beProtocol = beProtocol; - } - - public int getThreadpoolSize() { - return threadpoolSize; - } - - public void setThreadpoolSize(int threadpoolSize) { - this.threadpoolSize = threadpoolSize; - } - - public int getRequestTimeout() { - return requestTimeout; - } - - public void setRequestTimeout(int requestTimeout) { - this.requestTimeout = requestTimeout; - } - - public List<List<String>> getIdentificationHeaderFields() { - return identificationHeaderFields; - } - - public void setIdentificationHeaderFields(List<List<String>> identificationHeaderFields) { - this.identificationHeaderFields = identificationHeaderFields; - } - - public List<List<String>> getOptionalHeaderFields() { - return optionalHeaderFields; - } - - public void setOptionalHeaderFields(List<List<String>> optionalHeaderFields) { - this.optionalHeaderFields = optionalHeaderFields; - } - - public List<String> getForwardHeaderFields() { - return forwardHeaderFields; - } - - public void setForwardHeaderFields(List<String> forwardHeaderFields) { - this.forwardHeaderFields = forwardHeaderFields; - } - - public String getFeFqdn() { - return feFqdn; - } - - public void setFeFqdn(String feFqdn) { - this.feFqdn = feFqdn; - } - - public OnboardingConfig getOnboarding() { - return onboarding; - } - - public void setOnboarding(OnboardingConfig onboarding) { - this.onboarding = onboarding; - } - - public CookieConfig getAuthCookie() { - return authCookie; - } - - public void setAuthCookie(CookieConfig authCookie) { - this.authCookie = authCookie; - } - - public BasicAuthConfig getBasicAuth() { - return basicAuth; - } - - public void setBasicAuth(BasicAuthConfig basicAuth) { - this.basicAuth = basicAuth; - } - @Override public String toString() { return new StringBuilder().append(format("backend host: %s%n", beHost)) - .append(format("backend http port: %s%n", beHttpPort)) - .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext)) - .append(format("backend protocol: %s%n", beProtocol)) - .append(format("onboarding forward context: %s%n", onboardingForwardContext)) - .append(format("Version: %s%n", version)).append(format("Released: %s%n", released)) - .append(format("Connecting to database: %s%n", connection)) - .append(format("Supported protocols: %s%n", protocols)).toString(); - } - + .append(format("backend http port: %s%n", beHttpPort)) + .append(format("backend ssl port: %s%n", beSslPort)).append(format("backend context: %s%n", beContext)) + .append(format("backend protocol: %s%n", beProtocol)) + .append(format("onboarding forward context: %s%n", onboardingForwardContext)) + .append(format("Version: %s%n", version)).append(format("Released: %s%n", released)) + .append(format("Connecting to database: %s%n", connection)) + .append(format("Supported protocols: %s%n", protocols)).toString(); + } + + @Getter + @Setter + @NoArgsConstructor public static class FeMonitoringConfig { - Boolean enabled; - Boolean isProxy; - Integer probeIntervalInSeconds; - - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Boolean getIsProxy() { - return isProxy; - } - - public void setIsProxy(Boolean isProxy) { - this.isProxy = isProxy; - } - - public Integer getProbeIntervalInSeconds() { - return probeIntervalInSeconds; - } - - public void setProbeIntervalInSeconds(Integer probeIntervalInSeconds) { - this.probeIntervalInSeconds = probeIntervalInSeconds; - } + private Boolean enabled; + private Boolean isProxy; + private Integer probeIntervalInSeconds; public Integer getProbeIntervalInSeconds(int defaultVal) { return probeIntervalInSeconds == null ? defaultVal : probeIntervalInSeconds; } } + @Getter + @Setter + @NoArgsConstructor public static class OnboardingConfig { - String protocolFe = "http"; - String hostFe; - Integer portFe; - String protocolBe = "http"; - String hostBe; - Integer portBe; - String healthCheckUriFe; - - public String getProtocolFe() { - return protocolFe; - } - public void setProtocolFe(String protocolFe) { - this.protocolFe = protocolFe; - } + private String protocolFe = "http"; + private String hostFe; + private Integer portFe; + private String protocolBe = "http"; + private String hostBe; + private Integer portBe; + private String healthCheckUriFe; - public String getProtocolBe() { - return protocolBe; - } - - public void setProtocolBe(String protocolBe) { - this.protocolBe = protocolBe; - } - - public String getHostFe() { - return hostFe; - } - - public void setHostFe(String hostFe) { - this.hostFe = hostFe; - } - - public String getHostBe() { - return hostBe; - } - - public void setHostBe(String hostBe) { - this.hostBe = hostBe; - } - - public Integer getPortFe() { - return portFe; - } - - public void setPortFe(Integer portFe) { - this.portFe = portFe; - } - - public Integer getPortBe() { - return portBe; - } - - public void setPortBe(Integer portBe) { - this.portBe = portBe; - } - - public String getHealthCheckUriFe() { - return healthCheckUriFe; - } - - public void setHealthCheckUriFe(String healthCheckUriFe) { - this.healthCheckUriFe = healthCheckUriFe; - } } + @Getter + @Setter + @NoArgsConstructor public static class CookieConfig { - String cookieName = "AuthenticationCookie"; - String path = ""; - String domain = ""; - String securityKey = ""; - - public String getPath() { - return path; - } - public void setPath(String path) { - this.path = path; - } - - public String getDomain() { - return domain; - } - - public void setDomain(String domain) { - this.domain = domain; - } - - public String getSecurityKey() {return securityKey; - } - - public void setSecurityKey(String securityKey) { - this.securityKey = securityKey; - } + private String cookieName = "AuthenticationCookie"; + private String path = ""; + private String domain = ""; + private String securityKey = ""; - public String getCookieName() { - return cookieName; - } - - public void setCookieName(String cookieName) { - this.cookieName = cookieName; - } } + @Getter + @Setter + @NoArgsConstructor public static class BasicAuthConfig { - boolean enabled = false; - String userName = ""; - String userPass = ""; - public boolean getEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } + private boolean enabled = false; + private String userName = ""; + private String userPass = ""; - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserPass() {return userPass; - } - - public void setUserPass(String userPass) { - this.userPass = userPass; - } } + @Getter + @Setter + @NoArgsConstructor public static class CatalogFacadeMsConfig { - String protocol; - String host; - Integer port; - String healthCheckUri; - String path; - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - public void setHost(String host) { - this.host = host; - } - - public void setPort(Integer port) { - this.port = port; - } - - public void setHealthCheckUri(String healthCheckUri) { - this.healthCheckUri = healthCheckUri; - } - - public void setPath(String path) { - this.path = path; - } - - public String getProtocol() { - return protocol; - } - - public String getHost() { - return host; - } - - public Integer getPort() { - return port; - } - - public String getHealthCheckUri() { - return healthCheckUri; - } - - public String getPath() { - return path; - } - - - } - - public List<String> getHealthStatusExclude() { - return healthStatusExclude; - } + private String protocol; + private String host; + private Integer port; + private String healthCheckUri; + private String path; - public void setHealthStatusExclude(List<String> healthStatusExclude) { - this.healthStatusExclude = healthStatusExclude; } } diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java deleted file mode 100644 index 23e0ab8439..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nokia. - * ================================================================================ - * 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.be.config; - -import org.junit.Test; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.MatcherAssert.assertThat; - -public class ConfigurationTest { - public void validateBean() { - assertThat(Configuration.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding( - "excludedGroupTypesMapping", - "excludedPolicyTypesMapping", - "skipUpgradeVSPs", - "skipUpgradeVSPsFlag", - "supportAllottedResourcesAndProxy", - "supportAllottedResourcesAndProxyFlag") - )); - } - @Test - public void validateBeanForCassandrConfig() { - assertThat(Configuration.CassandrConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForSwitchoverDetectorConfig() { - assertThat(Configuration.SwitchoverDetectorConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForBeMonitoringConfig() { - assertThat(Configuration.BeMonitoringConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForArtifactTypeConfig() { - assertThat(Configuration.ArtifactTypeConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForOnboardingConfig() { - assertThat(Configuration.OnboardingConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForEcompPortalConfig() { - assertThat(Configuration.EcompPortalConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForApplicationL1CacheConfig() { - assertThat(Configuration.ApplicationL1CacheConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForApplicationL2CacheConfig() { - assertThat(Configuration.ApplicationL2CacheConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForToscaValidatorsConfig() { - assertThat(Configuration.ToscaValidatorsConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForApplicationL1CacheInfo() { - assertThat(Configuration.ApplicationL1CacheInfo.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForApplicationL1CacheCatalogInfo() { - assertThat(Configuration.ApplicationL1CacheCatalogInfo.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForQueueInfo() { - assertThat(Configuration.QueueInfo.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForEnvironmentContext() { - assertThat(Configuration.EnvironmentContext.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForPathsAndNamesDefinition() { - assertThat(Configuration.PathsAndNamesDefinition.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - @Test - public void validateBeanForGabConfig() { - assertThat(Configuration.GabConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding() - )); - } - -} diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java deleted file mode 100644 index ae30ccf502..0000000000 --- a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nokia. - * ================================================================================ - * 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.fe.config; - -import org.junit.Test; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; - - -public class ConfigurationTest { - - @Test - public void validateBean() { - assertThat(Configuration.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateFeMonitoringConfigBean() { - assertThat(Configuration.FeMonitoringConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateOnboardingConfigBean() { - assertThat(Configuration.OnboardingConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateGetHealthCheckSocketTimeoutInMsReturnsProperTime() { - final int defaultTestTimeout = 100; - final int setTestTimeout = 1000; - Configuration configuration = new Configuration(); - - assertEquals(configuration.getHealthCheckSocketTimeoutInMs(defaultTestTimeout).intValue(),defaultTestTimeout); - - configuration.setHealthCheckSocketTimeoutInMs(setTestTimeout); - assertEquals(configuration.getHealthCheckSocketTimeoutInMs(defaultTestTimeout).intValue(),setTestTimeout); - } - - @Test - public void validateGetHealthCheckIntervalInSecondsReturnsProperTime() { - final int defaultTestTimeout = 1; - final int setTestTimeout = 2; - Configuration configuration = new Configuration(); - - assertEquals(configuration.getHealthCheckIntervalInSeconds(defaultTestTimeout).intValue(),defaultTestTimeout); - - configuration.setHealthCheckIntervalInSeconds(setTestTimeout); - assertEquals(configuration.getHealthCheckIntervalInSeconds(defaultTestTimeout).intValue(),setTestTimeout); - } -} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/BasicAuthenticationFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/BasicAuthenticationFilter.java index c1eef1cd95..0cda5f8a27 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/BasicAuthenticationFilter.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/BasicAuthenticationFilter.java @@ -69,7 +69,7 @@ public class BasicAuthenticationFilter implements Filter { HttpServletRequestWrapper servletRequest = new HttpServletRequestWrapper(httpRequest); // BasicAuth is disabled - if (!basicAuthConfig.getEnabled()) { + if (!basicAuthConfig.isEnabled()) { arg2.doFilter(servletRequest, arg1); return; } |