List of usage examples for io.netty.util CharsetUtil UTF_8
Charset UTF_8
To view the source code for io.netty.util CharsetUtil UTF_8.
Click Source Link
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathInvalidOnDictUpsertInArray() { String subPath = "sub.array[1]"; ByteBuf fragment = Unpooled.copiedBuffer("\"mutated\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); //mutate//from w w w . j av a 2 s. c o m SubDictUpsertRequest upsertRequest = new SubDictUpsertRequest(testSubKey, subPath, fragment, bucket()); SimpleSubdocResponse upsertResponse = cluster().<SimpleSubdocResponse>send(upsertRequest).toBlocking() .single(); ReferenceCountUtil.releaseLater(upsertResponse.content()); assertFalse(upsertResponse.status().isSuccess()); assertEquals(0, upsertResponse.content().readableBytes()); assertEquals(ResponseStatus.SUBDOC_PATH_INVALID, upsertResponse.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldGetMutationTokenWithMutation() throws Exception { String subPath = "sub.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"mutated\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubDictUpsertRequest upsertRequest = new SubDictUpsertRequest(testSubKey, subPath, fragment, bucket()); SimpleSubdocResponse upsertResponse = cluster().<SimpleSubdocResponse>send(upsertRequest).toBlocking() .single();/*from w w w.j a v a 2 s . c o m*/ ReferenceCountUtil.releaseLater(upsertResponse.content()); assertValidMetadata(upsertResponse.mutationToken()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldNotGetMutationTokenWithGet() throws Exception { String subPath = "sub.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"mutated\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubGetRequest getRequest = new SubGetRequest(testSubKey, subPath, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(getRequest).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); assertNull(response.mutationToken()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldDictAddOnSubObject() { String subPath = "sub.otherValue"; ByteBuf fragment = Unpooled.copiedBuffer("\"inserted\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); //mutate/*from w ww . j a va2 s . c o m*/ SubDictAddRequest insertRequest = new SubDictAddRequest(testSubKey, subPath, fragment, bucket()); SimpleSubdocResponse insertResponse = cluster().<SimpleSubdocResponse>send(insertRequest).toBlocking() .single(); ReferenceCountUtil.releaseLater(insertResponse.content()); assertTrue(insertResponse.status().isSuccess()); assertEquals(0, insertResponse.content().readableBytes()); //check the insertion at the end of "sub" object String expected = "{\"value\":\"stringValue\", \"sub\": {\"value\": \"subStringValue\",\"array\": [\"array1\", 2, true]" + ",\"otherValue\":\"inserted\"}}"; assertMutation(testSubKey, expected); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathExistOnDictAddOnSubValue() { String subPath = "sub.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"mutated\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); //mutate/*w w w .j a v a 2s .co m*/ SubDictAddRequest insertRequest = new SubDictAddRequest(testSubKey, subPath, fragment, bucket()); SimpleSubdocResponse insertResponse = cluster().<SimpleSubdocResponse>send(insertRequest).toBlocking() .single(); ReferenceCountUtil.releaseLater(insertResponse.content()); assertFalse(insertResponse.status().isSuccess()); assertEquals(0, insertResponse.content().readableBytes()); assertEquals(ResponseStatus.SUBDOC_PATH_EXISTS, insertResponse.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathNotFoundOnDictAddForNewDeepPath() { String subPath = "sub2.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"insertedPath\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); //mutate//from www . j av a 2s . c om SubDictAddRequest insertRequest = new SubDictAddRequest(testSubKey, subPath, fragment, bucket()); assertFalse(insertRequest.createIntermediaryPath()); SimpleSubdocResponse insertResponse = cluster().<SimpleSubdocResponse>send(insertRequest).toBlocking() .single(); ReferenceCountUtil.releaseLater(insertResponse.content()); assertFalse(insertResponse.status().isSuccess()); assertEquals(0, insertResponse.content().readableBytes()); assertEquals(ResponseStatus.SUBDOC_PATH_NOT_FOUND, insertResponse.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReturnPathInvalidOnDictAddForArrayPath() { String subPath = "sub.array[1]"; ByteBuf fragment = Unpooled.copiedBuffer("\"insertedPath\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); //mutate/*from ww w . j a v a2 s .co m*/ SubDictAddRequest insertRequest = new SubDictAddRequest(testSubKey, subPath, fragment, bucket()); assertFalse(insertRequest.createIntermediaryPath()); SimpleSubdocResponse insertResponse = cluster().<SimpleSubdocResponse>send(insertRequest).toBlocking() .single(); ReferenceCountUtil.releaseLater(insertResponse.content()); assertFalse(insertResponse.status().isSuccess()); assertEquals(0, insertResponse.content().readableBytes()); assertEquals(ResponseStatus.SUBDOC_PATH_INVALID, insertResponse.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldCreateIntermediaryNodesOnDictAddForNewDeepPathIfForced() { String subPath = "sub2.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"insertedPath\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); //mutate//from ww w. jav a 2 s. c om SubDictAddRequest insertRequest = new SubDictAddRequest(testSubKey, subPath, fragment, bucket()); insertRequest.createIntermediaryPath(true); SimpleSubdocResponse insertResponse = cluster().<SimpleSubdocResponse>send(insertRequest).toBlocking() .single(); ReferenceCountUtil.releaseLater(insertResponse.content()); assertTrue(insertResponse.status().isSuccess()); assertEquals(0, insertResponse.content().readableBytes()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldNotCreateIntermediaryNodesOnDictAddForNewDeepPathByDefault() { String subPath = "sub2.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"insertedPath\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubDictAddRequest insertRequest = new SubDictAddRequest(testSubKey, subPath, fragment, bucket()); SimpleSubdocResponse insertResponse = cluster().<SimpleSubdocResponse>send(insertRequest).toBlocking() .single();// w w w . jav a 2s.c o m ReferenceCountUtil.releaseLater(insertResponse.content()); assertFalse(insertResponse.status().isSuccess()); assertEquals(0, insertResponse.content().readableBytes()); assertEquals(ResponseStatus.SUBDOC_PATH_NOT_FOUND, insertResponse.status()); }
From source file:com.couchbase.client.core.cluster.SubdocumentMessageTest.java
License:Apache License
@Test public void shouldReplaceValueInSubObject() { String path = "sub.value"; ByteBuf fragment = Unpooled.copiedBuffer("\"mutated\"", CharsetUtil.UTF_8); ReferenceCountUtil.releaseLater(fragment); SubReplaceRequest request = new SubReplaceRequest(testSubKey, path, fragment, bucket()); SimpleSubdocResponse response = cluster().<SimpleSubdocResponse>send(request).toBlocking().single(); ReferenceCountUtil.releaseLater(response.content()); assertTrue(response.status().isSuccess()); assertEquals(0, response.content().readableBytes()); assertEquals(ResponseStatus.SUCCESS, response.status()); //assert the mutation String expected = "{\"value\":\"stringValue\", \"sub\": {\"value\": \"mutated\",\"array\": [\"array1\", 2, true]}}"; assertMutation(testSubKey, expected); }