Skip to content

Commit

Permalink
JCBC-278: Align default settings in builder.
Browse files Browse the repository at this point in the history
This changeset makes the defaults for the factory the same when
instantiated through the builder as it would have been when
instantiated directly.

Change-Id: Ibb8d20a23d1aab78c130f95cadcb36ee9a784ff2
Reviewed-on: http://review.couchbase.org/25448
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
  • Loading branch information
daschl authored and Michael Nitschinger committed Apr 2, 2013
1 parent 67d9899 commit 8bf710d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Expand Up @@ -76,13 +76,14 @@ public class CouchbaseConnectionFactory extends BinaryConnectionFactory {
/** /**
* Default failure mode. * Default failure mode.
*/ */
public static final FailureMode DEFAULT_FAILURE_MODE = FailureMode.Retry; public static final FailureMode DEFAULT_FAILURE_MODE =
FailureMode.Redistribute;


/** /**
* Default hash algorithm. * Default hash algorithm.
*/ */
public static final HashAlgorithm DEFAULT_HASH = public static final HashAlgorithm DEFAULT_HASH =
DefaultHashAlgorithm.KETAMA_HASH; DefaultHashAlgorithm.NATIVE_HASH;


/** /**
* Maximum length of the operation queue returned by this connection factory. * Maximum length of the operation queue returned by this connection factory.
Expand Down
Expand Up @@ -150,4 +150,23 @@ public void testDefaultValues() throws IOException {
connFact.getHashAlg()); connFact.getHashAlg());
} }


/**
* Make sure that the Builder produces the same default values as would
* a direct Factory init.
*/
@Test
public void testIdenticalConfigs() throws Exception {
CouchbaseConnectionFactoryBuilder instance =
new CouchbaseConnectionFactoryBuilder();

CouchbaseConnectionFactory connFact =
instance.buildCouchbaseConnection(uris, "default", "");

CouchbaseConnectionFactory directFact =
new CouchbaseConnectionFactory(uris, "default", "");

assertEquals(connFact.getFailureMode(), directFact.getFailureMode());
assertEquals(connFact.getHashAlg(), directFact.getHashAlg());
}

} }

0 comments on commit 8bf710d

Please sign in to comment.