Copilot commented on code in PR #3805:
URL: https://github.com/apache/cxf/pull/3805#discussion_r4748656502


##########
rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java:
##########
@@ -45,26 +45,19 @@ public class RMTxStoreTest extends RMTxStoreTestBase {
     public static void setUpOnce() {
         RMTxStoreTestBase.setUpOnce();
 
-        RMTxStore.deleteDatabaseFiles();
-
-        store = new RMTxStore();
-        store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
+        store = new RMTxStore() {
+            @Override
+            protected boolean isRecoverableError(SQLException ex) {
+                // check for a transient or non-transient connection exception
+                return ex.getSQLState() != null && 
ex.getSQLState().startsWith("90007");

Review Comment:
   Overriding `isRecoverableError()` means `testReconnect()` no longer 
exercises the production classifier and can pass even if that implementation 
always returns false. Keep the H2-specific reconnect test, but add explicit 
tests on an unmodified `RMTxStore` for recoverable `08` SQL states, a 
non-connection error, and a null SQL state.



##########
rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java:
##########
@@ -45,26 +45,19 @@ public class RMTxStoreTest extends RMTxStoreTestBase {
     public static void setUpOnce() {
         RMTxStoreTestBase.setUpOnce();
 
-        RMTxStore.deleteDatabaseFiles();
-
-        store = new RMTxStore();
-        store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
+        store = new RMTxStore() {
+            @Override
+            protected boolean isRecoverableError(SQLException ex) {
+                // check for a transient or non-transient connection exception
+                return ex.getSQLState() != null && 
ex.getSQLState().startsWith("90007");
+            }
+        };
+        store.setDriverClassName("org.h2.Driver");
+        store.setUrl("jdbc:h2:~/rmdbpc;MODE=Derby;");

Review Comment:
   The fixed home-directory database paths make independent checkouts contend 
for H2 file locks; this URL also matches `RMTxStorePooledConnectionTest`, so 
parallel test forks can collide within one build. Use distinct database files 
under the module's `target` directory and update the matching URL assertion in 
`RMTxStoreConfigurationTest:54`. The same home-directory issue occurs in 
`RMTxStorePooledConnectionTest:38`, `txstore-ds-bean.xml:32`, 
`txstore-ds-bean2.xml:29`, and `txstore-bean.xml:29`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to