@Test public void testReserve() { ServerUtils serverUtil = new ServerUtils(); DawgPoundMongoService poundService = EasyMock.createMock(DawgPoundMongoService.class); DawgPoundRestController poundController = new DawgPoundRestController(); ReflectionTestUtils.setField(poundController, "serverUtils", serverUtil); ReflectionTestUtils.setField(poundController, "service", poundService); long expirationTime = System.currentTimeMillis() + TestConstants.ONE_DAY_IN_MILLIS; EasyMock.expect(poundService.overrideReserve( TestConstants.DEVICE_ID, TestConstants.PROCESSED_TOKEN, expirationTime)).andReturn(true); EasyMock.replay(poundService); boolean reserveStatus = poundController.reserve(TestConstants.TOKEN, TestConstants.ORIG_DEVICE_ID, String.valueOf(expirationTime)); Assert.assertEquals(reserveStatus, true); EasyMock.verify(poundService); }
@RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody public boolean reserve(@PathVariable String token, @PathVariable String id, @PathVariable String expiration) { token = clean(token); id = clean(id); LOGGER.info("Request to override reservation for a device for token="+token+", id="+id+", expiration="+expiration); return service.overrideReserve(id, token, Long.valueOf(expiration)); }
DawgPoundRestController { @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody public boolean reserve(@PathVariable String token, @PathVariable String id, @PathVariable String expiration) { token = clean(token); id = clean(id); LOGGER.info("Request to override reservation for a device for token="+token+", id="+id+", expiration="+expiration); return service.overrideReserve(id, token, Long.valueOf(expiration)); } }
DawgPoundRestController { @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody public boolean reserve(@PathVariable String token, @PathVariable String id, @PathVariable String expiration) { token = clean(token); id = clean(id); LOGGER.info("Request to override reservation for a device for token="+token+", id="+id+", expiration="+expiration); return service.overrideReserve(id, token, Long.valueOf(expiration)); }  }
DawgPoundRestController { @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody public boolean reserve(@PathVariable String token, @PathVariable String id, @PathVariable String expiration) { token = clean(token); id = clean(id); LOGGER.info("Request to override reservation for a device for token="+token+", id="+id+", expiration="+expiration); return service.overrideReserve(id, token, Long.valueOf(expiration)); }  @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] getReservered(@PathVariable String token); @RequestMapping(value = "unreserve/{id}", method = RequestMethod.POST) @ResponseBody String unreserve(@PathVariable String id); @RequestMapping(value = "reserve/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody String reservePolitely(@PathVariable String token,
            @PathVariable String id, @PathVariable String expiration); @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody boolean reserve(@PathVariable String token, @PathVariable String id,
            @PathVariable String expiration); @RequestMapping(value = "reserved/id/{id}", method = RequestMethod.GET) @ResponseBody Map<String, String> isReservered(@PathVariable String id); @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] listAll(); }
DawgPoundRestController { @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody public boolean reserve(@PathVariable String token, @PathVariable String id, @PathVariable String expiration) { token = clean(token); id = clean(id); LOGGER.info("Request to override reservation for a device for token="+token+", id="+id+", expiration="+expiration); return service.overrideReserve(id, token, Long.valueOf(expiration)); }  @RequestMapping(value = "reserved/token/{token}", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] getReservered(@PathVariable String token); @RequestMapping(value = "unreserve/{id}", method = RequestMethod.POST) @ResponseBody String unreserve(@PathVariable String id); @RequestMapping(value = "reserve/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody String reservePolitely(@PathVariable String token,
            @PathVariable String id, @PathVariable String expiration); @RequestMapping(value = "reserve/override/{token}/{id}/{expiration}", method = RequestMethod.POST) @ResponseBody boolean reserve(@PathVariable String token, @PathVariable String id,
            @PathVariable String expiration); @RequestMapping(value = "reserved/id/{id}", method = RequestMethod.GET) @ResponseBody Map<String, String> isReservered(@PathVariable String id); @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseBody Map<String,Object>[] listAll();  }