SearchIndexRestController extends HerdBaseController { @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX + "/{searchIndexName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_GET) public SearchIndex getSearchIndex(@PathVariable("searchIndexName") String searchIndexName) { return searchIndexService.getSearchIndex(new SearchIndexKey(searchIndexName)); }  @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_POST) SearchIndex createSearchIndex(@RequestBody SearchIndexCreateRequest request); @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX + "/{searchIndexName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_DELETE) SearchIndex deleteSearchIndex(@PathVariable("searchIndexName") String searchIndexName); @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX + "/{searchIndexName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_GET) SearchIndex getSearchIndex(@PathVariable("searchIndexName") String searchIndexName); @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_ALL_GET) SearchIndexKeys getSearchIndexes(); static final String SEARCH_INDEXES_URI_PREFIX; }
@Test public void testGetSearchIndex() { SearchIndexKey searchIndexKey = new SearchIndexKey(SEARCH_INDEX_NAME); SearchIndex searchIndex = new SearchIndex(searchIndexKey, SEARCH_INDEX_TYPE, SEARCH_INDEX_STATUS, SEARCH_INDEX_DEFAULT_ACTIVE_FLAG, NO_SEARCH_INDEX_STATISTICS, USER_ID, CREATED_ON, UPDATED_ON); when(searchIndexService.getSearchIndex(searchIndexKey)).thenReturn(searchIndex); SearchIndex response = searchIndexRestController.getSearchIndex(SEARCH_INDEX_NAME); verify(searchIndexService, times(1)).getSearchIndex(new SearchIndexKey(SEARCH_INDEX_NAME)); assertEquals(searchIndex, response); }