Exemplo n.º 1
0
  @Test
  public void noProjectInStorageErrorCheck() throws Exception {
    GridClient client = createClient();

    ClientServerRemoteInterface remote = client.getServer();
    assertNotNull(remote);

    DefaultTask task = new DefaultTask();
    task.setAgentNames(new String[] {"agent1"});
    task.setCreatedDate(new Date(1234567));
    List<SuiteTask> suiteTasks = new LinkedList<SuiteTask>();

    SuiteTask suiteTask = new SuiteTask();
    suiteTask.setName("Unsynced project task");
    suiteTask.setProjectName("unsynced_project");
    suiteTask.setProjectVersion("unsynced_version");
    suiteTask.setSuite(
        XmlSuiteParser.parse(new File(getClass().getResource("/simple-suite.xml").toURI())));
    suiteTasks.add(suiteTask);
    task.setSuiteTasks(suiteTasks);

    Long taskId = remote.runTask(task);

    Thread.sleep(10000);

    TaskInformation parentTaskInformation = server.getTask(taskId);
    TaskInformation[] list = server.getTasks(taskId);

    assertEquals(TaskStatus.COMPLETED, parentTaskInformation.getTaskStatus().getStatus());
    assertNotNull(list);
    assertEquals(1, list.length);
    assertEquals(TaskStatus.ERROR, list[0].getTaskStatus().getStatus());
    assertEquals(TaskStatus.ERROR_NO_PROJECT_IN_STORAGE, list[0].getTaskStatus().getMessage());
  }
Exemplo n.º 2
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());
  }
Exemplo n.º 3
0
  @Test(expected = IncorrectTaskException.class)
  public void emptyTaskGivesError() throws Exception {
    GridClient client = createClient();

    ClientServerRemoteInterface remote = client.getServer();
    assertNotNull(remote);

    DefaultTask task = new DefaultTask();
    task.setAgentNames(new String[] {"agent1"});
    task.setCreatedDate(new Date(1234567));
    List<SuiteTask> suiteTasks = new LinkedList<SuiteTask>();
    task.setSuiteTasks(suiteTasks);

    remote.runTask(task);
  }