Search in sources :

Example 21 with Field

use of org.drools.workbench.services.verifier.api.client.index.Field in project drools-wb by kiegroup.

the class ActionInspectorConflictResolverTest method testConflict001.

@Test
public void testConflict001() throws Exception {
    ActionInspector a = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "String", "name", new AnalyzerConfigurationMock()), DataType.DataTypes.STRING, "Toni");
    ActionInspector b = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "String", "name", new AnalyzerConfigurationMock()), DataType.DataTypes.STRING, "Rambo");
    assertTrue(a.conflicts(b));
    assertTrue(b.conflicts(a));
}
Also used : ObjectField(org.drools.workbench.services.verifier.api.client.index.ObjectField) Field(org.drools.workbench.services.verifier.api.client.index.Field) AnalyzerConfigurationMock(org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock) Test(org.junit.Test)

Example 22 with Field

use of org.drools.workbench.services.verifier.api.client.index.Field in project drools-wb by kiegroup.

the class ActionInspectorConflictResolverTest method testRedundancy005.

@Test
public void testRedundancy005() throws Exception {
    ActionInspector a = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "Boolean", "isOldEnough", new AnalyzerConfigurationMock()), DataType.DataTypes.BOOLEAN, true);
    ActionInspector b = createSetActionInspector(new Field(mock(ObjectField.class), "Person", "Boolean", "isOldEnough", new AnalyzerConfigurationMock()), DataType.DataTypes.STRING, "false");
    assertFalse(a.isRedundant(b));
    assertFalse(b.isRedundant(a));
}
Also used : ObjectField(org.drools.workbench.services.verifier.api.client.index.ObjectField) Field(org.drools.workbench.services.verifier.api.client.index.Field) AnalyzerConfigurationMock(org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock) Test(org.junit.Test)

Example 23 with Field

use of org.drools.workbench.services.verifier.api.client.index.Field in project drools-wb by kiegroup.

the class FieldConditionBuilder method build.

public Condition build() throws BuildException {
    PortablePreconditions.checkNotNull("conditionCol52", conditionCol52);
    PortablePreconditions.checkNotNull("columnIndex", columnIndex);
    try {
        final Field field = resolveField();
        final Condition condition = buildCondition(field);
        field.getConditions().add(condition);
        return condition;
    } catch (final BuildException buildException) {
        throw buildException;
    } catch (final Exception e) {
        throw new BuildException("Failed to build " + pattern.getName() + " # " + ToString.toString(conditionCol52));
    }
}
Also used : FieldCondition(org.drools.workbench.services.verifier.api.client.index.FieldCondition) Condition(org.drools.workbench.services.verifier.api.client.index.Condition) Field(org.drools.workbench.services.verifier.api.client.index.Field)

Example 24 with Field

use of org.drools.workbench.services.verifier.api.client.index.Field in project drools-wb by kiegroup.

the class FieldInspectorRelationsTest method testRedundancy02.

@Test
public void testRedundancy02() throws Exception {
    final FieldInspector x = new FieldInspector(new Field(mock(ObjectField.class), "org.Address", "String", "name", configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
    assertFalse(x.isRedundant(b));
    assertFalse(b.isRedundant(x));
}
Also used : Field(org.drools.workbench.services.verifier.api.client.index.Field) ObjectField(org.drools.workbench.services.verifier.api.client.index.ObjectField) AnalyzerConfiguration(org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration) Test(org.junit.Test)

Example 25 with Field

use of org.drools.workbench.services.verifier.api.client.index.Field in project drools-wb by kiegroup.

the class FieldInspectorRelationsTest method setUp.

@Before
public void setUp() throws Exception {
    configurationMock = new AnalyzerConfigurationMock();
    ObjectField objectField = mock(ObjectField.class);
    a = new FieldInspector(new Field(objectField, "org.Person", "String", "name", configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
    b = new FieldInspector(new Field(objectField, "org.Person", "String", "name", configurationMock), mock(RuleInspectorUpdater.class), mock(AnalyzerConfiguration.class));
}
Also used : Field(org.drools.workbench.services.verifier.api.client.index.Field) ObjectField(org.drools.workbench.services.verifier.api.client.index.ObjectField) AnalyzerConfigurationMock(org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock) ObjectField(org.drools.workbench.services.verifier.api.client.index.ObjectField) Before(org.junit.Before)

Aggregations

Field (org.drools.workbench.services.verifier.api.client.index.Field)25 ObjectField (org.drools.workbench.services.verifier.api.client.index.ObjectField)21 Test (org.junit.Test)18 AnalyzerConfigurationMock (org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock)17 Column (org.drools.workbench.services.verifier.api.client.index.Column)3 FieldCondition (org.drools.workbench.services.verifier.api.client.index.FieldCondition)3 Before (org.junit.Before)3 Date (java.util.Date)2 AnalyzerConfiguration (org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration)2 Action (org.drools.workbench.services.verifier.api.client.index.Action)2 Condition (org.drools.workbench.services.verifier.api.client.index.Condition)2 FieldAction (org.drools.workbench.services.verifier.api.client.index.FieldAction)2 ConditionsInspectorMultiMap (org.drools.workbench.services.verifier.core.cache.inspectors.condition.ConditionsInspectorMultiMap)2 ArrayList (java.util.ArrayList)1 BRLAction (org.drools.workbench.services.verifier.api.client.index.BRLAction)1 Fields (org.drools.workbench.services.verifier.api.client.index.Fields)1 RetractAction (org.drools.workbench.services.verifier.api.client.index.RetractAction)1 Values (org.drools.workbench.services.verifier.api.client.index.keys.Values)1