mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	修复#82引入代码导致的单元测试失败的问题
This commit is contained in:
		| @ -368,9 +368,7 @@ public class WxMpServiceImpl implements WxMpService { | ||||
|         return result; | ||||
|       } catch (WxErrorException e) { | ||||
|         WxError error = e.getError(); | ||||
|         /** | ||||
|          * -1 系统繁忙, 1000ms后重试 | ||||
|          */ | ||||
|         // -1 系统繁忙, 1000ms后重试 | ||||
|         if (error.getErrorCode() == -1) { | ||||
|           int sleepMillis = this.retrySleepMillis * (1 << retryTimes); | ||||
|           try { | ||||
|  | ||||
| @ -1,15 +1,15 @@ | ||||
| package me.chanjar.weixin.mp.api; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
|  | ||||
| import com.google.inject.Binder; | ||||
| import com.google.inject.Module; | ||||
| import com.thoughtworks.xstream.XStream; | ||||
|  | ||||
| import me.chanjar.weixin.common.util.xml.XStreamInitializer; | ||||
| import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.util.concurrent.locks.ReentrantLock; | ||||
|  | ||||
| public class ApiTestModule implements Module { | ||||
|  | ||||
|   @Override | ||||
| @ -18,6 +18,7 @@ public class ApiTestModule implements Module { | ||||
|         .getSystemResourceAsStream("test-config.xml")) { | ||||
|       WxXmlMpInMemoryConfigStorage config = this | ||||
|           .fromXml(WxXmlMpInMemoryConfigStorage.class, is1); | ||||
|       config.setAccessTokenLock(new ReentrantLock()); | ||||
|       WxMpService wxService = new WxMpServiceImpl(); | ||||
|       wxService.setWxMpConfigStorage(config); | ||||
|  | ||||
|  | ||||
| @ -1,8 +1,9 @@ | ||||
| package me.chanjar.weixin.mp.api; | ||||
|  | ||||
| import com.thoughtworks.xstream.annotations.XStreamAlias; | ||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
|  | ||||
| import com.thoughtworks.xstream.annotations.XStreamAlias; | ||||
| import java.util.concurrent.locks.Lock; | ||||
|  | ||||
| @XStreamAlias("xml") | ||||
| public class WxXmlMpInMemoryConfigStorage | ||||
| @ -50,4 +51,7 @@ public class WxXmlMpInMemoryConfigStorage | ||||
|     this.templateId = templateId; | ||||
|   } | ||||
|  | ||||
| } | ||||
|   public void setAccessTokenLock(Lock lock){ | ||||
|     super.accessTokenLock = lock; | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang