Add parallel pathways for getting accounts asyncronously to Accounts

This commit is contained in:
Jon Chambers
2023-07-11 15:58:21 -04:00
committed by Jon Chambers
parent 1605676509
commit 7d19e58953
2 changed files with 97 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.RandomUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@@ -73,6 +74,7 @@ import software.amazon.awssdk.services.dynamodb.model.TransactionCanceledExcepti
import software.amazon.awssdk.services.dynamodb.model.TransactionConflictException;
import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest;
@Timeout(value = 10, threadMode = Timeout.ThreadMode.SEPARATE_THREAD)
class AccountsTest {
private static final String BASE_64_URL_USERNAME_HASH_1 = "9p6Tip7BFefFOJzv4kv4GyXEYsBVfk_WbjNejdlOvQE";
@@ -573,6 +575,44 @@ class AccountsTest {
assertThat(retrieved.isPresent()).isFalse();
}
@Test
void getByAccountIdentifierAsync() {
assertThat(accounts.getByAccountIdentifierAsync(UUID.randomUUID()).join()).isEmpty();
final Account account =
generateAccount("+14151112222", UUID.randomUUID(), UUID.randomUUID(), List.of(generateDevice(1)));
accounts.create(account);
assertThat(accounts.getByAccountIdentifierAsync(account.getUuid()).join()).isPresent();
}
@Test
void getByPhoneNumberIdentifierAsync() {
assertThat(accounts.getByPhoneNumberIdentifierAsync(UUID.randomUUID()).join()).isEmpty();
final Account account =
generateAccount("+14151112222", UUID.randomUUID(), UUID.randomUUID(), List.of(generateDevice(1)));
accounts.create(account);
assertThat(accounts.getByPhoneNumberIdentifierAsync(account.getPhoneNumberIdentifier()).join()).isPresent();
}
@Test
void getByE164Async() {
final String e164 = "+14151112222";
assertThat(accounts.getByE164Async(e164).join()).isEmpty();
final Account account =
generateAccount(e164, UUID.randomUUID(), UUID.randomUUID(), List.of(generateDevice(1)));
accounts.create(account);
assertThat(accounts.getByE164Async(e164).join()).isPresent();
}
@Test
void testCanonicallyDiscoverableSet() {
Device device = generateDevice(1);