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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
Aggregations