jasmine.testconfigure.framework.MiddlewareTestConfiguration Maven / Gradle / Ivy
package jasmine.testconfigure.framework;
import jasmine.framework.cache.CacheService;
import jasmine.framework.cache.CacheUtil;
import jasmine.framework.lock.distributed.DistributedLockProvider;
import jasmine.framework.lock.DistributedLockUtil;
import jasmine.framework.mq.ReceiveMessageService;
import jasmine.framework.mq.SendMessageService;
import jasmine.mock.framework.cache.MockCacheService;
import jasmine.mock.framework.lock.MockDistributedLockProvider;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author mh.z
*/
@Configuration
public class MiddlewareTestConfiguration {
@Bean
public CacheService cacheService() {
CacheService cacheService = new MockCacheService();
// 初始工具类
CacheUtil.initUtil(cacheService);
return cacheService;
}
@Bean
public DistributedLockProvider distributedLockProvider() {
DistributedLockProvider provider = new MockDistributedLockProvider();
// 初始工具类
DistributedLockUtil.initUtil(provider);
return provider;
}
@Bean
public ReceiveMessageService receiveMessageService() {
return Mockito.mock(ReceiveMessageService.class);
}
@Bean
public SendMessageService sendMessageService() {
return Mockito.mock(SendMessageService.class);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy