use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicSourceOrSinkTest method testDocContentObjectTypeSupported.
@Test
public void testDocContentObjectTypeSupported() {
MarkLogicInputProperties testInputProperties = new MarkLogicInputProperties("inputProperties");
testInputProperties.init();
Schema bytesSchema = prepareSchema(AvroUtils._short(), "id_Object");
testInputProperties.datasetProperties.main.schema.setValue(bytesSchema);
sourceOrSink.checkDocContentTypeSupported(testInputProperties.datasetProperties.main);
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicCriteriaReaderTest method testStartWithoutDocContentField.
@Test
public void testStartWithoutDocContentField() throws IOException {
StringQueryDefinition mockedStringQueryDefinition = mock(StringQueryDefinition.class);
QueryManager mockedQueryManager = mock(QueryManager.class);
when(mockedQueryManager.newStringDefinition()).thenReturn(mockedStringQueryDefinition);
when(mockedQueryManager.newStringDefinition(anyString())).thenReturn(mockedStringQueryDefinition);
DatabaseClient mockedClient = mock(DatabaseClient.class);
when(mockedClient.newDocumentManager()).thenReturn(null);
when(mockedClient.newQueryManager()).thenReturn(mockedQueryManager);
SearchHandle searchHandle = Mockito.mock(SearchHandle.class);
Mockito.when(mockedQueryManager.search(Mockito.eq(mockedStringQueryDefinition), Mockito.any(SearchHandle.class))).thenReturn(searchHandle);
MarkLogicSource mockedSource = mock(MarkLogicSource.class);
when(mockedSource.connect(any(RuntimeContainer.class))).thenReturn(mockedClient);
MarkLogicInputProperties properties = new MarkLogicInputProperties("inputProperties");
properties.init();
Schema.Field docIdField = new Schema.Field("docId", AvroUtils._string(), null, (Object) null, Schema.Field.Order.IGNORE);
properties.datasetProperties.main.schema.setValue(Schema.createRecord("docIdOnlySchema", null, null, false, Collections.singletonList(docIdField)));
MarkLogicCriteriaReader criteriaReader = new MarkLogicCriteriaReader(mockedSource, null, properties);
System.out.println(criteriaReader.start());
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicSourceTest 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);
source.initialize(mockedContainer, inputProperties);
ValidationResult result = source.validate(mockedContainer);
assertEquals(ValidationResult.Result.OK, result.getStatus());
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicSourceTest method testCreateReader.
@Test
public void testCreateReader() {
MarkLogicInputProperties inputProperties = new MarkLogicInputProperties("inputProps");
inputProperties.init();
source.initialize(null, inputProperties);
MarkLogicCriteriaReader reader = source.createReader(null);
assertNotNull(reader);
}
use of org.talend.components.marklogic.tmarklogicinput.MarkLogicInputProperties in project components by Talend.
the class MarkLogicSinkTest method testCreateWriteOperationWithWrongProperties.
@Test(expected = MarkLogicException.class)
public void testCreateWriteOperationWithWrongProperties() {
MarkLogicInputProperties fakeOutputProperties = new MarkLogicInputProperties("fakeOutProps");
sink.initialize(null, fakeOutputProperties);
sink.createWriteOperation();
}
Aggregations