Fixed issue #2899, created also new test cases
Merge branch 'develop' of https://github.com/orientechnologies/orientdb into develop