summaryrefslogtreecommitdiffstats
path: root/ui-ci
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2018-04-08 14:03:29 +0300
committerMichael Lando <ml636r@att.com>2018-04-09 18:03:21 +0000
commit1788983cf083303c51d538608c92abbebef10307 (patch)
treea70997752b5448dc45739309c53df2ef49f5f59f /ui-ci
parent0ebace5621e54b8102b0371f0500340adedf7f75 (diff)
fix use of user credentials logic
Change-Id: If518234e78983fe35ceb4b971d5093052ee824bb Issue-ID: SDC-384 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'ui-ci')
-rw-r--r--ui-ci/pom.xml19
-rw-r--r--ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/files/default/conf/credentials.yaml42
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java10
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java39
4 files changed, 49 insertions, 61 deletions
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
@@ -405,6 +405,25 @@
</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>
<goals>
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<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());