Line data Source code
1 : // Copyright (C) 2018 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.acceptance.testsuite.group; 16 : 17 : import com.google.auto.value.AutoValue; 18 : import com.google.common.collect.ImmutableSet; 19 : import com.google.gerrit.entities.Account; 20 : import com.google.gerrit.entities.AccountGroup; 21 : import java.time.Instant; 22 : import java.util.Optional; 23 : 24 : @AutoValue 25 4 : public abstract class TestGroup { 26 : 27 : public abstract AccountGroup.UUID groupUuid(); 28 : 29 : public abstract AccountGroup.Id groupId(); 30 : 31 : public String name() { 32 4 : return nameKey().get(); 33 : } 34 : 35 : public abstract AccountGroup.NameKey nameKey(); 36 : 37 : public abstract Optional<String> description(); 38 : 39 : public abstract AccountGroup.UUID ownerGroupUuid(); 40 : 41 : public abstract boolean visibleToAll(); 42 : 43 : public abstract Instant createdOn(); 44 : 45 : public abstract ImmutableSet<Account.Id> members(); 46 : 47 : public abstract ImmutableSet<AccountGroup.UUID> subgroups(); 48 : 49 : static Builder builder() { 50 4 : return new AutoValue_TestGroup.Builder(); 51 : } 52 : 53 : @AutoValue.Builder 54 4 : abstract static class Builder { 55 : 56 : public abstract Builder groupUuid(AccountGroup.UUID groupUuid); 57 : 58 : public abstract Builder groupId(AccountGroup.Id id); 59 : 60 : public abstract Builder nameKey(AccountGroup.NameKey name); 61 : 62 : public abstract Builder description(String description); 63 : 64 : public abstract Builder description(Optional<String> description); 65 : 66 : public abstract Builder ownerGroupUuid(AccountGroup.UUID ownerGroupUuid); 67 : 68 : public abstract Builder visibleToAll(boolean visibleToAll); 69 : 70 : public abstract Builder createdOn(Instant createdOn); 71 : 72 : public abstract Builder members(ImmutableSet<Account.Id> members); 73 : 74 : public abstract Builder subgroups(ImmutableSet<AccountGroup.UUID> subgroups); 75 : 76 : abstract TestGroup build(); 77 : } 78 : }