@SuppressWarnings("unchecked") @Test public void testPopulateWithModel() { PopulateController controller = new PopulateController(); ParkService mockParkService = new MockParkService(); ChimpsToken myToken = new ChimpsToken("mytoken"); mockParkService.saveToken(myToken); ReflectionTestUtils.setField(controller, "parkService", mockParkService); Model model = new BindingAwareModelMap(); Assert.assertEquals(controller.populate(model), "populate"); List<ChimpsToken> tokens = (List<ChimpsToken>) model.asMap().get("population"); Assert.assertNotNull(tokens); Assert.assertTrue(tokens.contains(myToken)); }
@RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; } }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }  }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }  @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody int populate(@PathVariable String token,
            @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData); @RequestMapping(value = "populate") String populate(Model model); @RequestMapping(value = "populateTable") String populateTable(Model model); @Scheduled(fixedRate=1*12*60*60*1000) void populate(); @RequestMapping(value = "repopulate") String repopulate(Model model); }
PopulateController { @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody public int populate(@PathVariable String token, @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData) { int populated = houseController.populate(token, isToOverrideMetaData); parkService.saveToken(new ChimpsToken(token)); return populated; }  @RequestMapping(value = "devices/populateAndStore/{token}") @ResponseBody int populate(@PathVariable String token,
            @RequestParam(required = false, defaultValue = "false", value = "isToOverride") Boolean isToOverrideMetaData); @RequestMapping(value = "populate") String populate(Model model); @RequestMapping(value = "populateTable") String populateTable(Model model); @Scheduled(fixedRate=1*12*60*60*1000) void populate(); @RequestMapping(value = "repopulate") String repopulate(Model model);  }