Search in sources :

Example 1 with OAuthRequestValidator

use of com.synopsys.integration.alert.channel.azure.boards.oauth.OAuthRequestValidator in project blackduck-alert by blackducksoftware.

the class AzureBoardsGlobalConfigurationFieldModelValidatorTest method oauthRequestIsRunningError.

@Test
public void oauthRequestIsRunningError() {
    OAuthRequestValidator oAuthRequestValidator = new OAuthRequestValidator();
    oAuthRequestValidator.addAuthorizationRequest("test");
    AzureBoardsGlobalConfigurationFieldModelValidator azureBoardsGlobalConfigurationValidator = new AzureBoardsGlobalConfigurationFieldModelValidator(oAuthRequestValidator);
    Set<AlertFieldStatus> fieldStatuses = azureBoardsGlobalConfigurationValidator.validate(new FieldModel(new AzureBoardsChannelKey().getUniversalKey(), ConfigContextEnum.GLOBAL.name(), createValidKeyToValues()));
    assertEquals(1, fieldStatuses.size());
    AlertFieldStatus alertFieldStatus = fieldStatuses.stream().findFirst().orElse(null);
    assertNotNull(alertFieldStatus);
    assertEquals(AzureBoardsDescriptor.KEY_OAUTH, alertFieldStatus.getFieldName());
}
Also used : OAuthRequestValidator(com.synopsys.integration.alert.channel.azure.boards.oauth.OAuthRequestValidator) AzureBoardsChannelKey(com.synopsys.integration.alert.descriptor.api.AzureBoardsChannelKey) AlertFieldStatus(com.synopsys.integration.alert.api.common.model.errors.AlertFieldStatus) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) Test(org.junit.jupiter.api.Test)

Example 2 with OAuthRequestValidator

use of com.synopsys.integration.alert.channel.azure.boards.oauth.OAuthRequestValidator in project hub-alert by blackducksoftware.

the class AzureBoardsGlobalConfigurationFieldModelValidatorTest method oauthRequestIsRunningError.

@Test
public void oauthRequestIsRunningError() {
    OAuthRequestValidator oAuthRequestValidator = new OAuthRequestValidator();
    oAuthRequestValidator.addAuthorizationRequest("test");
    AzureBoardsGlobalConfigurationFieldModelValidator azureBoardsGlobalConfigurationValidator = new AzureBoardsGlobalConfigurationFieldModelValidator(oAuthRequestValidator);
    Set<AlertFieldStatus> fieldStatuses = azureBoardsGlobalConfigurationValidator.validate(new FieldModel(new AzureBoardsChannelKey().getUniversalKey(), ConfigContextEnum.GLOBAL.name(), createValidKeyToValues()));
    assertEquals(1, fieldStatuses.size());
    AlertFieldStatus alertFieldStatus = fieldStatuses.stream().findFirst().orElse(null);
    assertNotNull(alertFieldStatus);
    assertEquals(AzureBoardsDescriptor.KEY_OAUTH, alertFieldStatus.getFieldName());
}
Also used : OAuthRequestValidator(com.synopsys.integration.alert.channel.azure.boards.oauth.OAuthRequestValidator) AzureBoardsChannelKey(com.synopsys.integration.alert.descriptor.api.AzureBoardsChannelKey) AlertFieldStatus(com.synopsys.integration.alert.api.common.model.errors.AlertFieldStatus) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) Test(org.junit.jupiter.api.Test)

Aggregations

AlertFieldStatus (com.synopsys.integration.alert.api.common.model.errors.AlertFieldStatus)2 OAuthRequestValidator (com.synopsys.integration.alert.channel.azure.boards.oauth.OAuthRequestValidator)2 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)2 AzureBoardsChannelKey (com.synopsys.integration.alert.descriptor.api.AzureBoardsChannelKey)2 Test (org.junit.jupiter.api.Test)2