testDatabase.setUpDatabase();
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("login", "login");
SqlDataLoader sqlDataLoader = new SqlDataLoader(testDatabase.getDs());
BandData rootBand = new BandData("band1", null, BandOrientation.HORIZONTAL);
rootBand.setData(Collections.<String, Object>emptyMap());
List<Map<String, Object>> result = sqlDataLoader.loadData(
new ReportQueryImpl("", "select login, password from user where login = CONCAT(${login}, '1')", "sql", null, null), rootBand, params);
printResult(result);
Assert.assertEquals(1, result.size());
params.put("login", null);
result = sqlDataLoader.loadData(
new ReportQueryImpl("", "select login, password from user [[where login = CONCAT(${login}, '1')]]", "sql", null, null), rootBand, params);
printResult(result);
Assert.assertEquals(3, result.size());
params.put("login", "ABCD");
result = sqlDataLoader.loadData(
new ReportQueryImpl("", "select login, password from user [[where login = CONCAT(${login}, '1')]]", "sql", null, null), rootBand, params);
printResult(result);
Assert.assertEquals(0, result.size());
} catch (Exception e) {
e.printStackTrace();