Package org.japura.task

Examples of org.japura.task.Task


  task.registerOwner(null);
  }

  @Test
  public void registeringException() {
  Task task = new Task();
  task.registerStatus(TaskStatus.SUBMITTED);
  task.registerStatus(TaskStatus.EXECUTING);
  Exception exception = new Exception();
  task.registerException(exception);
  Assert.assertNotNull(task.getException());
  Assert.assertEquals(exception, task.getException());
  Assert.assertEquals(TaskStatus.ERROR, task.getStatus());
  }
View Full Code Here


  Assert.assertEquals(TaskStatus.ERROR, task.getStatus());
  }

  @Test
  public void submitNestedTask1() {
  Task parentTask = new Task();
  parentTask.setMessage("message");
  TaskExecutorFake executor = new TaskExecutorFake();
  parentTask.registerOwner(executor);
  Task task = new Task();
  parentTask.registerStatus(TaskStatus.SUBMITTED);
  parentTask.registerStatus(TaskStatus.EXECUTING);
  Assert.assertNull(executor.getNestedTasks());
  parentTask.submitNestedTask(task);
  Assert.assertNotNull(executor.getNestedTasks());
  Assert.assertNotNull(task.getParentId());
  Assert.assertEquals(parentTask.getId(), task.getParentId());
  Assert.assertNotNull(task.getMessage());
  Assert.assertEquals("message", task.getMessage());
  }
View Full Code Here

  }

  @Test
  public void submitNestedTask2() {
  // keeping current message
  Task parentTask = new Task();
  parentTask.setMessage("message");
  parentTask.registerOwner(new TaskExecutorFake());
  Task task = new Task();
  task.setMessage("message2");
  parentTask.registerStatus(TaskStatus.SUBMITTED);
  parentTask.registerStatus(TaskStatus.EXECUTING);
  parentTask.submitNestedTask(task);
  Assert.assertEquals("message2", task.getMessage());
  }
View Full Code Here

  Application.reset();
  }
 
  @Test
  public void pendingToNull(){
  Task task = new Task();
  Assert.assertEquals(TaskStatus.PENDING, task.getStatus());
  thrown.expect(TaskExeception.class);
  task.registerStatus(null);
  }
View Full Code Here

  task.registerStatus(null);
  }

  @Test
  public void pendingToSubmitted() {
  Task task = new Task();
  Assert.assertEquals(TaskStatus.PENDING, task.getStatus());
  task.registerStatus(TaskStatus.SUBMITTED);
  Assert.assertEquals(TaskStatus.SUBMITTED, task.getStatus());
  }
View Full Code Here

  Assert.assertEquals(TaskStatus.SUBMITTED, task.getStatus());
  }

  @Test
  public void pendingToCancelled() {
  Task task = new Task();
  Assert.assertEquals(TaskStatus.PENDING, task.getStatus());
  task.registerStatus(TaskStatus.CANCELED);
  Assert.assertEquals(TaskStatus.CANCELED, task.getStatus());
  }
View Full Code Here

  Assert.assertEquals(TaskStatus.CANCELED, task.getStatus());
  }

  @Test()
  public void pendingToExecuting() {
  Task task = new Task();
  thrown.expect(TaskExeception.class);
  task.registerStatus(TaskStatus.EXECUTING);
  }
View Full Code Here

  task.registerStatus(TaskStatus.EXECUTING);
  }

  @Test()
  public void pendingToDiscarded() {
  Task task = new Task();
  thrown.expect(TaskExeception.class);
  task.registerStatus(TaskStatus.DISCARDED);
  }
View Full Code Here

  task.registerStatus(TaskStatus.DISCARDED);
  }

  @Test()
  public void pendingToError() {
  Task task = new Task();
  thrown.expect(TaskExeception.class);
  task.registerStatus(TaskStatus.ERROR);
  }
View Full Code Here

  task.registerStatus(TaskStatus.ERROR);
  }

  @Test(expected = TaskExeception.class)
  public void pendingToDone() {
  Task task = new Task();
  task.registerStatus(TaskStatus.DONE);
  }
View Full Code Here

TOP

Related Classes of org.japura.task.Task

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.