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

db rider with zonkyio embedded postgresql #270

Open
alex123asd123asd opened this issue Apr 17, 2024 · 2 comments
Open

db rider with zonkyio embedded postgresql #270

alex123asd123asd opened this issue Apr 17, 2024 · 2 comments
Labels
status: waiting-for-feedback We need additional information before we can continue

Comments

@alex123asd123asd
Copy link

alex123asd123asd commented Apr 17, 2024

Hello.
Does it possible to use db rider with zonkyio embedded postgresql?
I have tried, but without success - @DataSet annotation throws an exception that table does not exist.

@tomix26
Copy link
Collaborator

tomix26 commented Apr 17, 2024

Hi, thanks for the comment. I've just tested it and it seems that this combination works fine. Technically, it should be possible to use the embedded database library with any tool that accesses the database using Spring's dataSource bean.

However, proper configuration is essential for proper operation. Make sure you have the caseSensitiveTableNames flag enabled and that your schema name is set up correctly. In my case, the annotations below were enough to get it working.

@DBRider
@DBUnit(caseSensitiveTableNames = true, escapePattern = "\"?\"", schema = "test")

@tomix26 tomix26 added the status: waiting-for-feedback We need additional information before we can continue label Apr 17, 2024
@alex123asd123asd
Copy link
Author

Cool it works.
Thank you for your help :)

@Sql("/datasets/init.sql")
@ExtendWith(DBUnitExtension.class)
@SpringJUnitConfig(DbTestConfig.class)
@DBUnit(caseSensitiveTableNames = true)
@AutoConfigureEmbeddedDatabase(provider = ZONKY)
class CddAlertRepositoryImplV2IntegrationTest {

    @Autowired
    MyRepository myRepository;

    Info INFO = Info.builder()
            .x("x")
            .y("y")
            .z("z")
            .build();

    @Test
    @DataSet("/datasets/data.xml")
    void test() {
        var data = myRepository.getData(INFO);
        var expected = ...;
        assertEquals(expected, data);
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback We need additional information before we can continue
Projects
None yet
Development

No branches or pull requests

2 participants