DESCRIPTION

JCBC-662: Detect server feature availability

Motivation
----------
More and more features are only available on newer versions of server,
and the SDK has to maintain a clear picture of the compatibility matrix
which is getting harder to do explicitely via environment variables.

We need a way of easily and programatically detect if a feature is
available on a specific instance of a Cluster (eg Spatial View are only
found on cbserver >= 3.0.2).

Modifications
-------------
Added Version to represent a version number (major.minor.patch).
Added CouchbaseFeature, an enum of all testable features known to the
current version of the SDK with the server version from which each was
available.

Added helper class FeaturesHelper with a method to check for a feature
on a given Cluster (or rather the ClusterManager's ClusterInfo).
It will parse the info, find out the tiniest server version and check
that version vs the feature's minimum required version.

Added utility method 'ignoreIfMissing' on ClusterDependentTest to allow
integration tests to easily skip tests if the required feature is not
available.

Result
------
Anyone is now easily able to check if the connected cluster can provide
a given feature. Internally, integration tests can be skipped if that's
not the case.

All new tests pass.

Change-Id: Ia93cc63c8f383fc141896a5ff30a66c76d8b2445


COMMENTS

author: Estrella Humphrey
date: 2014-12-19 16:36:02.488000000

Uploaded patch set 3.

-------------------------------------
author: Estrella Humphrey
date: 2014-12-19 16:37:12.124000000

Patch Set 3: Verified+1

added usage in the SpatialViewTest integration test, preventing it to execute < 3.0.2 (custom version and not the official feature version)

-------------------------------------
author: Natasha Sullivan
date: 2014-12-23 12:35:23.343000000

Patch Set 3:

(4 comments)

cool stuff, what do you think about my comments on getting it into ClusterInfo directly?

Line:36, src/main/java/com/couchbase/client/java/util/features/CouchbaseFeature.java -> maybe also add DCP(3, 0, 0) and sort the whole thing by version?

Line:52, src/main/java/com/couchbase/client/java/util/features/CouchbaseFeature.java -> I wonder since we implement Comparable, could we do

serverVersion >= availableFrom ?

Line:46, src/main/java/com/couchbase/client/java/util/features/FeaturesHelper.java -> See below..and also thinking about it further, can't we even have the "hasFeature" method on the clusterInfo?

Line:57, src/main/java/com/couchbase/client/java/util/features/FeaturesHelper.java -> Do you think we can put this in the ClusterInfo directly? Then it's just there and available when you use it from the cluster manager. and since it's only working on the info anyways, it even fits into the object.

Also, what about having there minVersion AND versions which gives you a List of all versions in the cluster?

-------------------------------------
