@Test public void setupDbCheck() throws Exception { mockMvc.perform(MockMvcRequestBuilders.get("/setupDb/setupDbCheck") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
@RequestMapping(value = "/setupDbCheck") public ServiceResult setupDbCheck() { try { boolean initialized = setupDBService.isInitialized(); if (initialized) { return ServiceResult.success(); } boolean valid = ResourceUtil.getSingleInstance().datasourceXmlValid(); if (!valid) { return ServiceResult.fail("配置信息读取失败！"); } if (valid && !initialized) { synchronized (SetupDataBaseService.LOCK) { if (!initialized) { setupDBService.setInitialized(true); } } return ServiceResult.success("initialized"); } return ServiceResult.success("initialized"); } catch (Exception e) { log.error("SetupDBController.setupDbCheck : {}", StringUtil.getMessage(e)); return ServiceResult.fail(CommMsg.loginFailMessage); } }
SetupDataBaseController { @RequestMapping(value = "/setupDbCheck") public ServiceResult setupDbCheck() { try { boolean initialized = setupDBService.isInitialized(); if (initialized) { return ServiceResult.success(); } boolean valid = ResourceUtil.getSingleInstance().datasourceXmlValid(); if (!valid) { return ServiceResult.fail("配置信息读取失败！"); } if (valid && !initialized) { synchronized (SetupDataBaseService.LOCK) { if (!initialized) { setupDBService.setInitialized(true); } } return ServiceResult.success("initialized"); } return ServiceResult.success("initialized"); } catch (Exception e) { log.error("SetupDBController.setupDbCheck : {}", StringUtil.getMessage(e)); return ServiceResult.fail(CommMsg.loginFailMessage); } } }
SetupDataBaseController { @RequestMapping(value = "/setupDbCheck") public ServiceResult setupDbCheck() { try { boolean initialized = setupDBService.isInitialized(); if (initialized) { return ServiceResult.success(); } boolean valid = ResourceUtil.getSingleInstance().datasourceXmlValid(); if (!valid) { return ServiceResult.fail("配置信息读取失败！"); } if (valid && !initialized) { synchronized (SetupDataBaseService.LOCK) { if (!initialized) { setupDBService.setInitialized(true); } } return ServiceResult.success("initialized"); } return ServiceResult.success("initialized"); } catch (Exception e) { log.error("SetupDBController.setupDbCheck : {}", StringUtil.getMessage(e)); return ServiceResult.fail(CommMsg.loginFailMessage); } }  }
SetupDataBaseController { @RequestMapping(value = "/setupDbCheck") public ServiceResult setupDbCheck() { try { boolean initialized = setupDBService.isInitialized(); if (initialized) { return ServiceResult.success(); } boolean valid = ResourceUtil.getSingleInstance().datasourceXmlValid(); if (!valid) { return ServiceResult.fail("配置信息读取失败！"); } if (valid && !initialized) { synchronized (SetupDataBaseService.LOCK) { if (!initialized) { setupDBService.setInitialized(true); } } return ServiceResult.success("initialized"); } return ServiceResult.success("initialized"); } catch (Exception e) { log.error("SetupDBController.setupDbCheck : {}", StringUtil.getMessage(e)); return ServiceResult.fail(CommMsg.loginFailMessage); } }  @RequestMapping(value = "/setupDbCheck") ServiceResult setupDbCheck(); @RequestMapping(value = "/connectionTest", method = RequestMethod.POST) ServiceResult connectionTest(@RequestBody ConnectionRequest connectionRequest); @RequestMapping(value = "tableConsistentCheck", method = RequestMethod.POST) ServiceResult tableConsistentCheck(@RequestBody ConnectionRequest connectionRequest); @RequestMapping(value = "initializeDb", method = RequestMethod.POST) ServiceResult initializeDb(@RequestBody InitDbUserRequset initDbUserRequset); }
SetupDataBaseController { @RequestMapping(value = "/setupDbCheck") public ServiceResult setupDbCheck() { try { boolean initialized = setupDBService.isInitialized(); if (initialized) { return ServiceResult.success(); } boolean valid = ResourceUtil.getSingleInstance().datasourceXmlValid(); if (!valid) { return ServiceResult.fail("配置信息读取失败！"); } if (valid && !initialized) { synchronized (SetupDataBaseService.LOCK) { if (!initialized) { setupDBService.setInitialized(true); } } return ServiceResult.success("initialized"); } return ServiceResult.success("initialized"); } catch (Exception e) { log.error("SetupDBController.setupDbCheck : {}", StringUtil.getMessage(e)); return ServiceResult.fail(CommMsg.loginFailMessage); } }  @RequestMapping(value = "/setupDbCheck") ServiceResult setupDbCheck(); @RequestMapping(value = "/connectionTest", method = RequestMethod.POST) ServiceResult connectionTest(@RequestBody ConnectionRequest connectionRequest); @RequestMapping(value = "tableConsistentCheck", method = RequestMethod.POST) ServiceResult tableConsistentCheck(@RequestBody ConnectionRequest connectionRequest); @RequestMapping(value = "initializeDb", method = RequestMethod.POST) ServiceResult initializeDb(@RequestBody InitDbUserRequset initDbUserRequset);  }