Adapting testStatsKey Testcase to account changes in 2.1.0.

This changeset makes sure that the test case passes for both
post 2.1.0 and pre 2.1.0, because the exposed key stats
have changed between versions.

Change-Id: Ia32dd34c5cb5b504471f4660f152e7f4799b8f66
Reviewed-on: http://review.couchbase.org/27215
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-76: Replica Read Command

This changeset implements the replica read command
on both the application level facing CouchbaseClient
and also implements the backend changes neeeded.

It depends on the corresponding changes on the SPY
project (see SPY-113).

Change-Id: Idfd0836adfd5212152f369e8e624d45c4c9ca2b4
Reviewed-on: http://review.couchbase.org/24750
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-323: Make flush() shutdown-aware.

This changeset makes sure that when flush() is called, it properly
checks that we are up and running and not shutDown.

It also exposes the shutDown variable to all other package-private
members.

Change-Id: Id8fcd379c260ef6586d4a73b97dbf540b33a1372
Reviewed-on: http://review.couchbase.org/27216
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-318: Making sure reconnect logic is not called in parallel.

This also prevents the underlying logic to be executed more often
than needed and therefore mitigating race conditions and overloaded
IO.

Change-Id: I6c18feadf55c56bb5bc0ba5c8e6920337e452f21
Reviewed-on: http://review.couchbase.org/26860
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-319: check config for memcache buckets.

This changeset makes sure that when using ketama with
memcache buckets, failing operations also trigger
reconfiguration eventually. Note that this algorithm is
different than for the CouchbaseConnection, because ketama will
always find a next node. Therefore, we trigger reconfigure but let
the doc pass through to a separate node.

Change-Id: I83ce342b76358a374469ca27e3807d8c3d8381af
Reviewed-on: http://review.couchbase.org/27065
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-322 : Extended test coverage for the store, retrieve operations

This changeset adds more test coverage for the add, replace
and set operations which are currently not covered by the
underlying SPY tests.

Change-Id: Ie2ad5bd48dbea7ab09a76e3d4010355af5398231
Reviewed-on: http://review.couchbase.org/27167
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-266: Harden HTTP Provider on empty pool buckets.

This changeset makes sure a proper exception is thrown when
no valid bucket configuration could be found. The resubscriber
picks it up and retries again.

Change-Id: I254c5498a149fc2bab2f5459b10c0654354d23fe
Reviewed-on: http://review.couchbase.org/26862
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Fix MemcachedMock to align with latest SPY changes.

Change-Id: I113802e89d1f74f93859e7298f06a693ea402d6b
Reviewed-on: http://review.couchbase.org/27261
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
Upgrade to SPY 2.9.1

Change-Id: I615ec7a305c2177810e4307f41cd21a68d083a9a
Reviewed-on: http://review.couchbase.org/27214
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Fix BucketMonitorTest and harden request code to avoid HTTP 401.

This changeset fixes the test cases to correctly pass in the
username. The server code has changed with 2.1 so that an
authorized header with empty user/password on the default
bucket are no longer ignored, therefore leading to
unauthorized responses in tests.

This does not affect production, because the code normally
passes in the bucket name as the user, which gets recognized
properly. A small change also now exposes this unlikely
situation with an exception, so that it just "doesnt stop"
silently in this case.

Change-Id: I46793cdc42e4851d72a81338e5ee5c47b3f86608
Reviewed-on: http://review.couchbase.org/27283
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
JCBC-327: Adding missing CouchbaseClientIF Signatures.

Change-Id: I505b95d1dbc76a365572ded83c85c5e6581ffe3e
Reviewed-on: http://review.couchbase.org/27307
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Checkstyle fixes before 1.1.8 release round.

Change-Id: I675fda5d0d0de3155d1ddddc68e204b81f468142
Reviewed-on: http://review.couchbase.org/27309
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
JCBC-325: Adapt Testcase to work with only one server.

The % 2 assertion on available servers is not needed (anymore)
and can lead to false negatives on unit test runs with only
one target server in the cluster.

Change-Id: I92f9edb8f5f9f9b7b4f3297a0f7576543840a9f5
Reviewed-on: http://review.couchbase.org/27608
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
JCBC-332 : Tests added for observe and arithmetic operations

Change-Id: Ie6bfac06cf168fddbbd7808a2579ece1e080c700
Reviewed-on: http://review.couchbase.org/27610
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Deepti Dawar <deepti.dawar@globallogic.com>
JCBC-336: Refresh config while polling.

This changeset makes sure the actual config is always used while
polling in the loop. This makes sure a potentially stale config
is reloaded before getting used.

Change-Id: I5e636672b2cc910a3b3d2272672939ca7edbd4b3
Reviewed-on: http://review.couchbase.org/27761
Tested-by: Deepti Dawar <deepti.dawar@globallogic.com>
Reviewed-by: Deepti Dawar <deepti.dawar@globallogic.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-338: Don't allow null for bucket and password.

This changeset makes sure that the code "fails fast" and throws
a semantically correct exception in case null (or an empty bucket
name) is passed in. Otherwise, the data goes through and throws a
NPE exception down the stack.

Change-Id: I6d73f5dd551d1d9921a25cae8c58783e5f63afed
Reviewed-on: http://review.couchbase.org/27790
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
CouchbaseProperties should use the SPY LoggerFactory.

Before this change, these log messages were not properly
logged with respect to the configured logging endpoint.

Also, the informative log message has been degraded to
DEBUG, because it is not used that often and it generates
confusion.

Change-Id: Ibac70bf012be80439d4d2a4f894230d0fabadca2
Reviewed-on: http://review.couchbase.org/27597
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Fixed Assertion failures from isDone() method call on future

Change-Id: I39693e789222f39a263d365546fda169e1182645
Reviewed-on: http://review.couchbase.org/27885
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Deepti Dawar <deepti.dawar@globallogic.com>
JCBC-340: TAP backfill ignores replicas.

This changeset makes sure that only keys from the active
node get propagated to the TapStream. This helps, but is
not a full fix of the issue. See the corresponding linked
issues from JCBC-340 for the ongoing other fixes.

Change-Id: I4a7acaaa3066180be0e0949023c295aef2eb7685
Reviewed-on: http://review.couchbase.org/27916
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
JCBC-280 - Support for edit bucket functionality through cbc.

Change-Id: Ia96f7653630a16e9c922a00882ff7fc1c1c195e8
Reviewed-on: http://review.couchbase.org/26557
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Deepti Dawar <deepti.dawar@globallogic.com>