@Test(groups = "io", dataProvider = "ldif") public void read(final Reader actual, final SearchResponse expected) throws Exception { final LdifReader reader = new LdifReader(actual); Assert.assertEquals(reader.read(), expected); }
@Override public SearchResponse read() throws IOException { final SearchResponse result = new SearchResponse(); final BufferedReader br = new BufferedReader(ldifReader); String line; br.mark(READ_AHEAD_LIMIT); while ((line = br.readLine()) != null) { if (!"".equals(line)) { br.reset(); final List<String> section = readSection(br); if (!section.isEmpty()) { if (section.get(0).startsWith("version")) { section.remove(0); } if (!section.isEmpty()) { if (section.get(0).startsWith("dn")) { result.addEntries(parseEntry(section)); } else if (section.get(0).startsWith("ref")) { result.addReferences(parseReference(section)); } else { logger.debug("Unknown LDIF section {}", section.get(0)); } } } } br.mark(READ_AHEAD_LIMIT); } return result; }
LdifReader implements SearchResultReader { @Override public SearchResponse read() throws IOException { final SearchResponse result = new SearchResponse(); final BufferedReader br = new BufferedReader(ldifReader); String line; br.mark(READ_AHEAD_LIMIT); while ((line = br.readLine()) != null) { if (!"".equals(line)) { br.reset(); final List<String> section = readSection(br); if (!section.isEmpty()) { if (section.get(0).startsWith("version")) { section.remove(0); } if (!section.isEmpty()) { if (section.get(0).startsWith("dn")) { result.addEntries(parseEntry(section)); } else if (section.get(0).startsWith("ref")) { result.addReferences(parseReference(section)); } else { logger.debug("Unknown LDIF section {}", section.get(0)); } } } } br.mark(READ_AHEAD_LIMIT); } return result; } }
LdifReader implements SearchResultReader { @Override public SearchResponse read() throws IOException { final SearchResponse result = new SearchResponse(); final BufferedReader br = new BufferedReader(ldifReader); String line; br.mark(READ_AHEAD_LIMIT); while ((line = br.readLine()) != null) { if (!"".equals(line)) { br.reset(); final List<String> section = readSection(br); if (!section.isEmpty()) { if (section.get(0).startsWith("version")) { section.remove(0); } if (!section.isEmpty()) { if (section.get(0).startsWith("dn")) { result.addEntries(parseEntry(section)); } else if (section.get(0).startsWith("ref")) { result.addReferences(parseReference(section)); } else { logger.debug("Unknown LDIF section {}", section.get(0)); } } } } br.mark(READ_AHEAD_LIMIT); } return result; } LdifReader(final Reader reader); }
LdifReader implements SearchResultReader { @Override public SearchResponse read() throws IOException { final SearchResponse result = new SearchResponse(); final BufferedReader br = new BufferedReader(ldifReader); String line; br.mark(READ_AHEAD_LIMIT); while ((line = br.readLine()) != null) { if (!"".equals(line)) { br.reset(); final List<String> section = readSection(br); if (!section.isEmpty()) { if (section.get(0).startsWith("version")) { section.remove(0); } if (!section.isEmpty()) { if (section.get(0).startsWith("dn")) { result.addEntries(parseEntry(section)); } else if (section.get(0).startsWith("ref")) { result.addReferences(parseReference(section)); } else { logger.debug("Unknown LDIF section {}", section.get(0)); } } } } br.mark(READ_AHEAD_LIMIT); } return result; } LdifReader(final Reader reader); @Override SearchResponse read(); }
LdifReader implements SearchResultReader { @Override public SearchResponse read() throws IOException { final SearchResponse result = new SearchResponse(); final BufferedReader br = new BufferedReader(ldifReader); String line; br.mark(READ_AHEAD_LIMIT); while ((line = br.readLine()) != null) { if (!"".equals(line)) { br.reset(); final List<String> section = readSection(br); if (!section.isEmpty()) { if (section.get(0).startsWith("version")) { section.remove(0); } if (!section.isEmpty()) { if (section.get(0).startsWith("dn")) { result.addEntries(parseEntry(section)); } else if (section.get(0).startsWith("ref")) { result.addReferences(parseReference(section)); } else { logger.debug("Unknown LDIF section {}", section.get(0)); } } } } br.mark(READ_AHEAD_LIMIT); } return result; } LdifReader(final Reader reader); @Override SearchResponse read();  }