@Test public void testToModel() { OpenShiftProviderConfig config = mock(OpenShiftProviderConfig.class); when(config.getName()).thenReturn(PROVIDER_NAME_VALUE); when(config.getKubernetesMaster()).thenReturn(MASTER_URL_VALUE); when(config.getKubernetesAuthBasicUsername()).thenReturn(USER_VALUE); when(config.getKubernetesAuthBasicPassword()).thenReturn(PASSWORD_VALUE); ProviderConfiguration result = converter.toModel(config); assertNotNull(result); assertEquals(PROVIDER_NAME_VALUE, result.getId()); assertEquals(MASTER_URL_VALUE, result.getValues().get(KUBERNETES_MASTER.inputKey())); assertEquals(USER_VALUE, result.getValues().get(KUBERNETES_AUTH_BASIC_USERNAME.inputKey())); assertEquals(PASSWORD_VALUE, result.getValues().get(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey())); }
@Override public ProviderConfiguration toModel(OpenShiftProviderConfig domainValue) { if (domainValue == null) { return null; } final Map<String, Object> values = new HashMap<>(); values.put(PROVIDER_NAME, domainValue.getName()); values.put(KUBERNETES_MASTER.inputKey(), domainValue.getKubernetesMaster()); values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), domainValue.getKubernetesAuthBasicUsername()); values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), domainValue.getKubernetesAuthBasicPassword()); return new ProviderConfiguration(domainValue.getName(), values); }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public ProviderConfiguration toModel(OpenShiftProviderConfig domainValue) { if (domainValue == null) { return null; } final Map<String, Object> values = new HashMap<>(); values.put(PROVIDER_NAME, domainValue.getName()); values.put(KUBERNETES_MASTER.inputKey(), domainValue.getKubernetesMaster()); values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), domainValue.getKubernetesAuthBasicUsername()); values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), domainValue.getKubernetesAuthBasicPassword()); return new ProviderConfiguration(domainValue.getName(), values); } }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public ProviderConfiguration toModel(OpenShiftProviderConfig domainValue) { if (domainValue == null) { return null; } final Map<String, Object> values = new HashMap<>(); values.put(PROVIDER_NAME, domainValue.getName()); values.put(KUBERNETES_MASTER.inputKey(), domainValue.getKubernetesMaster()); values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), domainValue.getKubernetesAuthBasicUsername()); values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), domainValue.getKubernetesAuthBasicPassword()); return new ProviderConfiguration(domainValue.getName(), values); } OpenShiftProviderConfigConverter(); }
OpenShiftProviderConfigConverter implements ProviderConfigConverter<ProviderConfiguration, OpenShiftProviderConfig> { @Override public ProviderConfiguration toModel(OpenShiftProviderConfig domainValue) { if (domainValue == null) { return null; } final Map<String, Object> values = new HashMap<>(); values.put(PROVIDER_NAME, domainValue.getName()); values.put(KUBERNETES_MASTER.inputKey(), domainValue.getKubernetesMaster()); values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), domainValue.getKubernetesAuthBasicUsername()); values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), domainValue.getKubernetesAuthBasicPassword()); return new ProviderConfiguration(domainValue.getName(), values); } 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 ProviderConfiguration toModel(OpenShiftProviderConfig domainValue) { if (domainValue == null) { return null; } final Map<String, Object> values = new HashMap<>(); values.put(PROVIDER_NAME, domainValue.getName()); values.put(KUBERNETES_MASTER.inputKey(), domainValue.getKubernetesMaster()); values.put(KUBERNETES_AUTH_BASIC_USERNAME.inputKey(), domainValue.getKubernetesAuthBasicUsername()); values.put(KUBERNETES_AUTH_BASIC_PASSWORD.inputKey(), domainValue.getKubernetesAuthBasicPassword()); return new ProviderConfiguration(domainValue.getName(), values); } OpenShiftProviderConfigConverter(); @Override Class<ProviderConfiguration> getModelType(); @Override Class<OpenShiftProviderConfig> getDomainType(); @Override OpenShiftProviderConfig toDomain(ProviderConfiguration modelValue); @Override ProviderConfiguration toModel(OpenShiftProviderConfig domainValue);  }