@Test public void testCollectData() { try { SearchRequest searchRequest = mock(SearchRequest.class); SearchCursor cursor = mock(SearchCursor.class); List<Entry> entries = new ArrayList<>(); Entry entry1 = mock(Entry.class); entries.add(entry1); when(ldapConnection.search(searchRequest)).thenReturn(cursor); doReturn(entries).when(queryRequestPagedExecutor).run(cursor); RoundtripResult roundtripResult = queryRequestPagedExecutor.collectData(ldapConnection, searchRequest); assertEquals(roundtripResult.getData(), entries); } catch (LdapException e) { e.printStackTrace(); } }
RoundtripResult collectData(LdapConnection connection, SearchRequest searchRequest) { RoundtripResult roundtripResult = new RoundtripResult(); List<Entry> results = new ArrayList<>(); SearchCursor cursor = null; try { cursor = connection.search(searchRequest); results = this.run(cursor); } catch (LdapException e) { LOGGER.error("Search failed", e.getStackTrace()); }finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Retrieving cookie. Data size: {}", results ==null ? "NaN" : results.size()); roundtripResult.setData(results); roundtripResult.setSearchCursor(cursor); return roundtripResult; }
QueryRequestPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest searchRequest) { RoundtripResult roundtripResult = new RoundtripResult(); List<Entry> results = new ArrayList<>(); SearchCursor cursor = null; try { cursor = connection.search(searchRequest); results = this.run(cursor); } catch (LdapException e) { LOGGER.error("Search failed", e.getStackTrace()); }finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Retrieving cookie. Data size: {}", results ==null ? "NaN" : results.size()); roundtripResult.setData(results); roundtripResult.setSearchCursor(cursor); return roundtripResult; } }
QueryRequestPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest searchRequest) { RoundtripResult roundtripResult = new RoundtripResult(); List<Entry> results = new ArrayList<>(); SearchCursor cursor = null; try { cursor = connection.search(searchRequest); results = this.run(cursor); } catch (LdapException e) { LOGGER.error("Search failed", e.getStackTrace()); }finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Retrieving cookie. Data size: {}", results ==null ? "NaN" : results.size()); roundtripResult.setData(results); roundtripResult.setSearchCursor(cursor); return roundtripResult; } QueryRequestPagedExecutor(QueryRequest queryRequest); }
QueryRequestPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest searchRequest) { RoundtripResult roundtripResult = new RoundtripResult(); List<Entry> results = new ArrayList<>(); SearchCursor cursor = null; try { cursor = connection.search(searchRequest); results = this.run(cursor); } catch (LdapException e) { LOGGER.error("Search failed", e.getStackTrace()); }finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Retrieving cookie. Data size: {}", results ==null ? "NaN" : results.size()); roundtripResult.setData(results); roundtripResult.setSearchCursor(cursor); return roundtripResult; } QueryRequestPagedExecutor(QueryRequest queryRequest);  }
QueryRequestPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest searchRequest) { RoundtripResult roundtripResult = new RoundtripResult(); List<Entry> results = new ArrayList<>(); SearchCursor cursor = null; try { cursor = connection.search(searchRequest); results = this.run(cursor); } catch (LdapException e) { LOGGER.error("Search failed", e.getStackTrace()); }finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Retrieving cookie. Data size: {}", results ==null ? "NaN" : results.size()); roundtripResult.setData(results); roundtripResult.setSearchCursor(cursor); return roundtripResult; } QueryRequestPagedExecutor(QueryRequest queryRequest);   }