Ejemplo n.º 1
0
  public void _testMassiveClientConnect() throws InterruptedException {

    final int CLIENT_COUNT = 20; // more than 200 clients will need more than 3 GB of memory

    final StringBuffer results = new StringBuffer();

    ThreadServices.spawnAndJoin(
        "ClientProcessesTestCase.testMassiveClientConnect",
        CLIENT_COUNT,
        new CodeBlock() {
          public void run() throws Throwable {
            String result = JavaServices.java(clientRunnerCommand());
            results.append(result);
            Assert.isTrue(result.indexOf(CLIENT_COMPLETED_OK) >= 0);
          }
        });
    System.out.println(results);
    asserItemCount(CLIENT_COUNT * ITEM_COUNT);
  }
Ejemplo n.º 2
0
  public void _testKillingClients() throws InterruptedException {

    final int CLIENT_COUNT = 3;

    final StringBuffer results = new StringBuffer();

    ThreadServices.spawnAndJoin(
        "ClientProcessesTestCase.testKillingClients",
        CLIENT_COUNT,
        new CodeBlock() {
          public void run() throws Throwable {
            results.append(
                JavaServices.startAndKillJavaProcess(
                    clientRunnerCommand(), CLIENT_STARTED_OK, 10000));
          }
        });

    Assert.areEqual(1, connectedClients());
    System.out.println(results);
  }