Search in sources :

Example 1 with MarkLogicCloseProperties

use of org.talend.components.marklogic.tmarklogicclose.MarkLogicCloseProperties in project components by Talend.

the class MarkLogicSourceOrSinkTest method testInitializeWrongProperties.

@Test
public void testInitializeWrongProperties() {
    // not io
    MarkLogicCloseProperties closeProperties = new MarkLogicCloseProperties("closeProperties");
    closeProperties.init();
    ValidationResult vr = sourceOrSink.initialize(null, closeProperties);
    assertEquals(ValidationResult.Result.ERROR, vr.getStatus());
    assertFalse(vr.getMessage().isEmpty());
}
Also used : MarkLogicCloseProperties(org.talend.components.marklogic.tmarklogicclose.MarkLogicCloseProperties) ValidationResult(org.talend.daikon.properties.ValidationResult) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with MarkLogicCloseProperties

use of org.talend.components.marklogic.tmarklogicclose.MarkLogicCloseProperties in project components by Talend.

the class TMarkLogicCloseStandaloneTest method testCloseSuccess.

@Test
public void testCloseSuccess() {
    MarkLogicCloseProperties closeProperties = new MarkLogicCloseProperties("close");
    closeProperties.referencedComponent.componentInstanceId.setValue("referenced1");
    RuntimeContainer container = Mockito.mock(RuntimeContainer.class);
    closeStandalone.initialize(container, closeProperties);
    DatabaseClient client = Mockito.mock(DatabaseClient.class);
    Mockito.when(container.getComponentData(closeProperties.getReferencedComponentId(), MarkLogicConnection.CONNECTION)).thenReturn(client);
    closeStandalone.runAtDriver(container);
    Mockito.verify(container, Mockito.only()).getComponentData(closeProperties.getReferencedComponentId(), MarkLogicConnection.CONNECTION);
    Mockito.verify(client).release();
}
Also used : DatabaseClient(com.marklogic.client.DatabaseClient) MarkLogicCloseProperties(org.talend.components.marklogic.tmarklogicclose.MarkLogicCloseProperties) RuntimeContainer(org.talend.components.api.container.RuntimeContainer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 MarkLogicCloseProperties (org.talend.components.marklogic.tmarklogicclose.MarkLogicCloseProperties)2 DatabaseClient (com.marklogic.client.DatabaseClient)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 RuntimeContainer (org.talend.components.api.container.RuntimeContainer)1 ValidationResult (org.talend.daikon.properties.ValidationResult)1