mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-03 09:14:01 +00:00
test[storage]: test unit
This commit is contained in:
1 parent
6476e0b4bb
commit
68a64d0e0e
2 files changed
+10
-6
No files matched your search
@@ -13,11 +13,13 @@
|
||||
package com.zfoo.boot;
|
||||
|
||||
import com.zfoo.boot.resource.StudentResource;
|
||||
import com.zfoo.protocol.ProtocolManager;
|
||||
import com.zfoo.protocol.generate.GenerateOperation;
|
||||
import com.zfoo.protocol.serializer.CodeLanguage;
|
||||
import com.zfoo.protocol.util.JsonUtils;
|
||||
import com.zfoo.storage.StorageContext;
|
||||
import com.zfoo.storage.model.config.StorageConfig;
|
||||
import com.zfoo.storage.model.vo.Storage;
|
||||
import com.zfoo.util.ThreadUtils;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
@@ -48,6 +50,7 @@ public class StorageTest {
|
||||
config.setScanPackage("com.zfoo.boot");
|
||||
config.setResourceLocation("classpath:/excel");
|
||||
config.setWriteable(true);
|
||||
config.setRecycle(false);
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -56,12 +59,17 @@ public class StorageTest {
|
||||
var springBoot = new SpringApplicationBuilder();
|
||||
springBoot.sources(StorageTest.class).web(WebApplicationType.NONE).run();
|
||||
|
||||
var protocols = StorageContext.getStorageManager().storageMap().keySet();
|
||||
|
||||
var operation = new GenerateOperation();
|
||||
operation.getGenerateLanguages().add(CodeLanguage.GdScript);
|
||||
ProtocolManager.initProtocolAuto(protocols, operation);
|
||||
|
||||
var storage = (Storage<Integer, StudentResource>) StorageContext.getStorageManager().getStorage(StudentResource.class);
|
||||
for (StudentResource resource : storage.getAll()) {
|
||||
logger.info(JsonUtils.object2String(resource));
|
||||
}
|
||||
|
||||
ThreadUtils.sleep(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user