@@ -134,4 +134,221 @@ public void testTabular_withoutQuery() throws Exception {
134134 assertThat (response ).isNotNull ();
135135 assertThat (response .getLogs ().size ()).isEqualTo (response .getSize ());
136136 }
137+
138+ @ Test
139+ public void testTabular_withCombinedFilters_statusAndBody () throws Exception {
140+ TabularResponse response = logRepository .query (
141+ queryContext ,
142+ tabular ()
143+ .timeRange (lastDays (60 ), hours (1 ))
144+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
145+ .page (1 )
146+ .size (10 )
147+ .build ()
148+ );
149+
150+ assertThat (response ).isNotNull ();
151+ assertThat (response .getSize ()).isLessThanOrEqualTo (6 );
152+ assertThat (response .getLogs ()).hasSizeLessThanOrEqualTo ((int ) response .getSize ());
153+ }
154+
155+ @ Test
156+ public void testTabular_withCombinedFilters_pagination_page1 () throws Exception {
157+ TabularResponse response = logRepository .query (
158+ queryContext ,
159+ tabular ()
160+ .timeRange (lastDays (60 ), hours (1 ))
161+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
162+ .page (1 )
163+ .size (3 )
164+ .build ()
165+ );
166+
167+ assertThat (response ).isNotNull ();
168+ long totalSize = response .getSize ();
169+ assertThat (response .getLogs ()).hasSizeLessThanOrEqualTo (3 );
170+ assertThat (totalSize ).isGreaterThanOrEqualTo (response .getLogs ().size ());
171+ }
172+
173+ @ Test
174+ public void testTabular_withCombinedFilters_pagination_page2 () throws Exception {
175+ TabularResponse responsePage1 = logRepository .query (
176+ queryContext ,
177+ tabular ()
178+ .timeRange (lastDays (60 ), hours (1 ))
179+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
180+ .page (1 )
181+ .size (3 )
182+ .build ()
183+ );
184+
185+ TabularResponse responsePage2 = logRepository .query (
186+ queryContext ,
187+ tabular ()
188+ .timeRange (lastDays (60 ), hours (1 ))
189+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
190+ .page (2 )
191+ .size (3 )
192+ .build ()
193+ );
194+
195+ assertThat (responsePage2 ).isNotNull ();
196+ assertThat (responsePage2 .getSize ()).isEqualTo (responsePage1 .getSize ());
197+ int expectedPage2Size = (int ) Math .max (0 , responsePage1 .getSize () - 3 );
198+ assertThat (responsePage2 .getLogs ()).hasSizeLessThanOrEqualTo (expectedPage2Size );
199+ }
200+
201+ @ Test
202+ public void testTabular_withCombinedFilters_differentPageSizes () throws Exception {
203+ TabularResponse responseSize10 = logRepository .query (
204+ queryContext ,
205+ tabular ()
206+ .timeRange (lastDays (60 ), hours (1 ))
207+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
208+ .page (1 )
209+ .size (10 )
210+ .build ()
211+ );
212+
213+ TabularResponse responseSize15 = logRepository .query (
214+ queryContext ,
215+ tabular ()
216+ .timeRange (lastDays (60 ), hours (1 ))
217+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
218+ .page (1 )
219+ .size (15 )
220+ .build ()
221+ );
222+
223+ TabularResponse responseSize100 = logRepository .query (
224+ queryContext ,
225+ tabular ()
226+ .timeRange (lastDays (60 ), hours (1 ))
227+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
228+ .page (1 )
229+ .size (100 )
230+ .build ()
231+ );
232+ assertThat (responseSize10 .getSize ()).isEqualTo (responseSize15 .getSize ()).isEqualTo (responseSize100 .getSize ());
233+ }
234+
235+ @ Test
236+ public void testTabular_bodyFilterOnly_pagination_consistent () throws Exception {
237+ String bodyQuery = "client-response.body:*not valid or is expired*" ;
238+
239+ TabularResponse response1 = logRepository .query (
240+ queryContext ,
241+ tabular ().timeRange (lastDays (60 ), hours (1 )).query (bodyQuery ).page (1 ).size (10 ).build ()
242+ );
243+
244+ TabularResponse response2 = logRepository .query (
245+ queryContext ,
246+ tabular ().timeRange (lastDays (60 ), hours (1 )).query (bodyQuery ).page (1 ).size (15 ).build ()
247+ );
248+
249+ // Total should be consistent
250+ assertThat (response1 .getSize ()).isEqualTo (response2 .getSize ());
251+ assertThat (response1 .getSize ()).isEqualTo (6 );
252+ }
253+
254+ @ Test
255+ public void testTabular_emptyResults_withCombinedFilters () throws Exception {
256+ TabularResponse response = logRepository .query (
257+ queryContext ,
258+ tabular ()
259+ .timeRange (lastDays (60 ), hours (1 ))
260+ .query ("status:999 AND client-response.body:*nonexistent-text-12345*" )
261+ .page (1 )
262+ .size (10 )
263+ .build ()
264+ );
265+
266+ assertThat (response ).isNotNull ();
267+ assertThat (response .getSize ()).isZero ();
268+ assertThat (response .getLogs ()).isEmpty ();
269+ }
270+
271+ @ Test
272+ public void testTabular_statusFilterOnly () throws Exception {
273+ TabularResponse response = logRepository .query (
274+ queryContext ,
275+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("status:200" ).page (1 ).size (10 ).build ()
276+ );
277+
278+ assertThat (response ).isNotNull ();
279+ assertThat (response .getSize ()).isGreaterThan (0 );
280+ assertThat (response .getLogs ()).isNotEmpty ();
281+ }
282+
283+ @ Test
284+ public void testTabular_multipleStatusFilters_withBody () throws Exception {
285+ TabularResponse response = logRepository .query (
286+ queryContext ,
287+ tabular ()
288+ .timeRange (lastDays (60 ), hours (1 ))
289+ .query ("status:200 AND client-response.body:*not valid or is expired*" )
290+ .page (1 )
291+ .size (10 )
292+ .build ()
293+ );
294+
295+ assertThat (response ).isNotNull ();
296+ assertThat (response .getLogs ()).hasSizeLessThanOrEqualTo ((int ) response .getSize ());
297+ }
298+
299+ @ Test
300+ public void testTabular_paginationBeyondResults () throws Exception {
301+ TabularResponse responsePage1 = logRepository .query (
302+ queryContext ,
303+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("client-response.body:*not valid or is expired*" ).page (1 ).size (10 ).build ()
304+ );
305+
306+ // Request page 10 when we only have 6 results
307+ TabularResponse responsePage10 = logRepository .query (
308+ queryContext ,
309+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("client-response.body:*not valid or is expired*" ).page (10 ).size (10 ).build ()
310+ );
311+
312+ assertThat (responsePage10 ).isNotNull ();
313+ assertThat (responsePage10 .getSize ()).isEqualTo (responsePage1 .getSize ()); // Total should be same
314+ assertThat (responsePage10 .getLogs ()).isEmpty (); // No results on page 10
315+ }
316+
317+ @ Test
318+ public void testTabular_largePaginationSize () throws Exception {
319+ TabularResponse response = logRepository .query (
320+ queryContext ,
321+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("client-response.body:*not valid or is expired*" ).page (1 ).size (1000 ).build ()
322+ );
323+
324+ assertThat (response ).isNotNull ();
325+ assertThat (response .getSize ()).isEqualTo (6 );
326+ assertThat (response .getLogs ()).hasSize (6 ); // Should return all available results
327+ }
328+
329+ @ Test
330+ public void testTabular_caseInsensitiveBodySearch () throws Exception {
331+ TabularResponse responseLower = logRepository .query (
332+ queryContext ,
333+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("client-response.body:*not valid*" ).page (1 ).size (10 ).build ()
334+ );
335+
336+ TabularResponse responseUpper = logRepository .query (
337+ queryContext ,
338+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("client-response.body:*NOT VALID*" ).page (1 ).size (10 ).build ()
339+ );
340+ assertThat (responseLower ).isNotNull ();
341+ assertThat (responseUpper ).isNotNull ();
342+ }
343+
344+ @ Test
345+ public void testTabular_complexQuery_multipleConditions () throws Exception {
346+ TabularResponse response = logRepository .query (
347+ queryContext ,
348+ tabular ().timeRange (lastDays (60 ), hours (1 )).query ("status:200 AND client-response.body:*valid*" ).page (1 ).size (10 ).build ()
349+ );
350+
351+ assertThat (response ).isNotNull ();
352+ assertThat (response .getLogs ()).hasSizeLessThanOrEqualTo ((int ) response .getSize ());
353+ }
137354}
0 commit comments