Package org.openengsb.core.api.l10n

Examples of org.openengsb.core.api.l10n.LocalizableString


        return new StringResourceModel(key, component, null).getString();
    }

    @Override
    public LocalizableString getString(final String key, String... parameters) {
        return new LocalizableString() {
            @Override
            public String getKey() {
                return key;
            }
View Full Code Here


    }

    @Test
    public void testAddEnumValues_shouldWork() throws Exception {
        StringLocalizer mock = Mockito.mock(StringLocalizer.class);
        LocalizableString mock2 = Mockito.mock(LocalizableString.class);
        LocalizableString mock3 = Mockito.mock(LocalizableString.class);
        when(mock2.getKey()).thenReturn("123");
        when(mock2.getString(Locale.getDefault())).thenReturn("ONE");
        when(mock2.getKey()).thenReturn("123");
        when(mock3.getString(Locale.getDefault())).thenReturn("TWO");
        when(mock.getString("ONE")).thenReturn(mock2);
        when(mock.getString("TWO")).thenReturn(mock2);

        Builder builder = AttributeDefinition.builder(mock);
        builder.name("ONE").id("123");
View Full Code Here

     *
     * Also the service is registered with the mocked service-registry with the given name as domain-value
     */
    protected DomainProvider createDomainProviderMock(final Class<? extends Domain> interfaze, String name) {
        DomainProvider domainProviderMock = mock(DomainProvider.class);
        LocalizableString testDomainLocalizedStringMock = mock(LocalizableString.class);
        when(testDomainLocalizedStringMock.getString(Mockito.<Locale> any())).thenReturn(name);
        when(domainProviderMock.getId()).thenReturn(name);
        when(domainProviderMock.getName()).thenReturn(testDomainLocalizedStringMock);
        when(domainProviderMock.getDescription()).thenReturn(testDomainLocalizedStringMock);
        when(domainProviderMock.getDomainInterface()).thenAnswer(new Answer<Class<? extends Domain>>() {
            @Override
View Full Code Here

    /**
     * creates a {@link LocalizableString} that returns the given value for all {@link Locale}s
     */
    protected LocalizableString mockLocalizeableString(String value) {
        LocalizableString mock2 = mock(LocalizableString.class);
        when(mock2.getString(any(Locale.class))).thenReturn(value);
        return mock2;
    }
View Full Code Here

        props.put(org.openengsb.core.api.Constants.DOMAIN_KEY, domains);
        registerService(connectorProvider, props, ConnectorProvider.class);

        ServiceDescriptor descriptor = mock(ServiceDescriptor.class);
        when(descriptor.getId()).thenReturn(connectorType);
        LocalizableString name = mockLocalizeableString("service.name");
        when(descriptor.getName()).thenReturn(name);
        LocalizableString desc = mockLocalizeableString("service.description");
        when(descriptor.getDescription()).thenReturn(desc);
        when(connectorProvider.getDescriptor()).thenReturn(descriptor);
        return connectorProvider;
    }
View Full Code Here

            @Override
            public Class<? extends Domain> answer(InvocationOnMock invocationOnMock) throws Throwable {
                return NullDomain.class;
            }
        });
        LocalizableString descriptionMock = mock(LocalizableString.class);
        LocalizableString nameDescritptionMock = mock(LocalizableString.class);
        when(descriptionMock.getString(any(Locale.class))).thenReturn("Dummy description");
        when(nameDescritptionMock.getString(any(Locale.class))).thenReturn("Dummy Name");
        when(domainProviderMock.getDescription()).thenReturn(descriptionMock);
        when(domainProviderMock.getName()).thenReturn(nameDescritptionMock);
        domainProviders.add(domainProviderMock);

        when(osgiServiceMock.listServices(DomainProvider.class)).thenAnswer(new Answer<List<DomainProvider>>() {
View Full Code Here

        AttributeDefinition atr2 = mock(AttributeDefinition.class);
        when(atr2.getId()).thenReturn(attr1);
        when(atr2.getName()).thenAnswer(new Answer<LocalizableString>() {
            @Override
            public LocalizableString answer(InvocationOnMock invocationOnMock) throws Throwable {
                LocalizableString nameLocalizerMock = mock(LocalizableString.class);
                when(nameLocalizerMock.getString(any(Locale.class))).thenReturn("name" + id);
                return nameLocalizerMock;
            }
        });

        when(atr2.getDefaultValue()).thenAnswer(new Answer<LocalizableString>() {
            @Override
            public LocalizableString answer(InvocationOnMock invocationOnMock) throws Throwable {
                LocalizableString nameLocalizerMock = mock(LocalizableString.class);
                when(nameLocalizerMock.getString(any(Locale.class))).thenReturn("defaultValue" + id);
                return nameLocalizerMock;
            }
        });
        when(atr2.getDescription()).thenAnswer(new Answer<LocalizableString>() {
            @Override
            public LocalizableString answer(InvocationOnMock invocationOnMock) throws Throwable {
                LocalizableString nameLocalizerMock = mock(LocalizableString.class);
                when(nameLocalizerMock.getString(any(Locale.class))).thenReturn("description" + id);
                return nameLocalizerMock;
            }
        });
        return atr2;
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.l10n.LocalizableString

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.