Package org.apache.tapestry5.ioc.def

Examples of org.apache.tapestry5.ioc.def.ModuleDef


    {
        Logger logger = mockLogger();

        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);

        ServiceDef sd = md.getServiceDef("Greeter");

        assertListsEquals(CollectionFactory.newList(sd.getMarkers()), BlueMarker.class);

        verify();
    }
View Full Code Here


    {
        Logger logger = mockLogger();

        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);

        ServiceDef sd = md.getServiceDef("RedGreeter");

        assertListsEquals(CollectionFactory.newList(sd.getMarkers()), RedMarker.class);

        verify();
    }
View Full Code Here

    {
        Logger logger = mockLogger();

        replay();

        ModuleDef md = new DefaultModuleDefImpl(MarkerModule.class, logger, classFactory);

        ServiceDef sd = md.getServiceDef("SecondRedGreeter");

        assertListsEquals(CollectionFactory.newList(sd.getMarkers()), RedMarker.class);

        verify();
    }
View Full Code Here

    public void build_and_startup_registry_from_moduledef_and_modules()
    {
        Logger logger = LoggerFactory.getLogger(getClass());
        ClassFactory classFactory = new ClassFactoryImpl();

        ModuleDef module = new DefaultModuleDefImpl(ServiceBuilderModule.class, logger, classFactory);
       
        Registry r = RegistryBuilder.buildAndStartupRegistry(module, MasterModule.class);
       
        NameListHolder nameListHolder = r.getService("UnorderedNames", NameListHolder.class);
View Full Code Here

            addedModuleClasses.add(c);

            logger.info("Adding module definition for " + c);

            ModuleDef def = new DefaultModuleDefImpl(c, logger, classFactory);
            add(def);

            SubModule annotation = ((AnnotatedElement) c).getAnnotation(SubModule.class);

            if (annotation == null) continue;
View Full Code Here

    public void find_service_ids_for_interface()
    {
        InternalRegistry registry = mockInternalRegistry();
        Logger logger = mockLogger();

        ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, logger, null);

        Module module = new ModuleImpl(registry, null, moduleDef, null, logger);

        replay();
View Full Code Here

        DecoratorDef def1 = mockDecoratorDef();
        DecoratorDef def2 = mockDecoratorDef();
        Set<DecoratorDef> rawDefs = newMock(Set.class);
        Logger logger = mockLogger();

        ModuleDef moduleDef = mockModuleDef();

        Set<String> serviceIds = Collections.emptySet();
        expect(moduleDef.getServiceIds()).andReturn(serviceIds);

        expect(moduleDef.getDecoratorDefs()).andReturn(rawDefs);

        expect(rawDefs.iterator()).andReturn(Arrays.asList(def1, def2).iterator());

        train_matches(def1, serviceDef, false);
        train_matches(def2, serviceDef, true);
View Full Code Here

        SymbolProvider provider = new SingleKeySymbolProvider(InternalSymbols.ALIAS_MODE, "servlet");
        ContributionDef contribution = new SyntheticSymbolSourceContributionDef("AliasMode", provider,
                                                                                "before:ApplicationDefaults");

        ModuleDef module = new SyntheticModuleDef(contribution);

        builder.add(module);

        registry = builder.build();
View Full Code Here

        replay();

        // BigDecimal is arbitrary, any class would do.

        ModuleDef md = new DefaultModuleDefImpl(SimpleModule.class, logger, classFactory);

        assertEquals(md.toString(), "ModuleDef[" + className + " Barney, Fred, Wilma]");

        Set<String> ids = md.getServiceIds();

        assertEquals(ids.size(), 3);
        assertTrue(ids.contains("Fred"));
        assertTrue(ids.contains("Barney"));
        assertTrue(ids.contains("Wilma"));

        ServiceDef sd = md.getServiceDef("Fred");

        assertEquals(sd.getServiceId(), "Fred");

        assertEquals(sd.getServiceInterface(), FieService.class);

        assertTrue(sd.toString().contains(className + ".buildFred()"));
        assertEquals(sd.getServiceScope(), ScopeConstants.DEFAULT);
        assertEquals(sd.isEagerLoad(), false);
        assertTrue(sd.getMarkers().isEmpty());

        sd = md.getServiceDef("Wilma");
        assertEquals(sd.isEagerLoad(), true);

        // Now the decorator method.

        Set<DecoratorDef> defs = md.getDecoratorDefs();

        assertEquals(defs.size(), 1);

        DecoratorDef dd = defs.iterator().next();
View Full Code Here

    {
        Logger logger = mockLogger();

        replay();

        ModuleDef def = new DefaultModuleDefImpl(ServiceIdViaAnnotationModule.class, logger, null);

        assertEquals(def.getServiceIds().size(), 2);

        ServiceDef sd = def.getServiceDef("FooService");

        assertEquals(sd.getServiceId(), "FooService");

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.def.ModuleDef

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.