Search in sources :

Example 1 with TaskSampleSubscriptionResource

use of org.ligoj.app.resource.subscription.TaskSampleSubscriptionResource in project ligoj-api by ligoj.

the class LongTaskRunnerTest method startTaskRunningRemote.

/**
 * Task is locally finished, but not from the external system view.
 */
@Test
public void startTaskRunningRemote() {
    resource = new TaskSampleSubscriptionResource() {

        @Override
        public boolean isFinished(final TaskSampleSubscription task) {
            // Never remotely finished
            return false;
        }
    };
    applicationContext.getAutowireCapableBeanFactory().autowireBean(resource);
    final TaskSampleSubscription newTaskSample = newTaskSample();
    repository.saveAndFlush(newTaskSample);
    Assertions.assertThrows(BusinessException.class, () -> {
        resource.startTask(subscription, task -> task.setData("init"));
    });
}
Also used : TaskSampleSubscription(org.ligoj.app.model.TaskSampleSubscription) TaskSampleSubscriptionResource(org.ligoj.app.resource.subscription.TaskSampleSubscriptionResource) AbstractOrgTest(org.ligoj.app.resource.AbstractOrgTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 TaskSampleSubscription (org.ligoj.app.model.TaskSampleSubscription)1 AbstractOrgTest (org.ligoj.app.resource.AbstractOrgTest)1 TaskSampleSubscriptionResource (org.ligoj.app.resource.subscription.TaskSampleSubscriptionResource)1