From f2795a0c450c98cca1ed4c25ef2459ab26dc3ec9 Mon Sep 17 00:00:00 2001 From: oliviarla Date: Thu, 5 Feb 2026 10:40:10 +0900 Subject: [PATCH] FIX: Call correct method for overloaded asyncBopUpsert method --- .../java/net/spy/memcached/ArcusClient.java | 2 +- .../collection/btree/BopUpsertTest.java | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/spy/memcached/ArcusClient.java b/src/main/java/net/spy/memcached/ArcusClient.java index 2c3eda16b..4954922c1 100644 --- a/src/main/java/net/spy/memcached/ArcusClient.java +++ b/src/main/java/net/spy/memcached/ArcusClient.java @@ -1917,7 +1917,7 @@ public void gotTrimmedKey(String key, Object bkey) { public CollectionFuture asyncBopUpsert(String key, long bkey, byte[] elementFlag, Object value, CollectionAttributes attributesForCreate) { - return asyncBopInsert(key, bkey, elementFlag, value, attributesForCreate, collectionTranscoder); + return asyncBopUpsert(key, bkey, elementFlag, value, attributesForCreate, collectionTranscoder); } @Override diff --git a/src/test/manual/net/spy/memcached/collection/btree/BopUpsertTest.java b/src/test/manual/net/spy/memcached/collection/btree/BopUpsertTest.java index b43ad4a41..fe01cc223 100644 --- a/src/test/manual/net/spy/memcached/collection/btree/BopUpsertTest.java +++ b/src/test/manual/net/spy/memcached/collection/btree/BopUpsertTest.java @@ -16,13 +16,18 @@ */ package net.spy.memcached.collection.btree; +import java.util.Map; + import net.spy.memcached.collection.BaseIntegrationTest; import net.spy.memcached.collection.CollectionAttributes; +import net.spy.memcached.collection.Element; +import net.spy.memcached.internal.CollectionFuture; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -58,4 +63,25 @@ void testUpsertNotExistsKey() { fail(e.getMessage()); } } + + @Test + void upsertExistingElement() throws Exception { + // given + CollectionFuture future + = mc.asyncBopUpsert(KEY, BKEY, null, "INITIAL_VALUE", new CollectionAttributes()); + boolean result = future.get(); + assertTrue(result); + + // when + future = mc.asyncBopUpsert(KEY, BKEY, null, "UPDATED_VALUE", null); + result = future.get(); + + // then + assertTrue(result); + CollectionFuture>> futureToGet + = mc.asyncBopGet(KEY, BKEY, null, false, false); + Map> elements = futureToGet.get(); + assertTrue(elements.containsKey(BKEY)); + assertEquals("UPDATED_VALUE", elements.get(BKEY).getValue()); + } }