Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.TranslatorSource


    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
View Full Code Here


    {
        Field field = mockField();
        Messages messages = mockMessages();
        Locale locale = Locale.ENGLISH;
        Class propertyType = Map.class;
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("maptrans", Map.class);
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
        String label = "My Label";
View Full Code Here

    public void create_translator_from_translator_name()
    {
        ComponentResources resources = mockComponentResources();
        FieldComponent field = mockFieldComponent();
        Messages messages = mockMessages();
        TranslatorSource ts = mockTranslatorSource();
        FormSupport fs = mockFormSupport();
        Translator translator = mockTranslator("map", Map.class);
        Messages globalMessages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        MarkupWriter writer = mockMarkupWriter();
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";
        String expression = "mock";

        expect(source.get(expression)).andReturn(translator);

        replay();

        BindingFactory factory = new TranslateBindingFactory(source);
View Full Code Here

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

        replay();

        TranslatorSource source = new TranslatorSourceImpl(configuration);

        assertSame(source.get("mock"), translator);

        verify();
    }
View Full Code Here

        configuration.put("fred", fred);
        configuration.put("barney", barney);

        replay();

        TranslatorSource source = new TranslatorSourceImpl(configuration);

        try
        {
            source.get("wilma");
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals(
View Full Code Here

        train_getType(t, String.class);

        replay();

        TranslatorSource source = new TranslatorSourceImpl(configuration);

        assertSame(source.getByType(String.class), t);
        assertSame(source.findByType(String.class), t);
        assertNull(source.findByType(Integer.class));

        verify();
    }
View Full Code Here

        train_getType(string, String.class);
        train_getType(bool, Boolean.class);

        replay();

        TranslatorSource source = new TranslatorSourceImpl(configuration);

        try
        {
            source.getByType(Integer.class);
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(ex.getMessage(),
View Full Code Here

    }

    @Test
    public void default_translator_property_type_is_null()
    {
        TranslatorSource source = mockTranslatorSource();
        ComponentResources resources = mockComponentResources();

        train_getBoundType(resources, "object", null);

        replay();
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);

        replay();

        ComponentDefaultProvider provider = new ComponentDefaultProviderImpl(null, null, null, source);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.TranslatorSource

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.