Java 类com.sun.jersey.api.client.UniformInterfaceException 实例源码

项目:hadoop    文件:TestHsWebServicesJobs.java   
@Test
public void testJobIdInvalid() throws JSONException, Exception {
  WebResource r = resource();

  try {
    r.path("ws").path("v1").path("history").path("mapreduce").path("jobs")
        .path("job_foo").accept(MediaType.APPLICATION_JSON)
        .get(JSONObject.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    verifyJobIdInvalid(message, type, classname);

  }
}
项目:hadoop    文件:TestNMWebServices.java   
@Test
public void testInvalidAccept() throws JSONException, Exception {
  WebResource r = resource();
  String responseStr = "";
  try {
    responseStr = r.path("ws").path("v1").path("node")
        .accept(MediaType.TEXT_PLAIN).get(String.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.INTERNAL_SERVER_ERROR,
        response.getClientResponseStatus());
    WebServicesTestUtils.checkStringMatch(
        "error string exists and shouldn't", "", responseStr);
  }
}
项目:hadoop    文件:TestAHSWebServices.java   
@Test
public void testInvalidAccept() throws JSONException, Exception {
  WebResource r = resource();
  String responseStr = "";
  try {
    responseStr =
        r.path("ws").path("v1").path("applicationhistory")
          .queryParam("user.name", USERS[round])
          .accept(MediaType.TEXT_PLAIN).get(String.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.INTERNAL_SERVER_ERROR,
      response.getClientResponseStatus());
    WebServicesTestUtils.checkStringMatch(
      "error string exists and shouldn't", "", responseStr);
  }
}
项目:hadoop    文件:TestAMWebServicesJobs.java   
@Test
public void testJobIdNonExist() throws JSONException, Exception {
  WebResource r = resource();

  try {
    r.path("ws").path("v1").path("mapreduce").path("jobs")
        .path("job_0_1234").get(JSONObject.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils.checkStringMatch("exception message",
        "java.lang.Exception: job, job_0_1234, is not found", message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "NotFoundException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "org.apache.hadoop.yarn.webapp.NotFoundException", classname);
  }
}
项目:hadoop    文件:TestRMWebServicesNodes.java   
@Test
public void testInvalidNode() throws JSONException, Exception {
  rm.registerNode("h1:1234", 5120);
  rm.registerNode("h2:1235", 5121);

  WebResource r = resource();
  try {
    r.path("ws").path("v1").path("cluster").path("nodes")
        .path("node_invalid_foo").accept(MediaType.APPLICATION_JSON)
        .get(JSONObject.class);

    fail("should have thrown exception on non-existent nodeid");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();

    assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils.checkStringMatch("exception message",
        "Invalid NodeId \\[node_invalid_foo\\]. Expected host:port", message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "IllegalArgumentException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "java.lang.IllegalArgumentException", classname);
  } finally {
    rm.stop();
  }
}
项目:hadoop    文件:TestRMWebServicesApps.java   
@Test
public void testInvalidApp() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  try {
    r.path("ws").path("v1").path("cluster").path("apps")
        .path("application_invalid_12").accept(MediaType.APPLICATION_JSON)
        .get(JSONObject.class);
    fail("should have thrown exception on invalid appid");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();

    assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils.checkStringMatch("exception message",
        "For input string: \"invalid\"", message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "NumberFormatException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "java.lang.NumberFormatException", classname);

  } finally {
    rm.stop();
  }
}
项目:hadoop    文件:TestAMWebServicesJobs.java   
@Test
public void testJobIdInvalidXML() throws JSONException, Exception {
  WebResource r = resource();

  try {
    r.path("ws").path("v1").path("mapreduce").path("jobs").path("job_foo")
        .accept(MediaType.APPLICATION_XML).get(JSONObject.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
    String msg = response.getEntity(String.class);
    System.out.println(msg);
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource is = new InputSource();
    is.setCharacterStream(new StringReader(msg));
    Document dom = db.parse(is);
    NodeList nodes = dom.getElementsByTagName("RemoteException");
    Element element = (Element) nodes.item(0);
    String message = WebServicesTestUtils.getXmlString(element, "message");
    String type = WebServicesTestUtils.getXmlString(element, "exception");
    String classname = WebServicesTestUtils.getXmlString(element,
        "javaClassName");
    verifyJobIdInvalid(message, type, classname);
  }
}
项目:hadoop    文件:TestAMWebServices.java   
@Test
public void testInvalidUri() throws JSONException, Exception {
  WebResource r = resource();
  String responseStr = "";
  try {
    responseStr = r.path("ws").path("v1").path("mapreduce").path("bogus")
        .accept(MediaType.APPLICATION_JSON).get(String.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    WebServicesTestUtils.checkStringMatch(
        "error string exists and shouldn't", "", responseStr);
  }
}
项目:hadoop    文件:TestRMWebServicesNodes.java   
@Test
public void testNodesQueryStateInvalid() throws JSONException, Exception {
  WebResource r = resource();
  rm.registerNode("h1:1234", 5120);
  rm.registerNode("h2:1235", 5121);

  try {
    r.path("ws").path("v1").path("cluster").path("nodes")
        .queryParam("states", "BOGUSSTATE").accept(MediaType.APPLICATION_JSON)
        .get(JSONObject.class);

    fail("should have thrown exception querying invalid state");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();

    assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());

    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils
        .checkStringContains(
            "exception message",
            "org.apache.hadoop.yarn.api.records.NodeState.BOGUSSTATE",
            message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "IllegalArgumentException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "java.lang.IllegalArgumentException", classname);

  } finally {
    rm.stop();
  }
}
项目:hadoop    文件:TestNMWebServicesApps.java   
@Test
public void testNodeAppsUserEmpty() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  addAppContainers(app);
  Application app2 = new MockApp("foo", 1234, 2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);

  try {
    r.path("ws").path("v1").path("node").path("apps").queryParam("user", "")
        .accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
    fail("should have thrown exception on invalid user query");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();

    assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils
        .checkStringMatch(
            "exception message",
            "java.lang.Exception: Error: You must specify a non-empty string for the user",
            message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "BadRequestException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "org.apache.hadoop.yarn.webapp.BadRequestException", classname);
  }
}
项目:hadoop    文件:TestAMWebServicesTasks.java   
@Test
public void testTasksQueryInvalid() throws JSONException, Exception {
  WebResource r = resource();
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);
    // tasktype must be exactly either "m" or "r"
    String tasktype = "reduce";

    try {
      r.path("ws").path("v1").path("mapreduce").path("jobs").path(jobId)
          .path("tasks").queryParam("type", tasktype)
          .accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
      fail("should have thrown exception on invalid uri");
    } catch (UniformInterfaceException ue) {
      ClientResponse response = ue.getResponse();
      assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
      assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
      JSONObject msg = response.getEntity(JSONObject.class);
      JSONObject exception = msg.getJSONObject("RemoteException");
      assertEquals("incorrect number of elements", 3, exception.length());
      String message = exception.getString("message");
      String type = exception.getString("exception");
      String classname = exception.getString("javaClassName");
      WebServicesTestUtils.checkStringMatch("exception message",
          "java.lang.Exception: tasktype must be either m or r", message);
      WebServicesTestUtils.checkStringMatch("exception type",
          "BadRequestException", type);
      WebServicesTestUtils.checkStringMatch("exception classname",
          "org.apache.hadoop.yarn.webapp.BadRequestException", classname);
    }
  }
}
项目:hadoop    文件:TestNMWebServices.java   
@Test
public void testInvalidUri() throws JSONException, Exception {
  WebResource r = resource();
  String responseStr = "";
  try {
    responseStr = r.path("ws").path("v1").path("node").path("bogus")
        .accept(MediaType.APPLICATION_JSON).get(String.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    WebServicesTestUtils.checkStringMatch(
        "error string exists and shouldn't", "", responseStr);
  }
}
项目:hadoop    文件:TestNMWebServicesContainers.java   
@Test
public void testSingleContainerWrong() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  addAppContainers(app);
  Application app2 = new MockApp(2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);
  try {
    r.path("ws").path("v1").path("node").path("containers")
        .path("container_1234_0001_01_000005")
        .accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
    fail("should have thrown exception on invalid user query");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils
        .checkStringMatch(
            "exception message",
            "java.lang.Exception: container with id, container_1234_0001_01_000005, not found",
            message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "NotFoundException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "org.apache.hadoop.yarn.webapp.NotFoundException", classname);
  }
}
项目:hadoop    文件:TestRMWebServicesApps.java   
@Test
public void testAppsQueryStateInvalid() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  try {
    r.path("ws").path("v1").path("cluster").path("apps")
        .queryParam("state", "INVALID_test")
        .accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
    fail("should have thrown exception on invalid state query");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils.checkStringContains(
        "exception message",
        "Invalid application-state INVALID_test",
        message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "BadRequestException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "org.apache.hadoop.yarn.webapp.BadRequestException", classname);

  } finally {
    rm.stop();
  }
}
项目:hadoop    文件:TestNMWebServicesApps.java   
@Test
public void testNodeAppsStateInvalid() throws JSONException, Exception {
  WebResource r = resource();
  Application app = new MockApp(1);
  nmContext.getApplications().put(app.getAppId(), app);
  addAppContainers(app);
  Application app2 = new MockApp("foo", 1234, 2);
  nmContext.getApplications().put(app2.getAppId(), app2);
  addAppContainers(app2);

  try {
    r.path("ws").path("v1").path("node").path("apps")
        .queryParam("state", "FOO_STATE").accept(MediaType.APPLICATION_JSON)
        .get(JSONObject.class);
    fail("should have thrown exception on invalid user query");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();

    assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    verifyStateInvalidException(message, type, classname);
  }
}
项目:hadoop    文件:TestHsWebServices.java   
@Test
public void testInvalidUri() throws JSONException, Exception {
  WebResource r = resource();
  String responseStr = "";
  try {
    responseStr = r.path("ws").path("v1").path("history").path("bogus")
        .accept(MediaType.APPLICATION_JSON).get(String.class);
    fail("should have thrown exception on invalid uri");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    WebServicesTestUtils.checkStringMatch(
        "error string exists and shouldn't", "", responseStr);
  }
}
项目:hadoop    文件:TestHsWebServicesTasks.java   
@Test
public void testTasksQueryInvalid() throws JSONException, Exception {
  WebResource r = resource();
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);
    // tasktype must be exactly either "m" or "r"
    String tasktype = "reduce";

    try {
      r.path("ws").path("v1").path("history").path("mapreduce").path("jobs")
          .path(jobId).path("tasks").queryParam("type", tasktype)
          .accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
      fail("should have thrown exception on invalid uri");
    } catch (UniformInterfaceException ue) {
      ClientResponse response = ue.getResponse();
      assertEquals(Status.BAD_REQUEST, response.getClientResponseStatus());
      assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
      JSONObject msg = response.getEntity(JSONObject.class);
      JSONObject exception = msg.getJSONObject("RemoteException");
      assertEquals("incorrect number of elements", 3, exception.length());
      String message = exception.getString("message");
      String type = exception.getString("exception");
      String classname = exception.getString("javaClassName");
      WebServicesTestUtils.checkStringMatch("exception message",
          "java.lang.Exception: tasktype must be either m or r", message);
      WebServicesTestUtils.checkStringMatch("exception type",
          "BadRequestException", type);
      WebServicesTestUtils.checkStringMatch("exception classname",
          "org.apache.hadoop.yarn.webapp.BadRequestException", classname);
    }
  }
}
项目:hadoop    文件:TestAMWebServicesTasks.java   
@Test
public void testTaskIdBogus() throws JSONException, Exception {
  WebResource r = resource();
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);
    String tid = "bogustaskid";
    try {
      r.path("ws").path("v1").path("mapreduce").path("jobs").path(jobId)
          .path("tasks").path(tid).get(JSONObject.class);
      fail("should have thrown exception on invalid uri");
    } catch (UniformInterfaceException ue) {
      ClientResponse response = ue.getResponse();
      assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
      assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
      JSONObject msg = response.getEntity(JSONObject.class);
      JSONObject exception = msg.getJSONObject("RemoteException");
      assertEquals("incorrect number of elements", 3, exception.length());
      String message = exception.getString("message");
      String type = exception.getString("exception");
      String classname = exception.getString("javaClassName");
      WebServicesTestUtils.checkStringMatch("exception message",
          "java.lang.Exception: TaskId string : "
              + "bogustaskid is not properly formed", message);
      WebServicesTestUtils.checkStringMatch("exception type",
          "NotFoundException", type);
      WebServicesTestUtils.checkStringMatch("exception classname",
          "org.apache.hadoop.yarn.webapp.NotFoundException", classname);
    }
  }
}
项目:hadoop    文件:TestRMWebServicesApps.java   
@Test
public void testNonexistApp() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB, "testwordcount", "user1");
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  try {
    r.path("ws").path("v1").path("cluster").path("apps")
        .path("application_00000_0099").accept(MediaType.APPLICATION_JSON)
        .get(JSONObject.class);
    fail("should have thrown exception on invalid appid");
  } catch (UniformInterfaceException ue) {
    ClientResponse response = ue.getResponse();

    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());

    JSONObject msg = response.getEntity(JSONObject.class);
    JSONObject exception = msg.getJSONObject("RemoteException");
    assertEquals("incorrect number of elements", 3, exception.length());
    String message = exception.getString("message");
    String type = exception.getString("exception");
    String classname = exception.getString("javaClassName");
    WebServicesTestUtils.checkStringMatch("exception message",
        "java.lang.Exception: app with id: application_00000_0099 not found",
        message);
    WebServicesTestUtils.checkStringMatch("exception type",
        "NotFoundException", type);
    WebServicesTestUtils.checkStringMatch("exception classname",
        "org.apache.hadoop.yarn.webapp.NotFoundException", classname);
  } finally {
    rm.stop();
  }
}
项目:hadoop    文件:TestAMWebServicesTasks.java   
@Test
public void testTaskIdNonExist() throws JSONException, Exception {
  WebResource r = resource();
  Map<JobId, Job> jobsMap = appContext.getAllJobs();
  for (JobId id : jobsMap.keySet()) {
    String jobId = MRApps.toString(id);
    String tid = "task_0_0000_m_000000";
    try {
      r.path("ws").path("v1").path("mapreduce").path("jobs").path(jobId)
          .path("tasks").path(tid).get(JSONObject.class);
      fail("should have thrown exception on invalid uri");
    } catch (UniformInterfaceException ue) {
      ClientResponse response = ue.getResponse();
      assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
      assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
      JSONObject msg = response.getEntity(JSONObject.class);
      JSONObject exception = msg.getJSONObject("RemoteException");
      assertEquals("incorrect number of elements", 3, exception.length());
      String message = exception.getString("message");
      String type = exception.getString("exception");
      String classname = exception.getString("javaClassName");
      WebServicesTestUtils.checkStringMatch("exception message",
          "java.lang.Exception: task not found with id task_0_0000_m_000000",
          message);
      WebServicesTestUtils.checkStringMatch("exception type",
          "NotFoundException", type);
      WebServicesTestUtils.checkStringMatch("exception classname",
          "org.apache.hadoop.yarn.webapp.NotFoundException", classname);
    }
  }
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public void remove(String id) throws UniformInterfaceException {
    webResource.path(java.text.MessageFormat.format("{0}", new Object[]{id})).delete();
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findRecentRegionProductType_JSON(Class<T> responseType, String region, Integer productTypeId) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("/recent/region/producttype/{0}/{1}", new Object[]{region, productTypeId.toString()}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findAll_XML(Class<T> responseType) throws UniformInterfaceException {
    WebResource resource = webResource;
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
}
项目:marathonv5    文件:RegionClient.java   
public void edit_JSON(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).put(requestEntity);
}
项目:marathonv5    文件:RegionClient.java   
public String countREST() throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path("count");
    return resource.accept(javax.ws.rs.core.MediaType.TEXT_PLAIN).get(String.class);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public void edit_JSON(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).put(requestEntity);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public void create_XML(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_XML).post(requestEntity);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public void create_JSON(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).post(requestEntity);
}
项目:marathonv5    文件:ProductTypeClient.java   
public void remove(String id) throws UniformInterfaceException {
    webResource.path(java.text.MessageFormat.format("{0}", new Object[]{id})).delete();
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findRange_JSON(Class<T> responseType, String from, String to) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("{0}/{1}", new Object[]{from, to}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType);
}
项目:marathonv5    文件:FullProductListingClient.java   
public <T> T findRange_XML(Class<T> responseType, String from, String to) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("{0}/{1}", new Object[]{from, to}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findFrom_XML(Class<T> responseType, Integer from) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("/date/{0}", new Object[]{from.toString()}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findFrom_JSON(Class<T> responseType, Integer from) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("/date/{0}", new Object[]{from.toString()}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findRecent_XML(Class<T> responseType) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path("recent");
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
}
项目:marathonv5    文件:RegionClient.java   
public <T> T findAmerican_XML(Class<T> responseType) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("/international/{0}", new Object[]{"0"}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
}
项目:marathonv5    文件:RegionClient.java   
public void create_JSON(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).post(requestEntity);
}
项目:marathonv5    文件:FullProductListingClient.java   
public <T> T find_JSON(Class<T> responseType, String id) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("{0}", new Object[]{id}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType);
}
项目:marathonv5    文件:ProductTypeClient.java   
public void edit_JSON(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_JSON).put(requestEntity);
}
项目:marathonv5    文件:ProductTypeClient.java   
public void create_XML(Object requestEntity) throws UniformInterfaceException {
    webResource.type(javax.ws.rs.core.MediaType.APPLICATION_XML).post(requestEntity);
}
项目:marathonv5    文件:LiveSalesViewClient.java   
public <T> T findRecentRegionProductType_JSON(Class<T> responseType, String region, Integer productTypeId) throws UniformInterfaceException {
    WebResource resource = webResource;
    resource = resource.path(java.text.MessageFormat.format("/recent/region/producttype/{0}/{1}", new Object[]{region, productTypeId.toString()}));
    return resource.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType);
}