Package org.drools.spring.pojorule

Examples of org.drools.spring.pojorule.Argument


        Method pojoMethod = Pojo.class.getMethod("method", new Class[] { KnowledgeHelper.class,
                String.class, Object.class });

        Rule rule = new Rule("test");
        MockControl controlKnowledgeHelperArgument = mocks.createControl(Argument.class);
        Argument mockKnowledgeHelperArgument = (Argument) controlKnowledgeHelperArgument.getMock();
        MockControl controlFactArgument = mocks.createControl(Argument.class);
        Argument mockFactArgument = (Argument) controlFactArgument.getMock();
        MockControl controlApplicationDataArgument = mocks.createControl(Argument.class);
        Argument mockApplicationDataArgument = (Argument) controlApplicationDataArgument.getMock();

        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlKnowledgeHelper = mocks.createControl(KnowledgeHelper.class);
        KnowledgeHelper mockKnowledgeHelper = (KnowledgeHelper) controlKnowledgeHelper.getMock();
        String p1 = "p1";
        Object a1 = new Object();

        controlKnowledgeHelperArgument.expectAndReturn(
                mockKnowledgeHelperArgument.getValue(mockTuple),
                mockKnowledgeHelper);
        controlFactArgument.expectAndReturn(
                mockFactArgument.getValue(mockTuple), p1);
        controlApplicationDataArgument.expectAndReturn(
                mockApplicationDataArgument.getValue(mockTuple), a1);

        Argument[] parameterValues = new Argument[] {
                mockKnowledgeHelperArgument, mockFactArgument, mockApplicationDataArgument };

        mocks.replay();
View Full Code Here


        ApplicationDataArgumentMetadata metadata =
                new ApplicationDataArgumentMetadata("id", String.class);

        mocks.replay();

        Argument argument = metadata.createArgument(mockRule);

        mocks.verify();

        assertTrue(argument instanceof ApplicationDataArgument);
        ApplicationDataArgument appDataArgument = (ApplicationDataArgument)argument;
View Full Code Here

        controlRule.expectAndReturn(mockRule.getParameterDeclaration(explicitIdentifier), null);
        controlRule.expectAndReturn(mockRule.addParameterDeclaration(explicitIdentifier, objectType), declaration);

        mocks.replay();

        Argument argument = metadata.createArgument(mockRule);

        mocks.verify();

        assertTrue(argument instanceof FactArgument);
        FactArgument factArgument = (FactArgument)argument;
View Full Code Here

        Declaration declaration = createDeclaration(explicitIdentifier);
        controlRule.expectAndReturn(mockRule.getParameterDeclaration(explicitIdentifier), declaration);

        mocks.replay();

        Argument argument = metadata.createArgument(mockRule);

        mocks.verify();

        assertTrue(argument instanceof FactArgument);
        FactArgument factArgument = (FactArgument)argument;
View Full Code Here

        DataArgumentMetadata metadata =
                new DataArgumentMetadata("id", String.class);

        mocks.replay();

        Argument argument = metadata.createArgument(mockRule);

        mocks.verify();

        assertTrue(argument instanceof ApplicationDataArgument);
        ApplicationDataArgument appDataArgument = (ApplicationDataArgument)argument;
View Full Code Here

    public void testCreate() throws Exception {
        Rule rule = new Rule("for-test");
        KnowledgeHelperArgumentMetadata metadata = new KnowledgeHelperArgumentMetadata();

        Argument argument = metadata.createArgument(rule);

        assertTrue(argument instanceof KnowledgeHelperArgument);
    }
View Full Code Here

TOP

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

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.