use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class SystemControlledColumnValuesSynchronizerTest method setUp.
@Before
public void setUp() throws Exception {
salienceAttribute = new AttributeCol52();
salienceAttribute.setAttribute(RuleAttributeWidget.SALIENCE_ATTR);
resolvedHitMetadata = new MetadataCol52();
resolvedHitMetadata.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
model.setHitPolicy(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT);
modelSynchronizer.appendColumn(salienceAttribute);
modelSynchronizer.appendColumn(resolvedHitMetadata);
rowsCount = 0;
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTableGeneratorListenerTest method testMetadata.
@Test
public void testMetadata() {
final ConversionResult result = new ConversionResult();
final List<DataListener> listeners = new ArrayList<DataListener>();
final GuidedDecisionTableGeneratorListener listener = new GuidedDecisionTableGeneratorListener(result, dmo);
listeners.add(listener);
// Convert
final ExcelParser parser = new ExcelParser(listeners);
final InputStream is = this.getClass().getResourceAsStream("Metadata.xls");
try {
parser.parseFile(is);
} finally {
try {
is.close();
} catch (IOException ioe) {
fail(ioe.getMessage());
}
}
// Check conversion results
assertEquals(0, result.getMessages().size());
// Check basics
List<GuidedDecisionTable52> dtables = listener.getGuidedDecisionTables();
assertNotNull(dtables);
assertEquals(1, dtables.size());
GuidedDecisionTable52 dtable = dtables.get(0);
assertEquals("MetadataTest", dtable.getTableName());
assertEquals(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY, dtable.getTableFormat());
// Check expanded columns
List<BaseColumn> columns = dtable.getExpandedColumns();
assertNotNull(columns);
assertEquals(3, columns.size());
assertTrue(columns.get(0) instanceof RowNumberCol52);
assertTrue(columns.get(1) instanceof DescriptionCol52);
assertTrue(columns.get(2) instanceof MetadataCol52);
// Check metadata column
MetadataCol52 mdCol2 = ((MetadataCol52) columns.get(2));
assertEquals("cheese", mdCol2.getMetadata());
// Check data
assertEquals(2, dtable.getData().size());
assertTrue(isRowEquivalent(new Object[] { 1, "Rule 1", "cheddar" }, dtable.getData().get(0)));
assertTrue(isRowEquivalent(new Object[] { 2, "Rule 2", "edam" }, dtable.getData().get(1)));
}
Aggregations