src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgWeek(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_WEEK, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List<WxDataC... | @Test(dataProvider = "thirtyDays") public void testGetUpstreamMsgWeek(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() .getUpstreamMsgWeek(beginDate, endDate); Assert.assertNotNull(results); System.out.println(results); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgMonth(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_MONTH, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List<WxDat... | @Test(dataProvider = "thirtyDays") public void testGetUpstreamMsgMonth(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() .getUpstreamMsgMonth(beginDate, endDate); Assert.assertNotNull(results); System.out.println(results); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgDist(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_DIST, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List<WxDataC... | @Test(dataProvider = "fifteenDays") public void testGetUpstreamMsgDist(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() .getUpstreamMsgDist(beginDate, endDate); Assert.assertNotNull(results); System.out.println(results); } |
WxCpTagServiceImpl implements WxCpTagService { @Override public WxCpTagAddOrRemoveUsersResult addUsers2Tag(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException { String url = "https: JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("tagid", tagId); if (userIds != null) { Js... | @Test(dependsOnMethods = {"testListAll", "testUpdate", "testCreate"}) public void testAddUsers2Tag() throws Exception { List<String> userIds = Splitter.on("|").splitToList(this.configStorage.getUserId()); WxCpTagAddOrRemoveUsersResult result = this.wxService.getTagService().addUsers2Tag(this.tagId, userIds, null); asse... |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgDistWeek(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_DIST_WEEK, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override Lis... | @Test(dataProvider = "thirtyDays") public void testGetUpstreamMsgDistWeek(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() .getUpstreamMsgDistWeek(beginDate, endDate); Assert.assertNotNull(results); System.out.println(results); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_DIST_MONTH, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override L... | @Test(dataProvider = "thirtyDays") public void testGetUpstreamMsgDistMonth(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeMsgResult> results = this.wxService.getDataCubeService() .getUpstreamMsgDistMonth(beginDate, endDate); Assert.assertNotNull(results); System.out.println(results); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeInterfaceResult> getInterfaceSummary(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_INTERFACE_SUMMARY, buildParams(beginDate, endDate)); return WxDataCubeInterfaceResult.f... | @Test(dataProvider = "thirtyDays") public void testGetInterfaceSummary(Date beginDate, Date endDate) throws WxErrorException { List<WxDataCubeInterfaceResult> results = this.wxService.getDataCubeService() .getInterfaceSummary(beginDate, endDate); Assert.assertNotNull(results); System.out.println(results); } |
WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeInterfaceResult> getInterfaceSummaryHour(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_INTERFACE_SUMMARY_HOUR, buildParams(beginDate, endDate)); return WxDataCubeInterfac... | @Test(dataProvider = "oneDay") public void testGetInterfaceSummaryHour(Date date) throws WxErrorException { List<WxDataCubeInterfaceResult> results = this.wxService.getDataCubeService() .getInterfaceSummaryHour(date, date); Assert.assertNotNull(results); System.out.println(results); } |
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMpMaterialNews materialNewsInfo(String media_id) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/get_material"; return this.wxMpService.execute(MaterialNewsInfoRequestExecutor.create(this.wxMpService.getRequestHttp()), url, m... | @Test(dependsOnMethods = {"testAddNews"}) public void testGetNewsInfo() throws WxErrorException { WxMpMaterialNews wxMpMaterialNewsSingle = this.wxService .getMaterialService().materialNewsInfo(this.singleNewsMediaId); WxMpMaterialNews wxMpMaterialNewsMultiple = this.wxService .getMaterialService().materialNewsInfo(thi... |
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/batchget_material"; Map<String, Object> params = new HashMap<>(); params.put("type", WxConsts.MATERIAL_N... | @Test(dependsOnMethods = {"testUpdateNewsInfo"}) public void testMaterialNewsList() throws WxErrorException { WxMpMaterialNewsBatchGetResult wxMpMaterialNewsBatchGetResult = this.wxService.getMaterialService().materialNewsBatchGet(0, 20); assertNotNull(wxMpMaterialNewsBatchGetResult); } |
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/batchget_material"; Map<String, Object> params = new HashMap<>(); params.put("type", type);... | @Test(dependsOnMethods = {"testMaterialNewsList"}) public void testMaterialFileList() throws WxErrorException { WxMpMaterialFileBatchGetResult wxMpMaterialVoiceBatchGetResult = this.wxService.getMaterialService().materialFileBatchGet(WxConsts.MATERIAL_VOICE, 0, 20); WxMpMaterialFileBatchGetResult wxMpMaterialVideoBatch... |
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public boolean materialDelete(String media_id) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/del_material"; return this.wxMpService.execute(MaterialDeleteRequestExecutor.create(this.wxMpService.getRequestHttp()), url, media_id); } W... | @Test(dependsOnMethods = {"testMaterialFileList"}, dataProvider = "allTestMaterial") public void testDeleteMaterial(String mediaId) throws WxErrorException { boolean result = this.wxService.getMaterialService().materialDelete(mediaId); assertTrue(result); } |
WxCpTagServiceImpl implements WxCpTagService { @Override public List<WxCpUser> listUsersByTagId(String tagId) throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.cre... | @Test(dependsOnMethods = {"testAddUsers2Tag", "testListAll", "testUpdate", "testCreate"}) public void testListUsersByTagId() throws Exception { List<WxCpUser> users = this.wxService.getTagService().listUsersByTagId(this.tagId); assertNotEquals(users.size(), 0); } |
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException { try { return this.mediaUpload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType)); } catch ... | @Test(dataProvider = "mediaFiles") public void testUploadMedia(String mediaType, String fileType, String fileName) throws WxErrorException, IOException { try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) { WxMediaUploadResult res = this.wxService.getMaterialService().mediaUpload(mediaType,... |
WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public File mediaDownload(String media_id) throws WxErrorException { String url = MEDIA_API_URL_PREFIX + "/get"; return this.wxMpService.execute( MediaDownloadRequestExecutor.create(this.wxMpService.getRequestHttp(), this.wxMpService.getWxMpConfigStorag... | @Test(dependsOnMethods = {"testUploadMedia"}, dataProvider = "downloadMedia") public void testDownloadMedia(String mediaId) throws WxErrorException { File file = this.wxService.getMaterialService().mediaDownload(mediaId); assertNotNull(file); System.out.println(file.getAbsolutePath()); } |
WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException { if (sceneId == 0) { throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("临时二维码场景值不能为0!").build()); } if (expireSeconds != nu... | @Test(dataProvider = "sceneIds") public void testQrCodeCreateTmpTicket(int sceneId) throws WxErrorException { WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(sceneId, null); Assert.assertNotNull(ticket.getUrl()); Assert.assertNotNull(ticket.getTicket()); Assert.assertTrue(ticket.getExp... |
WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("永久二维码的场景值目前只支持1--100000!").build()); } String url = AP... | @Test(dataProvider = "sceneIds") public void testQrCodeCreateLastTicket(int sceneId) throws WxErrorException { WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(sceneId); Assert.assertNotNull(ticket.getUrl()); Assert.assertNotNull(ticket.getTicket()); Assert.assertTrue(ticket.getExpire_... |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public WxUserTag tagCreate(String name) throws WxErrorException { String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); JsonObject tagJson = new JsonObject(); tagJson.addProperty("name", name); json.add("tag", tagJson); String respo... | @Test public void testTagCreate() throws Exception { String tagName = "测试标签" + System.currentTimeMillis(); WxUserTag res = this.wxService.getUserTagService().tagCreate(tagName); System.out.println(res); this.tagId = res.getId(); Assert.assertEquals(tagName, res.getName()); } |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public List<WxUserTag> tagGet() throws WxErrorException { String url = API_URL_PREFIX + "/get"; String responseContent = this.wxMpService.get(url, null); return WxUserTag.listFromJson(responseContent); } WxMpUserTagServiceImpl(WxMpService wxMpService); @O... | @Test public void testTagGet() throws Exception { List<WxUserTag> res = this.wxService.getUserTagService().tagGet(); System.out.println(res); Assert.assertNotNull(res); } |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public Boolean tagUpdate(Long id, String name) throws WxErrorException { String url = API_URL_PREFIX + "/update"; JsonObject json = new JsonObject(); JsonObject tagJson = new JsonObject(); tagJson.addProperty("id", id); tagJson.addProperty("name", name); ... | @Test(dependsOnMethods = {"testTagCreate"}) public void testTagUpdate() throws Exception { String tagName = "修改标签" + System.currentTimeMillis(); Boolean res = this.wxService.getUserTagService().tagUpdate(this.tagId, tagName); System.out.println(res); Assert.assertTrue(res); } |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public Boolean tagDelete(Long id) throws WxErrorException { String url = API_URL_PREFIX + "/delete"; JsonObject json = new JsonObject(); JsonObject tagJson = new JsonObject(); tagJson.addProperty("id", id); json.add("tag", tagJson); String responseContent... | @Test(dependsOnMethods = {"testTagCreate"}) public void testTagDelete() throws Exception { Boolean res = this.wxService.getUserTagService().tagDelete(this.tagId); System.out.println(res); Assert.assertTrue(res); } |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public WxTagListUser tagListUser(Long tagId, String nextOpenid) throws WxErrorException { String url = "https: JsonObject json = new JsonObject(); json.addProperty("tagid", tagId); json.addProperty("next_openid", StringUtils.trimToEmpty(nextOpenid)); Stri... | @Test public void testTagListUser() throws Exception { WxTagListUser res = this.wxService.getUserTagService().tagListUser(this.tagId, null); System.out.println(res); Assert.assertNotNull(res); } |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public boolean batchTagging(Long tagId, String[] openids) throws WxErrorException { String url = API_URL_PREFIX + "/members/batchtagging"; JsonObject json = new JsonObject(); json.addProperty("tagid", tagId); JsonArray openidArrayJson = new JsonArray(); f... | @Test public void testBatchTagging() throws Exception { String[] openids = new String[]{((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()}; boolean res = this.wxService.getUserTagService().batchTagging(this.tagId, openids); System.out.println(res); Assert.assertTrue(res); } |
WxCpTagServiceImpl implements WxCpTagService { @Override public WxCpTagAddOrRemoveUsersResult removeUsersFromTag(String tagId, List<String> userIds) throws WxErrorException { String url = "https: JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("tagid", tagId); JsonArray jsonArray = new JsonArray(); for... | @Test(dependsOnMethods = {"testListUsersByTagId", "testAddUsers2Tag", "testListAll", "testUpdate", "testCreate"}) public void testRemoveUsersFromTag() throws Exception { List<String> userIds = Splitter.on("|").splitToList(this.configStorage.getUserId()); WxCpTagAddOrRemoveUsersResult result = this.wxService.getTagServi... |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public boolean batchUntagging(Long tagId, String[] openids) throws WxErrorException { String url = API_URL_PREFIX + "/members/batchuntagging"; JsonObject json = new JsonObject(); json.addProperty("tagid", tagId); JsonArray openidArrayJson = new JsonArray(... | @Test public void testBatchUntagging() throws Exception { String[] openids = new String[]{((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()}; boolean res = this.wxService.getUserTagService().batchUntagging(this.tagId, openids); System.out.println(res); Assert.assertTrue(res); } |
WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public List<Long> userTagList(String openid) throws WxErrorException { String url = API_URL_PREFIX + "/getidlist"; JsonObject json = new JsonObject(); json.addProperty("openid", openid); String responseContent = this.wxMpService.post(url, json.toString())... | @Test public void testUserTagList() throws Exception { List<Long> res = this.wxService.getUserTagService().userTagList( ((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()); System.out.println(res); Assert.assertNotNull(res); } |
WxMpMenuServiceImpl implements WxMpMenuService { @Override public WxMenu menuTryMatch(String userid) throws WxErrorException { String url = API_URL_PREFIX + "/trymatch"; JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("user_id", userid); try { String resultContent = this.wxMpService.post(url, jsonObjec... | @Test public void testMenuTryMatch() throws Exception { WxMenu menu = this.wxService.getMenuService().menuTryMatch("..."); System.out.println(menu); } |
WxMpMenuServiceImpl implements WxMpMenuService { @Override public WxMpGetSelfMenuInfoResult getSelfMenuInfo() throws WxErrorException { String url = "https: String resultContent = this.wxMpService.get(url, null); return WxMpGetSelfMenuInfoResult.fromJson(resultContent); } WxMpMenuServiceImpl(WxMpService wxMpService); @... | @Test public void testGetSelfMenuInfo() throws Exception { WxMpGetSelfMenuInfoResult selfMenuInfo = this.wxService.getMenuService().getSelfMenuInfo(); System.out.println(selfMenuInfo); } |
WxCpTagServiceImpl implements WxCpTagService { @Override public void delete(String tagId) throws WxErrorException { String url = "https: this.mainService.get(url, null); } WxCpTagServiceImpl(WxCpService mainService); @Override String create(String tagName); @Override void update(String tagId, String tagName); @Override... | @Test(dependsOnMethods = {"testRemoveUsersFromTag", "testListUsersByTagId", "testAddUsers2Tag", "testListAll", "testUpdate", "testCreate"}) public void testDelete() throws Exception { this.wxService.getTagService().delete(this.tagId); } |
WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage { public void setTransInfo(TransInfo transInfo) { this.transInfo = transInfo; } WxMpXmlOutTransferKefuMessage(); TransInfo getTransInfo(); void setTransInfo(TransInfo transInfo); } | @Test public void test() { WxMpXmlOutTransferKefuMessage m = new WxMpXmlOutTransferKefuMessage(); m.setCreateTime(1399197672L); m.setFromUserName("fromuser"); m.setToUserName("touser"); String expected = "<xml>" + "<ToUserName><![CDATA[touser]]></ToUserName>" + "<FromUserName><![CDATA[fromuser]]></FromUserName>" + "<Cr... |
WxMpKfOnlineList { public static WxMpKfOnlineList fromJson(String json) { return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfOnlineList.class); } static WxMpKfOnlineList fromJson(String json); @Override String toString(); List<WxMpKfInfo> getKfOnlineList(); void setKfOnlineList(List<WxMpKfInfo> kfOnlineList... | @Test public void testFromJson() { String json = "{\r\n" + " \"kf_online_list\": [\r\n" + " {\r\n" + " \"kf_account\": \"test1@test\", \r\n" + " \"status\": 1, \r\n" + " \"kf_id\": \"1001\", \r\n" + " \"auto_accept\": 0, \r\n" + " \"accepted_case\": 1\r\n" + " },\r\n" + " {\r\n" + " \"kf_account\": \"test2@test\", \r\n... |
WxMpTemplateMessage implements Serializable { public String toJson() { return WxMpGsonBuilder.INSTANCE.create().toJson(this); } WxMpTemplateMessage(); static WxMpTemplateMessageBuilder builder(); String getToUser(); void setToUser(String toUser); String getTemplateId(); void setTemplateId(String templateId); String get... | @Test public void testToJson() throws Exception { WxMpTemplateMessage tm = WxMpTemplateMessage.builder() .toUser("OPENID") .templateId("ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY") .miniProgram(new WxMpTemplateMessage.MiniProgram("xiaochengxuappid12345", "index?foo=bar")) .url("http: .build(); tm.addWxMpTemplateData( ... |
WxCpMediaServiceImpl implements WxCpMediaService { @Override public WxMediaUploadResult upload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException, IOException { return this.upload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType)); } WxCpMediaServic... | @Test(dataProvider = "mediaData") public void testUploadMedia(String mediaType, String fileType, String fileName) throws WxErrorException, IOException { try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) { WxMediaUploadResult res = this.wxService.getMediaService().upload(mediaType, fileType... |
WxCpMediaServiceImpl implements WxCpMediaService { @Override public File download(String mediaId) throws WxErrorException { String url = "https: return this.mainService.execute( MediaDownloadRequestExecutor.create(this.mainService.getRequestHttp(), this.mainService.getWxCpConfigStorage().getTmpDirFile()), url, "media_i... | @Test(dependsOnMethods = {"testUploadMedia"}, dataProvider = "downloadMedia") public void testDownloadMedia(String media_id) throws WxErrorException { File file = this.wxService.getMediaService().download(media_id); assertNotNull(file); System.out.println(file); } |
WxCpUserServiceImpl implements WxCpUserService { @Override public void authenticate(String userId) throws WxErrorException { String url = "https: this.mainService.get(url, null); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser user); @Override v... | @Test public void testAuthenticate() throws Exception { this.wxCpService.getUserService().authenticate("abc"); } |
WxCpUserServiceImpl implements WxCpUserService { @Override public void create(WxCpUser user) throws WxErrorException { String url = "https: this.mainService.post(url, user.toJson()); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser user); @Overri... | @Test public void testCreate() throws Exception { WxCpUser user = new WxCpUser(); user.setUserId(userId); user.setName("Some Woman"); user.setDepartIds(new Integer[]{2}); user.setEmail("none@none.com"); user.setGender(WxCpUser.Gender.FEMAIL); user.setMobile("13560084979"); user.setPosition("woman"); user.setTelephone("... |
WxCpUserServiceImpl implements WxCpUserService { @Override public void update(WxCpUser user) throws WxErrorException { String url = "https: this.mainService.post(url, user.toJson()); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser user); @Overri... | @Test(dependsOnMethods = "testCreate") public void testUpdate() throws Exception { WxCpUser user = new WxCpUser(); user.setUserId(userId); user.setName("Some Woman"); user.addExtAttr("爱好", "table2"); this.wxCpService.getUserService().update(user); } |
WxCpUserServiceImpl implements WxCpUserService { @Override public void delete(String... userIds) throws WxErrorException { if (userIds.length == 1) { this.deleteOne(userIds[0]); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); for (String userid : userIds) { jsonAr... | @Test(dependsOnMethods = {"testCreate", "testUpdate"}) public void testDelete() throws Exception { this.wxCpService.getUserService().delete(userId); } |
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public List<WxCpDepart> listAll() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create()... | @Test public void testListAll() throws Exception { System.out.println("=================获取部门"); List<WxCpDepart> departList = this.wxCpService.getDepartmentService().listAll(); assertNotNull(departList); assertTrue(departList.size() > 0); for (WxCpDepart g : departList) { this.depart = g; System.out.println(this.depart... |
WxCpUserServiceImpl implements WxCpUserService { @Override public WxCpUser getById(String userid) throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); return WxCpUser.fromJson(responseContent); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticat... | @Test(dependsOnMethods = "testUpdate") public void testGetById() throws Exception { WxCpUser user = this.wxCpService.getUserService().getById(userId); assertNotNull(user); } |
WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status != null)... | @Test public void testListByDepartment() throws Exception { List<WxCpUser> users = this.wxCpService.getUserService().listByDepartment(1, true, 0); assertNotEquals(users.size(), 0); for (WxCpUser user : users) { System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE)); } } |
WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listSimpleByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (status !=... | @Test public void testListSimpleByDepartment() throws Exception { List<WxCpUser> users = this.wxCpService.getUserService().listSimpleByDepartment(1, true, 0); assertNotEquals(users.size(), 0); for (WxCpUser user : users) { System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE)); } } |
WxPayServiceImpl implements WxPayService { @Override public Map<String, String> getPayInfo(WxPayUnifiedOrderRequest request) throws WxPayException { WxPayUnifiedOrderResult unifiedOrderResult = this.unifiedOrder(request); String prepayId = unifiedOrderResult.getPrepayId(); if (StringUtils.isBlank(prepayId)) { throw new... | @Test public void testGetPayInfo() throws Exception { Map<String, String> payInfo = this.payService.getPayInfo(WxPayUnifiedOrderRequest.newBuilder() .body("我去") .totalFee(1) .spbillCreateIp("111111") .notifyURL("111111") .tradeType("JSAPI") .outTradeNo("111111") .openid(((XmlWxPayConfig) this.payService.getConfig()).ge... |
WxPayServiceImpl implements WxPayService { @Override public WxPayBillResult downloadBill(String billDate, String billType, String tarType, String deviceInfo) throws WxPayException { WxPayDownloadBillRequest request = new WxPayDownloadBillRequest(); request.setBillType(billType); request.setBillDate(billDate); request.s... | @Test public void testDownloadBill() throws Exception { WxPayBillResult wxPayBillResult = this.payService.downloadBill("20170101", "ALL", "GZIP", "1111111"); assertNotNull(wxPayBillResult); this.payService.downloadBill("", "", "", null); } |
WxPayServiceImpl implements WxPayService { public void report(WxPayReportRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/payitil/report"; String responseContent = this.post(url, request.toXML(), true); WxPayCommonResult result = WxPayBaseResult.from... | @Test public void testReport() throws Exception { WxPayReportRequest request = new WxPayReportRequest(); request.setInterfaceUrl("hahahah"); request.setSignType("HMAC-SHA256"); request.setExecuteTime(1000); request.setReturnCode("aaa"); request.setResultCode("aaa"); request.setUserIp("8.8.8"); this.payService.report(re... |
WxPayServiceImpl implements WxPayService { @Override public WxPayRefundResult refund(WxPayRefundRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/secapi/pay/refund"; String responseContent = this.postWithKey(url, request.toXML()); WxPayRefundResult re... | @Test public void testRefund() throws Exception { WxPayRefundResult result = this.payService.refund( WxPayRefundRequest.newBuilder() .outRefundNo("aaa") .outTradeNo("1111") .totalFee(1222) .refundFee(111) .build()); this.logger.info(result.toString()); } |
WxPayServiceImpl implements WxPayService { @Override public WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, String outRefundNo, String refundId) throws WxPayException { WxPayRefundQueryRequest request = new WxPayRefundQueryRequest(); request.setOutTradeNo(StringUtils.trimToNull(outTradeNo));... | @Test public void testRefundQuery() throws Exception { WxPayRefundQueryResult result; result = this.payService.refundQuery("1", "", "", ""); this.logger.info(result.toString()); result = this.payService.refundQuery("", "2", "", ""); this.logger.info(result.toString()); result = this.payService.refundQuery("", "", "3", ... |
WxPayServiceImpl implements WxPayService { @Override public WxPaySendRedpackResult sendRedpack(WxPaySendRedpackRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/mmpaymkttransfers/sendredpack"; if (request.getAmtType() != null) { url = this.getPayBaseU... | @Test public void testSendRedpack() throws Exception { WxPaySendRedpackRequest request = new WxPaySendRedpackRequest(); request.setActName("abc"); request.setClientIp("aaa"); request.setMchBillNo("aaaa"); request.setReOpenid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid()); WxPaySendRedpackResult redpackResu... |
WxPayServiceImpl implements WxPayService { @Override public WxPayRedpackQueryResult queryRedpack(String mchBillNo) throws WxPayException { WxPayRedpackQueryRequest request = new WxPayRedpackQueryRequest(); request.setMchBillNo(mchBillNo); request.setBillType("MCHT"); request.checkAndSign(this.getConfig()); String url =... | @Test public void testQueryRedpack() throws Exception { WxPayRedpackQueryResult redpackResult = this.payService.queryRedpack("aaaa"); this.logger.info(redpackResult.toString()); } |
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public void update(WxCpDepart group) throws WxErrorException { String url = "https: this.mainService.post(url, group.toJson()); } WxCpDepartmentServiceImpl(WxCpService mainService); @Override Integer create(WxCpDepart depart); @Override void update(... | @Test(dependsOnMethods = {"testListAll", "testCreate"}) public void testUpdate() throws Exception { System.out.println("=================更新部门"); this.depart.setName("子部门改名" + System.currentTimeMillis()); this.wxCpService.getDepartmentService().update(this.depart); } |
WxPayServiceImpl implements WxPayService { @Override public WxPayUnifiedOrderResult unifiedOrder(WxPayUnifiedOrderRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/pay/unifiedorder"; String responseContent = this.post(url, request.toXML(), true); WxPa... | @Test public void testUnifiedOrder() throws WxPayException { WxPayUnifiedOrderResult result = this.payService .unifiedOrder(WxPayUnifiedOrderRequest.newBuilder() .body("我去") .totalFee(1) .spbillCreateIp("111111") .notifyURL("111111") .tradeType("JSAPI") .openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid()... |
WxPayServiceImpl implements WxPayService { @Override public WxPayOrderQueryResult queryOrder(String transactionId, String outTradeNo) throws WxPayException { WxPayOrderQueryRequest request = new WxPayOrderQueryRequest(); request.setOutTradeNo(StringUtils.trimToNull(outTradeNo)); request.setTransactionId(StringUtils.tri... | @Test public void testQueryOrder() throws WxPayException { this.logger.info(this.payService.queryOrder("11212121", null).toString()); this.logger.info(this.payService.queryOrder(null, "11111").toString()); } |
WxPayServiceImpl implements WxPayService { @Override public WxPayOrderCloseResult closeOrder(String outTradeNo) throws WxPayException { if (StringUtils.isBlank(outTradeNo)) { throw new IllegalArgumentException("out_trade_no不能为空"); } WxPayOrderCloseRequest request = new WxPayOrderCloseRequest(); request.setOutTradeNo(St... | @Test public void testCloseOrder() throws WxPayException { this.logger.info(this.payService.closeOrder("11212121").toString()); } |
WxPayServiceImpl implements WxPayService { @Override public WxEntPayResult entPay(WxEntPayRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/mmpaymkttransfers/promotion/transfers"; String responseContent = this.postWithKey(url, request.toXML()); WxEntP... | @Test public void testEntPay() throws WxPayException { WxEntPayRequest request = new WxEntPayRequest(); this.logger.info(this.payService.entPay(request).toString()); } |
WxPayServiceImpl implements WxPayService { @Override public WxEntPayQueryResult queryEntPay(String partnerTradeNo) throws WxPayException { WxEntPayQueryRequest request = new WxEntPayQueryRequest(); request.setPartnerTradeNo(partnerTradeNo); request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/m... | @Test public void testQueryEntPay() throws WxPayException { this.logger.info(this.payService.queryEntPay("11212121").toString()); } |
WxPayServiceImpl implements WxPayService { @Override public byte[] createScanPayQrcodeMode1(String productId, File logoFile, Integer sideLength) { String content = this.createScanPayQrcodeMode1(productId); return this.createQrcode(content, logoFile, sideLength); } @Override WxPayConfig getConfig(); @Override void setC... | @Test public void testCreateScanPayQrcodeMode1() throws Exception { String productId = "abc"; byte[] bytes = this.payService.createScanPayQrcodeMode1(productId, null, null); Path qrcodeFilePath = Files.createTempFile("qrcode_", ".jpg"); Files.write(qrcodeFilePath, bytes); String qrcodeContent = QrcodeUtils.decodeQrcode... |
WxPayServiceImpl implements WxPayService { @Override public byte[] createScanPayQrcodeMode2(String codeUrl, File logoFile, Integer sideLength) { return this.createQrcode(codeUrl, logoFile, sideLength); } @Override WxPayConfig getConfig(); @Override void setConfig(WxPayConfig config); @Override WxPayRefundResult refund... | @Test public void testCreateScanPayQrcodeMode2() throws Exception { String qrcodeContent = "abc"; byte[] bytes = this.payService.createScanPayQrcodeMode2(qrcodeContent, null, null); Path qrcodeFilePath = Files.createTempFile("qrcode_", ".jpg"); Files.write(qrcodeFilePath, bytes); assertEquals(QrcodeUtils.decodeQrcode(q... |
WxPayServiceImpl implements WxPayService { @Override public WxPayOrderNotifyResult getOrderNotifyResult(String xmlData) throws WxPayException { try { log.debug("微信支付回调参数详细:{}", xmlData); WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData); log.debug("微信支付回调结果对象:{}", result); result.checkResult(this)... | @Test public void testGetOrderNotifyResult() throws Exception { } |
WxPayServiceImpl implements WxPayService { @Override public WxPayMicropayResult micropay(WxPayMicropayRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/pay/micropay"; String responseContent = this.post(url, request.toXML(), true); WxPayMicropayResult ... | @Test public void testMicropay() throws Exception { WxPayMicropayResult result = this.payService.micropay(WxPayMicropayRequest.newBuilder() .body("body") .outTradeNo("aaaaa") .totalFee(123) .spbillCreateIp("127.0.0.1") .authCode("aaa") .build()); this.logger.info(result.toString()); } |
WxPayServiceImpl implements WxPayService { @Override public WxPayConfig getConfig() { return this.config; } @Override WxPayConfig getConfig(); @Override void setConfig(WxPayConfig config); @Override WxPayRefundResult refund(WxPayRefundRequest request); @Override WxPayRefundQueryResult refundQuery(String transactionId,... | @Test public void testGetConfig() throws Exception { } |
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public void delete(Integer departId) throws WxErrorException { String url = "https: this.mainService.get(url, null); } WxCpDepartmentServiceImpl(WxCpService mainService); @Override Integer create(WxCpDepart depart); @Override void update(WxCpDepart ... | @Test(dependsOnMethods = "testUpdate") public void testDelete() throws Exception { System.out.println("=================删除部门"); System.out.println(this.depart.getId() + ":" + this.depart.getName()); this.wxCpService.getDepartmentService().delete(this.depart.getId()); } |
WxPayServiceImpl implements WxPayService { @Override public void setConfig(WxPayConfig config) { this.config = config; } @Override WxPayConfig getConfig(); @Override void setConfig(WxPayConfig config); @Override WxPayRefundResult refund(WxPayRefundRequest request); @Override WxPayRefundQueryResult refundQuery(String t... | @Test public void testSetConfig() throws Exception { } |
WxPayServiceImpl implements WxPayService { @Override public WxPayOrderReverseResult reverseOrder(WxPayOrderReverseRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/secapi/pay/reverse"; String responseContent = this.postWithKey(url, request.toXML()); W... | @Test public void testReverseOrder() throws Exception { WxPayOrderReverseResult result = this.payService.reverseOrder(WxPayOrderReverseRequest.newBuilder() .outTradeNo("1111") .build()); assertNotNull(result); this.logger.info(result.toString()); } |
WxPayServiceImpl implements WxPayService { @Override public String shorturl(WxPayShorturlRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/tools/shorturl"; String responseContent = this.post(url, request.toXML(), true); WxPayShorturlResult result = Wx... | @Test public void testShorturl() throws Exception { String longUrl = "weixin: String result = this.payService.shorturl(new WxPayShorturlRequest(longUrl)); assertNotNull(result); this.logger.info(result); result = this.payService.shorturl(longUrl); assertNotNull(result); this.logger.info(result); } |
WxPayServiceImpl implements WxPayService { @Override public String authcode2Openid(WxPayAuthcode2OpenidRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/tools/authcodetoopenid"; String responseContent = this.post(url, request.toXML(), true); WxPayAuth... | @Test public void testAuthcode2Openid() throws Exception { String authCode = "11111"; String result = this.payService.authcode2Openid(new WxPayAuthcode2OpenidRequest(authCode)); assertNotNull(result); this.logger.info(result); result = this.payService.authcode2Openid(authCode); assertNotNull(result); this.logger.info(r... |
WxPayServiceImpl implements WxPayService { @Override public String getSandboxSignKey() throws WxPayException { WxPayDefaultRequest request = new WxPayDefaultRequest(); request.checkAndSign(this.getConfig()); String url = "https: String responseContent = this.post(url, request.toXML(), false); WxPaySandboxSignKeyResult ... | @Test public void testGetSandboxSignKey() throws Exception { final String signKey = this.payService.getSandboxSignKey(); assertNotNull(signKey); this.logger.info(signKey); } |
WxPayConfig { public SSLContext initSSLContext() throws WxPayException { if (StringUtils.isBlank(mchId)) { throw new IllegalArgumentException("请确保商户号mchId已设置"); } if (StringUtils.isBlank(this.keyPath)) { throw new IllegalArgumentException("请确保证书文件地址keyPath已配置"); } InputStream inputStream; final String prefix = "classpa... | @Test public void testInitSSLContext() throws Exception { payConfig.setMchId("123"); payConfig.setKeyPath("classpath:/abc.p12"); payConfig.initSSLContext(); } |
WxPaySendRedpackResult extends WxPayBaseResult implements Serializable { public String getSendTime() { return this.sendTime; } String getMchBillno(); void setMchBillno(String mchBillno); String getWxappid(); void setWxappid(String wxappid); String getReOpenid(); void setReOpenid(String reOpenid); int getTotalAmount();... | @Test public void loadSuccessResult() { final String successSample = "<xml>\n" + "<return_code><![CDATA[SUCCESS]]></return_code>\n" + "<return_msg><![CDATA[发放成功.]]></return_msg>\n" + "<result_code><![CDATA[SUCCESS]]></result_code>\n" + "<err_code><![CDATA[0]]></err_code>\n" + "<err_code_des><![CDATA[发放成功.]]></err_code_... |
WxPayOrderQueryResult extends WxPayBaseResult { public void composeCoupons() { if (this.couponCount != null && this.couponCount > 0) { this.coupons = Lists.newArrayList(); for (int i = 0; i < this.couponCount; i++) { this.coupons.add(new Coupon(this.getXmlValue("xml/coupon_type_" + i), this.getXmlValue("xml/coupon_id_"... | @Test public void testComposeCoupons() throws Exception { String xmlString = "<xml>\n" + " <return_code><![CDATA[SUCCESS]]></return_code>\n" + " <return_msg><![CDATA[OK]]></return_msg>\n" + " <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" + " <mch_id><![CDATA[10000100]]></mch_id>\n" + " <device_info><![CDATA[1000]]><... |
WxPayBaseResult { protected String getXmlValue(String... path) { Document doc = this.getXmlDoc(); String expression = String.format("/%s try { return (String) XPathFactory .newInstance() .newXPath() .compile(expression) .evaluate(doc, XPathConstants.STRING); } catch (XPathExpressionException e) { throw new RuntimeExcep... | @Test public void testGetXmlValue() throws Exception { } |
WxPayBaseResult { public Map<String, String> toMap() { if (StringUtils.isBlank(this.xmlString)) { throw new RuntimeException("xml数据有问题,请核实!"); } Map<String, String> result = Maps.newHashMap(); Document doc = this.getXmlDoc(); try { NodeList list = (NodeList) XPathFactory.newInstance().newXPath() .compile("/xml/*") .eva... | @Test public void testToMap() throws Exception { WxPayOrderQueryResult result = new WxPayOrderQueryResult(); result.setXmlString("<xml>\n" + " <return_code><![CDATA[SUCCESS]]></return_code>\n" + " <return_msg><![CDATA[OK]]></return_msg>\n" + " <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" + " <mch_id><![CDATA[100001... |
WxCpMenuServiceImpl implements WxCpMenuService { @Override public void create(WxMenu menu) throws WxErrorException { this.create(this.mainService.getWxCpConfigStorage().getAgentId(), menu); } WxCpMenuServiceImpl(WxCpService mainService); @Override void create(WxMenu menu); @Override void create(Integer agentId, WxMenu ... | @Test(dataProvider = "menuData") public void testCreate(WxMenu wxMenu) throws Exception { this.wxService.getMenuService().create(wxMenu); } |
WxPayRefundQueryResult extends WxPayBaseResult { public void composeRefundRecords() { if (this.refundCount != null && this.refundCount > 0) { this.refundRecords = Lists.newArrayList(); for (int i = 0; i < this.refundCount; i++) { RefundRecord refundRecord = new RefundRecord(); this.refundRecords.add(refundRecord); refu... | @Test public void composeRefundRecords() throws Exception { String xmlString = "<xml>\n" + " <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" + " <mch_id><![CDATA[10000100]]></mch_id>\n" + " <nonce_str><![CDATA[TeqClE3i0mvn3DrK]]></nonce_str>\n" + " <out_refund_no_0><![CDATA[1415701182]]></out_refund_no_0>\n" + " <out_... |
WxPayOrderNotifyResult extends WxPayBaseResult implements Serializable { public static WxPayOrderNotifyResult fromXML(String xmlString) { XStream xstream = XStreamInitializer.getInstance(); xstream.processAnnotations(WxPayOrderNotifyResult.class); xstream.registerConverter(new WxPayOrderNotifyResultConverter(xstream.ge... | @Test public void testFromXML() throws Exception { String xmlString = "<xml>\n" + " <appid><![CDATA[wx2421b1c4370ec43b]]></appid>\n" + " <attach><![CDATA[支付测试]]></attach>\n" + " <bank_type><![CDATA[CFT]]></bank_type>\n" + " <fee_type><![CDATA[CNY]]></fee_type>\n" + " <is_subscribe><![CDATA[Y]]></is_subscribe>\n" + " <m... |
SHA1 { public static String gen(String... arr) { if (StringUtils.isAnyEmpty(arr)) { throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr)); } Arrays.sort(arr); StringBuilder sb = new StringBuilder(); for (String a : arr) { sb.append(a); } return DigestUtils.sha1Hex(sb.toString()); } static Stri... | @Test public void testGen() throws Exception { final String result = SHA1.gen("123", "345"); assertNotNull(result); assertEquals(result,"9f537aeb751ec72605f57f94a2f6dc3e3958e1dd"); }
@Test(expectedExceptions = {IllegalArgumentException.class}) public void testGen_illegalArguments() { final String result = SHA1.gen(null... |
SHA1 { public static String genWithAmple(String... arr) { if (StringUtils.isAnyEmpty(arr)) { throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr)); } Arrays.sort(arr); StringBuilder sb = new StringBuilder(); for (int i = 0; i < arr.length; i++) { String a = arr[i]; sb.append(a); if (i != arr.le... | @Test public void testGenWithAmple() throws Exception { final String result = SHA1.genWithAmple("123", "345"); assertNotNull(result); assertEquals(result,"20b896ccbd5a72dde5dbe0878ff985e4069771c6"); } |
WxMaMsgServiceImpl implements WxMaMsgService { @Override public String sendTemplateMsg(WxMaTemplateMessage templateMessage) throws WxErrorException { String responseContent = this.wxMaService.post(TEMPLATE_MSG_SEND_URL, templateMessage.toJson()); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObjec... | @Test(invocationCount = 5, threadPoolSize = 3) public void testSendTemplateMsg() throws WxErrorException { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); TestConfig config = (TestConfig) this.wxService.getWxMaConfig(); WxMaTemplateMessage templateMessage = WxMaTemplateMessage.newBuilder(... |
WxMaUserServiceImpl implements WxMaUserService { @Override public WxMaJscode2SessionResult getSessionInfo(String jsCode) throws WxErrorException { final WxMaConfig config = service.getWxMaConfig(); Map<String, String> params = new HashMap<>(); params.put("appid", config.getAppid()); params.put("secret", config.getSecre... | @Test public void testGetSessionKey() throws Exception { assertNotNull(this.wxService.getUserService().getSessionInfo("aaa")); } |
WxMaUserServiceImpl implements WxMaUserService { @Override public WxMaUserInfo getUserInfo(String sessionKey, String encryptedData, String ivStr) { return WxMaUserInfo.fromJson(WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr)); } WxMaUserServiceImpl(WxMaService service); @Override WxMaJscode2SessionResult getSe... | @Test public void testGetUserInfo() throws Exception { WxMaUserInfo userInfo = this.wxService.getUserService().getUserInfo("tiihtNczf5v6AKRyjwEUhQ==", "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8... |
WxMaUserServiceImpl implements WxMaUserService { @Override public boolean checkUserInfo(String sessionKey, String rawData, String signature) { final String generatedSignature = DigestUtils.sha1Hex(rawData + sessionKey); System.out.println(generatedSignature); return generatedSignature.equals(signature); } WxMaUserServi... | @Test public void testCheckUserInfo() throws Exception { assertTrue(this.wxService.getUserService().checkUserInfo("HyVFkGl5F5OQWJZZaNzBBg==", "{\"nickName\":\"Band\",\"gender\":1,\"language\":\"zh_CN\",\"city\":\"Guangzhou\",\"province\":\"Guangdong\",\"country\":\"CN\",\"avatarUrl\":\"http: "75e81ceda165f4ffa64f4068af... |
WxMaQrcodeServiceImpl implements WxMaQrcodeService { @Override public File createQrcode(String path, int width) throws WxErrorException { String url = "https: return this.wxMaService.execute(new QrCodeRequestExecutor(this.wxMaService.getRequestHttp()), url, new WxMaQrcode(path, width)); } WxMaQrcodeServiceImpl(WxMaServ... | @Test public void testCreateQrCode() throws Exception { final File qrCode = this.wxService.getQrcodeService().createQrcode("111", 122); System.out.println(qrCode); } |
WxCpMenuServiceImpl implements WxCpMenuService { @Override public WxMenu get() throws WxErrorException { return this.get(this.mainService.getWxCpConfigStorage().getAgentId()); } WxCpMenuServiceImpl(WxCpService mainService); @Override void create(WxMenu menu); @Override void create(Integer agentId, WxMenu menu); @Overri... | @Test(dependsOnMethods = "testCreate") public void testGet() throws Exception { WxMenu menu = this.wxService.getMenuService().get(); assertNotNull(menu); System.out.println(menu.toJson()); } |
WxMaMediaServiceImpl implements WxMaMediaService { @Override public WxMediaUploadResult uploadMedia(String mediaType, String fileType, InputStream inputStream) throws WxErrorException { try { return this.uploadMedia(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType)); } catch (IOExc... | @Test public void testUploadMedia() throws WxErrorException, IOException { String mediaType = "image"; String fileType = "png"; String fileName = "tmp.png"; try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) { WxMediaUploadResult res = this.wxService.getMediaService().uploadMedia(mediaType,... |
WxMaMediaServiceImpl implements WxMaMediaService { @Override public File getMedia(String mediaId) throws WxErrorException { try { RequestExecutor<File, String> executor = MediaDownloadRequestExecutor .create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile()); return this.wxMaService.execute(... | @Test(dependsOnMethods = {"testUploadMedia"}) public void testGetMedia() throws WxErrorException { File file = this.wxService.getMediaService().getMedia(this.mediaId); assertNotNull(file); System.out.println(file.getAbsolutePath()); } |
WxMaTemplateMessage implements Serializable { public String toJson() { return WxMaGsonBuilder.create().toJson(this); } private WxMaTemplateMessage(Builder builder); static Builder newBuilder(); String toJson(); String getToUser(); void setToUser(String toUser); String getTemplateId(); void setTemplateId(String templat... | @Test public void testToJson() throws Exception { WxMaTemplateMessage tm = WxMaTemplateMessage.newBuilder() .toUser("OPENID") .formId("FORMID") .page("index") .data(Lists.newArrayList( new WxMaTemplateMessage.Data("keyword1", "339208499", "#173177"), new WxMaTemplateMessage.Data("keyword2", "2015年01月05日12:30", "#173177... |
WxMpMessageRouter { public WxMpMessageRouterRule rule() { return new WxMpMessageRouterRule(this); } WxMpMessageRouter(WxMpService wxMpService); void setExecutorService(ExecutorService executorService); void setMessageDuplicateChecker(WxMessageDuplicateChecker messageDuplicateChecker); void setSessionManager(WxSessionMa... | @Test(enabled = false) public void prepare(boolean async, StringBuffer sb, WxMpMessageRouter router) { router .rule() .async(async) .msgType(WxConsts.XML_MSG_TEXT).event(WxConsts.EVT_CLICK).eventKey("KEY_1").content("CONTENT_1") .handler(new WxEchoMpMessageHandler(sb, "COMBINE_4")) .end() .rule() .async(async) .msgType... |
WxMpMessageRouter { public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map<String, Object> context) { if (isMsgDuplicated(wxMessage)) { return null; } final List<WxMpMessageRouterRule> matchRules = new ArrayList<>(); for (final WxMpMessageRouterRule rule : this.rules) { if (rule.test(wxMessage)) { mat... | @Test(dataProvider = "messages-1") public void testSync(WxMpXmlMessage message, String expected) { StringBuffer sb = new StringBuffer(); WxMpMessageRouter router = new WxMpMessageRouter(null); prepare(false, sb, router); router.route(message); Assert.assertEquals(sb.toString(), expected); }
@Test(dataProvider = "messag... |
WxMpUserBlacklistServiceImpl implements WxMpUserBlacklistService { @Override public WxMpUserBlacklistGetResult getBlacklist(String nextOpenid) throws WxErrorException { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("begin_openid", nextOpenid); String url = API_BLACKLIST_PREFIX + "/getblacklist"; Stri... | @Test public void testGetBlacklist() throws Exception { TestConfigStorage configStorage = (TestConfigStorage) this.wxService .getWxMpConfigStorage(); WxMpUserBlacklistGetResult wxMpUserBlacklistGetResult = this.wxService.getBlackListService().getBlacklist(configStorage.getOpenid()); Assert.assertNotNull(wxMpUserBlackli... |
WxMpUserBlacklistServiceImpl implements WxMpUserBlacklistService { @Override public void pushToBlacklist(List<String> openidList) throws WxErrorException { Map<String, Object> map = new HashMap<>(); map.put("openid_list", openidList); String url = API_BLACKLIST_PREFIX + "/batchblacklist"; this.wxMpService.execute(Simpl... | @Test public void testPushToBlacklist() throws Exception { TestConfigStorage configStorage = (TestConfigStorage) this.wxService .getWxMpConfigStorage(); List<String> openidList = new ArrayList<>(); openidList.add(configStorage.getOpenid()); this.wxService.getBlackListService().pushToBlacklist(openidList); } |
WxMpUserBlacklistServiceImpl implements WxMpUserBlacklistService { @Override public void pullFromBlacklist(List<String> openidList) throws WxErrorException { Map<String, Object> map = new HashMap<>(); map.put("openid_list", openidList); String url = API_BLACKLIST_PREFIX + "/batchunblacklist"; this.wxMpService.execute(S... | @Test public void testPullFromBlacklist() throws Exception { TestConfigStorage configStorage = (TestConfigStorage) this.wxService .getWxMpConfigStorage(); List<String> openidList = new ArrayList<>(); openidList.add(configStorage.getOpenid()); this.wxService.getBlackListService().pullFromBlacklist(openidList); } |
WxMpDeviceServiceImpl implements WxMpDeviceService { @Override public WxDeviceQrCodeResult getQrCode(String productId) throws WxErrorException { String url = API_URL_PREFIX + "/getqrcode"; String response = this.wxMpService.get(url, "product_id=" + productId); return WxDeviceQrCodeResult.fromJson(response); } WxMpDevic... | @Test(dataProvider = "productId") public void testGetQrcode(String productId) { try { WxDeviceQrCodeResult result = wxService.getDeviceService().getQrCode(productId); println(result.toJson()); } catch (WxErrorException e) { println(e.getMessage()); } } |
WxCpMenuServiceImpl implements WxCpMenuService { @Override public void delete() throws WxErrorException { this.delete(this.mainService.getWxCpConfigStorage().getAgentId()); } WxCpMenuServiceImpl(WxCpService mainService); @Override void create(WxMenu menu); @Override void create(Integer agentId, WxMenu menu); @Override ... | @Test(dependsOnMethods = {"testGet", "testCreate"}) public void testDelete() throws Exception { this.wxService.getMenuService().delete(); } |
WxMpCardServiceImpl implements WxMpCardService { @Override public String getCardApiTicket() throws WxErrorException { return getCardApiTicket(false); } WxMpCardServiceImpl(WxMpService wxMpService); @Override WxMpService getWxMpService(); @Override String getCardApiTicket(); @Override String getCardApiTicket(boolean for... | @Test public void testGetCardApiTicket() throws Exception { String cardApiTicket = this.wxService.getCardService().getCardApiTicket(); assertNotNull(cardApiTicket); System.out.println(cardApiTicket); }
@Test public void testGetCardApiTicketWithParam() throws Exception { String cardApiTicket = this.wxService.getCardServ... |
WxMpCardServiceImpl implements WxMpCardService { @Override public WxCardApiSignature createCardApiSignature(String... optionalSignParam) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; String nonceStr = RandomUtils.getRandomStr(); String cardApiTicket = getCardApiTicket(false); String[] si... | @Test public void testCreateCardApiSignature() throws Exception { String[] param = {"123", this.cardId, "", this.code, this.openid, ""}; WxCardApiSignature cardApiSignature = this.wxService.getCardService().createCardApiSignature(param); assertNotNull(cardApiSignature); System.out.println(cardApiSignature); } |
WxMpCardServiceImpl implements WxMpCardService { @Override public String decryptCardCode(String encryptCode) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("encrypt_code", encryptCode); String responseContent = this.wxMpService.post(CARD_CODE_DECRYPT, param.toString()); JsonElement tmp... | @Test public void testDecryptCardCode() throws Exception { String encryptCode = "pd0vTUHSHc9tMUCL2gXABcUmINm6yxqJh0y9Phsy63E="; String cardCode = this.wxService.getCardService().decryptCardCode(encryptCode); assertNotNull(cardCode); System.out.println(cardCode); } |
WxMpCardServiceImpl implements WxMpCardService { @Override public WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("card_id", cardId); param.addProperty("code", code); param.addProperty("check_consume", checkC... | @Test public void testQueryCardCode() throws Exception { WxMpCardResult wxMpCardResult = this.wxService.getCardService().queryCardCode(this.cardId, this.code, false); assertNotNull(wxMpCardResult); System.out.println(wxMpCardResult); } |
WxMpCardServiceImpl implements WxMpCardService { @Override public String consumeCardCode(String code) throws WxErrorException { return consumeCardCode(code, null); } WxMpCardServiceImpl(WxMpService wxMpService); @Override WxMpService getWxMpService(); @Override String getCardApiTicket(); @Override String getCardApiTick... | @Test public void testConsumeCardCode() throws Exception { String result = this.wxService.getCardService().consumeCardCode(this.code); assertNotNull(result); System.out.println(result); }
@Test public void testConsumeCardCodeWithCardId() throws Exception { String result = this.wxService.getCardService().consumeCardCode... |
WxMpCardServiceImpl implements WxMpCardService { @Override public void markCardCode(String code, String cardId, String openId, boolean isMark) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("code", code); param.addProperty("card_id", cardId); param.addProperty("openid", openId); param.... | @Test public void testMarkCardCode() throws Exception { this.wxService.getCardService().markCardCode(this.code, this.cardId, this.openid, true); System.out.println("done"); } |
WxMpCardServiceImpl implements WxMpCardService { @Override public String getCardDetail(String cardId) throws WxErrorException { JsonObject param = new JsonObject(); param.addProperty("card_id", cardId); String responseContent = this.wxMpService.post(CARD_GET, param.toString()); JsonObject json = (new JsonParser()).pars... | @Test public void testGetCardDetail() throws Exception { String result = this.wxService.getCardService().getCardDetail(this.cardId); assertNotNull(result); System.out.println(result); } |
WxMpTemplateMsgServiceImpl implements WxMpTemplateMsgService { @Override public String sendTemplateMsg(WxMpTemplateMessage templateMessage) throws WxErrorException { String url = "https: String responseContent = this.wxMpService.post(url, templateMessage.toJson()); final JsonObject jsonObject = JSON_PARSER.parse(respon... | @Test(invocationCount = 5, threadPoolSize = 3) public void testSendTemplateMsg() throws WxErrorException { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS"); TestConfigStorage configStorage = (TestConfigStorage) this.wxService .getWxMpConfigStorage(); WxMpTemplateMessage templateMessage = W... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.