Search in sources :

Example 1 with TaskStatusImpl

use of cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl in project perun by CESNET.

the class TaskStatusImplTest method getDestinationStatusTest.

@Test
public void getDestinationStatusTest() throws InternalErrorException {
    System.out.println("TaskStatusImpl.getDestinationStatusTest");
    TaskStatus taskStatus = new TaskStatusImpl(task1);
    Assert.isTrue(taskStatus.getDestinationStatus(destination1).equals(TaskDestinationStatus.WAITING));
}
Also used : TaskStatusImpl(cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl) TaskStatus(cz.metacentrum.perun.engine.scheduling.TaskStatus) Test(org.junit.Test) AbstractEngineTest(cz.metacentrum.perun.engine.AbstractEngineTest)

Example 2 with TaskStatusImpl

use of cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl in project perun by CESNET.

the class TaskStatusImplTest method getWaitingDestinationsTest.

@Test
public void getWaitingDestinationsTest() throws InternalErrorException {
    System.out.println("TaskStatusImpl.getWaitingDestinationsTest");
    TaskStatus taskStatus = new TaskStatusImpl(task1);
    List<Destination> destinations = taskStatus.getWaitingDestinations();
    log.debug("destinations: " + destinations.toString());
    Assert.isTrue(destinations.size() == 3, "size == 3");
    Assert.isTrue(destinations.contains(destination1), "destination1");
    Assert.isTrue(destinations.contains(destination2), "destination2");
    Assert.isTrue(destinations.contains(destination3) || destinations.contains(destination4), "destination3 or destination4");
    destinations = taskStatus.getWaitingDestinations();
    Assert.isTrue(destinations.size() == 1, "size == 1");
    taskStatus.setDestinationStatus(destination3, TaskDestinationStatus.DONE);
    destinations = taskStatus.getWaitingDestinations();
    Assert.isTrue(destinations.size() == 0, "size == 0");
}
Also used : Destination(cz.metacentrum.perun.core.api.Destination) TaskStatusImpl(cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl) TaskStatus(cz.metacentrum.perun.engine.scheduling.TaskStatus) Test(org.junit.Test) AbstractEngineTest(cz.metacentrum.perun.engine.AbstractEngineTest)

Example 3 with TaskStatusImpl

use of cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl in project perun by CESNET.

the class TaskStatusImplTest method isTaskFinishedTest.

@Test
public void isTaskFinishedTest() throws InternalErrorException {
    System.out.println("TaskStatusImpl.isTaskFinishedTest");
    TaskStatus taskStatus = new TaskStatusImpl(task1);
    Assert.isTrue(!taskStatus.isTaskFinished());
    taskStatus.setDestinationStatus(destination1, TaskDestinationStatus.DONE);
    Assert.isTrue(!taskStatus.isTaskFinished());
    taskStatus.setDestinationStatus(destination3, TaskDestinationStatus.DONE);
    Assert.isTrue(!taskStatus.isTaskFinished());
    taskStatus.setDestinationStatus(destination2, TaskDestinationStatus.ERROR);
    Assert.isTrue(taskStatus.isTaskFinished());
    taskStatus.setDestinationStatus(destination4, TaskDestinationStatus.ERROR);
    Assert.isTrue(taskStatus.isTaskFinished());
}
Also used : TaskStatusImpl(cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl) TaskStatus(cz.metacentrum.perun.engine.scheduling.TaskStatus) Test(org.junit.Test) AbstractEngineTest(cz.metacentrum.perun.engine.AbstractEngineTest)

Example 4 with TaskStatusImpl

use of cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl in project perun by CESNET.

the class TaskStatusImplTest method getTaskStatusTest.

@Test
public void getTaskStatusTest() throws InternalErrorException {
    System.out.println("TaskStatusImpl.getTaskStatusTest");
    TaskStatus taskStatus = new TaskStatusImpl(task1);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination1, TaskDestinationStatus.DONE);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination3, TaskDestinationStatus.ERROR);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination4, TaskDestinationStatus.DONE);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination2, TaskDestinationStatus.DONE);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.DONE));
    taskStatus = new TaskStatusImpl(task1);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination1, TaskDestinationStatus.DONE);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination3, TaskDestinationStatus.DONE);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.PROCESSING));
    taskStatus.setDestinationStatus(destination2, TaskDestinationStatus.ERROR);
    Assert.isTrue(taskStatus.getTaskStatus().equals(Task.TaskStatus.ERROR));
}
Also used : TaskStatusImpl(cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl) TaskStatus(cz.metacentrum.perun.engine.scheduling.TaskStatus) Test(org.junit.Test) AbstractEngineTest(cz.metacentrum.perun.engine.AbstractEngineTest)

Example 5 with TaskStatusImpl

use of cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl in project perun by CESNET.

the class TaskStatusImplTest method setDestinationStatusTest.

@Test
public void setDestinationStatusTest() throws InternalErrorException {
    System.out.println("TaskStatusImpl.setDestinationStatusTest");
    TaskStatus taskStatus = new TaskStatusImpl(task1);
    taskStatus.setDestinationStatus(destination1, TaskDestinationStatus.DONE);
    Assert.isTrue(taskStatus.getDestinationStatus(destination1).equals(TaskDestinationStatus.DONE));
}
Also used : TaskStatusImpl(cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl) TaskStatus(cz.metacentrum.perun.engine.scheduling.TaskStatus) Test(org.junit.Test) AbstractEngineTest(cz.metacentrum.perun.engine.AbstractEngineTest)

Aggregations

AbstractEngineTest (cz.metacentrum.perun.engine.AbstractEngineTest)5 TaskStatus (cz.metacentrum.perun.engine.scheduling.TaskStatus)5 TaskStatusImpl (cz.metacentrum.perun.engine.scheduling.impl.TaskStatusImpl)5 Test (org.junit.Test)5 Destination (cz.metacentrum.perun.core.api.Destination)1