Remove old style variables used by Velocity

I5f4e166ff removed support for Velocity templates so the dash separated
variables are no longer needed.

Change-Id: I416329a84bf468fe218d488355c7472b4102fd85
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 bca7675..cf0c66d 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
@@ -40,12 +40,6 @@
   public Set<Property> extractFrom(AccountAttribute accountAttribute, String prefix) {
     Set<Property> properties = Sets.newHashSet();
     if (accountAttribute != null) {
-      // deprecated, to be removed soon. migrate to ones without dash.
-      properties.add(propertyFactory.create(prefix + "-email", accountAttribute.email));
-      properties.add(propertyFactory.create(prefix + "-username", accountAttribute.username));
-      properties.add(propertyFactory.create(prefix + "-name", accountAttribute.name));
-
-      // New style configs for vm and soy
       properties.add(propertyFactory.create(prefix + "Email", accountAttribute.email));
       properties.add(propertyFactory.create(prefix + "Username", accountAttribute.username));
       properties.add(propertyFactory.create(prefix + "Name", accountAttribute.name));
@@ -62,19 +56,11 @@
         propertyFactory.create(
             "escapedSubject", StringEscapeUtils.escapeJava(changeAttribute.subject)));
 
-    // deprecated, to be removed soon. migrate to ones without dash.
-    properties.add(propertyFactory.create("commit-message", changeAttribute.commitMessage));
-    properties.add(propertyFactory.create("change-id", changeAttribute.id));
-    properties.add(propertyFactory.create("change-number", String.valueOf(changeAttribute.number)));
-    properties.add(propertyFactory.create("change-url", changeAttribute.url));
-
-    // New style configs for vm and soy
     properties.add(propertyFactory.create("commitMessage", changeAttribute.commitMessage));
     properties.add(propertyFactory.create("changeId", changeAttribute.id));
     properties.add(propertyFactory.create("changeNumber", String.valueOf(changeAttribute.number)));
     properties.add(propertyFactory.create("changeUrl", changeAttribute.url));
 
-    // Soy specfic config though will work with Velocity too
     properties.add(
         propertyFactory.create(
             "formatChangeUrl", its.createLinkForWebui(changeAttribute.url, changeAttribute.url)));
@@ -91,20 +77,9 @@
   public Set<Property> extractFrom(PatchSetAttribute patchSetAttribute) {
     Set<Property> properties = Sets.newHashSet();
     properties.add(propertyFactory.create("revision", patchSetAttribute.revision));
-    // deprecated, to be removed soon. migrate to ones without dash.
-    properties.add(
-        propertyFactory.create("patch-set-number", String.valueOf(patchSetAttribute.number)));
-
-    // New style configs for vm and soy
     properties.add(
         propertyFactory.create("patchSetNumber", String.valueOf(patchSetAttribute.number)));
-
     properties.add(propertyFactory.create("ref", patchSetAttribute.ref));
-
-    // deprecated, to be removed soon. migrate to ones without dash.
-    properties.add(propertyFactory.create("created-on", patchSetAttribute.createdOn.toString()));
-
-    // New style configs for vm and soy
     properties.add(propertyFactory.create("createdOn", patchSetAttribute.createdOn.toString()));
 
     properties.add(propertyFactory.create("parents", patchSetAttribute.parents.toString()));
@@ -120,11 +95,6 @@
   public Set<Property> extractFrom(RefUpdateAttribute refUpdateAttribute) {
     Set<Property> properties = Sets.newHashSet();
     properties.add(propertyFactory.create("revision", refUpdateAttribute.newRev));
-
-    // deprecated, to be removed soon. migrate to ones without dash.
-    properties.add(propertyFactory.create("revision-old", refUpdateAttribute.oldRev));
-
-    // New style configs for vm and soy
     properties.add(propertyFactory.create("revisionOld", refUpdateAttribute.oldRev));
     properties.add(propertyFactory.create("ref", refUpdateAttribute.refName));
     return properties;
@@ -132,11 +102,6 @@
 
   public Set<Property> extractFrom(ApprovalAttribute approvalAttribute) {
     Set<Property> properties = Sets.newHashSet();
-    // deprecated, to be removed soon. migrate to ones without dash.
-    properties.add(
-        propertyFactory.create("approval-" + approvalAttribute.type, approvalAttribute.value));
-
-    // New style configs for vm and soy
     properties.add(
         propertyFactory.create(
             "approval" + approvalAttribute.type.replace("-", ""), approvalAttribute.value));
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
index 4777d4b..d9f3479 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddStandardComment.java
@@ -43,12 +43,12 @@
 
   private String getCommentChangeEvent(String action, String prefix, Map<String, String> map) {
     String ret = "";
-    String changeNumber = getValueFromMap(map, "", "change-number", "changeNumber");
+    String changeNumber = Strings.nullToEmpty(map.get("changeNumber"));
     if (!changeNumber.isEmpty()) {
       changeNumber += " ";
     }
     ret += "Change " + changeNumber + action;
-    String submitter = getValueFromMap(map, prefix, "-name", "Name", "-username", "Username");
+    String submitter = getValueFromMap(map, prefix, "Name", "Username");
     if (!submitter.isEmpty()) {
       ret += " by " + submitter;
     }
@@ -60,7 +60,7 @@
     if (!reason.isEmpty()) {
       ret += "\n\nReason:\n" + reason;
     }
-    String url = getValueFromMap(map, "", "change-url", "changeUrl");
+    String url = Strings.nullToEmpty(map.get("changeUrl"));
     if (!url.isEmpty()) {
       ret += "\n\n" + its.createLinkForWebui(url, url);
     }
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 0bb884d..b7e157a 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
@@ -55,17 +55,6 @@
     accountAttribute.name = "testName";
     accountAttribute.username = "testUsername";
 
-    // deprecated, to be removed soon. migrate to ones without dash.
-    Property propertyEmail2 = createMock(Property.class);
-    expect(propertyFactory.create("prefix-email", "testEmail")).andReturn(propertyEmail2);
-
-    Property propertyName2 = createMock(Property.class);
-    expect(propertyFactory.create("prefix-name", "testName")).andReturn(propertyName2);
-
-    Property propertyUsername2 = createMock(Property.class);
-    expect(propertyFactory.create("prefix-username", "testUsername")).andReturn(propertyUsername2);
-
-    // New style configs for vm and soy
     Property propertyEmail = createMock(Property.class);
     expect(propertyFactory.create("prefixEmail", "testEmail")).andReturn(propertyEmail);
 
@@ -85,9 +74,6 @@
     expected.add(propertyEmail);
     expected.add(propertyName);
     expected.add(propertyUsername);
-    expected.add(propertyEmail2);
-    expected.add(propertyName2);
-    expected.add(propertyUsername2);
     assertEquals("Properties do not match", expected, actual);
   }
 
@@ -120,22 +106,12 @@
     expect(propertyFactory.create("escapedSubject", "testSubject"))
         .andReturn(propertyEscapedSubject);
 
-    Property propertyId2 = createMock(Property.class);
-    expect(propertyFactory.create("change-id", "testId")).andReturn(propertyId2);
-
     Property propertyId = createMock(Property.class);
     expect(propertyFactory.create("changeId", "testId")).andReturn(propertyId);
 
-    Property propertyNumber2 = createMock(Property.class);
-    expect(propertyFactory.create("change-number", "4711")).andReturn(propertyNumber2);
-
     Property propertyNumber = createMock(Property.class);
     expect(propertyFactory.create("changeNumber", "4711")).andReturn(propertyNumber);
 
-    Property propertyUrl2 = createMock(Property.class);
-    expect(propertyFactory.create("change-url", "http://www.example.org/test"))
-        .andReturn(propertyUrl2);
-
     Property propertyUrl = createMock(Property.class);
     expect(propertyFactory.create("changeUrl", "http://www.example.org/test"))
         .andReturn(propertyUrl);
@@ -156,19 +132,6 @@
     expect(propertyFactory.create("commitMessage", "Commit Message"))
         .andReturn(propertyCommitMessage);
 
-    Property propertyEmail2 = createMock(Property.class);
-    expect(propertyFactory.create("owner-email", "testEmail")).andReturn(propertyEmail2);
-
-    Property propertyName2 = createMock(Property.class);
-    expect(propertyFactory.create("owner-name", "testName")).andReturn(propertyName2);
-
-    Property propertyUsername2 = createMock(Property.class);
-    expect(propertyFactory.create("owner-username", "testUsername")).andReturn(propertyUsername2);
-
-    Property propertyCommitMessage2 = createMock(Property.class);
-    expect(propertyFactory.create("commit-message", "Commit Message"))
-        .andReturn(propertyCommitMessage2);
-
     Property propertyFormatChangeUrl = createMock(Property.class);
     expect(propertyFactory.create("formatChangeUrl", "http://www.example.org/test"))
         .andReturn(propertyFormatChangeUrl);
@@ -188,20 +151,13 @@
     expected.add(propertySubject);
     expected.add(propertyEscapedSubject);
     expected.add(propertyId);
-    expected.add(propertyId2);
     expected.add(propertyNumber);
-    expected.add(propertyNumber2);
     expected.add(propertyUrl);
-    expected.add(propertyUrl2);
     expected.add(propertyStatus);
     expected.add(propertyEmail);
     expected.add(propertyName);
     expected.add(propertyUsername);
     expected.add(propertyCommitMessage);
-    expected.add(propertyEmail2);
-    expected.add(propertyName2);
-    expected.add(propertyUsername2);
-    expected.add(propertyCommitMessage2);
     expected.add(propertyFormatChangeUrl);
     assertEquals("Properties do not match", expected, actual);
   }
@@ -246,16 +202,6 @@
     expect(propertyFactory.create("changeUrl", "http://www.example.org/test"))
         .andReturn(propertyUrl);
 
-    Property propertyId2 = createMock(Property.class);
-    expect(propertyFactory.create("change-id", "testId")).andReturn(propertyId2);
-
-    Property propertyNumber2 = createMock(Property.class);
-    expect(propertyFactory.create("change-number", "4711")).andReturn(propertyNumber2);
-
-    Property propertyUrl2 = createMock(Property.class);
-    expect(propertyFactory.create("change-url", "http://www.example.org/test"))
-        .andReturn(propertyUrl2);
-
     Property propertyStatus = createMock(Property.class);
     expect(propertyFactory.create("status", "ABANDONED")).andReturn(propertyStatus);
 
@@ -272,19 +218,6 @@
     expect(propertyFactory.create("commitMessage", "Commit Message"))
         .andReturn(propertyCommitMessage);
 
-    Property propertyEmail2 = createMock(Property.class);
-    expect(propertyFactory.create("owner-email", "testEmail")).andReturn(propertyEmail2);
-
-    Property propertyName2 = createMock(Property.class);
-    expect(propertyFactory.create("owner-name", "testName")).andReturn(propertyName2);
-
-    Property propertyUsername2 = createMock(Property.class);
-    expect(propertyFactory.create("owner-username", "testUsername")).andReturn(propertyUsername2);
-
-    Property propertyCommitMessage2 = createMock(Property.class);
-    expect(propertyFactory.create("commit-message", "Commit Message"))
-        .andReturn(propertyCommitMessage2);
-
     Property propertyFormatChangeUrl = createMock(Property.class);
     expect(propertyFactory.create("formatChangeUrl", "http://www.example.org/test"))
         .andReturn(propertyFormatChangeUrl);
@@ -306,18 +239,11 @@
     expected.add(propertyId);
     expected.add(propertyNumber);
     expected.add(propertyUrl);
-    expected.add(propertyId2);
-    expected.add(propertyNumber2);
-    expected.add(propertyUrl2);
     expected.add(propertyStatus);
     expected.add(propertyEmail);
     expected.add(propertyName);
     expected.add(propertyUsername);
     expected.add(propertyCommitMessage);
-    expected.add(propertyEmail2);
-    expected.add(propertyName2);
-    expected.add(propertyUsername2);
-    expected.add(propertyCommitMessage2);
     expected.add(propertyFormatChangeUrl);
     assertEquals("Properties do not match", expected, actual);
   }
@@ -351,18 +277,12 @@
     Property propertyNumber = createMock(Property.class);
     expect(propertyFactory.create("patchSetNumber", "42")).andReturn(propertyNumber);
 
-    Property propertyNumber2 = createMock(Property.class);
-    expect(propertyFactory.create("patch-set-number", "42")).andReturn(propertyNumber2);
-
     Property propertyRef = createMock(Property.class);
     expect(propertyFactory.create("ref", "testRef")).andReturn(propertyRef);
 
     Property propertyCreatedOn = createMock(Property.class);
     expect(propertyFactory.create("createdOn", "1234567890")).andReturn(propertyCreatedOn);
 
-    Property propertyCreatedOn2 = createMock(Property.class);
-    expect(propertyFactory.create("created-on", "1234567890")).andReturn(propertyCreatedOn2);
-
     Property propertyParents = createMock(Property.class);
     expect(propertyFactory.create("parents", "[parent1, parent2]")).andReturn(propertyParents);
 
@@ -382,17 +302,6 @@
     expect(propertyFactory.create("uploaderUsername", "testUsername1"))
         .andReturn(propertyUploaderUsername);
 
-    Property propertyUploaderEmail2 = createMock(Property.class);
-    expect(propertyFactory.create("uploader-email", "testEmail1"))
-        .andReturn(propertyUploaderEmail2);
-
-    Property propertyUploaderName2 = createMock(Property.class);
-    expect(propertyFactory.create("uploader-name", "testName1")).andReturn(propertyUploaderName2);
-
-    Property propertyUploaderUsername2 = createMock(Property.class);
-    expect(propertyFactory.create("uploader-username", "testUsername1"))
-        .andReturn(propertyUploaderUsername2);
-
     Property propertyAuthorEmail = createMock(Property.class);
     expect(propertyFactory.create("authorEmail", "testEmail2")).andReturn(propertyAuthorEmail);
 
@@ -403,16 +312,6 @@
     expect(propertyFactory.create("authorUsername", "testUsername2"))
         .andReturn(propertyAuthorUsername);
 
-    Property propertyAuthorEmail2 = createMock(Property.class);
-    expect(propertyFactory.create("author-email", "testEmail2")).andReturn(propertyAuthorEmail2);
-
-    Property propertyAuthorName2 = createMock(Property.class);
-    expect(propertyFactory.create("author-name", "testName2")).andReturn(propertyAuthorName2);
-
-    Property propertyAuthorUsername2 = createMock(Property.class);
-    expect(propertyFactory.create("author-username", "testUsername2"))
-        .andReturn(propertyAuthorUsername2);
-
     replayMocks();
 
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
@@ -422,25 +321,17 @@
     Set<Property> expected = Sets.newHashSet();
     expected.add(propertyRevision);
     expected.add(propertyNumber);
-    expected.add(propertyNumber2);
     expected.add(propertyRef);
     expected.add(propertyCreatedOn);
-    expected.add(propertyCreatedOn2);
     expected.add(propertyParents);
     expected.add(propertyDeletions);
     expected.add(propertyInsertions);
     expected.add(propertyUploaderEmail);
     expected.add(propertyUploaderName);
     expected.add(propertyUploaderUsername);
-    expected.add(propertyUploaderEmail2);
-    expected.add(propertyUploaderName2);
-    expected.add(propertyUploaderUsername2);
     expected.add(propertyAuthorEmail);
     expected.add(propertyAuthorName);
     expected.add(propertyAuthorUsername);
-    expected.add(propertyAuthorEmail2);
-    expected.add(propertyAuthorName2);
-    expected.add(propertyAuthorUsername2);
     assertEquals("Properties do not match", expected, actual);
   }
 
@@ -458,10 +349,6 @@
     expect(propertyFactory.create("revisionOld", "9876543211987654321298765432139876543214"))
         .andReturn(propertyRevisionOld);
 
-    Property propertyRevisionOld2 = createMock(Property.class);
-    expect(propertyFactory.create("revision-old", "9876543211987654321298765432139876543214"))
-        .andReturn(propertyRevisionOld2);
-
     Property propertyRef = createMock(Property.class);
     expect(propertyFactory.create("ref", "testRef")).andReturn(propertyRef);
 
@@ -474,7 +361,6 @@
     Set<Property> expected = Sets.newHashSet();
     expected.add(propertyRevision);
     expected.add(propertyRevisionOld);
-    expected.add(propertyRevisionOld2);
     expected.add(propertyRef);
     assertEquals("Properties do not match", expected, actual);
   }
@@ -487,9 +373,6 @@
     Property propertyApproval = createMock(Property.class);
     expect(propertyFactory.create("approvalTestType", "TestValue")).andReturn(propertyApproval);
 
-    Property propertyApproval2 = createMock(Property.class);
-    expect(propertyFactory.create("approval-TestType", "TestValue")).andReturn(propertyApproval2);
-
     replayMocks();
 
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
@@ -498,7 +381,6 @@
 
     Set<Property> expected = Sets.newHashSet();
     expected.add(propertyApproval);
-    expected.add(propertyApproval2);
     assertEquals("Properties do not match", expected, actual);
   }
 
@@ -510,9 +392,6 @@
     Property propertyApproval = createMock(Property.class);
     expect(propertyFactory.create("approvalTestType", "TestValue")).andReturn(propertyApproval);
 
-    Property propertyApproval2 = createMock(Property.class);
-    expect(propertyFactory.create("approval-Test-Type", "TestValue")).andReturn(propertyApproval2);
-
     replayMocks();
 
     PropertyAttributeExtractor extractor = injector.getInstance(PropertyAttributeExtractor.class);
@@ -521,7 +400,6 @@
 
     Set<Property> expected = Sets.newHashSet();
     expected.add(propertyApproval);
-    expected.add(propertyApproval2);
     assertEquals("Properties do not match", expected, actual);
   }