@@ -19,7 +19,7 @@ import com.github.binarywang.demo.spring.handler.UnsubscribeHandler; | |||||
import me.chanjar.weixin.common.api.WxConsts; | import me.chanjar.weixin.common.api.WxConsts; | ||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; | import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; | ||||
import me.chanjar.weixin.mp.api.WxMpMessageRouter; | import me.chanjar.weixin.mp.api.WxMpMessageRouter; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.WxMpXmlMessage; | import me.chanjar.weixin.mp.bean.WxMpXmlMessage; | ||||
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; | import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage; | ||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList; | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList; | ||||
@@ -1,4 +1,4 @@ | |||||
package me.chanjar.weixin.mp.api; | |||||
package me.chanjar.weixin.mp.api.impl; | |||||
import com.google.gson.*; | import com.google.gson.*; | ||||
import com.google.gson.internal.Streams; | import com.google.gson.internal.Streams; | ||||
@@ -17,7 +17,7 @@ import me.chanjar.weixin.common.util.crypto.SHA1; | |||||
import me.chanjar.weixin.common.util.crypto.WxCryptUtil; | import me.chanjar.weixin.common.util.crypto.WxCryptUtil; | ||||
import me.chanjar.weixin.common.util.http.*; | import me.chanjar.weixin.common.util.http.*; | ||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer; | import me.chanjar.weixin.common.util.xml.XStreamInitializer; | ||||
import me.chanjar.weixin.mp.api.impl.*; | |||||
import me.chanjar.weixin.mp.api.*; | |||||
import me.chanjar.weixin.mp.bean.*; | import me.chanjar.weixin.mp.bean.*; | ||||
import me.chanjar.weixin.mp.bean.result.*; | import me.chanjar.weixin.mp.bean.result.*; | ||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; |
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.apache.commons.lang3.builder.ToStringBuilder; | import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
import com.google.inject.Binder; | import com.google.inject.Binder; | ||||
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.common.util.StringUtils; | import me.chanjar.weixin.common.util.StringUtils; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
@@ -20,7 +21,7 @@ public class WxMpBaseAPITest { | |||||
protected WxMpServiceImpl wxService; | protected WxMpServiceImpl wxService; | ||||
public void testRefreshAccessToken() throws WxErrorException { | public void testRefreshAccessToken() throws WxErrorException { | ||||
WxMpConfigStorage configStorage = this.wxService.wxMpConfigStorage; | |||||
WxMpConfigStorage configStorage = this.wxService.getWxMpConfigStorage(); | |||||
String before = configStorage.getAccessToken(); | String before = configStorage.getAccessToken(); | ||||
this.wxService.getAccessToken(false); | this.wxService.getAccessToken(false); | ||||
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api; | |||||
import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.common.util.http.RequestExecutor; | import me.chanjar.weixin.common.util.http.RequestExecutor; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.testng.annotations.DataProvider; | import org.testng.annotations.DataProvider; | ||||
import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.api.WxConsts; | import me.chanjar.weixin.common.api.WxConsts; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.WxMpCustomMessage; | import me.chanjar.weixin.mp.bean.WxMpCustomMessage; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
@@ -20,7 +21,7 @@ public class WxMpCustomMessageAPITest { | |||||
protected WxMpServiceImpl wxService; | protected WxMpServiceImpl wxService; | ||||
public void testSendCustomMessage() throws WxErrorException { | public void testSendCustomMessage() throws WxErrorException { | ||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.wxMpConfigStorage; | |||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.getWxMpConfigStorage(); | |||||
WxMpCustomMessage message = new WxMpCustomMessage(); | WxMpCustomMessage message = new WxMpCustomMessage(); | ||||
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | message.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | ||||
message.setToUser(configStorage.getOpenId()); | message.setToUser(configStorage.getOpenId()); | ||||
@@ -30,7 +31,7 @@ public class WxMpCustomMessageAPITest { | |||||
} | } | ||||
public void testSendCustomMessageWithKfAccount() throws WxErrorException { | public void testSendCustomMessageWithKfAccount() throws WxErrorException { | ||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.wxMpConfigStorage; | |||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.getWxMpConfigStorage(); | |||||
WxMpCustomMessage message = new WxMpCustomMessage(); | WxMpCustomMessage message = new WxMpCustomMessage(); | ||||
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | message.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | ||||
message.setToUser(configStorage.getOpenId()); | message.setToUser(configStorage.getOpenId()); | ||||
@@ -3,13 +3,12 @@ package me.chanjar.weixin.mp.api; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.common.util.crypto.SHA1; | import me.chanjar.weixin.common.util.crypto.SHA1; | ||||
import me.chanjar.weixin.mp.bean.WxMpGroup; | |||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
import java.security.NoSuchAlgorithmException; | import java.security.NoSuchAlgorithmException; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 测试jsapi ticket接口 | * 测试jsapi ticket接口 | ||||
@@ -4,6 +4,7 @@ import com.google.inject.Inject; | |||||
import me.chanjar.weixin.common.api.WxConsts; | import me.chanjar.weixin.common.api.WxConsts; | ||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage; | import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassNews; | import me.chanjar.weixin.mp.bean.WxMpMassNews; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | ||||
@@ -33,7 +34,7 @@ public class WxMpMassMessageAPITest { | |||||
@Test | @Test | ||||
public void testTextMassOpenIdsMessageSend() throws WxErrorException { | public void testTextMassOpenIdsMessageSend() throws WxErrorException { | ||||
// 发送群发消息 | // 发送群发消息 | ||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configProvider = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.wxMpConfigStorage; | |||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configProvider = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.getWxMpConfigStorage(); | |||||
WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage(); | WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage(); | ||||
massMessage.setMsgType(WxConsts.MASS_MSG_TEXT); | massMessage.setMsgType(WxConsts.MASS_MSG_TEXT); | ||||
massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>"); | massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>"); | ||||
@@ -47,7 +48,7 @@ public class WxMpMassMessageAPITest { | |||||
@Test(dataProvider="massMessages") | @Test(dataProvider="massMessages") | ||||
public void testMediaMassOpenIdsMessageSend(String massMsgType, String mediaId) throws WxErrorException, IOException { | public void testMediaMassOpenIdsMessageSend(String massMsgType, String mediaId) throws WxErrorException, IOException { | ||||
// 发送群发消息 | // 发送群发消息 | ||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configProvider = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.wxMpConfigStorage; | |||||
ApiTestModule.WxXmlMpInMemoryConfigStorage configProvider = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.getWxMpConfigStorage(); | |||||
WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage(); | WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage(); | ||||
massMessage.setMsgType(massMsgType); | massMessage.setMsgType(massMsgType); | ||||
massMessage.setMediaId(mediaId); | massMessage.setMediaId(mediaId); | ||||
@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
import org.testng.annotations.Test; | import org.testng.annotations.Test; | ||||
@@ -3,7 +3,6 @@ package me.chanjar.weixin.mp.api.impl; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.WxMpGroup; | import me.chanjar.weixin.mp.bean.WxMpGroup; | ||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
@@ -16,7 +16,6 @@ import com.google.inject.Inject; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule.WxXmlMpInMemoryConfigStorage; | import me.chanjar.weixin.mp.api.ApiTestModule.WxXmlMpInMemoryConfigStorage; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest; | import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest; | ||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfInfo; | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfInfo; | ||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList; | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList; | ||||
@@ -6,7 +6,6 @@ import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.common.util.fs.FileUtils; | import me.chanjar.weixin.common.util.fs.FileUtils; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.WxMpMaterial; | import me.chanjar.weixin.mp.bean.WxMpMaterial; | ||||
import me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate; | import me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate; | ||||
import me.chanjar.weixin.mp.bean.WxMpMaterialNews; | import me.chanjar.weixin.mp.bean.WxMpMaterialNews; | ||||
@@ -6,7 +6,6 @@ import me.chanjar.weixin.common.bean.WxMenu; | |||||
import me.chanjar.weixin.common.bean.WxMenu.WxMenuButton; | import me.chanjar.weixin.common.bean.WxMenu.WxMenuButton; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.DataProvider; | import org.testng.annotations.DataProvider; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
@@ -3,7 +3,6 @@ package me.chanjar.weixin.mp.api.impl; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; | import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; | ||||
import org.testng.Assert; | import org.testng.Assert; | ||||
import org.testng.annotations.Guice; | import org.testng.annotations.Guice; | ||||
@@ -3,7 +3,6 @@ package me.chanjar.weixin.mp.api.impl; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.WxMpServiceImpl; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpUser; | import me.chanjar.weixin.mp.bean.result.WxMpUser; | ||||
import me.chanjar.weixin.mp.bean.result.WxMpUserCumulate; | import me.chanjar.weixin.mp.bean.result.WxMpUserCumulate; | ||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList; | import me.chanjar.weixin.mp.bean.result.WxMpUserList; | ||||
@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.demo; | |||||
import me.chanjar.weixin.common.api.WxConsts; | import me.chanjar.weixin.common.api.WxConsts; | ||||
import me.chanjar.weixin.mp.api.*; | import me.chanjar.weixin.mp.api.*; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | |||||
import org.eclipse.jetty.server.Server; | import org.eclipse.jetty.server.Server; | ||||
import org.eclipse.jetty.servlet.ServletHandler; | import org.eclipse.jetty.servlet.ServletHandler; | ||||
import org.eclipse.jetty.servlet.ServletHolder; | import org.eclipse.jetty.servlet.ServletHolder; | ||||