String expectedStatus,
ProtocolVersion protocolVersion,
String errorResponseHeaderName,
String idHeaderName) throws Exception
{
RestResponse response;
// #1 simple record template
response = invokeResponseHandler("/test", buildStatusRecord(), ResourceMethod.GET, acceptTypeData.acceptHeaders, protocolVersion);
checkResponse(response, 200, 2, acceptTypeData.responseContentType, Status.class.getName(), null, true, errorResponseHeaderName);
assertEquals(response.getEntity().asAvroString(), expectedStatus);
// #2 create (with id)
response = invokeResponseHandler("/test", new CreateResponse(1), ResourceMethod.CREATE, acceptTypeData.acceptHeaders, protocolVersion);
checkResponse(response, 201, 3, null, null, null, false, errorResponseHeaderName);
assertEquals(response.getHeader(RestConstants.HEADER_LOCATION), "/test/1");
assertEquals(response.getHeader(idHeaderName), "1");
// #2.1 create (without id)
response = invokeResponseHandler("/test", new CreateResponse(HttpStatus.S_201_CREATED),
ResourceMethod.CREATE, acceptTypeData.acceptHeaders,
protocolVersion);
checkResponse(response, 201, 1, null, null, null, false, errorResponseHeaderName);
// #2.2 create (with id and slash at the end of uri)
response = invokeResponseHandler("/test/", new CreateResponse(1), ResourceMethod.CREATE, acceptTypeData.acceptHeaders, protocolVersion);
checkResponse(response, 201, 3, null, null, null, false, errorResponseHeaderName);
assertEquals(response.getHeader(RestConstants.HEADER_LOCATION), "/test/1");
assertEquals(response.getHeader(idHeaderName), "1");
// #2.3 create (without id and slash at the end of uri)
response = invokeResponseHandler("/test/", new CreateResponse(HttpStatus.S_201_CREATED),
ResourceMethod.CREATE, acceptTypeData.acceptHeaders,
protocolVersion);