List of usage examples for io.netty.util ReferenceCountUtil releaseLater
@Deprecated public static <T> T releaseLater(T msg)
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldAppendIfArrayInsertIndexIsSize() { SubArrayRequest.ArrayOperation arrayOp = SubArrayRequest.ArrayOperation.INSERT; String path = "sub.array[3]"; ByteBuf fragment = Unpooled.copiedBuffer("99", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubArrayRequest request = new SubArrayRequest(testSubKey, path, arrayOp, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); assertEquals(ResponseStatus.SUCCESS, response.status()); assertMutation(testSubKey, jsonContent.replace("]", ", 99]")); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathNotFoundOnArrayInsertOverSize() { SubArrayRequest.ArrayOperation arrayOp = SubArrayRequest.ArrayOperation.INSERT; String path = "sub.array[5]"; ByteBuf fragment = Unpooled.copiedBuffer("99", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubArrayRequest request = new SubArrayRequest(testSubKey, path, arrayOp, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); assertEquals(ResponseStatus.SUBDOC_PATH_NOT_FOUND, response.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathInvalidOnArrayInsertAtNegativeIndex() { SubArrayRequest.ArrayOperation arrayOp = SubArrayRequest.ArrayOperation.INSERT; String path = "sub.array[-1]"; ByteBuf fragment = Unpooled.copiedBuffer("99", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubArrayRequest request = new SubArrayRequest(testSubKey, path, arrayOp, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); assertEquals(ResponseStatus.SUBDOC_PATH_INVALID, response.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldAddUniqueIfValueNotAlreadyInArray() { SubArrayRequest.ArrayOperation arrayOp = SubArrayRequest.ArrayOperation.ADD_UNIQUE; String path = "sub.array"; ByteBuf fragment = Unpooled.copiedBuffer("99", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubArrayRequest request = new SubArrayRequest(testSubKey, path, arrayOp, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); assertEquals(ResponseStatus.SUCCESS, response.status()); assertMutation(testSubKey, jsonContent.replace("]", ", 99]")); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathExistOnArrayAddUniqueWithDuplicateValue() { SubArrayRequest.ArrayOperation arrayOp = SubArrayRequest.ArrayOperation.ADD_UNIQUE; String path = "sub.array"; ByteBuf fragment = Unpooled.copiedBuffer("2", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubArrayRequest request = new SubArrayRequest(testSubKey, path, arrayOp, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); assertEquals(ResponseStatus.SUBDOC_PATH_EXISTS, response.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathMismatchOnArrayAddUniqueIfArrayIsNotPrimitive() { SubArrayRequest.ArrayOperation arrayOp = SubArrayRequest.ArrayOperation.ADD_UNIQUE; String path = "complexArray"; ByteBuf fragment = Unpooled.copiedBuffer("\"arrayElement\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubArrayRequest request = new SubArrayRequest(testComplexSubArray, path, arrayOp, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); assertEquals(ResponseStatus.SUBDOC_PATH_MISMATCH, response.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldIncrementOnCounterWithPositiveDelta() { String path = "sub.array[1]"; long delta = 100L; long expected = 102L; SubCounterRequest request = new SubCounterRequest(testSubKey, path, delta, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); String result = response.content().toString(CharsetUtil.UTF_8); assertEquals(ResponseStatus.SUCCESS, response.status()); assertEquals("" + expected, result); assertEquals(expected, Long.parseLong(result)); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldDecrementOnCounterWithNegativeDelta() { String path = "sub.array[1]"; long delta = -100L; long expected = -98L; SubCounterRequest request = new SubCounterRequest(testSubKey, path, delta, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); String result = response.content().toString(CharsetUtil.UTF_8); assertEquals(ResponseStatus.SUCCESS, response.status()); assertEquals("" + expected, result); assertEquals(expected, Long.parseLong(result)); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldStartFromZeroAndApplyDeltaOnCounterInNewFinalPath() { String path = "counter"; long delta = 1234L; long expected = delta; SubCounterRequest request = new SubCounterRequest(testSubKey, path, delta, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); String result = response.content().toString(CharsetUtil.UTF_8); assertEquals(ResponseStatus.SUCCESS, response.status()); assertEquals("" + expected, result); assertEquals(expected, Long.parseLong(result)); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathNotExistOnCounterInIncompletePath() { String path = "counter.subCounter"; long delta = 99L; SubCounterRequest request = new SubCounterRequest(testSubKey, path, delta, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); String result = response.content().toString(CharsetUtil.UTF_8); assertEquals(0, result.length());//from w w w . j a va2 s .c o m assertEquals(ResponseStatus.SUBDOC_PATH_NOT_FOUND, response.status()); }