Fixing compile errors after change 73527.
The memoized supplied pattern needs a different access to Gerrit Events
using the .get() and more importantly tests must be modified
accordingly to produce Supplier objects.
Change-Id: I64e59ce6887efa0d465a142669c0df3487f04de5
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 46cfe92..1a803e9 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
@@ -64,25 +64,25 @@
public boolean isEnabled(Event event) {
if (event instanceof PatchSetCreatedEvent) {
PatchSetCreatedEvent e = (PatchSetCreatedEvent) event;
- return isEnabled(e.change.project, e.getRefName());
+ return isEnabled(e.getProjectNameKey().get(), e.getRefName());
} else if (event instanceof CommentAddedEvent) {
CommentAddedEvent e = (CommentAddedEvent) event;
- return isEnabled(e.change.project, e.getRefName());
+ return isEnabled(e.getProjectNameKey().get(), e.getRefName());
} else if (event instanceof ChangeMergedEvent) {
ChangeMergedEvent e = (ChangeMergedEvent) event;
- return isEnabled(e.change.project, e.getRefName());
+ return isEnabled(e.getProjectNameKey().get(), e.getRefName());
} else if (event instanceof ChangeAbandonedEvent) {
ChangeAbandonedEvent e = (ChangeAbandonedEvent) event;
- return isEnabled(e.change.project, e.getRefName());
+ return isEnabled(e.getProjectNameKey().get(), e.getRefName());
} else if (event instanceof ChangeRestoredEvent) {
ChangeRestoredEvent e = (ChangeRestoredEvent) event;
- return isEnabled(e.change.project, e.getRefName());
+ return isEnabled(e.getProjectNameKey().get(), e.getRefName());
} else if (event instanceof DraftPublishedEvent) {
DraftPublishedEvent e = (DraftPublishedEvent) event;
- return isEnabled(e.change.project, e.getRefName());
+ return isEnabled(e.getProjectNameKey().get(), e.getRefName());
} else if (event instanceof RefUpdatedEvent) {
RefUpdatedEvent e = (RefUpdatedEvent) event;
- return isEnabled(e.refUpdate.project, e.refUpdate.refName);
+ return isEnabled(e.getProjectNameKey().get(), e.refUpdate.get().refName);
} else {
log.debug("Event " + event + " not recognised and ignored");
return false;
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 55d5a8d..8c30a0c 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
@@ -75,91 +75,91 @@
private Map<String,Set<String>> extractFrom(ChangeAbandonedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.change));
- common.addAll(propertyAttributeExtractor.extractFrom(event.abandoner, "abandoner"));
- common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.change.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.abandoner.get(), "abandoner"));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet.get()));
common.add(propertyFactory.create("reason", event.reason));
- PatchSet.Id patchSetId = newPatchSetId(event.change.number,
- event.patchSet.number);
- return issueExtractor.getIssueIds(event.change.project,
- event.patchSet.revision, patchSetId);
+ PatchSet.Id patchSetId = newPatchSetId(event.change.get().number,
+ event.patchSet.get().number);
+ return issueExtractor.getIssueIds(event.change.get().project,
+ event.patchSet.get().revision, patchSetId);
}
private Map<String,Set<String>> extractFrom(ChangeMergedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.change));
- common.addAll(propertyAttributeExtractor.extractFrom(event.submitter, "submitter"));
- common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet));
- PatchSet.Id patchSetId = newPatchSetId(event.change.number,
- event.patchSet.number);
- return issueExtractor.getIssueIds(event.change.project,
- event.patchSet.revision, patchSetId);
+ common.addAll(propertyAttributeExtractor.extractFrom(event.change.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.submitter.get(), "submitter"));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet.get()));
+ PatchSet.Id patchSetId = newPatchSetId(event.change.get().number,
+ event.patchSet.get().number);
+ return issueExtractor.getIssueIds(event.change.get().project,
+ event.patchSet.get().revision, patchSetId);
}
private Map<String,Set<String>> extractFrom(ChangeRestoredEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.change));
- common.addAll(propertyAttributeExtractor.extractFrom(event.restorer, "restorer"));
- common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.change.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.restorer.get(), "restorer"));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet.get()));
common.add(propertyFactory.create("reason", event.reason));
- PatchSet.Id patchSetId = newPatchSetId(event.change.number,
- event.patchSet.number);
- return issueExtractor.getIssueIds(event.change.project,
- event.patchSet.revision, patchSetId);
+ PatchSet.Id patchSetId = newPatchSetId(event.change.get().number,
+ event.patchSet.get().number);
+ return issueExtractor.getIssueIds(event.change.get().project,
+ event.patchSet.get().revision, patchSetId);
}
private Map<String,Set<String>> extractFrom(DraftPublishedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.change));
- common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet));
- common.addAll(propertyAttributeExtractor.extractFrom(event.uploader, "uploader"));
- PatchSet.Id patchSetId = newPatchSetId(event.change.number,
- event.patchSet.number);
- return issueExtractor.getIssueIds(event.change.project,
- event.patchSet.revision, patchSetId);
+ common.addAll(propertyAttributeExtractor.extractFrom(event.change.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.uploader.get(), "uploader"));
+ PatchSet.Id patchSetId = newPatchSetId(event.change.get().number,
+ event.patchSet.get().number);
+ return issueExtractor.getIssueIds(event.change.get().project,
+ event.patchSet.get().revision, patchSetId);
}
private Map<String,Set<String>> extractFrom(RefUpdatedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.submitter, "submitter"));
- common.addAll(propertyAttributeExtractor.extractFrom(event.refUpdate));
- return issueExtractor.getIssueIds(event.refUpdate.project,
- event.refUpdate.newRev);
+ common.addAll(propertyAttributeExtractor.extractFrom(event.submitter.get(), "submitter"));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.refUpdate.get()));
+ return issueExtractor.getIssueIds(event.refUpdate.get().project,
+ event.refUpdate.get().newRev);
}
private Map<String,Set<String>> extractFrom(PatchSetCreatedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.change));
- common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet));
- common.addAll(propertyAttributeExtractor.extractFrom(event.uploader, "uploader"));
- PatchSet.Id patchSetId = newPatchSetId(event.change.number,
- event.patchSet.number);
- return issueExtractor.getIssueIds(event.change.project,
- event.patchSet.revision, patchSetId);
+ common.addAll(propertyAttributeExtractor.extractFrom(event.change.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.uploader.get(), "uploader"));
+ PatchSet.Id patchSetId = newPatchSetId(event.change.get().number,
+ event.patchSet.get().number);
+ return issueExtractor.getIssueIds(event.change.get().project,
+ event.patchSet.get().revision, patchSetId);
}
private Map<String,Set<String>> extractFrom(CommentAddedEvent event,
Set<Property> common) {
common.add(propertyFactory.create("event-type", event.type));
- common.addAll(propertyAttributeExtractor.extractFrom(event.change));
- common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet));
- common.addAll(propertyAttributeExtractor.extractFrom(event.author, "commenter"));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.change.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.patchSet.get()));
+ common.addAll(propertyAttributeExtractor.extractFrom(event.author.get(), "commenter"));
if (event.approvals != null) {
- for (ApprovalAttribute approvalAttribute : event.approvals) {
+ for (ApprovalAttribute approvalAttribute : event.approvals.get()) {
common.addAll(propertyAttributeExtractor.extractFrom(
approvalAttribute));
}
}
common.add(propertyFactory.create("comment", event.comment));
- PatchSet.Id patchSetId = newPatchSetId(event.change.number,
- event.patchSet.number);
- return issueExtractor.getIssueIds(event.change.project,
- event.patchSet.revision, patchSetId);
+ PatchSet.Id patchSetId = newPatchSetId(event.change.get().number,
+ event.patchSet.get().number);
+ return issueExtractor.getIssueIds(event.change.get().project,
+ event.patchSet.get().revision, patchSetId);
}
/**
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 32c3f20..678bc76 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
@@ -16,6 +16,7 @@
import static org.easymock.EasyMock.expect;
+import com.google.common.base.Suppliers;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.config.FactoryModule;
import com.google.gerrit.reviewdb.client.Project;
@@ -277,9 +278,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -293,9 +295,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -309,9 +312,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -325,9 +329,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -341,9 +346,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -357,9 +363,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -373,9 +380,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -389,9 +397,10 @@
setupIsEnabled("true", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -405,9 +414,10 @@
setupIsEnabled("false", null, branches);
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -421,9 +431,10 @@
setupIsEnabled("true", null, branches);
CommentAddedEvent event = new CommentAddedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -437,9 +448,10 @@
setupIsEnabled("true", null, branches);
ChangeMergedEvent event = new ChangeMergedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -453,9 +465,10 @@
setupIsEnabled("true", null, branches);
ChangeAbandonedEvent event = new ChangeAbandonedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -469,9 +482,10 @@
setupIsEnabled("true", null, branches);
ChangeRestoredEvent event = new ChangeRestoredEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -485,9 +499,10 @@
setupIsEnabled("true", null, branches);
DraftPublishedEvent event = new DraftPublishedEvent();
- event.change = new ChangeAttribute();
- event.change.project = "testProject";
- event.change.branch = "testBranch";
+ ChangeAttribute changeAttribute = new ChangeAttribute();
+ changeAttribute.project = "testProject";
+ changeAttribute.branch = "testBranch";
+ event.change = Suppliers.ofInstance(changeAttribute);
ItsConfig itsConfig = createItsConfig();
@@ -501,9 +516,11 @@
setupIsEnabled("true", null, branches);
RefUpdatedEvent event = new RefUpdatedEvent();
- event.refUpdate = new RefUpdateAttribute();
- event.refUpdate.project = "testProject";
- event.refUpdate.refName = "refs/heads/testBranch";
+
+ RefUpdateAttribute refUpdate = new RefUpdateAttribute();
+ refUpdate.project = "testProject";
+ refUpdate.refName = "refs/heads/testBranch";
+ event.refUpdate = Suppliers.ofInstance(refUpdate);
ItsConfig itsConfig = createItsConfig();
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 de432bb..90d379a 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
@@ -15,6 +15,7 @@
import static org.easymock.EasyMock.expect;
+import com.google.common.base.Suppliers;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gerrit.extensions.annotations.PluginName;
@@ -72,19 +73,19 @@
ChangeAbandonedEvent event = new ChangeAbandonedEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ event.change = Suppliers.ofInstance(changeAttribute);
Property propertyChange = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(changeAttribute))
.andReturn(Sets.newHashSet(propertyChange));
AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.abandoner= accountAttribute;
+ event.abandoner= Suppliers.ofInstance(accountAttribute);
Property propertySubmitter = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(accountAttribute,
"abandoner")).andReturn(Sets.newHashSet(propertySubmitter));
PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
- event.patchSet = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -113,19 +114,19 @@
ChangeMergedEvent event = new ChangeMergedEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ event.change = Suppliers.ofInstance(changeAttribute);
Property propertyChange = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(changeAttribute))
.andReturn(Sets.newHashSet(propertyChange));
AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.submitter = accountAttribute;
+ event.submitter = Suppliers.ofInstance(accountAttribute);
Property propertySubmitter = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(accountAttribute,
"submitter")).andReturn(Sets.newHashSet(propertySubmitter));
PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
- event.patchSet = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -147,19 +148,19 @@
ChangeRestoredEvent event = new ChangeRestoredEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ event.change = Suppliers.ofInstance(changeAttribute);
Property propertyChange = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(changeAttribute))
.andReturn(Sets.newHashSet(propertyChange));
AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.restorer = accountAttribute;
+ event.restorer = Suppliers.ofInstance(accountAttribute);
Property propertySubmitter = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(accountAttribute,
"restorer")).andReturn(Sets.newHashSet(propertySubmitter));
PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
- event.patchSet = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -187,19 +188,19 @@
CommentAddedEvent event = new CommentAddedEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ event.change = Suppliers.ofInstance(changeAttribute);
Property propertyChange = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(changeAttribute))
.andReturn(Sets.newHashSet(propertyChange));
AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.author = accountAttribute;
+ event.author = Suppliers.ofInstance(accountAttribute);
Property propertySubmitter = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(accountAttribute,
"commenter")).andReturn(Sets.newHashSet(propertySubmitter));
PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
- event.patchSet = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -227,19 +228,19 @@
CommentAddedEvent event = new CommentAddedEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ event.change = Suppliers.ofInstance(changeAttribute);
Property propertyChange = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(changeAttribute))
.andReturn(Sets.newHashSet(propertyChange));
AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.author = accountAttribute;
+ event.author = Suppliers.ofInstance(accountAttribute);
Property propertySubmitter = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(accountAttribute,
"commenter")).andReturn(Sets.newHashSet(propertySubmitter));
PatchSetAttribute patchSetAttribute = createMock(PatchSetAttribute.class);
- event.patchSet = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -254,7 +255,7 @@
.andReturn(Sets.newHashSet(propertyApproval2));
ApprovalAttribute approvalAttributes[] = { approvalAttribute1,
approvalAttribute2 };
- event.approvals = approvalAttributes;
+ event.approvals = Suppliers.ofInstance(approvalAttributes);
event.comment = "testComment";
Property propertyComment = createMock(Property.class);
@@ -281,19 +282,19 @@
DraftPublishedEvent event = new DraftPublishedEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ 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 = accountAttribute;
+ 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 = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -316,19 +317,19 @@
PatchSetCreatedEvent event = new PatchSetCreatedEvent();
ChangeAttribute changeAttribute = createMock(ChangeAttribute.class);
- event.change = changeAttribute;
+ 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 = accountAttribute;
+ 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 = patchSetAttribute;
+ event.patchSet = Suppliers.ofInstance(patchSetAttribute);
Property propertyPatchSet = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(patchSetAttribute))
.andReturn(Sets.newHashSet(propertyPatchSet));
@@ -351,14 +352,14 @@
RefUpdatedEvent event = new RefUpdatedEvent();
AccountAttribute accountAttribute = createMock(AccountAttribute.class);
- event.submitter = accountAttribute;
+ event.submitter = Suppliers.ofInstance(accountAttribute);
Property propertySubmitter = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(accountAttribute,
"submitter")).andReturn(Sets.newHashSet(propertySubmitter));
RefUpdateAttribute refUpdateAttribute =
createMock(RefUpdateAttribute.class);
- event.refUpdate = refUpdateAttribute;
+ event.refUpdate = Suppliers.ofInstance(refUpdateAttribute);
Property propertyRefUpdated = createMock(Property.class);
expect(propertyAttributeExtractor.extractFrom(refUpdateAttribute))
.andReturn(Sets.newHashSet(propertyRefUpdated));