use of io.micronaut.coherence.SessionConfigurationProvider in project micronaut-coherence by micronaut-projects.
the class GrpcSessionConfigurationBeanTest method shouldConfigureSessions.
@Test
void shouldConfigureSessions() {
Map<String, SessionConfiguration> beans = ctx.getBeansOfType(GrpcSessionConfigurationBean.class).stream().map(SessionConfigurationProvider::getConfiguration).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toMap(SessionConfiguration::getName, cfg -> cfg));
Optional<Channel> optional = ctx.findBean(Channel.class, Qualifiers.byName("default"));
assertThat(optional.isPresent(), is(true));
assertThat(beans.size(), is(2));
GrpcSessionConfiguration beanBar = (GrpcSessionConfiguration) beans.get("bar");
assertThat(beanBar, is(notNullValue()));
assertThat(beanBar.getName(), is("bar"));
assertThat(beanBar.getScopeName(), is(Coherence.DEFAULT_SCOPE));
assertThat(beanBar.getSerializer().orElseThrow(AssertionFailedError::new), notNullValue());
assertThat(beanBar.getFormat().orElseThrow(AssertionFailedError::new), is("java"));
assertThat(beanBar.enableTracing(), is(true));
GrpcSessionConfiguration beanBaz = (GrpcSessionConfiguration) beans.get("baz");
assertThat(beanBaz, is(notNullValue()));
assertThat(beanBaz.getName(), is("baz"));
assertThat(beanBaz.getScopeName(), is("scoped"));
assertThat(beanBaz.getSerializer().isPresent(), is(false));
assertThat(beanBaz.getFormat().orElseThrow(AssertionFailedError::new), is("binary"));
assertThat(beanBaz.enableTracing(), is(false));
}
Aggregations