Permalink
Browse files

added test for get* methods

made graphdb reload conf after checking if vertex and edge classes are in place
  • Loading branch information...
1 parent 3fdc84a commit 8261025cee9b30694e87237468e064cfbd3f943d @ffissore ffissore committed Jun 12, 2012
Showing with 24 additions and 1 deletion.
  1. +5 −1 lib/orientdb/graphdb.js
  2. +14 −0 test/db_open_close.js
  3. +5 −0 test/graph.js
View
@@ -52,7 +52,11 @@ function checkForGraphSchema(self, callback) {
checkVertexClass(function(err) {
if (err) { return callback(err); }
- checkClassWithShortName("edgeClass", EDGE_CLASS_NAME, "E", callback);
+ checkClassWithShortName("edgeClass", EDGE_CLASS_NAME, "E", function(err) {
+ if (err) { return callback(err); }
+
+ self.reload(callback);
+ });
});
});
}
View
@@ -29,6 +29,20 @@ db.open(function(err) {
// cluster name case should not matter
assert.equal(4, db.getClusterByName("OuSeR").id);
+ assert.equal("internal", db.getClusterById(0).name);
+ assert.equal("ouser", db.getClusterById(4).name);
+ assert.equal("MEMORY", db.getClusterById(4).type);
+
+ assert.equal("OUser", db.getClassByName("OUser").name);
+ assert.equal(null, db.getClassByName("ouser"));
+
+ assert.equal("ouser", db.getClusterByClass("OUser").name);
+ assert.equal("MEMORY", db.getClusterByClass("OUser").type);
+ assert.equal(null, db.getClusterByClass("ouser"));
+
+ //memory storage doesn't have data segments
+ assert.equal(null, db.getDataSegmentById(1));
+
db.close(function(err) {
assert(!err, "Error while closing the database: " + err);
View
@@ -41,6 +41,11 @@ graphdb.open(function(err) {
assert(!err, "Error while opening the database: " + err);
+ assert.equal("OGraphVertex", graphdb.getClassByName("OGraphVertex").name);
+ assert.equal("OGraphVertex", graphdb.getClassByName("V").name);
+ assert.equal("OGraphEdge", graphdb.getClassByName("OGraphEdge").name);
+ assert.equal("OGraphEdge", graphdb.getClassByName("E").name);
+
createVertexes(graphdb, function(rootNode, childNode) {
graphdb.getOutEdges(rootNode, function(err, outEdges) {
assert(!err);

0 comments on commit 8261025

Please sign in to comment.