Package org.apache.tapestry.ioc

Examples of org.apache.tapestry.ioc.ServiceLocator


    @Test
    public void unordered_collection_with_incorrect_configuration_parameter()
    {
        Configuration configuration = newConfiguration();
        ServiceLocator locator = newServiceLocator();

        Throwable t = new RuntimeException("Missing service.");

        expect(locator.getService(MappedConfiguration.class)).andThrow(t);

        replay();

        Method m = findMethod("contributeUnorderedWrongParameter");
        ContributionDef def = new ContributionDefImpl("foo.Bar", m);
View Full Code Here


    @SuppressWarnings("unchecked")
    @Test
    public void ordered_collection_with_service_lookup()
    {
        OrderedConfiguration configuration = newOrderedConfiguration();
        ServiceLocator locator = newServiceLocator();
        UpcaseService service = newUpcaseService();

        train_getService(locator, "zip.Zap", UpcaseService.class, service);

        configuration.add("fred", service);
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void mapped_collection_with_service_lookup()
    {
        MappedConfiguration configuration = newMappedConfiguration();
        ServiceLocator locator = newServiceLocator();
        UpcaseService service = newUpcaseService();

        train_getService(locator, "zip.Zap", UpcaseService.class, service);

        configuration.add("upcase", service);
View Full Code Here

public class ServiceObjectProviderTest extends IOCInternalTestCase
{
    @Test
    public void provider_delegates_to_locator()
    {
        ServiceLocator locator = newServiceLocator();

        Runnable r = newRunnable();

        train_getService(locator, "module.Foo", Runnable.class, r);
View Full Code Here

        if (_insideConstructor)
            throw new RuntimeException(IOCMessages.recursiveModuleConstructor(_moduleDef
                    .getModuleId(), builderClass, constructor));

        ServiceLocator locator = new ServiceLocatorImpl(_registry, this);
        Map<Class, Object> parameterDefaults = newMap();

        parameterDefaults.put(Log.class, _log);
        parameterDefaults.put(String.class, _moduleDef.getModuleId());
        parameterDefaults.put(ServiceLocator.class, locator);
View Full Code Here

        if (contributions.isEmpty()) return;

        Log log = getLog(serviceId);
        boolean debug = log.isDebugEnabled();

        ServiceLocator locator = new ServiceResourcesImpl(this, module, serviceDef, log);

        for (ContributionDef def : contributions)
        {
            MappedConfiguration<K, V> validating = new ValidatingMappedConfigurationWrapper<K, V>(
                    serviceId, def, log, keyClass, valueType, keyToContribution, configuration);
View Full Code Here

        if (contributions.isEmpty()) return;

        Log log = getLog(serviceId);
        boolean debug = log.isDebugEnabled();

        ServiceLocator locator = new ServiceResourcesImpl(this, module, serviceDef, log);

        for (ContributionDef def : contributions)
        {
            Configuration<T> validating = new ValidatingConfigurationWrapper<T>(serviceId, log,
                    valueType, def, configuration);
View Full Code Here

        if (contributions.isEmpty()) return;

        Log log = getLog(serviceId);
        boolean debug = log.isDebugEnabled();

        ServiceLocator locator = new ServiceResourcesImpl(this, module, serviceDef, log);

        for (ContributionDef def : contributions)
        {
            OrderedConfiguration<T> validating = new ValidatingOrderedConfigurationWrapper<T>(
                    serviceId, module.getModuleId(), def, log, valueType, configuration);
View Full Code Here

    @Test
    public void successful_lookup()
    {
        ObjectProvider provider = newObjectProvider();
        ServiceLocator locator = newServiceLocator();
        Runnable r = newRunnable();
        SymbolSource source = newSymbolSource();

        train_expandSymbols(source, "prefix:expression");
        train_provide(provider, "expression", Runnable.class, locator, r);
View Full Code Here

    @Test
    public void successful_lookup_case_insensitive()
    {
        ObjectProvider provider = newObjectProvider();
        ServiceLocator locator = newServiceLocator();
        Runnable r = newRunnable();
        SymbolSource source = newSymbolSource();

        train_expandSymbols(source, "PREFIX:expression");
        train_provide(provider, "expression", Runnable.class, locator, r);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.ServiceLocator

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.