forked from keycloak/keycloak
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testsuite PoC - Refactor registry and suppliers around annotations, a…
…nd make lookup of dependency by ref more generic (keycloak#32161) Signed-off-by: stianst <[email protected]>
- Loading branch information
Showing
19 changed files
with
175 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ | |
|
||
LifeCycle lifecycle() default LifeCycle.CLASS; | ||
|
||
String ref() default "default"; | ||
String ref() default ""; | ||
} |
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
11 changes: 11 additions & 0 deletions
11
test-poc/framework/src/main/java/org/keycloak/test/framework/injection/AnnotationFields.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,11 @@ | ||
package org.keycloak.test.framework.injection; | ||
|
||
public interface AnnotationFields { | ||
|
||
String CONFIG = "config"; | ||
String LIFECYCLE = "lifecycle"; | ||
String REF = "ref"; | ||
|
||
String REALM_REF = "realmRef"; | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...framework/src/main/java/org/keycloak/test/framework/injection/DefaultAnnotationProxy.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,28 @@ | ||
package org.keycloak.test.framework.injection; | ||
|
||
import java.lang.reflect.InvocationHandler; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Proxy; | ||
|
||
public class DefaultAnnotationProxy implements InvocationHandler { | ||
|
||
private final Class<?> annotationClass; | ||
|
||
public <S> DefaultAnnotationProxy(Class<?> annotationClass) { | ||
this.annotationClass = annotationClass; | ||
} | ||
|
||
public static <S> S proxy(Class<S> annotationClass) { | ||
return (S) Proxy.newProxyInstance(DefaultAnnotationProxy.class.getClassLoader(), new Class<?>[]{annotationClass}, new DefaultAnnotationProxy(annotationClass)); | ||
} | ||
|
||
@Override | ||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { | ||
if (method.getName().equals("annotationType")) { | ||
return annotationClass; | ||
} else { | ||
return annotationClass.getMethod(method.getName()).getDefaultValue(); | ||
} | ||
} | ||
|
||
} |
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
9 changes: 9 additions & 0 deletions
9
test-poc/framework/src/main/java/org/keycloak/test/framework/injection/StringUtil.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,9 @@ | ||
package org.keycloak.test.framework.injection; | ||
|
||
public class StringUtil { | ||
|
||
public static String convertEmptyToNull(String s) { | ||
return s != null && s.isEmpty() ? null : s; | ||
} | ||
|
||
} |
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.