Package org.drools.verifier.components

Examples of org.drools.verifier.components.Pattern


        Set<String> rulesThatHadErrors = new HashSet<String>();
        while ( iter.hasNext() ) {
            Object o = (Object) iter.next();
            if ( o instanceof VerifierMessage ) {
                Pattern pattern = (Pattern) ((VerifierMessage) o).getFaulty();
                rulesThatHadErrors.add( pattern.getRuleName() );
            }
        }

        assertTrue( rulesThatHadErrors.remove( "Incoherent restrictions 7" ) );
View Full Code Here


        Set<String> rulesThatHadErrors = new HashSet<String>();
        while ( iter.hasNext() ) {
            Object o = (Object) iter.next();
            if ( o instanceof VerifierMessage ) {
                Pattern pattern = (Pattern) ((VerifierMessage) o).getFaulty();
                rulesThatHadErrors.add( pattern.getRuleName() );
            }
        }

        assertTrue( rulesThatHadErrors.remove( "Incoherent restrictions 3" ) );
        assertTrue( rulesThatHadErrors.remove( "Incoherent restrictions 4" ) );
View Full Code Here

        Set<String> rulesThatHadErrors = new HashSet<String>();
        while ( iter.hasNext() ) {
            Object o = (Object) iter.next();
            if ( o instanceof VerifierMessage ) {
                Pattern pattern = (Pattern) ((VerifierMessage) o).getFaulty();
                rulesThatHadErrors.add( pattern.getRuleName() );
            }
        }

        assertTrue( rulesThatHadErrors.remove( "Incoherent restrictions 6" ) );
View Full Code Here

        saveVerifierComponentAndGet( rulePackage );

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

        Pattern pattern = VerifierComponentMockFactory.createPattern1();
        saveVerifierComponentAndGet( pattern );

        saveVerifierComponentAndGet( new Constraint( pattern ) );
        saveVerifierComponentAndGet( new InlineEvalDescr( pattern ) );
        saveVerifierComponentAndGet( new ObjectType() );
View Full Code Here

        saveVerifierComponentAndGet( new Field() );
    }

    @Test
    public void testSaveVerifierComponentAndGetForAllRestrictions() {
        Pattern pattern = VerifierComponentMockFactory.createPattern1();

        saveVerifierComponentAndGet( LiteralRestriction.createRestriction( pattern,
                                                                           "" ) );
        saveVerifierComponentAndGet( new EnumRestriction( pattern ) );
        saveVerifierComponentAndGet( new QualifiedIdentifierRestriction( pattern ) );
View Full Code Here

        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] );
View Full Code Here

        session.setGlobal( "result",
                           result );

        // This pattern is always true.
        Pattern pattern1 = VerifierComponentMockFactory.createPattern1();

        Restriction r1 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        Restriction r2 = LiteralRestriction.createRestriction( pattern1,
                                                               "" );
        Opposites o1 = new Opposites( r1,
                                      r2 );
        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        pp1.add( r1 );
        pp1.add( r2 );

        Restriction r3 = new VariableRestriction( pattern1 );
        Restriction r4 = new VariableRestriction( pattern1 );
        Opposites o2 = new Opposites( r1,
                                      r2 );
        SubPattern pp2 = new SubPattern( pattern1,
                                         1 );
        pp2.add( r1 );
        pp2.add( r2 );

        // This pattern is okay.
        Pattern pattern2 = VerifierComponentMockFactory.createPattern2();

        Restriction r5 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
        Restriction r6 = LiteralRestriction.createRestriction( pattern2,
                                                               "" );
View Full Code Here

                           result );

        VerifierRule rule1 = VerifierComponentMockFactory.createRule1();

        // This pattern is always true.
        Pattern pattern1 = VerifierComponentMockFactory.createPattern1();

        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        AlwaysTrue alwaysTrue1 = new AlwaysTrue( pp1 );

        SubPattern pp2 = new SubPattern( pattern1,
                                         1 );
        AlwaysTrue alwaysTrue2 = new AlwaysTrue( pp2 );

        // This pattern is okay.
        Pattern pattern2 = new Pattern( rule1 );
        pattern2.setName( "testPattern2" );

        SubPattern pp3 = new SubPattern( pattern2,
                                         0 );

        SubPattern pp4 = new SubPattern( pattern2,
View Full Code Here

        session.setGlobal( "result",
                           result );

        // This rule is always true.
        VerifierRule rule1 = VerifierComponentMockFactory.createRule1();
        Pattern pattern1 = VerifierComponentMockFactory.createPattern1();

        SubRule rp1 = new SubRule( rule1,
                                   0 );
        SubPattern pp1 = new SubPattern( pattern1,
                                         0 );
        AlwaysTrue alwaysTrue1 = new AlwaysTrue( pp1 );
        SubPattern pp2 = new SubPattern( pattern1,
                                         1 );
        AlwaysTrue alwaysTrue2 = new AlwaysTrue( pp2 );

        rp1.add( pp1 );
        rp1.add( pp2 );

        // This rule is okay.
        VerifierRule rule2 = VerifierComponentMockFactory.createRule2();
        Pattern pattern2 = VerifierComponentMockFactory.createPattern2();

        SubRule rp2 = new SubRule( rule2,
                                   0 );
        SubPattern pp3 = new SubPattern( pattern2,
                                         0 );
View Full Code Here

        session.setAgendaFilter( new RuleNameMatchesAgendaFilter( "Incompatible LiteralRestrictions with ranges in pattern possibility, impossible equality less or equal" ) );

        Collection<Object> data = new ArrayList<Object>();

        Pattern pattern1 = VerifierComponentMockFactory.createPattern1();
        Pattern pattern2 = VerifierComponentMockFactory.createPattern2();

        /*
         * Working pair
         */
        LiteralRestriction r1 = LiteralRestriction.createRestriction( pattern1,
View Full Code Here

TOP

Related Classes of org.drools.verifier.components.Pattern

Copyright © 2018 www.massapicom. 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.