Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

119: Support fetching Jira issues with only a partial id #183

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -831,6 +831,25 @@ void issueInSummary(TestInfo testInfo) throws IOException {
assertFalse(pr.getBody().contains("My first issue"));
assertTrue(pr.getBody().contains("My second issue"));

// Use an invalid issue key
var issueKey = issue1.getId().replace("TEST", "BADPROJECT");
pr.setTitle(issueKey + ": This is a pull request");

// Check the status again
TestBotRunner.runPeriodicItems(checkBot);
assertFalse(pr.getBody().contains("My first issue"));
assertFalse(pr.getBody().contains("My second issue"));
assertTrue(pr.getBody().contains("Failed to retrieve"));

// Now drop the issue key
issueKey = issue1.getId().replace("TEST-", "");
pr.setTitle(issueKey + ": This is a pull request");

// The body should now contain the updated issue title
TestBotRunner.runPeriodicItems(checkBot);
assertTrue(pr.getBody().contains("My first issue"));
assertFalse(pr.getBody().contains("My second issue"));

// Now enter an invalid issue id
pr.setTitle("2384848: This is a pull request");

@@ -57,6 +57,9 @@ public Issue createIssue(String title, List<String> body) {

@Override
public Optional<Issue> getIssue(String id) {
if (id.indexOf('-') < 0) {
id = projectName.toUpperCase() + "-" + id;
}
var issue = request.get("issue/" + id)
.onError(r -> r.statusCode() == 404 ? JSON.object().put("NOT_FOUND", true) : null)
.execute();
@@ -161,7 +161,7 @@ TestPullRequest getPullRequest(TestHostedRepository repository, String id) {
}

TestIssue createIssue(TestIssueProject issueProject, String title, List<String> body) {
var id = String.valueOf(data.issues.size() + 1);
var id = issueProject.projectName().toUpperCase() + "-" + (data.issues.size() + 1);
var issue = TestIssue.createNew(issueProject, id, title, body);
data.issues.put(id ,issue);
return issue;
@@ -32,6 +32,10 @@
private final String projectName;
private final TestHost host;

String projectName() {
return projectName;
}

@Override
public Host host() {
return host;
@@ -54,6 +58,10 @@ public Issue createIssue(String title, List<String> body) {

@Override
public Optional<Issue> getIssue(String id) {
if (id.indexOf('-') < 0) {
id = projectName.toUpperCase() + "-" + id;
}

return Optional.ofNullable(host.getIssue(this, id));
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.