release branch 1.1.0
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.github.houbb.lock.test.spring;
|
||||
|
||||
|
||||
import com.github.houbb.lock.core.bs.LockBs;
|
||||
import com.github.houbb.lock.test.config.SpringConfig;
|
||||
import com.github.houbb.lock.test.model.User;
|
||||
import com.github.houbb.lock.test.service.UserService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author binbin.hou
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@ContextConfiguration(classes = SpringConfig.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class SpringServiceRawTest {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private LockBs lockBs;
|
||||
|
||||
@Test
|
||||
public void queryLogTest() {
|
||||
final String key = "name";
|
||||
try {
|
||||
lockBs.tryLock(key);
|
||||
final String value = userService.rawUserName(1L);
|
||||
} catch (Exception exception) {
|
||||
throw new RuntimeException(exception);
|
||||
} finally {
|
||||
lockBs.unlock(key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
23
lock-test/src/test/resources/logback.xml
Normal file
23
lock-test/src/test/resources/logback.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 /app/sv/logs -->
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--com.github.houbb 包路径 additivity: 表示是否 想上层传递)-->
|
||||
<logger name="com.github.houbb.lock" level="INFO" additivity="true">
|
||||
</logger>
|
||||
|
||||
<!-- 日志输出级别-->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user