package net.northking.cctp.element.database;

import com.alibaba.fastjson.JSONObject;
import net.northking.cctp.element.core.annotation.Autowired;
import net.northking.cctp.element.database.keywords.DatabaseTools;
import net.northking.cctp.element.test.AbstractLibraryTest;
import net.northking.cctp.element.test.SampleExecuteContext;
import net.northking.cctp.element.test.junit.LibraryJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RunWith(LibraryJUnit4ClassRunner.class)
public class DatabaseLibraryTest extends AbstractLibraryTest {

	//字符串小写转换
	@Test
	public void test() {
		DatabaseTools databaseTools=new DatabaseTools();
//		List<HashMap> mTmp= JSONObject.parseArray("", HashMap.class);
//		System.out.println(databaseTools.executeSQL(5, "172.16.77.26", "3306", "cctp_test_bug", "northking", "northking@002987", "select * from bug_management","#{aaa}",new SampleExecuteContext.Builder().build()));

		Map<String, Object> objectObjectHashMap = new HashMap<>();
		objectObjectHashMap.put("useSSL",false);
		objectObjectHashMap.put("allowMultiQueries",true);
		objectObjectHashMap.put("serverTimezone","Asia/Shanghai");
		objectObjectHashMap.put("useUnicode",true);
		objectObjectHashMap.put("characterEncoding","utf-8");
		System.out.println(databaseTools.executeSQL(1, "158.1.12.238", "3306", "atu_script_case",
				"cctp", "northking",
				"insert into atu_case_set_case_link(id,set_id,case_id) values('896','123','123')","224f6e97b3d5453f8f392997e625e65b",
				"777e064611ea44ad90996540faa2d559","1",objectObjectHashMap,
				"atu_script_case","${result}", "", new SampleExecuteContext.Builder().build()));
		// delete from atu_case_set_case_link_md where set_id ='beaf4eca2e51421d87f28dc1445db6bc'

	}

}