int main(int argc, char **argv) { //Doing preparation for the tests. string configFile(string(getenv("srch2_config_file")) + "/conf.xml"); CoreInfo_t* indexDataConfig = NULL; stringstream log_str; ConfigManager * conf = new ConfigManager(configFile); if (!conf->loadConfigFile()) { Logger::error("Error in loading the config file, therefore exiting."); exit(-1); } //Get indexDataConfig from the core for (ConfigManager::CoreInfoMap_t::const_iterator iterator = conf->coreInfoIterateBegin(); iterator != conf->coreInfoIterateEnd(); iterator++) { indexDataConfig = const_cast<CoreInfo_t *>(conf->getCoreInfo( iterator->second->getName())); } //Create schema based on the config file. Schema * schema = JSONRecordParser::createAndPopulateSchema( indexDataConfig); Record * record = new srch2is::Record(schema); //Create stored schema for the test function Schema * storedSchema = Schema::create(); RecordSerializerUtil::populateStoredSchema(storedSchema, schema); srch2::util::RecordSerializer recSerializer = RecordSerializer( *storedSchema); string jsonRecord; testCorrectRecord(indexDataConfig, recSerializer, record); testOnlyId(indexDataConfig, recSerializer, record); testOnlyIdTitle(indexDataConfig, recSerializer, record); testIntYear(indexDataConfig, recSerializer, record); testIdText(indexDataConfig, recSerializer, record); testIntBadYear(indexDataConfig, recSerializer, record); testEmptyYear(indexDataConfig, recSerializer, record); testTextBadYear(indexDataConfig, recSerializer, record); testTextBadYear2(indexDataConfig, recSerializer, record); testTextEmptyYear(indexDataConfig, recSerializer, record); testNoYear(indexDataConfig, recSerializer, record); testIntBadId(indexDataConfig, recSerializer, record); testIntBadId2(indexDataConfig, recSerializer, record); testIntEmptyId(indexDataConfig, recSerializer, record); testTextEmptyId(indexDataConfig, recSerializer, record); testTextBadId(indexDataConfig, recSerializer, record); testTextBadId2(indexDataConfig, recSerializer, record); testNoId(indexDataConfig, recSerializer, record); testNoTitle(indexDataConfig, recSerializer, record); testEmptyTitle1(indexDataConfig, recSerializer, record); testEmptyTitle2(indexDataConfig, recSerializer, record); testNULLTitle(indexDataConfig, recSerializer, record); testnullTitle(indexDataConfig, recSerializer, record); testEmptyGenre1(indexDataConfig, recSerializer, record); testEmptyGenre2(indexDataConfig, recSerializer, record); testNoGenre(indexDataConfig, recSerializer, record); testNULLGenre(indexDataConfig, recSerializer, record); testnullGenre(indexDataConfig, recSerializer, record); afterTest(conf, record, schema, storedSchema); return 0; }