示例#1
0
  @Test(timeout = 50000)
  public void saveLatitudeLongitudePassedAsStringType() throws CloudException {
    initialize();
    CloudObject obj = new CloudObject("Custom5");
    CloudGeoPoint loc = new CloudGeoPoint("17.7", " 78.9");

    obj.set("location", loc);
    obj.save(
        new CloudObjectCallback() {

          @Override
          public void done(CloudObject x, CloudException e) throws CloudException {
            if (e != null) {
              Assert.fail(e.getMessage());
            }
          }
        });
  }
示例#2
0
  @Test(timeout = 50000)
  public void updateGeoPoint() throws CloudException {
    initialize();
    CloudObject obj = new CloudObject("Custom5");
    CloudGeoPoint loc = new CloudGeoPoint(17.9, 79.6);
    obj.set("location", loc);
    obj.save(
        new CloudObjectCallback() {
          @Override
          public void done(CloudObject x, CloudException e) throws CloudException {
            if (e != null) {
              Assert.fail(e.getMessage());
            }
            CloudGeoPoint newObj = null;

            try {
              newObj = CloudGeoPoint.toGeoPoint(x.get("location"));
            } catch (JSONException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }

            newObj.setLatitute(55.0);
            x.set("location", newObj);
            x.save(
                new CloudObjectCallback() {

                  @Override
                  public void done(CloudObject object, CloudException e) throws CloudException {
                    if (e != null) {
                      Assert.fail(e.getMessage());
                    }
                  }
                });
          }
        });
  }