-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Brief, plain english overview of your changes here This PR makes it possible to set a default priority for all built-in task types. This makes it possible to e.g. define recurring tasks that only will run when the queue is otherwise empty. ## Fixes <!--- Which issue # does this fix? ---> ## Reminders - [x] Added/ran automated tests - [x] Update README and/or examples - [x] Ran `mvn spotless:apply` --- cc @kagkarlsson
- Loading branch information
1 parent
76c7bb2
commit 88ed8c3
Showing
13 changed files
with
270 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
db-scheduler/src/test/java/com/github/kagkarlsson/scheduler/task/helper/CustomTaskTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.github.kagkarlsson.scheduler.task.helper; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import com.github.kagkarlsson.scheduler.task.Priority; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class CustomTaskTest { | ||
|
||
@Test | ||
public void should_have_default_priority() { | ||
CustomTask<Void> customTask = | ||
Tasks.custom("name", Void.class).execute((taskInstance, executionContext) -> null); | ||
|
||
assertEquals(CustomTask.DEFAULT_PRIORITY, customTask.getDefaultPriority()); | ||
} | ||
|
||
@Test | ||
public void should_override_default_priority() { | ||
CustomTask<Void> customTask = | ||
Tasks.custom("name", Void.class) | ||
.defaultPriority(Priority.LOW) | ||
.execute((taskInstance, executionContext) -> null); | ||
|
||
assertEquals(Priority.LOW, customTask.getDefaultPriority()); | ||
} | ||
} |
Oops, something went wrong.