com.couchbase.client.core.state.NotConnectedException Java Examples
The following examples show how to use
com.couchbase.client.core.state.NotConnectedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestGetCouchbaseKey.java From localization_nifi with Apache License 2.0 | 6 votes |
@Test public void testCouchbaseFatalError() throws Exception { String docIdExp = "doc-c"; Bucket bucket = mock(Bucket.class); CouchbaseException exception = new NotConnectedException(); when(bucket.get(docIdExp, RawJsonDocument.class)) .thenThrow(exception); setupMockBucket(bucket); testRunner.setProperty(DOC_ID, docIdExp); String inputFileDataStr = "input FlowFile data"; byte[] inFileData = inputFileDataStr.getBytes(StandardCharsets.UTF_8); testRunner.enqueue(inFileData); testRunner.run(); testRunner.assertTransferCount(REL_SUCCESS, 0); testRunner.assertTransferCount(REL_ORIGINAL, 0); testRunner.assertTransferCount(REL_RETRY, 1); testRunner.assertTransferCount(REL_FAILURE, 0); MockFlowFile orgFile = testRunner.getFlowFilesForRelationship(REL_RETRY).get(0); orgFile.assertContentEquals(inputFileDataStr); orgFile.assertAttributeEquals(Exception.key(), exception.getClass().getName()); }
Example #2
Source File: TestGetCouchbaseKey.java From nifi with Apache License 2.0 | 6 votes |
@Test public void testCouchbaseFatalError() throws Exception { String docIdExp = "doc-c"; Bucket bucket = mock(Bucket.class); CouchbaseException exception = new NotConnectedException(); when(bucket.get(docIdExp, RawJsonDocument.class)) .thenThrow(exception); setupMockBucket(bucket); testRunner.setProperty(DOC_ID, docIdExp); String inputFileDataStr = "input FlowFile data"; byte[] inFileData = inputFileDataStr.getBytes(StandardCharsets.UTF_8); testRunner.enqueue(inFileData); testRunner.run(); testRunner.assertTransferCount(REL_SUCCESS, 0); testRunner.assertTransferCount(REL_ORIGINAL, 0); testRunner.assertTransferCount(REL_RETRY, 1); testRunner.assertTransferCount(REL_FAILURE, 0); MockFlowFile orgFile = testRunner.getFlowFilesForRelationship(REL_RETRY).get(0); orgFile.assertContentEquals(inputFileDataStr); orgFile.assertAttributeEquals(Exception.key(), exception.getClass().getName()); }
Example #3
Source File: AbstractEndpointTest.java From couchbase-jvm-core with Apache License 2.0 | 5 votes |
@Test(expected = NotConnectedException.class) public void shouldRejectMessageIfNotConnected() { BootstrapAdapter bootstrap = mock(BootstrapAdapter.class); Endpoint endpoint = new DummyEndpoint(bootstrap, ctx); CouchbaseRequest mockRequest = mock(CouchbaseRequest.class); Subject<CouchbaseResponse, CouchbaseResponse> subject = AsyncSubject.create(); when(mockRequest.observable()).thenReturn(subject); endpoint.send(mockRequest); mockRequest.observable().toBlocking().single(); }