AccountApi: Add methods to get emails and delete email

Also add a test for email deletion and add asserts for the addEmail()
test.

Bug: Issue 5385
Change-Id: I3e192638fdaac58d0cdaa535430bb968d7d32abb
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-02-08 13:38:15 +01:00
parent bf94427742
commit e1f9dd1120
8 changed files with 114 additions and 24 deletions

View File

@@ -23,6 +23,7 @@ import com.google.gerrit.extensions.common.AccountExternalIdInfo;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.AgreementInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.EmailInfo;
import com.google.gerrit.extensions.common.GpgKeyInfo;
import com.google.gerrit.extensions.common.SshKeyInfo;
import com.google.gerrit.extensions.restapi.NotImplementedException;
@@ -68,8 +69,12 @@ public interface AccountApi {
List<ChangeInfo> getStarredChanges() throws RestApiException;
List<EmailInfo> getEmails() throws RestApiException;
void addEmail(EmailInput input) throws RestApiException;
void deleteEmail(String email) throws RestApiException;
void setStatus(String status) throws RestApiException;
List<SshKeyInfo> listSshKeys() throws RestApiException;
@@ -189,11 +194,21 @@ public interface AccountApi {
throw new NotImplementedException();
}
@Override
public List<EmailInfo> getEmails() {
throw new NotImplementedException();
}
@Override
public void addEmail(EmailInput input) {
throw new NotImplementedException();
}
@Override
public void deleteEmail(String email) {
throw new NotImplementedException();
}
@Override
public void setStatus(String status) {
throw new NotImplementedException();

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.extensions.common;
public class EmailInfo {
public String email;
public Boolean preferred;
public Boolean pendingConfirmation;
public void preferred(String e) {
this.preferred = e != null && e.equals(email) ? true : null;
}
}