Search in sources :

Example 16 with Import

use of org.kie.soup.project.datamodel.imports.Import in project drools-wb by kiegroup.

the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantRows002.

@Test
public void testRedundantRows002() throws Exception {
    GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withStringColumn("application", "LoanApplication", "amount", ">").withStringColumn("person", "Person", "name", "==").withStringColumn("income", "IncomeSource", "type", "==").withActionSetField("application", "approved", DataType.TYPE_STRING).withData(new Object[][] { { 1, "description", "131000", "Toni", "Asset", "true" }, { 2, "description", "131000", "Toni", "Asset", "true" }, { 3, "description", "100001", "Michael", "Job", "true" } }).buildTable();
    Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_ROWS, Severity.WARNING, 1, 2);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Import(org.kie.soup.project.datamodel.imports.Import) ExtendedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 17 with Import

use of org.kie.soup.project.datamodel.imports.Import in project drools-wb by kiegroup.

the class DecisionTableAnalyzerTest method testRedundancy.

@Test
public void testRedundancy() throws Exception {
    table52 = new LimitedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withIntegerColumn("a", "Person", "age", "==", 0).withAction("a", "Person", "approved", new DTCellValue52() {

        {
            setBooleanValue(true);
        }
    }).withAction("a", "Person", "approved", new DTCellValue52() {

        {
            setBooleanValue(true);
        }
    }).withData(new Object[][] { { 1, "description", true, true, false }, { 2, "description", true, false, true } }).buildTable();
    fireUpAnalyzer();
    assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_ROWS, Severity.WARNING, 1, 2);
    assertNotNull(analyzerProvider.getStatus());
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) LimitedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.LimitedGuidedDecisionTableBuilder) Test(org.junit.Test)

Example 18 with Import

use of org.kie.soup.project.datamodel.imports.Import in project drools-wb by kiegroup.

the class DecisionTableAnalyzerConflictResolverLimitedDTableTest method testConflict.

@Test
public void testConflict() throws Exception {
    table52 = new LimitedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withIntegerColumn("a", "Person", "age", "==", 0).withAction("a", "approved", DataType.TYPE_BOOLEAN, new DTCellValue52() {

        {
            setBooleanValue(true);
        }
    }).withAction("a", "approved", DataType.TYPE_BOOLEAN, new DTCellValue52() {

        {
            setBooleanValue(false);
        }
    }).withData(new Object[][] { { 1, "description", true, true, false }, { 2, "description", true, false, true } }).buildTable();
    fireUpAnalyzer();
    assertContains(analyzerProvider.getAnalysisReport(), CONFLICTING_ROWS, Severity.WARNING, 2);
    assertContains(analyzerProvider.getAnalysisReport(), CONFLICTING_ROWS, Severity.WARNING, 1);
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) LimitedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.LimitedGuidedDecisionTableBuilder) Test(org.junit.Test)

Example 19 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ExternalDataObjectsItemPresenterTest method testSetup.

@Test
public void testSetup() {
    final Import import_ = new Import("type");
    externalDataObjectsItemPresenter.setup(import_, mock(ExternalDataObjectsPresenter.class));
    verify(view).init(eq(externalDataObjectsItemPresenter));
    verify(view).setTypeName(eq("type"));
    assertEquals(import_, externalDataObjectsItemPresenter.getObject());
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) Test(org.junit.Test)

Example 20 with Import

use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.

the class ExternalDataObjectsItemPresenterTest method testSetupOfType.

private void testSetupOfType(final String type) {
    final Import import_ = new Import(type);
    externalDataObjectsItemPresenter.setup(import_, mock(ExternalDataObjectsPresenter.class));
    verify(view).init(eq(externalDataObjectsItemPresenter));
    verify(view).setTypeName(eq(type));
    assertEquals(import_, externalDataObjectsItemPresenter.getObject());
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import)

Aggregations

Import (org.kie.soup.project.datamodel.imports.Import)103 Test (org.junit.Test)79 Imports (org.kie.soup.project.datamodel.imports.Imports)26 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)25 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)14 ArrayList (java.util.ArrayList)12 Path (org.uberfire.java.nio.file.Path)12 Query (org.apache.lucene.search.Query)11 FactData (org.drools.workbench.models.testscenarios.shared.FactData)11 VerifyFact (org.drools.workbench.models.testscenarios.shared.VerifyFact)11 BaseIndexingTest (org.kie.workbench.common.services.refactoring.backend.server.BaseIndexingTest)11 SingleTermQueryBuilder (org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder)11 VerifyField (org.drools.workbench.models.testscenarios.shared.VerifyField)10 FieldData (org.drools.workbench.models.testscenarios.shared.FieldData)9 KieSession (org.kie.api.runtime.KieSession)9 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)9 ValueReferenceIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm)9 Path (org.uberfire.backend.vfs.Path)9 ProjectImports (org.guvnor.common.services.project.model.ProjectImports)8 Analyzer (org.drools.verifier.core.main.Analyzer)7