|
@@ -32,11 +32,11 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
TestTerminal testTerminal = new TestTerminal();
|
|
|
HttpClient client = mock(HttpClient.class);
|
|
|
CliSession cliSession = new CliSession(client);
|
|
|
- when(client.basicQuery("blah", 1000, false)).thenThrow(new SQLException("test exception"));
|
|
|
+ when(client.basicQuery("blah", 1000, false, false)).thenThrow(new SQLException("test exception"));
|
|
|
ServerQueryCliCommand cliCommand = new ServerQueryCliCommand();
|
|
|
assertTrue(cliCommand.handle(testTerminal, cliSession, "blah"));
|
|
|
assertEquals("<b>Bad request [</b><i>test exception</i><b>]</b>\n", testTerminal.toString());
|
|
|
- verify(client, times(1)).basicQuery(eq("blah"), eq(1000), eq(false));
|
|
|
+ verify(client, times(1)).basicQuery(eq("blah"), eq(1000), eq(false), eq(false));
|
|
|
verifyNoMoreInteractions(client);
|
|
|
}
|
|
|
|
|
@@ -45,7 +45,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
HttpClient client = mock(HttpClient.class);
|
|
|
CliSession cliSession = new CliSession(client);
|
|
|
cliSession.cfg().setFetchSize(10);
|
|
|
- when(client.basicQuery("test query", 10, false)).thenReturn(fakeResponse("", true, "foo"));
|
|
|
+ when(client.basicQuery("test query", 10, false, false)).thenReturn(fakeResponse("", true, "foo"));
|
|
|
ServerQueryCliCommand cliCommand = new ServerQueryCliCommand();
|
|
|
assertTrue(cliCommand.handle(testTerminal, cliSession, "test query"));
|
|
|
assertEquals("""
|
|
@@ -53,7 +53,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
---------------
|
|
|
foo \s
|
|
|
<flush/>""", testTerminal.toString());
|
|
|
- verify(client, times(1)).basicQuery(eq("test query"), eq(10), eq(false));
|
|
|
+ verify(client, times(1)).basicQuery(eq("test query"), eq(10), eq(false), eq(false));
|
|
|
verifyNoMoreInteractions(client);
|
|
|
}
|
|
|
|
|
@@ -62,7 +62,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
HttpClient client = mock(HttpClient.class);
|
|
|
CliSession cliSession = new CliSession(client);
|
|
|
cliSession.cfg().setFetchSize(10);
|
|
|
- when(client.basicQuery("test query", 10, false)).thenReturn(fakeResponse("my_cursor1", true, "first"));
|
|
|
+ when(client.basicQuery("test query", 10, false, false)).thenReturn(fakeResponse("my_cursor1", true, "first"));
|
|
|
when(client.nextPage("my_cursor1")).thenReturn(fakeResponse("my_cursor2", false, "second"));
|
|
|
when(client.nextPage("my_cursor2")).thenReturn(fakeResponse("", false, "third"));
|
|
|
ServerQueryCliCommand cliCommand = new ServerQueryCliCommand();
|
|
@@ -74,7 +74,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
second \s
|
|
|
third \s
|
|
|
<flush/>""", testTerminal.toString());
|
|
|
- verify(client, times(1)).basicQuery(eq("test query"), eq(10), eq(false));
|
|
|
+ verify(client, times(1)).basicQuery(eq("test query"), eq(10), eq(false), eq(false));
|
|
|
verify(client, times(2)).nextPage(any());
|
|
|
verifyNoMoreInteractions(client);
|
|
|
}
|
|
@@ -86,7 +86,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
cliSession.cfg().setFetchSize(15);
|
|
|
// Set a separator
|
|
|
cliSession.cfg().setFetchSeparator("-----");
|
|
|
- when(client.basicQuery("test query", 15, false)).thenReturn(fakeResponse("my_cursor1", true, "first"));
|
|
|
+ when(client.basicQuery("test query", 15, false, false)).thenReturn(fakeResponse("my_cursor1", true, "first"));
|
|
|
when(client.nextPage("my_cursor1")).thenReturn(fakeResponse("", false, "second"));
|
|
|
ServerQueryCliCommand cliCommand = new ServerQueryCliCommand();
|
|
|
assertTrue(cliCommand.handle(testTerminal, cliSession, "test query"));
|
|
@@ -97,7 +97,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
-----
|
|
|
second \s
|
|
|
<flush/>""", testTerminal.toString());
|
|
|
- verify(client, times(1)).basicQuery(eq("test query"), eq(15), eq(false));
|
|
|
+ verify(client, times(1)).basicQuery(eq("test query"), eq(15), eq(false), eq(false));
|
|
|
verify(client, times(1)).nextPage(any());
|
|
|
verifyNoMoreInteractions(client);
|
|
|
}
|
|
@@ -107,7 +107,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
HttpClient client = mock(HttpClient.class);
|
|
|
CliSession cliSession = new CliSession(client);
|
|
|
cliSession.cfg().setFetchSize(15);
|
|
|
- when(client.basicQuery("test query", 15, false)).thenReturn(fakeResponse("my_cursor1", true, "first"));
|
|
|
+ when(client.basicQuery("test query", 15, false, false)).thenReturn(fakeResponse("my_cursor1", true, "first"));
|
|
|
when(client.nextPage("my_cursor1")).thenThrow(new SQLException("test exception"));
|
|
|
when(client.queryClose("my_cursor1", Mode.CLI)).thenReturn(true);
|
|
|
ServerQueryCliCommand cliCommand = new ServerQueryCliCommand();
|
|
@@ -118,7 +118,7 @@ public class ServerQueryCliCommandTests extends SqlCliTestCase {
|
|
|
first \s
|
|
|
<b>Bad request [</b><i>test exception</i><b>]</b>
|
|
|
""", testTerminal.toString());
|
|
|
- verify(client, times(1)).basicQuery(eq("test query"), eq(15), eq(false));
|
|
|
+ verify(client, times(1)).basicQuery(eq("test query"), eq(15), eq(false), eq(false));
|
|
|
verify(client, times(1)).nextPage(any());
|
|
|
verify(client, times(1)).queryClose(eq("my_cursor1"), eq(Mode.CLI));
|
|
|
verifyNoMoreInteractions(client);
|