Search in sources :

Example 21 with DatabaseClient

use of com.marklogic.client.DatabaseClient in project components by Talend.

the class MarkLogicRowProcessorTest method testOpen.

@Test
public void testOpen() throws IOException {
    DatabaseClient mockedClient = mock(DatabaseClient.class);
    MarkLogicInputSink mockedSink = mock(MarkLogicInputSink.class);
    MarkLogicInputProperties inputProperties = new MarkLogicInputProperties("inputProps");
    inputProperties.init();
    MarkLogicInputWriteOperation writeOperation = new MarkLogicInputWriteOperation(mockedSink, inputProperties);
    MarkLogicRowProcessor rowProcessor = writeOperation.createWriter(null);
    when(mockedSink.connect(any(RuntimeContainer.class))).thenReturn(mockedClient);
    rowProcessor.open("123");
    assertNotNull(rowProcessor.docContentReader);
}
Also used : DatabaseClient(com.marklogic.client.DatabaseClient) MarkLogicInputProperties(org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties) RuntimeContainer(org.talend.components.api.container.RuntimeContainer) Test(org.junit.Test)

Aggregations

DatabaseClient (com.marklogic.client.DatabaseClient)21 Test (org.junit.Test)18 RuntimeContainer (org.talend.components.api.container.RuntimeContainer)18 MarkLogicInputProperties (org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties)8 MarkLogicOutputProperties (org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties)7 ValidationResult (org.talend.daikon.properties.ValidationResult)4 IndexedRecord (org.apache.avro.generic.IndexedRecord)3 MarkLogicConnectionProperties (org.talend.components.marklogic.tmarklogicconnection.MarkLogicConnectionProperties)3 DatabaseClientFactory (com.marklogic.client.DatabaseClientFactory)2 DocumentManager (com.marklogic.client.document.DocumentManager)2 SearchHandle (com.marklogic.client.io.SearchHandle)2 QueryManager (com.marklogic.client.query.QueryManager)2 StringQueryDefinition (com.marklogic.client.query.StringQueryDefinition)2 GenericData (org.apache.avro.generic.GenericData)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 SecurityContext (com.marklogic.client.DatabaseClientFactory.SecurityContext)1 ForbiddenUserException (com.marklogic.client.ForbiddenUserException)1 DocumentDescriptor (com.marklogic.client.document.DocumentDescriptor)1 DocumentUriTemplate (com.marklogic.client.document.DocumentUriTemplate)1 GenericDocumentManager (com.marklogic.client.document.GenericDocumentManager)1