use of com.synopsys.integration.alert.update.model.DockerTagModel in project hub-alert by blackducksoftware.
the class UpdateChecker method getLatestAvailableTag.
private Optional<VersionDateModel> getLatestAvailableTag(DockerTagRetriever dockerTagRetriever, boolean isProduction) {
DockerTagsResponseModel tagsResponseModel = dockerTagRetriever.getTagsModel();
List<DockerTagModel> tags = new LinkedList<>();
while (!tagsResponseModel.isEmpty()) {
tags.addAll(tagsResponseModel.getResults());
tagsResponseModel = dockerTagRetriever.getNextPage(tagsResponseModel);
}
return tags.stream().filter(dockerTagModel -> {
if (isProduction) {
return isProductionVersion(dockerTagModel.getName());
}
return true;
}).map(dockerTagModel -> new VersionDateModel(dockerTagModel.getName(), dockerTagModel.getLastUpdated())).min(versionDateModelComparator());
}
use of com.synopsys.integration.alert.update.model.DockerTagModel in project hub-alert by blackducksoftware.
the class DockerTagRetrieverTest method createMockResponse.
private Response createMockResponse() throws IntegrationException {
Response mockResponse = Mockito.mock(Response.class);
List<DockerTagModel> tagModels = List.of(createDockerTagModel("1.0.0"), createDockerTagModel("1.0.1"));
DockerTagsResponseModel mockDockerTagsResponseModel = new DockerTagsResponseModel(TAGS_COUNT, null, null, tagModels);
String jsonString = gson.toJson(mockDockerTagsResponseModel);
Mockito.when(mockResponse.getContentString()).thenReturn(jsonString);
Mockito.doNothing().when(mockResponse).throwExceptionForError();
return mockResponse;
}
Aggregations