From 936ddf634b91ac67d4ad0c713b5a8bb89d27d725 Mon Sep 17 00:00:00 2001 From: Wooseok Son Date: Mon, 22 Aug 2016 14:11:53 +0900 Subject: [PATCH] Fix testTimeouts for map collection features moved timeout related tests of map collection to ArcusTimeoutTest.java --- .../net/spy/memcached/ArcusTimeoutTest.java | 35 ++++++++++ .../MopInsertBulkMultipleTest.java | 70 ------------------- .../bulkoperation/MopInsertBulkTest.java | 29 -------- 3 files changed, 35 insertions(+), 99 deletions(-) diff --git a/src/test/java/net/spy/memcached/ArcusTimeoutTest.java b/src/test/java/net/spy/memcached/ArcusTimeoutTest.java index b954aa24..64b1d8de 100644 --- a/src/test/java/net/spy/memcached/ArcusTimeoutTest.java +++ b/src/test/java/net/spy/memcached/ArcusTimeoutTest.java @@ -342,4 +342,39 @@ public void testFlushByPrefixTimeout() flushFuture.get(1L, TimeUnit.MILLISECONDS); flushFuture.cancel(true); } + + @Test(expected = TimeoutException.class) + public void testMopInsertBulkMultipleTimeout() + throws InterruptedException, ExecutionException, TimeoutException { + String key = "MyMopKey"; + String value = "MyValue"; + + int mkeySize = mc.getMaxPipedItemCount(); + Map mkeys = new TreeMap(); + for (int i = 0; i < mkeySize; i++) { + mkeys.put(String.valueOf(i), value); + } + + Future> future = mc.asyncMopPipedInsertBulk( + key, mkeys, new CollectionAttributes()); + future.get(1L, TimeUnit.NANOSECONDS); + future.cancel(true); + } + + public void testMopInsertBulkTimeout() + throws InterruptedException, ExecutionException, TimeoutException { + String key = "MyMopKey"; + String value = "MyValue"; + int keySize = 250000; + + String[] keys = new String[keySize]; + for (int i = 0; i < keys.length; i++) { + keys[i] = "MyMopKey" + i; + } + + Future> future = mc.asyncMopInsertBulk( + Arrays.asList(keys), key, value, new CollectionAttributes()); + future.get(1L, TimeUnit.MILLISECONDS); + future.cancel(true); + } } diff --git a/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkMultipleTest.java b/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkMultipleTest.java index 7d760caf..9644894e 100644 --- a/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkMultipleTest.java +++ b/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkMultipleTest.java @@ -88,41 +88,6 @@ public void testInsertAndGet() { } } - public void testTimeout() { - String key = "MyMopKey"; - String value = "MyValue"; - - int mkeySize = mc.getMaxPipedItemCount(); - Map mkeys = new TreeMap(); - for (int i = 0; i < mkeySize; i++) { - mkeys.put(String.valueOf(i), value); - } - - try { - // SET - Future> future = mc - .asyncMopPipedInsertBulk(key, mkeys, - new CollectionAttributes()); - try { - Map errorList = future.get( - 1L, TimeUnit.NANOSECONDS); - - Assert.assertTrue("Error list is not empty." + errorList, - errorList.isEmpty()); - } catch (TimeoutException e) { - future.cancel(true); - return; - } catch (Exception e) { - future.cancel(true); - Assert.fail(); - } - Assert.fail(); - } catch (Exception e) { - e.printStackTrace(); - Assert.fail(); - } - } - public void testInsertAndGetUsingSingleClient() { String key = "MyMopKey333"; String value = "MyValue"; @@ -181,41 +146,6 @@ public void testInsertAndGetUsingSingleClient() { } } - public void testTimeoutUsingSingleClient() { - String key = "MyMopKey"; - String value = "MyValue"; - - int mkeySize = mc.getMaxPipedItemCount(); - Map mkeys = new TreeMap(); - for (int i = 0; i < mkeySize; i++) { - mkeys.put(String.valueOf(i), value); - } - - try { - // SET - Future> future = mc - .asyncMopPipedInsertBulk(key, mkeys, - new CollectionAttributes()); - try { - Map errorList = future.get( - 1L, TimeUnit.NANOSECONDS); - - Assert.assertTrue("Error list is not empty." + errorList, - errorList.isEmpty()); - } catch (TimeoutException e) { - future.cancel(true); - return; - } catch (Exception e) { - future.cancel(true); - Assert.fail(); - } - Assert.fail(); - } catch (Exception e) { - e.printStackTrace(); - Assert.fail(); - } - } - public void testErrorCount() { String key = "MyMopKeyErrorCount"; String value = "MyValue"; diff --git a/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkTest.java b/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkTest.java index 905567b0..01307a22 100644 --- a/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkTest.java +++ b/src/test/manual/net/spy/memcached/bulkoperation/MopInsertBulkTest.java @@ -86,35 +86,6 @@ public void testInsertAndGet() { } } - public void testTimeout() { - String value = "MyValue"; - int keySize = 250000; - - String[] keys = new String[keySize]; - for (int i = 0; i < keys.length; i++) { - keys[i] = "MyMopKey" + i; - } - - try { - // SET - Future> future = mc - .asyncMopInsertBulk(Arrays.asList(keys), MKEY, value, - new CollectionAttributes()); - try { - future.get(1L, TimeUnit.MILLISECONDS); - Assert.fail("There is no timeout"); - } catch (TimeoutException e) { - future.cancel(true); - return; - } catch (Exception e) { - future.cancel(true); - } - } catch (Exception e) { - e.printStackTrace(); - Assert.fail(); - } - } - public void testCountError() { String value = "MyValue";