Search in sources :

Example 6 with DistributableSessionManagementProvider

use of org.wildfly.clustering.web.session.DistributableSessionManagementProvider in project wildfly by wildfly.

the class DistributableWebDeploymentXMLReaderTestCase method testHotRod.

@Test
public void testHotRod() throws IOException, XMLStreamException {
    URL url = this.getClass().getResource(String.format("distributable-web-hotrod-%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 HotRodSessionManagementProvider);
        HotRodSessionManagementConfiguration configuration = ((HotRodSessionManagementProvider) result).getSessionManagementConfiguration();
        Assert.assertEquals("foo", configuration.getContainerName());
        Assert.assertSame(SessionAttributePersistenceStrategy.FINE, configuration.getAttributePersistenceStrategy());
    } finally {
        mapper.unregisterRootAttribute(this.schema.getRoot());
    }
}
Also used : XMLMapper(org.jboss.staxmapper.XMLMapper) HotRodSessionManagementProvider(org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementProvider) HotRodSessionManagementConfiguration(org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementConfiguration) XMLStreamReader(javax.xml.stream.XMLStreamReader) InputStream(java.io.InputStream) DistributableSessionManagementProvider(org.wildfly.clustering.web.session.DistributableSessionManagementProvider) URL(java.net.URL) Test(org.junit.Test)

Aggregations

DistributableSessionManagementProvider (org.wildfly.clustering.web.session.DistributableSessionManagementProvider)6 InputStream (java.io.InputStream)2 URL (java.net.URL)2 XMLStreamReader (javax.xml.stream.XMLStreamReader)2 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)2 Service (org.jboss.msc.Service)2 ServiceName (org.jboss.msc.service.ServiceName)2 XMLMapper (org.jboss.staxmapper.XMLMapper)2 Test (org.junit.Test)2 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 WarMetaData (org.jboss.as.web.common.WarMetaData)1 SharedSessionManagerConfig (org.jboss.as.web.session.SharedSessionManagerConfig)1 Module (org.jboss.modules.Module)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1 SimpleImmutability (org.wildfly.clustering.ee.immutable.SimpleImmutability)1 FunctionalService (org.wildfly.clustering.service.FunctionalService)1 NullRouteLocatorServiceConfiguratorFactory (org.wildfly.clustering.web.cache.routing.NullRouteLocatorServiceConfiguratorFactory)1 HotRodSessionManagementConfiguration (org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementConfiguration)1 HotRodSessionManagementProvider (org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementProvider)1 RankedRouteLocatorServiceConfiguratorFactory (org.wildfly.clustering.web.infinispan.routing.RankedRouteLocatorServiceConfiguratorFactory)1