Package org.apache.hivemind.impl

Examples of org.apache.hivemind.impl.ElementImpl


        String localName,
        String qName,
        Attributes attributes)
        throws SAXException
    {
        ElementImpl element = constructElement(localName, attributes);

        push(element);
    }
View Full Code Here


    }

    private ElementImpl constructElement(String name, Attributes attributes)
    {
        ElementImpl result = new ElementImpl();
        result.setElementName(name);
        result.setLocation(getLocation());

        int count = attributes.getLength();
        for (int i = 0; i < count; i++)
        {
            Attribute a = new AttributeImpl(attributes.getLocalName(i), attributes.getValue(i));

            result.addAttribute(a);
        }

        if (_root == null)
            _root = result;
        else
View Full Code Here

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

        new InterceptorDescriptor().toString();
        new ModuleImpl().toString();
        new RegistryImpl(null, Locale.ENGLISH).toString();
        new ContributionImpl().toString();
        new ConfigurationPointImpl().toString();
        new ElementImpl().toString();
        new AttributeImpl("foo", "bar").toString();
        new ServiceInterceptorContributionImpl().toString();
        new ServicePointImpl().toString();
        new InterceptorStackImpl(null, mockServicePoint, null).toString();
    }
View Full Code Here

        return result;
    }

    private Element forgeElement()
    {
        ElementImpl e = new ElementImpl();
        Location l = new LocationImpl(getResource("TestEnumerationTranslator.class"), 50);
        e.setLocation(l);

        return e;
    }
View Full Code Here

    }

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

        MockControl c = newControl(Module.class);
        Module m = (Module) c.getMock();

        m.getClassResolver();
View Full Code Here

    }

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

        MockControl c = newControl(Module.class);
        Module m = (Module) c.getMock();

        m.getClassResolver();
View Full Code Here

        new ModuleDescriptor(_resolver, new DefaultErrorHandler()).toString();
        new SubModuleDescriptor().toString();
        new DependencyDescriptor().toString();
        new ServicePointDescriptor().toString();
        new InterceptorDescriptor().toString();
        new ElementImpl().toString();
        new AttributeImpl("foo", "bar").toString();
    }
View Full Code Here

{
    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

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

TOP

Related Classes of org.apache.hivemind.impl.ElementImpl

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.