Examples of VerifierRule


Examples of org.drools.verifier.components.VerifierRule

                                                field );

            fieldsByObjectTypeId.put( field.getObjectTypePath(),
                                      field );
        } else if ( VerifierComponentType.RULE.equals( object.getVerifierComponentType() ) ) {
            VerifierRule rule = (VerifierRule) object;
            rulesByName.put( rule.getName(),
                             rule );
            if ( rule.getMetadata().containsKey( "category" ) ) {
                rulesByCategory.put( rule.getMetaAttribute("category"),
                                     rule );
            }
        } else if ( VerifierComponentType.VARIABLE.equals( object.getVerifierComponentType() ) ) {
            Variable variable = (Variable) object;
            variablesByRuleAndVariableName.put( variable.getRuleName() + "." + variable.getName(),
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

        this.rulePackage = rulePackage;
    }

    public void visitRuleDescr(RuleDescr descr) throws UnknownDescriptionException {

        rule = new VerifierRule( rulePackage );

        rule.setName( descr.getName() );

        for ( AttributeDescr attribute : descr.getAttributes().values() ) {
            rule.getAttributes().put( attribute.getName(),
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

            data.add( subPattern );
        }

        for ( SubRule subRule : solvers.getRulePossibilities() ) {
            VerifierRule rule = data.getVerifierObject( VerifierComponentType.RULE,
                                                        subRule.getRulePath() );

            data.add( subRule );
        }
    }
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

     * @return Link to objects page or the toString() text if no link could not
     *         be created.
     */
    public static String getUrl(Object o) {
        if ( o instanceof VerifierRule ) {
            VerifierRule rule = (VerifierRule) o;
            return getRuleUrl( UrlFactory.RULE_FOLDER,
                               rule.getPath(),
                               rule.getName() );
        }

        return o.toString();
    }
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

        addDrlRulesData( rules );
    }

    private void addDrlRulesData(List<DrlRuleParser> rules) {
        for ( DrlRuleParser rData : rules ) {
            VerifierRule rule = this.result.getVerifierData().getRuleByName( rData.getName() );

            if ( rule != null ) {
                rule.getHeader().addAll( rData.getHeader() );
                rule.getLhsRows().addAll( rData.getLhs() );
                rule.getRhsRows().addAll( rData.getRhs() );
                rule.setDescription( rData.getDescription() );
                rule.getCommentMetadata().addAll( rData.getMetadata() );
                rule.getOtherInfo().putAll( rData.getOtherInformation() );
            }
        }
    }
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

    @Test
    public void testSaveVerifierComponentAndGet() {
        VerifierData data = VerifierReportFactory.newVerifierData();

        VerifierRule rule = VerifierComponentMockFactory.createRule1();
        rule.setName( "0" );
        String rulePath = rule.getPath();

        data.add( rule );

        Collection<VerifierComponent> all = data.getAll();

        assertEquals( 1,
                      all.size() );
        assertEquals( rule,
                      all.toArray()[0] );

        Collection<VerifierRule> rules = data.getAll( VerifierComponentType.RULE );

        assertEquals( 1,
                      rules.size() );
        assertEquals( rule,
                      rules.toArray()[0] );

        VerifierRule rule2 = data.getVerifierObject( VerifierComponentType.RULE,
                                                     rulePath );

        assertNotNull( rule2 );
        assertEquals( rule,
                      rule2 );
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

    public void testSaveVerifierComponentAndGetForAllComponentTypes() {

        RulePackage rulePackage = VerifierComponentMockFactory.createPackage1();
        saveVerifierComponentAndGet( rulePackage );

        VerifierRule rule = VerifierComponentMockFactory.createRule1();
        saveVerifierComponentAndGet( rule );

        Pattern pattern = VerifierComponentMockFactory.createPattern1();
        saveVerifierComponentAndGet( pattern );
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

    @Test
    public void testSavePatternAndGet() {
        VerifierData data = VerifierReportFactory.newVerifierData();

        VerifierRule rule = VerifierComponentMockFactory.createRule1();
        assertNotNull( rule.getName() );
        assertEquals( "testRule1",
                      rule.getName() );

        ObjectType objectType = new ObjectType();
        Pattern pattern = VerifierComponentMockFactory.createPattern1();

        assertNotNull( pattern.getRulePath() );
        assertEquals( rule.getPath(),
                      pattern.getRulePath() );

        assertNotNull( pattern.getName() );
        assertEquals( rule.getName(),
                      pattern.getRuleName() );

        pattern.setObjectTypePath( objectType.getPath() );
        assertNotNull( pattern.getObjectTypePath() );
        assertEquals( objectType.getPath(),
                      pattern.getObjectTypePath() );

        data.add( rule );
        data.add( objectType );
        data.add( pattern );

        Collection<VerifierComponent> all = data.getAll();

        assertEquals( 3,
                      all.size() );
        assertTrue( all.contains( pattern ) );
        assertTrue( all.contains( objectType ) );
        assertTrue( all.contains( rule ) );

        Collection<VerifierComponent> components = data.getAll( pattern.getVerifierComponentType() );

        assertEquals( 1,
                      components.size() );
        assertEquals( pattern,
                      components.toArray()[0] );

        VerifierComponent objectType2 = data.getVerifierObject( objectType.getVerifierComponentType(),
                                                                objectType.getPath() );

        assertNotNull( objectType2 );
        assertEquals( objectType,
                      objectType2 );

        VerifierComponent rule2 = data.getVerifierObject( rule.getVerifierComponentType(),
                                                          rule.getPath() );

        assertNotNull( rule2 );
        assertEquals( rule,
                      rule2 );
    }
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

    public void testRedundantPatternPossibilitiesInRulePossibilities() throws Exception {
        StatelessSession session = getStatelessSession( this.getClass().getResourceAsStream( "Notes.drl" ) );

        session.setAgendaFilter( new RuleNameMatchesAgendaFilter( "Find redundant pattern possibilities from rule possibilities" ) );

        VerifierRule rule = VerifierComponentMockFactory.createRule1();
        Pattern pattern = VerifierComponentMockFactory.createPattern1();

        Collection<Object> objects = new ArrayList<Object>();
        SubPattern left = new SubPattern( pattern,
                                          0 );
View Full Code Here

Examples of org.drools.verifier.components.VerifierRule

    public static Pattern createPattern2() {
        return createPattern( 2 );
    }

    public static VerifierRule createRule(int i) {
        VerifierRule rule = new VerifierRule( createPackage1() );

        rule.setName( "testRule" + i );

        return rule;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.