use of org.drools.template.parser.DecisionTableParseException in project drools by kiegroup.
the class LhsBuilder method addCellValue.
public void addCellValue(int row, int column, String value) {
this.hasValues = true;
Integer key = new Integer(column);
String content = this.constraints.get(key);
if (content == null) {
throw new DecisionTableParseException("No code snippet for CONDITION in cell " + RuleSheetParserUtil.rc2name(this.headerRow + 2, this.headerCol));
}
SnippetBuilder snip = new SnippetBuilder(content);
String result = snip.build(fixValue(column, value));
this.values.add(result);
}
use of org.drools.template.parser.DecisionTableParseException in project drools by kiegroup.
the class RhsBuilder method addCellValue.
public void addCellValue(int row, int column, String value) {
hasValues = true;
String template = (String) this.templates.get(new Integer(column));
if (template == null) {
throw new DecisionTableParseException("No code snippet for " + this.actionTypeCode + ", above cell " + RuleSheetParserUtil.rc2name(this.headerRow + 2, this.headerCol));
}
SnippetBuilder snip = new SnippetBuilder(template);
this.values.add(snip.build(value));
}
use of org.drools.template.parser.DecisionTableParseException in project drools by kiegroup.
the class CsvParser method parseFile.
public void parseFile(final InputStream inStream) {
final BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, IoUtils.UTF8_CHARSET));
try {
startSheet();
processRows(reader);
finishSheet();
} catch (final IOException e) {
throw new DecisionTableParseException("An error occurred reading the CSV data.", e);
}
}
use of org.drools.template.parser.DecisionTableParseException in project drools by kiegroup.
the class RuleWorksheetParseTest method testMissingCodeSnippetAction.
/**
* Must have a code snippet in an action.
*/
@Test
public void testMissingCodeSnippetAction() {
try {
makeRuleSet();
makeRuleTable();
makeRow(11, "C", "A");
makeRow(12, "foo: Foo", "Bar()");
makeRow(13, "attr == $param");
makeRow(15, "1", "1");
makeRow(16, "2", "2");
listener.finishSheet();
Package p = listener.getRuleSet();
DRLOutput dout = new DRLOutput();
p.renderDRL(dout);
String drl = dout.getDRL();
System.out.println(drl);
fail("should have failed");
} catch (DecisionTableParseException e) {
String badCell = RuleSheetParserUtil.rc2name(13, 2);
System.err.println(e.getMessage());
assertTrue(e.getMessage().contains(badCell));
}
}
use of org.drools.template.parser.DecisionTableParseException in project drools by kiegroup.
the class RuleWorksheetParseTest method testSalienceOutOfRange.
@Test
public void testSalienceOutOfRange() throws Exception {
// DROOLS-1225
final InputStream stream = RuleWorksheetParseTest.class.getResourceAsStream("/data/SalienceOutOfRangeWorkbook.xls");
try {
final RuleSheetListener listener = getRuleSheetListener(stream);
fail("should have failed");
} catch (DecisionTableParseException e) {
}
}
Aggregations