Package org.apache.tapestry5.ioc.def

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


    @SuppressWarnings("unchecked")
    @Test
    public void wrong_value_type()
    {
        ContributionDef def = newContributionDef("contributionPlaceholder1");
        Map<?, ContributionDef> keyToContribution = CollectionFactory.newMap();
        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 (type == null)
            throw new RuntimeException(IOCMessages.noContributionParameter(method));

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

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

     * Returns a contribution, "SpringBean", to the MasterObjectProvider service.  It is ordered after the built-in
     * contributions.
     */
    public Set<ContributionDef> getContributionDefs()
    {
        ContributionDef def = createContributionToMasterObjectProvider();

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

    private ContributionDef createContributionToMasterObjectProvider()
    {


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

            throw new NullPointerException(IOCMessages.contributionWasNull(serviceId));


        validateValue(value);

        ContributionDef existing = keyToContributor.get(key);

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

        map.put(key, value);
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");

        ContributionDef aliasModeContribution =
                new SyntheticSymbolSourceContributionDef("AliasMode",
                                                         new SingleKeySymbolProvider(InternalSymbols.ALIAS_MODE,
                                                                                     aliasMode),
                                                         "before:ServletContext");

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

        builder.add(new SyntheticModuleDef(symbolSourceContribution, aliasModeContribution, appNameContribution,
View Full Code Here

        configuration.add(toContribute);

        replay();

        Method m = findMethod("contributeUnordered");
        ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);

        def.contribute(this, serviceResources, configuration);

        verify();
    }
View Full Code Here

        configuration.add(service);

        replay();

        Method m = findMethod("contributeUnorderedParameter");
        ContributionDef def = new ContributionDefImpl("foo.Bar", m, null);

        def.contribute(this, resources, configuration);

        verify();
    }
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.