예제 #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());
  }
예제 #2
0
  public DefaultTask createBasicTask(String suitePath) throws URISyntaxException, Exception {
    DefaultTask task = new DefaultTask();
    task.setName("sample task1");

    task.setAgentNames(new String[] {"agent1"});
    task.setCreatedDate(new Date(1234567));

    List<SuiteTask> suiteTasks = new LinkedList<SuiteTask>();
    SuiteTask suiteTask = new SuiteTask();
    suiteTasks.add(suiteTask);

    suiteTask.setAgentNames(new String[] {"agent2", "agent3"});
    suiteTask.setName("sample suite task");

    Suite suite = XmlSuiteParser.parse(new File(getClass().getResource("/" + suitePath).toURI()));
    suiteTask.setSuite(suite);
    suiteTask.setProjectName("sample-project");
    suiteTask.setProjectVersion("current");
    task.setSuiteTasks(suiteTasks);
    return task;
  }