@Test public void testSwitchover() { assertTrue(this.wxService.switchover("another")); assertThat(WxMpConfigStorageHolder.get()).isEqualTo("another"); assertFalse(this.wxService.switchover("whatever")); }
@Override public boolean switchover(String mpId) { if (this.configStorageMap.containsKey(mpId)) { WxMpConfigStorageHolder.set(mpId); return true; } log.error("无法找到对应【{}】的公众号配置信息，请核实！", mpId); return false; }
BaseWxMpServiceImpl implements WxMpService, RequestHttp<H, P> { @Override public boolean switchover(String mpId) { if (this.configStorageMap.containsKey(mpId)) { WxMpConfigStorageHolder.set(mpId); return true; } log.error("无法找到对应【{}】的公众号配置信息，请核实！", mpId); return false; } }
BaseWxMpServiceImpl implements WxMpService, RequestHttp<H, P> { @Override public boolean switchover(String mpId) { if (this.configStorageMap.containsKey(mpId)) { WxMpConfigStorageHolder.set(mpId); return true; } log.error("无法找到对应【{}】的公众号配置信息，请核实！", mpId); return false; }  }
BaseWxMpServiceImpl implements WxMpService, RequestHttp<H, P> { @Override public boolean switchover(String mpId) { if (this.configStorageMap.containsKey(mpId)) { WxMpConfigStorageHolder.set(mpId); return true; } log.error("无法找到对应【{}】的公众号配置信息，请核实！", mpId); return false; }  @Override boolean checkSignature(String timestamp, String nonce, String signature); @Override String getTicket(TicketType type); @Override String getTicket(TicketType type, boolean forceRefresh); @Override String getJsapiTicket(); @Override String getJsapiTicket(boolean forceRefresh); @Override WxJsapiSignature createJsapiSignature(String url); @Override String getAccessToken(); @Override String shortUrl(String longUrl); @Override WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery); @Override String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state); @Override String buildQrConnectUrl(String redirectURI, String scope, String state); @Override WxMpOAuth2AccessToken oauth2getAccessToken(String code); @Override WxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken); @Override WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken token, String lang); @Override boolean oauth2validateAccessToken(WxMpOAuth2AccessToken token); @Override String[] getCallbackIP(); @Override WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo(); @Override void clearQuota(String appid); @Override String get(String url, String queryParam); @Override String post(String url, String postData); @Override T execute(RequestExecutor<T, E> executor, String uri, E data); T executeInternal(RequestExecutor<T, E> executor, String uri, E data); @Override WxMpConfigStorage getWxMpConfigStorage(); @Override void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider); @Override void setMultiConfigStorages(Map<String, WxMpConfigStorage> configStorages); @Override void setMultiConfigStorages(Map<String, WxMpConfigStorage> configStorages, String defaultMpId); @Override void addConfigStorage(String mpId, WxMpConfigStorage configStorages); @Override void removeConfigStorage(String mpId); @Override WxMpService switchoverTo(String mpId); @Override boolean switchover(String mpId); @Override void setRetrySleepMillis(int retrySleepMillis); @Override void setMaxRetryTimes(int maxRetryTimes); @Override WxMpKefuService getKefuService(); @Override WxMpMaterialService getMaterialService(); @Override WxMpMenuService getMenuService(); @Override WxMpUserService getUserService(); @Override WxMpUserTagService getUserTagService(); @Override WxMpQrcodeService getQrcodeService(); @Override WxMpCardService getCardService(); @Override WxMpDataCubeService getDataCubeService(); @Override WxMpUserBlacklistService getBlackListService(); @Override WxMpStoreService getStoreService(); @Override WxMpTemplateMsgService getTemplateMsgService(); @Override WxMpSubscribeMsgService getSubscribeMsgService(); @Override WxMpDeviceService getDeviceService(); @Override WxMpShakeService getShakeService(); @Override WxMpMemberCardService getMemberCardService(); @Override RequestHttp getRequestHttp(); @Override WxMpMassMessageService getMassMessageService(); @Override void setKefuService(WxMpKefuService kefuService); @Override void setMaterialService(WxMpMaterialService materialService); @Override void setMenuService(WxMpMenuService menuService); @Override void setUserService(WxMpUserService userService); @Override void setTagService(WxMpUserTagService tagService); @Override void setQrCodeService(WxMpQrcodeService qrCodeService); @Override void setCardService(WxMpCardService cardService); @Override void setStoreService(WxMpStoreService storeService); @Override void setDataCubeService(WxMpDataCubeService dataCubeService); @Override void setBlackListService(WxMpUserBlacklistService blackListService); @Override void setTemplateMsgService(WxMpTemplateMsgService templateMsgService); @Override void setDeviceService(WxMpDeviceService deviceService); @Override void setShakeService(WxMpShakeService shakeService); @Override void setMemberCardService(WxMpMemberCardService memberCardService); @Override void setMassMessageService(WxMpMassMessageService massMessageService); @Override WxMpAiOpenService getAiOpenService(); @Override void setAiOpenService(WxMpAiOpenService aiOpenService); @Override WxMpWifiService getWifiService(); @Override WxMpMarketingService getMarketingService(); @Override void setMarketingService(WxMpMarketingService marketingService); }
BaseWxMpServiceImpl implements WxMpService, RequestHttp<H, P> { @Override public boolean switchover(String mpId) { if (this.configStorageMap.containsKey(mpId)) { WxMpConfigStorageHolder.set(mpId); return true; } log.error("无法找到对应【{}】的公众号配置信息，请核实！", mpId); return false; }  @Override boolean checkSignature(String timestamp, String nonce, String signature); @Override String getTicket(TicketType type); @Override String getTicket(TicketType type, boolean forceRefresh); @Override String getJsapiTicket(); @Override String getJsapiTicket(boolean forceRefresh); @Override WxJsapiSignature createJsapiSignature(String url); @Override String getAccessToken(); @Override String shortUrl(String longUrl); @Override WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery); @Override String oauth2buildAuthorizationUrl(String redirectURI, String scope, String state); @Override String buildQrConnectUrl(String redirectURI, String scope, String state); @Override WxMpOAuth2AccessToken oauth2getAccessToken(String code); @Override WxMpOAuth2AccessToken oauth2refreshAccessToken(String refreshToken); @Override WxMpUser oauth2getUserInfo(WxMpOAuth2AccessToken token, String lang); @Override boolean oauth2validateAccessToken(WxMpOAuth2AccessToken token); @Override String[] getCallbackIP(); @Override WxMpCurrentAutoReplyInfo getCurrentAutoReplyInfo(); @Override void clearQuota(String appid); @Override String get(String url, String queryParam); @Override String post(String url, String postData); @Override T execute(RequestExecutor<T, E> executor, String uri, E data); T executeInternal(RequestExecutor<T, E> executor, String uri, E data); @Override WxMpConfigStorage getWxMpConfigStorage(); @Override void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider); @Override void setMultiConfigStorages(Map<String, WxMpConfigStorage> configStorages); @Override void setMultiConfigStorages(Map<String, WxMpConfigStorage> configStorages, String defaultMpId); @Override void addConfigStorage(String mpId, WxMpConfigStorage configStorages); @Override void removeConfigStorage(String mpId); @Override WxMpService switchoverTo(String mpId); @Override boolean switchover(String mpId); @Override void setRetrySleepMillis(int retrySleepMillis); @Override void setMaxRetryTimes(int maxRetryTimes); @Override WxMpKefuService getKefuService(); @Override WxMpMaterialService getMaterialService(); @Override WxMpMenuService getMenuService(); @Override WxMpUserService getUserService(); @Override WxMpUserTagService getUserTagService(); @Override WxMpQrcodeService getQrcodeService(); @Override WxMpCardService getCardService(); @Override WxMpDataCubeService getDataCubeService(); @Override WxMpUserBlacklistService getBlackListService(); @Override WxMpStoreService getStoreService(); @Override WxMpTemplateMsgService getTemplateMsgService(); @Override WxMpSubscribeMsgService getSubscribeMsgService(); @Override WxMpDeviceService getDeviceService(); @Override WxMpShakeService getShakeService(); @Override WxMpMemberCardService getMemberCardService(); @Override RequestHttp getRequestHttp(); @Override WxMpMassMessageService getMassMessageService(); @Override void setKefuService(WxMpKefuService kefuService); @Override void setMaterialService(WxMpMaterialService materialService); @Override void setMenuService(WxMpMenuService menuService); @Override void setUserService(WxMpUserService userService); @Override void setTagService(WxMpUserTagService tagService); @Override void setQrCodeService(WxMpQrcodeService qrCodeService); @Override void setCardService(WxMpCardService cardService); @Override void setStoreService(WxMpStoreService storeService); @Override void setDataCubeService(WxMpDataCubeService dataCubeService); @Override void setBlackListService(WxMpUserBlacklistService blackListService); @Override void setTemplateMsgService(WxMpTemplateMsgService templateMsgService); @Override void setDeviceService(WxMpDeviceService deviceService); @Override void setShakeService(WxMpShakeService shakeService); @Override void setMemberCardService(WxMpMemberCardService memberCardService); @Override void setMassMessageService(WxMpMassMessageService massMessageService); @Override WxMpAiOpenService getAiOpenService(); @Override void setAiOpenService(WxMpAiOpenService aiOpenService); @Override WxMpWifiService getWifiService(); @Override WxMpMarketingService getMarketingService(); @Override void setMarketingService(WxMpMarketingService marketingService);  }