ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject git commit: AMBARI-4299. Ambari server unit test failure. (mpapirkovskyy)
Date Wed, 15 Jan 2014 14:03:55 GMT
Updated Branches:
  refs/heads/trunk 391f1242c -> ad789bfe0


AMBARI-4299. Ambari server unit test failure. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ad789bfe
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ad789bfe
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ad789bfe

Branch: refs/heads/trunk
Commit: ad789bfe0e8f947d34e57225701ff4b115ed3a02
Parents: 391f124
Author: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Authored: Wed Jan 15 16:03:36 2014 +0200
Committer: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Committed: Wed Jan 15 16:03:36 2014 +0200

----------------------------------------------------------------------
 .../state/scheduler/BatchRequestJobTest.java      | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad789bfe/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java
index 8768645..adb2d27 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java
@@ -21,6 +21,7 @@ package org.apache.ambari.server.state.scheduler;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.scheduler.ExecutionScheduleManager;
 import org.easymock.Capture;
+import org.junit.Assert;
 import org.junit.Test;
 
 import java.util.HashMap;
@@ -36,11 +37,13 @@ public class BatchRequestJobTest {
     ExecutionScheduleManager scheduleManagerMock = createMock(ExecutionScheduleManager.class);
     BatchRequestJob batchRequestJob = new BatchRequestJob(scheduleManagerMock, 100L);
     String clusterName = "mycluster";
-    Long requestId = 11L;
+    long requestId = 11L;
+    long executionId = 31L;
+    long batchId = 1L;
 
     Map<String, Object> properties = new HashMap<String, Object>();
-    properties.put(BatchRequestJob.BATCH_REQUEST_EXECUTION_ID_KEY, 1L);
-    properties.put(BatchRequestJob.BATCH_REQUEST_BATCH_ID_KEY, 1L);
+    properties.put(BatchRequestJob.BATCH_REQUEST_EXECUTION_ID_KEY, executionId);
+    properties.put(BatchRequestJob.BATCH_REQUEST_BATCH_ID_KEY, batchId);
     properties.put(BatchRequestJob.BATCH_REQUEST_CLUSTER_NAME_KEY, clusterName);
 
 
@@ -64,8 +67,11 @@ public class BatchRequestJobTest {
     expect(scheduleManagerMock.getBatchRequestResponse(requestId, clusterName)).
       andReturn(inProgressResponse).times(4);
     expect(scheduleManagerMock.getBatchRequestResponse(requestId, clusterName)).
-      andReturn(completedResponse).atLeastOnce();
+      andReturn(completedResponse).once();
 
+    scheduleManagerMock.updateBatchRequest(eq(executionId), eq(batchId), eq(clusterName),
+        anyObject(BatchRequestResponse.class), eq(true));
+    expectLastCall().anyTimes();
 
     replay(scheduleManagerMock);
 
@@ -73,6 +79,10 @@ public class BatchRequestJobTest {
 
     verify(scheduleManagerMock);
 
+    Assert.assertEquals(executionId, executionIdCapture.getValue().longValue());
+    Assert.assertEquals(batchId, batchIdCapture.getValue().longValue());
+    Assert.assertEquals(clusterName, clusterNameCapture.getValue());
+
 
   }
 }


Mime
View raw message