use of org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties in project components by Talend.
the class MarkLogicSourceOrSinkTest method testInitializeOKOutputProperties.
@Test
public void testInitializeOKOutputProperties() {
MarkLogicOutputProperties outputProperties = new MarkLogicOutputProperties("outputProperties");
outputProperties.init();
ValidationResult vr = sourceOrSink.initialize(null, outputProperties);
assertEquals(ValidationResult.Result.OK, vr.getStatus());
}
use of org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties in project components by Talend.
the class MarkLogicWriterTest method testInitDocManagerBinary.
@Test
public void testInitDocManagerBinary() throws IOException {
MarkLogicSink sink = new MarkLogicSink();
MarkLogicOutputProperties properties = new MarkLogicOutputProperties("outputProperties");
properties.init();
properties.connection.referencedComponent.componentInstanceId.setValue("Not null value");
properties.docType.setValue(MarkLogicOutputProperties.DocType.BINARY);
sink.ioProperties = properties;
RuntimeContainer mockedContainer = mock(RuntimeContainer.class);
DatabaseClient mockedClient = mock(DatabaseClient.class);
Mockito.when(mockedContainer.getComponentData(anyString(), anyString())).thenReturn(mockedClient);
writer = sink.createWriteOperation().createWriter(mockedContainer);
writer.open("123");
verify(mockedClient).newBinaryDocumentManager();
}
use of org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties 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);
}
use of org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties in project components by Talend.
the class MarkLogicWriterTest method testInitDocManagerText.
@Test
public void testInitDocManagerText() throws IOException {
MarkLogicSink sink = new MarkLogicSink();
MarkLogicOutputProperties properties = new MarkLogicOutputProperties("outputProperties");
properties.init();
properties.connection.referencedComponent.componentInstanceId.setValue("Not null value");
properties.docType.setValue(MarkLogicOutputProperties.DocType.PLAIN_TEXT);
sink.ioProperties = properties;
RuntimeContainer mockedContainer = mock(RuntimeContainer.class);
DatabaseClient mockedClient = mock(DatabaseClient.class);
Mockito.when(mockedContainer.getComponentData(anyString(), anyString())).thenReturn(mockedClient);
writer = sink.createWriteOperation().createWriter(mockedContainer);
writer.open("123");
verify(mockedClient).newTextDocumentManager();
}
use of org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties in project components by Talend.
the class MarkLogicWriterTest method testGetWriteOperation.
@Test
public void testGetWriteOperation() {
MarkLogicSink sink = mock(MarkLogicSink.class);
MarkLogicOutputProperties properties = new MarkLogicOutputProperties("outputProperties");
properties.init();
MarkLogicWriteOperation writeOperation = new MarkLogicWriteOperation(sink, properties);
Mockito.when(sink.connect((RuntimeContainer) anyObject())).thenReturn(null);
writer = writeOperation.createWriter(null);
assertEquals(writeOperation, writer.getWriteOperation());
}
Aggregations