use of com.thoughtworks.go.domain.PipelineRunIdInfo in project gocd by gocd.
the class InternalMaterialModificationsControllerV1 method modifications.
public String modifications(Request request, Response response) throws Exception {
String fingerprint = request.params("fingerprint");
Long after = afterCursor(request);
Long before = beforeCursor(request);
Integer pageSize = getPageSize(request);
String pattern = request.queryParamOrDefault("pattern", "");
HttpOperationResult result = new HttpOperationResult();
MaterialConfig materialConfig = materialConfigService.getMaterialConfig(currentUsernameString(), fingerprint, result);
if (!result.canContinue()) {
return renderHTTPOperationResult(result, request, response);
}
List<Modification> modifications = materialService.getModificationsFor(materialConfig, pattern, after, before, pageSize);
PipelineRunIdInfo info = materialService.getLatestAndOldestModification(materialConfig, pattern);
return writerForTopLevelObject(request, response, writer -> ModificationsRepresenter.toJSON(writer, modifications, info, materialConfig.getFingerprint(), pattern, pageSize));
}
use of com.thoughtworks.go.domain.PipelineRunIdInfo in project gocd by gocd.
the class MaterialServiceTest method shouldCallDaoToFetchLatestAndOlderModification.
@Test
public void shouldCallDaoToFetchLatestAndOlderModification() {
GitMaterialConfig materialConfig = git("http://test.com");
GitMaterialInstance gitMaterialInstance = new GitMaterialInstance("http://test.com", null, null, null, "flyweight");
PipelineRunIdInfo value = new PipelineRunIdInfo(1, 2);
when(materialRepository.findMaterialInstance(materialConfig)).thenReturn(gitMaterialInstance);
when(materialRepository.getOldestAndLatestModificationId(anyLong(), anyString())).thenReturn(value);
PipelineRunIdInfo info = materialService.getLatestAndOldestModification(materialConfig, "");
verify(materialRepository).getOldestAndLatestModificationId(anyLong(), eq(""));
assertThat(info, is(value));
}
Aggregations