package minsecurity.identity.sqlite; import minsecurity.identity.persist.sqlite.Sqlite; import minsecurity.identity.persist.sqlite.SqliteUtil; import org.junit.Test; import static org.junit.Assert.assertFalse; public class SqliteTest { @Test public void testHome(){ System.out.println(SqliteUtil.home()); assertFalse(SqliteUtil.pathExists("/aaa/1.txt")); } @Test public void TestSqliteOpen(){ try{ Sqlite.getInstance().openDefault(); boolean res = SqliteUtil.pathExists("/home/zhengqi/min/identity/identity.db"); if (!res){ throw new Exception("no target db file!!"); } String homePath = SqliteUtil.home(); String filePath = homePath + "/test/"; Sqlite.getInstance().open(filePath); boolean res1 = SqliteUtil.pathExists("/home/zhengqi/test/identity.db"); if (!res1){ throw new Exception("no target db file!!"); } }catch (Exception ex){ System.out.println(ex.getMessage()); } } @Test public void TestSqliteSetPasswd(){ try{ String newPasswd = "1DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99"; Sqlite.getInstance().setPasswd(newPasswd); Sqlite.getInstance().open("/home/zhengqi/min/identity/"); // Sqlite.getInstance().getConn(); }catch (Exception ex){ System.out.println(ex.getMessage()); } } }