Package org.apache.hivemind.definition

Examples of org.apache.hivemind.definition.RegistryDefinition


    /**
     * Tests the string representation of the location of a module and an extension point
     */
    public void testLocation()
    {
        RegistryDefinition registry = constructRegistryDefinition(SimpleAnnotatedModule.class);
        ModuleDefinition module = registry.getModule("org.apache.hivemind.annotations.SimpleAnnotatedModule");
        assertEquals("Class org.apache.hivemind.annotations.SimpleAnnotatedModule", module.getLocation().toString());
        ServicePointDefinition service = registry.getServicePoint("org.apache.hivemind.annotations.SimpleAnnotatedModule.Test");
        assertEquals("Class org.apache.hivemind.annotations.SimpleAnnotatedModule, method getRunnable", service.getLocation().toString());
    }
View Full Code Here


     * Checks that an explicitly defined id in the module annotation takes precedence
     * over the package and class name.
     */
    public void testModuleId()
    {
        RegistryDefinition registry = constructRegistryDefinition(ModuleWithExplicitId.class);
        assertNotNull(registry.getModule("Test"));
    }
View Full Code Here

            throw new BuildException("You must specify an output file");

        if (_modulesPath == null)
            throw new BuildException("You must specify a set of modules");

        RegistryDefinition registryDefinition = buildRegistry();
        Document registry = constructRegistryDocument(registryDefinition);

        log("Writing registry to " + _output);

        writeDocument(registry, _output);
View Full Code Here

        return builder.constructRegistry(moduleClasses);
    }

    protected RegistryDefinition constructRegistryDefinition(Class ... moduleClasses)
    {
        RegistryDefinition definition = new RegistryDefinitionImpl();

        for (int i = 0; i < moduleClasses.length; i++)
        {
            AnnotatedModuleReader reader = new AnnotatedModuleReader(definition, getClassResolver(),
                    new DefaultErrorHandler());
View Full Code Here

{
    public void testFound()
    {
        DefaultErrorHandler errorHandler = new DefaultErrorHandler();

      RegistryDefinition definition = new RegistryDefinitionImpl();
     
        ModuleDefinitionImpl fooBar = createModuleDefinition("foo.bar");

        ServicePointDefinitionImpl spd = createServicePointDefinition(fooBar, "sp1", Runnable.class);

        fooBar.addServicePoint(spd);

        ModuleDefinitionImpl zipZoop = createModuleDefinition("zip.zoop");

        ConfigurationPointDefinition cpd = createConfigurationPointDefinition(fooBar, "cp1");
       
        zipZoop.addConfigurationPoint(cpd);
       
        definition.addModule(fooBar);
        definition.addModule(zipZoop);

        RegistryInfrastructureConstructor ric = new RegistryInfrastructureConstructor(errorHandler,
                LogFactory.getLog(TestRegistryInfrastructureConstructor.class), null);

        RegistryInfrastructure registryInfrastructure = ric.constructRegistryInfrastructure(definition);
View Full Code Here

     * Builds a registry containing a service "BeanInterface" that constructs its instance
     * by using the passed constructor.
     */
    private Registry createRegistry(ImplementationConstructor constructor)
    {
        RegistryDefinition definition = new RegistryDefinitionImpl();

        ModuleDefinitionImpl module = createModuleDefinition("hivemind.tests.serviceByInterface");
        definition.addModule(module);
       
        ServicePointDefinitionImpl sp1 = createServicePointDefinition(module, "BeanInterface", BeanInterface.class);
        ImplementationDefinition impl = new ImplementationDefinitionImpl(module, newLocation(),
                constructor, ServiceModel.SINGLETON, true);
        sp1.addImplementation(impl);
View Full Code Here

     * @param moduleClassNames  the annotated module class names
     * @return  the registry
     */
    public TypedRegistry constructRegistry(String ... moduleClassNames)
    {
        RegistryDefinition definition = constructRegistryDefinition(moduleClassNames);
        return constructRegistry(definition);
    }
View Full Code Here

     * @param moduleClasses  the annotated module classes
     * @return  the registry
     */
   public TypedRegistry constructRegistry(Class ... moduleClasses)
    {
        RegistryDefinition definition = constructRegistryDefinition(moduleClasses);
        return constructRegistry(definition);
    }
View Full Code Here

        return constructRegistry(definition);
    }
   
    private RegistryDefinition constructRegistryDefinition(String ... moduleClassNames)
    {
        RegistryDefinition definition = new RegistryDefinitionImpl();

        for (int i = 0; i < moduleClassNames.length; i++)
        {
            AnnotatedModuleReader reader = new AnnotatedModuleReader(definition,
                    _classResolver, _errorHandler);
View Full Code Here

        return definition;
    }
   
    private RegistryDefinition constructRegistryDefinition(Class ... moduleClasses)
    {
        RegistryDefinition definition = new RegistryDefinitionImpl();

        for (int i = 0; i < moduleClasses.length; i++)
        {
            AnnotatedModuleReader reader = new AnnotatedModuleReader(definition,
                    _classResolver, _errorHandler);
View Full Code Here

TOP

Related Classes of org.apache.hivemind.definition.RegistryDefinition

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.