Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Set current project name for EventListener events.

Change-Id: Ieaa3fd0a80b08ad2e0703e51864531a502e1894e
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionController.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionController.java
index f9214c6..f565dc1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionController.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionController.java
@@ -56,6 +56,7 @@
   public void onEvent(Event event) {
     if (event instanceof RefEvent) {
       RefEvent refEvent = (RefEvent) event;
+      ItsConfig.setCurrentProjectName(refEvent.getProjectNameKey());
       if (itsConfig.isEnabled(refEvent)) {
         handleEvent(refEvent);
       }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java
index 3653d26..27545a2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/ActionControllerTest.java
@@ -21,6 +21,7 @@
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
+import com.google.gerrit.entities.Project;
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.gerrit.server.events.ChangeEvent;
 import com.google.gerrit.server.events.RefEvent;
@@ -36,6 +37,7 @@
 import java.util.Set;
 
 public class ActionControllerTest extends LoggingMockingTestCase {
+  private static Project.NameKey testProjectName = Project.nameKey("test-project");
   private Injector injector;
 
   private PropertyExtractor propertyExtractor;
@@ -51,6 +53,7 @@
     Set<Map<String, String>> propertySets = new HashSet<>();
     when(propertyExtractor.extractFrom(event))
         .thenReturn(new RefEventProperties(Collections.emptyMap(), propertySets));
+    when(event.getProjectNameKey()).thenReturn(testProjectName);
 
     actionController.onEvent(event);
   }
@@ -66,6 +69,7 @@
 
     when(propertyExtractor.extractFrom(event))
         .thenReturn(new RefEventProperties(properties, propertySets));
+    when(event.getProjectNameKey()).thenReturn(testProjectName);
 
     // When no issues are found in the commit message, the list of actions is empty
     // as there are no matchs with an empty map of properties.
@@ -95,6 +99,7 @@
 
     when(propertyExtractor.extractFrom(event))
         .thenReturn(new RefEventProperties(projectProperties, propertySets));
+    when(event.getProjectNameKey()).thenReturn(testProjectName);
 
     ActionRequest issueActionRequest1 = mock(ActionRequest.class);
     Collection<ActionRequest> issueActionRequests = ImmutableList.of(issueActionRequest1);
@@ -126,6 +131,7 @@
 
     when(propertyExtractor.extractFrom(event))
         .thenReturn(new RefEventProperties(Collections.emptyMap(), propertySets));
+    when(event.getProjectNameKey()).thenReturn(testProjectName);
 
     ActionRequest actionRequest1 = mock(ActionRequest.class);
     Collection<ActionRequest> actionRequests1 = ImmutableList.of(actionRequest1);