Search in sources :

Example 1 with HotRodSessionManagementConfiguration

use of org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementConfiguration 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

InputStream (java.io.InputStream)1 URL (java.net.URL)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 XMLMapper (org.jboss.staxmapper.XMLMapper)1 Test (org.junit.Test)1 HotRodSessionManagementConfiguration (org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementConfiguration)1 HotRodSessionManagementProvider (org.wildfly.clustering.web.hotrod.session.HotRodSessionManagementProvider)1 DistributableSessionManagementProvider (org.wildfly.clustering.web.session.DistributableSessionManagementProvider)1