aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main/java
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-02-21 09:59:31 +0000
committerGerrit Code Review <gerrit@onap.org>2018-02-21 09:59:31 +0000
commit6bf073fdfa10a3b5c9b5d726b4284e8b30b727ce (patch)
tree78c876dfe4e92d37719d871fdc348ad9a2574075 /adapters/mso-adapter-utils/src/main/java
parent8f596cf8bbe7df943b0ff53442b0f1ad59d67c89 (diff)
parentef8c8012c037b0cefbdbf930819524e2050d7c87 (diff)
Merge "add junit for AuthenticationMethodFactory"
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java27
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java9
2 files changed, 11 insertions, 25 deletions
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 d0ba7e09fc..ba9a7d5007 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
@@ -23,28 +23,23 @@
package org.openecomp.mso.cloud;
-import java.io.IOException;
-import java.net.URISyntaxException;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
import java.security.GeneralSecurityException;
-
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-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.wrappers.RackspaceAPIKeyWrapper;
import org.openecomp.mso.cloud.authentication.wrappers.UsernamePasswordWrapper;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
-
-import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+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.utils.CryptoUtils;
-import com.woorea.openstack.keystone.model.Authentication;
/**
* JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity
@@ -143,15 +138,11 @@ public class CloudIdentity {
}
}
}
-
- public Authentication getAuthentication () throws MsoException {
+
+ public Authentication getAuthentication() {
if (this.getIdentityAuthenticationType() != null) {
- try {
return AuthenticationMethodFactory.getAuthenticationFor(this);
- } catch (IllegalAccessException | InstantiationException | ClassNotFoundException | IOException | URISyntaxException e) {
- throw new MsoAdapterException("Could not retrieve authentication for " + this.identityAuthenticationType, e);
- }
- } else { // Fallback
+ } else {
return new UsernamePassword(this.getMsoId(), this.getMsoPass());
}
}
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 85cb2967d6..c9be2c7949 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
@@ -23,18 +23,13 @@
package org.openecomp.mso.cloud.authentication;
-import java.io.IOException;
-import java.net.URISyntaxException;
+import com.woorea.openstack.keystone.model.Authentication;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-
import org.openecomp.mso.cloud.CloudIdentity;
-import com.woorea.openstack.keystone.model.Authentication;
-
/**
* This factory manages all the wrappers associated to authentication types.
- *
*/
public final class AuthenticationMethodFactory {
@@ -58,7 +53,7 @@ public final class AuthenticationMethodFactory {
}
}
- public static final synchronized Authentication getAuthenticationFor(CloudIdentity cloudIdentity) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException, URISyntaxException {
+ public static final synchronized Authentication getAuthenticationFor(CloudIdentity cloudIdentity) {
if (cloudIdentity == null) {
throw new IllegalArgumentException("Cloud identity cannot be null");
}