use crate::{database, rucmd};
use crate::rubase::BaseEntity;
use crate::rubase::rutils::fileutils;
use crate::rucfg;
use crate::rudi::difactroy::{difactroy, difactroy_init, rumulti, rusingle};
use crate::rudi::ditemplate::parsetemplate;
use crate::rudomain::rudb::dbdao::userdao;
use crate::rulog::rulog;
#[test]
fn test_01_f_commit() {
let ret = fileutils::read_file("./commit.bat");
rulog::info(ret.unwrap().as_str());
}
#[test]
fn test_02_f_cfg_test() {
let ret = fileutils::read_file("./tests/cfg_test.rs");
rulog::info(ret.unwrap().as_str());
}
#[test]
fn test_03_f_factroy() {
let ret = fileutils::read_file("./src/rudi/difactroy/difactroy.rs");
rulog::info(ret.unwrap().as_str());
}
#[test]
fn test_04_f_factroy() {
let cfg = rucfg::find_bean_ruconfig().unwrap();
println!("{}", cfg.config.lock().unwrap().software.logLevel);
}
#[test]
fn test_05_f_factroy() {
let template = parsetemplate::ParseTemplate::parse_template("hello world");
rulog::info(template.as_str());
}
#[test]
fn test_06_rusingle() {
let rs = rusingle::find_bean_rusingle().unwrap();
let ret = rs.execute();
crate::rulog::info(ret.as_str());
}
#[test]
fn test_07_rumulti() {
let rs = rumulti::find_bean_rumulti().unwrap();
let ret = rs.execute();
crate::rulog::info(ret.as_str());
}
#[test]
fn test_08_factroy() {
let ret = fileutils::read_file("./src/rudi/difactroy/dbisingle/dbisingle");
rulog::info(ret.unwrap().as_str());
}
fn test_09_build_single_file_name() {
let pt = parsetemplate::find_bean_pt().unwrap();
let template = pt.build_single_file_name("RuSingle");
rulog::info(template.as_str());
}
#[test]
fn test_10_build_single_name() {
let pt = parsetemplate::find_bean_pt().unwrap();
let template = pt.build_single_name("RuSingle");
rulog::info(template.as_str());
}
#[test]
fn test_11_list_all_files_rs() {
let files = fileutils::list_all_files_rs("./src");
for file in files {
rulog::info2("file:", file.as_str());
}
}
#[test]
fn test_12_parse_all_files() {
let mut diFacty = difactroy::DiFactroy::new();
diFacty.notShowExist = true;
diFacty.parse_all_files("./src");
for stru in diFacty.structs.lock().unwrap().iter() {
if diFacty.notShowExist && stru.existIniFile {
continue;
}
rulog::info2("struct file:===", stru.to_json().as_str());
}
}
#[test]
fn test_14_find_dirs() {
let files = fileutils::find_dir("./src", "ruenc");
for file in files {
rulog::info2("find_dirs:", file.to_str().unwrap());
}
}
#[test]
fn test_15_find_dirs() {
let files = fileutils::find_dir("C:\\Users\\leijmdas\\.cargo\\registry\\src", "rudi-0.8.3");
for file in files {
rulog::info2("find_dirs:", file.to_str().unwrap());
}
}
#[test]
fn test_17_parse_template_file() {
let template = parsetemplate::ParseTemplate::parse_template_file();
rulog::info2("parse_template_file:\r\n", template.as_str());
}
#[test]
fn test_19_parse_all_files() {
let diFacty = difactroy_init::find_bean_difactroy().unwrap();
diFacty.parse_all_files("./src");
for stru in diFacty.structs.lock().unwrap().iter() {
if diFacty.notShowExist && stru.existIniFile {
continue;
}
rulog::info2("struct file:===", stru.to_json().as_str());
}
}
#[test]
fn test_20() {
let db = database::find_bean_redisclient();
println!("{:?}", db);
if let Some(db) = database::find_bean_database() {
println!("{:?}", *db);
println!("{:?}", db);
}
}
#[test]
fn test_21_write_filemake_di_all() {
let ret = fileutils::write_file("e:/opt/1.txt", "dd");
println!("{:?}", ret);
assert!(ret.is_ok());
assert!(fileutils::check_file_exist("e:/opt/1.txt".to_string()));
}
#[test]
fn test_23_make_di_one() {
let diFacty = difactroy_init::find_bean_difactroy().unwrap();
let ret = diFacty.make_di_one("./src", "UsersDao");
println!("{:?}", ret);
}
#[test]
fn test_24_make_di_one() {
let diFacty = difactroy_init::find_bean_difactroy().unwrap();
let ret = diFacty.make_di_one("./src", "RedisClient");
println!("{:?}", ret);
}
#[test]
fn test_25_make_di_one() {
let dao = userdao::find_bean_userdao().unwrap();
let ret = dao.execute();
println!("{:?}", ret);
}
#[test]
fn test_26_make_di_force() {
let diFacty = difactroy_init::find_bean_difactroy().unwrap();
diFacty.make_di_force("./src");
}
#[test]
fn test_28_make_rucmd() {
let cmd = rucmd::find_bean_rucmd().unwrap();
cmd.test();
}
#[test]
fn test_29_make_di_all() {
let diFacty = difactroy_init::find_bean_difactroy().unwrap();
diFacty.make_di_all("./src");
}
#[test]
fn test_31_list_di_default() {
let diFacty = difactroy_init::find_bean_difactroy().unwrap();
diFacty.list_di_default( );
}