@Test public void testActions() { final ConversionResult result = new ConversionResult(); final List<DataListener> listeners = new ArrayList<DataListener>(); final GuidedDecisionTableGeneratorListener listener = new GuidedDecisionTableGeneratorListener(result, dmo); listeners.add(listener); final ExcelParser parser = new ExcelParser(listeners); final InputStream is = this.getClass().getResourceAsStream("Actions.xls"); try { parser.parseFile(is); } finally { try { is.close(); } catch (IOException ioe) { fail(ioe.getMessage()); } } assertEquals(0, result.getMessages().size()); List<GuidedDecisionTable52> dtables = listener.getGuidedDecisionTables(); assertNotNull(dtables); assertEquals(1, dtables.size()); GuidedDecisionTable52 dtable = dtables.get(0); assertEquals("ActionsTest", dtable.getTableName()); assertEquals(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY, dtable.getTableFormat()); List<BaseColumn> columns = dtable.getExpandedColumns(); assertNotNull(columns); assertEquals(8, columns.size()); assertTrue(columns.get(0) instanceof RowNumberCol52); assertTrue(columns.get(1) instanceof RuleNameColumn); assertTrue(columns.get(2) instanceof DescriptionCol52); assertTrue(columns.get(3) instanceof BRLActionVariableColumn); assertTrue(columns.get(4) instanceof BRLActionVariableColumn); assertTrue(columns.get(5) instanceof BRLActionVariableColumn); assertTrue(columns.get(6) instanceof BRLActionVariableColumn); assertTrue(columns.get(7) instanceof BRLActionVariableColumn); assertEquals(4, dtable.getActionCols().size()); assertTrue(dtable.getActionCols().get(0) instanceof BRLActionColumn); assertTrue(dtable.getActionCols().get(1) instanceof BRLActionColumn); assertTrue(dtable.getActionCols().get(2) instanceof BRLActionColumn); assertTrue(dtable.getActionCols().get(3) instanceof BRLActionColumn); BRLActionColumn actionCol0 = ((BRLActionColumn) dtable.getActionCols().get(0)); assertEquals("Converted from ['Multi-parameters', 'Multi-parameters']", actionCol0.getHeader()); assertEquals(2, actionCol0.getChildColumns().size()); List<IAction> actionCol0definition = actionCol0.getDefinition(); assertEquals(1, actionCol0definition.size()); assertTrue(actionCol0definition.get(0) instanceof FreeFormLine); FreeFormLine actionCol0ffl = (FreeFormLine) actionCol0definition.get(0); assertEquals("policy.setBasePrice(@{param1}, @{param2});", actionCol0ffl.getText()); BRLActionVariableColumn actionCol0param0 = actionCol0.getChildColumns().get(0); assertEquals("param1", actionCol0param0.getVarName()); assertEquals("Multi-parameters", actionCol0param0.getHeader()); assertEquals(DataType.TYPE_OBJECT, actionCol0param0.getFieldType()); assertNull(actionCol0param0.getFactType()); assertNull(actionCol0param0.getFactField()); BRLActionVariableColumn actionCol0param1 = actionCol0.getChildColumns().get(1); assertEquals("param2", actionCol0param1.getVarName()); assertEquals("Multi-parameters", actionCol0param1.getHeader()); assertEquals(DataType.TYPE_OBJECT, actionCol0param1.getFieldType()); assertNull(actionCol0param1.getFactType()); assertNull(actionCol0param1.getFactField()); BRLActionColumn actionCol1 = ((BRLActionColumn) dtable.getActionCols().get(1)); assertEquals("Converted from ['Single-parameter']", actionCol1.getHeader()); assertEquals(1, actionCol1.getChildColumns().size()); List<IAction> actionCol1definition = actionCol1.getDefinition(); assertEquals(1, actionCol1definition.size()); assertTrue(actionCol1definition.get(0) instanceof FreeFormLine); FreeFormLine actionCol1ffl = (FreeFormLine) actionCol1definition.get(0); assertEquals("policy.setSmurf(@{param3});", actionCol1ffl.getText()); BRLActionVariableColumn actionCol1param0 = actionCol1.getChildColumns().get(0); assertEquals("param3", actionCol1param0.getVarName()); assertEquals("Single-parameter", actionCol1param0.getHeader()); assertEquals(DataType.TYPE_OBJECT, actionCol1param0.getFieldType()); assertNull(actionCol1param0.getFactType()); assertNull(actionCol1param0.getFactField()); BRLActionColumn actionCol2 = ((BRLActionColumn) dtable.getActionCols().get(2)); assertEquals("Converted from ['Log-single-parameter']", actionCol2.getHeader()); assertEquals(1, actionCol2.getChildColumns().size()); List<IAction> actionCol2definition = actionCol2.getDefinition(); assertEquals(1, actionCol2definition.size()); assertTrue(actionCol2definition.get(0) instanceof FreeFormLine); FreeFormLine actionCol2ffl = (FreeFormLine) actionCol2definition.get(0); assertEquals("System.out.println(\"@{param4}\");", actionCol2ffl.getText()); BRLActionVariableColumn actionCol2param0 = actionCol2.getChildColumns().get(0); assertEquals("param4", actionCol2param0.getVarName()); assertEquals("Log-single-parameter", actionCol2param0.getHeader()); assertEquals(DataType.TYPE_OBJECT, actionCol2param0.getFieldType()); assertNull(actionCol2param0.getFactType()); assertNull(actionCol2param0.getFactField()); BRLActionColumn actionCol3 = ((BRLActionColumn) dtable.getActionCols().get(3)); assertEquals("Converted from ['Zero-parameters']", actionCol3.getHeader()); assertEquals(1, actionCol3.getChildColumns().size()); List<IAction> actionCol3definition = actionCol3.getDefinition(); assertEquals(1, actionCol3definition.size()); assertTrue(actionCol3definition.get(0) instanceof FreeFormLine); FreeFormLine actionCol3ffl = (FreeFormLine) actionCol3definition.get(0); assertEquals("System.out.println(\"Woot\");", actionCol3ffl.getText()); BRLActionVariableColumn actionCol3param0 = actionCol3.getChildColumns().get(0); assertEquals("", actionCol3param0.getVarName()); assertEquals("Zero-parameters", actionCol3param0.getHeader()); assertEquals(DataType.TYPE_BOOLEAN, actionCol3param0.getFieldType()); assertNull(actionCol3param0.getFactType()); assertNull(actionCol3param0.getFactField()); assertEquals(2, dtable.getData().size()); assertTrue(isRowEquivalent(new Object[]{1, "", "Row 1", "10", "20", "30", "hello", true}, dtable.getData().get(0))); assertTrue(isRowEquivalent(new Object[]{2, "", "Row 2", "50", "60", "70", "goodbye", false}, dtable.getData().get(1))); }
public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } GuidedDecisionTableGeneratorListener(final ConversionResult conversionResult,
                                                final PackageDataModelOracle _dmo); }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } GuidedDecisionTableGeneratorListener(final ConversionResult conversionResult,
                                                final PackageDataModelOracle _dmo); CaseInsensitiveMap getProperties(); Package getRuleSet(); List<Import> getImports(); List<Global> getGlobals(); List<String> getFunctions(); List<String> getQueries(); List<String> getTypeDeclarations(); List<GuidedDecisionTable52> getGuidedDecisionTables(); void startSheet(final String name); void finishSheet(); void newRow(final int rowNumber,
                       final int columns); void newCell(final int row,
                        final int column,
                        final String value,
                        int mergedColStart); }
GuidedDecisionTableGeneratorListener implements
        RuleSheetListener { public List<GuidedDecisionTable52> getGuidedDecisionTables() { return _dtables; } GuidedDecisionTableGeneratorListener(final ConversionResult conversionResult,
                                                final PackageDataModelOracle _dmo); CaseInsensitiveMap getProperties(); Package getRuleSet(); List<Import> getImports(); List<Global> getGlobals(); List<String> getFunctions(); List<String> getQueries(); List<String> getTypeDeclarations(); List<GuidedDecisionTable52> getGuidedDecisionTables(); void startSheet(final String name); void finishSheet(); void newRow(final int rowNumber,
                       final int columns); void newCell(final int row,
                        final int column,
                        final String value,
                        int mergedColStart);  }