本文整理汇总了Java中org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest类的典型用法代码示例。如果您正苦于以下问题:Java ODataServiceDocumentRequest类的具体用法?Java ODataServiceDocumentRequest怎么用?Java ODataServiceDocumentRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ODataServiceDocumentRequest类属于org.apache.olingo.client.api.communication.request.retrieve包,在下文中一共展示了ODataServiceDocumentRequest类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEdmTest
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; //导入依赖的package包/类
@Test
public void getEdmTest() throws Exception {
final ODataClient client = getODataClient();
final String serviceUrl = getServiceUrl();
final ODataServiceDocumentRequest reqeust =
client.getRetrieveRequestFactory().getServiceDocumentRequest(serviceUrl);
reqeust.setFormat(ContentType.APPLICATION_XML);
final Edm redHelixEdm = readEdm(client, serviceUrl);
Assert.assertEquals(1, redHelixEdm.getSchemas().size());
for (EdmSchema schema : redHelixEdm.getSchemas()) {
Assert.assertEquals(RED_HELIX_NAME_SPACE, schema.getNamespace());
}
}
示例2: readServiceDocument
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; //导入依赖的package包/类
@Test
public void readServiceDocument() {
ODataServiceDocumentRequest request = getClient().getRetrieveRequestFactory()
.getServiceDocumentRequest(SERVICE_URI);
assertNotNull(request);
setCookieHeader(request);
ODataRetrieveResponse<ClientServiceDocument> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
ClientServiceDocument serviceDocument = response.getBody();
assertNotNull(serviceDocument);
assertThat(serviceDocument.getEntitySetNames(), hasItem(ES_ALL_PRIM));
assertThat(serviceDocument.getFunctionImportNames(), hasItem("FICRTCollCTTwoPrim"));
assertThat(serviceDocument.getSingletonNames(), hasItem("SIMedia"));
}
示例3: readServiceDocument
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; //导入依赖的package包/类
@Test
public void readServiceDocument() throws Exception {
ODataServiceDocumentRequest request = getClient().getRetrieveRequestFactory()
.getServiceDocumentRequest(TecSvcConst.BASE_URI);
setCookieHeader(request);
ODataRetrieveResponse<ClientServiceDocument> response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
request = getClient().getRetrieveRequestFactory().getServiceDocumentRequest(TecSvcConst.BASE_URI);
request.setIfNoneMatch(response.getETag());
setCookieHeader(request);
response = request.execute();
saveCookieHeader(response);
assertEquals(HttpStatusCode.NOT_MODIFIED.getStatusCode(), response.getStatusCode());
request = getClient().getRetrieveRequestFactory().getServiceDocumentRequest(TecSvcConst.BASE_URI);
request.setIfMatch("W/\"0\"");
setCookieHeader(request);
executeAndExpectError(request, HttpStatusCode.PRECONDITION_FAILED);
}
示例4: getServiceDocumentRequest
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; //导入依赖的package包/类
@Override
public ODataServiceDocumentRequest getServiceDocumentRequest(final String serviceRoot) {
return new ODataServiceDocumentRequestImpl(client,
serviceRoot != null && !serviceRoot.isEmpty() && serviceRoot.endsWith("/") ?
client.newURIBuilder(serviceRoot).build() :
client.newURIBuilder(serviceRoot + '/').build());
}
示例5: testServiceReq
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest; //导入依赖的package包/类
@Test
public void testServiceReq() {
ODataServiceDocumentRequest serviceReq =
client.getRetrieveRequestFactory().getServiceDocumentRequest(serviceRoot);
ODataRetrieveResponse<ClientServiceDocument> serviceRes = serviceReq.execute();
ClientServiceDocument serviceBody = serviceRes.getBody();
Collection<String> names = serviceBody.getEntitySetNames();
assertFalse(names.isEmpty());
}