@Test public void test_unseal() throws Exception { Unseal unseal = new Unseal("localhost", "8200", "LwRw+j0I7L4ff4no50fduaF5OeTZJEOQFwdjWZcee0s=", true); String inputJson =new ObjectMapper().writeValueAsString(unseal); String responseMessage = "{\"messages\": [ \"vault is unsealed\" ]}"; ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(responseMessage); when(sysService.unseal(Mockito.any())).thenReturn(responseEntityExpected); mockMvc.perform(MockMvcRequestBuilders.post("/v2/unseal") .header("Content-Type", "application/json;charset=UTF-8") .content(inputJson)) .andExpect(status().isOk()) .andExpect(content().string(containsString(responseMessage))); }
@ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") public ResponseEntity<String> unseal (@RequestBody Unseal unseal){ return sysService.unseal(unseal); }
SysControllerV2 { @ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") public ResponseEntity<String> unseal (@RequestBody Unseal unseal){ return sysService.unseal(unseal); } }
SysControllerV2 { @ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") public ResponseEntity<String> unseal (@RequestBody Unseal unseal){ return sysService.unseal(unseal); }  }
SysControllerV2 { @ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") public ResponseEntity<String> unseal (@RequestBody Unseal unseal){ return sysService.unseal(unseal); }  @ApiOperation(value = "${SysControllerV2.checkVaultHealth.value}", notes = "${SysControllerV2.checkVaultHealth.notes}") @GetMapping(value ="/v2/health" ,produces="application/json") ResponseEntity<String> checkVaultHealth(); @ApiOperation(value = "${SysControllerV2.checkSealStatus.value}", notes = "${SysControllerV2.checkSealStatus.notes}") @GetMapping(value ="/v2/seal-status" ,produces="application/json") ResponseEntity<String> checkVaultSealStatus(); @ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") ResponseEntity<String> unseal(@RequestBody Unseal unseal); @ApiOperation(value = "${SysControllerV2.unsealProgress.value}", notes = "${SysControllerV2.unsealProgress.notes}") @GetMapping(value ="/v2/unseal-progress" ,produces="application/json") ResponseEntity<String> unsealProgress(@RequestParam("serverip" ) String serverip); }
SysControllerV2 { @ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") public ResponseEntity<String> unseal (@RequestBody Unseal unseal){ return sysService.unseal(unseal); }  @ApiOperation(value = "${SysControllerV2.checkVaultHealth.value}", notes = "${SysControllerV2.checkVaultHealth.notes}") @GetMapping(value ="/v2/health" ,produces="application/json") ResponseEntity<String> checkVaultHealth(); @ApiOperation(value = "${SysControllerV2.checkSealStatus.value}", notes = "${SysControllerV2.checkSealStatus.notes}") @GetMapping(value ="/v2/seal-status" ,produces="application/json") ResponseEntity<String> checkVaultSealStatus(); @ApiOperation(value = "${SysControllerV2.unseal.value}", notes = "${SysControllerV2.unseal.notes}") @PostMapping(value ="/v2/unseal" , consumes = "application/json" ,produces="application/json") ResponseEntity<String> unseal(@RequestBody Unseal unseal); @ApiOperation(value = "${SysControllerV2.unsealProgress.value}", notes = "${SysControllerV2.unsealProgress.notes}") @GetMapping(value ="/v2/unseal-progress" ,produces="application/json") ResponseEntity<String> unsealProgress(@RequestParam("serverip" ) String serverip);  }