Exemplo n.º 1
0
/**
 * \brief initialize db
 */
int DelagentDBInit()
{
  char CMD[256];
  int rc;
 
  rc = create_db_repo_sysconf(0, "delagent");
  if (rc != 0)
  {
    printf("Database initialize ERROR!\n");
    DelagentClean();
    return -1;
  }
  DBConfFile = get_dbconf();

  memset(CMD, '\0', sizeof(CMD));
  //sprintf(CMD, "sh testInitDB.sh %s", get_db_name());
  sprintf(CMD, "sudo su postgres -c 'pg_restore -d %s ../testdata/testdb_all.tar'", get_db_name());
  printf("restore database command: %s\n", CMD);
  rc = system(CMD); 
  //if (rc != 0)
  //{
  //  printf("Database initialize ERROR!\n");
  //  DelagentClean();
  //  return -1; 
  //}

  return 0;
}
Exemplo n.º 2
0
/*
 * \brief  main test function
 */
int main( int argc, char *argv[] )
{
  create_db_repo_sysconf(1, "mimetype");
  DBConfFile = get_dbconf();

  int rc = focunit_main(argc, argv, "mimetype_Tests", suites) ;
  drop_db_repo_sysconf(get_db_name());
  return rc;
}
Exemplo n.º 3
0
int main(int argc, char** argv)
{

  fo_dbManager* dbManager = createTestEnvironment(AGENT_DIR, "ununpack", 1);
  if(!dbManager) {
    printf("Unable to connect to test database\n");
    return 1;
  }

  DBConfFile = get_dbconf();

  int rc = focunit_main(argc, argv, "ununpack_Tests", suites);
  dropTestEnvironment(dbManager, AGENT_DIR, "ununpack");
  return(rc);
}
Exemplo n.º 4
0
int main(int argc, char** argv) {
  fo_dbManager* dbManager = NULL;

  if (argc > 1) {
    dbConf = argv[1];
  } else {
    dbManager = createTestEnvironment("..", NULL, 0);
    dbConf = get_dbconf();
  }

  const int returnValue = focunit_main(argc, argv, "lib c Tests", suites);

  if (dbManager)
    dropTestEnvironment(dbManager, "..");
  return returnValue;
}
Exemplo n.º 5
0
/**
 * \brief initialize db
 */
int PkgagentDBInit()
{
  dbManager = createTestEnvironment(AGENT_DIR, "pkgagent", 1);
  DBConfFile = get_dbconf();
  return dbManager ? 0 : 1;
}