ISPN-3442 fix and tests added for Query API DSL

See: https://issues.jboss.org/browse/ISPN-3442

Also added tests for Query API DSL to increase code coverage.