This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-persistence-r2dbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 9c97d19  durable state store TCK spec (#368)
9c97d19 is described below

commit 9c97d1991bcf92c4e53912f569b76bf9d53356d7
Author: PJ Fanning <[email protected]>
AuthorDate: Thu May 14 17:45:06 2026 +0100

    durable state store TCK spec (#368)
    
    * Copy DurableStateStoreSpec and DurableStateStoreCapabilityFlags from 
apache/pekko#2833 and add R2dbcDurableStateStoreTCKSpec
    
    Agent-Logs-Url: 
https://github.com/pjfanning/incubator-pekko-persistence-r2dbc/sessions/c130a828-cd94-4647-aa31-5f6d1da79ce5
    
    Co-authored-by: pjfanning <[email protected]>
    
    * Fix compile error: remove sealed CapabilityFlags inheritance from 
DurableStateStoreCapabilityFlags
    
    Agent-Logs-Url: 
https://github.com/pjfanning/incubator-pekko-persistence-r2dbc/sessions/25477f77-1ea6-4812-8752-f55666ffe9b1
    
    Co-authored-by: pjfanning <[email protected]>
    
    * Enable supportsDeleteWithRevisionCheck and fix deleteObject to always 
throw on revision mismatch
    
    Agent-Logs-Url: 
https://github.com/pjfanning/incubator-pekko-persistence-r2dbc/sessions/e83e86a0-0d01-4de2-87a0-14e145d4f7b8
    
    Co-authored-by: pjfanning <[email protected]>
    
    * license headers
    
    * remove classes
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] 
<[email protected]>
    Co-authored-by: pjfanning <[email protected]>
---
 .../state/scaladsl/R2dbcDurableStateStore.scala    |  8 ++---
 .../state/R2dbcDurableStateStoreTCKSpec.scala      | 35 ++++++++++++++++++++++
 project/MetaInfLicenseNoticeCopy.scala             | 14 +++++++--
 3 files changed, 49 insertions(+), 8 deletions(-)

diff --git 
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/state/scaladsl/R2dbcDurableStateStore.scala
 
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/state/scaladsl/R2dbcDurableStateStore.scala
index 5e9ceb1..c860b2a 100644
--- 
a/core/src/main/scala/org/apache/pekko/persistence/r2dbc/state/scaladsl/R2dbcDurableStateStore.scala
+++ 
b/core/src/main/scala/org/apache/pekko/persistence/r2dbc/state/scaladsl/R2dbcDurableStateStore.scala
@@ -136,16 +136,14 @@ class R2dbcDurableStateStore[A](system: 
ExtendedActorSystem, config: Config, cfg
   override def deleteObject(persistenceId: String, revision: Long): 
Future[Done] = {
     stateDao.deleteStateForRevision(persistenceId, revision).map { count =>
       if (count != 1) {
-        // if you run this code with Pekko 1.0.x, no exception will be thrown 
here
-        // this matches the behavior of pekko-connectors-jdbc 1.0.x
-        // if you run this code with Pekko 1.1.x, a DeleteRevisionException 
will be thrown here
         val msg = if (count == 0) {
           s"Failed to delete object with persistenceId [$persistenceId] and 
revision [$revision]"
         } else {
           s"Delete object succeeded for persistenceId [$persistenceId] and 
revision [$revision] but more than one row was affected ($count rows)"
         }
-        
DurableStateExceptionSupport.createDeleteRevisionExceptionIfSupported(msg)
-          .foreach(throw _)
+        // Use DeleteRevisionException if available (Pekko 1.1+), otherwise 
fall back to IllegalStateException
+        throw 
DurableStateExceptionSupport.createDeleteRevisionExceptionIfSupported(msg)
+          .getOrElse(new IllegalStateException(msg))
       }
       Done
     }(ExecutionContext.parasitic)
diff --git 
a/core/src/test/scala/org/apache/pekko/persistence/r2dbc/state/R2dbcDurableStateStoreTCKSpec.scala
 
b/core/src/test/scala/org/apache/pekko/persistence/r2dbc/state/R2dbcDurableStateStoreTCKSpec.scala
new file mode 100644
index 0000000..7ce93fd
--- /dev/null
+++ 
b/core/src/test/scala/org/apache/pekko/persistence/r2dbc/state/R2dbcDurableStateStoreTCKSpec.scala
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.pekko.persistence.r2dbc.state
+
+import org.apache.pekko
+import pekko.actor.typed.ActorSystem
+import pekko.actor.typed.scaladsl.adapter._
+import pekko.persistence.CapabilityFlag
+import pekko.persistence.r2dbc.TestConfig
+import pekko.persistence.r2dbc.TestDbLifecycle
+import pekko.persistence.state.DurableStateStoreSpec
+
+class R2dbcDurableStateStoreTCKSpec
+    extends DurableStateStoreSpec(TestConfig.config)
+    with TestDbLifecycle {
+
+  override def typedSystem: ActorSystem[_] = system.toTyped
+
+  override protected def supportsDeleteWithRevisionCheck: CapabilityFlag = 
CapabilityFlag.on()
+}
diff --git a/project/MetaInfLicenseNoticeCopy.scala 
b/project/MetaInfLicenseNoticeCopy.scala
index 57cf763..50267fd 100644
--- a/project/MetaInfLicenseNoticeCopy.scala
+++ b/project/MetaInfLicenseNoticeCopy.scala
@@ -1,10 +1,18 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  *
- *   https://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
- * This file is part of the Apache Pekko project, which was derived from Akka.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 import sbt.Keys._


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to