Skip to content

Commit

Permalink
reduce iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
tootedom committed Sep 25, 2016
1 parent b2980ae commit a0cc3d5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void testCaching(CacheWithExpiry cache) {


Map<String,ListenableFuture<String>> cacheWrites = new HashMap<>(200);
for(int i=0;i<200;i++) {
for(int i=0;i<20;i++) {
final String uuidKey = UUID.randomUUID().toString();
cacheWrites.put(uuidKey, cache.apply(uuidKey, () -> {
return uuidKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void testCaching(CacheWithExpiry cache) {


Map<String,ListenableFuture<String>> cacheWrites = new HashMap<>(200);
for(int i=0;i<200;i++) {
for(int i=0;i<10;i++) {
final String uuidKey = UUID.randomUUID().toString();
cacheWrites.put(uuidKey, cache.apply(uuidKey, () -> {
return uuidKey;
Expand Down Expand Up @@ -183,6 +183,11 @@ private void testHashAlgorithm(HashAlgorithm algo) {
configServer2.before(configurationsMessage2, TimeUnit.SECONDS, -1, false);
String[] urls = new String[]{"localhost:"+configServer1.getPort(),"localhost:"+configServer2.getPort()};

try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}

cache = new ElastiCacheMemcachedCache<String>(
new ElastiCacheCacheConfigBuilder()
Expand Down Expand Up @@ -216,20 +221,20 @@ private void testHashAlgorithm(HashAlgorithm algo) {
e.printStackTrace();
}

for(int i =0;i<100;i++) {
for(int i =0;i<10;i++) {
testCaching(cache);
}

assertTrue(memcached1.getDaemon().getCache().getCurrentItems()>=1);
for(int i =0;i<100;i++) {
for(int i =0;i<10;i++) {
testCaching(cache);
}
try {
Thread.sleep(7000);
} catch (InterruptedException e) {
e.printStackTrace();
}
for(int i =0;i<100;i++) {
for(int i =0;i<10;i++) {
testCaching(cache);
}
assertTrue(memcached1.getDaemon().getCache().getCurrentItems()>1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void testStaleCaching(CacheWithExpiry cache) {


Map<String,ListenableFuture<String>> cacheWrites = new HashMap<>(200);
for(int i=0;i<200;i++) {
for(int i=0;i<50;i++) {
final String uuidKey = UUID.randomUUID().toString();
cacheWrites.put(uuidKey, cache.apply(uuidKey, () -> {
return uuidKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private void testStaleCaching(CacheWithExpiry cache) {


Map<String,ListenableFuture<String>> cacheWrites = new HashMap<>(100);
for(int i=0;i<100;i++) {
for(int i=0;i<20;i++) {
final String uuidKey = UUID.randomUUID().toString();
cacheWrites.put(uuidKey, cache.apply(uuidKey, () -> {
return uuidKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void testNoCaching(CacheWithExpiry cache) {


Map<String,ListenableFuture<String>> cacheWrites = new HashMap<>(200);
for(int i=0;i<200;i++) {
for(int i=0;i<20;i++) {
final String uuidKey = UUID.randomUUID().toString();
cacheWrites.put(uuidKey, cache.apply(uuidKey, () -> {
return uuidKey;
Expand Down

0 comments on commit a0cc3d5

Please sign in to comment.