-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for InvocationContext.getInterceptorBindings()
- Loading branch information
Showing
20 changed files
with
419 additions
and
1 deletion.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
.../jboss/cdi/tck/interceptors/tests/contract/invocationContext/AroundConstructBinding1.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 org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.enterprise.util.AnnotationLiteral; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.CONSTRUCTOR; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@InterceptorBinding | ||
@Inherited | ||
@Target({ TYPE, METHOD, CONSTRUCTOR }) | ||
@Retention(RUNTIME) | ||
public @interface AroundConstructBinding1 { | ||
class Literal extends AnnotationLiteral<AroundConstructBinding1> implements AroundConstructBinding1 { | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../jboss/cdi/tck/interceptors/tests/contract/invocationContext/AroundConstructBinding2.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 org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.enterprise.util.AnnotationLiteral; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.CONSTRUCTOR; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@InterceptorBinding | ||
@Inherited | ||
@Target({ TYPE, METHOD, CONSTRUCTOR }) | ||
@Retention(RUNTIME) | ||
public @interface AroundConstructBinding2 { | ||
class Literal extends AnnotationLiteral<AroundConstructBinding2> implements AroundConstructBinding2 { | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ss/cdi/tck/interceptors/tests/contract/invocationContext/AroundConstructInterceptor1.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,26 @@ | ||
package org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundConstruct; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.Set; | ||
|
||
@Interceptor | ||
@AroundConstructBinding1 | ||
@Priority(100) | ||
public class AroundConstructInterceptor1 { | ||
private static Set<Annotation> allBindings; | ||
|
||
@AroundConstruct | ||
public Object intercept(InvocationContext ctx) throws Exception { | ||
allBindings = ctx.getInterceptorBindings(); | ||
return ctx.proceed(); | ||
} | ||
|
||
public static Set<Annotation> getAllBindings() { | ||
return allBindings; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ss/cdi/tck/interceptors/tests/contract/invocationContext/AroundConstructInterceptor2.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,26 @@ | ||
package org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundConstruct; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.Set; | ||
|
||
@Interceptor | ||
@AroundConstructBinding2 | ||
@Priority(200) | ||
public class AroundConstructInterceptor2 { | ||
private static Set<Annotation> allBindings; | ||
|
||
@AroundConstruct | ||
public Object intercept(InvocationContext ctx) throws Exception { | ||
allBindings = ctx.getInterceptorBindings(); | ||
return ctx.proceed(); | ||
} | ||
|
||
public static Set<Annotation> getAllBindings() { | ||
return allBindings; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../main/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Binding11.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,21 @@ | ||
package org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.enterprise.util.AnnotationLiteral; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@InterceptorBinding | ||
@Inherited | ||
@Target({ TYPE, METHOD }) | ||
@Retention(RUNTIME) | ||
public @interface Binding11 { | ||
class Literal extends AnnotationLiteral<Binding11> implements Binding11 { | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
.../main/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Binding12.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,21 @@ | ||
package org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.enterprise.util.AnnotationLiteral; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@InterceptorBinding | ||
@Inherited | ||
@Target({ TYPE, METHOD }) | ||
@Retention(RUNTIME) | ||
public @interface Binding12 { | ||
class Literal extends AnnotationLiteral<Binding12> implements Binding12 { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../main/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Binding13.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 org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.enterprise.util.AnnotationLiteral; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@InterceptorBinding | ||
@Inherited | ||
@Target({ TYPE, METHOD }) | ||
@Retention(RUNTIME) | ||
public @interface Binding13 { | ||
String value(); | ||
|
||
class Literal extends AnnotationLiteral<Binding13> implements Binding13 { | ||
private final String value; | ||
|
||
public Literal(String value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String value() { | ||
return value; | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
.../main/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Binding14.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,35 @@ | ||
package org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.enterprise.util.AnnotationLiteral; | ||
import jakarta.enterprise.util.Nonbinding; | ||
import jakarta.interceptor.InterceptorBinding; | ||
|
||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.ElementType.TYPE; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@InterceptorBinding | ||
@Inherited | ||
@Target({ TYPE, METHOD }) | ||
@Retention(RUNTIME) | ||
public @interface Binding14 { | ||
@Nonbinding | ||
String value(); | ||
|
||
class Literal extends AnnotationLiteral<Binding14> implements Binding14 { | ||
private final String value; | ||
|
||
public Literal(String value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String value() { | ||
return value; | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...n/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Interceptor11.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 org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundInvoke; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
@Interceptor | ||
@Binding11 | ||
@Priority(1100) | ||
public class Interceptor11 { | ||
@AroundInvoke | ||
public Object intercept(InvocationContext ctx) throws Exception { | ||
return ctx.proceed(); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...n/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Interceptor12.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,52 @@ | ||
package org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundInvoke; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.Set; | ||
|
||
@Interceptor | ||
@Binding12 | ||
@Priority(1200) | ||
public class Interceptor12 { | ||
private static Set<Annotation> allBindings; | ||
|
||
private static Set<Binding12> binding12s; // must be non-empty | ||
private static Binding12 binding12; // must be non-null | ||
|
||
private static Set<Binding5> binding5s; // must be empty | ||
private static Binding6 binding6; // must be null | ||
|
||
@AroundInvoke | ||
public Object intercept(InvocationContext ctx) throws Exception { | ||
allBindings = ctx.getInterceptorBindings(); | ||
binding12s = ctx.getInterceptorBindings(Binding12.class); | ||
binding12 = ctx.getInterceptorBinding(Binding12.class); | ||
binding5s = ctx.getInterceptorBindings(Binding5.class); | ||
binding6 = ctx.getInterceptorBinding(Binding6.class); | ||
return ctx.proceed(); | ||
} | ||
|
||
public static Set<Annotation> getAllBindings() { | ||
return allBindings; | ||
} | ||
|
||
public static Set<Binding12> getBinding12s() { | ||
return binding12s; | ||
} | ||
|
||
public static Binding12 getBinding12() { | ||
return binding12; | ||
} | ||
|
||
public static Set<Binding5> getBinding5s() { | ||
return binding5s; | ||
} | ||
|
||
public static Binding6 getBinding6() { | ||
return binding6; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...n/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Interceptor13.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 org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundInvoke; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
@Interceptor | ||
@Binding13("ok") | ||
@Priority(1300) | ||
public class Interceptor13 { | ||
@AroundInvoke | ||
public Object intercept(InvocationContext ctx) throws Exception { | ||
return ctx.proceed(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...n/java/org/jboss/cdi/tck/interceptors/tests/contract/invocationContext/Interceptor14.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 org.jboss.cdi.tck.interceptors.tests.contract.invocationContext; | ||
|
||
import jakarta.annotation.Priority; | ||
import jakarta.interceptor.AroundInvoke; | ||
import jakarta.interceptor.Interceptor; | ||
import jakarta.interceptor.InvocationContext; | ||
|
||
@Interceptor | ||
@Binding14("") | ||
@Priority(1400) | ||
public class Interceptor14 { | ||
@AroundInvoke | ||
public Object intercept(InvocationContext ctx) throws Exception { | ||
return ctx.proceed(); | ||
} | ||
} |
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
Oops, something went wrong.