use of org.jenkinsci.plugin.gitea.client.api.GiteaIssue in project gitea-plugin by jenkinsci.
the class MockGiteaConnection method withRepo.
public MockGiteaConnection withRepo(GiteaRepository repo) {
GiteaRepository clone = repo.clone();
clone.setId(nextId.incrementAndGet());
clone.setCreatedAt(new Date());
clone.setUpdatedAt(new Date());
this.repositories.put(keyOf(clone), clone);
this.repoHooks.put(keyOf(clone), new ArrayList<GiteaHook>());
this.branches.put(keyOf(clone), new HashMap<String, GiteaBranch>());
this.pulls.put(keyOf(clone), new HashMap<Long, GiteaPullRequest>());
this.issues.put(keyOf(clone), new HashMap<Long, GiteaIssue>());
this.collaborators.put(keyOf(clone), new TreeSet<String>());
this.files.put(keyOf(clone), new TreeMap<String, Map<String, byte[]>>());
return this;
}
use of org.jenkinsci.plugin.gitea.client.api.GiteaIssue in project gitea-plugin by jenkinsci.
the class MockGiteaConnection method withIssue.
public MockGiteaConnection withIssue(GiteaRepository repo, GiteaIssue issue) {
GiteaIssue clone = issue.clone();
clone.setId(nextId.incrementAndGet());
clone.setNumber(clone.getId());
clone.setCreatedAt(new Date());
clone.setUpdatedAt(new Date());
issues.get(keyOf(repo)).put(issue.getId(), issue);
return this;
}
use of org.jenkinsci.plugin.gitea.client.api.GiteaIssue in project gitea-plugin by jenkinsci.
the class MockGiteaConnection method withPull.
public MockGiteaConnection withPull(GiteaRepository repo, GiteaPullRequest pull) {
GiteaPullRequest clone = pull.clone();
clone.setId(nextId.incrementAndGet());
clone.setNumber(clone.getId());
clone.setCreatedAt(new Date());
clone.setUpdatedAt(new Date());
pulls.get(keyOf(repo)).put(clone.getId(), clone);
Map<String, byte[]> content = this.files.get(keyOf(repo)).get(pull.getHead().getSha());
if (content == null) {
this.files.get(keyOf(repo)).put(pull.getHead().getSha(), new HashMap<String, byte[]>());
}
content = this.files.get(keyOf(repo)).get(pull.getBase().getSha());
if (content == null) {
this.files.get(keyOf(repo)).put(pull.getBase().getSha(), new HashMap<String, byte[]>());
}
GiteaIssue issue = new GiteaIssue();
issue.setUrl(clone.getUrl());
issue.setNumber(clone.getNumber());
issue.setUser(clone.getUser());
issue.setTitle(clone.getTitle());
issue.setBody(clone.getBody());
issue.setLabels(clone.getLabels());
issue.setMilestone(clone.getMilestone());
issue.setAssignee(clone.getAssignee());
issue.setState(clone.getState());
issue.setComments(clone.getComments());
issue.setCreatedAt(clone.getCreatedAt());
issue.setUpdatedAt(clone.getUpdatedAt());
GiteaIssue.PullSummary summary = new GiteaIssue.PullSummary();
summary.setMerged(clone.isMerged());
summary.setMergedAt(clone.getMergedAt());
issue.setPullRequest(summary);
issues.get(keyOf(repo)).put(issue.getId(), issue);
return this;
}
Aggregations