Package org.drools.spring.pojorule

Examples of org.drools.spring.pojorule.PojoCondition


            Argument[] arguments = getArguments(rule, argumentsMetadata);

            if (methodMetadata.getMethodType() == MethodMetadata.METHOD_CONDITION) {
                assertReturnType(pojoMethod, boolean.class);
                rule.addCondition(
                        new PojoCondition(new RuleReflectMethod(rule, pojo, pojoMethod, arguments)));
                log.info("Condition method added to rule: " + pojoMethod.toString());

            } else if (methodMetadata.getMethodType() == MethodMetadata.METHOD_CONSEQUENCE) {
                conditionRuleReflectMethods.add(
                        new RuleReflectMethod(rule, pojo, pojoMethod, arguments));
View Full Code Here


            ArgumentMetadata[] argumentsMetadata = getArgumentMetadata(pojoMethod);
            Argument[] arguments = getArguments(rule, argumentsMetadata);
   
            if (methodMetadata.getMethodType() == MethodMetadata.METHOD_CONDITION) {
                assertReturnType(pojoMethod, boolean.class);
                rule.addCondition(new PojoCondition(new RuleReflectMethod(rule, pojo, pojoMethod, arguments)));
   
            }
        }
    }
View Full Code Here

        RuleReflectMethod mockRuleMethod = (RuleReflectMethod) controlRuleMethod.getMock();
        controlRuleMethod.expectAndReturn(mockRuleMethod.getArguments(), parameterValues);

        mocks.replay();

        PojoCondition pojoCondition = new PojoCondition(mockRuleMethod);

        Declaration[] requiredTupleMembers = pojoCondition.getRequiredTupleMembers();

        mocks.verify();
        assertEquals(2, requiredTupleMembers.length);
        assertSame(expectedDeclaration_1, requiredTupleMembers[0]);
        assertSame(expectedDeclaration_2, requiredTupleMembers[1]);
View Full Code Here

        controlRuleMethod.expectAndReturn(mockRuleMethod.getArguments(), new Argument[] {});
        controlRuleMethod.expectAndThrow(mockRuleMethod.invokeMethod(null), new RuntimeException("test"));

        mocks.replay();

        PojoCondition pojoCondition = new PojoCondition(mockRuleMethod);
        try {
            pojoCondition.isAllowed(null);
            fail("Expected ConditionException");
        } catch (ConditionException e) {
            // expected
        }
View Full Code Here

        controlRuleMethod.expectAndReturn(mockRuleMethod.getArguments(), new Argument[] {});
        controlRuleMethod.expectAndReturn(mockRuleMethod.invokeMethod(mockTuple), Boolean.TRUE);

        mocks.replay();

        PojoCondition pojoCondition = new PojoCondition(mockRuleMethod);
        pojoCondition.isAllowed(mockTuple);

        mocks.verify();
    }
View Full Code Here

        List conditions = rule.getConditions();
        assertEquals(2, conditions.size());
        for (Iterator iter = conditions.iterator(); iter.hasNext();) {
            Condition condition = (Condition) iter.next();
            assertTrue(condition instanceof PojoCondition);
            PojoCondition pojoCondition = (PojoCondition) condition;
            if (!expectedConditionMethodNames.contains(pojoCondition.getMethodName())) {
                fail("Unexpected rule pojo-condition method: " + pojoCondition.getMethodName());
            }
        }

        Consequence consequence = rule.getConsequence();
        assertNotNull(consequence);
View Full Code Here

TOP

Related Classes of org.drools.spring.pojorule.PojoCondition

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.