use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class DropBoxUtils method getClient.
private DbxClientV2 getClient() throws DbxException {
if (this.client == null) {
System.setProperty("https.protocols", "TLSv1.2");
Account account = AccountsDirectory.getInstance().get(Account.Name.DROPBOX);
DbxRequestConfig config = new DbxRequestConfig(account.getProperty("clientIdentifier"));
this.client = new DbxClientV2(config, account.getProperty("accessToken"));
log.debug("DropBox client created, logged as: " + client.users().getCurrentAccount());
} else {
log.debug("DropBox client was already created, returning existing instance");
}
return this.client;
}
use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class SftpClientManager method initProperties.
private void initProperties() {
Account account = AccountsDirectory.getInstance().get(Account.Name.SFTP);
Map<String, String> properties = new HashMap<>();
account.getProperties().forEach((key, value) -> properties.put(key.toLowerCase(), value));
sftpUser = properties.get("username");
sftpPass = properties.get("password");
sftpPodName = properties.get("host");
sftpRemotePort = Integer.parseInt(properties.get("port"));
}
use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class DynamoDbUtils method initClient.
@PostConstruct
public void initClient() {
log.info("Initializing DynamoDb client");
Account dynamoDbAccount = AccountsDirectory.getInstance().get(Account.Name.AWS);
final String region = dynamoDbAccount.getProperty("region");
this.tableName = dynamoDbAccount.getProperty("tableName");
dynamoDb = DynamoDbClient.builder().region(Region.of(region)).credentialsProvider(() -> AwsBasicCredentials.create(dynamoDbAccount.getProperty("accessKey"), dynamoDbAccount.getProperty("secretKey"))).build();
}
use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class CommonSteps method createConnections.
@Given("^created connections$")
public void createConnections(DataTable connectionsData) {
Connections connectionsPage = new Connections();
ConfigureConnectionSteps configureConnectionSteps = new ConfigureConnectionSteps();
NameConnectionSteps nameConnectionSteps = new NameConnectionSteps();
List<List<String>> dataTable = connectionsData.cells();
for (List<String> dataRow : dataTable) {
String connectionType = validateConnectorName(dataRow.get(0));
String connectionCredentialsName = dataRow.get(1);
String connectionName = dataRow.get(2);
String connectionDescription = dataRow.get(3);
if ("Gmail".equalsIgnoreCase(connectionType) || "Google Calendar".equalsIgnoreCase(connectionType)) {
Account a = AccountsDirectory.getInstance().get(connectionCredentialsName);
GoogleAccount googleAccount = googleAccounts.getGoogleAccountForTestAccount(connectionCredentialsName);
a.getProperties().put("accessToken", googleAccount.getCredential().getAccessToken());
}
navigateTo("Connections");
validatePage("Connections");
ElementsCollection connections = connectionsPage.getAllConnections();
connections = connections.filter(exactText(connectionName));
try {
if (connections.size() != 0) {
log.warn("Connection {} already exists!", connectionName);
continue;
}
} catch (org.openqa.selenium.StaleElementReferenceException e) {
// this may happen if page was "reloaded" before connections.size was processed, give it second try
connections = connectionsPage.getAllConnections();
connections = connections.filter(exactText(connectionName));
if (connections.size() != 0) {
log.warn("Connection {} already exists!", connectionName);
continue;
}
}
clickOnLink("Create Connection");
log.info("Sleeping so jenkins has more time to load all connectors");
TestUtils.sleepIgnoreInterrupt(TestConfiguration.getJenkinsDelay() * 1000);
selectConnectionTypeSteps.selectConnectionType(connectionType);
configureConnectionSteps.fillConnectionDetails(connectionCredentialsName);
// do nothing if connection does not require any credentials
if (!("no credentials".equalsIgnoreCase(connectionCredentialsName) || "no validation".equalsIgnoreCase(connectionDescription))) {
clickOnButton("Validate");
TestUtils.waitFor(() -> $$(Alert.ALL.getBy()).size() > 0, 2, 20, "Any notification appears!");
if (getAllAlerts(connectionType + " does not support validation", "info").size() > 0) {
log.warn("Connection type " + connectionType + " doesn't support validation. The test suite assumes that set credentials are correct.");
} else {
successNotificationIsPresentWithError(connectionType + " has been successfully validated", "success");
}
scrollTo("top", "right");
clickOnButton("Next");
} else if ("no validation".equalsIgnoreCase(connectionDescription)) {
scrollTo("top", "right");
clickOnButton("Next");
}
nameConnectionSteps.setConnectionName(connectionName);
nameConnectionSteps.setConnectionDescription(connectionDescription);
clickOnButton("Save");
try {
TestUtils.sleepForJenkinsDelayIfHigher(2);
OpenShiftWaitUtils.waitFor(() -> !syndesisRootPage.getCurrentUrl().contains("connections/create"), 2, 20);
} catch (TimeoutException | InterruptedException e) {
clickOnButton("Save");
TestUtils.waitFor(() -> !syndesisRootPage.getCurrentUrl().contains("connections/create"), 2, 20, "Unable to create a connection - create button does nothing.");
}
}
}
use of io.syndesis.qe.account.Account in project syndesis-qe by syndesisio.
the class CommonSteps method fillAndValidateConcur.
private void fillAndValidateConcur() {
Account account = AccountsDirectory.getInstance().get(Account.Name.CONCUR);
$$(By.tagName("input")).stream().filter(e -> e.getAttribute("name").equalsIgnoreCase("type") && e.getAttribute("value").equalsIgnoreCase("username")).findFirst().get().click();
$(By.id("userid")).shouldBe(visible).sendKeys(account.getProperty("userId"));
$(By.xpath(".//*[@type='submit']")).shouldBe(visible).click();
TestUtils.sleepForJenkinsDelayIfHigher(3);
$(By.id("password")).shouldBe(visible).sendKeys(account.getProperty("password"));
$(By.xpath(".//*[@type='submit']")).shouldBe(visible).click();
}
Aggregations