Package org.apache.hivemind.internal

Examples of org.apache.hivemind.internal.Module


        DefaultImplementationBuilderImpl dib = new DefaultImplementationBuilderImpl();

        dib.setClassFactory(cf);

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

        module.getModuleId();
        moduleControl.setReturnValue("foo.bar");

        module.getClassResolver();
        moduleControl.setReturnValue(new DefaultClassResolver());

        PipelineAssembler pa =
            new PipelineAssembler(
                getLog(),
View Full Code Here


        DefaultImplementationBuilderImpl dib = new DefaultImplementationBuilderImpl();

        dib.setClassFactory(cf);

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

        module.getModuleId();
        moduleControl.setReturnValue("foo.bar");

        module.getClassResolver();
        moduleControl.setReturnValue(new DefaultClassResolver());

        PipelineFactory factory = new PipelineFactory();
        factory.setClassFactory(cf);
        factory.setDefaultImplementationBuilder(dib);
View Full Code Here

        DefaultImplementationBuilderImpl dib = new DefaultImplementationBuilderImpl();

        dib.setClassFactory(cf);

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

        module.getModuleId();
        moduleControl.setReturnValue("foo.bar");

        module.getClassResolver();
        moduleControl.setReturnValue(new DefaultClassResolver());

        PipelineFactory factory = new PipelineFactory();
        factory.setClassFactory(cf);
        factory.setDefaultImplementationBuilder(dib);
View Full Code Here

        return _schema.getDefiningModuleId();
    }
   
    public Module getDefiningModule()
    {
        Module definingModule = getContributingModule().getRegistry().getModule(_schema.getDefiningModuleId());
        Defense.notNull(definingModule, "Defining module");
        return definingModule;
    }
View Full Code Here

{

    public void testGetContentTranslator()
    {
        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);

        m.getService(SymbolExpander.class);
        control.setReturnValue(symbolExpander);

        symbolExpander.expandSymbols("flintstone", null);
        symbolExpanderControl.setReturnValue("flintstone");
       
        m.getService(TranslatorManager.class);
        control.setReturnValue(tm);

        tm.getTranslator("smart");
        tmControl.setReturnValue(new NullTranslator());
        
View Full Code Here

    }

    public void testGetContentTranslatorUnspecified()
    {
        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);

        m.getService(SymbolExpander.class);
        control.setReturnValue(symbolExpander);

        symbolExpander.expandSymbols("flintstone", null);
        symbolExpanderControl.setReturnValue("flintstone");
View Full Code Here

    }

    public void testGetAttributeTranslator()
    {
        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);

        m.getService(SymbolExpander.class);
        control.setReturnValue(symbolExpander);

        symbolExpander.expandSymbols("wilma", null);
        symbolExpanderControl.setReturnValue("wilma");
       
        m.getService(TranslatorManager.class);
        control.setReturnValue(tm);

        tm.getTranslator("service");
        tmControl.setReturnValue(new NullTranslator());
View Full Code Here

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

        m.getService(SymbolExpander.class);
        control.setReturnValue(symbolExpander);
       
        symbolExpander.expandSymbols("${fred}", null);
        symbolExpanderControl.setReturnValue("fred");

        symbolExpander.expandSymbols("${flintstone}", null);
        symbolExpanderControl.setReturnValue("flintstone");

        MockControl tControl = newControl(Translator.class);
        Translator t = (Translator) tControl.getMock();

        tm.getTranslator("cartoon");
        tmControl.setReturnValue(t);

        m.getService(TranslatorManager.class);
        control.setReturnValue(tm);

        Object flintstoneKey = new Object();
        t.translate(m, Object.class, "flintstone", element.getLocation());
        tControl.setReturnValue(flintstoneKey);
View Full Code Here

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

    }

    public void testUnknownInterfaceClass()
    {
        Location l = newLocation();
        Module module = newModule();

        replayControls();

        ModuleDefinition moduleDefinition = createModuleDefinition("module");
        ServicePointDefinitionImpl definition = new ServicePointDefinitionImpl(moduleDefinition, "zip.zap", l, Visibility.PUBLIC, "foo.bar.Baz");
View Full Code Here

TOP

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

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.