Skip to content

Migrate Cassandra configuration to Spring Boot 3.0 in properties format #491

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

Merged

Conversation

kuldeepsidhu88
Copy link

@kuldeepsidhu88 kuldeepsidhu88 commented Oct 19, 2022

Migrate Cassandra configuration to Spring Boot 3.0 in properties format
Fixes #442

@fabapp2
Copy link
Contributor

fabapp2 commented Oct 28, 2022

Hi @kuldeepsidhu88

thank you for this contribution 🚀
I will review your PR asap, I was on vacation and am a bit behind.

@fabapp2 fabapp2 added upgrade:boot 3.0.0 Spring Boot 3.0.0 labels Oct 31, 2022
@fabapp2 fabapp2 added this to the v0.13.0 milestone Oct 31, 2022
@fabapp2
Copy link
Contributor

fabapp2 commented Oct 31, 2022

Hi @kuldeepsidhu88

Nice, thank you 👍

Could you replace the Visitor with

          - org.openrewrite.properties.ChangePropertyKey:
              oldPropertyKey: spring.data.cassandra
              newPropertyKey: spring.cassandra   

which will do the same as the yaml but for properties files
Sorry, my bad as I didn't add this in the spec. 🙈

@fabapp2
Copy link
Contributor

fabapp2 commented Oct 31, 2022

Hi @kuldeepsidhu88

Forgive me, I wanted to be nice and used the GitHub UI to resolve a merge conflict but broke the integration test leaving a ). 🙈
Shouldn't be hard to fix but I decided not to push anything to your PR.

@kuldeepsidhu88
Copy link
Author

kuldeepsidhu88 commented Nov 2, 2022

@fabapp2 Tried with the

Hi @kuldeepsidhu88

Nice, thank you 👍

Could you replace the Visitor with

          - org.openrewrite.properties.ChangePropertyKey:
              oldPropertyKey: spring.data.cassandra
              newPropertyKey: spring.cassandra   

which will do the same as the yaml but for properties files Sorry, my bad as I didn't add this in the spec. 🙈

I tried as above but test is failing and it does not remove the data property. Please let me know if I am missing something.
Noticed, this works fine if we provide the full property name.

image

@fabapp2
Copy link
Contributor

fabapp2 commented Nov 2, 2022

@fabapp2 Tried with the

Hi @kuldeepsidhu88
Nice, thank you 👍
Could you replace the Visitor with

          - org.openrewrite.properties.ChangePropertyKey:
              oldPropertyKey: spring.data.cassandra
              newPropertyKey: spring.cassandra   

which will do the same as the yaml but for properties files Sorry, my bad as I didn't add this in the spec. 🙈

I tried as above but test is failing and it does not remove the data property. Please let me know if I am missing something. Noticed, this works fine if we provide the full property name.

image

Hm, I share your observation.
Maybe I had a bad day yesterday (well possible) or I did something differently.
Need to further investigate. Will ping you when I found the issue.

Update:
It should work. This test passes (as expected). Going for lunch now, need to debug this when I'm back... 🤔

public class ChangeKeyTest {
    @Test
    void test_renameMe() {
        String properties =
                "spring.data.cassandra=value";

        List<Properties.File> propertiesFiles = new PropertiesParser().parse(properties);

        RecipeRun run = new ChangePropertyKey("spring.data.cassandra", "spring.cassandra", null, null).run(
                propertiesFiles);
        assertThat(run.getResults().get(0).getAfter().printAll()).isEqualTo("spring.cassandra=value");
    }
}

"Noticed, this works fine if we provide the full property name." --> missed this sentence... wait

Update2: then the test fails. Will get back to you/this when I'm back from lunch...

@fabapp2
Copy link
Contributor

fabapp2 commented Nov 2, 2022

Hi @kuldeepsidhu88

you know what... let's keep your visitor and get this into main?

@kuldeepsidhu88 kuldeepsidhu88 marked this pull request as ready for review November 3, 2022 04:48
@kuldeepsidhu88
Copy link
Author

Hi @kuldeepsidhu88

you know what... let's keep your visitor and get this into main?

Sure, changed the PR status from Draft to Open. If no other changes required on this PR, feel free to merge it.

Copy link
Contributor

@fabapp2 fabapp2 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 for your contribution @kuldeepsidhu88 🚀

@fabapp2 fabapp2 force-pushed the cassandra_properties branch from bca806a to a9a9cab Compare November 3, 2022 13:54
@fabapp2 fabapp2 merged commit 59ab772 into spring-projects-experimental:main Nov 3, 2022
@kuldeepsidhu88 kuldeepsidhu88 deleted the cassandra_properties branch February 5, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0.0 Spring Boot 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.0.0-M5: Cassandra Properties
3 participants