/* **************************************************************************** * * setupDatabase - * * This function (which is called before every test) cleans the database */ void setupDatabase(void) { DBClientBase* connection = NULL; static bool mongoStarted = false; /* mongoStart is needed one time to create the connection pool */ if (mongoStarted == false) { /* In fact, the mongoStart() parameters related with the pool, e.g. pool size, are irrelevant, * given that the connection creation is mocked under UNIT_TEST in the mongoBackend library */ mongoStart("localhost", "", "", "", "", false, 0, 10); mongoStarted = true; } connection = getMongoConnection(); connection->dropCollection(REGISTRATIONS_COLL); connection->dropCollection(ENTITIES_COLL); connection->dropCollection(SUBSCRIBECONTEXT_COLL); connection->dropCollection(SUBSCRIBECONTEXTAVAIL_COLL); setDbPrefix(DBPREFIX); setRegistrationsCollectionName("registrations"); setEntitiesCollectionName("entities"); setSubscribeContextCollectionName("csubs"); setSubscribeContextAvailabilityCollectionName("casubs"); }