All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testvagrant.optimus.core.remote.CloudConfigBuilder Maven / Gradle / Ivy

Go to download

Optimus Lite API to manage test devices and create appium driver based on platform

There is a newer version: 0.1.7-beta
Show newest version
package com.testvagrant.optimus.core.remote;

import com.testvagrant.optimus.commons.SystemProperties;
import com.testvagrant.optimus.core.models.CloudConfig;

public class CloudConfigBuilder {

  private final String userName;
  private final String accessKey;
  private final CloudConfig cloudConfig;

  public CloudConfigBuilder() {
    userName = System.getenv("username");
    accessKey = System.getenv("accessKey");
    cloudConfig = new ConfigLoader().loadConfig();

    overrideCloudConfig(cloudConfig);
    overrideHub(cloudConfig);
  }

  public CloudConfig build() {
    return cloudConfig;
  }

  private void overrideHub(CloudConfig cloudConfig) {
    if (cloudConfig.getHub() == null) {
      cloudConfig.setHub(SystemProperties.HUB);
    }
  }

  private void overrideCloudConfig(CloudConfig cloudConfig) {
    if (userName != null) cloudConfig.setUsername(userName);
    if (accessKey != null) cloudConfig.setAccessKey(accessKey);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy