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.
Closes keycloak#30616. Added database supplier.
Signed-off-by: Miquel Simon <[email protected]>
- Loading branch information
Showing
8 changed files
with
101 additions
and
6 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
test-poc/framework/src/main/java/org/keycloak/test/framework/database/DatabaseConfig.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 org.keycloak.test.framework.database; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
public interface DatabaseConfig { | ||
|
||
default String vendor() { | ||
return ""; | ||
} | ||
|
||
default String containerImage() { | ||
return ""; | ||
} | ||
|
||
default String urlHost() { | ||
return ""; | ||
} | ||
|
||
default String username() { | ||
return ""; | ||
} | ||
|
||
default String password() { | ||
return ""; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
test-poc/framework/src/main/java/org/keycloak/test/framework/database/DatabaseSupplier.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,36 @@ | ||
package org.keycloak.test.framework.database; | ||
|
||
import org.keycloak.test.framework.injection.InstanceWrapper; | ||
import org.keycloak.test.framework.injection.LifeCycle; | ||
import org.keycloak.test.framework.injection.Registry; | ||
import org.keycloak.test.framework.injection.Supplier; | ||
|
||
import java.lang.annotation.Annotation; | ||
|
||
public class DatabaseSupplier implements Supplier<DatabaseConfig, Annotation> { | ||
@Override | ||
public Class<Annotation> getAnnotationClass() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Class<DatabaseConfig> getValueType() { | ||
return DatabaseConfig.class; | ||
} | ||
|
||
@Override | ||
public InstanceWrapper<DatabaseConfig, Annotation> getValue(Registry registry, Annotation annotation) { | ||
DatabaseConfig databaseConfig = new DefaultDatabaseConfig(); // TODO: Get config from system property | ||
return new InstanceWrapper<>(this, annotation, databaseConfig); | ||
} | ||
|
||
@Override | ||
public LifeCycle getLifeCycle() { | ||
return LifeCycle.GLOBAL; | ||
} | ||
|
||
@Override | ||
public boolean compatible(InstanceWrapper<DatabaseConfig, Annotation> a, InstanceWrapper<DatabaseConfig, Annotation> b) { | ||
return true; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...c/framework/src/main/java/org/keycloak/test/framework/database/DefaultDatabaseConfig.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.database; | ||
|
||
public class DefaultDatabaseConfig implements DatabaseConfig { | ||
|
||
public static final String DEFAULT_DB_VENDOR = "dev-mem"; | ||
|
||
@Override | ||
public String vendor() { | ||
return DEFAULT_DB_VENDOR; | ||
} | ||
} |
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
4 changes: 3 additions & 1 deletion
4
test-poc/framework/src/main/java/org/keycloak/test/framework/server/KeycloakTestServer.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
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
4 changes: 3 additions & 1 deletion
4
.../framework/src/main/java/org/keycloak/test/framework/server/RemoteKeycloakTestServer.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
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