mirror of https://github.com/tikv/client-java.git
parent
0f4563a0d2
commit
9406c9bb36
|
|
@ -181,27 +181,24 @@ public class RequestKeyCodecTest {
|
||||||
{
|
{
|
||||||
ByteString m_123 = CodecUtils.encode(ByteString.copyFromUtf8("m_123"));
|
ByteString m_123 = CodecUtils.encode(ByteString.copyFromUtf8("m_123"));
|
||||||
ByteString m_124 = CodecUtils.encode(ByteString.copyFromUtf8("m_124"));
|
ByteString m_124 = CodecUtils.encode(ByteString.copyFromUtf8("m_124"));
|
||||||
ByteString infiniteEndKey_0 = CodecUtils.encode(v2.infiniteEndKey.concat(ByteString.copyFrom(new byte[] {0})));
|
ByteString infiniteEndKey_0 =
|
||||||
|
CodecUtils.encode(v2.infiniteEndKey.concat(ByteString.copyFrom(new byte[] {0})));
|
||||||
ByteString t_123 = CodecUtils.encode(ByteString.copyFromUtf8("t_123"));
|
ByteString t_123 = CodecUtils.encode(ByteString.copyFromUtf8("t_123"));
|
||||||
ByteString y_123 = CodecUtils.encode(ByteString.copyFromUtf8("y_123"));
|
ByteString y_123 = CodecUtils.encode(ByteString.copyFromUtf8("y_123"));
|
||||||
|
|
||||||
ByteString[][] outOfKeyspaceCases = {
|
ByteString[][] outOfKeyspaceCases = {
|
||||||
{ByteString.EMPTY, CodecUtils.encode(v2.keyPrefix)}, // ["", "r000"/"x000")
|
{ByteString.EMPTY, CodecUtils.encode(v2.keyPrefix)}, // ["", "r000"/"x000")
|
||||||
{ByteString.EMPTY, m_123},
|
{ByteString.EMPTY, m_123},
|
||||||
{m_123, m_124},
|
{m_123, m_124},
|
||||||
{m_124, CodecUtils.encode(v2.keyPrefix)},
|
{m_124, CodecUtils.encode(v2.keyPrefix)},
|
||||||
{CodecUtils.encode(v2.infiniteEndKey), ByteString.EMPTY}, // ["r001"/"x001", "")
|
{CodecUtils.encode(v2.infiniteEndKey), ByteString.EMPTY}, // ["r001"/"x001", "")
|
||||||
{CodecUtils.encode(v2.infiniteEndKey), infiniteEndKey_0},
|
{CodecUtils.encode(v2.infiniteEndKey), infiniteEndKey_0},
|
||||||
{infiniteEndKey_0, t_123},
|
{infiniteEndKey_0, t_123},
|
||||||
{y_123, ByteString.EMPTY}, // "y_123" is bigger than "infiniteEndKey" for both raw & txn.
|
{y_123, ByteString.EMPTY}, // "y_123" is bigger than "infiniteEndKey" for both raw & txn.
|
||||||
};
|
};
|
||||||
|
|
||||||
for (ByteString[] testCase : outOfKeyspaceCases) {
|
for (ByteString[] testCase : outOfKeyspaceCases) {
|
||||||
region =
|
region = Region.newBuilder().setStartKey(testCase[0]).setEndKey(testCase[1]).build();
|
||||||
Region.newBuilder()
|
|
||||||
.setStartKey(testCase[0])
|
|
||||||
.setEndKey(testCase[1])
|
|
||||||
.build();
|
|
||||||
try {
|
try {
|
||||||
decoded = v2.decodeRegion(region);
|
decoded = v2.decodeRegion(region);
|
||||||
fail(String.format("[%s,%s): %s", testCase[0], testCase[1], decoded.toString()));
|
fail(String.format("[%s,%s): %s", testCase[0], testCase[1], decoded.toString()));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue