use of io.syndesis.qe.accounts.Account in project syndesis-qe by syndesisio.
the class CommonSteps method validateCredentials.
@And("^.*validate credentials$")
public void validateCredentials() {
Map<String, Account> accounts = AccountsDirectory.getInstance().getAccounts();
List<List<String>> oneAccountList = new ArrayList<>();
List<String> tmpList = Arrays.asList("a", "s", "d", "f");
accounts.keySet().forEach(key -> {
Optional<Account> currentAccount = AccountsDirectory.getInstance().getAccount(key);
if (currentAccount.isPresent()) {
String service = currentAccount.get().getService();
Credentials current = Credentials.valueOf(service.toUpperCase());
switch(current) {
case DROPBOX:
service = "DropBox";
break;
case SALESFORCE:
service = "Salesforce";
break;
case TWITTER:
service = "Twitter";
break;
case S3:
// TODO: skip for now
return;
default:
// skip for other cred
return;
}
// type
tmpList.set(0, service);
// name
tmpList.set(1, key);
// connection name
tmpList.set(2, "my " + key + " connection");
// description
tmpList.set(3, "some description");
log.trace("Inserting: " + tmpList.toString());
oneAccountList.add(new ArrayList<>(tmpList));
log.trace("Current values in list list: " + oneAccountList.toString());
}
});
log.debug("Final status of list: " + oneAccountList.toString());
DataTable accountsTalbe = DataTable.create(oneAccountList);
createConnections(accountsTalbe);
}
use of io.syndesis.qe.accounts.Account in project syndesis-qe by syndesisio.
the class ConnectionsGeneralSteps method createS3Connection.
@Given("^create S3 connection using \"([^\"]*)\" bucket")
public void createS3Connection(String s3Bucket) {
final Connector s3Connector = connectorsEndpoint.get("aws-s3");
final Account s3Account = accountsDirectory.getAccount("s3").get();
log.info("Bucket name: {}", S3BucketNameBuilder.getBucketName(s3Bucket));
final Connection s3Connection = new Connection.Builder().connector(s3Connector).connectorId(getConnectorId(s3Connector)).id(S3BucketNameBuilder.getBucketName(s3Bucket)).name("New Fuse QE s3 " + S3BucketNameBuilder.getBucketName(s3Bucket)).icon("fa-puzzle-piece").configuredProperties(TestUtils.map("accessKey", s3Account.getProperty("accessKey"), "bucketNameOrArn", S3BucketNameBuilder.getBucketName(s3Bucket), "region", s3Account.getProperty("region"), "secretKey", s3Account.getProperty("secretKey"))).tags(Arrays.asList("aws-s3")).build();
log.info("Creating s3 connection {}", s3Connection.getName());
connectionsEndpoint.create(s3Connection);
}
use of io.syndesis.qe.accounts.Account in project syndesis-qe by syndesisio.
the class FtpTemplate method deploy.
public static void deploy() {
List<ContainerPort> ports = new LinkedList<>();
ports.add(new ContainerPortBuilder().withName("ftp-cmd").withContainerPort(2121).withProtocol("TCP").build());
for (int i = 0; i < 10; i++) {
ContainerPort dataPort = new ContainerPortBuilder().withName("ftp-data-" + i).withContainerPort(2300 + i).withProtocol("TCP").build();
ports.add(dataPort);
}
OpenShiftUtils.client().deploymentConfigs().createOrReplaceWithNew().editOrNewMetadata().withName(APP_NAME).addToLabels(LABEL_NAME, APP_NAME).endMetadata().editOrNewSpec().addToSelector(LABEL_NAME, APP_NAME).withReplicas(1).editOrNewTemplate().editOrNewMetadata().addToLabels(LABEL_NAME, APP_NAME).endMetadata().editOrNewSpec().addNewContainer().withName(APP_NAME).withImage("dsimansk/ftpd:latest").addAllToPorts(ports).endContainer().endSpec().endTemplate().addNewTrigger().withType("ConfigChange").endTrigger().endSpec().done();
ServiceSpecBuilder serviceSpecBuilder = new ServiceSpecBuilder().addToSelector(LABEL_NAME, APP_NAME);
serviceSpecBuilder.addToPorts(new ServicePortBuilder().withName("ftp-cmd").withPort(2121).withTargetPort(new IntOrString(2121)).build());
for (int i = 0; i < 10; i++) {
serviceSpecBuilder.addToPorts(new ServicePortBuilder().withName("ftp-data-" + i).withPort(2300 + i).withTargetPort(new IntOrString(2300 + i)).build());
}
OpenShiftUtils.getInstance().client().services().createOrReplaceWithNew().editOrNewMetadata().withName(APP_NAME).addToLabels(LABEL_NAME, APP_NAME).endMetadata().editOrNewSpecLike(serviceSpecBuilder.build()).endSpec().done();
try {
OpenShiftWaitUtils.waitFor(OpenShiftWaitUtils.areExactlyNPodsReady(LABEL_NAME, APP_NAME, 1));
Thread.sleep(20 * 1000);
} catch (InterruptedException | TimeoutException e) {
log.error("Wait for {} deployment failed ", APP_NAME, e);
}
Account ftpAccount = new Account();
ftpAccount.setService("ftp");
Map<String, String> accountParameters = new HashMap<>();
accountParameters.put("host", "ftpd");
accountParameters.put("port", "2121");
ftpAccount.setProperties(accountParameters);
AccountsDirectory.getInstance().addAccount("FTP", ftpAccount);
}
Aggregations