46 PGresult *result = NULL;
50 memset(
SQL,
'\0',1024);
52 "CREATE TABLE uploadtree"
53 " (uploadtree_pk SERIAL, parent integer, realparent integer, upload_fk integer, pfile_fk integer, ufile_mode integer,"
54 " lft integer, rgt integer, ufile_name text);"
59 printf(
"Create uploadtree ERROR!\n");
64 memset(
SQL,
'\0',1024);
67 " (upload_pk SERIAL, upload_desc text, upload_filename text, user_fk integer, upload_mode integer,"
68 " upload_ts timestamp with time zone DEFAULT now(), pfile_fk integer, upload_origin text,"
69 " uploadtree_tablename character varying(18) DEFAULT 'uploadtree_a'::character varying, expire_date date,"
70 " expire_action character(1), public_perm integer);"
75 printf(
"Create uploadtree ERROR!\n");
80 memset(
SQL,
'\0',1024);
83 " (pfile_pk SERIAL, pfile_md5 character(32), pfile_sha1 character(40), pfile_size bigint, pfile_mimetypefk integer);"
88 printf(
"Create pfile ERROR!\n");
93 memset(
SQL,
'\0',1024);
94 sprintf(
SQL,
"%s",
"CREATE TABLE mimetype (mimetype_pk SERIAL, mimetype_name text);");
98 printf(
"Create mimetype ERROR!\n");
103 memset(
SQL,
'\0',1024);
105 "INSERT INTO public.mimetype (mimetype_pk, mimetype_name) VALUES"
106 " (2, 'application/gzip'), (3, 'application/x-gzip'), (4, 'application/x-compress'), (5, 'application/x-bzip'),"
107 " (6, 'application/x-bzip2'), (7, 'application/x-upx'), (8, 'application/pdf'), (9, 'application/x-pdf'),"
108 " (10, 'application/x-zip'), (11, 'application/zip'), (12, 'application/x-tar'), (13, 'application/x-gtar'),"
109 " (14, 'application/x-cpio'), (15, 'application/x-rar'), (16, 'application/x-cab'), (17, 'application/x-7z-compressed'),"
110 " (18, 'application/x-7z-w-compressed'), (19, 'application/x-rpm'), (20, 'application/x-archive'),"
111 " (21, 'application/x-debian-package'), (22, 'application/x-iso'), (23, 'application/x-iso9660-image'),"
112 " (24, 'application/x-fat'), (25, 'application/x-ntfs'), (26, 'application/x-ext2'), (27, 'application/x-ext3'),"
113 " (28, 'application/x-x86_boot'), (29, 'application/x-debian-source'), (30, 'application/x-xz'), (31, 'application/jar'),"
114 " (32, 'application/java-archive'), (33, 'application/x-dosexec'), (34, 'text/plain');"
119 printf(
"Insert mimetype ERROR!\n");
128 int main(
int argc,
char *argv[] )
152 dbManager = createTestEnvironment(AGENT_DIR,
"mimetype", 0);
155 const int returnValue = focunit_main(argc, argv,
"mimetype_Tests",
suites);
156 if (returnValue == 0) {
157 dropTestEnvironment(
dbManager, AGENT_DIR,
"mimetype");
159 printf(
"preserving test environment in '%s'\n",
get_sysconfdir());
char SQL[256]
SQL query to execute.
PGconn * pgConn
Database connection.
int main(int argc, char *argv[])
main test function
CU_SuiteInfo suites[]
all test suites for delagent
char * get_dbconf()
get Db.conf path just created by create_db_repo_sysconf()
char * get_sysconfdir()
get sysconfig dir path just created by create_db_repo_sysconf()
PGconn * fo_dbconnect(char *DBConfFile, char **ErrorBuf)
Connect to a database. The default is Db.conf.
int fo_checkPQcommand(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres commands (not select) If an error occured, write the error to s...
fo_dbManager * dbManager
fo_dbManager object
int DBCheckMimeClean()
Clean the env.
int DBCheckMimeInit()
Initialize DB.
CU_TestInfo testcases_DBCheckMime[]
testcases for function DBCheckMime
CU_TestInfo testcases_DBFindMime[]
testcases for function DBFindMime
int DBFindMimeInit()
initialize
int DBFindMimeClean()
clean the env
int DBLoadMimeClean()
clean the env
int DBLoadMimeInit()
initialize DB
CU_TestInfo testcases_DBLoadMime[]
testcases for function DBLoadGold
char * DBConfFile
DB conf file location.
int DBInit()
initialize DB
CU_TestInfo testcases_DBCheckFileExtention[]
testcases for function DBCheckFileExtention
CU_TestInfo testcases_Utilities[]
testcases for function GetFieldValue
int DBClean()
clean the env
CU_TestInfo testcases_CheckMimeTypes[]
testcases for function CheckMimeTypes