Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
public class PhabricatorPostbuildSummaryAction implements Action {
private final String iconPath;
private final String url;
private final String diffID;
private final String revisionID;
private final String authorName;
private final String authorEmail;
private final String commitMessage;

public PhabricatorPostbuildSummaryAction(String iconPath, String phabricatorLink, String revisionID,
public PhabricatorPostbuildSummaryAction(String iconPath, String phabricatorLink, String diffID, String revisionID,
String authorName, String authorEmail, String commitMessage) {
this.iconPath = iconPath;
this.url = phabricatorLink;
this.diffID = diffID;
this.revisionID = revisionID;
this.authorName = authorName;
this.authorEmail = authorEmail;
Expand Down Expand Up @@ -71,6 +73,10 @@ public String getIconFileName() {
return revisionID;
}

@Exported public String getDiffID() {
return diffID;
}

@Exported public String getAuthorName() {
return authorName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public Differential(JSONObject rawJSON) {
this.rawJSON = rawJSON;
}

public String getDIffID() {
Copy link
Contributor Author

@liuhaotian liuhaotian Dec 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be public String getID() { instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDIffID -> getDiffId

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjx It may be inconsistent with the surrounding code like getRevisionID though.

String rawDiffId = (String) rawJSON.get("id");
if (rawDiffId == null || rawDiffId.equals("")) {
return null;
}
return rawDiffId;
}

public String getRevisionID(boolean formatted) {
String rawRevisionId = (String) rawJSON.get("revisionID");
if (rawRevisionId == null || rawRevisionId.equals("")) {
Expand Down Expand Up @@ -85,6 +93,7 @@ public PhabricatorPostbuildSummaryAction createSummary(String phabricatorURL) {
return new PhabricatorPostbuildSummaryAction(
"phabricator.png",
getPhabricatorLink(phabricatorURL),
getDIffID(),
getRevisionID(true),
getAuthorName(),
getAuthorEmail(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import java.io.IOException;

public class DifferentialTest extends TestCase {
private static final String FAKE_DIFF_ID = "not-a-real-id";
private static final String FAKE_DIFF_ID = "not-a-real-diff-id";
private static final String FAKE_REVISION_ID = "not-a-real-revision-id";

Differential differential;

Expand All @@ -43,12 +44,12 @@ protected void setUp() throws IOException, ArcanistUsageException, InterruptedEx

@Test
public void testFetchRevisionID() throws Exception {
assertEquals(FAKE_DIFF_ID, differential.getRevisionID(false));
assertEquals(FAKE_REVISION_ID, differential.getRevisionID(false));
}

@Test
public void testGetPhabricatorLink() throws Exception {
assertTrue(differential.getPhabricatorLink("http://example.com").contains(FAKE_DIFF_ID));
assertTrue(differential.getPhabricatorLink("http://example.com").contains(FAKE_REVISION_ID));
}

@Test
Expand Down Expand Up @@ -86,8 +87,9 @@ public void testGetBaseCommit() throws Exception {
@Test
public void testGetSummaryMessage() throws Exception {
PhabricatorPostbuildSummaryAction summary = differential.createSummary("http://example.com");
assertEquals("http://example.com/Dnot-a-real-id", summary.getUrl());
assertEquals("Dnot-a-real-id", summary.getRevisionID());
assertEquals("http://example.com/Dnot-a-real-revision-id", summary.getUrl());
assertEquals("not-a-real-diff-id", summary.getDiffID());
assertEquals("Dnot-a-real-revision-id", summary.getRevisionID());
assertEquals("aiden", summary.getAuthorName());
assertEquals("ai@uber.com", summary.getAuthorEmail());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"revisionID": "not-a-real-id",
"id": "not-a-real-diff-id",
"revisionID": "not-a-real-revision-id",
"branch": "a-branch-name",
"sourceControlBaseRevision": "aaaaaaaa",
"authorName": "aiden",
Expand Down