提交 e13cf869 编写于 作者: V Vlad Ilyushchenko

PG: added some edge-tests for postgres wire (protocol abuse tests)

上级 2eaa1238
......@@ -316,6 +316,7 @@ public class PGConnectionContext implements IOContext, Mutable {
try {
bindVariableService.setByte(index, (byte) Numbers.parseInt(dbcs.of(address, address + valueLen)));
} catch (NumericException e) {
LOG.error().$("bad byte variable value [index=").$(index).$(", value=`").$(dbcs).$("`").$();
throw BadProtocolException.INSTANCE;
}
}
......@@ -342,6 +343,7 @@ public class PGConnectionContext implements IOContext, Mutable {
try {
bindVariableService.setDouble(index, Numbers.parseDouble(dbcs.of(address, address + valueLen)));
} catch (NumericException e) {
LOG.error().$("bad double variable value [index=").$(index).$(", value=`").$(dbcs).$("`]").$();
throw BadProtocolException.INSTANCE;
}
}
......@@ -368,6 +370,7 @@ public class PGConnectionContext implements IOContext, Mutable {
try {
bindVariableService.setInt(index, Numbers.parseInt(dbcs.of(address, address + valueLen)));
} catch (NumericException e) {
LOG.error().$("bad int variable value [index=").$(index).$(", value=`").$(dbcs).$("`]").$();
throw BadProtocolException.INSTANCE;
}
}
......@@ -381,6 +384,7 @@ public class PGConnectionContext implements IOContext, Mutable {
try {
bindVariableService.setLong(index, Numbers.parseLong(dbcs.of(address, address + valueLen)));
} catch (NumericException e) {
LOG.error().$("bad long variable value [index=").$(index).$(", value=`").$(dbcs).$("`]").$();
throw BadProtocolException.INSTANCE;
}
}
......@@ -401,6 +405,7 @@ public class PGConnectionContext implements IOContext, Mutable {
private static void ensureValueLength(int required, int valueLen) throws BadProtocolException {
if (required != valueLen) {
LOG.error().$("bad parameter value length [required=").$(required).$(", actual=").$(valueLen).$(']').$();
throw BadProtocolException.INSTANCE;
}
}
......@@ -761,7 +766,6 @@ public class PGConnectionContext implements IOContext, Mutable {
switch (type) {
case 'P':
prepareForNewQuery();
// 'Parse'
// this appears to be the execution side - we must at least return 'RowDescription'
// possibly more, check QueryExecutionImpl.processResults() in PG driver for more info
......@@ -781,14 +785,8 @@ public class PGConnectionContext implements IOContext, Mutable {
throw BadProtocolException.INSTANCE;
}
CharacterStoreEntry e = queryCharacterStore.newEntry();
if (Chars.utf8Decode(lo, hi, e)) {
queryText = queryCharacterStore.toImmutable();
LOG.info().$("parse [q=").utf8(queryText).$(']').$();
} else {
LOG.error().$("invalid UTF8 bytes in parse query").$();
throw BadProtocolException.INSTANCE;
}
prepareForNewQuery();
parseQueryText(lo, hi);
lo = hi + 1;
if (lo + Short.BYTES > msgLimit) {
......@@ -894,15 +892,7 @@ public class PGConnectionContext implements IOContext, Mutable {
case 'Q':
// vanilla query
prepareForNewQuery();
e = queryCharacterStore.newEntry();
if (Chars.utf8Decode(lo, limit - 1, e)) {
queryText = queryCharacterStore.toImmutable();
LOG.info().$("simple query [q=").utf8(queryText).$(']').$();
} else {
LOG.error().$("invalid UTF8 bytes in simple query").$();
throw BadProtocolException.INSTANCE;
}
parseQueryText(lo, limit - 1);
currentFactory = factoryCache.peek(queryText);
if (currentFactory == null) {
......@@ -955,6 +945,17 @@ public class PGConnectionContext implements IOContext, Mutable {
}
}
private void parseQueryText(long lo, long hi) throws BadProtocolException {
CharacterStoreEntry e = queryCharacterStore.newEntry();
if (Chars.utf8Decode(lo, hi, e)) {
queryText = queryCharacterStore.toImmutable();
LOG.info().$("parse [q=").utf8(queryText).$(']').$();
} else {
LOG.error().$("invalid UTF8 bytes in parse query").$();
throw BadProtocolException.INSTANCE;
}
}
void prepareCommandComplete() {
responseAsciiSink.put(MESSAGE_TYPE_COMMAND_COMPLETE);
long addr = responseAsciiSink.skip();
......@@ -1069,7 +1070,12 @@ public class PGConnectionContext implements IOContext, Mutable {
log.$("property [");
try {
long hi = getStringLength(lo, msgLimit);
assert hi > -1;
if (hi == -1) {
// we did not find 0 within message limit
log.$("malformed property name");
throw BadProtocolException.INSTANCE;
}
log.$("name=").$(dbcs.of(lo, hi));
final boolean username = Chars.equals("user", dbcs);
......@@ -1077,7 +1083,12 @@ public class PGConnectionContext implements IOContext, Mutable {
// name is ready
lo = hi + 1;
hi = getStringLength(lo, msgLimit);
assert hi > -1;
if (hi == -1) {
// we did not find 0 within message limit
log.$(", malformed property value");
throw BadProtocolException.INSTANCE;
}
log.$(", value=").$(dbcs.of(lo, hi));
lo = hi + 1;
if (username) {
......@@ -1128,6 +1139,7 @@ public class PGConnectionContext implements IOContext, Mutable {
}
if (n < 0) {
LOG.info().$("disconnect [code=").$(n).$(']').$();
throw PeerDisconnectedException.INSTANCE;
}
......
......@@ -255,6 +255,23 @@ public class PGJobContextTest extends AbstractGriffinTest {
});
}
@Test
public void testBrokenUtf8QueryInParseMessage() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000000804d2162f\n" +
"<4e\n" +
">0000007500030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e65004575726f70652f4c6f6e646f6e0065787472615f666c6f61745f64696769747300320000\n" +
"<520000000800000003\n" +
">700000000a717565737400\n" +
"<520000000800000000530000001154696d655a6f6e6500474d5400530000001d6170706c69636174696f6e5f6e616d6500517565737444420053000000187365727665725f76657273696f6e0031312e33005300000019696e74656765725f6461746574696d6573006f6e005a0000000549\n" +
">50000000220053ac542065787472615f666c6f61745f646967697473203d2033000000420000000c0000000000000000450000000900000000015300000004\n" +
"<!!"
, new DefaultPGWireConfiguration()
);
}
@Test
public void testDDL() throws Exception {
TestUtils.assertMemoryLeak(() -> {
......@@ -622,6 +639,28 @@ public class PGJobContextTest extends AbstractGriffinTest {
});
}
@Test
public void testMalformedInitPropertyName() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000004c00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testMalformedInitPropertyValue() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000001e00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testParseMessageBadQueryTerminator() throws Exception {
final String script = ">0000006900030000757365720078797a006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
......@@ -950,6 +989,101 @@ public class PGJobContextTest extends AbstractGriffinTest {
assertPreparedStatementHex(nf, configuration);
}
@Test
public void testPreparedStatementParamBadByte() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000006b00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<520000000800000003\n" +
">700000000a717565737400\n" +
"<520000000800000000530000001154696d655a6f6e6500474d5400530000001d6170706c69636174696f6e5f6e616d6500517565737444420053000000187365727665725f76657273696f6e0031312e33005300000019696e74656765725f6461746574696d6573006f6e005a0000000549\n" +
">5000000022005345542065787472615f666c6f61745f646967697473203d2033000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">500000003700534554206170706c69636174696f6e5f6e616d65203d2027506f737467726553514c204a4442432044726976657227000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">50000000cd0073656c65637420782c24312c24322c24332c24342c24352c24362c24372c24382c24392c2431302c2431312c2431322c2431332c2431342c2431352c2431362c2431372c2431382c2431392c2432302c2432312c2432322066726f6d206c6f6e675f73657175656e63652835290000160000001700000014000002bd000002bd0000001500000010000004130000041300000000000000000000001700000014000002bc000002bd000000150000001000000413000004130000043a000000000000045a000004a04200000123000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000001340000000331323300000004352e343300000007302e353637383900000002993100000004545255450000000568656c6c6f0000001dd0b3d180d183d0bfd0bfd0b020d182d183d180d0b8d181d182d0bed0b20000000e313937302d30312d3031202b30300000001a313937302d30382d32302031313a33333a32302e3033332b3030ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000001a313937302d30312d30312030303a30353a30302e3031312b30300000001a313937302d30312d30312030303a30383a32302e3032332b3030000044000000065000450000000900000000005300000004\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testPreparedStatementParamBadDouble() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000006b00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<520000000800000003\n" +
">700000000a717565737400\n" +
"<520000000800000000530000001154696d655a6f6e6500474d5400530000001d6170706c69636174696f6e5f6e616d6500517565737444420053000000187365727665725f76657273696f6e0031312e33005300000019696e74656765725f6461746574696d6573006f6e005a0000000549\n" +
">5000000022005345542065787472615f666c6f61745f646967697473203d2033000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">500000003700534554206170706c69636174696f6e5f6e616d65203d2027506f737467726553514c204a4442432044726976657227000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">50000000cd0073656c65637420782c24312c24322c24332c24342c24352c24362c24372c24382c24392c2431302c2431312c2431322c2431332c2431342c2431352c2431362c2431372c2431382c2431392c2432302c2432312c2432322066726f6d206c6f6e675f73657175656e63652835290000160000001700000014000002bd000002bd0000001500000010000004130000041300000000000000000000001700000014000002bc000002bd000000150000001000000413000004130000043a000000000000045a000004a04200000123000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000001340000000331323300000004352f343300000007302e353637383900000002393100000004545255450000000568656c6c6f0000001dd0b3d180d183d0bfd0bfd0b020d182d183d180d0b8d181d182d0bed0b20000000e313937302d30312d3031202b30300000001a313937302d30382d32302031313a33333a32302e3033332b3030ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000001a313937302d30312d30312030303a30353a30302e3031312b30300000001a313937302d30312d30312030303a30383a32302e3032332b3030000044000000065000450000000900000000005300000004\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testPreparedStatementParamBadInt() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000006b00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<520000000800000003\n" +
">700000000a717565737400\n" +
"<520000000800000000530000001154696d655a6f6e6500474d5400530000001d6170706c69636174696f6e5f6e616d6500517565737444420053000000187365727665725f76657273696f6e0031312e33005300000019696e74656765725f6461746574696d6573006f6e005a0000000549\n" +
">5000000022005345542065787472615f666c6f61745f646967697473203d2033000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">500000003700534554206170706c69636174696f6e5f6e616d65203d2027506f737467726553514c204a4442432044726976657227000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">50000000cd0073656c65637420782c24312c24322c24332c24342c24352c24362c24372c24382c24392c2431302c2431312c2431322c2431332c2431342c2431352c2431362c2431372c2431382c2431392c2432302c2432312c2432322066726f6d206c6f6e675f73657175656e63652835290000160000001700000014000002bd000002bd0000001500000010000004130000041300000000000000000000001700000014000002bc000002bd000000150000001000000413000004130000043a000000000000045a000004a04200000123000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000001FC0000000331323300000004352e343300000007302e353637383900000002393100000004545255450000000568656c6c6f0000001dd0b3d180d183d0bfd0bfd0b020d182d183d180d0b8d181d182d0bed0b20000000e313937302d30312d3031202b30300000001a313937302d30382d32302031313a33333a32302e3033332b3030ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000001a313937302d30312d30312030303a30353a30302e3031312b30300000001a313937302d30312d30312030303a30383a32302e3032332b3030000044000000065000450000000900000000005300000004\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testPreparedStatementParamBadLong() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000006b00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<520000000800000003\n" +
">700000000a717565737400\n" +
"<520000000800000000530000001154696d655a6f6e6500474d5400530000001d6170706c69636174696f6e5f6e616d6500517565737444420053000000187365727665725f76657273696f6e0031312e33005300000019696e74656765725f6461746574696d6573006f6e005a0000000549\n" +
">5000000022005345542065787472615f666c6f61745f646967697473203d2033000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">500000003700534554206170706c69636174696f6e5f6e616d65203d2027506f737467726553514c204a4442432044726976657227000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">50000000cd0073656c65637420782c24312c24322c24332c24342c24352c24362c24372c24382c24392c2431302c2431312c2431322c2431332c2431342c2431352c2431362c2431372c2431382c2431392c2432302c2432312c2432322066726f6d206c6f6e675f73657175656e63652835290000160000001700000014000002bd000002bd0000001500000010000004130000041300000000000000000000001700000014000002bc000002bd000000150000001000000413000004130000043a000000000000045a000004a04200000123000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000001340000000331B23300000004352e343300000007302e353637383900000002393100000004545255450000000568656c6c6f0000001dd0b3d180d183d0bfd0bfd0b020d182d183d180d0b8d181d182d0bed0b20000000e313937302d30312d3031202b30300000001a313937302d30382d32302031313a33333a32302e3033332b3030ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000001a313937302d30312d30312030303a30353a30302e3031312b30300000001a313937302d30312d30312030303a30383a32302e3032332b3030000044000000065000450000000900000000005300000004\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testPreparedStatementParamValueLengthOverflow() throws Exception {
assertHexScript(
NetworkFacadeImpl.INSTANCE,
NetworkFacadeImpl.INSTANCE,
">0000006b00030000757365720061646d696e006461746162617365006e6162755f61707000636c69656e745f656e636f64696e67005554463800446174655374796c650049534f0054696d655a6f6e6500474d540065787472615f666c6f61745f64696769747300320000\n" +
"<520000000800000003\n" +
">700000000a717565737400\n" +
"<520000000800000000530000001154696d655a6f6e6500474d5400530000001d6170706c69636174696f6e5f6e616d6500517565737444420053000000187365727665725f76657273696f6e0031312e33005300000019696e74656765725f6461746574696d6573006f6e005a0000000549\n" +
">5000000022005345542065787472615f666c6f61745f646967697473203d2033000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">500000003700534554206170706c69636174696f6e5f6e616d65203d2027506f737467726553514c204a4442432044726976657227000000420000000c0000000000000000450000000900000000015300000004\n" +
"<31000000045a0000000549\n" +
">50000000cd0073656c65637420782c24312c24322c24332c24342c24352c24362c24372c24382c24392c2431302c2431312c2431322c2431332c2431342c2431352c2431362c2431372c2431382c2431392c2432302c2432312c2432322066726f6d206c6f6e675f73657175656e63652835290000160000001700000014000002bd000002bd0000001500000010000004130000041300000000000000000000001700000014000002bc000002bd000000150000001000000413000004130000043a000000000000045a000004a04200000123000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000001340000333331B23300000004352e343300000007302e353637383900000002393100000004545255450000000568656c6c6f0000001dd0b3d180d183d0bfd0bfd0b020d182d183d180d0b8d181d182d0bed0b20000000e313937302d30312d3031202b30300000001a313937302d30382d32302031313a33333a32302e3033332b3030ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000001a313937302d30312d30312030303a30353a30302e3031312b30300000001a313937302d30312d30312030303a30383a32302e3032332b3030000044000000065000450000000900000000005300000004\n" +
"<!!",
new DefaultPGWireConfiguration()
);
}
@Test
public void testPreparedStatementParams() throws Exception {
TestUtils.assertMemoryLeak(() -> {
......@@ -1097,111 +1231,7 @@ public class PGJobContextTest extends AbstractGriffinTest {
@Test
public void testSimple() throws Exception {
TestUtils.assertMemoryLeak(() -> {
final CountDownLatch haltLatch = new CountDownLatch(1);
final AtomicBoolean running = new AtomicBoolean(true);
try {
startBasicServer(NetworkFacadeImpl.INSTANCE,
new DefaultPGWireConfiguration(),
haltLatch,
running
);
Properties properties = new Properties();
properties.setProperty("user", "admin");
properties.setProperty("password", "quest");
final Connection connection = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:9120/nabu_app", properties);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(
"select " +
"rnd_str(4,4,4) s, " +
"rnd_int(0, 256, 4) i, " +
"rnd_double(4) d, " +
"timestamp_sequence(to_timestamp(0),10000) t, " +
"rnd_float(4) f, " +
"rnd_short() _short, " +
"rnd_long(0, 10000000, 5) l, " +
"rnd_timestamp(to_timestamp('2015','yyyy'),to_timestamp('2016','yyyy'),2) ts2, " +
"rnd_byte(0,127) bb, " +
"rnd_boolean() b, " +
"rnd_symbol(4,4,4,2), " +
"rnd_date(to_date('2015', 'yyyy'), to_date('2016', 'yyyy'), 2)," +
"rnd_bin(10,20,2) " +
"from long_sequence(50)");
final String expected = "s[VARCHAR],i[INTEGER],d[DOUBLE],t[TIMESTAMP],f[REAL],_short[SMALLINT],l[BIGINT],ts2[TIMESTAMP],bb[SMALLINT],b[BIT],rnd_symbol[VARCHAR],rnd_date[TIMESTAMP],rnd_bin[BINARY]\n" +
"null,57,0.62500000,1970-01-01 00:00:00.0,0.4620,-1593,3425232,null,121,false,PEHN,2015-03-17 04:25:52.765,00000000 19 c4 95 94 36 53 49 b4 59 7e 3b 08 a1 1e\n" +
"XYSB,142,0.57900000,1970-01-01 00:00:00.01,0.9690,20088,1517490,2015-01-17 20:41:19.480685,100,true,PEHN,2015-06-20 01:10:58.599,00000000 79 5f 8b 81 2b 93 4d 1a 8e 78 b5 b9 11 53 d0 fb\n" +
"00000010 64\n" +
"OZZV,219,0.16400000,1970-01-01 00:00:00.02,0.6590,-12303,9489508,2015-08-13 17:10:19.752521,6,false,null,2015-05-20 01:48:37.418,00000000 2b 4d 5f f6 46 90 c3 b3 59 8e e5 61 2f 64 0e\n" +
"OLYX,30,0.71300000,1970-01-01 00:00:00.03,0.6550,6610,6504428,2015-08-08 00:42:24.545639,123,false,null,2015-01-03 13:53:03.165,null\n" +
"TIQB,42,0.68100000,1970-01-01 00:00:00.04,0.6260,-1605,8814086,2015-07-28 15:08:53.462495,28,true,CPSW,null,00000000 3b a6 dc 3b 7d 2b e3 92 fe 69 38 e1 77 9a\n" +
"LTOV,137,0.76300000,1970-01-01 00:00:00.05,0.8820,9054,null,2015-04-20 05:09:03.580574,106,false,PEHN,2015-01-09 06:57:17.512,null\n" +
"ZIMN,125,null,1970-01-01 00:00:00.06,null,11524,8335261,2015-10-26 02:10:50.688394,111,true,PEHN,2015-08-21 15:46:32.624,null\n" +
"OPJO,168,0.10500000,1970-01-01 00:00:00.07,0.5350,-5920,7080704,2015-07-11 09:15:38.342717,103,false,VTJW,null,null\n" +
"GLUO,145,0.53900000,1970-01-01 00:00:00.08,0.7670,14242,2499922,2015-11-02 09:01:31.312804,84,false,PEHN,2015-11-14 17:37:36.043,null\n" +
"ZVQE,103,0.67300000,1970-01-01 00:00:00.09,null,13727,7875846,2015-12-12 13:16:26.134562,22,true,PEHN,2015-01-20 04:50:34.098,00000000 14 33 80 c9 eb a3 67 7a 1a 79 e4 35 e4 3a dc 5c\n" +
"00000010 65 ff\n" +
"LIGY,199,0.28400000,1970-01-01 00:00:00.1,null,30426,3215562,2015-08-21 14:55:07.055722,11,false,VTJW,null,00000000 ff 70 3a c7 8a b3 14 cd 47 0b 0c 39 12\n" +
"MQNT,43,0.58600000,1970-01-01 00:00:00.11,0.3350,27019,null,null,27,true,PEHN,2015-07-12 12:59:47.665,00000000 26 fb 2e 42 fa f5 6e 8f 80 e3 54 b8 07 b1 32 57\n" +
"00000010 ff 9a ef\n" +
"WWCC,213,0.76700000,1970-01-01 00:00:00.12,0.5800,13640,4121923,2015-08-06 02:27:30.469762,73,false,PEHN,2015-04-30 08:18:10.453,00000000 71 a7 d5 af 11 96 37 08 dd 98 ef 54 88 2a a2 ad\n" +
"00000010 e7 d4\n" +
"VFGP,120,0.84000000,1970-01-01 00:00:00.13,0.7730,7223,7241423,2015-12-18 07:32:18.456025,43,false,VTJW,null,00000000 24 4e 44 a8 0d fe 27 ec 53 13 5d b2 15 e7 b8 35\n" +
"00000010 67\n" +
"RMDG,134,0.11000000,1970-01-01 00:00:00.14,0.0430,21227,7155708,2015-07-03 04:12:45.774281,42,true,CPSW,2015-02-24 12:10:43.199,null\n" +
"WFOQ,255,null,1970-01-01 00:00:00.15,0.1160,31569,6688277,2015-05-19 03:30:45.779999,126,true,PEHN,2015-12-09 09:57:17.078,null\n" +
"MXDK,56,1.00000000,1970-01-01 00:00:00.16,0.5230,-32372,6884132,null,58,false,null,2015-01-20 06:18:18.583,null\n" +
"XMKJ,139,0.84100000,1970-01-01 00:00:00.17,0.3060,25856,null,2015-05-18 03:50:22.731437,2,true,VTJW,2015-06-25 10:45:01.014,00000000 00 7c fb 01 19 ca f2 bf 84 5a 6f 38 35\n" +
"VIHD,null,null,1970-01-01 00:00:00.18,0.5500,22280,9109842,2015-01-25 13:51:38.270583,94,false,CPSW,2015-10-27 02:52:19.935,00000000 2d 16 f3 89 a3 83 64 de d6 fd c4 5b c4 e9\n" +
"WPNX,null,0.94700000,1970-01-01 00:00:00.19,0.4150,-17933,674261,2015-03-04 15:43:15.213686,43,true,HYRX,2015-12-18 21:28:25.325,00000000 b3 4c 0e 8f f1 0c c5 60 b7 d1\n" +
"YPOV,36,0.67400000,1970-01-01 00:00:00.2,0.0310,-5888,1375423,2015-12-10 20:50:35.866614,3,true,null,2015-07-23 20:17:04.236,00000000 d4 ab be 30 fa 8d ac 3d 98 a0 ad 9a 5d\n" +
"NUHN,null,0.69400000,1970-01-01 00:00:00.21,0.3390,-25226,3524748,2015-05-07 04:07:18.152968,39,true,VTJW,2015-04-04 15:23:34.13,00000000 b8 be f8 a1 46 87 28 92 a3 9b e3 cb c2 64 8a b0\n" +
"00000010 35 d8\n" +
"BOSE,240,0.06000000,1970-01-01 00:00:00.22,0.3790,23904,9069339,2015-03-21 03:42:42.643186,84,true,null,null,null\n" +
"INKG,124,0.86200000,1970-01-01 00:00:00.23,0.4040,-30383,7233542,2015-07-21 16:42:47.012148,99,false,null,2015-08-27 17:25:35.308,00000000 87 fc 92 83 fc 88 f3 32 27 70 c8 01 b0 dc c9 3a\n" +
"00000010 5b 7e\n" +
"FUXC,52,0.74300000,1970-01-01 00:00:00.24,null,-14729,1042064,2015-08-21 02:10:58.949674,28,true,CPSW,2015-08-29 20:15:51.835,null\n" +
"UNYQ,71,0.44200000,1970-01-01 00:00:00.25,0.5390,-22611,null,2015-12-23 18:41:42.319859,98,true,PEHN,2015-01-26 00:55:50.202,00000000 28 ed 97 99 d8 77 33 3f b2 67 da 98 47 47 bf\n" +
"KBMQ,null,0.28000000,1970-01-01 00:00:00.26,null,12240,null,2015-08-16 01:02:55.766622,21,false,null,2015-05-19 00:47:18.698,00000000 6a de 46 04 d3 81 e7 a2 16 22 35 3b 1c\n" +
"JSOL,243,null,1970-01-01 00:00:00.27,0.0680,-17468,null,null,20,true,null,2015-06-19 10:38:54.483,00000000 3d e0 2d 04 86 e7 ca 29 98 07 69 ca 5b d6 cf 09\n" +
"00000010 69\n" +
"HNSS,150,null,1970-01-01 00:00:00.28,0.1480,14841,5992443,null,25,false,PEHN,null,00000000 14 d6 fc ee 03 22 81 b8 06 c4 06 af\n" +
"PZPB,101,0.06200000,1970-01-01 00:00:00.29,null,12237,9878179,2015-09-03 22:13:18.852465,79,false,VTJW,2015-12-17 15:12:54.958,00000000 12 61 3a 9a ad 98 2e 75 52 ad 62 87 88 45 b9 9d\n" +
"OYNN,25,0.33900000,1970-01-01 00:00:00.3,0.6280,22412,4736378,2015-10-10 12:19:42.528224,106,true,CPSW,2015-07-01 00:23:49.789,00000000 54 13 3f ff b6 7e cd 04 27 66 94 89 db\n" +
"null,117,0.56400000,1970-01-01 00:00:00.31,null,-5604,6353018,null,84,false,null,null,00000000 2b ad 25 07 db 62 44 33 6e 00 8e\n" +
"HVRI,233,0.22400000,1970-01-01 00:00:00.32,0.4250,10469,1715213,null,86,false,null,2015-02-02 05:48:17.373,null\n" +
"OYTO,96,0.74100000,1970-01-01 00:00:00.33,0.5280,-12239,3499620,2015-02-07 22:35:03.212268,17,false,PEHN,2015-03-29 12:55:11.682,null\n" +
"LFCY,63,0.72200000,1970-01-01 00:00:00.34,null,23344,9523982,null,123,false,CPSW,2015-05-18 04:35:27.228,00000000 05 e5 c0 4e cc d6 e3 7b 34 cd 15 35 bb a4\n" +
"GHLX,148,0.30600000,1970-01-01 00:00:00.35,0.6360,-31457,2322337,2015-10-22 12:06:05.544701,91,true,HYRX,2015-05-21 09:33:18.158,00000000 57 1d 91 72 30 04 b7 02 cb 03\n" +
"YTSZ,123,null,1970-01-01 00:00:00.36,0.5190,22534,4446236,2015-07-27 07:23:37.233711,53,false,CPSW,2015-01-13 04:37:10.036,null\n" +
"SWLU,251,null,1970-01-01 00:00:00.37,0.1790,7734,4082475,2015-10-21 18:24:34.400345,69,false,PEHN,2015-04-01 14:33:42.005,null\n" +
"TQJL,245,null,1970-01-01 00:00:00.38,0.8650,9516,929340,2015-05-28 04:18:18.640567,69,false,VTJW,2015-06-12 20:12:28.881,00000000 6c 3e 51 d7 eb b1 07 71 32 1f af 40 4e 8c 47\n" +
"REIJ,94,null,1970-01-01 00:00:00.39,0.1300,-29924,null,2015-03-20 22:14:46.204718,113,true,HYRX,2015-12-19 13:58:41.819,null\n" +
"HDHQ,94,0.72300000,1970-01-01 00:00:00.4,0.7300,19970,654131,2015-01-10 22:56:08.48045,84,true,null,2015-03-05 17:14:48.275,00000000 4f 56 6b 65 a4 53 38 e9 cd c1 a7 ee 86 75 ad a5\n" +
"00000010 2d 49\n" +
"UMEU,40,0.00800000,1970-01-01 00:00:00.41,0.8050,-11623,4599862,2015-11-20 04:02:44.335947,76,false,PEHN,2015-05-17 17:33:20.922,null\n" +
"YJIH,184,null,1970-01-01 00:00:00.42,0.3830,17614,3101671,2015-01-28 12:05:46.683001,105,true,null,2015-12-07 19:24:36.838,00000000 ec 69 cd 73 bb 9b c5 95 db 61 91 ce\n" +
"CYXG,27,0.29200000,1970-01-01 00:00:00.43,0.9530,3944,249165,null,67,true,null,2015-03-02 08:19:44.566,00000000 01 48 15 3e 0c 7f 3f 8f e4 b5 ab 34 21 29\n" +
"MRTG,143,0.02600000,1970-01-01 00:00:00.44,0.9430,-27320,1667842,2015-01-24 19:56:15.973109,11,false,null,2015-01-24 07:15:02.772,null\n" +
"DONP,246,0.65400000,1970-01-01 00:00:00.45,0.5560,27477,4160018,2015-12-14 03:40:05.911839,20,true,PEHN,2015-10-29 14:35:10.167,00000000 07 92 01 f5 6a a1 31 cd cb c2 a2 b4 8e 99\n" +
"IQXS,232,0.23100000,1970-01-01 00:00:00.46,0.0490,-18113,4005228,2015-06-11 13:00:07.248188,8,true,CPSW,2015-08-16 11:09:24.311,00000000 fa 1f 92 24 b1 b8 67 65 08 b7 f8 41 00\n" +
"null,178,null,1970-01-01 00:00:00.47,0.9030,-14626,2934570,2015-04-04 08:51:54.068154,88,true,null,2015-07-01 04:32:23.083,00000000 84 36 25 63 2b 63 61 43 1c 47 7d b6 46 ba bb 98\n" +
"00000010 ca 08 be a4\n" +
"HUWZ,94,0.11000000,1970-01-01 00:00:00.48,0.4200,-3736,5687514,2015-01-02 17:18:05.627633,74,false,null,2015-03-29 06:39:11.642,null\n" +
"SRED,66,0.11300000,1970-01-01 00:00:00.49,0.0600,-10543,3669377,2015-10-22 02:53:02.381351,77,true,PEHN,null,00000000 7c 3f d6 88 3a 93 ef 24 a5 e2 bc\n";
StringSink sink = new StringSink();
// dump metadata
assertResultSet(expected, sink, rs);
connection.close();
} finally {
running.set(false);
haltLatch.await();
}
});
testQuery("rnd_double(4) d, ", "s[VARCHAR],i[INTEGER],d[DOUBLE],t[TIMESTAMP],f[REAL],_short[SMALLINT],l[BIGINT],ts2[TIMESTAMP],bb[SMALLINT],b[BIT],rnd_symbol[VARCHAR],rnd_date[TIMESTAMP],rnd_bin[BINARY]\n");
}
@Test
......@@ -1410,6 +1440,11 @@ public class PGJobContextTest extends AbstractGriffinTest {
});
}
@Test
public void testUtf8QueryText() throws Exception {
testQuery("rnd_double(4) расход, ", "s[VARCHAR],i[INTEGER],расход[DOUBLE],t[TIMESTAMP],f[REAL],_short[SMALLINT],l[BIGINT],ts2[TIMESTAMP],bb[SMALLINT],b[BIT],rnd_symbol[VARCHAR],rnd_date[TIMESTAMP],rnd_bin[BINARY]\n");
}
private static void toSink(InputStream is, CharSink sink) throws IOException {
// limit what we print
byte[] bb = new byte[1];
......@@ -1567,10 +1602,10 @@ public class PGJobContextTest extends AbstractGriffinTest {
// we meant to receive; sendBuf will contain expected bytes we have to receive
// and this buffer will also drive the length of the message
if (len > 0 || expectDisconnect) {
int m = clientNf.recv(clientFd, recvBuf, len);
if (expectDisconnect) {
Assert.assertTrue(m < 0);
Assert.assertTrue(Net.isDead(clientFd));
} else {
int m = clientNf.recv(clientFd, recvBuf, len);
Assert.assertEquals(len, m);
for (int j = 0; j < len; j++) {
Assert.assertEquals(
......@@ -1585,6 +1620,7 @@ public class PGJobContextTest extends AbstractGriffinTest {
Unsafe.free(sendBuf, N);
Unsafe.free(recvBuf, N);
clientNf.freeSockAddr(sockAddress);
LOG.info().$("closed client").$();
clientNf.close(clientFd);
}
} finally {
......@@ -1859,4 +1895,112 @@ public class PGJobContextTest extends AbstractGriffinTest {
barrier.await();
}
private void testQuery(String s, String s2) throws Exception {
TestUtils.assertMemoryLeak(() -> {
final CountDownLatch haltLatch = new CountDownLatch(1);
final AtomicBoolean running = new AtomicBoolean(true);
try {
startBasicServer(NetworkFacadeImpl.INSTANCE,
new DefaultPGWireConfiguration(),
haltLatch,
running
);
Properties properties = new Properties();
properties.setProperty("user", "admin");
properties.setProperty("password", "quest");
final Connection connection = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:9120/nabu_app", properties);
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(
"select " +
"rnd_str(4,4,4) s, " +
"rnd_int(0, 256, 4) i, " +
s +
"timestamp_sequence(to_timestamp(0),10000) t, " +
"rnd_float(4) f, " +
"rnd_short() _short, " +
"rnd_long(0, 10000000, 5) l, " +
"rnd_timestamp(to_timestamp('2015','yyyy'),to_timestamp('2016','yyyy'),2) ts2, " +
"rnd_byte(0,127) bb, " +
"rnd_boolean() b, " +
"rnd_symbol(4,4,4,2), " +
"rnd_date(to_date('2015', 'yyyy'), to_date('2016', 'yyyy'), 2)," +
"rnd_bin(10,20,2) " +
"from long_sequence(50)");
final String expected = s2 +
"null,57,0.62500000,1970-01-01 00:00:00.0,0.4620,-1593,3425232,null,121,false,PEHN,2015-03-17 04:25:52.765,00000000 19 c4 95 94 36 53 49 b4 59 7e 3b 08 a1 1e\n" +
"XYSB,142,0.57900000,1970-01-01 00:00:00.01,0.9690,20088,1517490,2015-01-17 20:41:19.480685,100,true,PEHN,2015-06-20 01:10:58.599,00000000 79 5f 8b 81 2b 93 4d 1a 8e 78 b5 b9 11 53 d0 fb\n" +
"00000010 64\n" +
"OZZV,219,0.16400000,1970-01-01 00:00:00.02,0.6590,-12303,9489508,2015-08-13 17:10:19.752521,6,false,null,2015-05-20 01:48:37.418,00000000 2b 4d 5f f6 46 90 c3 b3 59 8e e5 61 2f 64 0e\n" +
"OLYX,30,0.71300000,1970-01-01 00:00:00.03,0.6550,6610,6504428,2015-08-08 00:42:24.545639,123,false,null,2015-01-03 13:53:03.165,null\n" +
"TIQB,42,0.68100000,1970-01-01 00:00:00.04,0.6260,-1605,8814086,2015-07-28 15:08:53.462495,28,true,CPSW,null,00000000 3b a6 dc 3b 7d 2b e3 92 fe 69 38 e1 77 9a\n" +
"LTOV,137,0.76300000,1970-01-01 00:00:00.05,0.8820,9054,null,2015-04-20 05:09:03.580574,106,false,PEHN,2015-01-09 06:57:17.512,null\n" +
"ZIMN,125,null,1970-01-01 00:00:00.06,null,11524,8335261,2015-10-26 02:10:50.688394,111,true,PEHN,2015-08-21 15:46:32.624,null\n" +
"OPJO,168,0.10500000,1970-01-01 00:00:00.07,0.5350,-5920,7080704,2015-07-11 09:15:38.342717,103,false,VTJW,null,null\n" +
"GLUO,145,0.53900000,1970-01-01 00:00:00.08,0.7670,14242,2499922,2015-11-02 09:01:31.312804,84,false,PEHN,2015-11-14 17:37:36.043,null\n" +
"ZVQE,103,0.67300000,1970-01-01 00:00:00.09,null,13727,7875846,2015-12-12 13:16:26.134562,22,true,PEHN,2015-01-20 04:50:34.098,00000000 14 33 80 c9 eb a3 67 7a 1a 79 e4 35 e4 3a dc 5c\n" +
"00000010 65 ff\n" +
"LIGY,199,0.28400000,1970-01-01 00:00:00.1,null,30426,3215562,2015-08-21 14:55:07.055722,11,false,VTJW,null,00000000 ff 70 3a c7 8a b3 14 cd 47 0b 0c 39 12\n" +
"MQNT,43,0.58600000,1970-01-01 00:00:00.11,0.3350,27019,null,null,27,true,PEHN,2015-07-12 12:59:47.665,00000000 26 fb 2e 42 fa f5 6e 8f 80 e3 54 b8 07 b1 32 57\n" +
"00000010 ff 9a ef\n" +
"WWCC,213,0.76700000,1970-01-01 00:00:00.12,0.5800,13640,4121923,2015-08-06 02:27:30.469762,73,false,PEHN,2015-04-30 08:18:10.453,00000000 71 a7 d5 af 11 96 37 08 dd 98 ef 54 88 2a a2 ad\n" +
"00000010 e7 d4\n" +
"VFGP,120,0.84000000,1970-01-01 00:00:00.13,0.7730,7223,7241423,2015-12-18 07:32:18.456025,43,false,VTJW,null,00000000 24 4e 44 a8 0d fe 27 ec 53 13 5d b2 15 e7 b8 35\n" +
"00000010 67\n" +
"RMDG,134,0.11000000,1970-01-01 00:00:00.14,0.0430,21227,7155708,2015-07-03 04:12:45.774281,42,true,CPSW,2015-02-24 12:10:43.199,null\n" +
"WFOQ,255,null,1970-01-01 00:00:00.15,0.1160,31569,6688277,2015-05-19 03:30:45.779999,126,true,PEHN,2015-12-09 09:57:17.078,null\n" +
"MXDK,56,1.00000000,1970-01-01 00:00:00.16,0.5230,-32372,6884132,null,58,false,null,2015-01-20 06:18:18.583,null\n" +
"XMKJ,139,0.84100000,1970-01-01 00:00:00.17,0.3060,25856,null,2015-05-18 03:50:22.731437,2,true,VTJW,2015-06-25 10:45:01.014,00000000 00 7c fb 01 19 ca f2 bf 84 5a 6f 38 35\n" +
"VIHD,null,null,1970-01-01 00:00:00.18,0.5500,22280,9109842,2015-01-25 13:51:38.270583,94,false,CPSW,2015-10-27 02:52:19.935,00000000 2d 16 f3 89 a3 83 64 de d6 fd c4 5b c4 e9\n" +
"WPNX,null,0.94700000,1970-01-01 00:00:00.19,0.4150,-17933,674261,2015-03-04 15:43:15.213686,43,true,HYRX,2015-12-18 21:28:25.325,00000000 b3 4c 0e 8f f1 0c c5 60 b7 d1\n" +
"YPOV,36,0.67400000,1970-01-01 00:00:00.2,0.0310,-5888,1375423,2015-12-10 20:50:35.866614,3,true,null,2015-07-23 20:17:04.236,00000000 d4 ab be 30 fa 8d ac 3d 98 a0 ad 9a 5d\n" +
"NUHN,null,0.69400000,1970-01-01 00:00:00.21,0.3390,-25226,3524748,2015-05-07 04:07:18.152968,39,true,VTJW,2015-04-04 15:23:34.13,00000000 b8 be f8 a1 46 87 28 92 a3 9b e3 cb c2 64 8a b0\n" +
"00000010 35 d8\n" +
"BOSE,240,0.06000000,1970-01-01 00:00:00.22,0.3790,23904,9069339,2015-03-21 03:42:42.643186,84,true,null,null,null\n" +
"INKG,124,0.86200000,1970-01-01 00:00:00.23,0.4040,-30383,7233542,2015-07-21 16:42:47.012148,99,false,null,2015-08-27 17:25:35.308,00000000 87 fc 92 83 fc 88 f3 32 27 70 c8 01 b0 dc c9 3a\n" +
"00000010 5b 7e\n" +
"FUXC,52,0.74300000,1970-01-01 00:00:00.24,null,-14729,1042064,2015-08-21 02:10:58.949674,28,true,CPSW,2015-08-29 20:15:51.835,null\n" +
"UNYQ,71,0.44200000,1970-01-01 00:00:00.25,0.5390,-22611,null,2015-12-23 18:41:42.319859,98,true,PEHN,2015-01-26 00:55:50.202,00000000 28 ed 97 99 d8 77 33 3f b2 67 da 98 47 47 bf\n" +
"KBMQ,null,0.28000000,1970-01-01 00:00:00.26,null,12240,null,2015-08-16 01:02:55.766622,21,false,null,2015-05-19 00:47:18.698,00000000 6a de 46 04 d3 81 e7 a2 16 22 35 3b 1c\n" +
"JSOL,243,null,1970-01-01 00:00:00.27,0.0680,-17468,null,null,20,true,null,2015-06-19 10:38:54.483,00000000 3d e0 2d 04 86 e7 ca 29 98 07 69 ca 5b d6 cf 09\n" +
"00000010 69\n" +
"HNSS,150,null,1970-01-01 00:00:00.28,0.1480,14841,5992443,null,25,false,PEHN,null,00000000 14 d6 fc ee 03 22 81 b8 06 c4 06 af\n" +
"PZPB,101,0.06200000,1970-01-01 00:00:00.29,null,12237,9878179,2015-09-03 22:13:18.852465,79,false,VTJW,2015-12-17 15:12:54.958,00000000 12 61 3a 9a ad 98 2e 75 52 ad 62 87 88 45 b9 9d\n" +
"OYNN,25,0.33900000,1970-01-01 00:00:00.3,0.6280,22412,4736378,2015-10-10 12:19:42.528224,106,true,CPSW,2015-07-01 00:23:49.789,00000000 54 13 3f ff b6 7e cd 04 27 66 94 89 db\n" +
"null,117,0.56400000,1970-01-01 00:00:00.31,null,-5604,6353018,null,84,false,null,null,00000000 2b ad 25 07 db 62 44 33 6e 00 8e\n" +
"HVRI,233,0.22400000,1970-01-01 00:00:00.32,0.4250,10469,1715213,null,86,false,null,2015-02-02 05:48:17.373,null\n" +
"OYTO,96,0.74100000,1970-01-01 00:00:00.33,0.5280,-12239,3499620,2015-02-07 22:35:03.212268,17,false,PEHN,2015-03-29 12:55:11.682,null\n" +
"LFCY,63,0.72200000,1970-01-01 00:00:00.34,null,23344,9523982,null,123,false,CPSW,2015-05-18 04:35:27.228,00000000 05 e5 c0 4e cc d6 e3 7b 34 cd 15 35 bb a4\n" +
"GHLX,148,0.30600000,1970-01-01 00:00:00.35,0.6360,-31457,2322337,2015-10-22 12:06:05.544701,91,true,HYRX,2015-05-21 09:33:18.158,00000000 57 1d 91 72 30 04 b7 02 cb 03\n" +
"YTSZ,123,null,1970-01-01 00:00:00.36,0.5190,22534,4446236,2015-07-27 07:23:37.233711,53,false,CPSW,2015-01-13 04:37:10.036,null\n" +
"SWLU,251,null,1970-01-01 00:00:00.37,0.1790,7734,4082475,2015-10-21 18:24:34.400345,69,false,PEHN,2015-04-01 14:33:42.005,null\n" +
"TQJL,245,null,1970-01-01 00:00:00.38,0.8650,9516,929340,2015-05-28 04:18:18.640567,69,false,VTJW,2015-06-12 20:12:28.881,00000000 6c 3e 51 d7 eb b1 07 71 32 1f af 40 4e 8c 47\n" +
"REIJ,94,null,1970-01-01 00:00:00.39,0.1300,-29924,null,2015-03-20 22:14:46.204718,113,true,HYRX,2015-12-19 13:58:41.819,null\n" +
"HDHQ,94,0.72300000,1970-01-01 00:00:00.4,0.7300,19970,654131,2015-01-10 22:56:08.48045,84,true,null,2015-03-05 17:14:48.275,00000000 4f 56 6b 65 a4 53 38 e9 cd c1 a7 ee 86 75 ad a5\n" +
"00000010 2d 49\n" +
"UMEU,40,0.00800000,1970-01-01 00:00:00.41,0.8050,-11623,4599862,2015-11-20 04:02:44.335947,76,false,PEHN,2015-05-17 17:33:20.922,null\n" +
"YJIH,184,null,1970-01-01 00:00:00.42,0.3830,17614,3101671,2015-01-28 12:05:46.683001,105,true,null,2015-12-07 19:24:36.838,00000000 ec 69 cd 73 bb 9b c5 95 db 61 91 ce\n" +
"CYXG,27,0.29200000,1970-01-01 00:00:00.43,0.9530,3944,249165,null,67,true,null,2015-03-02 08:19:44.566,00000000 01 48 15 3e 0c 7f 3f 8f e4 b5 ab 34 21 29\n" +
"MRTG,143,0.02600000,1970-01-01 00:00:00.44,0.9430,-27320,1667842,2015-01-24 19:56:15.973109,11,false,null,2015-01-24 07:15:02.772,null\n" +
"DONP,246,0.65400000,1970-01-01 00:00:00.45,0.5560,27477,4160018,2015-12-14 03:40:05.911839,20,true,PEHN,2015-10-29 14:35:10.167,00000000 07 92 01 f5 6a a1 31 cd cb c2 a2 b4 8e 99\n" +
"IQXS,232,0.23100000,1970-01-01 00:00:00.46,0.0490,-18113,4005228,2015-06-11 13:00:07.248188,8,true,CPSW,2015-08-16 11:09:24.311,00000000 fa 1f 92 24 b1 b8 67 65 08 b7 f8 41 00\n" +
"null,178,null,1970-01-01 00:00:00.47,0.9030,-14626,2934570,2015-04-04 08:51:54.068154,88,true,null,2015-07-01 04:32:23.083,00000000 84 36 25 63 2b 63 61 43 1c 47 7d b6 46 ba bb 98\n" +
"00000010 ca 08 be a4\n" +
"HUWZ,94,0.11000000,1970-01-01 00:00:00.48,0.4200,-3736,5687514,2015-01-02 17:18:05.627633,74,false,null,2015-03-29 06:39:11.642,null\n" +
"SRED,66,0.11300000,1970-01-01 00:00:00.49,0.0600,-10543,3669377,2015-10-22 02:53:02.381351,77,true,PEHN,null,00000000 7c 3f d6 88 3a 93 ef 24 a5 e2 bc\n";
StringSink sink = new StringSink();
// dump metadata
assertResultSet(expected, sink, rs);
connection.close();
} finally {
running.set(false);
haltLatch.await();
}
});
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册