use of org.kie.soup.project.datamodel.imports.Import in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantRowsWithConflict.
@Test
public void testRedundantRowsWithConflict() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", ">").withConditionDoubleColumn("d", "Account", "deposit", "<").withActionSetField("a", "approved", DataType.TYPE_BOOLEAN).withActionSetField("a", "approved", DataType.TYPE_BOOLEAN).withData(new Object[][] { { 1, "description", 100, 0.0, true, true }, { 2, "description", 100, 0.0, true, false } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertDoesNotContain("ThisRowIsRedundantTo(1)", analyzerProvider.getAnalysisReport());
assertDoesNotContain("ThisRowIsRedundantTo(2)", analyzerProvider.getAnalysisReport());
}
use of org.kie.soup.project.datamodel.imports.Import in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantConditions001.
@Test
public void testRedundantConditions001() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withEnumColumn("a", "Person", "name", "==", "Toni,Eder").withConditionIntegerColumn("a", "Person", "name", "==").withData(new Object[][] { { 1, "description", "Toni", "Toni" } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_CONDITIONS_TITLE, Severity.NOTE);
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenter method setContent.
@Override
public void setContent(final AsyncPackageDataModelOracle dmo, final Imports importTypes, final boolean isReadOnly) {
this.dmo = checkNotNull("dmo", dmo);
this.importTypes = checkNotNull("importTypes", importTypes);
getInternalFactTypes().clear();
getExternalFactTypes().clear();
getModelFactTypes().clear();
// Get list of types within the package
for (String importType : dmo.getInternalFactTypes()) {
getInternalFactTypes().add(new Import(importType.replaceAll("\\$", ".")));
}
// Get list of potential imports
for (String importType : dmo.getExternalFactTypes()) {
getExternalFactTypes().add(new Import(importType.replaceAll("\\$", ".")));
}
// Remove internal imports from model's imports (this should never be the case, but it exists "in the wild")
getModelFactTypes().addAll(importTypes.getImports());
getModelFactTypes().removeAll(getInternalFactTypes());
// Remove external imports that have already been imported
getExternalFactTypes().removeAll(getModelFactTypes());
view.setContent(getInternalFactTypes(), getExternalFactTypes(), getModelFactTypes(), isReadOnly);
view.updateRenderedColumns();
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class AddImportPopup method setContent.
public void setContent(final Command callbackCommand, final List<Import> allAvailableImportTypes) {
this.callbackCommand = callbackCommand;
this.importTypeListBox.clear();
if (allAvailableImportTypes.size() > 0) {
allAvailableImportTypes.sort(Sorters.sortByFQCN());
importTypeListBox.addItem(ImportConstants.INSTANCE.ChooseAFactType());
for (Import importType : allAvailableImportTypes) {
importTypeListBox.addItem(importType.getType());
}
importTypeListBox.setEnabled(true);
} else {
importTypeListBox.addItem(ImportConstants.INSTANCE.noTypesAvailable());
importTypeListBox.setEnabled(false);
}
footer.enableOkButton(false);
importTypeListBox.setSelectedIndex(0);
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenterTest method testSetContent.
@Test
public void testSetContent() {
final Imports imports = new Imports();
imports.addImport(new Import("Internal1"));
presenter.setContent(dmo, imports, false);
verify(view, times(1)).setContent(internalFactTypesCaptor.capture(), externalFactTypesCaptor.capture(), importsFactTypesCaptor.capture(), eq(false));
verify(view).updateRenderedColumns();
assertEquals(3, internalFactTypesCaptor.getValue().size());
assertContains("Internal1", internalFactTypesCaptor.getValue());
assertContains("Internal2", internalFactTypesCaptor.getValue());
assertContains("Internal3", internalFactTypesCaptor.getValue());
assertEquals(3, externalFactTypesCaptor.getValue().size());
assertContains("org.pkg1.External1", externalFactTypesCaptor.getValue());
assertContains("org.pkg1.External2", externalFactTypesCaptor.getValue());
assertContains("org.pkg1.External3", externalFactTypesCaptor.getValue());
assertEquals(0, importsFactTypesCaptor.getValue().size());
assertEquals(1, imports.getImports().size());
assertContains("Internal1", imports.getImports());
}
Aggregations