Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@stianst
Copy link
Contributor

@stianst stianst commented Jul 15, 2024

Few things related to this:

  • Provided class types can be given an alias through ValueTypeAlias, if not specified it will default to value type class.getSimpleName
  • Suppliers can be given an alias by overriding getAlias, if not specified it will default to the suppliers class.getSimpleName
  • Added a temporary config thing to make it easy to configure using system properties, env variables, or a local .env file

Closes #30609

Signed-off-by: stianst [email protected]

@stianst stianst requested a review from a team as a code owner July 15, 2024 11:55
@stianst stianst force-pushed the testsuite-poc-supplier-select branch 3 times, most recently from 7e26283 to d258379 Compare July 15, 2024 12:16
Copy link
Contributor Author

@stianst stianst Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary until we have Smallrye config stuff in place, but this let's you define the supplier using system property, environment variable, or in .env file.

Example of the last one:

# cat ./test-poc/base/.env
KC_TEST_BROWSER=firefox
KC_TEST_SERVER=remote

Set<Supplier> skippedSuppliers = new HashSet<>();

while (supplierIterator.hasNext()) {
Supplier supplier = supplierIterator.next();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supplier.getValueType() is called 4 times in this loop, perhaps re-use it in a variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

shouldAdd = true;
}
} else {
shouldAdd = !loadedValueTypes.contains(supplier.getValueType());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is always true, as it matches the condition of the if it is contained in.

Suggested change
shouldAdd = !loadedValueTypes.contains(supplier.getValueType());
shouldAdd = true;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@stianst stianst force-pushed the testsuite-poc-supplier-select branch from de1e1c5 to 32f3eb3 Compare July 16, 2024 07:30

private static final Map<Class, String> aliases = Map.of(
WebDriver.class, "browser",
KeycloakTestServer.class, "server"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stianst Since TestDatabase is merged, I propose to rebase it and add a database support here as well with particular aliases. WDYT?

@stianst stianst force-pushed the testsuite-poc-supplier-select branch from 32f3eb3 to 49e5cf9 Compare July 16, 2024 07:55
Copy link
Contributor

@lhanusov lhanusov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you Stian for updating the code, LGTM 👍

@stianst stianst merged commit 479e213 into keycloak:main Jul 16, 2024
@stianst stianst deleted the testsuite-poc-supplier-select branch July 17, 2024 09:00
stianst added a commit to stianst/keycloak that referenced this pull request Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Testsuite PoC - Ability to select supplier for a given type

4 participants