use of org.wildfly.clustering.web.infinispan.session.InfinispanSessionManagementConfiguration in project wildfly by wildfly.
the class DistributableWebDeploymentXMLReaderTestCase method testInfinispan.
@Test
public void testInfinispan() throws IOException, XMLStreamException {
URL url = this.getClass().getResource(String.format("distributable-web-infinispan-%d.%d.xml", this.schema.major(), this.schema.minor()));
XMLMapper mapper = XMLMapper.Factory.create();
mapper.registerRootElement(this.schema.getRoot(), new DistributableWebDeploymentXMLReader(this.schema));
try (InputStream input = url.openStream()) {
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(input);
MutableDistributableDeploymentConfiguration config = new MutableDistributableDeploymentConfiguration();
mapper.parseDocument(config, reader);
Assert.assertNull(config.getSessionManagementName());
DistributableSessionManagementProvider result = config.getSessionManagement();
Assert.assertNotNull(result);
Assert.assertTrue(result instanceof InfinispanSessionManagementProvider);
InfinispanSessionManagementProvider provider = (InfinispanSessionManagementProvider) result;
InfinispanSessionManagementConfiguration configuration = provider.getSessionManagementConfiguration();
Assert.assertEquals("foo", configuration.getContainerName());
Assert.assertEquals("bar", configuration.getCacheName());
Assert.assertSame(SessionAttributePersistenceStrategy.FINE, configuration.getAttributePersistenceStrategy());
if (this.schema.since(DistributableWebDeploymentSchema.VERSION_2_0)) {
Assert.assertTrue(provider.getRouteLocatorServiceConfiguratorFactory() instanceof RankedRouteLocatorServiceConfiguratorFactory);
RankedRoutingConfiguration routing = ((RankedRouteLocatorServiceConfiguratorFactory) provider.getRouteLocatorServiceConfiguratorFactory()).getConfiguration();
Assert.assertEquals(":", routing.getDelimiter());
Assert.assertEquals(4, routing.getMaxRoutes());
} else {
Assert.assertTrue(provider.getRouteLocatorServiceConfiguratorFactory() instanceof NullRouteLocatorServiceConfiguratorFactory);
}
Assert.assertNotNull(config.getImmutableClasses());
Assert.assertEquals(Arrays.asList(Locale.class.getName(), UUID.class.getName()), config.getImmutableClasses());
} finally {
mapper.unregisterRootAttribute(this.schema.getRoot());
}
}
Aggregations