Examples of RedisSession


Examples of com.cxy.redisclient.integration.protocol.RedisSession

import com.cxy.redisclient.integration.protocol.RedisSession;
import com.cxy.redisclient.integration.protocol.Result;

public class TestClient extends TestCase {
  public void testSet() throws IOException {
    RedisSession client = new RedisSession("localhost", 80);
    client.connect();
    Result result = client.execute("multi\r\n");
    System.out.println(result.getResult());
    result = client.execute("incr int\r\n");
    System.out.println(result.getResult());
    result = client.execute("incr int\r\n");
    System.out.println(result.getResult());
    result = client.execute("incr int\r\n");
    System.out.println(result.getResult());
    result = client.execute("incr int\r\n");
    System.out.println(result);
    Result result1 = client.execute("exec\r\n");
    System.out.println(result1.getResult());
    client.disconnect();
  }
View Full Code Here

Examples of com.cxy.redisclient.integration.protocol.RedisSession

    tabFolder_2.setSelection(tbtmNewItem_1);
    inputCmd.setFocus();

    sashForm3.setWeights(new int[] { 1, 1 });
   
    session = new RedisSession(server.getHost(), Integer.parseInt(server.getPort()));
    try {
      session.connect();
    } catch (IOException e) {
      throw new RuntimeException(e.getMessage());
    }
View Full Code Here

Examples of org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession

        assertThat(session.getMaxInactiveInterval()).isEqualTo(interval);
    }

    @Test
    public void saveNewSession() {
        RedisSession session = redisRepository.createSession();
        when(redisOperations.boundHashOps(getKey(session.getId()))).thenReturn(boundHashOperations);
        when(expirationRedisOperations.boundSetOps(anyString())).thenReturn(boundSetOperations);

        redisRepository.save(session);

        Map<String,Object> delta = getDelta();
View Full Code Here

Examples of org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession

        assertThat(delta.get(LAST_ACCESSED_ATTR)).isEqualTo(creationTime);
    }

    @Test
    public void saveLastAccessChanged() {
        RedisSession session = redisRepository.new RedisSession(new MapSession());
        session.setLastAccessedTime(12345678L);
        when(redisOperations.boundHashOps(getKey(session.getId()))).thenReturn(boundHashOperations);
        when(expirationRedisOperations.boundSetOps(anyString())).thenReturn(boundSetOperations);

        redisRepository.save(session);

        assertThat(getDelta()).isEqualTo(map(LAST_ACCESSED_ATTR, session.getLastAccessedTime()));
    }
View Full Code Here

Examples of org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession

    }

    @Test
    public void saveSetAttribute() {
        String attrName = "attrName";
        RedisSession session = redisRepository.new RedisSession(new MapSession());
        session.setAttribute(attrName, "attrValue");
        when(redisOperations.boundHashOps(getKey(session.getId()))).thenReturn(boundHashOperations);
        when(expirationRedisOperations.boundSetOps(anyString())).thenReturn(boundSetOperations);

        redisRepository.save(session);

        assertThat(getDelta()).isEqualTo(map(getSessionAttrNameKey(attrName), session.getAttribute(attrName)));
    }
View Full Code Here

Examples of org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession

    }

    @Test
    public void saveRemoveAttribute() {
        String attrName = "attrName";
        RedisSession session = redisRepository.new RedisSession(new MapSession());
        session.removeAttribute(attrName);
        when(redisOperations.boundHashOps(getKey(session.getId()))).thenReturn(boundHashOperations);
        when(expirationRedisOperations.boundSetOps(anyString())).thenReturn(boundSetOperations);

        redisRepository.save(session);

        assertThat(getDelta()).isEqualTo(map(getSessionAttrNameKey(attrName), null));
View Full Code Here

Examples of org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession

    }

    @Test
    public void redisSessionGetAttributes() {
        String attrName = "attrName";
        RedisSession session = redisRepository.new RedisSession(new MapSession());
        assertThat(session.getAttributeNames()).isEmpty();
        session.setAttribute(attrName, "attrValue");
        assertThat(session.getAttributeNames()).containsOnly(attrName);
        session.removeAttribute(attrName);
        assertThat(session.getAttributeNames()).isEmpty();
    }
View Full Code Here

Examples of org.springframework.session.data.redis.RedisOperationsSessionRepository.RedisSession

                MAX_INACTIVE_ATTR, expected.getMaxInactiveInterval(),
                LAST_ACCESSED_ATTR, expected.getLastAccessedTime());
        when(boundHashOperations.entries()).thenReturn(map);

        long now = System.currentTimeMillis();
        RedisSession session = redisRepository.getSession(expected.getId());
        assertThat(session.getId()).isEqualTo(expected.getId());
        assertThat(session.getAttributeNames()).isEqualTo(expected.getAttributeNames());
        assertThat(session.getAttribute(attrName)).isEqualTo(expected.getAttribute(attrName));
        assertThat(session.getCreationTime()).isEqualTo(expected.getCreationTime());
        assertThat(session.getMaxInactiveInterval()).isEqualTo(expected.getMaxInactiveInterval());
        assertThat(session.getLastAccessedTime()).isGreaterThanOrEqualTo(now);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.