Examples of refCnt()


Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

    @Test
    public void shouldReleaseBufferWhenDecoded() {
        ByteBuf content = Unpooled.copiedBuffer("value", CharsetUtil.UTF_8);
        StringDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.STRING_COMMON_FLAGS,
            ResponseStatus.SUCCESS);
        assertEquals(0, content.refCnt());
    }

    @Test(expected = TranscodingException.class)
    public void shouldReleaseBufferWhenError() {
        ByteBuf content = Unpooled.copiedBuffer("value", CharsetUtil.UTF_8);
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

        ByteBuf content = Unpooled.copiedBuffer("value", CharsetUtil.UTF_8);
        int wrongFlags = 1234;
        try {
            converter.decode("id", content, 0, 0, wrongFlags, ResponseStatus.SUCCESS);
        } finally {
            assertEquals(0, content.refCnt());
        }
    }
}
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

    @Test
    public void shouldReleaseBufferWhenDecoded() {
        ByteBuf content = Unpooled.copiedBuffer("9223372036854775807", CharsetUtil.UTF_8);
        JsonLongDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.JSON_COMPAT_FLAGS,
            ResponseStatus.SUCCESS);
        assertEquals(0, content.refCnt());
    }

    @Test(expected = TranscodingException.class)
    public void shouldReleaseBufferWhenError() {
        ByteBuf content = Unpooled.copiedBuffer("9223372036854775807", CharsetUtil.UTF_8);
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

        ByteBuf content = Unpooled.copiedBuffer("9223372036854775807", CharsetUtil.UTF_8);
        int wrongFlags = 1234;
        try {
            converter.decode("id", content, 0, 0, wrongFlags, ResponseStatus.SUCCESS);
        } finally {
            assertEquals(0, content.refCnt());
        }
    }
}
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

    @Test
    public void shouldReleaseBufferWhenDecoded() {
        ByteBuf content = Unpooled.copiedBuffer("\"value\"", CharsetUtil.UTF_8);
        JsonStringDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.JSON_COMPAT_FLAGS,
            ResponseStatus.SUCCESS);
        assertEquals(0, content.refCnt());
    }

    @Test(expected = TranscodingException.class)
    public void shouldReleaseBufferWhenError() {
        ByteBuf content = Unpooled.copiedBuffer("\"value\"", CharsetUtil.UTF_8);
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

        ByteBuf content = Unpooled.copiedBuffer("\"value\"", CharsetUtil.UTF_8);
        int wrongFlags = 1234;
        try {
            converter.decode("id", content, 0, 0, wrongFlags, ResponseStatus.SUCCESS);
        } finally {
            assertEquals(0, content.refCnt());
        }
    }
}
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

    @Test
    public void shouldReleaseBufferWhenDecoded() {
        ByteBuf content = Unpooled.copiedBuffer("{}", CharsetUtil.UTF_8);
        JsonDocument decoded = converter.decode("id", content, 0, 0, TranscoderUtils.JSON_COMMON_FLAGS, ResponseStatus.SUCCESS);

        assertEquals(0, content.refCnt());
    }

    @Test(expected = TranscodingException.class)
    public void shouldReleaseBufferWhenError() {
        ByteBuf content = Unpooled.copiedBuffer("{}", CharsetUtil.UTF_8);
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

        int wrongFlags = 1234;
        try {
            converter.decode("id", content, 0, 0, wrongFlags,
                ResponseStatus.SUCCESS);
        } finally {
            assertEquals(0, content.refCnt());
        }
    }

    @Test
    public void shouldNotReleaseBufferWhenBufToJson() throws Exception {
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

    @Test
    public void shouldNotReleaseBufferWhenBufToJson() throws Exception {
        ByteBuf content = ReferenceCountUtil.releaseLater(
            Unpooled.copiedBuffer("{}", CharsetUtil.UTF_8));
        JsonObject decoded = converter.byteBufToJsonObject(content);
        assertEquals(1, content.refCnt());

        content = ReferenceCountUtil.releaseLater(
            Unpooled.copiedBuffer("thisIsNotJson", CharsetUtil.UTF_8));
        try {
            decoded = converter.byteBufToJsonObject(content);
View Full Code Here

Examples of com.couchbase.client.deps.io.netty.buffer.ByteBuf.refCnt()

        } catch (JsonParseException e) {
            //NO-OP, exception expected
        } catch (Exception e) {
            fail(e.toString());
        } finally {
            assertEquals(1, content.refCnt());
        }
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.