- public static final String FAIL_AUTHENTICATION_TRIGGER = "FAIL AUTHENTICATION";
-
- private boolean authenticationShouldSucceed = true;
-
-
- /**
- * Performs all one-time initialization required for the end point.
- */
- @Override
- public void init() {
-
- // Instantiate our Document Store DAO.
- documentStore = new StubEsController();
- }
-
- @Override
- @RequestMapping (value="/indexes/dynamic/{index}",
- method = RequestMethod.PUT,
- consumes = { "application/json"})
- public ResponseEntity<String> processCreateDynamicIndex(@RequestBody String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index) {
-
- return super.processCreateDynamicIndex(requestBody, request, headers, index);
- }
-
-
- @Override
- @RequestMapping (value="/indexes/{index}",
- method = RequestMethod.PUT,
- consumes = { "application/json"})
- public ResponseEntity<String> processCreateIndex(@RequestBody String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index) {
-
- return super.processCreateIndex(requestBody, request, headers, index);
- }
-
- @Override
- @RequestMapping (value="/indexes/{index}",
- method = RequestMethod.DELETE,
- consumes = { "application/json"})
- public ResponseEntity<String> processDeleteIndex(HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index) {
-
- return super.processDeleteIndex(request, headers, index);
- }
-
- @Override
- @RequestMapping (value="/indexes/{index}/documents/{id}",
- method = RequestMethod.GET,
- produces = { "application/json"},
- consumes = { "application/json", "application/xml" })
- public ResponseEntity<String> processGetDocument(
- HttpServletRequest request,
- HttpServletResponse httpResponse,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index,
- @PathVariable("id") String id) {
-
- return super.processGetDocument(request, httpResponse, headers, index, id);
- }
-
- @Override
- @RequestMapping (value="/indexes/{index}/documents",
- method = RequestMethod.POST,
- consumes = { "application/json", "application/xml" })
- public ResponseEntity<String> processCreateDocWithoutId(@RequestBody String requestBody,
- HttpServletRequest request,
- HttpServletResponse httpResponse,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index) {
-
- return super.processCreateDocWithoutId(requestBody, request, httpResponse, headers, index);
- }
-
- @Override
- @RequestMapping (value="/indexes/{index}/documents/{id}",
- method = RequestMethod.PUT,
- consumes = { "application/json", "application/xml" })
- public ResponseEntity<String> processUpsertDoc(@RequestBody String requestBody,
- HttpServletRequest request,
- HttpServletResponse httpResponse,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index,
- @PathVariable("id") String id) {
-
- return super.processUpsertDoc(requestBody, request, httpResponse, headers, index, id);
- }
-
- @Override
- @RequestMapping(value = "/indexes/{index}/documents/{id}",
- method = RequestMethod.DELETE,
- consumes = { "application/json"})
- public ResponseEntity<String> processDeleteDoc(HttpServletRequest request,
- HttpServletResponse httpResponse,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index,
- @PathVariable("id") String id) {
-
- return super.processDeleteDoc(request, httpResponse, headers, index, id);
- }
-
- @Override
- @RequestMapping(value = "/indexes/{index}/query/{queryText}",
- method = RequestMethod.GET,
- consumes = { "application/json"})
- public ResponseEntity<String> processInlineQuery(HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index,
- @PathVariable("queryText") String queryText) {
-
- return super.processInlineQuery(request, headers, index, queryText);
- }
-
- @Override
- @RequestMapping(value = "/indexes/{index}/query",
- method = RequestMethod.GET,
- consumes = { "application/json"})
- public ResponseEntity<String> processQueryWithGet(@RequestBody String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index) {
-
- return super.processQueryWithGet(requestBody, request, headers, index);
- }
-
- @Override
- @RequestMapping(value = "/indexes/{index}/query",
- method = RequestMethod.POST,
- consumes = { "application/json"})
- public ResponseEntity<String> processQuery(@RequestBody String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers,
- @PathVariable("index") String index) {
-
- return super.processQuery(requestBody, request, headers, index);
- }
-
- @Override
- @RequestMapping(value = "/bulk",
- method = RequestMethod.POST,
- consumes = { "application/json", "application/xml" })
- public ResponseEntity<String> processBulkRequest(@RequestBody String requestBody,
- HttpServletRequest request,
- @RequestHeader HttpHeaders headers) {
-
- // If the operations string contains a special keyword, set the
- // harness to fail the authentication validation.
- if (requestBody.contains(FAIL_AUTHENTICATION_TRIGGER)) {
- authenticationShouldSucceed = false;