@Test void testPostQuery() throws Exception { BeaconAlleleRequest request = BeaconAlleleRequest.create("1", 100L, "A", "T"); BeaconAlleleResponse response = BeaconAlleleResponse.create("beaconA", true, null, request); when(beaconQueryService.query("beaconA", request)).thenReturn(response); mockMvc .perform( post("/beacon/{beaconId}/query", "beaconA") .content(getBeaconAlleleRequestJson()) .contentType(APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(content().string(getBeaconAlleleResponseAsJson())); verify(beaconQueryService, times(1)).query("beaconA", request); }
@ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) public BeaconAlleleResponse query( @RequestParam("referenceName") String referenceName, @RequestParam("start") Long start, @RequestParam("referenceBases") String referenceBases, @RequestParam("alternateBases") String alternateBases, @PathVariable("beaconId") final String beaconId) { return beaconQueryService.query(referenceName, start, referenceBases, alternateBases, beaconId); }
BeaconController { @ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) public BeaconAlleleResponse query( @RequestParam("referenceName") String referenceName, @RequestParam("start") Long start, @RequestParam("referenceBases") String referenceBases, @RequestParam("alternateBases") String alternateBases, @PathVariable("beaconId") final String beaconId) { return beaconQueryService.query(referenceName, start, referenceBases, alternateBases, beaconId); } }
BeaconController { @ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) public BeaconAlleleResponse query( @RequestParam("referenceName") String referenceName, @RequestParam("start") Long start, @RequestParam("referenceBases") String referenceBases, @RequestParam("alternateBases") String alternateBases, @PathVariable("beaconId") final String beaconId) { return beaconQueryService.query(referenceName, start, referenceBases, alternateBases, beaconId); } BeaconController(BeaconInfoService beaconInfoService, BeaconQueryService beaconQueryService); }
BeaconController { @ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) public BeaconAlleleResponse query( @RequestParam("referenceName") String referenceName, @RequestParam("start") Long start, @RequestParam("referenceBases") String referenceBases, @RequestParam("alternateBases") String alternateBases, @PathVariable("beaconId") final String beaconId) { return beaconQueryService.query(referenceName, start, referenceBases, alternateBases, beaconId); } BeaconController(BeaconInfoService beaconInfoService, BeaconQueryService beaconQueryService); @ResponseBody @GetMapping(value = "/list", produces = APPLICATION_JSON_VALUE) @ApiOperation( value = "List all beacons", response = BeaconResponse.class, responseContainer = "List") List<BeaconResponse> getAllBeacons(); @ResponseBody @GetMapping(value = "/{beaconId}", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Retrieve info on one beacon", response = BeaconResponse.class) BeaconResponse info(@PathVariable("beaconId") final String beaconId); @ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) BeaconAlleleResponse query(
      @RequestParam("referenceName") String referenceName,
      @RequestParam("start") Long start,
      @RequestParam("referenceBases") String referenceBases,
      @RequestParam("alternateBases") String alternateBases,
      @PathVariable("beaconId") final String beaconId); @ResponseBody @PostMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a POST request", response = BeaconAlleleResponse.class) BeaconAlleleResponse query(
      @PathVariable("beaconId") final String beaconId, @RequestBody BeaconAlleleRequest request); }
BeaconController { @ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) public BeaconAlleleResponse query( @RequestParam("referenceName") String referenceName, @RequestParam("start") Long start, @RequestParam("referenceBases") String referenceBases, @RequestParam("alternateBases") String alternateBases, @PathVariable("beaconId") final String beaconId) { return beaconQueryService.query(referenceName, start, referenceBases, alternateBases, beaconId); } BeaconController(BeaconInfoService beaconInfoService, BeaconQueryService beaconQueryService); @ResponseBody @GetMapping(value = "/list", produces = APPLICATION_JSON_VALUE) @ApiOperation( value = "List all beacons", response = BeaconResponse.class, responseContainer = "List") List<BeaconResponse> getAllBeacons(); @ResponseBody @GetMapping(value = "/{beaconId}", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Retrieve info on one beacon", response = BeaconResponse.class) BeaconResponse info(@PathVariable("beaconId") final String beaconId); @ResponseBody @GetMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a GET request", response = BeaconAlleleResponse.class) BeaconAlleleResponse query(
      @RequestParam("referenceName") String referenceName,
      @RequestParam("start") Long start,
      @RequestParam("referenceBases") String referenceBases,
      @RequestParam("alternateBases") String alternateBases,
      @PathVariable("beaconId") final String beaconId); @ResponseBody @PostMapping(value = "/{beaconId}/query", produces = APPLICATION_JSON_VALUE) @ApiOperation(value = "Query a beacon via a POST request", response = BeaconAlleleResponse.class) BeaconAlleleResponse query(
      @PathVariable("beaconId") final String beaconId, @RequestBody BeaconAlleleRequest request); static final String URI; }