Examples of ElementImpl


Examples of org.apache.hivemind.impl.ElementImpl

{
    public void testPushAttributeRule()
    {
        MockControl control = newControl(SchemaProcessor.class);

        ElementImpl element = new ElementImpl();
        element.setElementName("myelement");

        Attribute attribute = new AttributeImpl("fred", "${flintstone}");

        element.addAttribute(attribute);

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

Examples of org.apache.hivemind.impl.ElementImpl

public class TestReadAttributeRule extends HiveMindTestCase
{
    public void testReadAttributeRule()
    {
        ElementImpl element = new ElementImpl();
        element.setElementName("myelement");

        ReadAttributeRule rule = new ReadAttributeRule();

        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");

        replayControls();

        rule.begin(mockProcessor, element);
View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

{
    public void testPushContentRule()
    {
        MockControl control = newControl(SchemaProcessor.class);

        ElementImpl element = new ElementImpl();
        element.setElementName("myelement");

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

Examples of org.apache.hivemind.impl.ElementImpl

     * attributes and content.
     */

    private void beginCollectServiceParameters(String elementName)
    {
        ElementImpl element = buildLWDomElement(elementName);

        AbstractServiceInvocationDescriptor sid = (AbstractServiceInvocationDescriptor) peekObject();

        sid.addParameter(element);

View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

    private void beginContribution(String elementName)
    {
        // This is where things get tricky, the point where we outgrew Jakarta Digester.

        ElementImpl element = buildLWDomElement(elementName);

        ContributionDescriptor ed = (ContributionDescriptor) peekObject();
        ed.addElement(element);

        push(elementName, element, STATE_LWDOM, false);
View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

        unexpectedElement(elementName);
    }

    private void beginLWDom(String elementName)
    {
        ElementImpl element = buildLWDomElement(elementName);

        ElementImpl parent = (ElementImpl) peekObject();
        parent.addElement(element);

        push(elementName, element, STATE_LWDOM, false);
    }
View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

            super.push(elementName, object, state, true);
    }

    private ElementImpl buildLWDomElement(String elementName)
    {
        ElementImpl result = new ElementImpl();
        result.setElementName(elementName);

        Iterator i = _attributes.entrySet().iterator();
        while (i.hasNext())
        {
            Map.Entry entry = (Map.Entry) i.next();

            String name = (String) entry.getKey();
            String value = (String) entry.getValue();

            Attribute a = new AttributeImpl(name, value);

            result.addAttribute(a);
        }

        return result;
    }
View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

        cd.addRulesForModel();
    }

    private void endLWDom()
    {
        ElementImpl element = (ElementImpl) peekObject();
        element.setContent(peekContent());
    }
View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

    }

    public void testBadClass() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestInstanceTranslator.class"), 50);
        e.setLocation(l);

        Module m = newModule();

        m.resolveType("bad.class.Name");
        ApplicationRuntimeException cause = new ApplicationRuntimeException("failure");
View Full Code Here

Examples of org.apache.hivemind.impl.ElementImpl

    }

    public void testPrivateObject() throws Exception
    {
        InstanceTranslator t = new InstanceTranslator();
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestInstanceTranslator.class"), 50);
        e.setLocation(l);

        ModuleImpl m = new ModuleImpl();
        m.setClassResolver(getClassResolver());

        replayControls();
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.