Resource extends LazyLoad { @Override public void reload() throws OdpsException { String resource = ResourceBuilder.buildResourceResource(project, model.name); HashMap<String, String> params = new HashMap<String, String>(); params.put("meta", null); Response rp = client.request(resource, "GET", params, null, null); Map<String, String> headers = rp.getHeaders(); model.owner = headers.get(Headers.ODPS_OWNER); model.type = headers.get(Headers.ODPS_RESOURCE_TYPE); model.comment = headers.get(Headers.ODPS_COMMENT); model.lastUpdator = headers.get(Headers.ODPS_RESOURCE_LAST_UPDATOR); String sizeStr = headers.get(Headers.ODPS_RESOURCE_SIZE); try { model.size = (sizeStr == null ? null : Long.parseLong(sizeStr)); } catch (NumberFormatException e) { throw new OdpsException("Invalid resource size format" + sizeStr, e); } try { model.createdTime = DateUtils.parseRfc822Date(headers .get(Headers.ODPS_CREATION_TIME)); model.lastModifiedTime = DateUtils.parseRfc822Date(headers .get(Headers.LAST_MODIFIED)); } catch (Exception e) { throw new OdpsException("Invalid date format", e); } model.sourceTableName = headers.get(Headers.ODPS_COPY_TABLE_SOURCE); model.volumePath = headers.get(Headers.ODPS_COPY_FILE_SOURCE); model.contentMD5 = headers.get(Headers.CONTENT_MD5); setLoaded(true); } Resource();   Resource(ResourceModel model, String project, Odps odps); String getName(); void setName(String name); String getComment(); void setComment(String comment); String getOwner(); Type getType(); Date getCreatedTime(); Date getLastModifiedTime(); String getLastUpdator(); Long getSize(); String getProject(); @Override void reload(); void updateOwner(String newOwner);  }
@Test public void testResourceMetaErrorMessage() throws OdpsException { String resName = "NotExists"; try { odps.resources().get(resName).reload(); } catch (OdpsException e) { assertTrue(e.getMessage().contains("ODPS-")); } }