Package org.apache.tapestry5.ioc.def

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


    @SuppressWarnings("unchecked")
    @Test
    public void wrong_key_type()
    {
        ContributionDef def = newContributionDef("contributionPlaceholder1");
        Map<?, ContributionDef> keyToContribution = CollectionFactory.newMap();
        Runnable value = mockRunnable();
        ObjectLocator locator = mockObjectLocator();
        Map<Class, Runnable> map = CollectionFactory.newMap();
View Full Code Here


    }

    @Test
    public void null_value()
    {
        ContributionDef def = newContributionDef("contributionPlaceholder1");
        Map<Class, ContributionDef> keyToContribution = CollectionFactory.newMap();
        Map<Class, Runnable> map = CollectionFactory.newMap();
        ObjectLocator locator = mockObjectLocator();

        replay();
View Full Code Here

        Set<ContributionDef> defs = md.getContributionDefs();

        assertEquals(defs.size(), 1);

        ContributionDef cd = defs.iterator().next();

        // The target service id is derived from the method name

        assertEquals(cd.getServiceId(), expectedServiceId);

        // Can't be exact, because the source file & line number are probably attached (and those
        // can change)

        assertTrue(cd.toString().contains(moduleClass.getName() + "." + expectedMethodSignature));

        verify();
    }
View Full Code Here

        if (value == null)
            throw new NullPointerException(IOCMessages.contributionWasNull(serviceId));

        V coerced = typeCoercer.coerce(value, expectedValueType);

        ContributionDef existing = keyToContributor.get(key);

        if (existing != null)
            throw new IllegalArgumentException(IOCMessages.contributionDuplicateKey(serviceId, existing));

        map.put(key, coerced);
View Full Code Here

        builder.add(moduleClasses);
    }

    private void addSyntheticSymbolSourceModule(String appPackage)
    {
        ContributionDef appPathContribution = new SyntheticSymbolSourceContributionDef("AppPath",
                new SingleKeySymbolProvider(InternalSymbols.APP_PACKAGE_PATH, appPackage.replace('.', '/')));

        ContributionDef symbolSourceContribution = new SyntheticSymbolSourceContributionDef("ServletContext",
                appProvider, "before:ApplicationDefaults", "after:EnvironmentVariables");

        ContributionDef appNameContribution = new SyntheticSymbolSourceContributionDef("AppName",
                new SingleKeySymbolProvider(InternalSymbols.APP_NAME, appName), "before:ServletContext");

        builder.add(new SyntheticModuleDef(symbolSourceContribution, appNameContribution, appPathContribution));
    }
View Full Code Here

     * contributions.
     */
    @Override
    public Set<ContributionDef> getContributionDefs()
    {
        ContributionDef def = createContributionToMasterObjectProvider();

        return CollectionFactory.newSet(def);
    }
View Full Code Here

    }

    private ContributionDef createContributionToMasterObjectProvider()
    {

        ContributionDef def = new AbstractContributionDef()
        {
            @Override
            public String getServiceId()
            {
                return "MasterObjectProvider";
View Full Code Here

        {
            logger.warn(IOCMessages.noContributionParameter(method));
            return;
        }

        ContributionDef def = new ContributionDefImpl(serviceId, method, classFactory);

        contributionDefs.add(def);
    }
View Full Code Here

        Set<ContributionDef> defs = md.getContributionDefs();

        assertEquals(defs.size(), 1);

        ContributionDef cd = defs.iterator().next();

        // The target service id is derived from the method name

        assertEquals(cd.getServiceId(), expectedServiceId);

        // Can't be exact, because the source file & line number are probably attached (and those
        // can change)

        assertTrue(cd.toString().contains(moduleClass.getName() + "." + expectedMethodSignature));

        verify();
    }
View Full Code Here

        builder.add(TapestryModule.class);

        // A synthetic module to ensure that the tapestry.alias-mode is set correctly.

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

        ModuleDef module = new SyntheticModuleDef(contribution);

        builder.add(module);
View Full Code Here

TOP

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

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.