mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 12:07:59 +01:00
Drop relational profiles store
This commit is contained in:
committed by
Jon Chambers
parent
6aceb24fd2
commit
afa910bbd7
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2021 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.storage;
|
||||
|
||||
import com.opentable.db.postgres.embedded.LiquibasePreparer;
|
||||
import com.opentable.db.postgres.junit5.EmbeddedPostgresExtension;
|
||||
import com.opentable.db.postgres.junit5.PreparedDbExtension;
|
||||
import org.jdbi.v3.core.Jdbi;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.whispersystems.textsecuregcm.configuration.CircuitBreakerConfiguration;
|
||||
|
||||
public class ProfilesPostgresTest extends ProfilesTest {
|
||||
|
||||
@RegisterExtension
|
||||
static PreparedDbExtension ACCOUNTS_POSTGRES_EXTENSION =
|
||||
EmbeddedPostgresExtension.preparedDatabase(LiquibasePreparer.forClasspathLocation("accountsdb.xml"));
|
||||
|
||||
private Profiles profiles;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
final FaultTolerantDatabase faultTolerantDatabase = new FaultTolerantDatabase("profilesTest",
|
||||
Jdbi.create(ACCOUNTS_POSTGRES_EXTENSION.getTestDatabase()),
|
||||
new CircuitBreakerConfiguration());
|
||||
|
||||
profiles = new Profiles(faultTolerantDatabase);
|
||||
|
||||
faultTolerantDatabase.use(jdbi -> jdbi.useHandle(handle -> handle.createUpdate("DELETE FROM profiles").execute()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProfilesStore getProfilesStore() {
|
||||
return profiles;
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
|
||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicProfileMigrationConfiguration;
|
||||
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster;
|
||||
import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager;
|
||||
import org.whispersystems.textsecuregcm.storage.Profiles;
|
||||
import org.whispersystems.textsecuregcm.storage.ProfilesDynamoDb;
|
||||
import org.whispersystems.textsecuregcm.storage.ProfilesManager;
|
||||
import org.whispersystems.textsecuregcm.storage.VersionedProfile;
|
||||
@@ -36,7 +32,7 @@ import org.whispersystems.textsecuregcm.tests.util.RedisClusterHelper;
|
||||
|
||||
public class ProfilesManagerTest {
|
||||
|
||||
private Profiles profiles;
|
||||
private ProfilesDynamoDb profiles;
|
||||
private RedisAdvancedClusterCommands<String, String> commands;
|
||||
|
||||
private ProfilesManager profilesManager;
|
||||
@@ -47,22 +43,9 @@ public class ProfilesManagerTest {
|
||||
commands = mock(RedisAdvancedClusterCommands.class);
|
||||
final FaultTolerantRedisCluster cacheCluster = RedisClusterHelper.buildMockRedisCluster(commands);
|
||||
|
||||
profiles = mock(Profiles.class);
|
||||
profiles = mock(ProfilesDynamoDb.class);
|
||||
|
||||
@SuppressWarnings("unchecked") final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager =
|
||||
mock(DynamicConfigurationManager.class);
|
||||
|
||||
final DynamicConfiguration dynamicConfiguration = mock(DynamicConfiguration.class);
|
||||
final DynamicProfileMigrationConfiguration profileMigrationConfiguration =
|
||||
mock(DynamicProfileMigrationConfiguration.class);
|
||||
|
||||
when(dynamicConfigurationManager.getConfiguration()).thenReturn(dynamicConfiguration);
|
||||
when(dynamicConfiguration.getProfileMigrationConfiguration()).thenReturn(profileMigrationConfiguration);
|
||||
|
||||
profilesManager = new ProfilesManager(profiles,
|
||||
mock(ProfilesDynamoDb.class),
|
||||
cacheCluster,
|
||||
dynamicConfigurationManager);
|
||||
profilesManager = new ProfilesManager(profiles, cacheCluster);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user