Search in sources :

Example 1 with DocumentManager

use of com.marklogic.client.document.DocumentManager in project components by Talend.

the class MarkLogicWriterTest method testWriteNotIndexedRecord.

@Test
public void testWriteNotIndexedRecord() throws IOException {
    DocumentManager markLogicDocMngrMock = mock(DocumentManager.class);
    MarkLogicSink someSink = new MarkLogicSink();
    someSink.ioProperties = new MarkLogicOutputProperties("outputProps");
    writer = someSink.createWriteOperation().createWriter(null);
    writer.docMgr = markLogicDocMngrMock;
    writer.write(new Object());
    verifyZeroInteractions(markLogicDocMngrMock);
}
Also used : MarkLogicOutputProperties(org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties) DocumentManager(com.marklogic.client.document.DocumentManager) Matchers.anyObject(org.mockito.Matchers.anyObject) Test(org.junit.Test)

Example 2 with DocumentManager

use of com.marklogic.client.document.DocumentManager in project components by Talend.

the class MarkLogicWriterTest method testMarkLogicUpsertBinaryText.

@Test
public void testMarkLogicUpsertBinaryText() throws IOException {
    DocumentManager markLogicDocMngrMock = prepareDocManagerText(MarkLogicOutputProperties.Action.UPSERT, MarkLogicOutputProperties.DocType.BINARY);
    verify(markLogicDocMngrMock).write(anyString(), (GenericWriteHandle) anyObject());
}
Also used : DocumentManager(com.marklogic.client.document.DocumentManager) Test(org.junit.Test)

Example 3 with DocumentManager

use of com.marklogic.client.document.DocumentManager in project components by Talend.

the class MarkLogicWriterTest method testMarkLogicDelete.

@Test
public void testMarkLogicDelete() throws IOException {
    DocumentManager markLogicDocMngrMock = prepareDocManagerText(MarkLogicOutputProperties.Action.DELETE, MarkLogicOutputProperties.DocType.JSON);
    verify(markLogicDocMngrMock).delete(anyString());
}
Also used : DocumentManager(com.marklogic.client.document.DocumentManager) Test(org.junit.Test)

Example 4 with DocumentManager

use of com.marklogic.client.document.DocumentManager in project components by Talend.

the class MarkLogicWriterTest method testMarkLogicPatchXML.

@Test
public void testMarkLogicPatchXML() throws IOException {
    DocumentManager markLogicDocMngrMock = prepareDocManagerText(MarkLogicOutputProperties.Action.PATCH, MarkLogicOutputProperties.DocType.XML);
    verify(markLogicDocMngrMock).patch(anyString(), (DocumentPatchHandle) anyObject());
}
Also used : DocumentManager(com.marklogic.client.document.DocumentManager) Test(org.junit.Test)

Example 5 with DocumentManager

use of com.marklogic.client.document.DocumentManager in project components by Talend.

the class MarkLogicWriterTest method testMarkLogicUpsertText.

@Test
public void testMarkLogicUpsertText() throws IOException {
    DocumentManager markLogicDocMngrMock = prepareDocManagerText(MarkLogicOutputProperties.Action.UPSERT, MarkLogicOutputProperties.DocType.PLAIN_TEXT);
    verify(markLogicDocMngrMock).write(anyString(), (GenericWriteHandle) anyObject());
}
Also used : DocumentManager(com.marklogic.client.document.DocumentManager) Test(org.junit.Test)

Aggregations

DocumentManager (com.marklogic.client.document.DocumentManager)11 Test (org.junit.Test)10 MarkLogicOutputProperties (org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties)4 IndexedRecord (org.apache.avro.generic.IndexedRecord)3 DatabaseClient (com.marklogic.client.DatabaseClient)2 GenericData (org.apache.avro.generic.GenericData)2 Matchers.anyObject (org.mockito.Matchers.anyObject)2 RuntimeContainer (org.talend.components.api.container.RuntimeContainer)2 DocumentDescriptor (com.marklogic.client.document.DocumentDescriptor)1 DocumentUriTemplate (com.marklogic.client.document.DocumentUriTemplate)1 FileHandle (com.marklogic.client.io.FileHandle)1 AbstractWriteHandle (com.marklogic.client.io.marker.AbstractWriteHandle)1 File (java.io.File)1