use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method getRelationBogusData.
public static IPentahoResultSet getRelationBogusData() {
IPentahoResultSet ips = null;
ArrayList<String> colHeaders = new ArrayList();
colHeaders.add(0, "DEPARTMENT");
colHeaders.add(1, "ACTUAL");
colHeaders.add(2, "BUDGET");
ArrayList r1 = new ArrayList();
r1.add("Sales");
r1.add("11");
ArrayList r2 = new ArrayList();
r2.add("Finance");
r1.add("14");
ArrayList r3 = new ArrayList();
r3.add("Human Resource");
r1.add("15");
ArrayList data = new ArrayList();
data.add(r1);
data.add(r2);
data.add(r3);
ips = MemoryResultSet.createFromLists(colHeaders, data);
System.out.println(ips.getRowCount());
return ips;
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class PentahoFlashChartTest method testLineChart.
@Test
public void testLineChart() {
String chart = "<chart>" + "<chart-type>LineChart</chart-type>" + "</chart>";
IPentahoResultSet rs = getRelationData();
Node chartNode = getChartNode(chart);
String c2 = PentahoOFC4JChartHelper.generateChartJson(chartNode, rs, false, null);
assertJsonEquals("{\"y_axis\":{\"min\":0,\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\",\"stroke\":1,\"max\":110," + "\"steps\":10},\"x_legend\":{\"text\":\"DEPARTMENT\",\"style\":\"font-family: Arial; font-size: 14px; " + "font-weight: normal; font-style: normal;\"},\"elements\":[{\"colour\":\"#006666\",\"text\":\"ACTUAL\"," + "\"values\":[{\"value\":11},{\"value\":14},{\"value\":7}],\"font-size\":10,\"type\":\"line\"}," + "{\"colour\":\"#0066CC\",\"text\":\"BUDGET\",\"values\":[{\"value\":12},{\"value\":9},{\"value\":100}]," + "\"font-size\":10,\"type\":\"line\"}],\"x_axis\":{\"colour\":\"#000000\",\"grid-colour\":\"#aaaaaa\"," + "\"stroke\":1,\"labels\":{\"labels\":[\"Sales\",\"Finance\",\"Human Resource\"]}}}", c2, when(IGNORING_ARRAY_ORDER));
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class MultipleComponentIT method testDataUtility1.
public void testDataUtility1() {
startTest();
IPentahoResultSet rs1 = getResultSetFromArray();
String xmlString1 = DataUtilities.getXMLString(rs1);
// $NON-NLS-1$
assertTrue(xmlString1.indexOf("VAL1") > 0);
finishTest();
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class RulesIT method testQueryRule.
public void testQueryRule() {
startTest();
IPentahoResultSet resultSet = null;
try {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/query_rule1.xaction");
// $NON-NLS-1$
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus());
// $NON-NLS-1$
Object result = context.getOutputParameter("rule-result").getValue();
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0001_NULL_RESULT"), result);
// $NON-NLS-1$
assertTrue(Messages.getInstance().getString("RulesTest.ERROR_0007_LOOKUP_RULE_INVALID_RESULT"), (result instanceof IPentahoResultSet));
resultSet = (IPentahoResultSet) result;
IPentahoMetaData metaData = resultSet.getMetaData();
Object[][] columnHeaders = metaData.getColumnHeaders();
String columnHeader = columnHeaders[0][0].toString();
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals(Messages.getInstance().getString("RulesTest.ERROR_0009_LOOKUP_RULE_COLUMN_MISSING"), "POSITIONTITLE", columnHeader);
Object[] row = resultSet.next();
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0007_LOOKUP_RULE_INVALID_RESULT"), row);
// $NON-NLS-1$
info(Messages.getInstance().getString("RulesTest.DEBUG_LOOKUP_RULE_SUCCESS", row[0].toString()));
} finally {
if (resultSet != null) {
resultSet.closeConnection();
}
}
finishTest();
}
use of org.pentaho.commons.connection.IPentahoResultSet in project pentaho-platform by pentaho.
the class RulesIT method testQueryRule2.
public void testQueryRule2() {
startTest();
IPentahoResultSet resultSet = null;
try {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IRuntimeContext context = run("/test/rules/query_rule2.xaction");
// $NON-NLS-1$
assertEquals(Messages.getInstance().getString("BaseTest.USER_RUNNING_ACTION_SEQUENCE"), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus());
// $NON-NLS-1$
Object result = context.getOutputParameter("rule-result").getValue();
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0001_NULL_RESULT"), result);
// $NON-NLS-1$
assertTrue(Messages.getInstance().getString("RulesTest.ERROR_0007_LOOKUP_RULE_INVALID_RESULT"), (result instanceof IPentahoResultSet));
resultSet = (IPentahoResultSet) result;
IPentahoMetaData metaData = resultSet.getMetaData();
Object[][] columnHeaders = metaData.getColumnHeaders();
String regionHeader = columnHeaders[0][0].toString();
String departmentHeader = columnHeaders[0][1].toString();
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals(Messages.getInstance().getString("RulesTest.ERROR_0009_LOOKUP_RULE_COLUMN_MISSING"), "REGION", regionHeader);
assertEquals(Messages.getInstance().getString("RulesTest.ERROR_0009_LOOKUP_RULE_COLUMN_MISSING"), "DEPARTMENT", // $NON-NLS-1$ //$NON-NLS-2$
departmentHeader);
Object[] row = resultSet.next();
while (row != null) {
String region = row[0].toString();
String department = row[1].toString();
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0009_LOOKUP_RULE_COLUMN_MISSING"), region);
// $NON-NLS-1$
assertNotNull(Messages.getInstance().getString("RulesTest.ERROR_0009_LOOKUP_RULE_COLUMN_MISSING"), department);
// $NON-NLS-1$
info(region + ", " + department);
row = resultSet.next();
}
} finally {
if (resultSet != null) {
resultSet.closeConnection();
}
}
finishTest();
}
Aggregations