private void updateGeog(final ODataPubFormat format, final String contentType,
            final String prefer, final ODataEntity entityAfterCreate, final UpdateType type,
            final String tag) {
        final ODataEntityUpdateRequest req = ODataCUDRequestFactory.getEntityUpdateRequest(type, entityAfterCreate);
        if (Configuration.isUseXHTTPMethod()) {
            assertEquals(HttpMethod.POST, req.getMethod());
        } else {
            assertEquals(type.getMethod(), req.getMethod());
        }
        req.setFormat(format);
        req.setContentType(contentType);
        req.setPrefer(prefer);
        if (StringUtils.isNotEmpty(tag)) {
            req.setIfMatch(tag);
        }
        final ODataEntityUpdateResponse res = req.execute();

        if (prefer.equals("return-content")) {
            assertEquals(200, res.getStatusCode());
            ODataEntity entityAfterUpdate = res.getBody();
            assertNotNull(entityAfterUpdate);
        } else {
            assertEquals(204, res.getStatusCode());
        }
    }
예제 #2
0
  private void batchUpdate(
      final EntityTypeInvocationHandler handler,
      final ODataEntity changes,
      final ODataChangeset changeset) {

    LOG.debug("Update '{}'", changes.getEditLink());

    final ODataEntityUpdateRequest req =
        ODataCUDRequestFactory.getEntityUpdateRequest(UpdateType.PATCH, changes);
    req.setPrefer(ODataHeaderValues.preferReturnContent);

    if (StringUtils.isNotBlank(handler.getETag())) {
      req.setIfMatch(handler.getETag());
    }

    changeset.addRequest(req);
  }