@@ -32,34 +32,34 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Eddú Meléndez
|
||||
* @author Rob Winch
|
||||
*/
|
||||
public class AttributeTests {
|
||||
class AttributeTests {
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
void setup() {
|
||||
this.driver = new HtmlUnitDriver();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
void tearDown() {
|
||||
this.driver.quit();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void home() {
|
||||
void home() {
|
||||
HomePage home = HomePage.go(this.driver);
|
||||
home.assertAt();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noAttributes() {
|
||||
void noAttributes() {
|
||||
HomePage home = HomePage.go(this.driver);
|
||||
assertThat(home.attributes().size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAttribute() {
|
||||
void createAttribute() {
|
||||
HomePage home = HomePage.go(this.driver);
|
||||
// @formatter:off
|
||||
home = home.form()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,6 +77,7 @@ public class HomePage {
|
||||
}
|
||||
|
||||
public class Form {
|
||||
|
||||
@FindBy(name = "attributeName")
|
||||
WebElement attributeName;
|
||||
|
||||
@@ -104,9 +105,11 @@ public class HomePage {
|
||||
this.submit.click();
|
||||
return PageFactory.initElements(HomePage.this.driver, page);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Attribute {
|
||||
|
||||
@FindBy(xpath = ".//td[1]")
|
||||
WebElement attributeName;
|
||||
|
||||
@@ -130,6 +133,7 @@ public class HomePage {
|
||||
public String getAttributeValue() {
|
||||
return this.attributeValue.getText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,8 +49,7 @@ public class Initializer implements ServletContextListener {
|
||||
Map<String, Session> sessions = this.instance.getMap(SESSION_MAP_NAME);
|
||||
|
||||
MapSessionRepository sessionRepository = new MapSessionRepository(sessions);
|
||||
SessionRepositoryFilter<? extends Session> filter = new SessionRepositoryFilter<>(
|
||||
sessionRepository);
|
||||
SessionRepositoryFilter<? extends Session> filter = new SessionRepositoryFilter<>(sessionRepository);
|
||||
|
||||
Dynamic fr = sce.getServletContext().addFilter("springSessionFilter", filter);
|
||||
fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
|
||||
@@ -64,12 +63,9 @@ public class Initializer implements ServletContextListener {
|
||||
private HazelcastInstance createHazelcastInstance() {
|
||||
Config config = new Config();
|
||||
|
||||
config.getNetworkConfig()
|
||||
.setPort(getAvailablePort())
|
||||
.getJoin().getMulticastConfig().setEnabled(false);
|
||||
config.getNetworkConfig().setPort(getAvailablePort()).getJoin().getMulticastConfig().setEnabled(false);
|
||||
|
||||
config.getMapConfig(SESSION_MAP_NAME)
|
||||
.setTimeToLiveSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
|
||||
config.getMapConfig(SESSION_MAP_NAME).setTimeToLiveSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
|
||||
|
||||
return Hazelcast.newHazelcastInstance(config);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,8 +31,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class SessionServlet extends HttpServlet {
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||
throws ServletException, IOException {
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String attributeName = req.getParameter("attributeName");
|
||||
String attributeValue = req.getParameter("attributeValue");
|
||||
req.getSession().setAttribute(attributeName, attributeValue);
|
||||
@@ -40,4 +39,5 @@ public class SessionServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 2878267318695777395L;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user