use of com.synopsys.integration.alert.common.persistence.model.SystemMessageModel in project hub-alert by blackducksoftware.
the class SystemActions method getSystemMessagesBefore.
private ActionResponse<MultiSystemMessageModel> getSystemMessagesBefore(String endDate) throws ParseException {
OffsetDateTime date = DateUtils.parseDateFromJsonString(endDate);
List<SystemMessageModel> messages = systemMessageAccessor.getSystemMessagesBefore(date);
return new ActionResponse<>(HttpStatus.OK, new MultiSystemMessageModel(messages));
}
use of com.synopsys.integration.alert.common.persistence.model.SystemMessageModel in project hub-alert by blackducksoftware.
the class AboutReaderTest method initialize.
@BeforeEach
public void initialize() {
alertWebServerUrlManager = Mockito.mock(AlertWebServerUrlManager.class);
Mockito.when(alertWebServerUrlManager.getServerComponentsBuilder()).thenReturn(UriComponentsBuilder.newInstance());
defaultSystemStatusUtility = Mockito.mock(DefaultSystemStatusAccessor.class);
Mockito.when(defaultSystemStatusUtility.isSystemInitialized()).thenReturn(Boolean.TRUE);
Mockito.when(defaultSystemStatusUtility.getStartupTime()).thenReturn(DateUtils.createCurrentDateTimestamp());
defaultSystemMessageUtility = Mockito.mock(DefaultSystemMessageAccessor.class);
Mockito.when(defaultSystemMessageUtility.getSystemMessages()).thenReturn(Collections.singletonList(new SystemMessageModel("1", RestConstants.formatDate(new Date()), "ERROR", "startup errors", "type")));
descriptorMetadataActions = Mockito.mock(DescriptorMetadataActions.class);
DescriptorsResponseModel descriptorsResponseModel = new DescriptorsResponseModel(Set.of(Mockito.mock(DescriptorMetadata.class), Mockito.mock(DescriptorMetadata.class)));
Mockito.when(descriptorMetadataActions.getDescriptorsByType(Mockito.anyString())).thenReturn(new ActionResponse<>(HttpStatus.OK, descriptorsResponseModel));
}
use of com.synopsys.integration.alert.common.persistence.model.SystemMessageModel in project hub-alert by blackducksoftware.
the class SystemActions method getSystemMessagesAfter.
private ActionResponse<MultiSystemMessageModel> getSystemMessagesAfter(String startDate) throws ParseException {
OffsetDateTime date = DateUtils.parseDateFromJsonString(startDate);
List<SystemMessageModel> messages = systemMessageAccessor.getSystemMessagesAfter(date);
return new ActionResponse<>(HttpStatus.OK, new MultiSystemMessageModel(messages));
}
use of com.synopsys.integration.alert.common.persistence.model.SystemMessageModel in project hub-alert by blackducksoftware.
the class SystemMessageModelTest method testContructor.
@Test
public void testContructor() {
final String id = "1";
final String severity = "type";
final String createdAt = "createdAt";
final String content = "content";
final String type = "type";
SystemMessageModel model = new SystemMessageModel(id, severity, createdAt, content, type);
assertEquals(id, model.getId());
assertEquals(severity, model.getSeverity());
assertEquals(createdAt, model.getCreatedAt());
assertEquals(content, model.getContent());
assertEquals(type, model.getType());
}
use of com.synopsys.integration.alert.common.persistence.model.SystemMessageModel in project hub-alert by blackducksoftware.
the class SystemMessageAccessorTestIT method testFindCreatedBeforeEmptyList.
@Test
public void testFindCreatedBeforeEmptyList() {
OffsetDateTime currentDate = DateUtils.createCurrentDateTimestamp();
List<SystemMessageModel> actualMessageList = defaultSystemMessageUtility.getSystemMessagesBefore(currentDate);
assertTrue(actualMessageList.isEmpty());
}
Aggregations