Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-refactoring: remove forked class in tests #2845

Merged
merged 1 commit into from
May 1, 2024

Conversation

strehle
Copy link
Member

@strehle strehle commented Apr 21, 2024

Forked because of

#1462

We have now AlphanumericRandomValueStringGenerator and will get the other one.

For tests go with AlphanumericRandomValueStringGenerator

Prevent problems with #2813 where we now have the same class also in UAA context

Forked because of #1462
We have now AlphanumericRandomValueStringGenerator and will
get the other one.

For tests go with AlphanumericRandomValueStringGenerator
@strehle strehle marked this pull request as ready for review April 21, 2024 10:32
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/187469690

The labels on this github issue will be updated when the story is started.

@strehle strehle changed the title Remove forked class Remove forked class in tests Apr 21, 2024
@strehle strehle requested a review from a team April 21, 2024 11:07
@strehle strehle changed the title Remove forked class in tests test-refactoring: remove forked class in tests Apr 24, 2024
@swalchemist
Copy link
Contributor

I'm having trouble understanding the context. The code changes are easy enough to review on the surface. @strehle could you explain the motivation?

Why were some RandomValueStringGenerator uses replaced but not all?

@strehle
Copy link
Member Author

strehle commented Apr 30, 2024

I'm having trouble understanding the context. The code changes are easy enough to review on the surface. @strehle could you explain the motivation?

Why were some RandomValueStringGenerator uses replaced but not all?

The productive usage of this class is in context of OAuth2 and this stays.

This PR is only for test usages:
Motivation is to remove a mix of RandomValueStringGenerator and AlphanumericRandomValueStringGenerator usages.

History:
RandomValueStringGenerator comes from spring-security-oauth2 (https://github.com/spring-attic/spring-security-oauth/blob/main/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/RandomValueStringGenerator.java) and created random. In the past without extra characters, but with latest updates 2.5.1 , added -_

This new chars caused many test failures in UAA because we used the random for client / user creation.... and many test scenarios. Therefore I forked the original class from ext. project into UAA test scope, see
https://github.com/cloudfoundry/uaa/blob/develop/uaa/src/test/java/org/cloudfoundry/identity/uaa/login/util/RandomValueStringGenerator.java

Later there was the new class https://github.com/cloudfoundry/uaa/blob/develop/server/src/main/java/org/cloudfoundry/identity/uaa/util/AlphanumericRandomValueStringGenerator.java because others in UAA had similar issues.

Now (back in present) we want remove the spring security oauth2 dependency but the RandomValueStringGenerator still is in test, therefore this PR is a cleanup to remove this fork and re-use the AlphanumericRandomValueStringGenerator in places where we need random without special chars.
In the big move #2813 the original class RandomValueStringGenerator comes again to UAA but this time with its current behavior, means with extra characters which is needed for OAuth2 code creation.

You may see that all changes are only in TEST code, therefore this extra cleanup PR because I see it as a easy to approve PR and thought its better to have it in a extra PR and not within #2813

Copy link
Contributor

@swalchemist swalchemist left a comment

Choose a reason for hiding this comment

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

Thanks for splitting out this PR.

@strehle strehle merged commit 4a89b78 into develop May 1, 2024
20 checks passed
@strehle strehle deleted the Refactor-Test-Random-Generator branch May 1, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants