Package net.sf.katta.util

Examples of net.sf.katta.util.SleepServer.sleep()


  @Test
  public void testNoSleep() throws Exception {
    SleepServer server = new SleepServer();
    long start = System.currentTimeMillis();
    server.sleep(0, 0, null);
    long time = System.currentTimeMillis() - start;
    assertTrue(time < 10);
  }

  @Test
View Full Code Here


  @Test
  public void testSleep() throws Exception {
    SleepServer server = new SleepServer();
    long start = System.currentTimeMillis();
    server.sleep(100, 0, null);
    long time = System.currentTimeMillis() - start;
    assertTrue("took " + time, time >= 100);
  }

  @Test
View Full Code Here

  @Test
  public void testShards() throws IllegalArgumentException {
    SleepServer server = new SleepServer();
    server.init("sleepy", newNodeConfiguration());
    try {
      server.sleep(0L, 0, new String[] { "not-found" });
      fail("Should have failed");
    } catch (IllegalArgumentException e) {
      assertEquals("Node sleepy invalid shards: not-found", e.getMessage());
    }
    server.addShard("s1", null);
View Full Code Here

      fail("Should have failed");
    } catch (IllegalArgumentException e) {
      assertEquals("Node sleepy invalid shards: not-found", e.getMessage());
    }
    server.addShard("s1", null);
    server.sleep(0L, 0, new String[] { "s1" });
    try {
      server.sleep(0L, 0, new String[] { "s1", "s2" });
    } catch (IllegalArgumentException e) {
      assertEquals("Node sleepy invalid shards: s2", e.getMessage());
    }
View Full Code Here

      assertEquals("Node sleepy invalid shards: not-found", e.getMessage());
    }
    server.addShard("s1", null);
    server.sleep(0L, 0, new String[] { "s1" });
    try {
      server.sleep(0L, 0, new String[] { "s1", "s2" });
    } catch (IllegalArgumentException e) {
      assertEquals("Node sleepy invalid shards: s2", e.getMessage());
    }
    server.addShard("s2", null);
    server.sleep(0L, 0, new String[] { "s1", "s2" });
View Full Code Here

      server.sleep(0L, 0, new String[] { "s1", "s2" });
    } catch (IllegalArgumentException e) {
      assertEquals("Node sleepy invalid shards: s2", e.getMessage());
    }
    server.addShard("s2", null);
    server.sleep(0L, 0, new String[] { "s1", "s2" });
  }

}
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.