diff --git a/src/test/manual/net/spy/memcached/bulkoperation/BopInsertBulkTest.java b/src/test/manual/net/spy/memcached/bulkoperation/BopInsertBulkTest.java index 7d107b205..a9dafdd3f 100644 --- a/src/test/manual/net/spy/memcached/bulkoperation/BopInsertBulkTest.java +++ b/src/test/manual/net/spy/memcached/bulkoperation/BopInsertBulkTest.java @@ -374,4 +374,32 @@ void testErrorCount() { fail(); } } + + @Test + void testBopInsertNotPiped() { + String value = "MyValue"; + long bkey = Long.MAX_VALUE; + Future> future; + Map errorList; + String[] keys = {"MyBopKeyA"}; + + try { + // DELETE + mc.delete(keys[0]).get(); + // SET FAIL + future = mc.asyncBopInsertBulk(Arrays.asList(keys), bkey, null, value, + null); + errorList = future.get(20000L, TimeUnit.MILLISECONDS); + assertEquals(1, errorList.size()); + // SET + future = mc.asyncBopInsertBulk(Arrays.asList(keys), bkey, null, value, + new CollectionAttributes()); + errorList = future.get(20000L, TimeUnit.MILLISECONDS); + assertTrue(errorList.isEmpty(), + "Error list is not empty."); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } } diff --git a/src/test/manual/net/spy/memcached/bulkoperation/BopPipeUpdateTest.java b/src/test/manual/net/spy/memcached/bulkoperation/BopPipeUpdateTest.java index da076826d..ca3685194 100644 --- a/src/test/manual/net/spy/memcached/bulkoperation/BopPipeUpdateTest.java +++ b/src/test/manual/net/spy/memcached/bulkoperation/BopPipeUpdateTest.java @@ -284,4 +284,29 @@ void testBopPipeUpdateNotFoundKey() { } } + + @Test + void testBopUpdateNotPiped() { + List> updateElements = new ArrayList<>(); + updateElements.add(new Element<>(0, "updated" + 0, + new ElementFlagUpdate(new byte[]{1, 1, 1, 1}))); + CollectionFuture> future; + Map errorList; + + try { + // UPDATE + future = mc.asyncBopPipedUpdateBulk(KEY, updateElements); + errorList = future.get(5000L, TimeUnit.MILLISECONDS); + assertTrue(errorList.isEmpty()); + // DELETE + mc.delete(KEY).get(); + // UPDATE FAIL + future = mc.asyncBopPipedUpdateBulk(KEY, updateElements); + errorList = future.get(5000L, TimeUnit.MILLISECONDS); + assertEquals(1, errorList.size()); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } } diff --git a/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java b/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java index 59607e1ca..526f7505e 100644 --- a/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java +++ b/src/test/manual/net/spy/memcached/collection/set/SopBulkAPITest.java @@ -17,6 +17,7 @@ package net.spy.memcached.collection.set; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; @@ -127,4 +128,26 @@ void testBulkEmptySet() { } fail(); } + + @Test + void testSopBulkNotPiped() { + CollectionFuture> future; + Map errorList; + try { + mc.delete(key).get(); + // INSERT FAIL + future = mc.asyncSopPipedInsertBulk(key, Arrays.asList(valueList.get(0)), + null); + errorList = future.get(10000, TimeUnit.MILLISECONDS); + assertEquals(1, errorList.size()); + // INSERT + future = mc.asyncSopPipedInsertBulk(key, Arrays.asList(valueList.get(0)), + new CollectionAttributes()); + errorList = future.get(10000, TimeUnit.MILLISECONDS); + assertEquals(0, errorList.size()); + } catch (Exception e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } }