//Assert.assertEquals(date, pa2.getDeadline());
}
public void testNotificationLifecycle() throws Exception {
ITMSServer server = Utils.createTMSServer();
Notification notification = new Notification("taskID", new URI("http://localhost/1"), Utils.createXMLDocument());
notification.getUserOwners().add("test/user1");
notification.getRoleOwners().add("test/role3");
ITaskDAOConnectionFactory daoFactory=new SimpleTaskDAOConnectionFactory();
ITaskDAOConnection dao=daoFactory.openConnection();
server.create(dao,notification, "token1");
TaskEquality.areTasksEquals(notification, server.getTask(dao,"taskID", "token1"));
TaskEquality.areTasksEquals(notification, server.getTask(dao,"taskID", "token2"));
TaskEquality.areTasksEquals(notification, server.getTaskList(dao,"token1")[0]);
TaskEquality.areTasksEquals(notification, server.getTaskList(dao,"token2")[0]);
try {
server.getTask(dao,"taskID", "token3");
Assert.fail("AccessDeniedException expected");
} catch (AccessDeniedException e) {
}
Assert.assertEquals(0, server.getTaskList(dao,"token3").length);
server.complete(dao,"taskID", "token2");
Notification completedTask = (Notification) server.getTask(dao,"taskID", "token1");
Assert.assertEquals(TaskState.COMPLETED, completedTask.getState());
String failureCode = "failure-code";
String failureReason = "failure reason";
server.fail(dao,"taskID", failureCode, failureReason, "token1");
Notification failedTask = (Notification) server.getTask(dao,"taskID", "token2");
Assert.assertEquals(TaskState.FAILED, failedTask.getState());
Assert.assertEquals(failureCode, failedTask.getFailureCode());
Assert.assertEquals(failureReason, failedTask.getFailureReason());
try {
server.delete(dao,new String[] { "taskID" }, "token1");
Assert.fail("AuthException expected");
} catch (UnavailableTaskException e) {