use of org.simbasecurity.manager.service.rest.dto.SessionDTO in project simba-os by cegeka.
the class SessionDTOAssemblerTest method testAssembleMultipleSessions.
@Test
public void testAssembleMultipleSessions() {
TSession session = new TSession();
session.setUserName("username");
session.setSsoToken("token");
session.setClientIpAddress("127.0.0.1");
session.setCreationTime(12345L);
session.setLastAccessTime(23456L);
Collection<SessionDTO> sessionDataList = DTOAssembler.list(Collections.singletonList(session));
assertThat(sessionDataList).extracting(SessionDTO::getUserName).containsExactly("username");
assertThat(sessionDataList).extracting(SessionDTO::getSsoToken).containsExactly("token");
assertThat(sessionDataList).extracting(SessionDTO::getClientIpAddress).containsExactly("127.0.0.1");
assertThat(sessionDataList).extracting(SessionDTO::getCreationTime).containsExactly(12345L);
assertThat(sessionDataList).extracting(SessionDTO::getLastAccessTime).containsExactly(23456L);
}
use of org.simbasecurity.manager.service.rest.dto.SessionDTO in project simba-os by cegeka.
the class SessionDTOAssemblerTest method testAssembleSingleSession.
@Test
public void testAssembleSingleSession() {
TSession session = new TSession();
session.setUserName("username");
session.setSsoToken("token");
session.setClientIpAddress("127.0.0.1");
session.setCreationTime(12345L);
session.setLastAccessTime(23456L);
SessionDTO sessionData = DTOAssembler.assemble(session);
assertThat(sessionData).isNotNull();
assertThat(session.getUserName()).isEqualTo("username");
assertThat(session.getSsoToken()).isEqualTo("token");
assertThat(session.getClientIpAddress()).isEqualTo("127.0.0.1");
assertThat(session.getCreationTime()).isEqualTo(12345L);
assertThat(session.getLastAccessTime()).isEqualTo(23456L);
}
Aggregations