@Test public void testToDomain() { Map<String, Object> values = new HashMap<>(); values.put(KUBERNETES_MASTER.inputKey(), MASTER_URL_VALUE); values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), USER_VALUE); values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), PASSWORD_VALUE); ProviderConfiguration configuration = new ProviderConfiguration(PROVIDER_NAME_VALUE, values); OpenShiftProviderConfig result = converter.toDomain(configuration); assertNotNull(result); assertEquals(PROVIDER_NAME_VALUE, result.getName()); assertEquals(MASTER_URL_VALUE, result.getKubernetesMaster()); assertEquals(USER_VALUE, result.getKubernetesAuthBasicUsername()); assertEquals(PASSWORD_VALUE, result.getKubernetesAuthBasicPassword()); }
@Override public OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue) { if (modelValue == null) { return null; } OpenShiftProviderConfigImpl openShiftProviderConfig = new OpenShiftProviderConfigImpl(); openShiftProviderConfig.clear(); openShiftProviderConfig.setName(modelValue.getId()); openShiftProviderConfig.setKubernetesMaster(getStringValue(modelValue.getValues(), KUBERNETES_MASTER.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicUsername(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_USERNAME.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicPassword(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_PASSWORD.inputKey())); return openShiftProviderConfig; }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue) { if (modelValue == null) { return null; } OpenShiftProviderConfigImpl openShiftProviderConfig = new OpenShiftProviderConfigImpl(); openShiftProviderConfig.clear(); openShiftProviderConfig.setName(modelValue.getId()); openShiftProviderConfig.setKubernetesMaster(getStringValue(modelValue.getValues(), KUBERNETES_MASTER.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicUsername(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_USERNAME.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicPassword(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_PASSWORD.inputKey())); return openShiftProviderConfig; } }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue) { if (modelValue == null) { return null; } OpenShiftProviderConfigImpl openShiftProviderConfig = new OpenShiftProviderConfigImpl(); openShiftProviderConfig.clear(); openShiftProviderConfig.setName(modelValue.getId()); openShiftProviderConfig.setKubernetesMaster(getStringValue(modelValue.getValues(), KUBERNETES_MASTER.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicUsername(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_USERNAME.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicPassword(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_PASSWORD.inputKey())); return openShiftProviderConfig; } OpenShiftProviderConfigConverter(); }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue) { if (modelValue == null) { return null; } OpenShiftProviderConfigImpl openShiftProviderConfig = new OpenShiftProviderConfigImpl(); openShiftProviderConfig.clear(); openShiftProviderConfig.setName(modelValue.getId()); openShiftProviderConfig.setKubernetesMaster(getStringValue(modelValue.getValues(), KUBERNETES_MASTER.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicUsername(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_USERNAME.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicPassword(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_PASSWORD.inputKey())); return openShiftProviderConfig; } OpenShiftProviderConfigConverter(); @Override Class<ProviderConfiguration> getModelType(); @Override Class<OpenShiftProviderConfig> getDomainType(); @Override OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue); @Override ProviderConfiguration toModel(OpenShiftProviderConfig domainValue); }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue) { if (modelValue == null) { return null; } OpenShiftProviderConfigImpl openShiftProviderConfig = new OpenShiftProviderConfigImpl(); openShiftProviderConfig.clear(); openShiftProviderConfig.setName(modelValue.getId()); openShiftProviderConfig.setKubernetesMaster(getStringValue(modelValue.getValues(), KUBERNETES_MASTER.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicUsername(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_USERNAME.inputKey())); openShiftProviderConfig.setKubernetesAuthBasicPassword(getStringValue(modelValue.getValues(), KUBERNETES_AUTH_BASIC_PASSWORD.inputKey())); return openShiftProviderConfig; } OpenShiftProviderConfigConverter(); @Override Class<ProviderConfiguration> getModelType(); @Override Class<OpenShiftProviderConfig> getDomainType(); @Override OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue); @Override ProviderConfiguration toModel(OpenShiftProviderConfig domainValue);  }