SQLQueryRequest { public boolean isSupported() { return !isExplainRequest() && isOnlyQueryFieldInPayload() && isDefaultFormat(); }  boolean isSupported();  }
@Test public void shouldSupportQuery() { SQLQueryRequest request = SQLQueryRequestBuilder.request("SELECT 1").build(); assertTrue(request.isSupported()); }
@Test public void shouldSupportQueryWithJDBCFormat() { SQLQueryRequest request = SQLQueryRequestBuilder.request("SELECT 1") .format("jdbc") .build(); assertTrue(request.isSupported()); }
@Test public void shouldSupportQueryWithZeroFetchSize() { SQLQueryRequest request = SQLQueryRequestBuilder.request("SELECT 1") .jsonContent("{\"query\": \"SELECT 1\", \"fetch_size\": 0}") .build(); assertTrue(request.isSupported()); }
@Test public void shouldNotSupportExplain() { SQLQueryRequest explainRequest = SQLQueryRequestBuilder.request("SELECT 1") .path("_opendistro/_sql/_explain") .build(); assertFalse(explainRequest.isSupported()); }
@Test public void shouldNotSupportCursorRequest() { SQLQueryRequest fetchSizeRequest = SQLQueryRequestBuilder.request("SELECT 1") .jsonContent("{\"query\": \"SELECT 1\", \"fetch_size\": 5}") .build(); assertFalse(fetchSizeRequest.isSupported()); SQLQueryRequest cursorRequest = SQLQueryRequestBuilder.request("SELECT 1") .jsonContent("{\"cursor\": \"abcdefgh...\"}") .build(); assertFalse(cursorRequest.isSupported()); }
@Test public void shouldNotSupportCSVFormat() { SQLQueryRequest csvRequest = SQLQueryRequestBuilder.request("SELECT 1") .format("csv") .build(); assertFalse(csvRequest.isSupported()); }