TAJO-686: Integration test aborted. (jinho)
diff --git a/CHANGES.txt b/CHANGES.txt
index 120569a..1e5f747 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -588,6 +588,9 @@
TAJO-602: WorkerResourceManager should be broke down into 3 parts.
(hyunsik)
+ TEST
+
+ TAJO-686: Integration test aborted. (jinho)
Release 0.2.0 - released
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/rm/TestTajoResourceManager.java b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/rm/TestTajoResourceManager.java
index af48fa6..34deb29 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/rm/TestTajoResourceManager.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/master/rm/TestTajoResourceManager.java
@@ -30,6 +30,8 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import static org.apache.tajo.ipc.TajoResourceTrackerProtocol.NodeHeartbeat;
import static org.junit.Assert.assertEquals;
@@ -148,25 +150,20 @@
.setMaxMemoryMBPerContainer(maxMemory)
.build();
- final Object monitor = new Object();
+ final CountDownLatch barrier = new CountDownLatch(1);
final List<YarnProtos.ContainerIdProto> containerIds = new ArrayList<YarnProtos.ContainerIdProto>();
-
RpcCallback<WorkerResourceAllocationResponse> callBack = new RpcCallback<WorkerResourceAllocationResponse>() {
@Override
public void run(WorkerResourceAllocationResponse response) {
TestTajoResourceManager.this.response = response;
- synchronized(monitor) {
- monitor.notifyAll();
- }
+ barrier.countDown();
}
};
tajoWorkerResourceManager.allocateWorkerResources(request, callBack);
- synchronized(monitor) {
- monitor.wait();
- }
+ assertTrue(barrier.await(3, TimeUnit.SECONDS));
// assert after callback
@@ -242,22 +239,19 @@
.setMaxMemoryMBPerContainer(maxMemory)
.build();
- final Object monitor = new Object();
+ final CountDownLatch barrier = new CountDownLatch(1);
RpcCallback<WorkerResourceAllocationResponse> callBack = new RpcCallback<WorkerResourceAllocationResponse>() {
@Override
public void run(WorkerResourceAllocationResponse response) {
TestTajoResourceManager.this.response = response;
- synchronized(monitor) {
- monitor.notifyAll();
- }
+ barrier.countDown();
}
};
tajoWorkerResourceManager.allocateWorkerResources(request, callBack);
- synchronized(monitor) {
- monitor.wait();
- }
+
+ assertTrue(barrier.await(3, TimeUnit.SECONDS));
numAllocatedContainers += TestTajoResourceManager.this.response.getWorkerAllocatedResourceList().size();
@@ -324,7 +318,7 @@
.setMaxMemoryMBPerContainer(memoryMB)
.build();
- final Object monitor = new Object();
+ final CountDownLatch barrier = new CountDownLatch(1);
final List<YarnProtos.ContainerIdProto> containerIds = new ArrayList<YarnProtos.ContainerIdProto>();
@@ -333,16 +327,13 @@
@Override
public void run(WorkerResourceAllocationResponse response) {
TestTajoResourceManager.this.response = response;
- synchronized(monitor) {
- monitor.notifyAll();
- }
+ barrier.countDown();
}
};
tajoWorkerResourceManager.allocateWorkerResources(request, callBack);
- synchronized(monitor) {
- monitor.wait();
- }
+ assertTrue(barrier.await(3, TimeUnit.SECONDS));
+
for(WorkerAllocatedResource eachResource: response.getWorkerAllocatedResourceList()) {
assertTrue("AllocatedDiskSlot:" + eachResource.getAllocatedDiskSlots(),
eachResource.getAllocatedDiskSlots() >= minDiskSlots &&