use of com.thoughtworks.go.domain.materials.MatchedRevision in project gocd by gocd.
the class MaterialSearchController method search.
public String search(Request request, Response response) throws IOException {
String pipelineName = request.queryParams("pipeline_name");
String fingerprint = request.queryParams("fingerprint");
String searchText = request.queryParamOrDefault("search_text", "");
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
List<MatchedRevision> matchedRevisions = materialService.searchRevisions(pipelineName, fingerprint, searchText, currentUsername(), result);
if (result.isSuccessful()) {
return writerForTopLevelArray(request, response, outputListWriter -> MatchedRevisionRepresenter.toJSON(outputListWriter, matchedRevisions));
} else {
return renderHTTPOperationResult(result, request, response);
}
}
use of com.thoughtworks.go.domain.materials.MatchedRevision in project gocd by gocd.
the class MaterialSearchControllerDelegate method search.
public String search(Request request, Response response) throws IOException {
String pipelineName = request.queryParams("pipeline_name");
String fingerprint = request.queryParams("fingerprint");
String searchText = request.queryParamOrDefault("search_text", "");
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
List<MatchedRevision> matchedRevisions = materialService.searchRevisions(pipelineName, fingerprint, searchText, currentUsername(), result);
if (result.isSuccessful()) {
return writerForTopLevelArray(request, response, outputListWriter -> MatchedRevisionRepresenter.toJSON(outputListWriter, matchedRevisions));
} else {
return renderHTTPOperationResult(result, request, response, localizer);
}
}
use of com.thoughtworks.go.domain.materials.MatchedRevision in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldReturnMatchedRevisionForPluggableSCMMaterial.
@Test
void shouldReturnMatchedRevisionForPluggableSCMMaterial() {
ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "v1");
SCM scmConfig = SCMMother.create("scm-id", "scm-name", "pluginid", "version", new Configuration(k1));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
Date timestamp = new Date();
MatchedRevision matchedRevision = material.createMatchedRevision(new Modification("go", "comment", null, timestamp, "rev123"), "rev");
assertThat(matchedRevision.getShortRevision()).isEqualTo("rev123");
assertThat(matchedRevision.getLongRevision()).isEqualTo("rev123");
assertThat(matchedRevision.getCheckinTime()).isEqualTo(timestamp);
assertThat(matchedRevision.getUser()).isEqualTo("go");
assertThat(matchedRevision.getComment()).isEqualTo("comment");
}
use of com.thoughtworks.go.domain.materials.MatchedRevision in project gocd by gocd.
the class PackageMaterialTest method shouldReturnMatchedRevisionForPackageMaterial.
@Test
void shouldReturnMatchedRevisionForPackageMaterial() {
PackageMaterial material = new PackageMaterial();
PackageRepository repository = PackageRepositoryMother.create("repo-id", "repo-name", "pluginid", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "v1")));
material.setPackageDefinition(PackageDefinitionMother.create("p-id", "package-name", new Configuration(ConfigurationPropertyMother.create("k2", false, "v2")), repository));
Date timestamp = new Date();
MatchedRevision matchedRevision = material.createMatchedRevision(new Modification("go", "comment", null, timestamp, "rev123"), "rev");
assertThat(matchedRevision.getShortRevision()).isEqualTo("rev123");
assertThat(matchedRevision.getLongRevision()).isEqualTo("rev123");
assertThat(matchedRevision.getCheckinTime()).isEqualTo(timestamp);
assertThat(matchedRevision.getUser()).isEqualTo("go");
assertThat(matchedRevision.getComment()).isEqualTo("comment");
}
Aggregations