Search in sources :

Example 1 with TSession

use of org.simbasecurity.api.service.thrift.TSession 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);
}
Also used : SessionDTO(org.simbasecurity.manager.service.rest.dto.SessionDTO) TSession(org.simbasecurity.api.service.thrift.TSession) Test(org.junit.Test)

Example 2 with TSession

use of org.simbasecurity.api.service.thrift.TSession 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);
}
Also used : SessionDTO(org.simbasecurity.manager.service.rest.dto.SessionDTO) TSession(org.simbasecurity.api.service.thrift.TSession) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 TSession (org.simbasecurity.api.service.thrift.TSession)2 SessionDTO (org.simbasecurity.manager.service.rest.dto.SessionDTO)2