Make tests more modular

Change-Id: Iadf27acb4b558e678d0b3598694a5125122f847b
Reviewed-on: http://review.couchbase.org/20548
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
fixup review comments

Change-Id: I36c6db92995f7bed6b773d06f6e559099d504525
Reviewed-on: http://review.couchbase.org/20571
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Allow tests to be run against a real cluster

- WIP notes:
* config-test still needs work (skip it)
* the way the structures and parameters are share is hacky
  otherwise, works normally.

Change-Id: Ie3a13562972e83713297af4b37681349ae73cbee
Reviewed-on: http://review.couchbase.org/20447
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Add HTTP tests

Change-Id: If70e8e56d1f5ff4f5cbe9ed62cb62a7bd2c48a3e
Reviewed-on: http://review.couchbase.org/20551
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Move getopt test to gtest

Change-Id: I7a34ab2906568d6e7951f2024a6b4b83b3b1c485
Reviewed-on: http://review.couchbase.org/20575
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Use LCB instead of LIBCOUCHBASE

Change-Id: Idbecdbf07ea8fbf1505354439edac65ab18d690a
Reviewed-on: http://review.couchbase.org/20578
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Dump the servers in use when using real cluster

Change-Id: I0037ce87d22560f78563c948371bf65fd5ceb06b
Reviewed-on: http://review.couchbase.org/20579
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Don't try to put the current node last in the backup list

This may cause "duplicates" in the list if the REST server
returns another name for the server than you used.

Ex: you specify "localhost" and the REST response contains
127.0.0.1

Change-Id: Ifab5e13909e46738870e0eeaf6f04d1796ee7508
Reviewed-on: http://review.couchbase.org/20581
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Remove keys before testing miss

Change-Id: Ia405bf9d89c7f732ac333af8f7c1b6c9990a818e
Reviewed-on: http://review.couchbase.org/20605
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mordechai Nunberg <mnunberg@haskalah.org>
Tested-by: Mordechai Nunberg <mnunberg@haskalah.org>
Don't use strdup for http path

If users are passing the npath parameter, they obviously expect to be
able to pass a non-NUL delimited string.

Change-Id: I339876d0605108cd66410fede8959bef3deacc7f
Reviewed-on: http://review.couchbase.org/20671
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Divide unit tests into categories and place them in their own files

Change-Id: I951c8c2a67636bf0c1693860a267087856158dcd
Reviewed-on: http://review.couchbase.org/20620
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
add mget hit/miss test

Change-Id: Id7ba2b23b3bcea40dfb4076e375dc18795f6fa4b
Reviewed-on: http://review.couchbase.org/20624
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Initialize counter for arithmetic tests before each test

By doing so we know the initial value instead of
depending on the value from the previous test

Change-Id: I9f30952420c3d5e394468124c3d4fc9c5e4f865a
Reviewed-on: http://review.couchbase.org/20621
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Instantiate the mock only once

Use global environment SetUp/TearDown instead of one for each test class

Change-Id: I3f77c1f39554ea0bee7477a785df44f03f916d04
Reviewed-on: http://review.couchbase.org/20674
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Split up mock-unit-test.h

It shouldn't be a "catch all" headerfile

Change-Id: I0619c681b00a6a189bee6a359f1772e26b36042a
Reviewed-on: http://review.couchbase.org/20685
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Refactor MockEnvironment to singleton

Change-Id: I7958642b28128649921f3864b126fc8f5a1feeca
Reviewed-on: http://review.couchbase.org/20686
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
The mockenv should provide createConnection

Change-Id: If1ba6d098c70ad8a469a7f2dbc706e3bfb024e34
Reviewed-on: http://review.couchbase.org/20687
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
CCBC-98 Differentiate between TMPFAILs

Introduce new client specific error code

Change-Id: I5517d97b8097bfbdf0d89b7889f1c722e88ff973
Reviewed-on: http://review.couchbase.org/20700
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Determine cluster version

Change-Id: Ib357621025f57aab89e66023c2dd82f3b018b416
Reviewed-on: http://review.couchbase.org/20677
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Test lock and unlock commands

Change-Id: I075db344d0bc903b8405e6b5800de67e03e1b5d2
Reviewed-on: http://review.couchbase.org/20678
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>