DESCRIPTION

JVMCBC-148: Fix KV response code type

Motivation
----------
In memcached protocol, response codes are defined on 2 bytes. In the
KeyValueHandler, response codes have wrongly been defined as bytes
instead of shorts, leading to bad mapping of codes into ResponseStatus
(FAILURE instead of a more precise type).

Also the fact that OPCODES are defined as byte then some received an
oversized value, casted and overflown to a single byte, is on purpose.
It should be made explicit in a comment.

Modifications
-------------
All response codes in KeyValueHandler have been migrated to shorts,
eliminating the need for casts.

Removed unnecessary casts from int/short to byte in order to make the
places where they are done on purpose stand out (KV OPCODES).

Added a test in KeyValueHandlerTest for conversion of short response
codes to ResponseStatus (conversion method has been made protected final
for that purpose).

Amended the KeyValueMessageTest integration test on getAndLock to check
that two lock attempts in a row return a TEMPORARY_FAILURE on the second
attempt, not just a FAILURE.

Results
-------
Tests allow us to better detect a mismatch in KV error interpretation.
Previously badly mapped error codes are now correctly mapped.

Change-Id: Iedac2d580e114735003fb83496485ceb38ee6be6


COMMENTS

author: Estrella Humphrey
date: 2015-02-10 16:15:17.222000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2015-02-10 16:16:29.779000000

Patch Set 1: Verified+1

-------------------------------------
author: Natasha Sullivan
date: 2015-02-10 16:27:16.585000000

Patch Set 1: Code-Review+2

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