WindowParametersHelper { public static long getWindowSize( long windowSize, boolean timeBased, int maxRows, long maxTime ) { windowSize = windowSize <= 0 ? 0 : ( timeBased ? Math.min( windowSize, maxTime ) : Math.min( windowSize, maxRows ) ); return windowSize; }  static String getCacheKey( String query, IDataServiceClientService.StreamingMode windowMode, long windowSize, long windowEvery,
                                    int windowMaxRowLimit, long windowMaxTimeLimit, long windowLimit, int serviceExecutorCacheKeyHash ); static long getWindowEvery( long windowEvery, boolean timeBased, int maxRows, long maxTime ); static long getWindowSize( long windowSize, boolean timeBased, int maxRows, long maxTime ); static long getMaxTime( long windowMaxTimeLimit, long windowLimit, boolean rowBased ); static int getMaxRows( int windowMaxRowLimit, long windowLimit, boolean timeBased );  }
@Test public void testGetWindowSizeRowMode() { assertEquals( 100, WindowParametersHelper.getWindowSize( 1000, false, 100, 10000 ) ); assertEquals( 1000, WindowParametersHelper.getWindowSize( 1000, false, 2000, 500 ) ); assertEquals( 100, WindowParametersHelper.getWindowSize( 1000, false, 100, 500 ) ); assertEquals( 1000, WindowParametersHelper.getWindowSize( 1000, false, 2000, 3000 ) ); }
@Test public void testGetWindowSizeTimeMode() { assertEquals( 1000, WindowParametersHelper.getWindowSize( 1000, true, 100, 10000 ) ); assertEquals( 500, WindowParametersHelper.getWindowSize( 1000, true, 2000, 500 ) ); assertEquals( 500, WindowParametersHelper.getWindowSize( 1000, true, 100, 500 ) ); assertEquals( 1000, WindowParametersHelper.getWindowSize( 1000, true, 2000, 3000 ) ); }