Author: julien_viet
Date: 2010-04-06 09:09:18 -0400 (Tue, 06 Apr 2010)
New Revision: 2490
Modified:
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java
Log:
improve unit test relibility
Modified:
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java
===================================================================
---
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java 2010-04-06
11:44:01 UTC (rev 2489)
+++
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java 2010-04-06
13:09:18 UTC (rev 2490)
@@ -39,7 +39,7 @@
private AssertionFailedError failure;
/** . */
- private LinkedList<String> events = new LinkedList<String>();
+ private List<String> events = Collections.synchronizedList(new
LinkedList<String>());
FutureCache<String, String, Callable<String>> futureCache = new
FutureCache<String, String, Callable<String>>(new StringLoader()) {
@@ -53,7 +53,7 @@
{
failure = new AssertionFailedError();
}
- events.addLast("get/key1");
+ events.add("get/key1");
}
else if (key == key2)
{
@@ -61,7 +61,7 @@
{
failure = new AssertionFailedError();
}
- events.addLast("get/key2");
+ events.add("get/key2");
}
else
{
@@ -77,7 +77,7 @@
{
if (Thread.currentThread() == thread1)
{
- events.addLast("begin_put/key1/" + entry);
+ events.add("begin_put/key1/" + entry);
//
thread2.start();
@@ -89,7 +89,7 @@
}
//
- events.addLast("end_put/key1");
+ events.add("end_put/key1");
}
else
{
@@ -118,11 +118,11 @@
{
public String call() throws Exception
{
- events.addLast("call/key1");
+ events.add("call/key1");
return "foo_value_1";
}
}, key1);
- events.addLast("retrieved/key1/" + v);
+ events.add("retrieved/key1/" + v);
}
};
@@ -139,7 +139,7 @@
return "foo_value_2";
}
}, key2);
- events.addLast("retrieved/key2/" + v);
+ events.add("retrieved/key2/" + v);
}
};
Show replies by date