use of com.synopsys.integration.jira.common.model.response.CustomFieldCreationResponseModel in project hub-alert by blackducksoftware.
the class JiraCustomFieldResolver method initializeCaches.
private void initializeCaches() throws IntegrationException {
List<CustomFieldCreationResponseModel> userVisibleFields = retrieveAvailableFields.get();
for (CustomFieldCreationResponseModel jiraField : userVisibleFields) {
nameToModelCache.put(jiraField.getName(), jiraField);
idToNameCache.put(jiraField.getId(), jiraField.getName());
}
cachesHaveBeenInitialized = true;
}
use of com.synopsys.integration.jira.common.model.response.CustomFieldCreationResponseModel in project hub-alert by blackducksoftware.
the class JiraCustomFieldResolver method retrieveCustomFieldDefinition.
protected CustomFieldDefinitionModel retrieveCustomFieldDefinition(JiraCustomFieldConfig customFieldConfig) {
String fieldName = customFieldConfig.getFieldName();
CustomFieldCreationResponseModel fieldResponse = retrieveFieldDefinition(fieldName).orElseThrow(() -> new AlertRuntimeException(String.format("No custom field named '%s' existed", fieldName)));
return new CustomFieldDefinitionModel(fieldResponse.getId(), fieldResponse.getSchema().getType(), fieldResponse.getSchema().getItems());
}
use of com.synopsys.integration.jira.common.model.response.CustomFieldCreationResponseModel in project hub-alert by blackducksoftware.
the class JiraCustomFieldResolverTest method verifyCachesAreInitializedTest.
@Test
void verifyCachesAreInitializedTest() {
JiraCustomFieldResolver jiraCustomFieldResolver = new JiraCustomFieldResolver(retrieveCustomFields(Map.of(FIELD_ID_1, FIELD_NAME_1)));
Set<String> customFieldIds = jiraCustomFieldResolver.getCustomFieldIds();
assertEquals(1, customFieldIds.size());
Optional<CustomFieldCreationResponseModel> customFieldCreationResponseModel = jiraCustomFieldResolver.retrieveFieldDefinition(FIELD_NAME_1);
assertTrue(customFieldCreationResponseModel.isPresent());
CustomFieldCreationResponseModel customField = customFieldCreationResponseModel.get();
assertEquals(FIELD_ID_1, customField.getId());
}
use of com.synopsys.integration.jira.common.model.response.CustomFieldCreationResponseModel in project hub-alert by blackducksoftware.
the class JiraCustomFieldResolverTest method resolveCustomFieldTest.
@Test
void resolveCustomFieldTest() {
JiraCustomFieldResolver jiraCustomFieldResolver = new JiraCustomFieldResolver(retrieveCustomFields(Map.of(FIELD_ID_1, FIELD_NAME_1)));
Optional<CustomFieldCreationResponseModel> customFieldCreationResponseModel = jiraCustomFieldResolver.retrieveFieldDefinition(FIELD_NAME_1);
assertTrue(customFieldCreationResponseModel.isPresent());
CustomFieldCreationResponseModel customField = customFieldCreationResponseModel.get();
assertEquals(FIELD_ID_1, customField.getId());
assertEquals(FIELD_KEY, customField.getKey());
assertEquals(FIELD_SCHEMA_TYPE, customField.getSchema().getType());
}
Aggregations