ClusterConfiguration { public Config getConfig() { final ConfigBuilder configBuilder = new ConfigBuilder(); if (StringUtils.isNotBlank(this.username)) { configBuilder.withUsername(this.username); } if (StringUtils.isNotBlank(this.password)) { configBuilder.withPassword(this.password); } if (StringUtils.isNoneBlank(this.token)) { configBuilder.withOauthToken(this.token); } if (StringUtils.isNotBlank(this.masterUrl)) { configBuilder.withMasterUrl(this.masterUrl); } if (StringUtils.isNotBlank(this.apiVersion)) { configBuilder.withApiVersion(this.apiVersion); } if (StringUtils.isNotBlank(this.caCertData)) { configBuilder.withCaCertData(this.caCertData); } if (StringUtils.isNotBlank(this.caCertFile)) { configBuilder.withCaCertFile(this.caCertFile); } if (StringUtils.isNotBlank(this.clientCertData)) { configBuilder.withClientCertData(this.clientCertData); } if (StringUtils.isNotBlank(this.clientCertFile)) { configBuilder.withClientCertFile(this.clientCertFile); } if (StringUtils.isNotBlank(this.clientKeyAlgo)) { configBuilder.withClientKeyAlgo(this.clientKeyAlgo); } if (StringUtils.isNotBlank(this.clientKeyData)) { configBuilder.withClientKeyData(this.clientKeyData); } if (StringUtils.isNotBlank(this.clientKeyFile)) { configBuilder.withClientKeyFile(this.clientKeyFile); } if (StringUtils.isNotBlank(this.clientKeyPassphrase)) { configBuilder.withClientKeyPassphrase(this.clientKeyPassphrase); } if (StringUtils.isNotBlank(this.keyStoreFile)) { configBuilder.withKeyStoreFile(this.keyStoreFile); } if (StringUtils.isNotBlank(this.keyStorePassphrase)) { configBuilder.withKeyStorePassphrase(this.keyStorePassphrase); } if (StringUtils.isNotBlank(this.namespace)) { configBuilder.withNamespace(this.namespace); } if (StringUtils.isNotBlank(this.trustStoreFile)) { configBuilder.withTrustStoreFile(this.trustStoreFile); } if (StringUtils.isNotBlank(this.trustStorePassphrase)) { configBuilder.withTrustStorePassphrase(this.trustStorePassphrase); } return configBuilder.build(); } ClusterConfiguration(); String getNamespace(); Config getConfig();  }
@Test public void should_lod_coniguration_from_properties() { final ClusterConfiguration.Builder clusterConfigurationBuilder = new ClusterConfiguration.Builder(); final Properties properties = new Properties(); properties.put("fabric8.username", "aaa"); properties.put("fabric8.password", "bbb"); properties.put("fabric8.token", "ccc"); final ClusterConfiguration clusterConfiguration = clusterConfigurationBuilder.from(properties).build(); assertThat(clusterConfiguration.getConfig().getUsername()).isEqualTo("aaa"); assertThat(clusterConfiguration.getConfig().getPassword()).isEqualTo("bbb"); assertThat(clusterConfiguration.getConfig().getOauthToken()).isEqualTo("ccc"); }