Permalink
Browse files

JCBC-278: Align default settings in builder.

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...
1 parent 67d9899 commit 8bf710d0f1560c982e545458e83c7a6f27921d89 @daschl daschl committed with daschl Apr 2, 2013
@@ -76,13 +76,14 @@
/**
* Default failure mode.
*/
- public static final FailureMode DEFAULT_FAILURE_MODE = FailureMode.Retry;
+ public static final FailureMode DEFAULT_FAILURE_MODE =
+ FailureMode.Redistribute;
/**
* Default hash algorithm.
*/
public static final HashAlgorithm DEFAULT_HASH =
- DefaultHashAlgorithm.KETAMA_HASH;
+ DefaultHashAlgorithm.NATIVE_HASH;
/**
* Maximum length of the operation queue returned by this connection factory.
@@ -150,4 +150,23 @@ public void testDefaultValues() throws IOException {
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.