You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "zhfeng (via GitHub)" <gi...@apache.org> on 2023/04/13 04:44:02 UTC

[GitHub] [camel-quarkus] zhfeng opened a new pull request, #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

zhfeng opened a new pull request, #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769

   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on a diff in pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769#discussion_r1165178632


##########
integration-tests/mybatis/src/test/java/org/apache/camel/quarkus/component/mybatis/it/MyBatisTest.java:
##########
@@ -70,17 +98,126 @@ public void testInsert() {
                 .body(equalTo("3"));
     }
 
+    public void testInsertRollback() {
+        Account account = new Account();
+        account.setId(999);
+        account.setFirstName("Rollback");
+        account.setLastName("Rollback");
+        account.setEmailAddress("Rollback@gmail.com");
+
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body(account)
+                .post("/mybatis/insertOne")
+                .then()
+                .statusCode(500);
+    }
+
+    public void testInsertList() {
+        Account account1 = new Account();
+        account1.setId(555);
+        account1.setFirstName("Aaron");
+        account1.setLastName("Daubman");
+        account1.setEmailAddress("ReadTheDevList@gmail.com");
+
+        Account account2 = new Account();
+        account2.setId(666);
+        account2.setFirstName("Amos");
+        account2.setLastName("Feng");
+        account2.setEmailAddress("ZHENG@gmail.com");
+
+        List<Account> accountList = new ArrayList<>(2);
+
+        accountList.add(account1);
+        accountList.add(account2);
+
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body(accountList)
+                .post("/mybatis/insertList")
+                .then()
+                .statusCode(200)
+                .body(equalTo("5"));

Review Comment:
   Why it does return 5 here ? We batch insert only 2 items ? Maybe there 3 before that ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on a diff in pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on code in PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769#discussion_r1165222210


##########
integration-tests/mybatis/src/test/java/org/apache/camel/quarkus/component/mybatis/it/MyBatisTest.java:
##########
@@ -70,17 +98,126 @@ public void testInsert() {
                 .body(equalTo("3"));
     }
 
+    public void testInsertRollback() {
+        Account account = new Account();
+        account.setId(999);
+        account.setFirstName("Rollback");
+        account.setLastName("Rollback");
+        account.setEmailAddress("Rollback@gmail.com");
+
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body(account)
+                .post("/mybatis/insertOne")
+                .then()
+                .statusCode(500);
+    }
+
+    public void testInsertList() {
+        Account account1 = new Account();
+        account1.setId(555);
+        account1.setFirstName("Aaron");
+        account1.setLastName("Daubman");
+        account1.setEmailAddress("ReadTheDevList@gmail.com");
+
+        Account account2 = new Account();
+        account2.setId(666);
+        account2.setFirstName("Amos");
+        account2.setLastName("Feng");
+        account2.setEmailAddress("ZHENG@gmail.com");
+
+        List<Account> accountList = new ArrayList<>(2);
+
+        accountList.add(account1);
+        accountList.add(account2);
+
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body(accountList)
+                .post("/mybatis/insertList")
+                .then()
+                .statusCode(200)
+                .body(equalTo("5"));

Review Comment:
   Well, there are 2 items in the `insert.sql` and the other one is in `testInsert()` .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769#issuecomment-1506582447

   @zhfeng  Should it be backported to 2.13.x branch ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] zhfeng commented on pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "zhfeng (via GitHub)" <gi...@apache.org>.
zhfeng commented on PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769#issuecomment-1506608787

   Some cases have been in https://github.com/quarkiverse/quarkus-mybatis/tree/master/mybatis/integration-tests/ and yeah, there could be some cases we are missing, such as Cache and dynamic queries.
   
   I will check if it is possible to backport to `2.13.x`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on a diff in pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on code in PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769#discussion_r1165459662


##########
integration-tests/mybatis/src/test/java/org/apache/camel/quarkus/component/mybatis/it/MyBatisTest.java:
##########
@@ -70,17 +98,126 @@ public void testInsert() {
                 .body(equalTo("3"));
     }
 
+    public void testInsertRollback() {
+        Account account = new Account();
+        account.setId(999);
+        account.setFirstName("Rollback");
+        account.setLastName("Rollback");
+        account.setEmailAddress("Rollback@gmail.com");
+
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body(account)
+                .post("/mybatis/insertOne")
+                .then()
+                .statusCode(500);
+    }
+
+    public void testInsertList() {
+        Account account1 = new Account();
+        account1.setId(555);
+        account1.setFirstName("Aaron");
+        account1.setLastName("Daubman");
+        account1.setEmailAddress("ReadTheDevList@gmail.com");
+
+        Account account2 = new Account();
+        account2.setId(666);
+        account2.setFirstName("Amos");
+        account2.setLastName("Feng");
+        account2.setEmailAddress("ZHENG@gmail.com");
+
+        List<Account> accountList = new ArrayList<>(2);
+
+        accountList.add(account1);
+        accountList.add(account2);
+
+        RestAssured.given()
+                .contentType(ContentType.JSON)
+                .body(accountList)
+                .post("/mybatis/insertList")
+                .then()
+                .statusCode(200)
+                .body(equalTo("5"));

Review Comment:
   Ok, it's clearer now. It's the kind of integration test scenario where the result of an assert can depend on previous operation. Many thanks of clarification :+1: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger merged pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger merged PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-quarkus] aldettinger commented on pull request #4769: Fix #4717 to expand camel-quarkus-mybatis test coverage

Posted by "aldettinger (via GitHub)" <gi...@apache.org>.
aldettinger commented on PR #4769:
URL: https://github.com/apache/camel-quarkus/pull/4769#issuecomment-1506564686

   Many thanks  @zhfeng. It looks good. Just one question for curiosity.
   
   Beyond this pr, it looks there is a lot of native usage in mybatis, like in `MapperProxy`, `PooledConnection`, `VFSHolder`, `CacheBuilder`, `LogFactory`... There is even whole package `org.apache.ibatis.reflection.*`.
   Are all those cases covered in tests ? That my be another ticket/pr for sure.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org