-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove character replacement for equal statement (#154)
* feat: remove character replacement for equal statement * feat: remove character replacement for equal statement
- Loading branch information
1 parent
10b8e5f
commit 3fd98c0
Showing
6 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
:project-version: 2.19.0 | ||
:project-version: 2.20.0 | ||
:quarkus-version: 3.9.3 | ||
|
||
:examples-dir: ./../examples/ |
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
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
3 changes: 2 additions & 1 deletion
3
extensions/jpa/tests/src/main/resources/application.properties
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
%test.quarkus.datasource.db-kind=postgresql | ||
%test.quarkus.hibernate-orm.database.generation=drop-and-create | ||
#%test.quarkus.hibernate-orm.log.sql=true | ||
|
||
#%test.quarkus.hibernate-orm.log.format-sql=true | ||
#%test.quarkus.hibernate-orm.log.bind-parameters=true | ||
%test.quarkus.datasource.devservices.enabled=true |
64 changes: 64 additions & 0 deletions
64
extensions/jpa/tests/src/test/java/org/tkit/quarkus/jpa/test/UserDAOLikeTest.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,64 @@ | ||
package org.tkit.quarkus.jpa.test; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.tkit.quarkus.jpa.daos.Page; | ||
import org.tkit.quarkus.jpa.daos.PageResult; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
@DisplayName("User DAO tests") | ||
public class UserDAOLikeTest extends AbstractTest { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(UserDAOLikeTest.class); | ||
|
||
@Inject | ||
UserDAO userDAO; | ||
|
||
private void testSearchUser(String input, List<String> output) { | ||
UserSearchCriteria criteria = new UserSearchCriteria(); | ||
criteria.setName(input); | ||
|
||
var pages = userDAO.pageUsers2(criteria, Page.of(0, 10)); | ||
|
||
Assertions.assertNotNull(pages); | ||
PageResult<User> page = pages.getPageResult(); | ||
Assertions.assertNotNull(page); | ||
var names = page.getStream().map(User::getName).toList(); | ||
log.info("Result: {}", names); | ||
Assertions.assertTrue(output.containsAll(names)); | ||
} | ||
|
||
@Test | ||
public void searchUserTest() { | ||
User c = new User(); | ||
c.setEmail("test@test.test"); | ||
c.setName("rest1"); | ||
userDAO.create(c); | ||
|
||
c = new User(); | ||
c.setEmail("test@test.test"); | ||
c.setName("rest\\name"); | ||
userDAO.create(c); | ||
|
||
c = new User(); | ||
c.setEmail("test@test.test"); | ||
c.setName("rest_name"); | ||
userDAO.create(c); | ||
|
||
testSearchUser("rest_name", List.of("rest_name")); | ||
testSearchUser("rest_na*", List.of("rest_name")); | ||
testSearchUser("rest*", List.of("rest1", "rest\\name", "rest_name")); | ||
testSearchUser("rest\\na*", List.of("rest\\name")); | ||
testSearchUser("rest\\name", List.of("rest\\name")); | ||
} | ||
|
||
} |