use of com.datastax.oss.simulacron.common.result.SuccessResult in project dsbulk by datastax.
the class EndToEndUtils method createQueryWithResultSet.
public static RequestPrime createQueryWithResultSet(String query, int numOfResults) {
Query when = new Query(query);
LinkedHashMap<String, String> columnTypes = new LinkedHashMap<>();
columnTypes.put("country_code", "varchar");
columnTypes.put("country_name", "varchar");
columnTypes.put("beginning_ip_address", "inet");
columnTypes.put("ending_ip_address", "inet");
columnTypes.put("beginning_ip_number", "bigint");
columnTypes.put("ending_ip_number", "bigint");
List<LinkedHashMap<String, Object>> rows = new ArrayList<>();
for (int i = 0; i < numOfResults; i++) {
LinkedHashMap<String, Object> row = new LinkedHashMap<>();
row.put("country_code", "country" + i);
row.put("country_name", "country" + i);
row.put("beginning_ip_address", "127.0.0.1");
row.put("ending_ip_address", "127.2.0.1");
row.put("beginning_ip_number", Integer.toString(i));
row.put("ending_ip_number", Integer.toString(i));
rows.add(row);
}
SuccessResult then = new SuccessResult(rows, columnTypes);
return new RequestPrime(when, then);
}
Aggregations