I'am having another issue with this unit test (BasicITCase class):
@Test
public void readMetadata() {
EdmMetadataRequest request =
odata.getRetrieveRequestFactory().getMetadataRequest(REF_SERVICE);
assertNotNull(request);
ODataRetrieveResponse<Edm> response = request.execute();
assertEquals(200, response.getStatusCode());
...
}
The response object returns -1 for status code and it seems that the
object is just not correctly created. On the wire all data is fine. Should
I open an issue?
Regards,
Stephan
On 03.07.14 12:57, "Francesco Chicchiriccò" <[email protected]> wrote:
>On 03/07/2014 12:51, Klevenz, Stephan wrote:
>> Hi,
>>
>> I have create an integration test to read the service document and
>>recognized that client sends an default accept header which is
>>"application/json;odata.metadata=full". The server currently supports
>>only minimal and doesn't accept the request.
>>
>>
>>
>> @Test
>>
>> public void readServiceDocument() {
>>
>> ODataServiceDocumentRequest request =
>>
>>
>>odata.getRetrieveRequestFactory().getServiceDocumentRequest(REF_SERVICE);
>>
>> assertNotNull(request);
>>
>> ODataServiceDocument serviceDocument = request.execute().getBody();
>>
>> assertNotNull(serviceDocument);
>>
>> }
>>
>>
>> Is it by purpose to add an accept header if client code doesn't set a
>>header explicitly? If this is the case then I must overwrite the header
>>by this
>>
>>
>> request.setAccept("application/json;odata.metadata=minimal");
>>
>> to get the request accepted.
>
>The client code will generate the header values from its configuration:
>doing
>
>request.setFormat(ODataFormat.JSON)
>
>should do the trick for this single request.
>
>Alternatively you can configure the default format via
>
>odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON)
>
>HTH
>Regards.
>
>--
>Francesco Chicchiriccò
>
>Tirasa - Open Source Excellence
>http://www.tirasa.net/
>
>Involved at The Apache Software Foundation:
>member, Syncope PMC chair, Cocoon PMC, Olingo PMC
>http://people.apache.org/~ilgrosso/
>