Merge "Extract status from PatchSetAttribute"
diff --git a/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractor.java b/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractor.java
index b1a47be..4ef5e41 100644
--- a/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractor.java
+++ b/hooks-its/src/main/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractor.java
@@ -85,6 +85,8 @@
Integer.toString(patchSetAttribute.sizeDeletions)));
properties.add(propertyFactory.create("insertions",
Integer.toString(patchSetAttribute.sizeInsertions)));
+ properties.add(propertyFactory.create("is-draft",
+ Boolean.toString(patchSetAttribute.isDraft)));
properties.addAll(extractFrom(patchSetAttribute.uploader,
"uploader"));
properties.addAll(extractFrom(patchSetAttribute.author,
diff --git a/hooks-its/src/main/resources/Documentation/config.md b/hooks-its/src/main/resources/Documentation/config.md
index afc74f9..165e191 100644
--- a/hooks-its/src/main/resources/Documentation/config.md
+++ b/hooks-its/src/main/resources/Documentation/config.md
@@ -383,6 +383,8 @@
number of lines deleted by the patch set.
'insertions'::
number of lines inserted by the patch set.
+'is-draft'::
+ '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.
'patch-set-number'::
diff --git a/hooks-its/src/test/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractorTest.java b/hooks-its/src/test/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractorTest.java
index 80f90e3..0125bc0 100644
--- a/hooks-its/src/test/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractorTest.java
+++ b/hooks-its/src/test/java/com/googlesource/gerrit/plugins/hooks/util/PropertyAttributeExtractorTest.java
@@ -267,6 +267,7 @@
patchSetAttribute.parents = Lists.newArrayList("parent1", "parent2");
patchSetAttribute.sizeDeletions = 7;
patchSetAttribute.sizeInsertions = 12;
+ patchSetAttribute.isDraft = true;
patchSetAttribute.uploader = uploader;
patchSetAttribute.author = author;
@@ -299,6 +300,10 @@
expect(propertyFactory.create("insertions", "12"))
.andReturn(propertyInsertions);
+ Property propertyIsDraft= createMock(Property.class);
+ expect(propertyFactory.create("is-draft", "true"))
+ .andReturn(propertyIsDraft);
+
Property propertyEmail1 = createMock(Property.class);
expect(propertyFactory.create("uploader-email", "testEmail1"))
.andReturn(propertyEmail1);
@@ -338,6 +343,7 @@
expected.add(propertyParents);
expected.add(propertyDeletions);
expected.add(propertyInsertions);
+ expected.add(propertyIsDraft);
expected.add(propertyEmail1);
expected.add(propertyName1);
expected.add(propertyUsername1);