Java Code Examples for org.apache.hadoop.mapreduce.v2.app.job.Job#getJobACLs()
The following examples show how to use
org.apache.hadoop.mapreduce.v2.app.job.Job#getJobACLs() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAMWebServicesJobs.java From hadoop with Apache License 2.0 | 4 votes |
public void verifyAMJob(JSONObject info, Job job) throws JSONException { assertEquals("incorrect number of elements", 30, info.length()); // everyone access fields verifyAMJobGeneric(job, info.getString("id"), info.getString("user"), info.getString("name"), info.getString("state"), info.getLong("startTime"), info.getLong("finishTime"), info.getLong("elapsedTime"), info.getInt("mapsTotal"), info.getInt("mapsCompleted"), info.getInt("reducesTotal"), info.getInt("reducesCompleted"), (float) info.getDouble("reduceProgress"), (float) info.getDouble("mapProgress")); String diagnostics = ""; if (info.has("diagnostics")) { diagnostics = info.getString("diagnostics"); } // restricted access fields - if security and acls set verifyAMJobGenericSecure(job, info.getInt("mapsPending"), info.getInt("mapsRunning"), info.getInt("reducesPending"), info.getInt("reducesRunning"), info.getBoolean("uberized"), diagnostics, info.getInt("newReduceAttempts"), info.getInt("runningReduceAttempts"), info.getInt("failedReduceAttempts"), info.getInt("killedReduceAttempts"), info.getInt("successfulReduceAttempts"), info.getInt("newMapAttempts"), info.getInt("runningMapAttempts"), info.getInt("failedMapAttempts"), info.getInt("killedMapAttempts"), info.getInt("successfulMapAttempts")); Map<JobACL, AccessControlList> allacls = job.getJobACLs(); if (allacls != null) { for (Map.Entry<JobACL, AccessControlList> entry : allacls.entrySet()) { String expectName = entry.getKey().getAclName(); String expectValue = entry.getValue().getAclString(); Boolean found = false; // make sure ws includes it if (info.has("acls")) { JSONArray arr = info.getJSONArray("acls"); for (int i = 0; i < arr.length(); i++) { JSONObject aclInfo = arr.getJSONObject(i); if (expectName.matches(aclInfo.getString("name"))) { found = true; WebServicesTestUtils.checkStringMatch("value", expectValue, aclInfo.getString("value")); } } } else { fail("should have acls in the web service info"); } assertTrue("acl: " + expectName + " not found in webservice output", found); } } }
Example 2
Source File: TestAMWebServicesJobs.java From hadoop with Apache License 2.0 | 4 votes |
public void verifyAMJobXML(NodeList nodes, AppContext appContext) { assertEquals("incorrect number of elements", 1, nodes.getLength()); for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); Job job = appContext.getJob(MRApps.toJobID(WebServicesTestUtils .getXmlString(element, "id"))); assertNotNull("Job not found - output incorrect", job); verifyAMJobGeneric(job, WebServicesTestUtils.getXmlString(element, "id"), WebServicesTestUtils.getXmlString(element, "user"), WebServicesTestUtils.getXmlString(element, "name"), WebServicesTestUtils.getXmlString(element, "state"), WebServicesTestUtils.getXmlLong(element, "startTime"), WebServicesTestUtils.getXmlLong(element, "finishTime"), WebServicesTestUtils.getXmlLong(element, "elapsedTime"), WebServicesTestUtils.getXmlInt(element, "mapsTotal"), WebServicesTestUtils.getXmlInt(element, "mapsCompleted"), WebServicesTestUtils.getXmlInt(element, "reducesTotal"), WebServicesTestUtils.getXmlInt(element, "reducesCompleted"), WebServicesTestUtils.getXmlFloat(element, "reduceProgress"), WebServicesTestUtils.getXmlFloat(element, "mapProgress")); // restricted access fields - if security and acls set verifyAMJobGenericSecure(job, WebServicesTestUtils.getXmlInt(element, "mapsPending"), WebServicesTestUtils.getXmlInt(element, "mapsRunning"), WebServicesTestUtils.getXmlInt(element, "reducesPending"), WebServicesTestUtils.getXmlInt(element, "reducesRunning"), WebServicesTestUtils.getXmlBoolean(element, "uberized"), WebServicesTestUtils.getXmlString(element, "diagnostics"), WebServicesTestUtils.getXmlInt(element, "newReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "runningReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "failedReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "killedReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "successfulReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "newMapAttempts"), WebServicesTestUtils.getXmlInt(element, "runningMapAttempts"), WebServicesTestUtils.getXmlInt(element, "failedMapAttempts"), WebServicesTestUtils.getXmlInt(element, "killedMapAttempts"), WebServicesTestUtils.getXmlInt(element, "successfulMapAttempts")); Map<JobACL, AccessControlList> allacls = job.getJobACLs(); if (allacls != null) { for (Map.Entry<JobACL, AccessControlList> entry : allacls.entrySet()) { String expectName = entry.getKey().getAclName(); String expectValue = entry.getValue().getAclString(); Boolean found = false; // make sure ws includes it NodeList id = element.getElementsByTagName("acls"); if (id != null) { for (int j = 0; j < id.getLength(); j++) { Element aclElem = (Element) id.item(j); if (aclElem == null) { fail("should have acls in the web service info"); } if (expectName.matches(WebServicesTestUtils.getXmlString(aclElem, "name"))) { found = true; WebServicesTestUtils.checkStringMatch("value", expectValue, WebServicesTestUtils.getXmlString(aclElem, "value")); } } } else { fail("should have acls in the web service info"); } assertTrue("acl: " + expectName + " not found in webservice output", found); } } } }
Example 3
Source File: TestAMWebServicesJobs.java From big-c with Apache License 2.0 | 4 votes |
public void verifyAMJob(JSONObject info, Job job) throws JSONException { assertEquals("incorrect number of elements", 30, info.length()); // everyone access fields verifyAMJobGeneric(job, info.getString("id"), info.getString("user"), info.getString("name"), info.getString("state"), info.getLong("startTime"), info.getLong("finishTime"), info.getLong("elapsedTime"), info.getInt("mapsTotal"), info.getInt("mapsCompleted"), info.getInt("reducesTotal"), info.getInt("reducesCompleted"), (float) info.getDouble("reduceProgress"), (float) info.getDouble("mapProgress")); String diagnostics = ""; if (info.has("diagnostics")) { diagnostics = info.getString("diagnostics"); } // restricted access fields - if security and acls set verifyAMJobGenericSecure(job, info.getInt("mapsPending"), info.getInt("mapsRunning"), info.getInt("reducesPending"), info.getInt("reducesRunning"), info.getBoolean("uberized"), diagnostics, info.getInt("newReduceAttempts"), info.getInt("runningReduceAttempts"), info.getInt("failedReduceAttempts"), info.getInt("killedReduceAttempts"), info.getInt("successfulReduceAttempts"), info.getInt("newMapAttempts"), info.getInt("runningMapAttempts"), info.getInt("failedMapAttempts"), info.getInt("killedMapAttempts"), info.getInt("successfulMapAttempts")); Map<JobACL, AccessControlList> allacls = job.getJobACLs(); if (allacls != null) { for (Map.Entry<JobACL, AccessControlList> entry : allacls.entrySet()) { String expectName = entry.getKey().getAclName(); String expectValue = entry.getValue().getAclString(); Boolean found = false; // make sure ws includes it if (info.has("acls")) { JSONArray arr = info.getJSONArray("acls"); for (int i = 0; i < arr.length(); i++) { JSONObject aclInfo = arr.getJSONObject(i); if (expectName.matches(aclInfo.getString("name"))) { found = true; WebServicesTestUtils.checkStringMatch("value", expectValue, aclInfo.getString("value")); } } } else { fail("should have acls in the web service info"); } assertTrue("acl: " + expectName + " not found in webservice output", found); } } }
Example 4
Source File: TestAMWebServicesJobs.java From big-c with Apache License 2.0 | 4 votes |
public void verifyAMJobXML(NodeList nodes, AppContext appContext) { assertEquals("incorrect number of elements", 1, nodes.getLength()); for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); Job job = appContext.getJob(MRApps.toJobID(WebServicesTestUtils .getXmlString(element, "id"))); assertNotNull("Job not found - output incorrect", job); verifyAMJobGeneric(job, WebServicesTestUtils.getXmlString(element, "id"), WebServicesTestUtils.getXmlString(element, "user"), WebServicesTestUtils.getXmlString(element, "name"), WebServicesTestUtils.getXmlString(element, "state"), WebServicesTestUtils.getXmlLong(element, "startTime"), WebServicesTestUtils.getXmlLong(element, "finishTime"), WebServicesTestUtils.getXmlLong(element, "elapsedTime"), WebServicesTestUtils.getXmlInt(element, "mapsTotal"), WebServicesTestUtils.getXmlInt(element, "mapsCompleted"), WebServicesTestUtils.getXmlInt(element, "reducesTotal"), WebServicesTestUtils.getXmlInt(element, "reducesCompleted"), WebServicesTestUtils.getXmlFloat(element, "reduceProgress"), WebServicesTestUtils.getXmlFloat(element, "mapProgress")); // restricted access fields - if security and acls set verifyAMJobGenericSecure(job, WebServicesTestUtils.getXmlInt(element, "mapsPending"), WebServicesTestUtils.getXmlInt(element, "mapsRunning"), WebServicesTestUtils.getXmlInt(element, "reducesPending"), WebServicesTestUtils.getXmlInt(element, "reducesRunning"), WebServicesTestUtils.getXmlBoolean(element, "uberized"), WebServicesTestUtils.getXmlString(element, "diagnostics"), WebServicesTestUtils.getXmlInt(element, "newReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "runningReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "failedReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "killedReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "successfulReduceAttempts"), WebServicesTestUtils.getXmlInt(element, "newMapAttempts"), WebServicesTestUtils.getXmlInt(element, "runningMapAttempts"), WebServicesTestUtils.getXmlInt(element, "failedMapAttempts"), WebServicesTestUtils.getXmlInt(element, "killedMapAttempts"), WebServicesTestUtils.getXmlInt(element, "successfulMapAttempts")); Map<JobACL, AccessControlList> allacls = job.getJobACLs(); if (allacls != null) { for (Map.Entry<JobACL, AccessControlList> entry : allacls.entrySet()) { String expectName = entry.getKey().getAclName(); String expectValue = entry.getValue().getAclString(); Boolean found = false; // make sure ws includes it NodeList id = element.getElementsByTagName("acls"); if (id != null) { for (int j = 0; j < id.getLength(); j++) { Element aclElem = (Element) id.item(j); if (aclElem == null) { fail("should have acls in the web service info"); } if (expectName.matches(WebServicesTestUtils.getXmlString(aclElem, "name"))) { found = true; WebServicesTestUtils.checkStringMatch("value", expectValue, WebServicesTestUtils.getXmlString(aclElem, "value")); } } } else { fail("should have acls in the web service info"); } assertTrue("acl: " + expectName + " not found in webservice output", found); } } } }