use of com.couchbase.client.core.deps.io.netty.buffer.ByteBuf in project couchbase-jvm-clients by couchbase.
the class CompressionTest method doesNotCompressIfTooShortReplace.
@Test
void doesNotCompressIfTooShortReplace() {
ReplaceRequest request = new ReplaceRequest(key, shortContent, expiry, preserveExpiry, flags, timeout, cas, coreContext, cid, retryStrategy, durability, null);
ByteBuf encoded = request.encode(allocator, 0, ctx(true));
assertEquals(0, datatype(encoded));
assertEquals(Unpooled.wrappedBuffer(shortContent), body(encoded).get());
ReferenceCountUtil.release(encoded);
}
use of com.couchbase.client.core.deps.io.netty.buffer.ByteBuf in project couchbase-jvm-clients by couchbase.
the class CompressionTest method doesCompressLongUpsert.
@Test
void doesCompressLongUpsert() {
UpsertRequest request = new UpsertRequest(key, longContent, expiry, preserveExpiry, flags, timeout, coreContext, cid, retryStrategy, Optional.empty(), null);
ByteBuf encoded = request.encode(allocator, 0, ctx(true));
assertEquals(MemcacheProtocol.Datatype.SNAPPY.datatype(), datatype(encoded));
assertTrue(body(encoded).get().readableBytes() < longContent.length);
ReferenceCountUtil.release(encoded);
}
use of com.couchbase.client.core.deps.io.netty.buffer.ByteBuf in project couchbase-jvm-clients by couchbase.
the class CompressionTest method doesNotCompressIfTooShortPrepend.
@Test
void doesNotCompressIfTooShortPrepend() {
PrependRequest request = new PrependRequest(timeout, coreContext, cid, retryStrategy, key, shortContent, cas, durability, null);
ByteBuf encoded = request.encode(allocator, 0, ctx(true));
assertEquals(0, datatype(encoded));
assertEquals(Unpooled.wrappedBuffer(shortContent), body(encoded).get());
ReferenceCountUtil.release(encoded);
}
use of com.couchbase.client.core.deps.io.netty.buffer.ByteBuf in project couchbase-jvm-clients by couchbase.
the class CompressionTest method doesCompressLongInsert.
@Test
void doesCompressLongInsert() {
InsertRequest request = new InsertRequest(key, longContent, expiry, flags, timeout, coreContext, cid, retryStrategy, durability, null);
ByteBuf encoded = request.encode(allocator, 0, ctx(true));
assertEquals(MemcacheProtocol.Datatype.SNAPPY.datatype(), datatype(encoded));
assertTrue(body(encoded).get().readableBytes() < longContent.length);
ReferenceCountUtil.release(encoded);
}
use of com.couchbase.client.core.deps.io.netty.buffer.ByteBuf in project couchbase-jvm-clients by couchbase.
the class CompressionTest method doesNotCompressIfDisabledInsert.
@Test
void doesNotCompressIfDisabledInsert() {
InsertRequest request = new InsertRequest(key, longContent, expiry, flags, timeout, coreContext, cid, retryStrategy, durability, null);
ByteBuf encoded = request.encode(allocator, 0, ctx(false));
assertEquals(0, datatype(encoded));
assertEquals(Unpooled.wrappedBuffer(longContent), body(encoded).get());
ReferenceCountUtil.release(encoded);
}
Aggregations