Package org.apache.hivemind.schema

Examples of org.apache.hivemind.schema.SchemaProcessor


    /**
     * Tests for when the stack is empty.
     */
    public void testStackEmpty()
    {
        SchemaProcessor sp = new SchemaProcessorImpl(null, null);

        // The sp is pushed onto the stack itself

        sp.pop();

        try
        {
            sp.pop();
            unreachable();
        }
        catch (ArrayIndexOutOfBoundsException ex)
        {

        }

        try
        {
            sp.peek();
            unreachable();
        }
        catch (ArrayIndexOutOfBoundsException ex)
        {
        }
View Full Code Here


        PushAttributeRule rule = new PushAttributeRule();

        rule.setAttributeName("fred");

        SchemaProcessor mockProcessor = (SchemaProcessor) control.getMock();

        mockProcessor.getAttributeTranslator("fred");
        control.setReturnValue(new NullTranslator());

        mockProcessor.getContributingModule();

        control.setReturnValue(newMock(Module.class));

        mockProcessor.push("flintstone");
        mockProcessor.pop();

        control.setReturnValue("flintstone");

        replayControls();
View Full Code Here

        PushAttributeRule rule = new PushAttributeRule();

        rule.setAttributeName("fred");

        SchemaProcessor mockProcessor = (SchemaProcessor) control.getMock();

        mockProcessor.getContributingModule();

        MockControl moduleControl = newControl(Module.class);
        Module mockModule = (Module) moduleControl.getMock();

        control.setReturnValue(mockModule);

        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
       
        mockProcessor.getSymbolExpander();
        control.setReturnValue(symbolExpander);

        mockProcessor.getAttributeTranslator("fred");
        control.setReturnValue(new NullTranslator());

        mockProcessor.getContributingModule();
        control.setReturnValue(mockModule);

        symbolExpander.expandSymbols("${flintstone}", element.getLocation());
        symbolExpanderControl.setReturnValue("FLINTSTONE");

        mockProcessor.push("FLINTSTONE");
        mockProcessor.pop();

        control.setReturnValue("FLINTSTONE");

        replayControls();
View Full Code Here

        rule.setAttributeName("fred");
        rule.setPropertyName("value");

        MockControl control = newControl(SchemaProcessor.class);
        SchemaProcessor mockProcessor = (SchemaProcessor) control.getMock();

        mockProcessor.getAttributeDefault("fred");
        control.setReturnValue("${flintstone}");

        mockProcessor.getContributingModule();

        MockControl moduleControl = newControl(Module.class);
        Module mockModule = (Module) moduleControl.getMock();

        control.setReturnValue(mockModule);
       
        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
       
        mockProcessor.getSymbolExpander();
        control.setReturnValue(symbolExpander);

        mockProcessor.peek();

        StringHolderImpl target = new StringHolderImpl();
        control.setReturnValue(target);

        mockProcessor.getAttributeTranslator("fred");
        control.setReturnValue(new NullTranslator());

        mockProcessor.getContributingModule();
        control.setReturnValue(mockModule);

        symbolExpander.expandSymbols("${flintstone}", element.getLocation());
        symbolExpanderControl.setReturnValue("FLINTSTONE");
View Full Code Here

        element.setContent("${flintstone}");

        PushContentRule rule = new PushContentRule();

        SchemaProcessor mockProcessor = (SchemaProcessor) control.getMock();

        mockProcessor.getContentTranslator();
        control.setReturnValue(new NullTranslator());

        mockProcessor.getContributingModule();

        MockControl moduleControl = newControl(Module.class);
        Module mockModule = (Module) moduleControl.getMock();

        control.setReturnValue(mockModule);
       
        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
       
        mockProcessor.getSymbolExpander();
        control.setReturnValue(symbolExpander);

        symbolExpander.expandSymbols("${flintstone}", element.getLocation());
        symbolExpanderControl.setReturnValue("FLINTSTONE");
       
        mockProcessor.getContributingModule();
        control.setReturnValue(mockModule);

        mockProcessor.push("FLINTSTONE");
        mockProcessor.pop();

        control.setReturnValue("FLINTSTONE");

        replayControls();
View Full Code Here

        final Location l = newLocation();
        Module module = newModule("Bean", Bean.class);
        Element element = newElement(l);

        MockControl control = newControl(SchemaProcessor.class);
        SchemaProcessor processor = (SchemaProcessor) control.getMock();

        processor.getDefiningModule();
        control.setReturnValue(module);

        processor.push(new Bean());
        control.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher()
        {
            public boolean compareArguments(Object expected, Object actual)
            {
                Bean b = (Bean) actual;

                assertEquals("HiveMind", b.getValue());
                assertSame(l, b.getLocation());

                return true;
            }
        }));

        replayControls();

        CreateObjectRule rule = new CreateObjectRule("Bean,value=HiveMind");

        rule.begin(processor, element);

        verifyControls();

        processor.pop();
        control.setReturnValue(null);

        replayControls();

        rule.end(processor, element);
View Full Code Here

    /**
     * Tests for when the stack is empty.
     */
    public void testStackEmpty()
    {
        SchemaProcessor sp = new SchemaProcessorImpl(null, null);

        // The sp is pushed onto the stack itself

        sp.pop();

        try
        {
            sp.pop();
            unreachable();
        }
        catch (ArrayIndexOutOfBoundsException ex)
        {

        }

        try
        {
            sp.peek();
            unreachable();
        }
        catch (ArrayIndexOutOfBoundsException ex)
        {
        }
View Full Code Here

    /**
     * Tests for when the stack is empty.
     */
    public void testStackEmpty()
    {
        SchemaProcessor sp = new SchemaProcessorImpl(null, null);

        try
        {
            sp.pop();
            unreachable();
        }
        catch (ArrayIndexOutOfBoundsException ex)
        {

        }

        try
        {
            sp.peek();
            unreachable();
        }
        catch (ArrayIndexOutOfBoundsException ex)
        {
        }
View Full Code Here

    public void testNullParameter() throws Exception
    {
        InvokeParentRule rule = new InvokeParentRule("add");

        MockControl procControl = newControl(SchemaProcessor.class);
        SchemaProcessor proc = (SchemaProcessor) procControl.getMock();

        proc.peek(0);
        procControl.setReturnValue(null);

        MockControl listControl = newControl(List.class);
        List list = (List) listControl.getMock();

        proc.peek(1);
        procControl.setReturnValue(list);

        proc.isInBackwardCompatibilityModeForMaps();
        procControl.setReturnValue(false);
       
        list.add(null);
        listControl.setReturnValue(true);

        replayControls();

        rule.begin(proc, null);

        verifyControls();

        resetControls();

        rule = new InvokeParentRule("get");

        proc.peek(0);
        procControl.setReturnValue(null);

        proc.peek(1);
        procControl.setReturnValue(list);
       
        proc.isInBackwardCompatibilityModeForMaps();
        procControl.setReturnValue(false);
       
        replayControls();

        try
View Full Code Here

    }

    public void testSetModuleRule()
    {
        MockControl control = newControl(SchemaProcessor.class);
        SchemaProcessor p = (SchemaProcessor) control.getMock();

        Module m = new ModuleImpl();
        Target t = new Target();

        p.peek();
        control.setReturnValue(t);

        p.getContributingModule();
        control.setReturnValue(m);

        replayControls();

        SetModuleRule rule = new SetModuleRule();
View Full Code Here

TOP

Related Classes of org.apache.hivemind.schema.SchemaProcessor

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.