fix use of user credentials logic 79/41679/2
authorYuli Shlosberg <ys9693@att.com>
Sun, 8 Apr 2018 11:03:29 +0000 (14:03 +0300)
committerMichael Lando <ml636r@att.com>
Mon, 9 Apr 2018 18:03:21 +0000 (18:03 +0000)
Change-Id: If518234e78983fe35ceb4b971d5093052ee824bb
Issue-ID: SDC-384
Signed-off-by: Yuli Shlosberg <ys9693@att.com>
25 files changed:
.gitignore
asdctool/sdc-cassandra-init/Dockerfile
catalog-be/sdc-backend-init/Dockerfile
catalog-be/sdc-backend/Dockerfile
catalog-fe/sdc-frontend/Dockerfile
common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml
sdc-os-chef/sdc-cassandra/Dockerfile
sdc-os-chef/sdc-elasticsearch/Dockerfile
sdc-os-chef/sdc-init-elasticsearch/Dockerfile
sdc-os-chef/sdc-kibana/Dockerfile
test-apis-ci/sdc-api-tests/Dockerfile
test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/conf/credentials.yaml
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/MainToTest.java [new file with mode: 0644]
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/config/UserCredentialsFromFile.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/enums/UserRoleEnum.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/service/UpdateServiceMetadataTest.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/user/ActivateDeActivateDeleteUser.java
test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/sanity/Onboard.java
test-apis-ci/src/main/resources/ci/conf/credentials.yaml [new file with mode: 0644]
ui-ci/pom.xml
ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/credentials.yaml
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
utils/webseal-simulator/pom.xml
utils/webseal-simulator/sdc-simulator/Dockerfile

index fe04086..6fcd3c0 100644 (file)
@@ -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/*
index c91358d..c1069c8 100644 (file)
@@ -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/
 
index d9f0237..33d3760 100644 (file)
@@ -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/
 
index a7b1aa2..20a4624 100644 (file)
@@ -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/
 
index 2f9b3d1..75cbd8c 100644 (file)
@@ -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/
 
index fe0bab2..b1c35cf 100644 (file)
   <artifactId>openecomp-sdc-artifact-generator-test</artifactId>\r
   <build>\r
     <plugins>\r
-      <plugin>\r
-        <artifactId>maven-compiler-plugin</artifactId>\r
-        <configuration>\r
-          <source>1.7</source>\r
-          <target>1.7</target>\r
-        </configuration>\r
-      </plugin>\r
       <plugin>\r
         <artifactId>maven-shade-plugin</artifactId>\r
         <version>${mvn.shade.version}</version>\r
index 3c3fc01..2f8ecb7 100644 (file)
@@ -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/
 
index 20aa225..9b9883e 100644 (file)
@@ -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/
 
index 63fba6c..cfcf4b9 100644 (file)
@@ -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/
 
index d17602f..c62f1db 100644 (file)
@@ -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/
 
index 2be4150..d419224 100644 (file)
@@ -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/
 
index ab37f7b..05f9a71 100644 (file)
@@ -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 (file)
index 0000000..64f1a72
--- /dev/null
@@ -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<Service, RestResponse> createDefaultService1e = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true);
+
+
+
+    }
+
+    private static String convertToJson(String yamlString) {
+        Yaml yaml = new Yaml();
+        Map<String, Object> map = (Map<String, Object>) 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;
+    }
+
+
+}
index 42f06f2..c6e684c 100644 (file)
@@ -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<String, UserCredentials> 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<String, UserCredentials>) 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<String, String> credentialsMap = (Map<String, String>) 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;
     }
 
 }
index aa70c37..7f19d45 100644 (file)
 
 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;
+       }
 }
index 9ab4d0b..304f61d 100644 (file)
@@ -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);
index 24afcec..28cf1b7 100644 (file)
@@ -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);
index 8d62dae..a64c377 100644 (file)
@@ -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<String, VendorSoftwareProductObject> 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<ComponentInstance, RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER3, true);
+               Either<ComponentInstance, RestResponse> 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 (file)
index 0000000..19dc605
--- /dev/null
@@ -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
index b0e13f1..f341274 100644 (file)
                                                                </configuration>
                                                        </execution>
 
+                                                       <execution>
+                                                               <id>copy-csar-files</id>
+                                                               <phase>verify</phase>
+                                                               <goals>
+                                                                       <goal>copy-resources</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <outputDirectory>sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/Files/VNFs</outputDirectory>
+                                                                       <resources>
+                                                                               <resource>
+                                                                                       <directory>${project.parent.basedir}/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/files/default/Files/VNFs</directory>
+                                                                                       <includes>
+                                                                                               <include>*</include>
+                                                                                       </includes>
+                                                                               </resource>
+                                                                       </resources>
+                                                               </configuration>
+                                                       </execution>
+
                                                        <execution>
                                                                <id>copy-resources-ui-ci</id>
                                                                <phase>verify</phase>
index ab37f7b..05f9a71 100644 (file)
@@ -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
index 4df09a6..c612b66 100644 (file)
@@ -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);
index 2dcab07..c8ef880 100644 (file)
@@ -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<String, String> credentialsMap = (Map<String, String>) 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());
index 80a8db3..2fa9fca 100644 (file)
@@ -10,7 +10,7 @@
                <groupId>org.openecomp.sdc</groupId>
                <artifactId>sdc-main</artifactId>
                <version>1.2.0-SNAPSHOT</version>
-                <relativePath>../../</relativePath>
+               <relativePath>../../</relativePath>
        </parent>
 
        <properties>
index e546d48..079c282 100644 (file)
@@ -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/