Java Code Examples for org.apache.olingo.client.api.domain.ClientEntity#addLink()

The following examples show how to use org.apache.olingo.client.api.domain.ClientEntity#addLink() . 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: BasicITCase.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void createEntityWithIEEE754CompatibleParameter() {
  assumeTrue("There is no IEEE754Compatible content-type parameter in XML.", isJson());

  final URI uri = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
  final URI linkURI = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_PRIM)
      .appendKeySegment(32767).build();

  final ClientEntity newEntity = getFactory().newEntity(ET_ALL_PRIM);
  newEntity.getProperties().add(getFactory().newPrimitiveProperty(PROPERTY_INT64,
      getFactory().newPrimitiveValueBuilder().buildInt64(Long.MAX_VALUE)));
  newEntity.getProperties().add(getFactory().newPrimitiveProperty(PROPERTY_DECIMAL,
      getFactory().newPrimitiveValueBuilder().buildDecimal(BigDecimal.valueOf(34))));
  newEntity.addLink(getFactory().newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE, linkURI));

  final ODataEntityCreateRequest<ClientEntity> request = getEdmEnabledClient().getCUDRequestFactory()
      .getEntityCreateRequest(uri, newEntity);
  request.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
  request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
  final ODataEntityCreateResponse<ClientEntity> response = request.execute();

  assertEquals(Long.MAX_VALUE, response.getBody().getProperty(PROPERTY_INT64).getPrimitiveValue().toValue());
  assertEquals(BigDecimal.valueOf(34), response.getBody().getProperty(PROPERTY_DECIMAL)
      .getPrimitiveValue().toValue());
}
 
Example 2
Source File: BasicITCase.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void createEntityWithIEEE754CompatibleParameterNull() {
  assumeTrue("There is no IEEE754Compatible content-type parameter in XML.", isJson());

  final URI uri = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
  final URI linkURI = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_TWO_PRIM)
      .appendKeySegment(32767).build();

  final ClientEntity newEntity = getFactory().newEntity(ET_ALL_PRIM);
  newEntity.getProperties().add(getFactory().newPrimitiveProperty(PROPERTY_INT64,
      getFactory().newPrimitiveValueBuilder().buildInt64(null)));
  newEntity.getProperties().add(getFactory().newPrimitiveProperty(PROPERTY_DECIMAL,
      getFactory().newPrimitiveValueBuilder().buildDecimal(null)));
  newEntity.addLink(getFactory().newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE, linkURI));

  final ODataEntityCreateRequest<ClientEntity> request = getEdmEnabledClient().getCUDRequestFactory()
      .getEntityCreateRequest(uri, newEntity);
  request.setContentType(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
  request.setAccept(CONTENT_TYPE_JSON_IEEE754_COMPATIBLE);
  final ODataEntityCreateResponse<ClientEntity> response = request.execute();

  assertTrue(response.getBody().getProperty(PROPERTY_INT64).hasNullValue());
  assertTrue(response.getBody().getProperty(PROPERTY_DECIMAL).hasNullValue());
}
 
Example 3
Source File: FilterSystemQueryITCase.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
@Test
public void numericBinaryOperationWithNullValues() {
  // Create new Entries
  final String filterString = "PropertyString eq null";

  ClientEntity entity = getFactory().newEntity(new FullQualifiedName(SERVICE_NAMESPACE, "ETAllPrim"));

  entity.getProperties().add(
      getFactory().newPrimitiveProperty("PropertyInt16", getFactory().newPrimitiveValueBuilder()
          .buildInt16((short) 1)));
  entity.addLink(getFactory().newEntityNavigationLink("NavPropertyETTwoPrimOne",
      getClient().newURIBuilder(SERVICE_URI)
      .appendEntitySetSegment("ESTwoPrim")
      .appendKeySegment(32766)
      .build()));

  final URI uri = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build();
  ODataEntityCreateResponse<ClientEntity> createResponse =
      getClient().getCUDRequestFactory().getEntityCreateRequest(uri, entity).execute();

  ODataRetrieveResponse<ClientEntitySet> filterResponse = sendRequest(ES_ALL_PRIM, filterString,
      createResponse.getHeader(HttpHeader.SET_COOKIE).iterator().next());
  assertEquals(1, filterResponse.getBody().getEntities().size());
}
 
Example 4
Source File: ConformanceTestITCase.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
/**
 * 6. MUST support instances returning properties and navigation properties not specified in metadata (section 11.2).
 */
@Test
public void item6() {
  final Integer id = 2000;

  ClientEntity rowIndex = getClient().getObjectFactory().newEntity(
      new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex"));
  getClient().getBinder().add(rowIndex,
      getClient().getObjectFactory().newPrimitiveProperty("Id",
          getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id)));

  // add property not in metadata
  getClient().getBinder().add(rowIndex,
      getClient().getObjectFactory().newPrimitiveProperty("aString",
          getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string")));

  // add navigation property not in metadata
  rowIndex.addLink(client.getObjectFactory().newEntityNavigationLink(
      "Row", URI.create(testOpenTypeServiceRootURL + "/Row(71f7d0dc-ede4-45eb-b421-555a2aa1e58f)")));

  final ODataEntityCreateRequest<ClientEntity> createReq = getClient().getCUDRequestFactory().
      getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL).
          appendEntitySetSegment("RowIndex").build(), rowIndex);

  final ODataEntityCreateResponse<ClientEntity> createRes = createReq.execute();
  assertEquals(201, createRes.getStatusCode());

  final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL).
      appendEntitySetSegment("RowIndex").appendKeySegment(id);

  rowIndex = read(ContentType.JSON_FULL_METADATA, builder.build());
  assertNotNull(rowIndex);
  assertEquals(EdmPrimitiveTypeKind.Int32, rowIndex.getProperty("Id").getPrimitiveValue().getTypeKind());
  assertEquals(EdmPrimitiveTypeKind.String, rowIndex.getProperty("aString").getPrimitiveValue().getTypeKind());
  assertNotNull(rowIndex.getNavigationLink("Row"));

  final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().
      getDeleteRequest(rowIndex.getEditLink()).execute();
  assertEquals(204, deleteRes.getStatusCode());
}
 
Example 5
Source File: ConformanceITCase.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
/**
 * 2. MUST specify OData-Version (section 8.1.5) and Content-Type (section 8.1.1) in any request with a payload.
 */
@Test
public void checkClientWithPayloadHeader() {
  assumeTrue("json conformance test with content type", isJson());

  ClientEntity newEntity = getFactory().newEntity(ET_ALL_PRIM);
  newEntity.getProperties().add(getFactory().newPrimitiveProperty(PROPERTY_INT64,
      getFactory().newPrimitiveValueBuilder().buildInt64((long) 42)));
  final ODataClient client = getClient();
  newEntity.addLink(getFactory().newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE,
      client.newURIBuilder(SERVICE_URI)
          .appendEntitySetSegment(ES_TWO_PRIM)
          .appendKeySegment(32766)
          .build()));

  final ODataEntityCreateRequest<ClientEntity> createRequest = client.getCUDRequestFactory().getEntityCreateRequest(
      client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build(),
      newEntity);
  assertNotNull(createRequest);
  createRequest.setFormat(contentType);
  // check for OData-Version
  assertEquals(ODATA_MAX_VERSION_NUMBER, createRequest.getHeader(HttpHeader.ODATA_VERSION));

  // check for Content-Type
  assertEquals(
      ContentType.APPLICATION_JSON.toContentTypeString(),
      createRequest.getHeader(HttpHeader.CONTENT_TYPE));
  assertEquals(
      ContentType.APPLICATION_JSON.toContentTypeString(),
      createRequest.getContentType());

  final ODataEntityCreateResponse<ClientEntity> createResponse = createRequest.execute();

  assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode());
}
 
Example 6
Source File: BasicITCase.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
@Test
public void createEntity() throws Exception {
  ClientEntity newEntity = getFactory().newEntity(ET_ALL_PRIM);
  newEntity.getProperties().add(getFactory().newPrimitiveProperty(PROPERTY_INT64,
      getFactory().newPrimitiveValueBuilder().buildInt64((long) 42)));
  final ODataClient client = getClient();
  newEntity.addLink(getFactory().newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE,
      client.newURIBuilder(SERVICE_URI)
          .appendEntitySetSegment(ES_TWO_PRIM)
          .appendKeySegment(32766)
          .build()));

  final ODataEntityCreateRequest<ClientEntity> createRequest = client.getCUDRequestFactory().getEntityCreateRequest(
      client.newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_ALL_PRIM).build(),
      newEntity);
  assertNotNull(createRequest);
  final ODataEntityCreateResponse<ClientEntity> createResponse = createRequest.execute();
  assertNotNull(createRequest.getHttpRequest());
  assertNotNull(((AbstractODataBasicRequest)createRequest).getPayload());
  assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode());
  assertEquals(SERVICE_URI + ES_ALL_PRIM + "(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next());
  final ClientEntity createdEntity = createResponse.getBody();
  assertNotNull(createdEntity);
  final ClientProperty property1 = createdEntity.getProperty(PROPERTY_INT64);
  assertNotNull(property1);
  assertShortOrInt(42, property1.getPrimitiveValue().toValue());
  final ClientProperty property2 = createdEntity.getProperty(PROPERTY_DECIMAL);
  assertNotNull(property2);
  assertNull(property2.getPrimitiveValue().toValue());
}
 
Example 7
Source File: BindingITCase.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Test
public void deepInsertWithBindingSameNavigationProperty() {
  final ClientObjectFactory factory = getFactory();
  final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
  entity.getProperties().add(factory.newPrimitiveProperty(PROPERTY_STRING, factory
          .newPrimitiveValueBuilder()
          .buildString("1")));
  entity.getProperties().add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM, factory.newComplexValue
          (CT_TWO_PRIM)
          .add(factory.newPrimitiveProperty(PROPERTY_INT16, factory.newPrimitiveValueBuilder().buildInt16
                  ((short) 1)))
          .add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder().buildString("1")))));

  final ClientEntity innerEntity = factory.newEntity(ET_KEY_NAV);
  innerEntity.getProperties().add(factory.newPrimitiveProperty(PROPERTY_STRING, factory.newPrimitiveValueBuilder()
          .buildString("2")));
  innerEntity.getProperties().add(factory.newComplexProperty(PROPERTY_COMP_TWO_PRIM,
          factory.newComplexValue(CT_TWO_PRIM)
                  .add(factory.newPrimitiveProperty(PROPERTY_INT16,
                          factory.newPrimitiveValueBuilder().buildInt16((short) 1)))
                  .add(factory.newPrimitiveProperty(PROPERTY_STRING,
                          factory.newPrimitiveValueBuilder().buildString("2")))));
  innerEntity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
          getClient().newURIBuilder(SERVICE_URI)
                  .appendEntitySetSegment(ES_TWO_KEY_NAV)
                  .appendKeySegment(new LinkedHashMap<String, Object>() {
                    private static final long serialVersionUID = 1L;

                    {
                      put(PROPERTY_INT16, 3);
                      put(PROPERTY_STRING, "1");
                    }
                  }).build()));

  final ClientInlineEntity inlineLink = factory.newDeepInsertEntity(NAV_PROPERTY_ET_KEY_NAV_ONE, innerEntity);
  entity.addLink(inlineLink);

  entity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE,
          getClient().newURIBuilder(SERVICE_URI)
                  .appendEntitySetSegment(ES_TWO_KEY_NAV)
                  .appendKeySegment(new LinkedHashMap<String, Object>() {
                    private static final long serialVersionUID = 3109256773218160485L;

                    {
                      put(PROPERTY_INT16, 3);
                      put(PROPERTY_STRING, "1");
                    }
                  }).build()));

  final URI bindingURI = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV)
      .appendKeySegment(3)
      .build();

  entity.addLink(factory.newEntityNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE, bindingURI));

  final URI targetURI = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment(ES_KEY_NAV).build();
  final ODataEntityCreateResponse<ClientEntity> response =
      getEdmEnabledClient().getCUDRequestFactory().getEntityCreateRequest(targetURI, entity).execute();

  assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());

  if (isJson()) {
    assertEquals(1, response.getBody().getNavigationLink(NAV_PROPERTY_ET_KEY_NAV_ONE)
        .asInlineEntity()
        .getEntity()
        .getProperty(PROPERTY_COMP_TWO_PRIM)
        .getComplexValue()
        .get(PROPERTY_INT16)
        .getPrimitiveValue()
        .toValue());
  }
}
 
Example 8
Source File: BasicITCase.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Test
public void updateMerge() {
  final URI targetURI = getClient().newURIBuilder(SERVICE_URI)
      .appendEntitySetSegment(ES_KEY_NAV)
      .appendKeySegment(1)
      .build();

  final ClientObjectFactory factory = getFactory();
  final ClientEntity entity = factory.newEntity(ET_KEY_NAV);
  entity.addLink(factory.newEntityNavigationLink("NavPropertyETKeyNavOne", targetURI));
  entity.addLink(factory.newEntitySetNavigationLink("NavPropertyETKeyNavMany", getClient().newURIBuilder
      (SERVICE_URI)
      .appendEntitySetSegment(ES_KEY_NAV).appendKeySegment(3).build()));
  entity.getProperties().add(factory.newCollectionProperty("CollPropertyString",
      factory.newCollectionValue("Edm.String").add(
          factory.newPrimitiveValueBuilder().buildString("Single entry!"))));
  entity.getProperties().add(factory.newComplexProperty(PROPERTY_COMP_ALL_PRIM,
      factory.newComplexValue(SERVICE_NAMESPACE+".CTAllPrim")
          .add(factory.newPrimitiveProperty(PROPERTY_STRING,
              factory.newPrimitiveValueBuilder().buildString("Changed")))));

  final ODataEntityUpdateResponse<ClientEntity> response = getEdmEnabledClient().getCUDRequestFactory()
      .getEntityUpdateRequest(targetURI, UpdateType.PATCH, entity)
      .execute();

  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next();

  final ODataEntityRequest<ClientEntity> entityRequest = getEdmEnabledClient().getRetrieveRequestFactory()
      .getEntityRequest(
          getEdmEnabledClient().newURIBuilder()
              .appendEntitySetSegment(ES_KEY_NAV)
              .appendKeySegment(1)
              .expand("NavPropertyETKeyNavOne", "NavPropertyETKeyNavMany")
              .build());
  entityRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
  final ODataRetrieveResponse<ClientEntity> entityResponse = entityRequest.execute();

  assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
  assertShortOrInt(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavOne")
      .asInlineEntity()
      .getEntity()
      .getProperty(PROPERTY_INT16)
      .getPrimitiveValue()
      .toValue());

  assertEquals(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
      .asInlineEntitySet()
      .getEntitySet()
      .getEntities()
      .size());

  assertShortOrInt(1, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
      .asInlineEntitySet()
      .getEntitySet()
      .getEntities()
      .get(0)
      .getProperty(PROPERTY_INT16)
      .getPrimitiveValue()
      .toValue());

  assertShortOrInt(2, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
      .asInlineEntitySet()
      .getEntitySet()
      .getEntities()
      .get(1)
      .getProperty(PROPERTY_INT16)
      .getPrimitiveValue()
      .toValue());

  assertShortOrInt(3, entityResponse.getBody().getNavigationLink("NavPropertyETKeyNavMany")
      .asInlineEntitySet()
      .getEntitySet()
      .getEntities()
      .get(2)
      .getProperty(PROPERTY_INT16)
      .getPrimitiveValue()
      .toValue());

  final Iterator<ClientValue> collectionIterator = entityResponse.getBody()
      .getProperty("CollPropertyString")
      .getCollectionValue()
      .iterator();
  assertTrue(collectionIterator.hasNext());
  assertEquals("Single entry!", collectionIterator.next().asPrimitive().toValue());
  assertFalse(collectionIterator.hasNext());

  final ClientComplexValue complexValue = entityResponse.getBody()
      .getProperty(PROPERTY_COMP_ALL_PRIM)
      .getComplexValue();

  assertEquals("Changed", complexValue.get(PROPERTY_STRING).getPrimitiveValue().toValue());
}
 
Example 9
Source File: FilterSystemQueryITCase.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Test
public void nullComplexProperty() {
  // Create a new entry.The complex property PropertyCompComp is set to null. So the structure of the property
  // is still there, but filled is null values (primitive types)
  // We define a filter, which returns all entry where PropertyCompComp/PropertyComp/PropertyInt16 is equals to 1

  ClientEntity newEntity = getFactory().newEntity(new FullQualifiedName(SERVICE_NAMESPACE, "ETKeyNav"));
  newEntity.getProperties().add(getFactory().newComplexProperty("PropertyCompCompNav", null));
  newEntity.getProperties().add(getFactory().newPrimitiveProperty("PropertyInt16",
      getFactory().newPrimitiveValueBuilder().buildInt16((short) 4)));
  newEntity.getProperties().add(getFactory().newPrimitiveProperty("PropertyString",
      getFactory().newPrimitiveValueBuilder().buildString("Test")));
  newEntity.getProperties().add(
      getFactory().newComplexProperty("PropertyCompAllPrim",
          getFactory().newComplexValue(SERVICE_NAMESPACE+"."+"CTAllPrim")
          .add(getFactory().newPrimitiveProperty(
              "PropertyString",
              getFactory().newPrimitiveValueBuilder().buildString("Test 3")))));

  newEntity.getProperties().add(
      getFactory().newComplexProperty("PropertyCompTwoPrim",
          getFactory().newComplexValue(SERVICE_NAMESPACE+"."+"CTTwoPrim")
          .add(getFactory().newPrimitiveProperty(
              "PropertyInt16",
              getFactory().newPrimitiveValueBuilder().buildInt16((short) 1)))
              .add(getFactory().newPrimitiveProperty(
                  "PropertyString",
                  getFactory().newPrimitiveValueBuilder().buildString("Test2")))));

  newEntity.addLink(getFactory().newEntityNavigationLink("NavPropertyETTwoKeyNavOne",
      getClient().newURIBuilder(SERVICE_URI)
      .appendEntitySetSegment(ES_TWO_KEY_NAV)
      .appendKeySegment(new LinkedHashMap<String, Object>() {
        private static final long serialVersionUID = 1L;

        {
          put("PropertyInt16", 1);
          put("PropertyString", "1");
        }
      })
      .build()));

  final URI uri = getClient().newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESKeyNav").build();
  ODataEntityCreateRequest<ClientEntity> request =
      getClient().getCUDRequestFactory().getEntityCreateRequest(uri, newEntity);
  ODataEntityCreateResponse<ClientEntity> response = request.execute();
  assertEquals(HttpStatusCode.CREATED.getStatusCode(), response.getStatusCode());

  final String cookie = response.getHeader(HttpHeader.SET_COOKIE).iterator().next();

  // Do the filter request
  ODataRetrieveResponse<ClientEntitySet> result =
      sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyCompNav/PropertyInt16 eq 1", cookie);
  assertEquals(3, result.getBody().getEntities().size());

  // Try filter all entries where PropertyCompComp is null
  result = sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyCompNav/PropertyInt16 eq null", cookie);
  assertEquals(1, result.getBody().getEntities().size());
}
 
Example 10
Source File: AsyncSupportITCase.java    From olingo-odata4 with Apache License 2.0 4 votes vote down vote up
@Test
public void createEntity() throws Exception {
  ODataClient client = getClient();
  URI uri = client.newURIBuilder(SERVICE_URI)
      .appendEntitySetSegment(ES_ALL_PRIM).build();

  ClientEntity newEntity = getFactory().newEntity(new FullQualifiedName(SERVICE_NAMESPACE, "ETAllPrim"));
  newEntity.getProperties().add(getFactory().newPrimitiveProperty("PropertyInt64",
          getFactory().newPrimitiveValueBuilder().buildInt32(42)));
  newEntity.addLink(getFactory().newEntityNavigationLink(NAV_PROPERTY_ET_TWO_PRIM_ONE,
          client.newURIBuilder(SERVICE_URI)
                  .appendEntitySetSegment("ESTwoPrim")
                  .appendKeySegment(32766)
                  .build()));

  final ODataEntityCreateRequest<ClientEntity> createRequest =
      client.getCUDRequestFactory().getEntityCreateRequest(uri, newEntity);
  createRequest.setPrefer(PreferenceName.RESPOND_ASYNC + "; " + TEC_ASYNC_SLEEP + "=1");
  assertNotNull(createRequest);
  AsyncResponseWrapper<ODataResponse> asyncResponse =
      client.getAsyncRequestFactory().getAsyncRequestWrapper(createRequest).execute();

  assertTrue(asyncResponse.isPreferenceApplied());
  assertFalse(asyncResponse.isDone());

  waitTillDone(asyncResponse, 10);

  @SuppressWarnings("unchecked")
  final ODataEntityCreateResponse<ClientEntity> createResponse =
      (ODataEntityCreateResponse<ClientEntity>) asyncResponse.getODataResponse();

  assertEquals(HttpStatusCode.CREATED.getStatusCode(), createResponse.getStatusCode());
  assertEquals(SERVICE_URI + "ESAllPrim(1)", createResponse.getHeader(HttpHeader.LOCATION).iterator().next());
  final ClientEntity createdEntity = createResponse.getBody();
  assertNotNull(createdEntity);
  final ClientProperty property1 = createdEntity.getProperty("PropertyInt64");
  assertNotNull(property1);
  assertShortOrInt(42, property1.getPrimitiveValue().toValue());
  final ClientProperty property2 = createdEntity.getProperty("PropertyDecimal");
  assertNotNull(property2);
  assertNull(property2.getPrimitiveValue().toValue());
}