aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapter-utils')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java58
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java150
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java87
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java76
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java154
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java90
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java76
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java158
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java116
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java110
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java110
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java19
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java230
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java112
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java126
16 files changed, 842 insertions, 831 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
index a765f80..5ef33a3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java
@@ -1,29 +1,29 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.cloud;
-
-/**
- * This interface provides the method signature for mapping registration.
- * All mappings should be registered by the implementing class.
- */
-public interface CloudConfigIdentityMapper {
-
- public void registerAllMappings();
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+/**
+ * This interface provides the method signature for mapping registration.
+ * All mappings should be registered by the implementing class.
+ */
+public interface CloudConfigIdentityMapper {
+
+ public void registerAllMappings();
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java
index 45a7973..d36f775 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java
@@ -1,75 +1,75 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.cloud;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
-
-public abstract class IdentityAuthenticationTypeAbstract {
-
- // This map will prevent duplicates (as if it was an Enum).
- // Without this, using an instance specific field for the class could allow
- // different classes bound to the same entry name.
- private static final Map<String, IdentityAuthenticationTypeAbstract> entries = new ConcurrentHashMap<>();
-
- private String identityType;
-
- private Class<? extends AuthenticationWrapper> wrapperClass;
-
- protected IdentityAuthenticationTypeAbstract(String identityType, Class<? extends AuthenticationWrapper> wrapperClass) {
- try {
- this.identityType = identityType;
- this.wrapperClass = wrapperClass;
- entries.put(identityType, this);
- AuthenticationWrapper.register(this.toString(), wrapperClass);
- } catch (IllegalAccessException | InstantiationException e) {
- // Do not add the class if an exception occurs as we won't get the class anyway
- }
- }
-
- public static final IdentityAuthenticationTypeAbstract valueOf(String serverType) {
- return entries.get(serverType);
- }
-
- @Override
- public final String toString() {
- return this.identityType;
- }
-
- public final String name() {
- return this.identityType;
- }
-
- public static final IdentityAuthenticationTypeAbstract[] values() {
- return (IdentityAuthenticationTypeAbstract[]) entries.values().stream().toArray(IdentityAuthenticationTypeAbstract[]::new);
- }
-
- public final Class<? extends AuthenticationWrapper> getWrapperClass() {
- return this.wrapperClass;
- }
-
- @Override
- public final boolean equals(Object other) {
- return ((this.identityType != null) && (other != null) && (other instanceof IdentityAuthenticationTypeAbstract) && (this.identityType.equals(other.toString())));
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
+
+public abstract class IdentityAuthenticationTypeAbstract {
+
+ // This map will prevent duplicates (as if it was an Enum).
+ // Without this, using an instance specific field for the class could allow
+ // different classes bound to the same entry name.
+ private static final Map<String, IdentityAuthenticationTypeAbstract> entries = new ConcurrentHashMap<>();
+
+ private String identityType;
+
+ private Class<? extends AuthenticationWrapper> wrapperClass;
+
+ protected IdentityAuthenticationTypeAbstract(String identityType, Class<? extends AuthenticationWrapper> wrapperClass) {
+ try {
+ this.identityType = identityType;
+ this.wrapperClass = wrapperClass;
+ entries.put(identityType, this);
+ AuthenticationWrapper.register(this.toString(), wrapperClass);
+ } catch (IllegalAccessException | InstantiationException e) {
+ // Do not add the class if an exception occurs as we won't get the class anyway
+ }
+ }
+
+ public static final IdentityAuthenticationTypeAbstract valueOf(String serverType) {
+ return entries.get(serverType);
+ }
+
+ @Override
+ public final String toString() {
+ return this.identityType;
+ }
+
+ public final String name() {
+ return this.identityType;
+ }
+
+ public static final IdentityAuthenticationTypeAbstract[] values() {
+ return (IdentityAuthenticationTypeAbstract[]) entries.values().stream().toArray(IdentityAuthenticationTypeAbstract[]::new);
+ }
+
+ public final Class<? extends AuthenticationWrapper> getWrapperClass() {
+ return this.wrapperClass;
+ }
+
+ @Override
+ public final boolean equals(Object other) {
+ return ((this.identityType != null) && (other != null) && (other instanceof IdentityAuthenticationTypeAbstract) && (this.identityType.equals(other.toString())));
+ }
+
+}
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 c7b2c14..fd6ead2 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
@@ -1,44 +1,43 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.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 {
- JsonToken token = jsonParser.getCurrentToken();
- if (JsonToken.VALUE_STRING.equals(token)) {
- return IdentityAuthenticationTypeAbstract.valueOf(jsonParser.getText());
- } else {
- return null;
- }
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.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 {
+ JsonToken token = jsonParser.getCurrentToken();
+ if (JsonToken.VALUE_STRING.equals(token)) {
+ return IdentityAuthenticationTypeAbstract.valueOf(jsonParser.getText());
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java
index 06d877d..b599066 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java
@@ -1,38 +1,38 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.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 IdentityAuthenticationTypeJsonSerializer extends JsonSerializer<IdentityAuthenticationTypeAbstract> {
-
- @Override
- public void serialize(IdentityAuthenticationTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
- throws IOException, JsonProcessingException {
- jsonGenerator.writeObject(tmpObj.toString());
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.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 IdentityAuthenticationTypeJsonSerializer extends JsonSerializer<IdentityAuthenticationTypeAbstract> {
+
+ @Override
+ public void serialize(IdentityAuthenticationTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
+ throws IOException, JsonProcessingException {
+ jsonGenerator.writeObject(tmpObj.toString());
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java
index 38f1f87..d2658bc 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java
@@ -1,77 +1,77 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.cloud;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.openecomp.mso.openstack.utils.MsoTenantUtils;
-
-
-public abstract class IdentityServerTypeAbstract {
-
- // This map will prevent duplicates (as if it was an Enum).
- // Without this, using an instance specific field for the class could allow
- // different classes bound to the same entry name.
- private static final Map<String, IdentityServerTypeAbstract> entries = new ConcurrentHashMap<>();
-
- private String serverType;
-
- private Class<? extends MsoTenantUtils> utilsClass;
-
- protected IdentityServerTypeAbstract(String serverType, Class<? extends MsoTenantUtils> utilsClass) {
- if ((serverType == null) || (serverType.isEmpty())) {
- throw new IllegalArgumentException("Server Type name cannot be null or empty, provided value was " + serverType);
- }
- if (entries.containsKey(serverType)) {
- throw new IllegalArgumentException("Duplicate Server Type entry for registration: " + serverType);
- }
- this.serverType = serverType;
- this.utilsClass = utilsClass;
- entries.put(serverType, this);
- }
-
- public static final IdentityServerTypeAbstract valueOf(String serverType) {
- return entries.get(serverType);
- }
-
- @Override
- public final String toString() {
- return this.serverType;
- }
-
- public final String name() {
- return this.serverType;
- }
-
- public static final IdentityServerTypeAbstract[] values() {
- return (IdentityServerTypeAbstract[]) entries.values().stream().toArray(IdentityServerTypeAbstract[]::new);
- }
-
- public final Class<? extends MsoTenantUtils> getMsoTenantUtilsClass() {
- return this.utilsClass;
- }
-
- @Override
- public final boolean equals(Object other) {
- return ((this.serverType != null) && (other != null) && (other instanceof IdentityServerTypeAbstract) && (this.serverType.equals(other.toString())));
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.openecomp.mso.openstack.utils.MsoTenantUtils;
+
+
+public abstract class IdentityServerTypeAbstract {
+
+ // This map will prevent duplicates (as if it was an Enum).
+ // Without this, using an instance specific field for the class could allow
+ // different classes bound to the same entry name.
+ private static final Map<String, IdentityServerTypeAbstract> entries = new ConcurrentHashMap<>();
+
+ private String serverType;
+
+ private Class<? extends MsoTenantUtils> utilsClass;
+
+ protected IdentityServerTypeAbstract(String serverType, Class<? extends MsoTenantUtils> utilsClass) {
+ if ((serverType == null) || (serverType.isEmpty())) {
+ throw new IllegalArgumentException("Server Type name cannot be null or empty, provided value was " + serverType);
+ }
+ if (entries.containsKey(serverType)) {
+ throw new IllegalArgumentException("Duplicate Server Type entry for registration: " + serverType);
+ }
+ this.serverType = serverType;
+ this.utilsClass = utilsClass;
+ entries.put(serverType, this);
+ }
+
+ public static final IdentityServerTypeAbstract valueOf(String serverType) {
+ return entries.get(serverType);
+ }
+
+ @Override
+ public final String toString() {
+ return this.serverType;
+ }
+
+ public final String name() {
+ return this.serverType;
+ }
+
+ public static final IdentityServerTypeAbstract[] values() {
+ return (IdentityServerTypeAbstract[]) entries.values().stream().toArray(IdentityServerTypeAbstract[]::new);
+ }
+
+ public final Class<? extends MsoTenantUtils> getMsoTenantUtilsClass() {
+ return this.utilsClass;
+ }
+
+ @Override
+ public final boolean equals(Object other) {
+ return ((this.serverType != null) && (other != null) && (other instanceof IdentityServerTypeAbstract) && (this.serverType.equals(other.toString())));
+ }
+
+}
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 8b9da1a..c07954d 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
@@ -1,44 +1,46 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.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 {
- JsonToken token = jsonParser.getCurrentToken();
- if (JsonToken.VALUE_STRING.equals(token)) {
- return IdentityServerTypeAbstract.valueOf(jsonParser.getText());
- } else {
- return null;
- }
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.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 {
+ JsonToken token = jsonParser.getCurrentToken();
+ if (JsonToken.VALUE_STRING.equals(token)) {
+ return IdentityServerTypeAbstract.valueOf(jsonParser.getText());
+ } else {
+ return null;
+ }
+ }
+}
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 c008860..6db8e5b 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
@@ -1,38 +1,38 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.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 {
- jsonGenerator.writeObject(tmpObj.toString());
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.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 {
+ 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 feaafd3..8236307 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
@@ -1,79 +1,79 @@
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
-
-package org.openecomp.mso.cloud.authentication;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-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 {
-
- private static Map<String, AuthenticationWrapper> authWrappers = new ConcurrentHashMap<>();
-
- /**
- *
- */
- private AuthenticationMethodFactory() {}
-
- /**
- * Function to be called by classes implementing the abstract {@link AuthenticationWrapper#register(String, Class)}.
- */
- static final synchronized void register(String authenticationType, Class<? extends AuthenticationWrapper> wrapperClass) throws InstantiationException, IllegalAccessException {
- if ((authenticationType == null) || ("".equals(authenticationType))) {
- throw new IllegalArgumentException("Authentication Type to register cannot be null or an empty name string, provided value is " + authenticationType + ".");
- }
- if (wrapperClass == null) {
- throw new IllegalArgumentException("Wrapper Class to register for Authentication cannot be null");
- }
-
- if (!authWrappers.containsKey(authenticationType)) {
- authWrappers.put(authenticationType, wrapperClass.newInstance());
- }
- }
-
- public static final synchronized Authentication getAuthenticationFor(CloudIdentity cloudIdentity) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException, URISyntaxException {
- if (cloudIdentity == null) {
- throw new IllegalArgumentException("Cloud identity cannot be null");
- }
- if ((cloudIdentity.getIdentityAuthenticationType() == null) || ("".equals(cloudIdentity.getIdentityAuthenticationType().toString()))) {
- throw new IllegalArgumentException("Cloud identity authentication type cannot be null or empty, provided value is " + cloudIdentity.getIdentityAuthenticationType() + ".");
- }
- String authenticationType = cloudIdentity.getIdentityAuthenticationType().toString();
-
- if (authWrappers.containsKey(authenticationType)) {
- return authWrappers.get(authenticationType).getAuthentication(cloudIdentity);
- } else {
- throw new IllegalArgumentException("Provided authentication type (" + authenticationType + ") is not implemented by any wrapper.");
- }
- }
-}
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * 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============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
+
+package org.openecomp.mso.cloud.authentication;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+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 {
+
+ private static Map<String, AuthenticationWrapper> authWrappers = new ConcurrentHashMap<>();
+
+ /**
+ *
+ */
+ private AuthenticationMethodFactory() {}
+
+ /**
+ * Function to be called by classes implementing the abstract {@link AuthenticationWrapper#register(String, Class)}.
+ */
+ static final synchronized void register(String authenticationType, Class<? extends AuthenticationWrapper> wrapperClass) throws InstantiationException, IllegalAccessException {
+ if ((authenticationType == null) || ("".equals(authenticationType))) {
+ throw new IllegalArgumentException("Authentication Type to register cannot be null or an empty name string, provided value is " + authenticationType + ".");
+ }
+ if (wrapperClass == null) {
+ throw new IllegalArgumentException("Wrapper Class to register for Authentication cannot be null");
+ }
+
+ if (!authWrappers.containsKey(authenticationType)) {
+ authWrappers.put(authenticationType, wrapperClass.newInstance());
+ }
+ }
+
+ public static final synchronized Authentication getAuthenticationFor(CloudIdentity cloudIdentity) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException, URISyntaxException {
+ if (cloudIdentity == null) {
+ throw new IllegalArgumentException("Cloud identity cannot be null");
+ }
+ if ((cloudIdentity.getIdentityAuthenticationType() == null) || ("".equals(cloudIdentity.getIdentityAuthenticationType().toString()))) {
+ throw new IllegalArgumentException("Cloud identity authentication type cannot be null or empty, provided value is " + cloudIdentity.getIdentityAuthenticationType() + ".");
+ }
+ String authenticationType = cloudIdentity.getIdentityAuthenticationType().toString();
+
+ if (authWrappers.containsKey(authenticationType)) {
+ return authWrappers.get(authenticationType).getAuthentication(cloudIdentity);
+ } else {
+ throw new IllegalArgumentException("Provided authentication type (" + authenticationType + ") is not implemented by any wrapper.");
+ }
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java
index 8b3725c..77f405a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java
@@ -1,58 +1,58 @@
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
-
-package org.openecomp.mso.cloud.authentication;
-
-import org.openecomp.mso.cloud.CloudIdentity;
-
-import com.woorea.openstack.keystone.model.Authentication;
-
-/**
- * This abstract class provides the necessary method for registering authentication
- * types with wrapper classes, and also defines the contract for providing
- * Openstack-compatible Authentication implementations for said authentication types.
- *
- */
-public abstract class AuthenticationWrapper {
-
- /**
- * Registers the implementing class to the list of Authentication Wrappers.
- *
- * @param authenticationType The authentication type that is provided by the implementing class
- * @param wrapperClass The implementing class Class object
- * @throws InstantiationException If the provided implementing class cannot be instantiated
- * @throws IllegalAccessException If the provided implementing class cannot be instantiated
- */
- public static final void register(String authenticationType, Class<? extends AuthenticationWrapper> wrapperClass) throws InstantiationException, IllegalAccessException {
- AuthenticationMethodFactory.register(authenticationType, wrapperClass);
- }
-
- /**
- * Returns an OpenStack Authentication object for the provided CloudIdentity.
- *
- * @param cloudIdentity The input Cloud Identity instance
- * @return the OpenStack Authentication associated with this cloud identity instance
- */
- protected abstract Authentication getAuthentication(CloudIdentity cloudIdentity);
-
-}
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * 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============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
+
+package org.openecomp.mso.cloud.authentication;
+
+import org.openecomp.mso.cloud.CloudIdentity;
+
+import com.woorea.openstack.keystone.model.Authentication;
+
+/**
+ * This abstract class provides the necessary method for registering authentication
+ * types with wrapper classes, and also defines the contract for providing
+ * Openstack-compatible Authentication implementations for said authentication types.
+ *
+ */
+public abstract class AuthenticationWrapper {
+
+ /**
+ * Registers the implementing class to the list of Authentication Wrappers.
+ *
+ * @param authenticationType The authentication type that is provided by the implementing class
+ * @param wrapperClass The implementing class Class object
+ * @throws InstantiationException If the provided implementing class cannot be instantiated
+ * @throws IllegalAccessException If the provided implementing class cannot be instantiated
+ */
+ public static final void register(String authenticationType, Class<? extends AuthenticationWrapper> wrapperClass) throws InstantiationException, IllegalAccessException {
+ AuthenticationMethodFactory.register(authenticationType, wrapperClass);
+ }
+
+ /**
+ * Returns an OpenStack Authentication object for the provided CloudIdentity.
+ *
+ * @param cloudIdentity The input Cloud Identity instance
+ * @return the OpenStack Authentication associated with this cloud identity instance
+ */
+ protected abstract Authentication getAuthentication(CloudIdentity cloudIdentity);
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java
index 87ff258..5cf5587 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java
@@ -1,55 +1,55 @@
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
-
-package org.openecomp.mso.cloud.authentication.wrappers;
-
-import org.openecomp.mso.cloud.CloudIdentity;
-import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
-import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;
-
-import com.woorea.openstack.keystone.model.Authentication;
-
-/**
- * This class implements the authentication wrapper for Rackspace Authentication.
- *
- */
-public class RackspaceAPIKeyWrapper extends AuthenticationWrapper {
-
- /**
- *
- */
- public RackspaceAPIKeyWrapper() {
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity)
- */
- @Override
- public Authentication getAuthentication(CloudIdentity cloudIdentity) {
- if (cloudIdentity == null) {
- throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password");
- }
- return new RackspaceAuthentication (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ());
- }
-}
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * 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============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
+
+package org.openecomp.mso.cloud.authentication.wrappers;
+
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
+import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;
+
+import com.woorea.openstack.keystone.model.Authentication;
+
+/**
+ * This class implements the authentication wrapper for Rackspace Authentication.
+ *
+ */
+public class RackspaceAPIKeyWrapper extends AuthenticationWrapper {
+
+ /**
+ *
+ */
+ public RackspaceAPIKeyWrapper() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity)
+ */
+ @Override
+ public Authentication getAuthentication(CloudIdentity cloudIdentity) {
+ if (cloudIdentity == null) {
+ throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password");
+ }
+ return new RackspaceAuthentication (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ());
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java
index 2eebbb7..5fd3e52 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java
@@ -1,55 +1,55 @@
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
-
-package org.openecomp.mso.cloud.authentication.wrappers;
-
-import org.openecomp.mso.cloud.CloudIdentity;
-import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
-
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
-
-/**
- * This class implements the authentication wrapper for Openstack provided for
- * user name and password authentication.
- *
- */
-public class UsernamePasswordWrapper extends AuthenticationWrapper {
-
- /**
- *
- */
- public UsernamePasswordWrapper() {
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity)
- */
- @Override
- public Authentication getAuthentication(CloudIdentity cloudIdentity) {
- if (cloudIdentity == null) {
- throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password");
- }
- return new UsernamePassword (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ());
- }
-}
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * 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============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
+
+package org.openecomp.mso.cloud.authentication.wrappers;
+
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
+
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
+
+/**
+ * This class implements the authentication wrapper for Openstack provided for
+ * user name and password authentication.
+ *
+ */
+public class UsernamePasswordWrapper extends AuthenticationWrapper {
+
+ /**
+ *
+ */
+ public UsernamePasswordWrapper() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity)
+ */
+ @Override
+ public Authentication getAuthentication(CloudIdentity cloudIdentity) {
+ if (cloudIdentity == null) {
+ throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password");
+ }
+ return new UsernamePassword (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ());
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java
index 11a74d4..0125cce 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.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.
@@ -43,6 +43,7 @@ public class NetworkRollback {
private String tenantId;
private String cloudId;
private String networkType;
+ private String modelCustomizationUuid;
private boolean networkCreated = false;
// Previous values for updates
private String networkName = null;
@@ -63,7 +64,7 @@ public class NetworkRollback {
public void setNeutronNetworkId(String neutronNetworkId) {
this.neutronNetworkId = neutronNetworkId;
}
-
+
public String getNetworkStackId() {
return networkStackId;
}
@@ -91,6 +92,14 @@ public class NetworkRollback {
this.networkType = networkType;
}
+ public String getModelCustomizationUuid() {
+ return this.modelCustomizationUuid;
+ }
+
+ public void setModelCustomizationUuid(String modelCustomizationUuid) {
+ this.modelCustomizationUuid = modelCustomizationUuid;
+ }
+
public boolean getNetworkCreated() {
return networkCreated;
}
@@ -125,7 +134,7 @@ public class NetworkRollback {
public void setMsoRequest (MsoRequest msoRequest) {
this.msoRequest = msoRequest;
}
-
+
@Override
public String toString() {
return "NetworkRollback [networkId=" + networkId
@@ -135,5 +144,5 @@ public class NetworkRollback {
+ ", networkCreated=" + networkCreated + ", networkName=" + networkName
+ ", physicalNetwork=" + physicalNetwork + "]";
}
-
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index 99d5863..1c91fe2 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -984,6 +984,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
String heatUrl = null;
try {
heatUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "orchestration", region, "public");
+ LOGGER.debug("heatUrl=" + heatUrl + ", region=" + region);
} catch (RuntimeException e) {
// This comes back for not found (probably an incorrect region ID)
String error = "Orchestration service not found: region=" + region + ",cloud=" + cloudIdentity.getId ();
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java
index beb85a4..ccfede7 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java
@@ -1,115 +1,115 @@
-/*
- * ============LICENSE_START==========================================
- * ===================================================================
- * 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============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
- */
-
-package org.openecomp.mso.cloud.authentication;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import org.junit.Test;
-import org.openecomp.mso.cloud.CloudIdentity;
-import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
-
-/**
- * A few JUnit tests to evaluate the new factory that manages authentication
- * types and their associated wrapper classes. Here it is assumed that core types
- * only are tested.
- *
- */
-public class AuthenticationMethodTest {
-
- /**
- *
- */
- public AuthenticationMethodTest() {
- // TODO Auto-generated constructor stub
- }
-
- @Test
- public void testCustomRackspaceAuth() {
- CloudIdentity ci = new CloudIdentity();
- ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
- ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
- ci.setMsoId("test");
-
- try {
- Authentication auth = AuthenticationMethodFactory.getAuthenticationFor(ci);
- assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
- } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException
- | URISyntaxException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testCoreUsernamePasswordAuth() {
- CloudIdentity ci = new CloudIdentity();
- ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);
- ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
- ci.setMsoId("someuser");
-
- try {
- Authentication auth = AuthenticationMethodFactory.getAuthenticationFor(ci);
- assertTrue(UsernamePassword.class.equals(auth.getClass()));
- } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException
- | URISyntaxException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testCustomRackspaceAuthFromCloudIdentity() {
- CloudIdentity ci = new CloudIdentity();
- ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
- ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
- ci.setMsoId("test");
-
- try {
- Authentication auth = ci.getAuthentication();
- assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
- } catch (MsoException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testCoreUsernamePasswordAuthFromCloudIdentity() {
- CloudIdentity ci = new CloudIdentity();
- ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);
- ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
- ci.setMsoId("someuser");
-
- try {
- Authentication auth = ci.getAuthentication();
- assertTrue(UsernamePassword.class.equals(auth.getClass()));
- } catch (MsoException e) {
- e.printStackTrace();
- }
- }
-}
+/*
+ * ============LICENSE_START==========================================
+ * ===================================================================
+ * 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============================================
+ *
+ * ECOMP and OpenECOMP are trademarks
+ * and service marks of AT&T Intellectual Property.
+ *
+ */
+
+package org.openecomp.mso.cloud.authentication;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
+
+/**
+ * A few JUnit tests to evaluate the new factory that manages authentication
+ * types and their associated wrapper classes. Here it is assumed that core types
+ * only are tested.
+ *
+ */
+public class AuthenticationMethodTest {
+
+ /**
+ *
+ */
+ public AuthenticationMethodTest() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Test
+ public void testCustomRackspaceAuth() {
+ CloudIdentity ci = new CloudIdentity();
+ ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
+ ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
+ ci.setMsoId("test");
+
+ try {
+ Authentication auth = AuthenticationMethodFactory.getAuthenticationFor(ci);
+ assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
+ } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException
+ | URISyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testCoreUsernamePasswordAuth() {
+ CloudIdentity ci = new CloudIdentity();
+ ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);
+ ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
+ ci.setMsoId("someuser");
+
+ try {
+ Authentication auth = AuthenticationMethodFactory.getAuthenticationFor(ci);
+ assertTrue(UsernamePassword.class.equals(auth.getClass()));
+ } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException
+ | URISyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testCustomRackspaceAuthFromCloudIdentity() {
+ CloudIdentity ci = new CloudIdentity();
+ ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
+ ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
+ ci.setMsoId("test");
+
+ try {
+ Authentication auth = ci.getAuthentication();
+ assertTrue(RackspaceAuthentication.class.equals(auth.getClass()));
+ } catch (MsoException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testCoreUsernamePasswordAuthFromCloudIdentity() {
+ CloudIdentity ci = new CloudIdentity();
+ ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD);
+ ci.setMsoPass("FD205490A48D48475607C36B9AD902BF");
+ ci.setMsoId("someuser");
+
+ try {
+ Authentication auth = ci.getAuthentication();
+ assertTrue(UsernamePassword.class.equals(auth.getClass()));
+ } catch (MsoException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
index 1cbba3c..4b4f2b8 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java
@@ -1,56 +1,56 @@
-/**
- *
- */
-package org.openecomp.mso.cloud.servertype;
-
-import java.util.Map;
-
-import org.openecomp.mso.cloud.CloudIdentity;
-import org.openecomp.mso.openstack.beans.MsoTenant;
-import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-import org.openecomp.mso.openstack.utils.MsoTenantUtils;
-
-
-public class NewServerTypeUtils extends MsoTenantUtils {
-
- /**
- * @param msoPropID
- */
- public NewServerTypeUtils(String msoPropID) {
- super(msoPropID);
- }
-
- @Override
- public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout)
- throws MsoException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public MsoTenant queryTenant(String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public MsoTenant queryTenantByName(String tenantName, String cloudSiteId)
- throws MsoException, MsoCloudSiteNotFound {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean deleteTenant(String tenantId, String cloudSiteId) throws MsoException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity)
- throws MsoException {
- return msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl();
- }
-
-}
+/**
+ *
+ */
+package org.openecomp.mso.cloud.servertype;
+
+import java.util.Map;
+
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.openstack.beans.MsoTenant;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.utils.MsoTenantUtils;
+
+
+public class NewServerTypeUtils extends MsoTenantUtils {
+
+ /**
+ * @param msoPropID
+ */
+ public NewServerTypeUtils(String msoPropID) {
+ super(msoPropID);
+ }
+
+ @Override
+ public String createTenant(String tenantName, String cloudSiteId, Map<String, String> metadata, boolean backout)
+ throws MsoException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public MsoTenant queryTenant(String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public MsoTenant queryTenantByName(String tenantName, String cloudSiteId)
+ throws MsoException, MsoCloudSiteNotFound {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean deleteTenant(String tenantId, String cloudSiteId) throws MsoException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity)
+ throws MsoException {
+ return msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl();
+ }
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
index e2a0f86..9ac2513 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java
@@ -1,63 +1,63 @@
-/**
- *
- */
-package org.openecomp.mso.cloud.servertype;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import org.junit.Test;
-import org.openecomp.mso.cloud.CloudIdentity;
-import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType;
-import org.openecomp.mso.cloud.IdentityServerTypeAbstract;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-
-public class ServerTypeTest {
-
- @Test
- public void testKeystoneServerType() {
- IdentityServerTypeAbstract keystoneServerType = IdentityServerType.valueOf("KEYSTONE");
- assertNotNull(keystoneServerType);
- }
-
- @Test
- public void testNewServerType() {
- IdentityServerTypeAbstract customServerType = null;
- try {
- customServerType = new IdentityServerType("NewServerType", NewServerTypeUtils.class);
-
- } catch (IllegalArgumentException e) {
- fail("An exception should not be raised when we register a new server type for the first time");
- } finally {
- System.out.println(IdentityServerType.values().toString());
- assertEquals(customServerType, IdentityServerType.valueOf("NewServerType"));
- }
-
- // Create it a second time
- IdentityServerTypeAbstract customServerType2 = null;
- try {
- customServerType2 = new IdentityServerType("NewServerType", NewServerTypeUtils.class);
- fail("An exception should be raised as server type does not exist");
- } catch (IllegalArgumentException e) {
- // Fail silently -- it simply indicates we already registered it
- customServerType2 = IdentityServerType.valueOf("NewServerType");
- } finally {
- System.out.println(IdentityServerType.values().toString());
- assertEquals(customServerType2, IdentityServerType.valueOf("NewServerType"));
- }
-
- // Check the KeystoneURL for this custom TenantUtils
- CloudIdentity cloudIdentity = new CloudIdentity();
- cloudIdentity.setIdentityUrl("LocalIdentity");
- cloudIdentity.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
- cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.valueOf("NewServerType"));
- String regionId = "RegionA";
- String msoPropID = "12345";
- try {
- assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl());
- } catch (MsoException e) {
- fail("No MSO Exception should have occured here");
- }
- }
-}
+/**
+ *
+ */
+package org.openecomp.mso.cloud.servertype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType;
+import org.openecomp.mso.cloud.IdentityServerTypeAbstract;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+
+public class ServerTypeTest {
+
+ @Test
+ public void testKeystoneServerType() {
+ IdentityServerTypeAbstract keystoneServerType = IdentityServerType.valueOf("KEYSTONE");
+ assertNotNull(keystoneServerType);
+ }
+
+ @Test
+ public void testNewServerType() {
+ IdentityServerTypeAbstract customServerType = null;
+ try {
+ customServerType = new IdentityServerType("NewServerType", NewServerTypeUtils.class);
+
+ } catch (IllegalArgumentException e) {
+ fail("An exception should not be raised when we register a new server type for the first time");
+ } finally {
+ System.out.println(IdentityServerType.values().toString());
+ assertEquals(customServerType, IdentityServerType.valueOf("NewServerType"));
+ }
+
+ // Create it a second time
+ IdentityServerTypeAbstract customServerType2 = null;
+ try {
+ customServerType2 = new IdentityServerType("NewServerType", NewServerTypeUtils.class);
+ fail("An exception should be raised as server type does not exist");
+ } catch (IllegalArgumentException e) {
+ // Fail silently -- it simply indicates we already registered it
+ customServerType2 = IdentityServerType.valueOf("NewServerType");
+ } finally {
+ System.out.println(IdentityServerType.values().toString());
+ assertEquals(customServerType2, IdentityServerType.valueOf("NewServerType"));
+ }
+
+ // Check the KeystoneURL for this custom TenantUtils
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setIdentityUrl("LocalIdentity");
+ cloudIdentity.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY);
+ cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.valueOf("NewServerType"));
+ String regionId = "RegionA";
+ String msoPropID = "12345";
+ try {
+ assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl());
+ } catch (MsoException e) {
+ fail("No MSO Exception should have occured here");
+ }
+ }
+}