Package org.eclipse.orion.internal.server.core.tasks

Examples of org.eclipse.orion.internal.server.core.tasks.TaskDescription


    TaskInfo task = AllTaskTests.createTestTask("test");
    String json = task.toJSON().toString();
    json = json.replace('}', ')');
    boolean exceptionThrown = false;
    try {
      TaskInfo.fromJSON(new TaskDescription(task.getUserId(), task.getId(), true), json);
    } catch (CorruptedTaskException e) {
      exceptionThrown = true;
    }
    assertTrue(json, exceptionThrown);
  }
View Full Code Here


   * @throws CorruptedTaskException
   */
  @Test
  public void testJSONRoundTrip() throws CorruptedTaskException {
    TaskInfo info = AllTaskTests.createTestTask("test");
    TaskInfo task2 = TaskInfo.fromJSON(new TaskDescription(info.getUserId(), info.getId(), true), info.toJSON().toString());
    AllTaskTests.assertEqualTasks(info, task2);
  }
View Full Code Here

  File tempDir;

  @Test
  public void testRead() {
    TaskStore store = new TaskStore(tempDir);
    String task = store.readTask(new TaskDescription("Userdoesnotexist", "Doesnotexist", true));
    assertNull(task);
  }
View Full Code Here

  @Test
  public void testRoundTrip() throws CorruptedTaskException {
    TaskInfo task = AllTaskTests.createTestTask("test");
    TaskStore store = new TaskStore(tempDir);
    store.writeTask(new TaskDescription(task.getUserId(), task.getId(), true), task.toJSON().toString());

    TaskInfo task2 = TaskInfo.fromJSON(new TaskDescription(task.getUserId(), task.getId(), true), store.readTask(new TaskDescription(task.getUserId(), task.getId(), true)));
    AllTaskTests.assertEqualTasks(task, task2);
  }
View Full Code Here

  @Test
  public void testDeleteTask() {
    TaskInfo task = AllTaskTests.createTestTask("test");
    task.done(Status.OK_STATUS);
    TaskStore store = new TaskStore(tempDir);
    store.writeTask(new TaskDescription(task.getUserId(), task.getId(), true), task.toJSON().toString());
    assertNotNull(store.readTask(new TaskDescription(task.getUserId(), task.getId(), true)));
    assertTrue(store.removeTask(new TaskDescription(task.getUserId(), task.getId(), true)));
    assertNull(store.readTask(new TaskDescription(task.getUserId(), task.getId(), true)));
  }
View Full Code Here

    TaskInfo task1 = new TaskInfo("test", "taskid1", true);
    task1.done(Status.OK_STATUS);
    TaskInfo task2 = new TaskInfo("test", "taskid2", true);
    task2.done(Status.OK_STATUS);
    TaskStore store = new TaskStore(tempDir);
    store.writeTask(new TaskDescription("test", task1.getId(), true), task1.toJSON().toString());
    assertEquals(1, store.readAllTasks("test"));
    store.writeTask(new TaskDescription("test", task2.getId(), true), task2.toJSON().toString());
    assertEquals(2, store.readAllTasks("test"));
    store.removeTask(new TaskDescription("test", task1.getId(), true));
    assertEquals(1, store.readAllTasks("test"));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.orion.internal.server.core.tasks.TaskDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.