删除用不到的文件
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
||||||
* No deletion without permission, or be held responsible to law.
|
|
||||||
*/
|
|
||||||
package com.jeesite.test;
|
|
||||||
|
|
||||||
import com.jeesite.common.collect.ListUtils;
|
|
||||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
|
||||||
import com.jeesite.modules.ApiApplication;
|
|
||||||
import com.jeesite.modules.test.dao.TestDataDao;
|
|
||||||
import com.jeesite.modules.test.entity.TestData;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入测试
|
|
||||||
* @author ThinkGem
|
|
||||||
* @version 2019年10月28日
|
|
||||||
*/
|
|
||||||
@ActiveProfiles("test")
|
|
||||||
@SpringBootTest(classes = ApiApplication.class)
|
|
||||||
public class InsertBatchTest extends BaseSpringContextTests {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TestDataDao testDataDao;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testData() throws Exception{
|
|
||||||
List<TestData> list = ListUtils.newArrayList();
|
|
||||||
for(int i=0; i<5000; i++){
|
|
||||||
TestData testData = new TestData();
|
|
||||||
testData.setTestInput("test"+i);
|
|
||||||
list.add(testData);
|
|
||||||
}
|
|
||||||
testDataDao.insertBatch(list, null);
|
|
||||||
list = testDataDao.findList(new TestData());
|
|
||||||
System.out.println("insert: " + list.size());
|
|
||||||
long count = testDataDao.updateBatch(list, null);
|
|
||||||
System.out.println("update: " + count);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
||||||
* No deletion without permission, or be held responsible to law.
|
|
||||||
*/
|
|
||||||
package com.jeesite.test;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
|
||||||
|
|
||||||
import com.jeesite.common.collect.ListUtils;
|
|
||||||
import com.jeesite.common.idgen.IdGen;
|
|
||||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
|
||||||
import com.jeesite.modules.ApiApplication;
|
|
||||||
import com.jeesite.modules.test.entity.TestData;
|
|
||||||
import com.jeesite.modules.test.entity.TestDataChild;
|
|
||||||
import com.jeesite.modules.test.service.TestDataService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多数据源并发测试<br>
|
|
||||||
* 1、将 TestDataChildDao 的数据源设置为 ds2<br>
|
|
||||||
* 2、将 TestDataChild 的表名设置为 test_data_child2<br>
|
|
||||||
* 3、配置 ds2 数据源,并创建 test_data_child2 表
|
|
||||||
* @author ThinkGem
|
|
||||||
* @version 2019-6-26
|
|
||||||
*/
|
|
||||||
@ActiveProfiles("test")
|
|
||||||
@SpringBootTest(classes = ApiApplication.class)
|
|
||||||
public class MultiDataSourceTest extends BaseSpringContextTests {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TestDataService testDataService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testData() throws Exception{
|
|
||||||
ExecutorService pool = Executors.newCachedThreadPool();
|
|
||||||
CountDownLatch latch = new CountDownLatch(10);
|
|
||||||
Runnable runnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try{
|
|
||||||
Thread.sleep(IdGen.randomInt(1000, 3000));
|
|
||||||
TestData testData = new TestData();
|
|
||||||
testData.setTestDataChildList(ListUtils.newArrayList(
|
|
||||||
new TestDataChild(), new TestDataChild(), new TestDataChild()));
|
|
||||||
testDataService.save(testData);
|
|
||||||
List<TestData> list = testDataService.findList(new TestData());
|
|
||||||
System.out.println("size: " + list.size());
|
|
||||||
list.forEach(e -> {
|
|
||||||
System.out.println("get: " + testDataService.get(e));
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println(e.getMessage());
|
|
||||||
} finally {
|
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for (int i = 0; i < latch.getCount(); i++) {
|
|
||||||
pool.execute(runnable);
|
|
||||||
}
|
|
||||||
latch.await();
|
|
||||||
pool.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
||||||
* No deletion without permission, or be held responsible to law.
|
|
||||||
*/
|
|
||||||
package com.jeesite.test;
|
|
||||||
|
|
||||||
import com.jeesite.common.collect.ListUtils;
|
|
||||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
|
||||||
import com.jeesite.modules.FastApplication;
|
|
||||||
import com.jeesite.modules.test.dao.TestDataDao;
|
|
||||||
import com.jeesite.modules.test.entity.TestData;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入测试
|
|
||||||
* @author ThinkGem
|
|
||||||
* @version 2019年10月28日
|
|
||||||
*/
|
|
||||||
@ActiveProfiles("test")
|
|
||||||
@SpringBootTest(classes = FastApplication.class)
|
|
||||||
public class InsertBatchTest extends BaseSpringContextTests {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TestDataDao testDataDao;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testData() throws Exception{
|
|
||||||
List<TestData> list = ListUtils.newArrayList();
|
|
||||||
for(int i=0; i<5000; i++){
|
|
||||||
TestData testData = new TestData();
|
|
||||||
testData.setTestInput("test"+i);
|
|
||||||
list.add(testData);
|
|
||||||
}
|
|
||||||
testDataDao.insertBatch(list, null);
|
|
||||||
list = testDataDao.findList(new TestData());
|
|
||||||
System.out.println("insert: " + list.size());
|
|
||||||
long count = testDataDao.updateBatch(list, null);
|
|
||||||
System.out.println("update: " + count);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
||||||
* No deletion without permission, or be held responsible to law.
|
|
||||||
*/
|
|
||||||
package com.jeesite.test;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
|
||||||
|
|
||||||
import com.jeesite.common.collect.ListUtils;
|
|
||||||
import com.jeesite.common.idgen.IdGen;
|
|
||||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
|
||||||
import com.jeesite.modules.FastApplication;
|
|
||||||
import com.jeesite.modules.test.entity.TestData;
|
|
||||||
import com.jeesite.modules.test.entity.TestDataChild;
|
|
||||||
import com.jeesite.modules.test.service.TestDataService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多数据源并发测试<br>
|
|
||||||
* 1、将 TestDataChildDao 的数据源设置为 ds2<br>
|
|
||||||
* 2、将 TestDataChild 的表名设置为 test_data_child2<br>
|
|
||||||
* 3、配置 ds2 数据源,并创建 test_data_child2 表
|
|
||||||
* @author ThinkGem
|
|
||||||
* @version 2019-6-26
|
|
||||||
*/
|
|
||||||
@ActiveProfiles("test")
|
|
||||||
@SpringBootTest(classes = FastApplication.class)
|
|
||||||
public class MultiDataSourceTest extends BaseSpringContextTests {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TestDataService testDataService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testData() throws Exception{
|
|
||||||
ExecutorService pool = Executors.newCachedThreadPool();
|
|
||||||
CountDownLatch latch = new CountDownLatch(10);
|
|
||||||
Runnable runnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try{
|
|
||||||
Thread.sleep(IdGen.randomInt(1000, 3000));
|
|
||||||
TestData testData = new TestData();
|
|
||||||
testData.setTestDataChildList(ListUtils.newArrayList(
|
|
||||||
new TestDataChild(), new TestDataChild(), new TestDataChild()));
|
|
||||||
testDataService.save(testData);
|
|
||||||
List<TestData> list = testDataService.findList(new TestData());
|
|
||||||
System.out.println("size: " + list.size());
|
|
||||||
list.forEach(e -> {
|
|
||||||
System.out.println("get: " + testDataService.get(e));
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println(e.getMessage());
|
|
||||||
} finally {
|
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for (int i = 0; i < latch.getCount(); i++) {
|
|
||||||
pool.execute(runnable);
|
|
||||||
}
|
|
||||||
latch.await();
|
|
||||||
pool.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user