diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2017-12-18 15:03:24 +0100 |
---|---|---|
committer | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-01-03 05:08:44 +0000 |
commit | 4108c5aca1ee4c556af3937c09c4415d2ebbde70 (patch) | |
tree | 3ce4af7faaa655dac3e96769fa6608327d46d091 /adapters/mso-adapter-utils/src | |
parent | 58ee7ac8ab60a17a508358a4c1353eac00411be5 (diff) |
refactoring - remove unused code
Issue-ID: SO-360
Change-Id: Iac9653fa6d5f10de7986fa3d511535d74f0c24c8
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src')
15 files changed, 50 insertions, 235 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java index 23230071c7..0af0e9422b 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java @@ -26,13 +26,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.annotate.JsonRootName; -import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; @@ -165,25 +162,23 @@ public class CloudConfig { return null; } - protected synchronized void reloadPropertiesFile() throws JsonParseException, JsonMappingException, IOException, MsoCloudIdentityNotFound { + protected synchronized void reloadPropertiesFile() throws IOException, MsoCloudIdentityNotFound { this.loadCloudConfig(this.configFilePath, this.refreshTimerInMinutes); } protected synchronized void loadCloudConfig(String configFile, int refreshTimer) - throws JsonParseException, JsonMappingException, IOException, MsoCloudIdentityNotFound { + throws IOException, MsoCloudIdentityNotFound { FileReader reader = null; configFilePath = configFile; this.refreshTimerInMinutes = refreshTimer; - - CloudConfig cloudConfig = null; this.validCloudConfig=false; try { reader = new FileReader(configFile); // Parse the JSON input into a CloudConfig - cloudConfig = mapper.readValue(reader, CloudConfig.class); + CloudConfig cloudConfig = mapper.readValue(reader, CloudConfig.class); this.cloudSites = cloudConfig.cloudSites; this.identityServices = cloudConfig.identityServices; diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java index 0f15dea577..d0ba7e09fc 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java @@ -26,26 +26,17 @@ package org.openecomp.mso.cloud; import java.io.IOException; import java.net.URISyntaxException; import java.security.GeneralSecurityException; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.SerializerProvider; import org.codehaus.jackson.map.annotate.JsonDeserialize; import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.codehaus.jackson.JsonProcessingException; - import org.openecomp.mso.openstack.exceptions.MsoAdapterException; import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoCommonUtils; import org.openecomp.mso.openstack.utils.MsoKeystoneUtils; import org.openecomp.mso.openstack.utils.MsoTenantUtils; import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory; import org.openecomp.mso.cloud.authentication.AuthenticationMethodFactory; import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; -import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; import org.openecomp.mso.cloud.authentication.wrappers.RackspaceAPIKeyWrapper; import org.openecomp.mso.cloud.authentication.wrappers.UsernamePasswordWrapper; import org.openecomp.mso.logger.MessageEnum; @@ -137,14 +128,6 @@ public class CloudIdentity { this.id = id; } - //DEPRECATED - public String getKeystoneUrl () throws MsoException { - if (this.identityServerType.equals(IdentityServerType.KEYSTONE)) - return this.identityUrl; - else - return null; - } - public String getKeystoneUrl (String regionId, String msoPropID) throws MsoException { if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) { return this.identityUrl; diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java index 7e4eced884..dcd8de79aa 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java @@ -22,17 +22,15 @@ package org.openecomp.mso.cloud; import java.io.IOException;
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
-import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType;
public class IdentityAuthenticationTypeJsonDeserializer extends JsonDeserializer<IdentityAuthenticationTypeAbstract> {
@Override
public IdentityAuthenticationTypeAbstract deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
- throws IOException, JsonProcessingException {
+ throws IOException {
JsonToken token = jsonParser.getCurrentToken();
if (JsonToken.VALUE_STRING.equals(token)) {
return IdentityAuthenticationTypeAbstract.valueOf(jsonParser.getText());
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java index 6e030a9262..bb8a3f1fd9 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java @@ -24,18 +24,15 @@ package org.openecomp.mso.cloud; import java.io.IOException;
import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
-import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType;
-
public class IdentityServerTypeJsonDeserializer extends JsonDeserializer<IdentityServerTypeAbstract> {
@Override
public IdentityServerTypeAbstract deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
- throws IOException, JsonProcessingException {
+ throws IOException {
JsonToken token = jsonParser.getCurrentToken();
if (JsonToken.VALUE_STRING.equals(token)) {
return IdentityServerTypeAbstract.valueOf(jsonParser.getText());
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java index 600f88b7bd..a05d0b8872 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java @@ -22,17 +22,14 @@ package org.openecomp.mso.cloud; import java.io.IOException;
import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType;
-
public class IdentityServerTypeJsonSerializer extends JsonSerializer<IdentityServerTypeAbstract> {
@Override
public void serialize(IdentityServerTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
- throws IOException, JsonProcessingException {
+ throws IOException {
jsonGenerator.writeObject(tmpObj.toString());
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java index 8236307f45..85cb2967d6 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java @@ -39,10 +39,7 @@ import com.woorea.openstack.keystone.model.Authentication; public final class AuthenticationMethodFactory {
private static Map<String, AuthenticationWrapper> authWrappers = new ConcurrentHashMap<>();
-
- /**
- *
- */
+
private AuthenticationMethodFactory() {}
/**
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java index 2b8da9f641..c96b809ff9 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java @@ -23,7 +23,6 @@ package org.openecomp.mso.cloud.authentication.models; -import org.codehaus.jackson.annotate.JsonIgnore; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.annotate.JsonRootName; import com.woorea.openstack.keystone.model.Authentication; @@ -31,17 +30,8 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class RackspaceAuthentication extends Authentication { - /** - * - */ private static final long serialVersionUID = 5451283386875662918L; - @JsonIgnore - private String tenantId; - - @JsonIgnore - private String tenantName; - public static final class Token { private String username; diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java index fe380b27b9..7e21d9d15a 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java @@ -20,29 +20,22 @@ package org.openecomp.mso.openstack.exceptions; - /** - * Cloud site not found exception. + * Signals that an attempt to find a specific mso cloud identity has failed. */ public class MsoCloudIdentityNotFound extends MsoException { - /** - * Serialization id. - */ private static final long serialVersionUID = 2583769056266415665L; + /** * Default constructor (needed for BPEL/JAXB) */ public MsoCloudIdentityNotFound () { super("Cloud Identity not found"); super.category=MsoExceptionCategory.USERDATA; - } - - /** - * Constructor to create a new MsoOpenstackException instance - * @param cloudSite the cloud site - */ + } + public MsoCloudIdentityNotFound (String cloudIdentity) { // Set the detailed error as the Exception 'message' super("Cloud Identity [" + cloudIdentity + "] not found"); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java index 17a5d55698..7c6e98d55f 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java @@ -20,15 +20,11 @@ package org.openecomp.mso.openstack.exceptions; - /** - * Cloud site not found exception. + * Signals that an attempt to find a specific mso cloud site has failed. */ public class MsoCloudSiteNotFound extends MsoException { - /** - * Serialization id. - */ private static final long serialVersionUID = 2583769056266415664L; /** @@ -38,11 +34,7 @@ public class MsoCloudSiteNotFound extends MsoException { super("Cloud site not found"); super.category=MsoExceptionCategory.USERDATA; } - - /** - * Constructor to create a new MsoOpenstackException instance - * @param cloudSite the cloud site - */ + public MsoCloudSiteNotFound (String cloudSite) { // Set the detailed error as the Exception 'message' super("Cloud Site [" + cloudSite + "] not found"); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java index 49d3a267a0..7a597d6f4d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java @@ -7,9 +7,9 @@ * 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. @@ -20,16 +20,13 @@ package org.openecomp.mso.openstack.exceptions; - - public class MsoTenantAlreadyExists extends MsoOpenstackException { private static final long serialVersionUID = 1L; - // Constructor to create a new MsoOpenstackException instance public MsoTenantAlreadyExists (String tenant, String cloud) { // Set the detailed error as the Exception 'message' super(409, "Conflict", "Tenant " + tenant + " already exists in Cloud " + cloud); } - + } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java deleted file mode 100644 index 43a6171699..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.openstack.utils; - - -import javax.ejb.EJB; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; - -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudConfigIdentityMapper; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class will attempt to initialize Cloud Config when part of a web application. - * - * - * - */ -@WebListener -public class CloudConfigInitializer implements ServletContextListener -{ - - private CloudConfigFactory cloudConfigFactory=new CloudConfigFactory(); - - public CloudConfigInitializer () { - } - - @Override - public void contextDestroyed(ServletContextEvent event) { - // Nothing to do... - } - - - @Override - public void contextInitialized(ServletContextEvent event) - { - - // Note - this logger may be before or after MSO Logging configuration applied - MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - try { - // Look first in the init-parameters - String msoPropConfigParam = event.getServletContext().getInitParameter("mso.cloud_config.configuration"); - - String[] configFileSplit = msoPropConfigParam.split(","); - for (String msoPropConfig:configFileSplit) { - String[] msoPropDecoded = msoPropConfig.split("="); - - try { - cloudConfigFactory.initializeCloudConfig(msoPropDecoded[0], Integer.valueOf(msoPropDecoded[1])); - initLogger.info(MessageEnum.RA_CONFIG_LOAD, msoPropDecoded[0], "", ""); - initLogger.debug("Mso properties successfully loaded:"+msoPropDecoded[0]+"(Timer(mins):"+Integer.valueOf(msoPropDecoded[1])); - } catch (NumberFormatException ne) { - initLogger.error(MessageEnum.RA_CONFIG_EXC, msoPropDecoded[0] + ". MSO Properties failed due to conversion error (in web.xml file)", "", "", MsoLogger.ErrorCode.DataError, "MSO Properties failed due to conversion error (in web.xml file)", ne); - } - } - - // Second, obtain class name that will register all mappings - String msoMapperClassParam = event.getServletContext().getInitParameter("mso.cloud_config.mapper.class"); - if (msoMapperClassParam != null) { - Class<?> mapperClass = Class.forName(msoMapperClassParam); - if (CloudConfigIdentityMapper.class.isAssignableFrom(mapperClass)) { - ((CloudConfigIdentityMapper)mapperClass.newInstance()).registerAllMappings(); - initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class)","",""); - } else { - initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class not an implementation of CloudConfigIdentityMapper)","",""); - } - } else { - initLogger.info(MessageEnum.RA_CONFIG_LOAD,"Openstack authentication mapper class not specified in web.xml (ONLY core authentication mechanisms will be loaded)","",""); - } - - } - catch (Exception e) { - initLogger.error(MessageEnum.RA_CONFIG_EXC, "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception - MSO Properties failed to initialize completely", e); - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java index e47dea6350..269f6b0cdf 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java @@ -40,14 +40,12 @@ import com.woorea.openstack.quantum.model.NeutronError; public class MsoCommonUtils { - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - - protected static String retryDelayProp = "ecomp.mso.adapters.po.retryDelay"; + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + protected static String retryDelayProp = "ecomp.mso.adapters.po.retryDelay"; protected static String retryCountProp = "ecomp.mso.adapters.po.retryCount"; protected static String retryCodesProp = "ecomp.mso.adapters.po.retryCodes"; - - protected static int retryDelayDefault = 5; + protected static int retryDelayDefault = 5; protected static int retryCountDefault = 3; protected static String retryCodesDefault = "504"; @@ -81,7 +79,6 @@ public class MsoCommonUtils { } } - long start = System.currentTimeMillis (); String requestType; if (request.getClass ().getEnclosingClass () != null) { requestType = request.getClass ().getEnclosingClass ().getSimpleName () + "." @@ -308,7 +305,7 @@ public class MsoCommonUtils { public static boolean isNullOrEmpty (String s) { return s == null || s.isEmpty(); } - - + + } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java index 8e35e39b22..ee89840c50 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java @@ -26,8 +26,6 @@ import java.util.Calendar; import java.util.HashMap; import java.util.Map; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; import org.openecomp.mso.cloud.CloudIdentity; import org.openecomp.mso.cloud.CloudSite; import org.openecomp.mso.logger.MsoAlarmLogger; @@ -39,9 +37,6 @@ import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; import org.openecomp.mso.openstack.exceptions.MsoException; import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; import org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; import com.woorea.openstack.base.client.OpenStackBaseException; import com.woorea.openstack.base.client.OpenStackConnectException; import com.woorea.openstack.base.client.OpenStackRequest; @@ -87,7 +82,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { * <p> * * @param tenantName The tenant name to create - * @param cloudId The cloud identifier (may be a region) in which to create the tenant. + * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant. * @return the tenant ID of the newly created tenant * @throws MsoTenantAlreadyExists Thrown if the requested tenant already exists * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception @@ -200,7 +195,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils { * @return the tenant properties of the queried tenant, or null if not found * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception */ - public MsoTenant queryTenant (String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound { + public MsoTenant queryTenant (String tenantId, String cloudSiteId) throws MsoException { // Obtain the cloud site information where we will query the tenant CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId); if (cloudSite == null) { @@ -679,11 +674,11 @@ public class MsoKeystoneUtils extends MsoTenantUtils { * This may be useful if cached credentials get out of sync. */ public static void adminCacheReset () { - adminClientCache = new HashMap <String, KeystoneCacheEntry> (); + adminClientCache = new HashMap<>(); } @Override - public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity) throws MsoException { + public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity) { return cloudIdentity.getIdentityUrl(); } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java index be49cd947f..a659fb629e 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java @@ -24,19 +24,14 @@ import org.openecomp.mso.cloud.CloudConfig; import org.openecomp.mso.cloud.CloudConfigFactory; import org.openecomp.mso.cloud.CloudIdentity; import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; import java.lang.reflect.InvocationTargetException; public class MsoTenantUtilsFactory { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private CloudConfigFactory cloudConfigFactory= new CloudConfigFactory(); - protected CloudConfig cloudConfig; - protected MsoJavaProperties msoProps = null; + private CloudConfig cloudConfig; private String msoPropID; public MsoTenantUtilsFactory (String msoPropID) { diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java index 4d9b64e920..dd1b396fae 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java @@ -35,12 +35,8 @@ import org.openecomp.mso.cloud.CloudIdentity; import org.openecomp.mso.cloud.CloudSite; import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; - - /** * This class implements test methods of the CloudConfig features. - * - * */ public class CloudConfigTest { @@ -110,37 +106,29 @@ public class CloudConfigTest { CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP"); CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1"); -// assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0"); -// assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0"); - assertEquals (identity1.getMsoId(), "john"); - assertEquals (identity1.getMsoPass(), "changeme"); - assertEquals (identity1.getAdminTenant(), "admin"); - assertEquals (identity1.getMemberRole(), "_member_"); - assertEquals (identity1.hasTenantMetadata(), false); - -// assertEquals (identity2.getKeystoneUrl(), "http://localhost:5000/v2.0"); -// assertEquals (identity2.getIdentityUrl(), "http://localhost:5000/v2.0"); - assertEquals (identity2.getMsoId(), "mockId"); - assertEquals (identity2.getMsoPass(), "stack123"); - assertEquals (identity2.getAdminTenant(), "service"); - assertEquals (identity2.getMemberRole(), "_member_"); - assertEquals (identity2.hasTenantMetadata(), false); - -// assertEquals (identity3.getKeystoneUrl(), "http://localhost:5000/v2.0"); -// assertEquals (identity3.getIdentityUrl(), "http://localhost:5000/v2.0"); - assertEquals (identity3.getMsoId(), "mockIdToo"); - assertEquals (identity3.getMsoPass(), "AICG@mm@@2015"); - assertEquals (identity3.getAdminTenant(), "service"); - assertEquals (identity3.getMemberRole(), "admin"); - assertEquals (identity3.hasTenantMetadata(), true); - -// assertEquals (identity4.getKeystoneUrl(), "https://localhost:5000/v2.0"); -// assertEquals (identity4.getIdentityUrl(), "https://localhost:5000/v2.0"); - assertEquals (identity4.getMsoId(), "mockIdToo"); - assertEquals (identity4.getMsoPass(), "2315QRS2015srq"); - assertEquals (identity4.getAdminTenant(), "service"); - assertEquals (identity4.getMemberRole(), "admin"); - assertEquals (identity4.hasTenantMetadata(), true); + assertEquals("john", identity1.getMsoId()); + assertEquals("changeme", identity1.getMsoPass()); + assertEquals("admin", identity1.getAdminTenant()); + assertEquals("_member_", identity1.getMemberRole()); + assertEquals(false, identity1.hasTenantMetadata()); + + assertEquals("mockId", identity2.getMsoId()); + assertEquals("stack123", identity2.getMsoPass()); + assertEquals("service", identity2.getAdminTenant()); + assertEquals("_member_", identity2.getMemberRole()); + assertEquals(false, identity2.hasTenantMetadata()); + + assertEquals("mockIdToo", identity3.getMsoId()); + assertEquals("AICG@mm@@2015", identity3.getMsoPass()); + assertEquals("service", identity3.getAdminTenant()); + assertEquals("admin", identity3.getMemberRole()); + assertEquals(true, identity3.hasTenantMetadata()); + + assertEquals("mockIdToo", identity4.getMsoId()); + assertEquals("2315QRS2015srq", identity4.getMsoPass()); + assertEquals("service", identity4.getAdminTenant()); + assertEquals("admin", identity4.getMemberRole()); + assertEquals(true, identity4.hasTenantMetadata()); } @@ -162,8 +150,6 @@ public class CloudConfigTest { public final void testGetIdentityService () { CloudIdentity identity1 = con.getIdentityService("MT_KEYSTONE"); assertNotNull(identity1); -// assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0"); -// assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0"); assertEquals (identity1.getMsoId(), "john"); assertEquals (identity1.getMsoPass(), "changeme"); assertEquals (identity1.getAdminTenant(), "admin"); |