Search in sources :

Example 66 with ComponentException

use of org.talend.components.api.exception.ComponentException in project components by Talend.

the class JDBCInputTestIT method testGetSchemaNamesWithException.

@Test(expected = ComponentException.class)
public void testGetSchemaNamesWithException() throws Exception {
    TJDBCInputDefinition definition = new TJDBCInputDefinition();
    TJDBCInputProperties properties = DBTestUtils.createCommonJDBCInputProperties(allSetting, definition);
    properties.connection.driverClass.setValue("notexist");
    JDBCSource source = DBTestUtils.createCommonJDBCSource(properties);
    try {
        source.getSchemaNames(null);
    } catch (ComponentException e) {
        String message = CommonUtils.getClearExceptionInfo(e);
        assertTrue(message.contains("notexist"));
        throw e;
    }
}
Also used : ComponentException(org.talend.components.api.exception.ComponentException) TJDBCInputProperties(org.talend.components.jdbc.tjdbcinput.TJDBCInputProperties) JDBCSource(org.talend.components.jdbc.runtime.JDBCSource) TJDBCInputDefinition(org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition) Test(org.junit.Test)

Example 67 with ComponentException

use of org.talend.components.api.exception.ComponentException in project components by Talend.

the class JDBCInputTestIT method testGetSchemaFromQueryWithException1.

@Test(expected = ComponentException.class)
public void testGetSchemaFromQueryWithException1() throws Exception {
    TJDBCInputDefinition definition = new TJDBCInputDefinition();
    TJDBCInputProperties properties = DBTestUtils.createCommonJDBCInputProperties(allSetting, definition);
    JDBCSource source = DBTestUtils.createCommonJDBCSource(properties);
    try {
        source.getSchemaFromQuery(null, "select * from notexist");
    } catch (ComponentException e) {
        String message = CommonUtils.getClearExceptionInfo(e);
        assertTrue(message != null && !message.isEmpty());
        throw e;
    }
}
Also used : ComponentException(org.talend.components.api.exception.ComponentException) TJDBCInputProperties(org.talend.components.jdbc.tjdbcinput.TJDBCInputProperties) JDBCSource(org.talend.components.jdbc.runtime.JDBCSource) TJDBCInputDefinition(org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition) Test(org.junit.Test)

Example 68 with ComponentException

use of org.talend.components.api.exception.ComponentException in project components by Talend.

the class JDBCInputTestIT method testGetSchemaFromQueryWithException3.

@Test(expected = ComponentException.class)
public void testGetSchemaFromQueryWithException3() throws Exception {
    TJDBCInputDefinition definition = new TJDBCInputDefinition();
    TJDBCInputProperties properties = DBTestUtils.createCommonJDBCInputProperties(allSetting, definition);
    properties.connection.jdbcUrl.setValue("wrongone");
    JDBCSource source = DBTestUtils.createCommonJDBCSource(properties);
    try {
        source.getSchemaFromQuery(null, "select * from " + tablename);
    } catch (ComponentException e) {
        String message = CommonUtils.getClearExceptionInfo(e);
        assertTrue(message != null && !message.isEmpty());
        throw e;
    }
}
Also used : ComponentException(org.talend.components.api.exception.ComponentException) TJDBCInputProperties(org.talend.components.jdbc.tjdbcinput.TJDBCInputProperties) JDBCSource(org.talend.components.jdbc.runtime.JDBCSource) TJDBCInputDefinition(org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition) Test(org.junit.Test)

Example 69 with ComponentException

use of org.talend.components.api.exception.ComponentException in project components by Talend.

the class JDBCInputTestIT method testGetSchemaFromQueryWithException2.

@Test(expected = ComponentException.class)
public void testGetSchemaFromQueryWithException2() throws Exception {
    TJDBCInputDefinition definition = new TJDBCInputDefinition();
    TJDBCInputProperties properties = DBTestUtils.createCommonJDBCInputProperties(allSetting, definition);
    properties.connection.driverClass.setValue("notexist");
    JDBCSource source = DBTestUtils.createCommonJDBCSource(properties);
    try {
        source.getSchemaFromQuery(null, "select * from " + tablename);
    } catch (ComponentException e) {
        String message = CommonUtils.getClearExceptionInfo(e);
        assertTrue(message.contains("notexist"));
        throw e;
    }
}
Also used : ComponentException(org.talend.components.api.exception.ComponentException) TJDBCInputProperties(org.talend.components.jdbc.tjdbcinput.TJDBCInputProperties) JDBCSource(org.talend.components.jdbc.runtime.JDBCSource) TJDBCInputDefinition(org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition) Test(org.junit.Test)

Example 70 with ComponentException

use of org.talend.components.api.exception.ComponentException in project components by Talend.

the class JDBCInputTestIT method testGetSchemaWithException.

@Test(expected = ComponentException.class)
public void testGetSchemaWithException() throws Exception {
    TJDBCInputDefinition definition = new TJDBCInputDefinition();
    TJDBCInputProperties properties = DBTestUtils.createCommonJDBCInputProperties(allSetting, definition);
    properties.connection.driverClass.setValue("notexist");
    JDBCSource source = DBTestUtils.createCommonJDBCSource(properties);
    try {
        source.getEndpointSchema(null, tablename);
    } catch (ComponentException e) {
        String message = CommonUtils.getClearExceptionInfo(e);
        assertTrue(message.contains("notexist"));
        throw e;
    }
}
Also used : ComponentException(org.talend.components.api.exception.ComponentException) TJDBCInputProperties(org.talend.components.jdbc.tjdbcinput.TJDBCInputProperties) JDBCSource(org.talend.components.jdbc.runtime.JDBCSource) TJDBCInputDefinition(org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition) Test(org.junit.Test)

Aggregations

ComponentException (org.talend.components.api.exception.ComponentException)101 URL (java.net.URL)32 MalformedURLException (java.net.MalformedURLException)30 JarRuntimeInfo (org.talend.components.api.component.runtime.JarRuntimeInfo)27 IOException (java.io.IOException)18 ArrayList (java.util.ArrayList)17 InvalidKeyException (java.security.InvalidKeyException)14 Schema (org.apache.avro.Schema)14 URISyntaxException (java.net.URISyntaxException)12 StorageException (com.microsoft.azure.storage.StorageException)11 NamedThing (org.talend.daikon.NamedThing)11 ValidationResult (org.talend.daikon.properties.ValidationResult)10 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)10 IndexedRecord (org.apache.avro.generic.IndexedRecord)8 Test (org.junit.Test)8 SimpleNamedThing (org.talend.daikon.SimpleNamedThing)8 NetSuiteException (org.talend.components.netsuite.client.NetSuiteException)6 GeneralSecurityException (java.security.GeneralSecurityException)5 JDBCSource (org.talend.components.jdbc.runtime.JDBCSource)5 TJDBCInputDefinition (org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition)5