use of org.talend.components.marklogic.tmarklogicconnection.MarkLogicConnectionProperties in project components by Talend.
the class MarkLogicWizardDefinition method createWizard.
@Override
public ComponentWizard createWizard(ComponentProperties properties, String location) {
MarkLogicWizard markLogicWizard = new MarkLogicWizard(this, location);
MarkLogicConnectionProperties connectionProperties = (MarkLogicConnectionProperties) properties;
markLogicWizard.loadProperties(connectionProperties);
return markLogicWizard;
}
use of org.talend.components.marklogic.tmarklogicconnection.MarkLogicConnectionProperties in project components by Talend.
the class MarkLogicSourceOrSinkTest method testGetMarkLogicConnectionProperties.
@Test
public void testGetMarkLogicConnectionProperties() {
MarkLogicInputProperties expectedInputProperties = new MarkLogicInputProperties("inputProperties");
expectedInputProperties.init();
sourceOrSink.initialize(null, expectedInputProperties);
MarkLogicConnectionProperties actualConnectionProperties = sourceOrSink.getMarkLogicConnectionProperties();
assertEquals(expectedInputProperties.connection, actualConnectionProperties);
}
use of org.talend.components.marklogic.tmarklogicconnection.MarkLogicConnectionProperties in project components by Talend.
the class MarkLogicInputPropertiesTest method testUseExistedConnectionHideConnectionWidget.
@Test
public void testUseExistedConnectionHideConnectionWidget() {
MarkLogicConnectionProperties someConnection = new MarkLogicConnectionProperties("connection");
testInputProperties.setupProperties();
testInputProperties.connection.init();
testInputProperties.datasetProperties.init();
testInputProperties.inputSchema.init();
testInputProperties.setupLayout();
someConnection.init();
testInputProperties.connection.referencedComponent.setReference(someConnection);
testInputProperties.connection.referencedComponent.componentInstanceId.setValue(MarkLogicConnectionDefinition.COMPONENT_NAME + "_1");
testInputProperties.refreshLayout(testInputProperties.getForm(Form.MAIN));
boolean isConnectionHostPropertyHidden = testInputProperties.connection.getForm(Form.MAIN).getWidget(testInputProperties.connection.host).isHidden();
boolean isConnectionPortPropertyHidden = testInputProperties.connection.getForm(Form.MAIN).getWidget(testInputProperties.connection.port).isHidden();
boolean isUserNameHidden = testInputProperties.connection.getForm(Form.MAIN).getWidget(testInputProperties.connection.username).isHidden();
boolean isPasswordHidden = testInputProperties.connection.getForm(Form.MAIN).getWidget(testInputProperties.connection.password).isHidden();
boolean isConnectionDatabasePropertyHidden = testInputProperties.connection.getForm(Form.MAIN).getWidget(testInputProperties.connection.database).isHidden();
assertTrue(isConnectionHostPropertyHidden);
assertTrue(isConnectionPortPropertyHidden);
assertTrue(isUserNameHidden);
assertTrue(isPasswordHidden);
assertTrue(isConnectionDatabasePropertyHidden);
}
use of org.talend.components.marklogic.tmarklogicconnection.MarkLogicConnectionProperties in project components by Talend.
the class MarkLogicConnection method connect.
/**
* Creates new {@link DatabaseClient} connection or gets referenced one from container.
*
* @param container
* @return connection to MarkLogic database.
* @throws IOException thrown if referenced connection is not connected.
*/
public DatabaseClient connect(RuntimeContainer container) {
MarkLogicConnectionProperties properties = getMarkLogicConnectionProperties();
if (properties.getReferencedComponentId() != null && container != null) {
DatabaseClient client = (DatabaseClient) container.getComponentData(properties.getReferencedComponentId(), CONNECTION);
if (client != null) {
return client;
}
throw new MarkLogicException(new MarkLogicErrorCode(MESSAGES.getMessage("error.invalid.referenceConnection", properties.getReferencedComponentId())));
}
SecurityContext context = "BASIC".equals(properties.authentication.getValue()) ? new DatabaseClientFactory.BasicAuthContext(properties.username.getValue(), properties.password.getValue()) : new DatabaseClientFactory.DigestAuthContext(properties.username.getValue(), properties.password.getValue());
DatabaseClient client = DatabaseClientFactory.newClient(properties.host.getValue(), properties.port.getValue(), properties.database.getValue(), context);
testConnection(client);
LOGGER.info("Connected to MarkLogic server");
if (container != null) {
container.setComponentData(container.getCurrentComponentId(), CONNECTION, client);
LOGGER.info("Connection stored in container");
}
return client;
}
use of org.talend.components.marklogic.tmarklogicconnection.MarkLogicConnectionProperties in project components by Talend.
the class MarkLogicInternalBulkLoadRunnerTest method setUp.
@Before
public void setUp() {
connectionProperties = new MarkLogicConnectionProperties("connectionProperties");
bulkLoadProperties = new MarkLogicBulkLoadProperties("bulkLoadProperties");
bulkLoadRuntime = new MarkLogicBulkLoad();
}
Aggregations