Skip to content

Commit

Permalink
Merge pull request #117 from AO-StreetArt/dbTestingFixes
Browse files Browse the repository at this point in the history
Db testing fixes
  • Loading branch information
AO-StreetArt committed Mar 11, 2018
2 parents f4f8c4a + 8837901 commit d79b940
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion aossl/mongo/mongo_admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ void MongoConnectionPool::init_connections(std::string conn_str, \
}

MongoConnectionPool::~MongoConnectionPool() {
for (int i = 0; i < connections.size(); i++) {
for (unsigned int i = 0; i < connections.size(); i++) {
// Release the connection
mongoc_client_destroy(connections[i].connection);
}
Expand Down
2 changes: 1 addition & 1 deletion aossl/neo4j/include/neo4j_connection_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Neo4jConnectionPool : public AOSSL::ConnectionPoolInterface {

// Destructor
inline ~Neo4jConnectionPool() {
for (int i = 0; i < current_max_connection; i++) {
for (unsigned int i = 0; i < connections.size(); i++) {
// Release the connection
neo4j_close(connections[i].connection);
}
Expand Down
84 changes: 42 additions & 42 deletions aossl/neo4j/neo4j_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ int path_test() {
delete setup_result2;
delete setup_results2;

setup_results3 = neo->execute(setup_query2);
setup_results3 = neo->execute(setup_query3);
if (!setup_results3) return -1;
ResultTreeInterface* setup_result3 = setup_results3->next();
if (!setup_result3) assert(false);
Expand All @@ -422,47 +422,47 @@ int path_test() {
if (!results) return -1;

// Access the results
// std::cout << "Access Results" << std::endl;
// ResultTreeInterface* result = results->next();
// if (!result) assert(false);
// DbObjectInterface* path = result->get(0);
// std::cout << "Object Retrieved" << std::endl;
// assert(path->is_path());
// assert(path->size() == 5);
// for (int i = 0; i < 5; i++) {
// DbObjectInterface* path_obj = path->get_path_element(i);
// std::cout << path_obj->to_string() << std::endl;
// // Generic Tests
// if (i % 2 == 0) {
// std::cout << "Testing Node " << i << std::endl;
// assert(path_obj->is_node());
// DbListInterface* label_list = path_obj->labels();
// assert(label_list->get_string_element(0) == "CoordinateSystem");
// delete label_list;
// } else {
// std::cout << "Testing Edge " << i << std::endl;
// assert(path_obj->is_edge());
// assert(path_obj->type() == "Transform");
// assert(path_obj->forward());
// }
// // Properties Tests
// DbMapInterface* map = path_obj->properties();
// if (i == 0) {
// assert(map->element_exists("name"));
// assert(map->get_string_element("name") == "1");
// } else if (i == 2) {
// assert(map->element_exists("name"));
// assert(map->get_string_element("name") == "2");
// } else if (i == 4) {
// assert(map->element_exists("name"));
// assert(map->get_string_element("name") == "3");
// }
// delete map;
// delete path_obj;
// }
//
// delete path;
// delete result;
std::cout << "Access Results" << std::endl;
ResultTreeInterface* result = results->next();
if (!result) assert(false);
DbObjectInterface* path = result->get(0);
std::cout << "Object Retrieved" << std::endl;
assert(path->is_path());
assert(path->size() == 5);
for (int i = 0; i < 5; i++) {
DbObjectInterface* path_obj = path->get_path_element(i);
std::cout << path_obj->to_string() << std::endl;
// Generic Tests
if (i % 2 == 0) {
std::cout << "Testing Node " << i << std::endl;
assert(path_obj->is_node());
DbListInterface* label_list = path_obj->labels();
assert(label_list->get_string_element(0) == "CoordinateSystem");
delete label_list;
} else {
std::cout << "Testing Edge " << i << std::endl;
assert(path_obj->is_edge());
assert(path_obj->type() == "Transform");
assert(path_obj->forward());
}
// Properties Tests
DbMapInterface* map = path_obj->properties();
if (i == 0) {
assert(map->element_exists("name"));
assert(map->get_string_element("name") == "1");
} else if (i == 2) {
assert(map->element_exists("name"));
assert(map->get_string_element("name") == "2");
} else if (i == 4) {
assert(map->element_exists("name"));
assert(map->get_string_element("name") == "3");
}
delete map;
delete path_obj;
}

delete path;
delete result;
delete results;
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion aossl/redis/redis_admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void RedisConnectionPool::init_connections(const char * conn_str, \

// Clean up the connection pool
RedisConnectionPool::~RedisConnectionPool() {
for (int i = 0; i < current_max_connection; i++) {
for (unsigned int i = 0; i < connections.size(); i++) {
// Free the redis instance
if (connections[i].connection) {
redisFree(connections[i].connection);
Expand Down

0 comments on commit d79b940

Please sign in to comment.