Allow to set active flag from new test API for accounts
Change-Id: I0c3d0ed1f3b11bb4e4c7e9cae769ac9147aa5bf8 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -82,6 +82,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
|||||||
String httpPassword = accountCreation.httpPassword().orElse(null);
|
String httpPassword = accountCreation.httpPassword().orElse(null);
|
||||||
accountCreation.username().ifPresent(u -> setUsername(builder, accountId, u, httpPassword));
|
accountCreation.username().ifPresent(u -> setUsername(builder, accountId, u, httpPassword));
|
||||||
accountCreation.status().ifPresent(builder::setStatus);
|
accountCreation.status().ifPresent(builder::setStatus);
|
||||||
|
accountCreation.active().ifPresent(builder::setActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TestAccount toTestAccount(AccountState accountState) {
|
private static TestAccount toTestAccount(AccountState accountState) {
|
||||||
@@ -91,6 +92,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
|||||||
.preferredEmail(Optional.ofNullable(createdAccount.getPreferredEmail()))
|
.preferredEmail(Optional.ofNullable(createdAccount.getPreferredEmail()))
|
||||||
.fullname(Optional.ofNullable(createdAccount.getFullName()))
|
.fullname(Optional.ofNullable(createdAccount.getFullName()))
|
||||||
.username(accountState.getUserName())
|
.username(accountState.getUserName())
|
||||||
|
.active(accountState.getAccount().isActive())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +161,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
|||||||
String httpPassword = accountUpdate.httpPassword().orElse(null);
|
String httpPassword = accountUpdate.httpPassword().orElse(null);
|
||||||
accountUpdate.username().ifPresent(u -> setUsername(builder, accountId, u, httpPassword));
|
accountUpdate.username().ifPresent(u -> setUsername(builder, accountId, u, httpPassword));
|
||||||
accountUpdate.status().ifPresent(builder::setStatus);
|
accountUpdate.status().ifPresent(builder::setStatus);
|
||||||
|
accountUpdate.active().ifPresent(builder::setActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public abstract class TestAccount {
|
|||||||
|
|
||||||
public abstract Optional<String> username();
|
public abstract Optional<String> username();
|
||||||
|
|
||||||
|
public abstract boolean active();
|
||||||
|
|
||||||
static Builder builder() {
|
static Builder builder() {
|
||||||
return new AutoValue_TestAccount.Builder();
|
return new AutoValue_TestAccount.Builder();
|
||||||
}
|
}
|
||||||
@@ -42,6 +44,8 @@ public abstract class TestAccount {
|
|||||||
|
|
||||||
abstract Builder username(Optional<String> username);
|
abstract Builder username(Optional<String> username);
|
||||||
|
|
||||||
|
abstract Builder active(boolean active);
|
||||||
|
|
||||||
abstract TestAccount build();
|
abstract TestAccount build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public abstract class TestAccountCreation {
|
|||||||
|
|
||||||
public abstract Optional<String> status();
|
public abstract Optional<String> status();
|
||||||
|
|
||||||
|
public abstract Optional<Boolean> active();
|
||||||
|
|
||||||
abstract ThrowingFunction<TestAccountCreation, TestAccount> accountCreator();
|
abstract ThrowingFunction<TestAccountCreation, TestAccount> accountCreator();
|
||||||
|
|
||||||
public static Builder builder(ThrowingFunction<TestAccountCreation, TestAccount> accountCreator) {
|
public static Builder builder(ThrowingFunction<TestAccountCreation, TestAccount> accountCreator) {
|
||||||
@@ -70,6 +72,16 @@ public abstract class TestAccountCreation {
|
|||||||
return status("");
|
return status("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract Builder active(boolean active);
|
||||||
|
|
||||||
|
public Builder active() {
|
||||||
|
return active(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder inactive() {
|
||||||
|
return active(false);
|
||||||
|
}
|
||||||
|
|
||||||
abstract Builder accountCreator(
|
abstract Builder accountCreator(
|
||||||
ThrowingFunction<TestAccountCreation, TestAccount> accountCreator);
|
ThrowingFunction<TestAccountCreation, TestAccount> accountCreator);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public abstract class TestAccountUpdate {
|
|||||||
|
|
||||||
public abstract Optional<String> status();
|
public abstract Optional<String> status();
|
||||||
|
|
||||||
|
public abstract Optional<Boolean> active();
|
||||||
|
|
||||||
abstract ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater();
|
abstract ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater();
|
||||||
|
|
||||||
public static Builder builder(ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater) {
|
public static Builder builder(ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater) {
|
||||||
@@ -70,6 +72,16 @@ public abstract class TestAccountUpdate {
|
|||||||
return status("");
|
return status("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract Builder active(boolean active);
|
||||||
|
|
||||||
|
public Builder active() {
|
||||||
|
return active(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder inactive() {
|
||||||
|
return active(false);
|
||||||
|
}
|
||||||
|
|
||||||
abstract Builder accountUpdater(
|
abstract Builder accountUpdater(
|
||||||
ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater);
|
ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user