diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java index 429071581..f0ea627ee 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java @@ -691,7 +691,7 @@ public class WhisperServerService extends Application implemen private final ScheduledExecutorService messagesPollExecutor; private final ScheduledExecutorService retryExecutor; private final Clock clock; - private final DynamicConfigurationManager dynamicConfigurationManager; private final Key verificationTokenKey; @@ -221,8 +219,7 @@ public class AccountsManager extends RedisPubSubAdapter implemen final Executor accountLockExecutor, final ScheduledExecutorService messagesPollExecutor, final ScheduledExecutorService retryExecutor, final Clock clock, - final byte[] linkDeviceSecret, - final DynamicConfigurationManager dynamicConfigurationManager) { + final byte[] linkDeviceSecret) { this.accounts = accounts; this.phoneNumberIdentifiers = phoneNumberIdentifiers; this.cacheCluster = cacheCluster; @@ -239,7 +236,6 @@ public class AccountsManager extends RedisPubSubAdapter implemen this.messagesPollExecutor = messagesPollExecutor; this.retryExecutor = retryExecutor; this.clock = requireNonNull(clock); - this.dynamicConfigurationManager = dynamicConfigurationManager; this.verificationTokenKey = new SecretKeySpec(linkDeviceSecret, LINK_DEVICE_VERIFICATION_TOKEN_ALGORITHM); diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java index 735281ae0..25f540d19 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java @@ -282,8 +282,7 @@ public record CommandDependencies( pubsubClient, accountLockManager, keys, messagesManager, profilesManager, secureStorageClient, secureValueRecovery2Client, disconnectionRequestManager, registrationRecoveryPasswordsManager, accountLockExecutor, messagePollExecutor, - retryExecutor, clock, configuration.getLinkDeviceSecretConfiguration().secret().value(), - dynamicConfigurationManager); + retryExecutor, clock, configuration.getLinkDeviceSecretConfiguration().secret().value()); RateLimiters rateLimiters = RateLimiters.create(dynamicConfigurationManager, rateLimitersCluster, retryExecutor); final BackupsDb backupsDb = new BackupsDb(dynamoDbAsyncClient, configuration.getDynamoDbTables().getBackups().getTableName(), clock); diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountCreationDeletionIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountCreationDeletionIntegrationTest.java index e0b3ea1b9..c15ded37a 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountCreationDeletionIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountCreationDeletionIntegrationTest.java @@ -40,7 +40,6 @@ import org.junitpioneer.jupiter.cartesian.CartesianTest; import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.ecc.ECKeyPair; import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.entities.AccountAttributes; import org.whispersystems.textsecuregcm.entities.ApnRegistrationId; import org.whispersystems.textsecuregcm.entities.ECSignedPreKey; @@ -88,12 +87,6 @@ public class AccountCreationDeletionIntegrationTest { @BeforeEach void setUp() { - @SuppressWarnings("unchecked") final DynamicConfigurationManager dynamicConfigurationManager = - mock(DynamicConfigurationManager.class); - - final DynamicConfiguration dynamicConfiguration = mock(DynamicConfiguration.class); - when(dynamicConfigurationManager.getConfiguration()).thenReturn(dynamicConfiguration); - final DynamoDbAsyncClient dynamoDbAsyncClient = DYNAMO_DB_EXTENSION.getDynamoDbAsyncClient(); keysManager = new KeysManager( new SingleUseECPreKeyStore(dynamoDbAsyncClient, DynamoDbExtensionSchema.Tables.EC_KEYS.tableName()), @@ -164,8 +157,7 @@ public class AccountCreationDeletionIntegrationTest { executor, executor, CLOCK, - "link-device-secret".getBytes(StandardCharsets.UTF_8), - dynamicConfigurationManager); + "link-device-secret".getBytes(StandardCharsets.UTF_8)); } @AfterEach diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java index baa932d6f..f1d9037b7 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java @@ -32,7 +32,6 @@ import org.junit.jupiter.api.extension.RegisterExtension; import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.ecc.ECKeyPair; import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.controllers.MismatchedDevicesException; import org.whispersystems.textsecuregcm.entities.AccountAttributes; import org.whispersystems.textsecuregcm.entities.ECSignedPreKey; @@ -79,12 +78,6 @@ class AccountsManagerChangeNumberIntegrationTest { void setup() throws InterruptedException { { - @SuppressWarnings("unchecked") final DynamicConfigurationManager dynamicConfigurationManager = - mock(DynamicConfigurationManager.class); - - DynamicConfiguration dynamicConfiguration = new DynamicConfiguration(); - when(dynamicConfigurationManager.getConfiguration()).thenReturn(dynamicConfiguration); - final DynamoDbAsyncClient dynamoDbAsyncClient = DYNAMO_DB_EXTENSION.getDynamoDbAsyncClient(); keysManager = new KeysManager( new SingleUseECPreKeyStore(dynamoDbAsyncClient, DynamoDbExtensionSchema.Tables.EC_KEYS.tableName()), @@ -153,8 +146,7 @@ class AccountsManagerChangeNumberIntegrationTest { executor, executor, mock(Clock.class), - "link-device-secret".getBytes(StandardCharsets.UTF_8), - dynamicConfigurationManager); + "link-device-secret".getBytes(StandardCharsets.UTF_8)); } } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java index 2fdcb961d..fd6730fe1 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java @@ -48,7 +48,6 @@ import org.signal.libsignal.protocol.ecc.ECKeyPair; import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager; import org.whispersystems.textsecuregcm.auth.SaltedTokenHash; import org.whispersystems.textsecuregcm.auth.UnidentifiedAccessUtil; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.entities.AccountAttributes; import org.whispersystems.textsecuregcm.identity.IdentityType; import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisClient; @@ -86,10 +85,6 @@ class AccountsManagerConcurrentModificationIntegrationTest { @BeforeEach void setup() throws Exception { - @SuppressWarnings("unchecked") final DynamicConfigurationManager dynamicConfigurationManager = - mock(DynamicConfigurationManager.class); - when(dynamicConfigurationManager.getConfiguration()).thenReturn(new DynamicConfiguration()); - accounts = new Accounts( Clock.systemUTC(), DYNAMO_DB_EXTENSION.getDynamoDbClient(), @@ -121,7 +116,7 @@ class AccountsManagerConcurrentModificationIntegrationTest { final PhoneNumberIdentifiers phoneNumberIdentifiers = mock(PhoneNumberIdentifiers.class); when(phoneNumberIdentifiers.getPhoneNumberIdentifier(anyString())) - .thenAnswer((Answer>) invocation -> CompletableFuture.completedFuture(UUID.randomUUID())); + .thenAnswer((Answer>) _ -> CompletableFuture.completedFuture(UUID.randomUUID())); accountsManager = new AccountsManager( accounts, @@ -140,8 +135,7 @@ class AccountsManagerConcurrentModificationIntegrationTest { mock(ScheduledExecutorService.class), mock(ScheduledExecutorService.class), mock(Clock.class), - "link-device-secret".getBytes(StandardCharsets.UTF_8), - dynamicConfigurationManager + "link-device-secret".getBytes(StandardCharsets.UTF_8) ); } } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerDeviceTransferIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerDeviceTransferIntegrationTest.java index 35f0ba02b..8b3a6c4c8 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerDeviceTransferIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerDeviceTransferIntegrationTest.java @@ -55,7 +55,6 @@ public class AccountsManagerDeviceTransferIntegrationTest { connection.sync().configSet("notify-keyspace-events", "K$"); }); - //noinspection unchecked accountsManager = new AccountsManager( mock(Accounts.class), mock(PhoneNumberIdentifiers.class), @@ -73,8 +72,7 @@ public class AccountsManagerDeviceTransferIntegrationTest { mock(ScheduledExecutorService.class), mock(ScheduledExecutorService.class), Clock.systemUTC(), - "link-device-secret".getBytes(StandardCharsets.UTF_8), - mock(DynamicConfigurationManager.class)); + "link-device-secret".getBytes(StandardCharsets.UTF_8)); accountsManager.start(); } diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java index 9702cf778..7b64e8e32 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java @@ -77,7 +77,6 @@ import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.ecc.ECKeyPair; import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager; import org.whispersystems.textsecuregcm.auth.UnidentifiedAccessUtil; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.controllers.MismatchedDevices; import org.whispersystems.textsecuregcm.controllers.MismatchedDevicesException; import org.whispersystems.textsecuregcm.entities.AccountAttributes; @@ -130,7 +129,6 @@ class AccountsManagerTest { private RedisAdvancedClusterAsyncCommands asyncClusterCommands; private AccountsManager accountsManager; private SecureValueRecoveryClient svr2Client; - private DynamicConfiguration dynamicConfiguration; private static final Answer ACCOUNT_UPDATE_ANSWER = (answer) -> { // it is implicit in the update() contract is that a successful call will @@ -156,7 +154,6 @@ class AccountsManagerTest { messagesManager = mock(MessagesManager.class); profilesManager = mock(ProfilesManager.class); disconnectionRequestManager = mock(DisconnectionRequestManager.class); - dynamicConfiguration = mock(DynamicConfiguration.class); //noinspection unchecked asyncCommands = mock(RedisAsyncCommands.class); @@ -200,11 +197,6 @@ class AccountsManagerTest { return CompletableFuture.completedFuture(phoneNumberIdentifiersByE164.computeIfAbsent(number, n -> UUID.randomUUID())); }); - @SuppressWarnings("unchecked") final DynamicConfigurationManager dynamicConfigurationManager = - mock(DynamicConfigurationManager.class); - - when(dynamicConfigurationManager.getConfiguration()).thenReturn(dynamicConfiguration); - final AccountLockManager accountLockManager = mock(AccountLockManager.class); doAnswer(invocation -> { @@ -256,8 +248,7 @@ class AccountsManagerTest { mock(ScheduledExecutorService.class), mock(ScheduledExecutorService.class), CLOCK, - LINK_DEVICE_SECRET, - dynamicConfigurationManager); + LINK_DEVICE_SECRET); } @Test diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerUsernameIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerUsernameIntegrationTest.java index e5f694dba..17beea9d1 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerUsernameIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerUsernameIntegrationTest.java @@ -39,7 +39,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.mockito.Mockito; import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisClient; import org.whispersystems.textsecuregcm.redis.RedisClusterExtension; import org.whispersystems.textsecuregcm.securestorage.SecureStorageClient; @@ -93,11 +92,6 @@ class AccountsManagerUsernameIntegrationTest { private void buildAccountsManager(final int initialWidth, int discriminatorMaxWidth, int attemptsPerWidth) throws Exception { - @SuppressWarnings("unchecked") final DynamicConfigurationManager dynamicConfigurationManager = - mock(DynamicConfigurationManager.class); - - DynamicConfiguration dynamicConfiguration = new DynamicConfiguration(); - when(dynamicConfigurationManager.getConfiguration()).thenReturn(dynamicConfiguration); final DynamoDbAsyncClient dynamoDbAsyncClient = DYNAMO_DB_EXTENSION.getDynamoDbAsyncClient(); final KeysManager keysManager = new KeysManager( @@ -164,8 +158,7 @@ class AccountsManagerUsernameIntegrationTest { Executors.newSingleThreadScheduledExecutor(), Executors.newSingleThreadScheduledExecutor(), mock(Clock.class), - "link-device-secret".getBytes(StandardCharsets.UTF_8), - dynamicConfigurationManager); + "link-device-secret".getBytes(StandardCharsets.UTF_8)); } @Test diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AddRemoveDeviceIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AddRemoveDeviceIntegrationTest.java index a40c4ffa5..8aa9bb787 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AddRemoveDeviceIntegrationTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AddRemoveDeviceIntegrationTest.java @@ -35,7 +35,6 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.signal.libsignal.protocol.ecc.ECKeyPair; import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.entities.DeviceInfo; import org.whispersystems.textsecuregcm.identity.IdentityType; import org.whispersystems.textsecuregcm.redis.RedisClusterExtension; @@ -84,12 +83,6 @@ public class AddRemoveDeviceIntegrationTest { @BeforeEach void setUp() { - @SuppressWarnings("unchecked") final DynamicConfigurationManager dynamicConfigurationManager = - mock(DynamicConfigurationManager.class); - - final DynamicConfiguration dynamicConfiguration = mock(DynamicConfiguration.class); - when(dynamicConfigurationManager.getConfiguration()).thenReturn(dynamicConfiguration); - clock = TestClock.pinned(Instant.now()); final DynamoDbAsyncClient dynamoDbAsyncClient = DYNAMO_DB_EXTENSION.getDynamoDbAsyncClient(); @@ -165,8 +158,7 @@ public class AddRemoveDeviceIntegrationTest { scheduledExecutorService, scheduledExecutorService, clock, - "link-device-secret".getBytes(StandardCharsets.UTF_8), - dynamicConfigurationManager); + "link-device-secret".getBytes(StandardCharsets.UTF_8)); accountsManager.start(); }