Search in sources :

Example 36 with RuntimeContainer

use of org.talend.components.api.container.RuntimeContainer in project components by Talend.

the class SnowflakeCloseSourceOrSinkTest method testValidateFailedToClose.

@Test
public void testValidateFailedToClose() throws SQLException {
    RuntimeContainer container = Mockito.mock(RuntimeContainer.class);
    Connection connection = Mockito.mock(Connection.class);
    Mockito.doThrow(new SQLException("Failed to close connection")).when(connection).close();
    Mockito.when(container.getComponentData(Mockito.anyString(), Mockito.anyString())).thenReturn(connection);
    Assert.assertEquals(ValidationResult.Result.ERROR, closeSourceOrSink.validate(container).getStatus());
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) RuntimeContainer(org.talend.components.api.container.RuntimeContainer) Test(org.junit.Test)

Aggregations

RuntimeContainer (org.talend.components.api.container.RuntimeContainer)36 Test (org.junit.Test)34 DatabaseClient (com.marklogic.client.DatabaseClient)14 Schema (org.apache.avro.Schema)10 IndexedRecord (org.apache.avro.generic.IndexedRecord)10 DefaultComponentRuntimeContainerImpl (org.talend.components.api.container.DefaultComponentRuntimeContainerImpl)9 MarkLogicOutputProperties (org.talend.components.marklogic.tmarklogicoutput.MarkLogicOutputProperties)7 List (java.util.List)6 NetSuiteDatasetRuntime (org.talend.components.netsuite.NetSuiteDatasetRuntime)6 ValidationResult (org.talend.daikon.properties.ValidationResult)6 NetSuiteRuntimeImpl (org.talend.components.netsuite.v2016_2.NetSuiteRuntimeImpl)5 NetSuitePortType (com.netsuite.webservices.v2016_2.platform.NetSuitePortType)4 CustomFieldList (com.netsuite.webservices.v2016_2.platform.core.CustomFieldList)4 CustomRecordRef (com.netsuite.webservices.v2016_2.platform.core.CustomRecordRef)4 RecordRefList (com.netsuite.webservices.v2016_2.platform.core.RecordRefList)4 GetListRequest (com.netsuite.webservices.v2016_2.platform.messages.GetListRequest)4 ArrayList (java.util.ArrayList)4 Result (org.talend.components.api.component.runtime.Result)4 NetSuiteSink (org.talend.components.netsuite.NetSuiteSink)4 NetSuiteClientService (org.talend.components.netsuite.client.NetSuiteClientService)4