Package net.rubyeye.xmemcached.test.unittest

Examples of net.rubyeye.xmemcached.test.unittest.MockSession


    this.locator = new KetamaMemcachedSessionLocator();
  }

  @Test
  public void testGetSessionByKey_MoreSessions() {
    MockSession session1 = new MockSession(8080);
    MockSession session2 = new MockSession(8081);
    MockSession session3 = new MockSession(8082);
    List<Session> list = new ArrayList<Session>();
    list.add(session1);
    list.add(session2);
    list.add(session3);
    this.locator.updateSessions(list);
View Full Code Here


  }

  @Test
  public void testGetSessionByKey_MoreSessions_OneClosed() {
    MockSession session1 = new MockSession(8080);
    MockSession session2 = new MockSession(8081);
    session1.close();
    MockSession session3 = new MockSession(8082);
    List<Session> list = new ArrayList<Session>();
    list.add(session1);
    list.add(session2);
    list.add(session3);
    this.locator.updateSessions(list);
View Full Code Here

  }

  @Test
  public void testGetSessionByKey_MoreSessions_OneClosed_FailureMode() {
    this.locator.setFailureMode(true);
    MockSession session1 = new MockSession(8080);
    MockSession session2 = new MockSession(8081);
    session1.close();
    MockSession session3 = new MockSession(8082);
    List<Session> list = new ArrayList<Session>();
    list.add(session1);
    list.add(session2);
    list.add(session3);
    this.locator.updateSessions(list);
View Full Code Here

    assertNull(this.locator.getSessionByKey("test"));
  }

  @Test
  public void testGetSessionByKey_OneSession() {
    MockSession session = new MockSession(8080);
    List<Session> list = new ArrayList<Session>();
    list.add(session);
    this.locator.updateSessions(list);

    assertSame(session, this.locator.getSessionByKey("a"));
View Full Code Here

  public void testArraySessionLocator() {
    sessionLocator = new ArrayMemcachedSessionLocator();

    List<Session> sessions = new ArrayList<Session>();
    for (int i = 8080; i < 8100; i++) {
      sessions.add(new MockSession(i));
    }
    sessionLocator.updateSessions(sessions);
    for (int i = 1; i <= 10; i++) {
      String key = String.valueOf(i);
      int mod = key.hashCode() % sessions.size();
View Full Code Here

  public void testKetamaMemcachedSessionLocator() {
    sessionLocator = new KetamaMemcachedSessionLocator(
        HashAlgorithm.NATIVE_HASH);
    List<Session> sessions = new ArrayList<Session>();
    for (int i = 8080; i < 8100; i++) {
      sessions.add(new MockSession(i));
    }
    sessionLocator.updateSessions(sessions);
    for (int i = 1; i <= 10; i++) {
      String key = String.valueOf(i);
View Full Code Here

    this.locator = new RoundRobinMemcachedSessionLocator();
  }

  @Test
  public void testGetSessionByKey() {
    MockSession session1 = new MockSession(8080);
    MockSession session2 = new MockSession(8080);
    MockSession session3 = new MockSession(8080);
    List<Session> list = new ArrayList<Session>();
    list.add(session1);
    list.add(session2);
    list.add(session3);
    this.locator.updateSessions(list);
View Full Code Here

TOP

Related Classes of net.rubyeye.xmemcached.test.unittest.MockSession

Copyright © 2018 www.massapicom. 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.