use of io.jenkins.blueocean.commons.ServiceException.NotFoundException in project blueocean-plugin by jenkinsci.
the class BlueTestResultContainerImpl method get.
@Override
public BlueTestResult get(final String name) {
Result resolved = resolve();
if (resolved.summary == null || resolved.results == null) {
throw new NotFoundException("no tests");
}
BlueTestResult testResult = IterableUtils.find(resolved.results, blueTestResult -> blueTestResult != null && blueTestResult.getId().equals(name), null);
if (testResult == null) {
throw new NotFoundException("not found");
}
return testResult;
}
use of io.jenkins.blueocean.commons.ServiceException.NotFoundException in project blueocean-plugin by jenkinsci.
the class BlueTestResultContainerImpl method iterator.
@NonNull
@Override
public Iterator<BlueTestResult> iterator() {
Result resolved = resolve();
if (resolved.summary == null || resolved.results == null) {
throw new NotFoundException("no tests");
}
StaplerRequest request = Stapler.getCurrentRequest();
if (request != null) {
String status = request.getParameter("status");
String state = request.getParameter("state");
String age = request.getParameter("age");
return getBlueTestResultIterator(resolved.results, status, state, age);
}
return resolved.results.iterator();
}
use of io.jenkins.blueocean.commons.ServiceException.NotFoundException in project blueocean-plugin by jenkinsci.
the class RunContainerImpl method get.
@Override
public BlueRun get(String name) {
RunList<? extends hudson.model.Run> runList = job.getBuilds();
if (name == null) {
return BlueRunFactory.getRun(runList.getLastBuild(), pipeline);
}
for (hudson.model.Run r : runList) {
if (r.getId().equals(name)) {
return BlueRunFactory.getRun(r, pipeline);
}
}
int number;
try {
number = Integer.parseInt(name);
} catch (NumberFormatException e) {
throw new NotFoundException(String.format("Run %s not found in organization %s and pipeline %s", name, pipeline.getOrganizationName(), job.getName()));
}
for (BlueQueueItem item : QueueUtil.getQueuedItems(pipeline.getOrganization(), job)) {
if (item.getExpectedBuildNumber() == number) {
return item.toRun();
}
}
throw new NotFoundException(String.format("Run %s not found in organization %s and pipeline %s", name, pipeline.getOrganizationName(), job.getName()));
}
Aggregations