@Test public void testGetStbsByTag() { MockHouseService houseService = new MockHouseService(); HouseRestController controller = new HouseRestController(); MetaStbBuilder metaStbBuilder = new MetaStbBuilder(); metaStbBuilder.tags(new String[] { "validTag" }); MetaStb stb = metaStbBuilder.stb(); houseService.upsertStb(stb); ReflectionTestUtils.setField(controller, "service", houseService); Map<String, Object>[] stbs = controller.getStbsByTag("validTag", null); Assert.assertNotNull(stbs, "No result found on quering with tag value"); Assert.assertTrue(stbs[0].get(MetaStb.TAGS).toString().contains("validTag"), " Expected tag not found in the MetaStbs returned"); }
@RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody public Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q) { return service.getStbsByTag(tag, q); }
HouseRestController { @RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody public Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q) { return service.getStbsByTag(tag, q); } }
HouseRestController { @RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody public Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q) { return service.getStbsByTag(tag, q); }  }
HouseRestController { @RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody public Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q) { return service.getStbsByTag(tag, q); }  @RequestMapping(value="list*", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] listAll(); @RequestMapping(value="id/{id}", method = {RequestMethod.GET}) @ResponseBody Map<String,Object> getStbsById(@PathVariable String id); @RequestMapping(value="edit/{id}", method = {RequestMethod.GET}) @ResponseBody Map<String,Object> editStb(@PathVariable String id); @RequestMapping(value="id/{id}", method={RequestMethod.DELETE}) @ResponseBody void deleteSingle(@PathVariable String id); @RequestMapping(value="id/{id}", method = {RequestMethod.PUT}) @ResponseBody void add(@PathVariable String id, @RequestBody Map<String,Object> data); @RequestMapping(value="id", method = {RequestMethod.POST}) @ResponseBody Map<String,Object>[] getStbsByIds(@RequestParam String[] id); @RequestMapping(value="update", method = {RequestMethod.POST}) @ResponseBody int update(@RequestParam String[] id, @RequestBody Map<String,Object> data,
            @RequestParam(defaultValue="false") boolean replace); @RequestMapping(value="remotetypes", method = {RequestMethod.GET}, produces = "application/json; charset=utf-8") @ResponseBody List<String> getRemoteTypes(); @SuppressWarnings({"unchecked", "rawtypes" }) @RequestMapping(value="update/tags/{op}", method = {RequestMethod.POST}) @ResponseBody void updateTags(@RequestBody Map<String,Object> payload, @PathVariable("op") String op); @RequestMapping(value="query", method = {RequestMethod.GET,RequestMethod.POST}) @ResponseBody Map<String,Object>[] getStbsByQuery(@RequestParam String q); @RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q); @RequestMapping(value="delete", method = {RequestMethod.GET,RequestMethod.POST}) @ResponseBody void deleteStb(@RequestParam String[] id); @RequestMapping(value="populate/{token}", method=RequestMethod.POST) @ResponseBody int populate(@PathVariable String token,
            @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData); }
HouseRestController { @RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody public Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q) { return service.getStbsByTag(tag, q); }  @RequestMapping(value="list*", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] listAll(); @RequestMapping(value="id/{id}", method = {RequestMethod.GET}) @ResponseBody Map<String,Object> getStbsById(@PathVariable String id); @RequestMapping(value="edit/{id}", method = {RequestMethod.GET}) @ResponseBody Map<String,Object> editStb(@PathVariable String id); @RequestMapping(value="id/{id}", method={RequestMethod.DELETE}) @ResponseBody void deleteSingle(@PathVariable String id); @RequestMapping(value="id/{id}", method = {RequestMethod.PUT}) @ResponseBody void add(@PathVariable String id, @RequestBody Map<String,Object> data); @RequestMapping(value="id", method = {RequestMethod.POST}) @ResponseBody Map<String,Object>[] getStbsByIds(@RequestParam String[] id); @RequestMapping(value="update", method = {RequestMethod.POST}) @ResponseBody int update(@RequestParam String[] id, @RequestBody Map<String,Object> data,
            @RequestParam(defaultValue="false") boolean replace); @RequestMapping(value="remotetypes", method = {RequestMethod.GET}, produces = "application/json; charset=utf-8") @ResponseBody List<String> getRemoteTypes(); @SuppressWarnings({"unchecked", "rawtypes" }) @RequestMapping(value="update/tags/{op}", method = {RequestMethod.POST}) @ResponseBody void updateTags(@RequestBody Map<String,Object> payload, @PathVariable("op") String op); @RequestMapping(value="query", method = {RequestMethod.GET,RequestMethod.POST}) @ResponseBody Map<String,Object>[] getStbsByQuery(@RequestParam String q); @RequestMapping(value = "tag/{tag}", method = { RequestMethod.GET, RequestMethod.POST }) @ResponseBody Map<String, Object>[] getStbsByTag(@PathVariable String tag, @RequestParam(required = false) String q); @RequestMapping(value="delete", method = {RequestMethod.GET,RequestMethod.POST}) @ResponseBody void deleteStb(@RequestParam String[] id); @RequestMapping(value="populate/{token}", method=RequestMethod.POST) @ResponseBody int populate(@PathVariable String token,
            @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData); static final String[] ignoreProps; }