-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release 1.0.0 #3
Open
dcdh
wants to merge
28
commits into
main
Choose a base branch
from
release/1.0.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
b552bec
wip
dcdh a03d97e
add mongo
dcdh 790b89b
define quarkus extensions yaml
dcdh c6cf3c9
tchitchi
dcdh a4675eb
split into multiple interceptors depending on the provider (one inter…
dcdh 53efb78
regarding jdbc configuration are defined in build time so I've done t…
dcdh db8a226
little fix on mongo configuration
dcdh 6519b03
add documentation
dcdh beee372
rewrite the jdbc configuration validation
dcdh 61ca6f2
Do not build yet https://github.com/quarkusio/quarkus/issues/39169
dcdh 6f3d368
revert to avoid release
dcdh 7d8fb67
remove unused modules
dcdh 2c3fdb0
make JdbcConfig runtime because not used in processor and the develop…
dcdh 5538afd
add the option to create or not shedlock tables at startup
dcdh 7260173
make it build
dcdh f46413f
remove unused code
dcdh 099d8e9
try to fix build
dcdh 51033f4
make it fails by not reusing postgres container between tests
dcdh 036bf6b
avoid injecting a list regarding this issue https://github.com/quarku…
dcdh 0e7125b
remove previously deleted dependency
dcdh 80b88a2
bump Quarkus to 3.17.5
dcdh 1679624
Revert "avoid injecting a list regarding this issue https://github.co…
dcdh 5d783d1
rewrite tests - add mongo reactive - renaming
dcdh edf7661
Merge remote-tracking branch 'quarkiverse/main' into release/1.0.0
dcdh fe5d9f2
fix jdbc resource leaking
dcdh 9b0f223
lock can be applied only on a method returning void type
dcdh 5dbb764
check exception behavior
dcdh 3f86e7c
remove injectable bean because an interceptor is application wide scoped
dcdh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
release: | ||
current-version: "0" | ||
current-version: "1.0.0" | ||
next-version: "999-SNAPSHOT" | ||
|
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,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-common-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-shedlock-common-deployment</artifactId> | ||
<name>Quarkus ShedLock - Common - Deployment</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-common</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5-internal</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-devtools-testing</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
16 changes: 16 additions & 0 deletions
16
...n/deployment/src/main/java/io/quarkiverse/shedlock/common/deployment/CommonProcessor.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,16 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import io.quarkiverse.shedlock.common.runtime.DefaultInstantProvider; | ||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
|
||
public class CommonProcessor { | ||
@BuildStep | ||
void registerBeans(final BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemProducer) { | ||
additionalBeanBuildItemProducer.produce(AdditionalBeanBuildItem.builder() | ||
.setUnremovable() | ||
.addBeanClasses(DefaultInstantProvider.class) | ||
.build()); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ment/src/test/java/io/quarkiverse/shedlock/common/deployment/CommonSchedulerLockTest.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,43 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class CommonSchedulerLockTest { | ||
@RegisterExtension | ||
static final QuarkusUnitTest unitTest = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses( | ||
DefaultSchedulerLock.class, | ||
DefaultLockProvider.class, | ||
DefaultSchedulerLockInterceptor.class, | ||
LockableService.class) | ||
.addAsResource(new StringAsset("quarkus.shedlock.defaults-lock-at-most-for=PT30S"), | ||
"application.properties")); | ||
|
||
@Inject | ||
LockableService lockableService; | ||
|
||
@Inject | ||
DefaultLockProvider defaultLockProvider; | ||
|
||
@Test | ||
public void shouldIntercept() { | ||
// Given | ||
|
||
// When | ||
lockableService.execute(); | ||
|
||
// Then | ||
assertThat(defaultLockProvider.hasBeenCalled()).isTrue(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...ployment/src/test/java/io/quarkiverse/shedlock/common/deployment/DefaultLockProvider.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,24 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import java.util.Optional; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import net.javacrumbs.shedlock.core.LockConfiguration; | ||
import net.javacrumbs.shedlock.core.LockProvider; | ||
import net.javacrumbs.shedlock.core.SimpleLock; | ||
|
||
@ApplicationScoped | ||
public class DefaultLockProvider implements LockProvider { | ||
private boolean hasBeenCalled = false; | ||
|
||
@Override | ||
public Optional<SimpleLock> lock(final LockConfiguration lockConfiguration) { | ||
hasBeenCalled = true; | ||
return Optional.empty(); | ||
} | ||
|
||
public boolean hasBeenCalled() { | ||
return hasBeenCalled; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...loyment/src/test/java/io/quarkiverse/shedlock/common/deployment/DefaultSchedulerLock.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,17 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import java.lang.annotation.*; | ||
|
||
import jakarta.enterprise.util.Nonbinding; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import io.quarkiverse.shedlock.common.runtime.LockDuration; | ||
|
||
@InterceptorBinding | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
@Inherited | ||
public @interface DefaultSchedulerLock { | ||
@Nonbinding | ||
LockDuration lockDuration() default @LockDuration(); | ||
} |
45 changes: 45 additions & 0 deletions
45
.../test/java/io/quarkiverse/shedlock/common/deployment/DefaultSchedulerLockInterceptor.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,45 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.Objects; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundInvoke; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
import io.quarkiverse.shedlock.common.runtime.InstantProvider; | ||
import io.quarkiverse.shedlock.common.runtime.LockDuration; | ||
import io.quarkiverse.shedlock.common.runtime.SchedulerLockInterceptorBase; | ||
import io.quarkiverse.shedlock.common.runtime.ShedLockConfiguration; | ||
import net.javacrumbs.shedlock.core.LockProvider; | ||
|
||
@DefaultSchedulerLock | ||
@Priority(3001) | ||
@Interceptor | ||
public class DefaultSchedulerLockInterceptor extends SchedulerLockInterceptorBase { | ||
final DefaultLockProvider lockProvider; | ||
|
||
protected DefaultSchedulerLockInterceptor(final ShedLockConfiguration shedLockConfiguration, | ||
final InstantProvider instantProvider, | ||
final DefaultLockProvider lockProvider) { | ||
super(shedLockConfiguration, instantProvider); | ||
this.lockProvider = Objects.requireNonNull(lockProvider); | ||
} | ||
|
||
@Override | ||
@AroundInvoke | ||
protected Object lock(InvocationContext context) throws Throwable { | ||
return super.lock(context); | ||
} | ||
|
||
@Override | ||
protected LockProvider lockProvider(Method method) { | ||
return lockProvider; | ||
} | ||
|
||
@Override | ||
protected LockDuration lockDuration(Method method) { | ||
return method.getAnnotation(DefaultSchedulerLock.class).lockDuration(); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...n/deployment/src/test/java/io/quarkiverse/shedlock/common/deployment/LockableService.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,10 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
@ApplicationScoped | ||
public class LockableService { | ||
@DefaultSchedulerLock | ||
void execute() { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...e/shedlock/common/deployment/ShouldFailWhenDefaultLockAtMostForPropertyIsMissingTest.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,33 @@ | ||
package io.quarkiverse.shedlock.common.deployment; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class ShouldFailWhenDefaultLockAtMostForPropertyIsMissingTest { | ||
@RegisterExtension | ||
static final QuarkusUnitTest unitTest = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses( | ||
DefaultSchedulerLock.class, | ||
DefaultLockProvider.class, | ||
DefaultSchedulerLockInterceptor.class, | ||
LockableService.class)) | ||
.assertException(throwable -> assertThat(throwable) | ||
.hasNoSuppressedExceptions() | ||
.rootCause() | ||
.hasMessage("Configuration validation failed:\n" + | ||
"\tjava.util.NoSuchElementException: SRCFG00014: The config property quarkus.shedlock.defaults-lock-at-most-for is required but it could not be found in any config source") | ||
.hasNoSuppressedExceptions()); | ||
|
||
@Test | ||
public void test() { | ||
Assertions.fail("Startup should have failed"); | ||
} | ||
} |
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,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>quarkus-shedlock-common-parent</artifactId> | ||
<name>Quarkus - ShedLock - Common</name> | ||
<packaging>pom</packaging> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>net.javacrumbs.shedlock</groupId> | ||
<artifactId>shedlock-core</artifactId> | ||
<version>${shedlock.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<modules> | ||
<module>runtime</module> | ||
<module>deployment</module> | ||
</modules> | ||
</project> |
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,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.shedlock</groupId> | ||
<artifactId>quarkus-shedlock-common-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>quarkus-shedlock-common</artifactId> | ||
<name>Quarkus ShedLock - Common - Runtime</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.javacrumbs.shedlock</groupId> | ||
<artifactId>shedlock-core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-maven-plugin</artifactId> | ||
<version>${quarkus.version}</version> | ||
<executions> | ||
<execution> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>extension-descriptor</goal> | ||
</goals> | ||
<configuration> | ||
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
16 changes: 16 additions & 0 deletions
16
.../runtime/src/main/java/io/quarkiverse/shedlock/common/runtime/DefaultInstantProvider.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,16 @@ | ||
package io.quarkiverse.shedlock.common.runtime; | ||
|
||
import java.time.Instant; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkus.arc.DefaultBean; | ||
|
||
@ApplicationScoped | ||
@DefaultBean | ||
public class DefaultInstantProvider implements InstantProvider { | ||
@Override | ||
public Instant now() { | ||
return Instant.now(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
common/runtime/src/main/java/io/quarkiverse/shedlock/common/runtime/InstantProvider.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,7 @@ | ||
package io.quarkiverse.shedlock.common.runtime; | ||
|
||
import java.time.Instant; | ||
|
||
public interface InstantProvider { | ||
Instant now(); | ||
} |
18 changes: 18 additions & 0 deletions
18
common/runtime/src/main/java/io/quarkiverse/shedlock/common/runtime/LockDuration.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,18 @@ | ||
package io.quarkiverse.shedlock.common.runtime; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import jakarta.enterprise.util.Nonbinding; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
public @interface LockDuration { | ||
@Nonbinding | ||
String lockAtMostFor() default ""; | ||
|
||
@Nonbinding | ||
String lockAtLeastFor() default ""; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend to have a separate PR to trigger the release workflow (which is triggered when this file is changed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello George, it was my intention to trigger a release. I'll revert it.
Should I rename the branch ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dcdh no need to, it can be named as you like