static List<Object> performTest(int rowcnt, int colCount, ObjectExecution exec) throws TranslatorException { exec.execute(); List<Object> rows = new ArrayList<Object>(); int cnt = 0; List<?> row = exec.next(); while (row != null) { rows.add(row); assertEquals("column count doesnt match", colCount, row.size()); ++cnt; row = exec.next(); } assertEquals("Did not get expected number of rows", rowcnt, cnt); // $NON-NLS-1$ exec.close(); return rows; }
private static Query createLikeQuery( Column column, String value, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) { Query queryKey = queryBuilder .phrase() .onField(ObjectExecution.getNameInSource(column)) .sentence(value) .createQuery(); junction.should(queryKey); return queryKey; }
private static Query createRangeBelowQuery( Column column, Object value, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) { Query queryKey = queryBuilder .range() .onField(ObjectExecution.getNameInSource(column)) .below(value) .excludeLimit() .createQuery(); junction.must(queryKey); return queryKey; }
private static Query createEqualsQuery( Column column, Object value, boolean and, boolean not, BooleanJunction<BooleanJunction> junction, QueryBuilder queryBuilder) { Query queryKey = queryBuilder .keyword() .onField(ObjectExecution.getNameInSource(column)) .matching(value) .createQuery(); if (not) { junction.must(queryKey).not(); } else if (and) { junction.must(queryKey); } else { junction.should(queryKey); } return queryKey; }