From 1788983cf083303c51d538608c92abbebef10307 Mon Sep 17 00:00:00 2001 From: Yuli Shlosberg Date: Sun, 8 Apr 2018 14:03:29 +0300 Subject: fix use of user credentials logic Change-Id: If518234e78983fe35ceb4b971d5093052ee824bb Issue-ID: SDC-384 Signed-off-by: Yuli Shlosberg --- .gitignore | 2 + asdctool/sdc-cassandra-init/Dockerfile | 2 +- catalog-be/sdc-backend-init/Dockerfile | 2 +- catalog-be/sdc-backend/Dockerfile | 2 +- catalog-fe/sdc-frontend/Dockerfile | 2 +- .../dependency-reduced-pom.xml | 7 --- sdc-os-chef/sdc-cassandra/Dockerfile | 2 +- sdc-os-chef/sdc-elasticsearch/Dockerfile | 2 +- sdc-os-chef/sdc-init-elasticsearch/Dockerfile | 2 +- sdc-os-chef/sdc-kibana/Dockerfile | 2 +- test-apis-ci/sdc-api-tests/Dockerfile | 2 +- .../files/default/conf/credentials.yaml | 42 ++++++------- .../openecomp/sdc/ci/tests/config/MainToTest.java | 67 +++++++++++++++++++++ .../ci/tests/config/UserCredentialsFromFile.java | 56 +++++------------- .../sdc/ci/tests/datatypes/enums/UserRoleEnum.java | 69 ++++++++++++++-------- .../execute/service/UpdateServiceMetadataTest.java | 2 +- .../execute/user/ActivateDeActivateDeleteUser.java | 2 +- .../org/openecomp/sdc/ci/tests/sanity/Onboard.java | 12 ++-- .../src/main/resources/ci/conf/credentials.yaml | 48 +++++++++++++++ ui-ci/pom.xml | 19 ++++++ .../files/default/conf/credentials.yaml | 42 ++++++------- .../tests/execute/sanity/AdminUserManagment.java | 10 ++-- .../sdc/ci/tests/execute/setup/SetupCDTest.java | 39 ++---------- utils/webseal-simulator/pom.xml | 2 +- utils/webseal-simulator/sdc-simulator/Dockerfile | 2 +- 25 files changed, 265 insertions(+), 174 deletions(-) create mode 100644 test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java create mode 100644 test-apis-ci/src/main/resources/ci/conf/credentials.yaml diff --git a/.gitignore b/.gitignore index fe04086ca5..6fcd3c0973 100644 --- a/.gitignore +++ b/.gitignore @@ -262,3 +262,5 @@ utils/DmaapPublisher/logs/* /openecomp-ui/yarn.lock + +/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/Files/VNFs/* diff --git a/asdctool/sdc-cassandra-init/Dockerfile b/asdctool/sdc-cassandra-init/Dockerfile index c91358d563..c1069c8b99 100644 --- a/asdctool/sdc-cassandra-init/Dockerfile +++ b/asdctool/sdc-cassandra-init/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-cqlsh:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-cqlsh:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/catalog-be/sdc-backend-init/Dockerfile b/catalog-be/sdc-backend-init/Dockerfile index d9f0237620..33d3760cdf 100644 --- a/catalog-be/sdc-backend-init/Dockerfile +++ b/catalog-be/sdc-backend-init/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-python:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-python:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/catalog-be/sdc-backend/Dockerfile b/catalog-be/sdc-backend/Dockerfile index a7b1aa20b1..20a4624a49 100644 --- a/catalog-be/sdc-backend/Dockerfile +++ b/catalog-be/sdc-backend/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-jetty:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-jetty:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/catalog-fe/sdc-frontend/Dockerfile b/catalog-fe/sdc-frontend/Dockerfile index 2f9b3d1184..75cbd8c44c 100644 --- a/catalog-fe/sdc-frontend/Dockerfile +++ b/catalog-fe/sdc-frontend/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-jetty:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-jetty:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml index fe0bab29f6..b1c35cf3a9 100644 --- a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml @@ -10,13 +10,6 @@ openecomp-sdc-artifact-generator-test - - maven-compiler-plugin - - 1.7 - 1.7 - - maven-shade-plugin ${mvn.shade.version} diff --git a/sdc-os-chef/sdc-cassandra/Dockerfile b/sdc-os-chef/sdc-cassandra/Dockerfile index 3c3fc01dc7..2f8ecb7785 100644 --- a/sdc-os-chef/sdc-cassandra/Dockerfile +++ b/sdc-os-chef/sdc-cassandra/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-cassandra:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-cassandra:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/sdc-os-chef/sdc-elasticsearch/Dockerfile b/sdc-os-chef/sdc-elasticsearch/Dockerfile index 20aa225a80..9b9883e454 100644 --- a/sdc-os-chef/sdc-elasticsearch/Dockerfile +++ b/sdc-os-chef/sdc-elasticsearch/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-elasticsearch:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-elasticsearch:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/sdc-os-chef/sdc-init-elasticsearch/Dockerfile b/sdc-os-chef/sdc-init-elasticsearch/Dockerfile index 63fba6caaf..cfcf4b9f2b 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/Dockerfile +++ b/sdc-os-chef/sdc-init-elasticsearch/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-sanity:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-sanity:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/sdc-os-chef/sdc-kibana/Dockerfile b/sdc-os-chef/sdc-kibana/Dockerfile index d17602febb..c62f1db69d 100644 --- a/sdc-os-chef/sdc-kibana/Dockerfile +++ b/sdc-os-chef/sdc-kibana/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-kibana:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-kibana:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/test-apis-ci/sdc-api-tests/Dockerfile b/test-apis-ci/sdc-api-tests/Dockerfile index 2be415080e..d419224251 100644 --- a/test-apis-ci/sdc-api-tests/Dockerfile +++ b/test-apis-ci/sdc-api-tests/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-sanity:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-sanity:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml index ab37f7bee8..05f9a71c5c 100644 --- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml @@ -1,48 +1,48 @@ designer: { username: cs0008, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } admin: { username: jh0003, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } ops: { - username: af0006, + username: op0001, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } tester: { - username: kb0004, + username: jm0007, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } governor: { - username: ah0002, + username: gv0001, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } product_strategist: { username: m99126, - password: 1910-FruitGum, - firstname: ASDC, - lastname: KASPIN + password: 123123a, + firstname: SDC, + lastname: SDC2 } product_manager: { username: m99127, - password: 747-Airplane, - firstname: ASDC, - lastname: KASPIN + password: 123123a, + firstname: SDC, + lastname: SDC2 } product_local: { username: pm0001, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } \ No newline at end of file diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java new file mode 100644 index 0000000000..64f1a72034 --- /dev/null +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java @@ -0,0 +1,67 @@ +package org.openecomp.sdc.ci.tests.config; + + +import fj.data.Either; +import org.apache.commons.io.IOUtils; +import org.json.JSONObject; +import org.openecomp.sdc.be.model.Service; +import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum; +import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse; +import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils; +import org.openecomp.sdc.ci.tests.utils.general.FileHandling; +import org.yaml.snakeyaml.Yaml; + +import java.io.*; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +public class MainToTest { + + private static final String CREDENTIALS_FILE = "credentials.yaml"; + + public static void main(String[] args) throws Exception { + System.out.println("Hello World!"); // Display the string. + System.out.println("user.dir: " + System.getProperty("user.dir")); + System.out.println(UserRoleEnum.DESIGNER.getFirstName()); + String file = readFile(); + convertToJson(file); + Either createDefaultService1e = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true); + + + + } + + private static String convertToJson(String yamlString) { + Yaml yaml = new Yaml(); + Map map = (Map) yaml.load(yamlString); + + JSONObject jsonObject = new JSONObject(map); + return jsonObject.toString(); + } + + private static String readFile() { + + File credentialsFileLocal = new File(FileHandling.getSdcVnfsPath() + File.separator + "conf" + + File.separator + CREDENTIALS_FILE); + + InputStream inputStream = null; + try { + inputStream = new FileInputStream(credentialsFileLocal); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + finally { + try { + String mystr = IOUtils.toString(inputStream, Charset.forName("UTF-8")); + inputStream.close(); + return mystr; + } catch(IOException e) { + } + } + + return null; + } + + +} diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java index 42f06f2bd3..c6e684c020 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java @@ -5,55 +5,34 @@ import org.openecomp.sdc.ci.tests.utils.general.FileHandling; import org.yaml.snakeyaml.Yaml; import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Paths; +import java.util.HashMap; import java.util.Map; public class UserCredentialsFromFile { private static final String CREDENTIALS_FILE = "credentials.yaml"; - private static Map credentials; + private static Map credentials; private static Yaml yaml = new Yaml(); - private static UserCredentialsFromFile credentialsFromFile; -// private UserCredentialsFromFile() { -// -// } + private static final UserCredentialsFromFile instance = new UserCredentialsFromFile(); - public synchronized static UserCredentialsFromFile getInstance() { - if (credentialsFromFile == null) { - try { - credentialsFromFile = new UserCredentialsFromFile(); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - return credentialsFromFile; + public static UserCredentialsFromFile getInstance(){ + return instance; } - private void UserCredentialsFromFile() throws IOException { + private UserCredentialsFromFile() { credentials = null; File credentialsFileRemote = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE); // File credentialsFileLocal = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE); - File credentialFile = new File(FileHandling.getSdcVnfsPath() + File.separator + "conf" + File credentialsFileLocal = new File(FileHandling.getSdcVnfsPath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE); - - if (false == credentialFile.exists()) { - throw new RuntimeException("The config file " + credentialFile + " cannot be found."); - } - - - File[] credentialFiles = {credentialsFileRemote, credentialFile}; - + File[] credentialFiles = {credentialsFileRemote, credentialsFileLocal}; for (File credentialsFile : credentialFiles){ if (credentialsFile.exists()){ try { - credentials = FileHandling.parseYamlFile(credentialsFile.getAbsolutePath()); + credentials = (Map) FileHandling.parseYamlFile(credentialsFile.getAbsolutePath()); } catch (Exception e) { e.printStackTrace(); } @@ -62,19 +41,16 @@ public class UserCredentialsFromFile { } - } - - public static UserCredentials getUserCredentialsByRole(String userRole) throws Exception { - @SuppressWarnings("unchecked") + public UserCredentials getUserCredentialsByRole(String userRole) { Map credentialsMap = (Map) credentials.get(userRole); - String user = (String) credentialsMap.get("username"); - String password = (String) credentialsMap.get("password"); - String firstname = (String) credentialsMap.get("firstname"); - String lastname = (String) credentialsMap.get("lastname"); - - return new UserCredentials(user, password, firstname, lastname, userRole); + UserCredentials userCredentials = new UserCredentials(); + userCredentials.setUserId(credentialsMap.get("username")); + userCredentials.setFirstName(credentialsMap.get("firstname")); + userCredentials.setLastName(credentialsMap.get("lastname")); + userCredentials.setPassword(credentialsMap.get("password")); + return userCredentials; } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java index aa70c376bb..7f19d45dfb 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java @@ -20,30 +20,44 @@ package org.openecomp.sdc.ci.tests.datatypes.enums; +import org.openecomp.sdc.ci.tests.config.UserCredentialsFromFile; +import org.openecomp.sdc.ci.tests.datatypes.UserCredentials; + public enum UserRoleEnum { -// ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Joni", "Mitchell"), ADMIN4("km2000", "Kot", "May"), +// ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("cs0008", "Carlos", "Santana"), DESIGNER2("me0009", "Melissa","Etheridge"), TESTER("jm0007", "Joni", "Mitchell"), ADMIN4("km2000", "Kot", "May"), // GOVERNOR("gv0001","David", "Shadmi"), OPS("op0001", "Steve", "Regev"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), // PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); - ADMIN("jh0003", "Jimmy", "Hendrix"), DESIGNER("m08740", "Zero", "ASDCMech"), DESIGNER2("me0009", "Melissa","Etheridge"), DESIGNER3("cs0008", "Carlos", "Santana"),TESTER("jm0007", "Johnny", "Depp"), ADMIN4("km2000", "Kot", "May"), - GOVERNOR("gv0001","David", "Shadmi"), OPS("af0006", "Aretha", "Franklin"), PRODUCT_STRATEGIST1("ps0001", "Eden","Rozin"), PRODUCT_STRATEGIST2("ps0002", "Ella", "Kvetny"), PRODUCT_STRATEGIST3("ps0003", "Geva", "Alon"), - PRODUCT_MANAGER1("pm0001", "Teddy", "Isashar"), PRODUCT_MANAGER2("pm0002", "Sarah", "Bettens"); + ADMIN("admin"), + ADMIN2("admin"), + DESIGNER("designer"), + DESIGNER2("designer"), + TESTER("tester"), + GOVERNOR("governor"), + OPS("ops"), + PRODUCT_STRATEGIST1("ops"), + PRODUCT_STRATEGIST2("ops"), + PRODUCT_STRATEGIST3("ops"), + PRODUCT_MANAGER1("ops"), + PRODUCT_MANAGER2("ops"); + + private String password; private String userId; private String firstName; - private String lastName; - private String userName; + private String lastName; - private UserRoleEnum(String userId, String userName) { - this.userId = userId; - this.userName = userName; - } - private UserRoleEnum(String userId, String firstName, String lastName) { - this.userId = userId; - this.firstName = firstName; - this.lastName = lastName; - this.userName = firstName + " " + lastName; - } + private UserRoleEnum(String userRole) { + String name = name(); + final UserCredentialsFromFile instance = UserCredentialsFromFile.getInstance(); + this.credentials = instance.getUserCredentialsByRole(userRole); + this.userId = this.credentials.getUserId(); + this.firstName = this.credentials.getFirstName(); + this.lastName = this.credentials.getLastName(); + this.password = this.credentials.getPassword(); + this.userName = this.firstName + " " + this.lastName; + } + public String getUserId() { return userId; @@ -53,14 +67,6 @@ public enum UserRoleEnum { this.userId = userId; } - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - public String getFirstName() { return firstName; } @@ -69,12 +75,23 @@ public enum UserRoleEnum { this.firstName = firstName; } + public UserCredentials getCredentials() { + return credentials; + } + public String getLastName() { return lastName; } - public void setLastName(String lastName) { - this.lastName = lastName; + public String getUserName() { + return userName; } + private String userName; + private UserCredentials credentials; + + + public String getPassword() { + return password; + } } diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java index 9ab4d0b0dc..304f61d280 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java @@ -89,7 +89,7 @@ public class UpdateServiceMetadataTest extends ComponentBaseTest { sdncDesignerDetails = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); sdncDesignerDetails2 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER2); sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN); - sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN4); + sdncAdminDetails = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN2); sdncGovernorDeatails = ElementFactory.getDefaultUser(UserRoleEnum.GOVERNOR); sdncTesterDetails = ElementFactory.getDefaultUser(UserRoleEnum.TESTER); sdncOpsDetails = ElementFactory.getDefaultUser(UserRoleEnum.OPS); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java index 24afcec40f..28cf1b787f 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java @@ -591,7 +591,7 @@ public class ActivateDeActivateDeleteUser extends ComponentBaseTest { // resource--------------------------------------------------------------------------------- // import new resource with CERTIFIED state - User importer = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN4); + User importer = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN2); RestResponse importResponse = ImportRestUtils.importResourceByName(resourceDetails, importer); assertNotNull("check response object is not null after create user", importResponse); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java index 8d62dae8bf..a64c3771c3 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java @@ -106,7 +106,7 @@ public class Onboard extends ComponentBaseTest { public void runOnboardToDistributionFlow(String filePath, String vnfFile) throws Exception { ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile)); - User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER3); + User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER); ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); Pair createVendorSoftwareProduct = OnboardingUtillViaApis.createVspViaApis(resourceReqDetails, filePath, vnfFile, user); VendorSoftwareProductObject vendorSoftwareProductObject = createVendorSoftwareProduct.right; @@ -116,19 +116,19 @@ public class Onboard extends ComponentBaseTest { // ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); resourceReqDetails = OnboardingUtillViaApis.prepareOnboardedResourceDetailsBeforeCreate(resourceReqDetails, vendorSoftwareProductObject); ExtentTestActions.log(Status.INFO, String.format("Create VF %s From VSP", resourceReqDetails.getName())); - Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, UserRoleEnum.DESIGNER3); + Resource resource = OnboardingUtillViaApis.createResourceFromVSP(resourceReqDetails, UserRoleEnum.DESIGNER); ExtentTestActions.log(Status.INFO, String.format("Certify VF")); - resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER3, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + resource = (Resource) AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); //--------------------------SERVICE-------------------------------- ServiceReqDetails serviceReqDetails = OnboardingUtillViaApis.prepareServiceDetailsBeforeCreate(user); ExtentTestActions.log(Status.INFO, String.format("Create Service %s", serviceReqDetails.getName())); - Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER3, true).left().value(); + Service service = AtomicOperationUtils.createCustomService(serviceReqDetails, UserRoleEnum.DESIGNER, true).left().value(); ExtentTestActions.log(Status.INFO, String.format("add VF to Service")); - Either addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER3, true); + Either addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true); addComponentInstanceToComponentContainer.left().value(); ExtentTestActions.log(Status.INFO, String.format("Certify Service")); - service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER3, LifeCycleStatesEnum.CERTIFY, true).getLeft(); + service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft(); if (makeDistributionValue.equals("true")) { ExtentTestActions.log(Status.INFO, String.format("Distribute Service")); diff --git a/test-apis-ci/src/main/resources/ci/conf/credentials.yaml b/test-apis-ci/src/main/resources/ci/conf/credentials.yaml new file mode 100644 index 0000000000..19dc605a1f --- /dev/null +++ b/test-apis-ci/src/main/resources/ci/conf/credentials.yaml @@ -0,0 +1,48 @@ + designer: { + username: cs0008, + password: 123123a, + firstname: SDC, + lastname: SDC2 + } + admin: { + username: jh0003, + password: 123123a, + firstname: SDC, + lastname: SDC2 + } + ops: { + username: af0006, + password: 123123a, + firstname: SDC, + lastname: SDC2 + } + tester: { + username: kb0004, + password: 123123a, + firstname: SDC, + lastname: SDC2 + } + governor: { + username: ah0002, + password: 123123a, + firstname: SDC, + lastname: SDC2 + } + product_strategist: { + username: m99126, + password: 1910-FruitGum, + firstname: SDC, + lastname: SDC2 + } + product_manager: { + username: m99127, + password: 747-Airplane, + firstname: SDC, + lastname: SDC2 + } + product_local: { + username: pm0001, + password: 123123a, + firstname: SDC, + lastname: SDC2 + } \ No newline at end of file diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml index b0e13f14aa..f34127401c 100644 --- a/ui-ci/pom.xml +++ b/ui-ci/pom.xml @@ -404,6 +404,25 @@ + + copy-csar-files + verify + + copy-resources + + + sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/Files/VNFs + + + ${project.parent.basedir}/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs + + * + + + + + + copy-resources-ui-ci verify diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/credentials.yaml b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/credentials.yaml index ab37f7bee8..05f9a71c5c 100644 --- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/credentials.yaml +++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/credentials.yaml @@ -1,48 +1,48 @@ designer: { username: cs0008, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } admin: { username: jh0003, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } ops: { - username: af0006, + username: op0001, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } tester: { - username: kb0004, + username: jm0007, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } governor: { - username: ah0002, + username: gv0001, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } product_strategist: { username: m99126, - password: 1910-FruitGum, - firstname: ASDC, - lastname: KASPIN + password: 123123a, + firstname: SDC, + lastname: SDC2 } product_manager: { username: m99127, - password: 747-Airplane, - firstname: ASDC, - lastname: KASPIN + password: 123123a, + firstname: SDC, + lastname: SDC2 } product_local: { username: pm0001, password: 123123a, - firstname: ASDC, - lastname: KASPIN + firstname: SDC, + lastname: SDC2 } \ No newline at end of file diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java index 4df09a660d..c612b66461 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java @@ -280,12 +280,12 @@ public class AdminUserManagment extends SetupCDTest { private User getUserByEnv(UserRoleEnum userRole) { try{ - if (!getConfig().getUrl().contains("localhost") && !getConfig().getUrl().contains("127.0.0.1")) { - return getUserFromFileByRole(userRole); - } - else{ +// if (!getConfig().getUrl().contains("localhost") && !getConfig().getUrl().contains("127.0.0.1")) { +// return getUserFromFileByRole(userRole); +// } +// else{ return getUser(userRole); - } +// } } catch (Exception e){ throw new RuntimeException(e); diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java index 2dcab070ef..c8ef880a2c 100644 --- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java +++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java @@ -35,6 +35,7 @@ import org.json.simple.JSONObject; import org.littleshoot.proxy.impl.ClientToProxyConnection; import org.littleshoot.proxy.impl.ProxyToServerConnection; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.ci.tests.config.UserCredentialsFromFile; import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestManager; import org.openecomp.sdc.ci.tests.api.SomeInterface; import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum; @@ -105,7 +106,7 @@ public abstract class SetupCDTest extends DriverFactory { private static boolean uiSimulator; private static boolean localEnv = true; private static OnboardCSVReport csvReport; - private static Map credentials; + private final UserCredentialsFromFile credentialsIns = UserCredentialsFromFile.getInstance(); protected static ITestContext myContext; @@ -313,33 +314,6 @@ public abstract class SetupCDTest extends DriverFactory { return url; } - public static void loadCredentialsFile() throws Exception { - if (credentials != null){ - return; - } - File credentialsFileRemote = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE); -// File credentialsFileLocal = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE); - File credentialsFileLocal = new File(FileHandling.getSdcVnfsPath() + File.separator + "conf" - + File.separator + CREDENTIALS_FILE); - File[] credentialFiles = {credentialsFileRemote, credentialsFileLocal}; - for (File credentialsFile : credentialFiles){ - if (credentialsFile.exists()){ - credentials = FileHandling.parseYamlFile(credentialsFile.getAbsolutePath()); - break; - } - } - } - - private UserCredentials getUserCredentialsFromFile(String userRole) throws Exception { - @SuppressWarnings("unchecked") - Map credentialsMap = (Map) credentials.get(userRole); - String user = (String) credentialsMap.get("username"); - String password = (String) credentialsMap.get("password"); - String firstname = (String) credentialsMap.get("firstname"); - String lastname = (String) credentialsMap.get("lastname"); - - return new UserCredentials(user, password, firstname, lastname, userRole); - } public static void navigateToUrl(String url) throws Exception { @@ -385,13 +359,11 @@ public abstract class SetupCDTest extends DriverFactory { } protected void loginToSystem(UserRoleEnum role) throws Exception { - UserCredentials credentials; + UserCredentials credentials = new UserCredentials(role.getUserId(), role.getPassword(), role.getFirstName(), role.getLastName(), role.name()); if (localEnv){ loginToSimulator(role); - credentials = new UserCredentials(role.getUserId(), WEB_SEAL_PASSWORD, role.getFirstName(), role.getLastName(), role.name()); } else{ - credentials = getUserFromFileByRole(role); sendUserAndPasswordKeys(credentials); WebElement submitButton = GeneralUIUtils.getWebElementBy(By.name("btnSubmit"), 30); submitButton.click(); @@ -402,10 +374,7 @@ public abstract class SetupCDTest extends DriverFactory { GeneralUIUtils.ultimateWait(); getWindowTest().setUser(credentials); } - protected UserCredentials getUserFromFileByRole(UserRoleEnum role) throws Exception { - loadCredentialsFile(); - return getUserCredentialsFromFile(role.name().toLowerCase()); - } + private void goToHomePage(UserRoleEnum role) throws Exception { try { getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() == 0 ? NUM_OF_ATTEMPTS_TO_REFTRESH : getWindowTest().getRefreshAttempts()); diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml index 80a8db3c2b..2fa9fca2ee 100644 --- a/utils/webseal-simulator/pom.xml +++ b/utils/webseal-simulator/pom.xml @@ -10,7 +10,7 @@ org.openecomp.sdc sdc-main 1.2.0-SNAPSHOT - ../../ + ../../ diff --git a/utils/webseal-simulator/sdc-simulator/Dockerfile b/utils/webseal-simulator/sdc-simulator/Dockerfile index e546d48655..079c282093 100644 --- a/utils/webseal-simulator/sdc-simulator/Dockerfile +++ b/utils/webseal-simulator/sdc-simulator/Dockerfile @@ -1,4 +1,4 @@ -FROM onap/base_sdc-jetty:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-jetty:1.3.0-SNAPSHOT-latest COPY chef-solo /root/chef-solo/ -- cgit 1.2.3-korg