use of org.springframework.web.server.WebSession in project spring-session by spring-projects.
the class SpringSessionWebSessionStoreTests method createSessionWhenGetAttributesAndPutNullThenDelegatesToCreateSession.
@Test
public void createSessionWhenGetAttributesAndPutNullThenDelegatesToCreateSession() {
WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map<String, Object> attributes = createdWebSession.getAttributes();
attributes.put("a", null);
verify(this.createSession).setAttribute("a", null);
}
use of org.springframework.web.server.WebSession in project spring-session by spring-projects.
the class SpringSessionWebSessionStoreTests method createSessionWhenGetAttributesAndClearThenDelegatesToCreateSession.
@Test
public void createSessionWhenGetAttributesAndClearThenDelegatesToCreateSession() {
given(this.createSession.getAttributeNames()).willReturn(Collections.singleton("a"));
WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map<String, Object> attributes = createdWebSession.getAttributes();
attributes.clear();
verify(this.createSession).removeAttribute("a");
}
use of org.springframework.web.server.WebSession in project spring-session by spring-projects.
the class SpringSessionWebSessionStoreTests method createSessionWhenGetAttributesAndKeySetThenDelegatesToCreateSession.
@Test
public void createSessionWhenGetAttributesAndKeySetThenDelegatesToCreateSession() {
given(this.createSession.getAttributeNames()).willReturn(Collections.singleton("a"));
WebSession createdWebSession = this.webSessionStore.createWebSession().block();
Map<String, Object> attributes = createdWebSession.getAttributes();
assertThat(attributes.keySet()).containsExactly("a");
}
use of org.springframework.web.server.WebSession in project spring-session by spring-projects.
the class SpringSessionWebSessionStoreTests method storeSessionWhenInvokedThenSessionSaved.
@Test
public void storeSessionWhenInvokedThenSessionSaved() {
given(this.sessionRepository.save(this.createSession)).willReturn(Mono.empty());
WebSession createdSession = this.webSessionStore.createWebSession().block();
this.webSessionStore.storeSession(createdSession).block();
verify(this.sessionRepository).save(this.createSession);
}
use of org.springframework.web.server.WebSession in project spring-session by spring-projects.
the class SpringSessionWebSessionStoreTests method retrieveSessionThenStarted.
@Test
public void retrieveSessionThenStarted() {
String id = "id";
WebSession retrievedWebSession = this.webSessionStore.retrieveSession(id).block();
assertThat(retrievedWebSession.isStarted()).isTrue();
}
Aggregations