use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicSourceOrSinkTest method testInitializeOKInputProperties.
@Test
public void testInitializeOKInputProperties() {
MarkLogicInputProperties inputProperties = new MarkLogicInputProperties("inputProperties");
inputProperties.init();
ValidationResult vr = sourceOrSink.initialize(null, inputProperties);
assertEquals(ValidationResult.Result.OK, vr.getStatus());
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicSourceOrSinkTest method testDocContentTypeNotExists.
@Test(expected = MarkLogicException.class)
public void testDocContentTypeNotExists() {
MarkLogicInputProperties testInputProperties = new MarkLogicInputProperties("inputProperties");
testInputProperties.init();
Schema wrongSchema = AvroUtils.createEmptySchema();
testInputProperties.datasetProperties.main.schema.setValue(wrongSchema);
sourceOrSink.checkDocContentTypeSupported(testInputProperties.datasetProperties.main);
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicCriteriaReaderTest method testStartWithoutConnection.
@Test
public void testStartWithoutConnection() throws IOException {
MarkLogicSource mockedSource = mock(MarkLogicSource.class);
when(mockedSource.connect(any(RuntimeContainer.class))).thenReturn(null);
MarkLogicInputProperties properties = new MarkLogicInputProperties("inputProperties");
properties.init();
MarkLogicCriteriaReader criteriaReader = new MarkLogicCriteriaReader(mockedSource, null, properties);
assertFalse(criteriaReader.start());
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicInputSinkTest method testValidate.
@Test
public void testValidate() {
MarkLogicInputProperties inputProperties = new MarkLogicInputProperties("inputProps");
inputProperties.init();
inputProperties.connection.referencedComponent.componentInstanceId.setValue("some value");
RuntimeContainer mockedContainer = mock(RuntimeContainer.class);
DatabaseClient client = mock(DatabaseClient.class);
when(mockedContainer.getComponentData(inputProperties.connection.getReferencedComponentId(), "connection")).thenReturn(client);
inputSink.initialize(mockedContainer, inputProperties);
ValidationResult result = inputSink.validate(mockedContainer);
assertEquals(ValidationResult.Result.OK, result.getStatus());
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicRowProcessorTest method testWriteWithoutDocIdField.
@Test(expected = MarkLogicException.class)
public void testWriteWithoutDocIdField() throws IOException {
MarkLogicInputProperties inputProperties = new MarkLogicInputProperties("inputProps");
inputProperties.init();
inputProperties.inputSchema.schema.setValue(AvroUtils.createEmptySchema());
inputProperties.docIdColumn.setValue("someValue");
MarkLogicInputSink inputSink = new MarkLogicInputSink();
MarkLogicInputWriteOperation writeOperation = new MarkLogicInputWriteOperation(inputSink, inputProperties);
MarkLogicRowProcessor rowProcessor = writeOperation.createWriter(null);
GenericData.Record someRecord = new GenericData.Record(inputProperties.datasetProperties.main.schema.getValue());
rowProcessor.write(someRecord);
}
Aggregations