@Test public void testCollectData() { try { when(ldapConnection.search(any(SearchRequest.class))).thenReturn(mock(SearchCursor.class)); doReturn(null).when(queryRequestNonPagedExecutor).run(any(SearchCursor.class)); RoundtripResult roundtripResult = queryRequestNonPagedExecutor.collectData(ldapConnection, mock(SearchRequest.class)); assertNotNull(roundtripResult); } catch (LdapException e) { e.printStackTrace(); } }
RoundtripResult collectData(LdapConnection connection, SearchRequest search) { RoundtripResult roundtripResult = new RoundtripResult(); SearchCursor cursor = null; List<Entry> result = new ArrayList<>(); try { cursor = connection.search(search); result = this.run(cursor); roundtripResult.setData(result); } catch (LdapException e) { LOGGER.error("Can't execute non-paged LDAP query", e.getStackTrace()); } finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Collect Data. Data size:", result == null ? "NaN" : result.size()); return roundtripResult; }
QueryRequestNonPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest search) { RoundtripResult roundtripResult = new RoundtripResult(); SearchCursor cursor = null; List<Entry> result = new ArrayList<>(); try { cursor = connection.search(search); result = this.run(cursor); roundtripResult.setData(result); } catch (LdapException e) { LOGGER.error("Can't execute non-paged LDAP query", e.getStackTrace()); } finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Collect Data. Data size:", result == null ? "NaN" : result.size()); return roundtripResult; } }
QueryRequestNonPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest search) { RoundtripResult roundtripResult = new RoundtripResult(); SearchCursor cursor = null; List<Entry> result = new ArrayList<>(); try { cursor = connection.search(search); result = this.run(cursor); roundtripResult.setData(result); } catch (LdapException e) { LOGGER.error("Can't execute non-paged LDAP query", e.getStackTrace()); } finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Collect Data. Data size:", result == null ? "NaN" : result.size()); return roundtripResult; } QueryRequestNonPagedExecutor(QueryRequest queryRequest); }
QueryRequestNonPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest search) { RoundtripResult roundtripResult = new RoundtripResult(); SearchCursor cursor = null; List<Entry> result = new ArrayList<>(); try { cursor = connection.search(search); result = this.run(cursor); roundtripResult.setData(result); } catch (LdapException e) { LOGGER.error("Can't execute non-paged LDAP query", e.getStackTrace()); } finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Collect Data. Data size:", result == null ? "NaN" : result.size()); return roundtripResult; } QueryRequestNonPagedExecutor(QueryRequest queryRequest);  }
QueryRequestNonPagedExecutor extends QueryRequestExecutor { RoundtripResult collectData(LdapConnection connection, SearchRequest search) { RoundtripResult roundtripResult = new RoundtripResult(); SearchCursor cursor = null; List<Entry> result = new ArrayList<>(); try { cursor = connection.search(search); result = this.run(cursor); roundtripResult.setData(result); } catch (LdapException e) { LOGGER.error("Can't execute non-paged LDAP query", e.getStackTrace()); } finally { if (cursor != null) { try { cursor.close(); } catch (IOException e) { LOGGER.error("Can't close cursor", e.getStackTrace()); } } } LOGGER.trace("Collect Data. Data size:", result == null ? "NaN" : result.size()); return roundtripResult; } QueryRequestNonPagedExecutor(QueryRequest queryRequest);   }