Package org.apache.tapestry

Examples of org.apache.tapestry.Translator


public class TranslatorSourceImplTest extends InternalBaseTestCase
{
    @Test
    public void found_translator_by_name()
    {
        Translator translator = mockTranslator();

        Map<String, Translator> configuration = Collections.singletonMap("mock", translator);

        replay();
View Full Code Here


    }

    @Test
    public void unknown_translator_is_failure()
    {
        Translator fred = mockTranslator();
        Translator barney = mockTranslator();

        Map<String, Translator> configuration = CollectionFactory.newMap();

        configuration.put("fred", fred);
        configuration.put("barney", barney);
View Full Code Here

    }

    public Binding newBinding(String description, ComponentResources container,
            ComponentResources component, String expression, Location location)
    {
        Translator translator = _source.get(expression);

        return new LiteralBinding(description, translator, location);
    }
View Full Code Here

    }

    public Translator get(String name)
    {

        Translator result = _translators.get(name);

        if (result == null)
            throw new RuntimeException(ServicesMessages.unknownTranslatorType(name, InternalUtils
                    .sortedKeys(_translators)));
View Full Code Here

    @Test
    public void default_translator()
    {
        TranslatorSource source = mockTranslatorSource();
        ComponentResources resources = mockComponentResources();
        Translator translator = mockTranslator();

        train_getBoundType(resources, "object", Integer.class);

        expect(source.findByType(Integer.class)).andReturn(translator);
View Full Code Here

    }

    public Binding newBinding(String description, ComponentResources container,
                              ComponentResources component, String expression, Location location)
    {
        Translator translator = _source.get(expression);

        return new LiteralBinding(description, translator, location);
    }
View Full Code Here

    }

    public Translator get(String name)
    {

        Translator result = _translators.get(name);

        if (result == null)
            throw new RuntimeException(ServicesMessages.unknownTranslatorType(name, InternalUtils
                    .sortedKeys(_translators)));
View Full Code Here

        return result;
    }

    public Translator getByType(Class valueType)
    {
        Translator result = _registry.get(valueType);

        if (result == null)
        {
            List<String> names = CollectionFactory.newList();
View Full Code Here

    }

    @Test
    public void translate_binding()
    {
        Translator translator = mockTranslator();
        TranslatorSource source = newMock(TranslatorSource.class);
        ComponentResources resources = mockComponentResources();
        Location l = mockLocation();

        String description = "foo bar";
View Full Code Here


    @Test
    public void found_translator_by_name()
    {
        Translator translator = mockTranslator();

        train_getType(translator, String.class);

        Map<String, Translator> configuration = Collections.singletonMap("mock", translator);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.Translator

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.