MAPREDUCE-4569. Fixed TestHsWebServicesJobsQuery to pass on JDK7 by not depending on test order. Contributed by Thomas Graves.
svn merge --ignore-ancestry -c 1379146 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1379148 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0fb6e7626f
commit
e591c4f4dc
|
@ -429,6 +429,9 @@ Release 0.23.3 - UNRELEASED
|
|||
MAPREDUCE-4375. Show Configuration Tracability in MR UI (bobby
|
||||
via tgraves)
|
||||
|
||||
MAPREDUCE-4569. Fixed TestHsWebServicesJobsQuery to pass on JDK7 by not
|
||||
depending on test order. (Thomas Graves via vinodkv)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
MAPREDUCE-3850. Avoid redundant calls for tokens in TokenCache (Daryn
|
||||
|
|
|
@ -25,6 +25,7 @@ import static org.mockito.Mockito.when;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -217,9 +218,23 @@ public class TestHsWebServicesJobsQuery extends JerseyTest {
|
|||
@Test
|
||||
public void testJobsQueryStateNone() throws JSONException, Exception {
|
||||
WebResource r = resource();
|
||||
|
||||
ArrayList<JobState> JOB_STATES =
|
||||
new ArrayList<JobState>(Arrays.asList(JobState.values()));
|
||||
|
||||
// find a state that isn't in use
|
||||
Map<JobId, Job> jobsMap = appContext.getAllJobs();
|
||||
for (Map.Entry<JobId, Job> entry : jobsMap.entrySet()) {
|
||||
JOB_STATES.remove(entry.getValue().getState());
|
||||
}
|
||||
|
||||
assertTrue("No unused job states", JOB_STATES.size() > 0);
|
||||
JobState notInUse = JOB_STATES.get(0);
|
||||
|
||||
ClientResponse response = r.path("ws").path("v1").path("history")
|
||||
.path("mapreduce").path("jobs").queryParam("state", JobState.KILL_WAIT.toString())
|
||||
.path("mapreduce").path("jobs").queryParam("state", notInUse.toString())
|
||||
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
||||
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
|
|
Loading…
Reference in New Issue