本文整理匯總了Java中io.undertow.servlet.api.SessionPersistenceManager.PersistentSession類的典型用法代碼示例。如果您正苦於以下問題:Java PersistentSession類的具體用法?Java PersistentSession怎麽用?Java PersistentSession使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PersistentSession類屬於io.undertow.servlet.api.SessionPersistenceManager包,在下文中一共展示了PersistentSession類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: persistAndLoad
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void persistAndLoad() throws Exception {
Map<String, PersistentSession> sessionData = new LinkedHashMap<String, PersistentSession>();
Map<String, Object> data = new LinkedHashMap<String, Object>();
data.put("spring", "boot");
PersistentSession session = new PersistentSession(this.expiration, data);
sessionData.put("abc", session);
this.persistence.persistSessions("test", sessionData);
Map<String, PersistentSession> restored = this.persistence
.loadSessionAttributes("test", this.classLoader);
assertThat(restored).isNotNull();
assertThat(restored.get("abc").getExpiration()).isEqualTo(this.expiration);
assertThat(restored.get("abc").getSessionData().get("spring")).isEqualTo("boot");
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:FileSessionPersistenceTests.java
示例2: dontRestoreExpired
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void dontRestoreExpired() throws Exception {
Date expired = new Date(System.currentTimeMillis() - 1000);
Map<String, PersistentSession> sessionData = new LinkedHashMap<String, PersistentSession>();
Map<String, Object> data = new LinkedHashMap<String, Object>();
data.put("spring", "boot");
PersistentSession session = new PersistentSession(expired, data);
sessionData.put("abc", session);
this.persistence.persistSessions("test", sessionData);
Map<String, PersistentSession> restored = this.persistence
.loadSessionAttributes("test", this.classLoader);
assertThat(restored).isNotNull();
assertThat(restored.containsKey("abc")).isFalse();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:FileSessionPersistenceTests.java
示例3: deleteFileOnClear
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void deleteFileOnClear() throws Exception {
File sessionFile = new File(this.dir, "test.session");
Map<String, PersistentSession> sessionData = new LinkedHashMap<String, PersistentSession>();
this.persistence.persistSessions("test", sessionData);
assertThat(sessionFile.exists()).isTrue();
this.persistence.clear("test");
assertThat(sessionFile.exists()).isFalse();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:FileSessionPersistenceTests.java
示例4: presistAndLoad
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void presistAndLoad() throws Exception {
Map<String, PersistentSession> sessionData = new LinkedHashMap<String, PersistentSession>();
Map<String, Object> data = new LinkedHashMap<String, Object>();
data.put("spring", "boot");
PersistentSession session = new PersistentSession(this.expiration, data);
sessionData.put("abc", session);
this.persistence.persistSessions("test", sessionData);
Map<String, PersistentSession> restored = this.persistence
.loadSessionAttributes("test", this.classLoader);
assertThat(restored, notNullValue());
assertThat(restored.get("abc").getExpiration(), equalTo(this.expiration));
assertThat(restored.get("abc").getSessionData().get("spring"),
equalTo((Object) "boot"));
}
示例5: dontRestoreExpired
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void dontRestoreExpired() throws Exception {
Date expired = new Date(System.currentTimeMillis() - 1000);
Map<String, PersistentSession> sessionData = new LinkedHashMap<String, PersistentSession>();
Map<String, Object> data = new LinkedHashMap<String, Object>();
data.put("spring", "boot");
PersistentSession session = new PersistentSession(expired, data);
sessionData.put("abc", session);
this.persistence.persistSessions("test", sessionData);
Map<String, PersistentSession> restored = this.persistence
.loadSessionAttributes("test", this.classLoader);
assertThat(restored, notNullValue());
assertThat(restored.containsKey("abc"), equalTo(false));
}
示例6: deleteFileOnClear
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void deleteFileOnClear() throws Exception {
File sessionFile = new File(this.folder, "test.session");
Map<String, PersistentSession> sessionData = new LinkedHashMap<String, PersistentSession>();
this.persistence.persistSessions("test", sessionData);
assertThat(sessionFile.exists(), equalTo(true));
this.persistence.clear("test");
assertThat(sessionFile.exists(), equalTo(false));
}
示例7: loadsNullForMissingFile
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void loadsNullForMissingFile() throws Exception {
Map<String, PersistentSession> attributes = this.persistence
.loadSessionAttributes("test", this.classLoader);
assertThat(attributes).isNull();
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:7,代碼來源:FileSessionPersistenceTests.java
示例8: loadsNullForMissingFile
import io.undertow.servlet.api.SessionPersistenceManager.PersistentSession; //導入依賴的package包/類
@Test
public void loadsNullForMissingFile() throws Exception {
Map<String, PersistentSession> attributes = this.persistence
.loadSessionAttributes("test", this.classLoader);
assertThat(attributes, nullValue());
}