예제 #1
0
  /**
   * Tests two consecutive connections to see how it works.
   *
   * @throws Exception
   */
  public void testDoubleUsage() throws Exception {

    while (!server.isRunning()) {
      Thread.sleep(100); // waits until the server finishes the startup
    }

    AsyncTaskService client = createTaskClient();

    client.connect();

    Task task = new Task();
    List<I18NText> names1 = new ArrayList<I18NText>();
    I18NText text1 = new I18NText("en-UK", "tarea1");
    names1.add(text1);
    task.setNames(names1);
    TaskData taskData = new TaskData();
    taskData.setStatus(Status.Created);
    taskData.setCreatedBy(new User("usr0"));
    taskData.setActualOwner(new User("usr0"));
    task.setTaskData(taskData);

    ContentData data = new ContentData();
    BlockingAddTaskResponseHandler addTaskHandler = new BlockingAddTaskResponseHandler();
    client.addTask(task, data, addTaskHandler);

    long taskId = addTaskHandler.getTaskId();

    client.disconnect();

    client.connect();

    assertTrue("taskId debe ser un valor mayor a cero", taskId > 0);

    Task task2 = new Task();
    List<I18NText> names2 = new ArrayList<I18NText>();
    I18NText text2 = new I18NText("en-UK", "tarea1");
    names2.add(text2);
    task2.setNames(names2);
    TaskData taskData2 = new TaskData();
    taskData2.setStatus(Status.Created);
    taskData2.setCreatedBy(new User("usr0"));
    taskData2.setActualOwner(new User("usr0"));
    task2.setTaskData(taskData2);

    ContentData data2 = new ContentData();
    BlockingAddTaskResponseHandler addTaskHandler2 = new BlockingAddTaskResponseHandler();
    client.addTask(task2, data2, addTaskHandler2);

    long taskId2 = addTaskHandler2.getTaskId();

    assertTrue("taskId2 debe ser un valor mayor a cero", taskId2 > 0);
    assertNotSame("taskId y taskId2 deben ser distintos", taskId, taskId2);

    client.disconnect();
  }
  protected void tearDown() throws Exception {
    if (client != null) {
      client.disconnect();
    }

    if (clientAsync != null) {
      clientAsync.disconnect();
    }
    server.stop();
    super.tearDown();
  }
예제 #3
0
 protected void tearDown() throws Exception {
   ((MinaHTWorkItemHandler) getHandler()).dispose();
   getClient().disconnect();
   server.stop();
   super.tearDown();
 }
예제 #4
0
 /** Stops the server */
 @Override
 protected void tearDown() throws Exception {
   server.stop();
 }
 protected void tearDown() throws Exception {
   client.disconnect();
   server.stop();
   super.tearDown();
 }