Skip to content

Commit

Permalink
JAMES-2090 Rename CassandraUtilsDefaultValue
Browse files Browse the repository at this point in the history
  • Loading branch information
chibenwa committed Jul 6, 2017
1 parent 366023f commit c8286d9
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 20 deletions.
Expand Up @@ -31,7 +31,7 @@


public class CassandraUtils { public class CassandraUtils {


public static final CassandraUtils DEFAULT_CASSANDRA_UTILS = new CassandraUtils(CassandraConfiguration.DEFAULT_CONFIGURATION); public static final CassandraUtils WITH_DEFAULT_CONFIGURATION = new CassandraUtils(CassandraConfiguration.DEFAULT_CONFIGURATION);


private final CassandraConfiguration cassandraConfiguration; private final CassandraConfiguration cassandraConfiguration;


Expand Down
Expand Up @@ -123,7 +123,7 @@ public CassandraMailboxSessionMapperFactory(


this(uidProvider, modSeqProvider, session, messageDAO, messageIdDAO, imapUidDAO, mailboxCounterDAO, this(uidProvider, modSeqProvider, session, messageDAO, messageIdDAO, imapUidDAO, mailboxCounterDAO,
mailboxRecentsDAO, mailboxDAO, mailboxPathDAO, firstUnseenDAO, applicableFlagDAO, deletedMesageDAO, mailboxRecentsDAO, mailboxDAO, mailboxPathDAO, firstUnseenDAO, applicableFlagDAO, deletedMesageDAO,
CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraConfiguration.DEFAULT_CONFIGURATION); CassandraUtils.WITH_DEFAULT_CONFIGURATION, CassandraConfiguration.DEFAULT_CONFIGURATION);
} }


@Override @Override
Expand Down
Expand Up @@ -75,7 +75,7 @@ public CassandraDeletedMessageDAO(Session session, CassandraUtils cassandraUtils


@VisibleForTesting @VisibleForTesting
public CassandraDeletedMessageDAO(Session session) { public CassandraDeletedMessageDAO(Session session) {
this(session, CassandraUtils.DEFAULT_CASSANDRA_UTILS); this(session, CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


private PreparedStatement prepareAllUidStatement(Session session) { private PreparedStatement prepareAllUidStatement(Session session) {
Expand Down
Expand Up @@ -37,7 +37,6 @@
import java.util.stream.Stream; import java.util.stream.Stream;


import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named;


import org.apache.james.backends.cassandra.CassandraConfiguration; import org.apache.james.backends.cassandra.CassandraConfiguration;
import org.apache.james.backends.cassandra.init.CassandraTypesProvider; import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
Expand Down Expand Up @@ -87,7 +86,7 @@ public CassandraMailboxDAO(Session session, CassandraTypesProvider typesProvider


@VisibleForTesting @VisibleForTesting
public CassandraMailboxDAO(Session session, CassandraTypesProvider typesProvider) { public CassandraMailboxDAO(Session session, CassandraTypesProvider typesProvider) {
this(session, typesProvider, CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraConfiguration.DEFAULT_CONFIGURATION); this(session, typesProvider, CassandraUtils.WITH_DEFAULT_CONFIGURATION, CassandraConfiguration.DEFAULT_CONFIGURATION);
} }


private PreparedStatement prepareInsert(Session session) { private PreparedStatement prepareInsert(Session session) {
Expand Down
Expand Up @@ -107,7 +107,7 @@ public CassandraMailboxPathDAO(Session session, CassandraTypesProvider typesProv


@VisibleForTesting @VisibleForTesting
public CassandraMailboxPathDAO(Session session, CassandraTypesProvider typesProvider) { public CassandraMailboxPathDAO(Session session, CassandraTypesProvider typesProvider) {
this(session, typesProvider, CassandraUtils.DEFAULT_CASSANDRA_UTILS); this(session, typesProvider, CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


private PreparedStatement prepareDelete(Session session) { private PreparedStatement prepareDelete(Session session) {
Expand Down
Expand Up @@ -60,7 +60,7 @@ public CassandraMailboxRecentsDAO(Session session, CassandraUtils cassandraUtils


@VisibleForTesting @VisibleForTesting
public CassandraMailboxRecentsDAO(Session session) { public CassandraMailboxRecentsDAO(Session session) {
this(session, CassandraUtils.DEFAULT_CASSANDRA_UTILS); this(session, CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


private PreparedStatement createReadStatement(Session session) { private PreparedStatement createReadStatement(Session session) {
Expand Down
Expand Up @@ -100,7 +100,7 @@ public CassandraMessageIdDAO(Session session, CassandraMessageId.Factory message


@VisibleForTesting @VisibleForTesting
public CassandraMessageIdDAO(Session session, CassandraMessageId.Factory messageIdFactory) { public CassandraMessageIdDAO(Session session, CassandraMessageId.Factory messageIdFactory) {
this(session, messageIdFactory, CassandraUtils.DEFAULT_CASSANDRA_UTILS); this(session, messageIdFactory, CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


private PreparedStatement prepareDelete(Session session) { private PreparedStatement prepareDelete(Session session) {
Expand Down
Expand Up @@ -92,7 +92,7 @@ public CassandraMessageIdToImapUidDAO(Session session, CassandraMessageId.Factor


@VisibleForTesting @VisibleForTesting
public CassandraMessageIdToImapUidDAO(Session session, CassandraMessageId.Factory messageIdFactory) { public CassandraMessageIdToImapUidDAO(Session session, CassandraMessageId.Factory messageIdFactory) {
this(session, messageIdFactory, CassandraUtils.DEFAULT_CASSANDRA_UTILS); this(session, messageIdFactory, CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


private PreparedStatement prepareDelete(Session session) { private PreparedStatement prepareDelete(Session session) {
Expand Down
Expand Up @@ -77,7 +77,7 @@ public void setUp() throws Exception {
new CassandraMailboxPathRegisterMapper( new CassandraMailboxPathRegisterMapper(
cassandra.getConf(), cassandra.getConf(),
cassandra.getTypesProvider(), cassandra.getTypesProvider(),
CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraUtils.WITH_DEFAULT_CONFIGURATION,
CASSANDRA_TIME_OUT_IN_S), CASSANDRA_TIME_OUT_IN_S),
SCHEDULER_PERIOD_IN_S); SCHEDULER_PERIOD_IN_S);
registeredDelegatingMailboxListener1 = new RegisteredDelegatingMailboxListener( registeredDelegatingMailboxListener1 = new RegisteredDelegatingMailboxListener(
Expand All @@ -92,7 +92,7 @@ public void setUp() throws Exception {
new CassandraMailboxPathRegisterMapper( new CassandraMailboxPathRegisterMapper(
cassandra.getConf(), cassandra.getConf(),
cassandra.getTypesProvider(), cassandra.getTypesProvider(),
CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraUtils.WITH_DEFAULT_CONFIGURATION,
CASSANDRA_TIME_OUT_IN_S), CASSANDRA_TIME_OUT_IN_S),
SCHEDULER_PERIOD_IN_S); SCHEDULER_PERIOD_IN_S);
registeredDelegatingMailboxListener2 = new RegisteredDelegatingMailboxListener( registeredDelegatingMailboxListener2 = new RegisteredDelegatingMailboxListener(
Expand All @@ -107,7 +107,7 @@ public void setUp() throws Exception {
new CassandraMailboxPathRegisterMapper( new CassandraMailboxPathRegisterMapper(
cassandra.getConf(), cassandra.getConf(),
cassandra.getTypesProvider(), cassandra.getTypesProvider(),
CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraUtils.WITH_DEFAULT_CONFIGURATION,
CASSANDRA_TIME_OUT_IN_S), CASSANDRA_TIME_OUT_IN_S),
SCHEDULER_PERIOD_IN_S); SCHEDULER_PERIOD_IN_S);
registeredDelegatingMailboxListener3 = new RegisteredDelegatingMailboxListener( registeredDelegatingMailboxListener3 = new RegisteredDelegatingMailboxListener(
Expand Down
Expand Up @@ -48,7 +48,7 @@ public class CassandraMailboxPathRegistrerMapperTest {
public void setUp() { public void setUp() {
mapper = new CassandraMailboxPathRegisterMapper(cassandra.getConf(), mapper = new CassandraMailboxPathRegisterMapper(cassandra.getConf(),
cassandra.getTypesProvider(), cassandra.getTypesProvider(),
CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraUtils.WITH_DEFAULT_CONFIGURATION,
CASSANDRA_TIME_OUT_IN_S); CASSANDRA_TIME_OUT_IN_S);
} }


Expand Down Expand Up @@ -112,7 +112,7 @@ public void entriesShouldExpire() throws Exception {
int verySmallTimeoutInSecond = 1; int verySmallTimeoutInSecond = 1;
mapper = new CassandraMailboxPathRegisterMapper(cassandra.getConf(), mapper = new CassandraMailboxPathRegisterMapper(cassandra.getConf(),
cassandra.getTypesProvider(), cassandra.getTypesProvider(),
CassandraUtils.DEFAULT_CASSANDRA_UTILS, CassandraUtils.WITH_DEFAULT_CONFIGURATION,
verySmallTimeoutInSecond); verySmallTimeoutInSecond);
mapper.doRegister(MAILBOX_PATH, TOPIC); mapper.doRegister(MAILBOX_PATH, TOPIC);
Thread.sleep(2 * TimeUnit.SECONDS.toMillis(verySmallTimeoutInSecond)); Thread.sleep(2 * TimeUnit.SECONDS.toMillis(verySmallTimeoutInSecond));
Expand Down
Expand Up @@ -33,7 +33,7 @@ public class CassandraSubscriptionMapperTest extends SubscriptionMapperTest {
@Override @Override
protected SubscriptionMapper createSubscriptionMapper() { protected SubscriptionMapper createSubscriptionMapper() {
cassandra.ensureAllTables(); cassandra.ensureAllTables();
return new CassandraSubscriptionMapper(cassandra.getConf(), CassandraUtils.DEFAULT_CASSANDRA_UTILS); return new CassandraSubscriptionMapper(cassandra.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


@After @After
Expand Down
Expand Up @@ -50,7 +50,7 @@ protected static SieveRepository createSieveRepository() throws Exception {
} }


protected static UsersRepository createUsersRepository() { protected static UsersRepository createUsersRepository() {
CassandraUsersRepository cassandraUsersRepository = new CassandraUsersRepository(CASSANDRA_CLUSTER.getConf(), CassandraUtils.DEFAULT_CASSANDRA_UTILS); CassandraUsersRepository cassandraUsersRepository = new CassandraUsersRepository(CASSANDRA_CLUSTER.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
cassandraUsersRepository.setEnableVirtualHosting(false); cassandraUsersRepository.setEnableVirtualHosting(false);
return cassandraUsersRepository; return cassandraUsersRepository;
} }
Expand Down
Expand Up @@ -87,7 +87,7 @@ private PreparedStatement prepareReadAllStatement(Session session) {


@VisibleForTesting @VisibleForTesting
CassandraDomainList(Session session) { CassandraDomainList(Session session) {
this(session, CassandraUtils.DEFAULT_CASSANDRA_UTILS); this(session, CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }


@Override @Override
Expand Down
Expand Up @@ -51,7 +51,7 @@ public void tearDown() throws Exception {


@Override @Override
protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception { protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
CassandraRecipientRewriteTable rrt = new CassandraRecipientRewriteTable(cassandra.getConf(), CassandraUtils.DEFAULT_CASSANDRA_UTILS); CassandraRecipientRewriteTable rrt = new CassandraRecipientRewriteTable(cassandra.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
rrt.setLog(LoggerFactory.getLogger("MockLog")); rrt.setLog(LoggerFactory.getLogger("MockLog"));
rrt.configure(new DefaultConfigurationBuilder()); rrt.configure(new DefaultConfigurationBuilder());
return rrt; return rrt;
Expand Down
Expand Up @@ -52,7 +52,7 @@ public void tearDown() {
} }


private AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception { private AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
CassandraRecipientRewriteTable rrt = new CassandraRecipientRewriteTable(cassandra.getConf(), CassandraUtils.DEFAULT_CASSANDRA_UTILS); CassandraRecipientRewriteTable rrt = new CassandraRecipientRewriteTable(cassandra.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
rrt.setLog(LoggerFactory.getLogger("MockLog")); rrt.setLog(LoggerFactory.getLogger("MockLog"));
rrt.configure(new DefaultConfigurationBuilder()); rrt.configure(new DefaultConfigurationBuilder());
return rrt; return rrt;
Expand Down
Expand Up @@ -37,6 +37,6 @@ public void tearDown() {
@Override @Override
protected AbstractUsersRepository getUsersRepository() throws Exception { protected AbstractUsersRepository getUsersRepository() throws Exception {
cassandra = CassandraCluster.create(new CassandraUsersRepositoryModule()); cassandra = CassandraCluster.create(new CassandraUsersRepositoryModule());
return new CassandraUsersRepository(cassandra.getConf(), CassandraUtils.DEFAULT_CASSANDRA_UTILS); return new CassandraUsersRepository(cassandra.getConf(), CassandraUtils.WITH_DEFAULT_CONFIGURATION);
} }
} }

0 comments on commit c8286d9

Please sign in to comment.