-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added job/step/partition scope management Add IT tests copied from https://github.com/jberet/jsr352/tree/main/test-apps/cdiScopes
- Loading branch information
1 parent
2ae6d52
commit e97e5e6
Showing
30 changed files
with
1,249 additions
and
1 deletion.
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
54 changes: 54 additions & 0 deletions
54
...untime/src/main/java/io/quarkiverse/jberet/runtime/scope/QuarkusJobScopedContextImpl.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,54 @@ | ||
package io.quarkiverse.jberet.runtime.scope; | ||
|
||
import java.lang.annotation.Annotation; | ||
|
||
import jakarta.enterprise.context.spi.Contextual; | ||
import jakarta.enterprise.context.spi.CreationalContext; | ||
|
||
import org.jberet.cdi.JobScoped; | ||
import org.jberet.creation.JobScopedContextImpl; | ||
|
||
import io.quarkus.arc.InjectableContext; | ||
|
||
public class QuarkusJobScopedContextImpl implements InjectableContext { | ||
private final JobScopedContextImpl impl; | ||
|
||
public QuarkusJobScopedContextImpl() { | ||
this.impl = JobScopedContextImpl.getInstance(); | ||
} | ||
|
||
@Override | ||
public void destroy(Contextual<?> contextual) { | ||
this.impl.destroy(contextual); | ||
} | ||
|
||
@Override | ||
public Class<? extends Annotation> getScope() { | ||
return JobScoped.class; | ||
} | ||
|
||
@Override | ||
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { | ||
return impl.get(contextual, creationalContext); | ||
} | ||
|
||
@Override | ||
public <T> T get(Contextual<T> contextual) { | ||
return impl.get(contextual); | ||
} | ||
|
||
@Override | ||
public boolean isActive() { | ||
return impl.isActive(); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
this.impl.destroy(null); | ||
} | ||
|
||
@Override | ||
public ContextState getState() { | ||
return null; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
.../src/main/java/io/quarkiverse/jberet/runtime/scope/QuarkusPartitionScopedContextImpl.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,54 @@ | ||
package io.quarkiverse.jberet.runtime.scope; | ||
|
||
import java.lang.annotation.Annotation; | ||
|
||
import jakarta.enterprise.context.spi.Contextual; | ||
import jakarta.enterprise.context.spi.CreationalContext; | ||
|
||
import org.jberet.cdi.PartitionScoped; | ||
import org.jberet.creation.PartitionScopedContextImpl; | ||
|
||
import io.quarkus.arc.InjectableContext; | ||
|
||
public class QuarkusPartitionScopedContextImpl implements InjectableContext { | ||
private final PartitionScopedContextImpl impl; | ||
|
||
public QuarkusPartitionScopedContextImpl() { | ||
this.impl = PartitionScopedContextImpl.getInstance(); | ||
} | ||
|
||
@Override | ||
public void destroy(Contextual<?> contextual) { | ||
this.impl.destroy(contextual); | ||
} | ||
|
||
@Override | ||
public Class<? extends Annotation> getScope() { | ||
return PartitionScoped.class; | ||
} | ||
|
||
@Override | ||
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { | ||
return impl.get(contextual, creationalContext); | ||
} | ||
|
||
@Override | ||
public <T> T get(Contextual<T> contextual) { | ||
return impl.get(contextual); | ||
} | ||
|
||
@Override | ||
public boolean isActive() { | ||
return impl.isActive(); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
this.impl.destroy(null); | ||
} | ||
|
||
@Override | ||
public ContextState getState() { | ||
return null; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ntime/src/main/java/io/quarkiverse/jberet/runtime/scope/QuarkusStepScopedContextImpl.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,54 @@ | ||
package io.quarkiverse.jberet.runtime.scope; | ||
|
||
import java.lang.annotation.Annotation; | ||
|
||
import jakarta.enterprise.context.spi.Contextual; | ||
import jakarta.enterprise.context.spi.CreationalContext; | ||
|
||
import org.jberet.cdi.StepScoped; | ||
import org.jberet.creation.StepScopedContextImpl; | ||
|
||
import io.quarkus.arc.InjectableContext; | ||
|
||
public class QuarkusStepScopedContextImpl implements InjectableContext { | ||
private final StepScopedContextImpl impl; | ||
|
||
public QuarkusStepScopedContextImpl() { | ||
this.impl = StepScopedContextImpl.getInstance(); | ||
} | ||
|
||
@Override | ||
public void destroy(Contextual<?> contextual) { | ||
this.impl.destroy(contextual); | ||
} | ||
|
||
@Override | ||
public Class<? extends Annotation> getScope() { | ||
return StepScoped.class; | ||
} | ||
|
||
@Override | ||
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { | ||
return impl.get(contextual, creationalContext); | ||
} | ||
|
||
@Override | ||
public <T> T get(Contextual<T> contextual) { | ||
return impl.get(contextual); | ||
} | ||
|
||
@Override | ||
public boolean isActive() { | ||
return impl.isActive(); | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
this.impl.destroy(null); | ||
} | ||
|
||
@Override | ||
public ContextState getState() { | ||
return null; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
Copyright (c) 2017 Red Hat, Inc. and/or its affiliates. | ||
This program and the accompanying materials are made | ||
available under the terms of the Eclipse Public License 2.0 | ||
which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
SPDX-License-Identifier: EPL-2.0 | ||
--> | ||
|
||
<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.jberet</groupId> | ||
<artifactId>quarkus-jberet-integration-tests</artifactId> | ||
<version>2.2.1-SNAPSHOT</version> | ||
<relativePath>../..</relativePath> | ||
</parent> | ||
|
||
<artifactId>quarkus-jberet-integration-tests-scopes-commons</artifactId> | ||
<name>Quarkus - JBeret - Commons components</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jberet.test-apps</groupId> | ||
<version>${jberet.version}</version> | ||
<artifactId>cdiScopes-commons</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
...sts/scopes/common/src/main/java/io/quarkiverse/jberet/it/cdiscopes/AbstractQuarkusIT.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,22 @@ | ||
package io.quarkiverse.jberet.it.cdiscopes; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.jberet.testapps.common.AbstractIT; | ||
import org.junit.jupiter.api.BeforeEach; | ||
|
||
import io.quarkiverse.jberet.runtime.QuarkusJobOperator; | ||
|
||
/** | ||
* Quarkus version of JBeret {@link AbstractIT} | ||
*/ | ||
public abstract class AbstractQuarkusIT extends AbstractIT { | ||
@Inject | ||
QuarkusJobOperator quarkusJobOperator; | ||
|
||
@BeforeEach | ||
@Override | ||
public void before() throws Exception { | ||
super.jobOperator = new JobOperatorImplQuarkusDelegate(quarkusJobOperator); | ||
} | ||
} |
Oops, something went wrong.