use of java.sql.SQLSyntaxErrorException in project zipkin by openzipkin.
the class SchemaTest method hasDependencies_missing.
@Test
public void hasDependencies_missing() throws SQLException {
SQLSyntaxErrorException sqlException = new SQLSyntaxErrorException("SQL [select count(*) from `zipkin_dependencies`]; Table 'zipkin.zipkin_dependencies' doesn't exist\n" + " Query is : select count(*) from `zipkin_dependencies`", "42S02", 1146);
DataSource dataSource = mock(DataSource.class);
// cheats to lower mock count: this exception is really thrown during execution of the query
when(dataSource.getConnection()).thenThrow(new DataAccessException(sqlException.getMessage(), sqlException));
assertThat(schema.hasPreAggregatedDependencies).isFalse();
}
use of java.sql.SQLSyntaxErrorException in project zipkin by openzipkin.
the class SchemaTest method hasRemoteServiceName_falseWhenKnownSQLState.
@Test
public void hasRemoteServiceName_falseWhenKnownSQLState() throws SQLException {
SQLSyntaxErrorException sqlException = new SQLSyntaxErrorException("Unknown column 'zipkin_spans.remote_serviceName' in 'field list'", "42S22", 1054);
// cheats to lower mock count: this exception is really thrown during execution of the query
when(dataSource.getConnection()).thenThrow(new DataAccessException(sqlException.getMessage(), sqlException));
assertThat(schema.hasRemoteServiceName).isFalse();
}
use of java.sql.SQLSyntaxErrorException in project zipkin by openzipkin.
the class SchemaTest method hasIpv6_falseWhenUnknownSQLState.
/**
* This returns false instead of failing when the SQLState code doesn't imply the column is
* missing. This is to prevent zipkin from crashing due to scenarios we haven't thought up, yet.
* The root error goes into the log in this case.
*/
@Test
public void hasIpv6_falseWhenUnknownSQLState() throws SQLException {
SQLSyntaxErrorException sqlException = new SQLSyntaxErrorException("java.sql.SQLSyntaxErrorException: Table 'zipkin.zipkin_annotations' doesn't exist", "42S02", 1146);
DataSource dataSource = mock(DataSource.class);
// cheats to lower mock count: this exception is really thrown during execution of the query
when(dataSource.getConnection()).thenThrow(new DataAccessException(sqlException.getMessage(), sqlException));
assertThat(schema.hasIpv6).isFalse();
}
use of java.sql.SQLSyntaxErrorException in project zipkin by openzipkin.
the class SchemaTest method hasErrorCount_falseWhenUnknownSQLState.
/**
* This returns false instead of failing when the SQLState code doesn't imply the column is
* missing. This is to prevent zipkin from crashing due to scenarios we haven't thought up, yet.
* The root error goes into the log in this case.
*/
@Test
public void hasErrorCount_falseWhenUnknownSQLState() throws SQLException {
SQLSyntaxErrorException sqlException = new SQLSyntaxErrorException("java.sql.SQLSyntaxErrorException: Table 'zipkin.zipkin_dependencies' doesn't exist", "42S02", 1146);
DataSource dataSource = mock(DataSource.class);
// cheats to lower mock count: this exception is really thrown during execution of the query
when(dataSource.getConnection()).thenThrow(new DataAccessException(sqlException.getMessage(), sqlException));
assertThat(schema.hasErrorCount).isFalse();
}
use of java.sql.SQLSyntaxErrorException in project zipkin by openzipkin.
the class SchemaTest method hasIpv6_falseWhenUnknownSQLState.
/**
* This returns false instead of failing when the SQLState code doesn't imply the column is
* missing. This is to prevent zipkin from crashing due to scenarios we haven't thought up, yet.
* The root error goes into the log in this case.
*/
@Test
public void hasIpv6_falseWhenUnknownSQLState() throws SQLException {
SQLSyntaxErrorException sqlException = new SQLSyntaxErrorException("java.sql.SQLSyntaxErrorException: Table 'zipkin.zipkin_annotations' doesn't exist", "42S02", 1146);
DataSource dataSource = mock(DataSource.class);
// cheats to lower mock count: this exception is really thrown during execution of the query
when(dataSource.getConnection()).thenThrow(new DataAccessException(sqlException.getMessage(), sqlException));
assertThat(schema.hasIpv6).isFalse();
}
Aggregations