.
This commit is contained in:
@@ -3,6 +3,7 @@ import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.dbq.parser.ParseMysql;
|
||||
import net.tccn.dict.DictKit;
|
||||
import net.tccn.meta.MetaService;
|
||||
import net.tccn.meta.MetaTable;
|
||||
import net.tccn.qtask.TaskEntity;
|
||||
@@ -19,10 +20,8 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
@@ -52,6 +51,7 @@ public class RunTest<T> {
|
||||
//System.out.println(query.getClass());
|
||||
}*/
|
||||
ParseMysql parser = new ParseMysql();
|
||||
|
||||
//@Test
|
||||
public void parseFBeanTest() {
|
||||
String str = "{name:'user_service', filters:[{col:'a.username',type:'like',value:'lxy'}], orders:[{col:a.`id`,desc: -1},{col:a.`deptName`,desc: 1}], limit:{ps:2,pn:10}}";
|
||||
@@ -150,7 +150,7 @@ public class RunTest<T> {
|
||||
public void findMaxNum() {
|
||||
int xx = asList("1", "5", "3").stream().filter(x -> !x.isEmpty()).mapToInt(x -> {
|
||||
return Integer.parseInt(x) * 2;
|
||||
}).min().orElseGet(()-> 0);
|
||||
}).min().orElseGet(() -> 0);
|
||||
|
||||
System.out.println(xx);
|
||||
}
|
||||
@@ -229,7 +229,8 @@ public class RunTest<T> {
|
||||
String tpl = tplKit.getTpl("service.method", kv, false);
|
||||
System.out.println(tpl);
|
||||
}
|
||||
private String toUpperCaseFirst(String str){
|
||||
|
||||
private String toUpperCaseFirst(String str) {
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
}
|
||||
|
||||
@@ -249,14 +250,10 @@ public class RunTest<T> {
|
||||
|
||||
MetaKit metaKit = new MetaKit();
|
||||
|
||||
try {
|
||||
File file = new File("tmp/metaKit.json");
|
||||
file.getParentFile().mkdirs();
|
||||
File file = new File("tmp/metaKit.json");
|
||||
file.getParentFile().mkdirs();
|
||||
|
||||
FileKit.strToFile(convert.convertTo(metaKit), file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
FileKit.strToFile(convert.convertTo(metaKit), file);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -357,7 +354,7 @@ public class RunTest<T> {
|
||||
@Test
|
||||
public void switchTest() {
|
||||
String a = "2";
|
||||
switch (a){
|
||||
switch (a) {
|
||||
case "1":
|
||||
System.out.println(1);
|
||||
case "2":
|
||||
|
||||
40
src/test/java/TimerKit.java
Normal file
40
src/test/java/TimerKit.java
Normal file
@@ -0,0 +1,40 @@
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* @author: liangxianyou
|
||||
*/
|
||||
public class TimerKit {
|
||||
private static Timer timer = new Timer();
|
||||
|
||||
/**
|
||||
* 延迟执行
|
||||
*
|
||||
* @param runnable 执行的任务
|
||||
* @param delay 延迟时间
|
||||
*/
|
||||
public static void schedule(Runnable runnable, long delay) {
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
runnable.run();
|
||||
}
|
||||
}, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 延迟周期执行
|
||||
*
|
||||
* @param runnable 执行的任务
|
||||
* @param delay 延迟时间
|
||||
* @param period 执行周期
|
||||
*/
|
||||
public static void schedule(Runnable runnable, long delay, long period) {
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
runnable.run();
|
||||
}
|
||||
}, delay, period);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user