use of org.neo4j.kernel.impl.core.NodeManager in project graphdb by neo4j-attic.
the class TestNeo4j method testIdUsageInfo.
// private static enum RelTypes implements RelationshipType
// {
// ONE_MORE_RELATIONSHIP;
// }
// TODO: fix this testcase
@Test
public void testIdUsageInfo() {
GraphDbModule graphDbModule = ((EmbeddedGraphDatabase) getGraphDb()).getConfig().getGraphDbModule();
NodeManager nm = graphDbModule.getNodeManager();
long nodeCount = nm.getNumberOfIdsInUse(Node.class);
long relCount = nm.getNumberOfIdsInUse(Relationship.class);
if (nodeCount > nm.getHighestPossibleIdInUse(Node.class)) {
// fail( "Node count greater than highest id " + nodeCount );
}
if (relCount > nm.getHighestPossibleIdInUse(Relationship.class)) {
// fail( "Rel count greater than highest id " + relCount );
}
// assertTrue( nodeCount <= nm.getHighestPossibleIdInUse( Node.class )
// );
// assertTrue( relCount <= nm.getHighestPossibleIdInUse(
// Relationship.class ) );
Node n1 = nm.createNode();
Node n2 = nm.createNode();
Relationship r1 = n1.createRelationshipTo(n2, MyRelTypes.TEST);
// assertEquals( nodeCount + 2, nm.getNumberOfIdsInUse( Node.class ) );
// assertEquals( relCount + 1, nm.getNumberOfIdsInUse(
// Relationship.class ) );
r1.delete();
n1.delete();
n2.delete();
// must commit for ids to be reused
try {
getTransaction().success();
getTransaction().finish();
} catch (Exception e) {
fail("" + e);
}
// assertEquals( nodeCount, nm.getNumberOfIdsInUse( Node.class ) );
// assertEquals( relCount, nm.getNumberOfIdsInUse( Relationship.class )
// );
setTransaction(getGraphDb().beginTx());
}
Aggregations