use of org.springframework.context.support.ResourceBundleMessageSource in project solarnetwork-central by SolarNetwork.
the class DatumExportStandardServiceConfig method csvDatumExportOutputFormatService.
@Bean
public DatumExportOutputFormatService csvDatumExportOutputFormatService() {
CsvDatumExportOutputFormatService service = new CsvDatumExportOutputFormatService();
service.setTemporaryPath(temporaryDir);
ResourceBundleMessageSource msgSource = new ResourceBundleMessageSource();
msgSource.setBasenames(CsvDatumExportOutputFormatService.class.getName(), OutputConfiguration.class.getName());
service.setMessageSource(msgSource);
return service;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project solarnetwork-central by SolarNetwork.
the class DaoUserEventHookBizTests method availableTopics_multipleProducers_overlapTopic.
@Test
public void availableTopics_multipleProducers_overlapTopic() {
// GIVEN
DatumAppEventProducer producer1 = EasyMock.createMock(DatumAppEventProducer.class);
DatumAppEventProducer producer2 = EasyMock.createMock(DatumAppEventProducer.class);
biz.setDatumEventProducers(asList(producer2, producer1));
String topic = "topic/3";
expect(producer2.getProducedDatumAppEventTopics()).andReturn(singleton(topic));
expect(producer1.getProducedDatumAppEventTopics()).andReturn(singleton(topic));
ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
ms.setBasename("net/solarnetwork/central/user/event/biz/dao/test/test-messages-03");
expect(producer2.getMessageSource()).andReturn(ms);
// WHEN
replayAll(producer1, producer2);
Iterable<LocalizedServiceInfo> itr = biz.availableDatumEventTopics(Locale.ENGLISH);
// THEN
assertThat("Service info iterable returned", itr, notNullValue());
List<LocalizedServiceInfo> infos = StreamSupport.stream(itr.spliterator(), false).collect(toList());
assertThat("Service info count", infos, hasSize(1));
LocalizedServiceInfo info;
info = infos.get(0);
assertThat("Service info ID is topic", info.getId(), equalTo(topic));
assertThat("Service name from i18n bundle", info.getLocalizedName(), equalTo("TOPIC-03-3"));
assertThat("Service description from i18n bundle", info.getLocalizedDescription(), equalTo("DESC-03-3"));
}
use of org.springframework.context.support.ResourceBundleMessageSource in project solarnetwork-central by SolarNetwork.
the class UserEventHookBizConfig method userEventHookBiz.
@Bean
public UserEventHookBiz userEventHookBiz() {
DaoUserEventHookBiz biz = new DaoUserEventHookBiz(userNodeEventHookConfiguationDao);
biz.setDatumEventProducers(datumAppEventProducers);
biz.setNodeEventHookServices(userNodeEventHookServices);
ResourceBundleMessageSource msgSource = new ResourceBundleMessageSource();
msgSource.setBasenames("net.solarnetwork.central.user.event.biz.UserEventHook");
biz.setMessageSource(msgSource);
return biz;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project solarnetwork-central by SolarNetwork.
the class UserEventServiceNoopConfig method noopUserNodeEventHookService.
@Bean
public UserNodeEventHookService noopUserNodeEventHookService() {
NoopUserNodeEventHookService service = new NoopUserNodeEventHookService();
ResourceBundleMessageSource msgSource = new ResourceBundleMessageSource();
msgSource.setBasenames(NoopUserNodeEventHookService.class.getName());
service.setMessageSource(msgSource);
return service;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project study by bage2014.
the class WebAppConfig method messageSource.
@Bean
public ResourceBundleMessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("Messages");
return messageSource;
}
Aggregations