mirror of
https://github.com/Geniusay/ChopperBot.git
synced 2026-05-28 00:55:01 +08:00
斗鱼录播初步完成
This commit is contained in:
@@ -1,123 +1,123 @@
|
||||
package org.example.cache;
|
||||
|
||||
import org.example.constpool.GlobalFileCache;
|
||||
import org.example.pojo.Student;
|
||||
import org.example.pojo.configfile.ChopperBotConfigFile;
|
||||
import org.example.exception.FileCacheException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
* @author Genius
|
||||
* @date 2023/04/24 03:30
|
||||
**/
|
||||
|
||||
public class FileCacheTest {
|
||||
static FileCache cache;
|
||||
|
||||
static{
|
||||
|
||||
try {
|
||||
cache = new FileCache<>(
|
||||
new CommonConfigFile(
|
||||
"E:\\Project\\ChopperBot\\FileModule\\src\\main\\resources\\",
|
||||
"test.json",
|
||||
new ConcurrentLinkedQueue<Student>()
|
||||
)
|
||||
);
|
||||
FileCacheManagerInstance.getInstance().addFileCache(cache);
|
||||
} catch (FileCacheException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestFileCache() throws FileCacheException, InterruptedException {
|
||||
ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
|
||||
FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
manager.start();
|
||||
Thread.sleep(500000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestFileCacheManager() throws FileCacheException, InterruptedException {
|
||||
ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
manager.start();
|
||||
Thread.sleep(500000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestGet() throws FileCacheException, InterruptedException {
|
||||
ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
|
||||
FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
manager.start();
|
||||
|
||||
fileCache.append(1,"barrage","src");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestAppend() throws FileCacheException, InterruptedException {
|
||||
FileCacheManagerInstance.getInstance().start();
|
||||
//追加数组的某个元素
|
||||
for(int i=0;i<10;i++){
|
||||
GlobalFileCache.ModuleSrcConfigFile.append(i,"sectionwork","src","0");
|
||||
}
|
||||
//追加数组
|
||||
for(int i=0;i<10;i++){
|
||||
GlobalFileCache.ModuleSrcConfigFile.append(i,"sectionwork","src","-1");
|
||||
}
|
||||
//追加类中的元素
|
||||
for(int i=0;i<10;i++){
|
||||
GlobalFileCache.ModuleSrcConfigFile.append(i,"barrage","src");
|
||||
}
|
||||
Thread.sleep(500000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestWrite() throws FileCacheException,InterruptedException{
|
||||
FileCacheManagerInstance.getInstance().start();
|
||||
//更改数组元素
|
||||
for(int i=0;i<10;i++){
|
||||
GlobalFileCache.ModuleSrcConfigFile.writeKeys(i,"sectionwork","src","0");
|
||||
}
|
||||
//追加数组
|
||||
for(int i=0;i<10;i++){
|
||||
GlobalFileCache.ModuleSrcConfigFile.writeKeys(i,"sectionwork","src","-1");
|
||||
}
|
||||
//更改类中的元素
|
||||
for(int i=0;i<10;i++){
|
||||
GlobalFileCache.ModuleSrcConfigFile.writeKeys(i,"barrage","src");
|
||||
}
|
||||
Thread.sleep(500000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestArrayAdd() throws InterruptedException, FileCacheException {
|
||||
ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
|
||||
FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
manager.start();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestAddCache() throws FileCacheException, InterruptedException {
|
||||
FileCacheManagerInstance.getInstance().start();
|
||||
|
||||
for(int i=0;i<10;i++){
|
||||
Student student = new Student(Integer.toString(i),i,"jsu"+i,"major"+i,null,null);
|
||||
cache.writeKeys(student,"-1");
|
||||
}
|
||||
Thread.sleep(500000);
|
||||
}
|
||||
|
||||
}
|
||||
//package org.example.cache;
|
||||
//
|
||||
//import org.example.constpool.GlobalFileCache;
|
||||
//import org.example.pojo.Student;
|
||||
//import org.example.pojo.configfile.ChopperBotConfigFile;
|
||||
//import org.example.exception.FileCacheException;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
//
|
||||
///**
|
||||
// * @author Genius
|
||||
// * @date 2023/04/24 03:30
|
||||
// **/
|
||||
//
|
||||
//public class FileCacheTest {
|
||||
// static FileCache cache;
|
||||
//
|
||||
// static{
|
||||
//
|
||||
// try {
|
||||
// cache = new FileCache<>(
|
||||
// new CommonConfigFile(
|
||||
// "E:\\Project\\ChopperBot\\FileModule\\src\\main\\resources\\",
|
||||
// "test.json",
|
||||
// new ConcurrentLinkedQueue<Student>()
|
||||
// )
|
||||
// );
|
||||
// FileCacheManagerInstance.getInstance().addFileCache(cache);
|
||||
// } catch (FileCacheException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestFileCache() throws FileCacheException, InterruptedException {
|
||||
// ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
// FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
//
|
||||
// FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
// manager.start();
|
||||
// Thread.sleep(500000);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestFileCacheManager() throws FileCacheException, InterruptedException {
|
||||
// ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
// FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
// FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
// manager.start();
|
||||
// Thread.sleep(500000);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestGet() throws FileCacheException, InterruptedException {
|
||||
// ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
// FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
//
|
||||
// FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
// manager.start();
|
||||
//
|
||||
// fileCache.append(1,"barrage","src");
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestAppend() throws FileCacheException, InterruptedException {
|
||||
// FileCacheManagerInstance.getInstance().start();
|
||||
// //追加数组的某个元素
|
||||
// for(int i=0;i<10;i++){
|
||||
// GlobalFileCache.ModuleSrcConfigFile.append(i,"sectionwork","src","0");
|
||||
// }
|
||||
// //追加数组
|
||||
// for(int i=0;i<10;i++){
|
||||
// GlobalFileCache.ModuleSrcConfigFile.append(i,"sectionwork","src","-1");
|
||||
// }
|
||||
// //追加类中的元素
|
||||
// for(int i=0;i<10;i++){
|
||||
// GlobalFileCache.ModuleSrcConfigFile.append(i,"barrage","src");
|
||||
// }
|
||||
// Thread.sleep(500000);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestWrite() throws FileCacheException,InterruptedException{
|
||||
// FileCacheManagerInstance.getInstance().start();
|
||||
// //更改数组元素
|
||||
// for(int i=0;i<10;i++){
|
||||
// GlobalFileCache.ModuleSrcConfigFile.writeKeys(i,"sectionwork","src","0");
|
||||
// }
|
||||
// //追加数组
|
||||
// for(int i=0;i<10;i++){
|
||||
// GlobalFileCache.ModuleSrcConfigFile.writeKeys(i,"sectionwork","src","-1");
|
||||
// }
|
||||
// //更改类中的元素
|
||||
// for(int i=0;i<10;i++){
|
||||
// GlobalFileCache.ModuleSrcConfigFile.writeKeys(i,"barrage","src");
|
||||
// }
|
||||
// Thread.sleep(500000);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestArrayAdd() throws InterruptedException, FileCacheException {
|
||||
// ChopperBotConfigFile chopperBotConfigFile = new ChopperBotConfigFile();
|
||||
// FileCache fileCache = new FileCache(chopperBotConfigFile);
|
||||
//
|
||||
// FileCacheManager manager = new FileCacheManager(List.of(fileCache));
|
||||
// manager.start();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void TestAddCache() throws FileCacheException, InterruptedException {
|
||||
// FileCacheManagerInstance.getInstance().start();
|
||||
//
|
||||
// for(int i=0;i<10;i++){
|
||||
// Student student = new Student(Integer.toString(i),i,"jsu"+i,"major"+i,null,null);
|
||||
// cache.writeKeys(student,"-1");
|
||||
// }
|
||||
// Thread.sleep(500000);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user