示例#1
0
  @Test
  public void serverSendsRecievesTask() throws Exception {
    /*
     * To be able to run this test the storage should be configured properly.
     * Just run utils/install.sh script from workspace folder
     */
    GridClient client = createClient();
    ClientServerRemoteInterface remote = client.getServer();

    assertNotNull(remote);

    DefaultTask task = createBasicTask("simple-suite.xml");

    Long taskId = remote.runTask(task);
    assertNotNull(taskId);
    assertTrue(taskId > 0L);
    Thread.sleep(1000);

    TaskInformation[] tasks = remote.getTasks(null);
    assertNotNull(tasks);
    assertEquals(1, tasks.length);
    assertEquals("sample task1", tasks[0].getTaskName());
    assertEquals(1, (int) tasks[0].getChildTasksAmount());
    assertNotNull(tasks[0].getTaskStatus());
    assertNull(tasks[0].getTaskStatus().getAssignedAgent());
    assertEquals(TaskStatus.WAITING, tasks[0].getTaskStatus().getStatus());
    assertNotNull(tasks[0].getTaskId());
    assertEquals(Task.TYPE_MULTITASK, tasks[0].getType());

    // Fetching child tasks
    TaskInformation[] childTasks = remote.getTasks(tasks[0].getTaskId());
    assertNotNull(childTasks);
    assertEquals(1, childTasks.length);
    assertEquals("sample suite task", childTasks[0].getTaskName());
    assertEquals(0, (int) childTasks[0].getChildTasksAmount());
    assertNotNull(childTasks[0].getTaskStatus());
    assertNull(childTasks[0].getTaskStatus().getAssignedAgent());
    assertEquals(TaskStatus.WAITING, childTasks[0].getTaskStatus().getStatus());
    assertNotNull(childTasks[0].getTaskId());
    assertEquals(tasks[0].getTaskId(), childTasks[0].getParentId());
    assertEquals(Task.TYPE_SUITETASK, childTasks[0].getType());

    assertNotNull(childTasks[0].getTaskStatus().getSuiteInformation());
    assertNotNull(childTasks[0].getTaskStatus().getSuiteInformation().getTests());
    assertEquals(3, (int) childTasks[0].getTaskStatus().getSuiteInformation().getTests().size());

    List<TestStatus> tests = childTasks[0].getTaskStatus().getSuiteInformation().getTests();
    assertEquals("net.mindengine.oculus.experior.samples.Sample2_B", tests.get(0).getMapping());
    assertEquals("1", tests.get(0).getCustomId());

    assertEquals("net.mindengine.oculus.experior.samples.Sample2_B", tests.get(1).getMapping());
    assertEquals("345", tests.get(1).getCustomId());

    assertEquals("net.mindengine.oculus.experior.samples.Sample2_A", tests.get(2).getMapping());
    assertEquals("123", tests.get(2).getCustomId());
  }