use of com.mysql.cj.xdevapi.WarningImpl in project aws-mysql-jdbc by awslabs.
the class XProtocolTest method testWarnings.
@Test
public void testWarnings() {
assumeTrue(this.isSetForXTests, PropertyDefinitions.SYSP_testsuite_url_mysqlx + " must be set to run this test.");
this.protocol.send(this.messageBuilder.buildSqlStatement("explain select 1"), 0);
this.protocol.readMetadata();
this.protocol.drainRows();
SqlResult res = this.protocol.readQueryResult(new SqlResultBuilder(this.protocol.getServerSession().getDefaultTimeZone(), this.protocol.getPropertySet()));
Iterable<Warning> iterable = () -> res.getWarnings();
List<Warning> warnings = StreamSupport.stream(iterable.spliterator(), false).map(w -> new WarningImpl(w)).collect(Collectors.toList());
assertEquals(1, warnings.size());
Warning w = warnings.get(0);
assertEquals(1, w.getLevel());
assertEquals(1003, w.getCode());
// this message format might change over time and have to be loosened up
assertEquals("/* select#1 */ select 1 AS `1`", w.getMessage());
}
Aggregations