use of com.synopsys.integration.alert.api.common.model.exception.AlertException in project hub-alert by blackducksoftware.
the class JiraCloudSummaryFieldLengthTestIT method summaryLength254SucceedsTest.
@Test
public void summaryLength254SucceedsTest() {
IssueCreationModel issueCreationModel = createIssueCreationModel(254);
IssueTrackerModelHolder<String> messages = new IssueTrackerModelHolder<>(List.of(issueCreationModel), List.of(), List.of());
try {
jiraCloudMessageSender.sendMessages(messages);
} catch (AlertException e) {
fail("Failed to send a message with a 254 character summary", e);
}
}
use of com.synopsys.integration.alert.api.common.model.exception.AlertException in project hub-alert by blackducksoftware.
the class JiraCloudSummaryFieldLengthTestIT method summaryLength256FailsTest.
@Test
public void summaryLength256FailsTest() {
IssueCreationModel issueCreationModel = createIssueCreationModel(256);
IssueTrackerModelHolder<String> messages = new IssueTrackerModelHolder<>(List.of(issueCreationModel), List.of(), List.of());
try {
jiraCloudMessageSender.sendMessages(messages);
fail("Successfully sent a message with a 256 character summary which is greater than the expected maximum");
} catch (AlertException e) {
// Pass
e.printStackTrace();
}
}
use of com.synopsys.integration.alert.api.common.model.exception.AlertException in project hub-alert by blackducksoftware.
the class JiraServerSummaryFieldLengthTestIT method summaryLength256FailsTest.
@Test
public void summaryLength256FailsTest() {
IssueCreationModel issueCreationModel = createIssueCreationModel(256);
IssueTrackerModelHolder<String> messages = new IssueTrackerModelHolder<>(List.of(issueCreationModel), List.of(), List.of());
try {
jiraServerMessageSender.sendMessages(messages);
fail("Successfully sent a message with a 256 character summary which is greater than the expected maximum");
} catch (AlertException e) {
// Pass
e.printStackTrace();
}
}
use of com.synopsys.integration.alert.api.common.model.exception.AlertException in project hub-alert by blackducksoftware.
the class ConfigurationCrudHelperTest method testUpdateException.
@Test
public void testUpdateException() {
AuthenticationTestUtils authenticationTestUtils = new AuthenticationTestUtils();
DescriptorKey descriptorKey = new ChannelKey("channel_key", "channel-display-name");
PermissionKey permissionKey = new PermissionKey(ConfigContextEnum.GLOBAL.name(), descriptorKey.getUniversalKey());
Map<PermissionKey, Integer> permissions = Map.of(permissionKey, AuthenticationTestUtils.FULL_PERMISSIONS);
AuthorizationManager authorizationManager = authenticationTestUtils.createAuthorizationManagerWithCurrentUserSet("admin", "admin", () -> new PermissionMatrixModel(permissions));
ThrowingSupplier createdModelSupplier = () -> {
throw new AlertException("error getting test message");
};
ConfigurationCrudHelper configurationHelper = new ConfigurationCrudHelper(authorizationManager, ConfigContextEnum.GLOBAL, descriptorKey);
ActionResponse response = configurationHelper.update(() -> ValidationResponseModel.success(), () -> true, createdModelSupplier);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getHttpStatus());
}
use of com.synopsys.integration.alert.api.common.model.exception.AlertException in project hub-alert by blackducksoftware.
the class AzureOAuthCallbackController method testOAuthConnection.
private void testOAuthConnection(AzureBoardsProperties azureBoardsProperties, String authorizationCode, String oAuthRequestId) {
try {
ProxyInfo proxyInfo = proxyManager.createProxyInfoForHost(AzureHttpRequestCreatorFactory.DEFAULT_BASE_URL);
String organizationName = azureBoardsProperties.getOrganizationName();
// save initiate token requests with the authorization code.
logger.info("OAuth request with id {}: Testing with authorization code to save tokens.", oAuthRequestId);
testGetProjects(azureBoardsProperties.createAzureHttpService(proxyInfo, gson, authorizationCode), organizationName, oAuthRequestId);
// load the oauth credentials from the store.
logger.info("OAuth request with id {}: Testing with store to read tokens.", oAuthRequestId);
testGetProjects(azureBoardsProperties.createAzureHttpService(proxyInfo, gson), organizationName, oAuthRequestId);
} catch (AlertException ex) {
logger.error("OAuth request with id {}: Error in azure oauth validation test ", oAuthRequestId, ex);
logger.error("Caused by: ", ex);
}
}
Aggregations