Package org.apache.hivemind.internal

Examples of org.apache.hivemind.internal.RegistryInfrastructure


    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();
       
        MockControl registryControl = newControl(RegistryInfrastructure.class);
        RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();
       
        MockControl tmControl = newControl(TranslatorManager.class);
        TranslatorManager tm = (TranslatorManager) tmControl.getMock();

        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();

        ElementModelImpl em = new ElementModelImpl("module");

        em.setElementName("fred");
        em.setContentTranslator("smart");

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl("module");
        schema.addElementModel(em);

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);

        ElementImpl element = new ElementImpl();
        element.setElementName("fred");
        element.setContent("flintstone");

        List elements = Collections.singletonList(element);
       
        m.getRegistry();
        control.setReturnValue(registry);
       
        registry.getModule("module");
        registryControl.setReturnValue(m);

        m.resolveType("hivemind.test.services.impl.StringHolderImpl");
        control.setReturnValue(StringHolderImpl.class);
View Full Code Here


    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();
       
        MockControl registryControl = newControl(RegistryInfrastructure.class);
        RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();

        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();

        ElementModelImpl em = new ElementModelImpl("module");

        em.setElementName("fred");
        // No content handler specified

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl("module");
        schema.addElementModel(em);

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);

        ElementImpl element = new ElementImpl();
        element.setElementName("fred");
        element.setContent("flintstone");

        List elements = Collections.singletonList(element);
       
        m.getRegistry();
        control.setReturnValue(registry);
       
        registry.getModule(schema.getDefiningModuleId());
        registryControl.setReturnValue(m);

        m.resolveType("hivemind.test.services.impl.StringHolderImpl");
        control.setReturnValue(StringHolderImpl.class);
View Full Code Here

    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();
       
        MockControl registryControl = newControl(RegistryInfrastructure.class);
        RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();

        MockControl tmControl = newControl(TranslatorManager.class);
        TranslatorManager tm = (TranslatorManager) tmControl.getMock();

        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();

        ElementModelImpl em = new ElementModelImpl("module");

        AttributeModelImpl am = new AttributeModelImpl();
        am.setName("wife");
        am.setTranslator("service");

        em.setElementName("fred");
        em.addAttributeModel(am);

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadAttributeRule rule = new ReadAttributeRule();
        rule.setPropertyName("value");
        rule.setAttributeName("wife");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl("module");
        schema.addElementModel(em);

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);

        ElementImpl element = new ElementImpl();
        element.setElementName("fred");
        element.addAttribute(new AttributeImpl("wife", "wilma"));

        List elements = Collections.singletonList(element);
       
        m.getRegistry();
        control.setReturnValue(registry);
       
        registry.getModule("module");
        registryControl.setReturnValue(m);

        m.resolveType("hivemind.test.services.impl.StringHolderImpl");
        control.setReturnValue(StringHolderImpl.class);
View Full Code Here

       
        MockControl tmControl = newControl(TranslatorManager.class);
        TranslatorManager tm = (TranslatorManager) tmControl.getMock();
       
        MockControl registryControl = newControl(RegistryInfrastructure.class);
        RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();

        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();

        em.setElementName("cartoon");
        em.setKeyAttribute("name");

        AttributeModelImpl am = new AttributeModelImpl();
        am.setName("name");
        am.setTranslator("cartoon");

        em.addAttributeModel(am);
       
        em.addRule(new CreateObjectRule("StringHolderImpl"));
       
        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);
       
        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl("module");
        schema.addElementModel(em);

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

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);

        ElementImpl element = new ElementImpl();
        element.setElementName("cartoon");
        element.setContent("${fred}");
        element.addAttribute(new AttributeImpl("name", "${flintstone}"));

        List elements = Collections.singletonList(element);

        m.getRegistry();
        control.setReturnValue(registry);
       
        registry.getModule("module");
        registryControl.setReturnValue(m);

        m.resolveType("StringHolderImpl");
        control.setReturnValue(StringHolderImpl.class);
View Full Code Here

        MockControl control2 = newControl(Module.class);
        Module m2 = (Module) control2.getMock();
       
        MockControl registryControl = newControl(RegistryInfrastructure.class);
        RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();

        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);

        Location location1 = newLocation();
        ElementImpl element1 = new ElementImpl();
        element1.setElementName("cartoon");
        element1.addAttribute(new AttributeImpl("name", "flintstone"));
        element1.setLocation(location1);

        List elements1 = Collections.singletonList(element1);

        Location location2 = newLocation();
        ElementImpl element2 = new ElementImpl();
        element2.setElementName("cartoon");
        element2.addAttribute(new AttributeImpl("name", "flintstone"));
        element2.setLocation(location2);

        List elements2 = Collections.singletonList(element2);

        MockControl tControl1 = newControl(Translator.class);
        Translator t1 = (Translator) tControl1.getMock();
       
        MockControl tmControl = newControl(TranslatorManager.class);
        TranslatorManager tm = (TranslatorManager) tmControl.getMock();
       
        m1.getRegistry();
        control1.setReturnValue(registry);
       
        registry.getModule("module");
        registryControl.setReturnValue(m1);

        m2.getRegistry();
        control2.setReturnValue(registry);
       
        registry.getModule("module");
        registryControl.setReturnValue(m2);
       
        m1.resolveType("StringHolderImpl");
        control1.setReturnValue(StringHolderImpl.class);
View Full Code Here

*/
public class TestRegistryInfrastructure extends HiveMindTestCase
{
    public void testGetMissingExtensionPoint()
    {
        RegistryInfrastructure r = new RegistryInfrastructureImpl(null, null);

        try
        {
            r.getServicePoint("foo", null);
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertEquals(ImplMessages.noSuchServicePoint("foo"), ex.getMessage());
View Full Code Here

        // Process any deferred operations. Post processing is added by
        // both the parser and the registry constructor.

        _registryAssembly.performPostProcessing();

        RegistryInfrastructure infrastructure = _constructor
                .constructRegistryInfrastructure(locale);

        infrastructure.startup();

        return new RegistryImpl(infrastructure);
    }
View Full Code Here

{

    public void testGetServiceByInterface()
    {
        MockControl rc = newControl(RegistryInfrastructure.class);
        RegistryInfrastructure r = (RegistryInfrastructure) rc.getMock();

        ModuleImpl m = new ModuleImpl();
        m.setRegistry(r);

        StringHolder h = new StringHolderImpl();

        r.getService(StringHolder.class, m);
        rc.setReturnValue(h);

        replayControls();

        Object result = m.getService(StringHolder.class);
View Full Code Here

*/
public class TestRegistryInfrastructure extends HiveMindTestCase
{
    public void testGetMissingExtensionPoint()
    {
        RegistryInfrastructure r = new RegistryInfrastructureImpl(null, null);

        try
        {
            r.getServicePoint("foo", null);
            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
            assertEquals(ImplMessages.noSuchServicePoint("foo"), ex.getMessage());
View Full Code Here

        ClassResolver resolver = new DefaultClassResolver(loader);

        RegistryBuilder b = new RegistryBuilder();
        b.processModules(resolver);

        RegistryInfrastructure r =
            (RegistryInfrastructure) b.constructRegistry(Locale.getDefault());

        List l = r.getConfiguration("hivemind.test.config.Symbols");
        assertEquals(1, l.size());

        Datum d = (Datum) l.get(0);

        assertEquals("wife", d.getKey());
View Full Code Here

TOP

Related Classes of org.apache.hivemind.internal.RegistryInfrastructure

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.