DecisionTableAnalyzer implements org.kie.workbench.common.services.verifier.reporting.client.analysis.DecisionTableAnalyzer<BaseColumn> { @Override public void insertColumn(final BaseColumn baseColumn) { updateManager.newColumn(model, getColumnIndex(baseColumn)); } DecisionTableAnalyzer(final GuidedDecisionTable52 model,
                                 final DTableUpdateManager updateManager,
                                 final VerifierWebWorkerConnection connection); @Override void analyze(final List<Coordinate> updates); @Override void deleteColumns(final int firstColumnIndex,
                              final int numberOfColumns); @Override void insertColumn(final BaseColumn baseColumn); @Override void updateColumns(final int amountOfRows); @Override void deleteRow(final int index); @Override void appendRow(); @Override void insertRow(final int index); @Override void activate(); @Override void terminate();  }
@Test public void testInsertConditionColumn() throws Exception { ConditionCol52 a = new ConditionCol52(); ConditionCol52 b = new ConditionCol52(); conditionColumns.add(a); conditionColumns.add(b); pattern.setChildColumns(conditionColumns); patterns.add(pattern); model.getConditions().addAll(patterns); decisionTableAnalyzer.insertColumn(a); verify(updateManager).newColumn(model, 3); }
@Test public void testInsertActionColumn() throws Exception { ActionCol52 a = new ActionCol52(); a.setHeader("A"); ActionCol52 b = new ActionCol52(); b.setHeader("B"); actionColumns.add(a); actionColumns.add(b); model.setActionCols(actionColumns); decisionTableAnalyzer.insertColumn(b); verify(updateManager).newColumn(model, 4); }
@Test public void testInsertBRLConditionColumn() throws Exception { BRLConditionColumn brlConditionOne = new BRLConditionColumn(); BRLConditionVariableColumn a = new BRLConditionVariableColumn(); a.setHeader("A"); BRLConditionVariableColumn b = new BRLConditionVariableColumn(); b.setHeader("B"); BRLConditionColumn brlConditionTwo = new BRLConditionColumn(); BRLConditionVariableColumn c = new BRLConditionVariableColumn(); BRLConditionVariableColumn d = new BRLConditionVariableColumn(); brlConditionOne.setChildColumns(Arrays.asList(a, b)); brlConditionTwo.setChildColumns(Arrays.asList(c, d)); model.getConditions().addAll(Arrays.asList(brlConditionOne, brlConditionTwo)); decisionTableAnalyzer.insertColumn(brlConditionTwo); verify(updateManager).newColumn(model, 5); }
@Test public void testInsertBRLActionColumn() throws Exception { BRLActionColumn brlActionOne = new BRLActionColumn(); BRLActionVariableColumn a = new BRLActionVariableColumn(); BRLActionVariableColumn b = new BRLActionVariableColumn(); BRLActionColumn brlActionTwo = new BRLActionColumn(); BRLActionVariableColumn c = new BRLActionVariableColumn(); BRLActionVariableColumn d = new BRLActionVariableColumn(); brlActionOne.setChildColumns(Arrays.asList(a, b)); brlActionTwo.setChildColumns(Arrays.asList(c, d)); model.setActionCols(Arrays.asList(brlActionOne, brlActionTwo)); decisionTableAnalyzer.insertColumn(brlActionOne); verify(updateManager).newColumn(model, 3); }
@Test public void testInsertBRLVariableColumn() throws Exception { ConditionCol52 a = new ConditionCol52(); a.setHeader("A"); ConditionCol52 b = new ConditionCol52(); b.setHeader("B"); pattern.setChildColumns(Arrays.asList(a, b)); BRLConditionColumn brlCondition = new BRLConditionColumn(); BRLConditionVariableColumn c = new BRLConditionVariableColumn(); c.setHeader("C"); BRLConditionVariableColumn d = new BRLConditionVariableColumn(); d.setHeader("D"); brlCondition.setChildColumns(Arrays.asList(c, d)); model.getConditions().addAll(Arrays.asList(pattern, brlCondition)); decisionTableAnalyzer.insertColumn(d); verify(updateManager).newColumn(model, 6); }
@Test(expected = IllegalArgumentException.class) public void testInsertNonExistingColumn() throws Exception { ConditionCol52 a = new ConditionCol52(); a.setHeader("A"); ConditionCol52 b = new ConditionCol52(); b.setHeader("B"); pattern.setChildColumns(Arrays.asList(a)); BRLConditionColumn brlCondition = new BRLConditionColumn(); BRLConditionVariableColumn c = new BRLConditionVariableColumn(); BRLConditionVariableColumn d = new BRLConditionVariableColumn(); brlCondition.setChildColumns(Arrays.asList(c, d)); model.getConditions().addAll(Arrays.asList(pattern, brlCondition)); decisionTableAnalyzer.insertColumn(b); }