comparison tests/OnClientTester.java @ 544:c71ce17fa724 onclient

Add another error handling test
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 07 Sep 2021 13:30:14 +0200 (2021-09-07)
parents d462000fc410
children 79393647d7fb
comparison
equal deleted inserted replaced
543:70a827c6ced4 544:c71ce17fa724
208 MyUploadHandler handler = new MyUploadHandler(100, 50, "i don't like line 50"); 208 MyUploadHandler handler = new MyUploadHandler(100, 50, "i don't like line 50");
209 conn.setUploadHandler(handler); 209 conn.setUploadHandler(handler);
210 expectError("COPY INTO foo FROM 'banana' ON CLIENT", "i don't like"); 210 expectError("COPY INTO foo FROM 'banana' ON CLIENT", "i don't like");
211 assertEq("handler encountered write error", false, handler.encounteredWriteError()); 211 assertEq("handler encountered write error", false, handler.encounteredWriteError());
212 assertEq("connection is closed", true, conn.isClosed()); 212 assertEq("connection is closed", true, conn.isClosed());
213 }
214
215
216 public void test_FailUploadLate2() throws SQLException, Failure {
217 // Here we send empty lines only, to check if the server detects is properly instead
218 // of simply complaining about an incomplete file.
219 prepare();
220 UploadHandler handler = new UploadHandler() {
221 @Override
222 public void handleUpload(MonetConnection.Upload handle, String name, boolean textMode, int offset) throws IOException {
223 PrintStream stream = handle.getStream();
224 for (int i = 1; i <= 20_000; i++)
225 stream.println();
226 stream.flush();
227 throw new IOException("exception after all");
228 }
229 };
230 conn.setUploadHandler(handler);
231 expectError("COPY INTO foo(t) FROM 'banana'(t) ON CLIENT", "after all");
232 assertEq("connection is closed", true, conn.isClosed());
233 // Cannot check the server log, but at the time I checked, it said "prematurely stopped client", which is fine.
213 } 234 }
214 235
215 // Disabled because it hangs, triggering the watchdog timer 236 // Disabled because it hangs, triggering the watchdog timer
216 public void testx_FailDownloadLate() throws SQLException, Failure { 237 public void testx_FailDownloadLate() throws SQLException, Failure {
217 prepare(); 238 prepare();