Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
Cross out gerrit_api_maven_local in WORKSPACE
Change-Id: I9e77e120a0ce1818a9177b990cf37e0b3c31a2af
diff --git a/WORKSPACE b/WORKSPACE
index 0ab9160..c8cbd68 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "52381b8a7cd9a68f39fd11a53fe5f4b16897a6e0",
+ commit = "cbddbc2b9571b1d692fb823ba8791ccd60b52421",
# local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
index 08d3d1d..665aef1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
@@ -30,7 +30,6 @@
import com.google.gerrit.server.events.ChangeMergedEvent;
import com.google.gerrit.server.events.ChangeRestoredEvent;
import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
import com.google.gerrit.server.events.Event;
import com.google.gerrit.server.events.PatchSetCreatedEvent;
import com.google.gerrit.server.events.RefUpdatedEvent;
@@ -100,9 +99,6 @@
} else if (event instanceof ChangeRestoredEvent) {
ChangeRestoredEvent e = (ChangeRestoredEvent) event;
return isEnabled(e.getProjectNameKey(), e.getRefName());
- } else if (event instanceof DraftPublishedEvent) {
- DraftPublishedEvent e = (DraftPublishedEvent) event;
- return isEnabled(e.getProjectNameKey(), e.getRefName());
} else if (event instanceof RefUpdatedEvent) {
RefUpdatedEvent e = (RefUpdatedEvent) event;
return isEnabled(e.getProjectNameKey(), e.getRefName());
@@ -205,14 +201,14 @@
}
})
.last();
-
+
String defPattern = gerritConfig.getString("commentlink", getCommentLinkName(),
"match");
if (!match.isPresent() && defPattern == null) {
return null;
}
-
+
return Pattern.compile(match.or(defPattern));
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
index 0384699..a306240 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractor.java
@@ -126,12 +126,6 @@
Integer.toString(patchSetAttribute.sizeDeletions)));
properties.add(propertyFactory.create("insertions",
Integer.toString(patchSetAttribute.sizeInsertions)));
- // deprecated, to be removed soon. migrate to ones without dash.
- properties.add(propertyFactory.create("is-draft",
- Boolean.toString(patchSetAttribute.isDraft)));
- // New style configs for vm and soy
- properties.add(propertyFactory.create("isDraft",
- Boolean.toString(patchSetAttribute.isDraft)));
properties.addAll(extractFrom(patchSetAttribute.uploader,
"uploader"));
properties.addAll(extractFrom(patchSetAttribute.author,
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
index d93a2a3..72a3089 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractor.java
@@ -27,7 +27,6 @@
import com.google.gerrit.server.events.ChangeMergedEvent;
import com.google.gerrit.server.events.ChangeRestoredEvent;
import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
import com.google.gerrit.server.events.Event;
import com.google.gerrit.server.events.PatchSetCreatedEvent;
import com.google.gerrit.server.events.PatchSetEvent;
@@ -113,12 +112,6 @@
return extractFrom((PatchSetEvent) event, common);
}
- private Map<String,Set<String>> extractFrom(DraftPublishedEvent event,
- Set<Property> common) {
- common.addAll(propertyAttributeExtractor.extractFrom(event.uploader.get(), "uploader"));
- return extractFrom((PatchSetEvent) event, common);
- }
-
private Map<String,Set<String>> extractFrom(RefUpdatedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
@@ -206,8 +199,6 @@
associations = extractFrom((ChangeRestoredEvent) event, common);
} else if (event instanceof CommentAddedEvent) {
associations = extractFrom((CommentAddedEvent) event, common);
- } else if (event instanceof DraftPublishedEvent) {
- associations = extractFrom((DraftPublishedEvent) event, common);
} else if (event instanceof PatchSetCreatedEvent) {
associations = extractFrom((PatchSetCreatedEvent) event, common);
} else if (event instanceof RefUpdatedEvent) {
diff --git a/src/main/resources/Documentation/config-rulebase-common.md b/src/main/resources/Documentation/config-rulebase-common.md
index 8f1da31..16f2de5 100644
--- a/src/main/resources/Documentation/config-rulebase-common.md
+++ b/src/main/resources/Documentation/config-rulebase-common.md
@@ -160,7 +160,6 @@
* [ChangeMergedEvent][event-properties-ChangeMergedEvent]
* [ChangeRestoredEvent][event-properties-ChangeRestoredEvent]
* [CommentAddedEvent][event-properties-CommentAddedEvent]
-* [DraftPublishedEvent][event-properties-DraftPublishedEvent]
* [PatchSetCreatedEvent][event-properties-PatchSetCreatedEvent]
* [RefUpdatedEvent][event-properties-RefUpdatedEvent]
* [Common properties for events on a change][event-properties-change]
@@ -332,19 +331,6 @@
properties for the [Change][event-properties-change] the comment was
added for, and it's most recent [Patch Set][event-properties-patch-set].
-[event-properties-DraftPublishedEvent]: #event-properties-DraftPublishedEvent
-### <a name="event-properties-DraftPublishedEvent">DraftPublishedEvent</a>
-
-`event`
-: `com.google.gerrit.server.events.DraftPublishedEvent`
-
-`event-type`
-: `draft-published`
-
-In addition to the above properties, the event also provides
-properties for the uploaded [Patch Set][event-properties-patch-set],
-and the [Change][event-properties-change] it belongs to.
-
[event-properties-PatchSetCreatedEvent]: #event-properties-PatchSetCreatedEvent
### <a name="event-properties-PatchSetCreatedEvent">PatchSetCreatedEvent</a>
@@ -426,8 +412,8 @@
: full commit message of the most recent patch set
`status`
-: status of the change (`null`, `NEW`, `SUBMITTED`, `DRAFT`, `MERGED`,
- or `ABANDONED` )
+: status of the change (`null`, `NEW`, `SUBMITTED`, `MERGED`,
+ or `ABANDONED` )
`topic`
: name of the topic the change belongs to.
@@ -453,9 +439,6 @@
`insertions`
: number of lines inserted by the patch set.
-`isDraft`
-: 'true', if the patch set is a draft patch set, 'false' otherwise.
-
`parents`
: A list of git commit hashes that are parents to the patch set.
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
index 1b9e1bb..f0f3fe2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfigTest.java
@@ -28,7 +28,6 @@
import com.google.gerrit.server.events.ChangeMergedEvent;
import com.google.gerrit.server.events.ChangeRestoredEvent;
import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
import com.google.gerrit.server.events.Event;
import com.google.gerrit.server.events.PatchSetCreatedEvent;
import com.google.gerrit.server.events.RefUpdatedEvent;
@@ -469,20 +468,6 @@
assertTrue(itsConfig.isEnabled(event));
}
- public void testIsEnabledDraftPublishedEvent() {
- String[] branches = {};
- setupIsEnabled("true", null, branches);
-
- DraftPublishedEvent event =
- new DraftPublishedEvent(testChange("testProject", "testBranch"));
-
- ItsConfig itsConfig = createItsConfig();
-
- replayMocks();
-
- assertTrue(itsConfig.isEnabled(event));
- }
-
public void testIsEnabledRefUpdatedEvent() {
String[] branches = {};
setupIsEnabled("true", null, branches);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
index 64a824b..41f8921 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyAttributeExtractorTest.java
@@ -384,7 +384,6 @@
patchSetAttribute.parents = Lists.newArrayList("parent1", "parent2");
patchSetAttribute.sizeDeletions = 7;
patchSetAttribute.sizeInsertions = 12;
- patchSetAttribute.isDraft = true;
patchSetAttribute.uploader = uploader;
patchSetAttribute.author = author;
@@ -425,14 +424,6 @@
expect(propertyFactory.create("insertions", "12"))
.andReturn(propertyInsertions);
- Property propertyIsDraft= createMock(Property.class);
- expect(propertyFactory.create("is-draft", "true"))
- .andReturn(propertyIsDraft);
-
- Property propertyIsDraft2= createMock(Property.class);
- expect(propertyFactory.create("isDraft", "true"))
- .andReturn(propertyIsDraft2);
-
Property propertyUploaderEmail = createMock(Property.class);
expect(propertyFactory.create("uploaderEmail", "testEmail1"))
.andReturn(propertyUploaderEmail);
@@ -499,8 +490,6 @@
expected.add(propertyParents);
expected.add(propertyDeletions);
expected.add(propertyInsertions);
- expected.add(propertyIsDraft);
- expected.add(propertyIsDraft2);
expected.add(propertyUploaderEmail);
expected.add(propertyUploaderName);
expected.add(propertyUploaderUsername);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
index 4561b42..eeffe13 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/util/PropertyExtractorTest.java
@@ -31,7 +31,6 @@
import com.google.gerrit.server.events.ChangeMergedEvent;
import com.google.gerrit.server.events.ChangeRestoredEvent;
import com.google.gerrit.server.events.CommentAddedEvent;
-import com.google.gerrit.server.events.DraftPublishedEvent;
import com.google.gerrit.server.events.Event;
import com.google.gerrit.server.events.PatchSetCreatedEvent;
import com.google.gerrit.server.events.RefUpdatedEvent;
@@ -283,42 +282,6 @@
eventHelper(event, "CommentAddedEvent", "comment-added", common, true);
}
- public void testDraftPublishedEvent() {
- DraftPublishedEvent event =
- new DraftPublishedEvent(testChange("testProject", "testBranch"));
-
- ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = Suppliers.ofInstance(changeAttribute);
- Property propertyChange = createMock(Property.class);
- expect(propertyAttributeExtractor.extractFrom(changeAttribute))
- .andReturn(Sets.newHashSet(propertyChange));
-
- AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.uploader = Suppliers.ofInstance(accountAttribute);
- Property propertySubmitter = createMock(Property.class);
- expect(propertyAttributeExtractor.extractFrom(accountAttribute,
- "uploader")).andReturn(Sets.newHashSet(propertySubmitter));
-
- PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
- event.patchSet = Suppliers.ofInstance(patchSetAttribute);
- Property propertyPatchSet = createMock(Property.class);
- expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
- .andReturn(Sets.newHashSet(propertyPatchSet));
-
- changeAttribute.project = "testProject";
- changeAttribute.number = 176;
- patchSetAttribute.revision = "testRevision";
- patchSetAttribute.number = 3;
-
- Set<Property> common = Sets.newHashSet();
- common.add(propertyChange);
- common.add(propertySubmitter);
- common.add(propertyPatchSet);
-
- eventHelper(event, "DraftPublishedEvent", "draft-published", common,
- true);
- }
-
public void testPatchSetCreatedEvent() {
PatchSetCreatedEvent event =
new PatchSetCreatedEvent(testChange("testProject", "testBranch"));