Search in sources :

Example 46 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method createValidLdapValues.

private Map<String, FieldValueModel> createValidLdapValues() {
    FieldValueModel ldapEnabled = new FieldValueModel(List.of("true"), true);
    FieldValueModel server = new FieldValueModel(List.of("server"), true);
    FieldValueModel managerDn = new FieldValueModel(List.of("managerDn"), true);
    FieldValueModel managerPassword = new FieldValueModel(List.of("managerPassword"), true);
    Map<String, FieldValueModel> keyToValues = new HashMap<>();
    keyToValues.put(AuthenticationDescriptor.KEY_LDAP_ENABLED, ldapEnabled);
    keyToValues.put(AuthenticationDescriptor.KEY_LDAP_SERVER, server);
    keyToValues.put(AuthenticationDescriptor.KEY_LDAP_MANAGER_DN, managerDn);
    keyToValues.put(AuthenticationDescriptor.KEY_LDAP_MANAGER_PWD, managerPassword);
    return keyToValues;
}
Also used : HashMap(java.util.HashMap) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel)

Example 47 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method createValidSamlValues.

private Map<String, FieldValueModel> createValidSamlValues() {
    FieldValueModel samlEnabled = new FieldValueModel(List.of("true"), true);
    FieldValueModel forceAuth = new FieldValueModel(List.of("true"), true);
    FieldValueModel entityId = new FieldValueModel(List.of("entityId"), true);
    FieldValueModel entityBaseUrl = new FieldValueModel(List.of("entityBaseUrl"), true);
    FieldValueModel metadataUrl = new FieldValueModel(List.of("metadataUrl"), true);
    Map<String, FieldValueModel> keyToValues = new HashMap<>();
    keyToValues.put(AuthenticationDescriptor.KEY_SAML_ENABLED, samlEnabled);
    keyToValues.put(AuthenticationDescriptor.KEY_SAML_FORCE_AUTH, forceAuth);
    keyToValues.put(AuthenticationDescriptor.KEY_SAML_ENTITY_ID, entityId);
    keyToValues.put(AuthenticationDescriptor.KEY_SAML_ENTITY_BASE_URL, entityBaseUrl);
    keyToValues.put(AuthenticationDescriptor.KEY_SAML_METADATA_URL, metadataUrl);
    return keyToValues;
}
Also used : HashMap(java.util.HashMap) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel)

Example 48 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class SettingsGlobalConfigurationFieldModelValidatorTest method validHostAndPort.

@Test
public void validHostAndPort() {
    Map<String, FieldValueModel> keyToValues = createProxyKeyToValues();
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
    validatorAsserter.assertValid();
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test)

Example 49 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class SettingsGlobalConfigurationFieldModelValidatorTest method createKeyToValues.

private Map<String, FieldValueModel> createKeyToValues() {
    Map<String, FieldValueModel> keyToValues = new HashMap<>();
    FieldValueModel encryptionPassword = new FieldValueModel(List.of("encryptionPassword"), true);
    FieldValueModel encryptionSalt = new FieldValueModel(List.of("encryptionSalt"), true);
    keyToValues.put(SettingsDescriptor.KEY_ENCRYPTION_PWD, encryptionPassword);
    keyToValues.put(SettingsDescriptor.KEY_ENCRYPTION_GLOBAL_SALT, encryptionSalt);
    return keyToValues;
}
Also used : HashMap(java.util.HashMap) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel)

Example 50 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class BlackDuckGlobalApiAction method afterDeleteAction.

@Override
public void afterDeleteAction(FieldModel fieldModel) {
    Map<String, FieldValueModel> keyToValues = fieldModel.getKeyToValues();
    FieldValueModel fieldValueModel = keyToValues.get(ProviderDescriptor.KEY_PROVIDER_CONFIG_NAME);
    String blackDuckGlobalConfigName = fieldValueModel.getValue().orElse("");
    Long configId = Long.parseLong(fieldModel.getId());
    providerLifecycleManager.unscheduleTasksForProviderConfig(configId);
    List<ProviderProject> blackDuckProjects = providerDataAccessor.getProjectsByProviderConfigName(blackDuckGlobalConfigName);
    providerDataAccessor.deleteProjects(blackDuckProjects);
}
Also used : ProviderProject(com.synopsys.integration.alert.common.persistence.model.ProviderProject) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel)

Aggregations

FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)58 HashMap (java.util.HashMap)27 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)24 Test (org.junit.jupiter.api.Test)18 ConfigurationFieldModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel)12 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)6 GlobalConfigurationValidatorAsserter (com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter)6 JobFieldModel (com.synopsys.integration.alert.common.rest.model.JobFieldModel)5 JobProviderProjectFieldModel (com.synopsys.integration.alert.common.rest.model.JobProviderProjectFieldModel)4 ConfigurationManager (com.synopsys.integration.alert.performance.utility.ConfigurationManager)4 IntegrationPerformanceTestRunner (com.synopsys.integration.alert.performance.utility.IntegrationPerformanceTestRunner)4 Disabled (org.junit.jupiter.api.Disabled)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 ConfigContextEnum (com.synopsys.integration.alert.common.enumeration.ConfigContextEnum)3 DescriptorAccessor (com.synopsys.integration.alert.common.persistence.accessor.DescriptorAccessor)3 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)3 EncryptionUtility (com.synopsys.integration.alert.common.security.EncryptionUtility)3 AlertRequestUtility (com.synopsys.integration.alert.performance.utility.AlertRequestUtility)3 BlackDuckProviderService (com.synopsys.integration.alert.performance.utility.BlackDuckProviderService)3 List (java.util.List)3