Ejemplo 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());
  }
Ejemplo n.º 2
0
  @Test
  public void retrievesOnlyTasksWhichBelongToUser() throws URISyntaxException, Exception {
    DefaultTask task1 = createBasicTask("simple-suite.xml");
    DefaultTask task2 = createBasicTask("simple-suite.xml");
    task1.setName("Task 1");
    task1.setTaskUser(new TaskUser(2L, "test user1"));
    task2.setName("Task 2");
    task2.setTaskUser(new TaskUser(3L, "test user2"));

    Long task1Id = server.runTask(task1);
    Long task2Id = server.runTask(task2);

    TaskInformation[] tasks1 = server.getAllUserTasks(2L);
    TaskInformation[] tasks2 = server.getAllUserTasks(3L);

    assertNotNull(tasks1);
    assertEquals(1, tasks1.length);
    assertEquals("Task 1", tasks1[0].getTaskName());
    assertEquals(task1Id, tasks1[0].getTaskId());
    assertEquals(2L, (long) tasks1[0].getTaskUser().getId());
    assertEquals("test user1", tasks1[0].getTaskUser().getName());

    assertNotNull(tasks2);
    assertEquals(1, tasks2.length);
    assertEquals("Task 2", tasks2[0].getTaskName());
    assertEquals(task2Id, tasks2[0].getTaskId());
    assertEquals(3L, (long) tasks2[0].getTaskUser().getId());
    assertEquals("test user2", tasks2[0].getTaskUser().getName());
  }
Ejemplo n.º 3
0
 @SuppressWarnings("deprecation")
 @AfterClass
 public static void stopServer() throws Exception {
   server.stopServer();
   serverThread.stop();
   Thread.sleep(4000);
 }
Ejemplo n.º 4
0
 @Override
 public void run() {
   try {
     server.startServer(8100, "server");
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 5
0
  @BeforeClass
  public static void startServer() throws InterruptedException {
    DefaultGridStorage storage = new DefaultGridStorage();

    storage.setStoragePath("../data/storage-server");
    server.setStorage(storage);
    serverThread.start();
    Thread.sleep(4000);
  }