Search in sources :

Example 1 with MessageSourceAccessor

use of org.springframework.context.support.MessageSourceAccessor in project gocd by gocd.

the class LocalizerTest method shouldLocalizeDurations.

@Test
public void shouldLocalizeDurations() {
    CurrentLocale locale = new CurrentLocale();
    ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    source.setBasename("test_message");
    MessageSourceAccessor accessor = new MessageSourceAccessor(source);
    Localizer localizer = new Localizer(accessor, locale);
    assertThat(localizer.localize(new Duration(1000)), is("1 second"));
    assertThat(localizer.localize(new Duration(0)), is(""));
    locale.setLocaleString(Localizer.LOCALE_KANNADA);
    assertThat(localizer.localize(new Duration(1000)), is("1 second"));
}
Also used : MessageSourceAccessor(org.springframework.context.support.MessageSourceAccessor) ReloadableResourceBundleMessageSource(org.springframework.context.support.ReloadableResourceBundleMessageSource) Duration(org.joda.time.Duration) Test(org.junit.Test)

Example 2 with MessageSourceAccessor

use of org.springframework.context.support.MessageSourceAccessor in project spring-security by spring-projects.

the class AccountStatusUserDetailsChecker method setMessageSource.

/**
 * @since 5.2
 */
@Override
public void setMessageSource(MessageSource messageSource) {
    Assert.notNull(messageSource, "messageSource cannot be null");
    this.messages = new MessageSourceAccessor(messageSource);
}
Also used : MessageSourceAccessor(org.springframework.context.support.MessageSourceAccessor)

Example 3 with MessageSourceAccessor

use of org.springframework.context.support.MessageSourceAccessor in project spring-security by spring-projects.

the class AbstractUserDetailsReactiveAuthenticationManager method setMessageSource.

/**
 * @since 5.5
 */
@Override
public void setMessageSource(MessageSource messageSource) {
    Assert.notNull(messageSource, "messageSource cannot be null");
    this.messages = new MessageSourceAccessor(messageSource);
}
Also used : MessageSourceAccessor(org.springframework.context.support.MessageSourceAccessor)

Example 4 with MessageSourceAccessor

use of org.springframework.context.support.MessageSourceAccessor in project spring-security by spring-projects.

the class AnonymousAuthenticationProvider method setMessageSource.

@Override
public void setMessageSource(MessageSource messageSource) {
    Assert.notNull(messageSource, "messageSource cannot be null");
    this.messages = new MessageSourceAccessor(messageSource);
}
Also used : MessageSourceAccessor(org.springframework.context.support.MessageSourceAccessor)

Example 5 with MessageSourceAccessor

use of org.springframework.context.support.MessageSourceAccessor in project spring-security by spring-projects.

the class JdbcDaoImpl method setMessageSource.

@Override
public void setMessageSource(MessageSource messageSource) {
    Assert.notNull(messageSource, "messageSource cannot be null");
    this.messages = new MessageSourceAccessor(messageSource);
}
Also used : MessageSourceAccessor(org.springframework.context.support.MessageSourceAccessor)

Aggregations

MessageSourceAccessor (org.springframework.context.support.MessageSourceAccessor)18 Test (org.junit.Test)3 Test (org.junit.jupiter.api.Test)3 ReloadableResourceBundleMessageSource (org.springframework.context.support.ReloadableResourceBundleMessageSource)3 Locale (java.util.Locale)2 TerminateSessionEvent (com.evolveum.midpoint.TerminateSessionEvent)1 AuthenticationEvaluatorImpl (com.evolveum.midpoint.authentication.impl.evaluator.AuthenticationEvaluatorImpl)1 GuiProfiledPrincipal (com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipal)1 GuiProfiledPrincipalManager (com.evolveum.midpoint.model.api.authentication.GuiProfiledPrincipalManager)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 List (java.util.List)1 DateTime (org.joda.time.DateTime)1 Duration (org.joda.time.Duration)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 BadCredentialsException (org.springframework.security.authentication.BadCredentialsException)1 DefaultLoginPageGeneratingFilter (org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter)1