-
Notifications
You must be signed in to change notification settings - Fork 119
Fix MongoDB query heuristic semantics #1750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
c293276
Add test cases for MongoDB semantics not reproduced by the heuristics…
LautaroPetaccio 80d5c69
Refactor `$all` heuristic evaluation for improved handling of edge ca…
jgaleotti 65fbb12
Enhance `$all` heuristic evaluation to handle null and scalar field e…
jgaleotti 82c0e7c
Add comprehensive bitmask support for MongoDB queries and operations
jgaleotti a07a0e3
Add `MongoUtils` utility for integral number handling; integrate with…
jgaleotti c435d3b
Refactor number comparison logic in Mongo heuristics to handle NaN ca…
jgaleotti 42ee0b5
Refactor heuristic calculation to support scalar-to-list comparisons;…
jgaleotti 16dfb46
Refactor `$nin` heuristic evaluation; re-enable and extend related te…
jgaleotti f99a982
Refactor heuristic evaluation logic for `$in` and `$nin` operations
jgaleotti b876be3
Refactor `$regex` heuristic evaluation to handle array fields
jgaleotti b499cdb
Refactor Mongo heuristic comparison to remove unsupported type checks…
jgaleotti 820b48c
Re-enable test for `$ne` between incomparable BSON types; remove outd…
jgaleotti 445e453
fix parsing logic for `$not` with multiple comparison operators
jgaleotti ca4d299
Refactor `$not` heuristic calculation; remove field existence check a…
jgaleotti ce4f804
Refactor `TrueOperation` to `EmptyOperation`; update query parsing lo…
jgaleotti 9282ade
Refactor heuristic calculation to handle arrays in comparison operations
jgaleotti 281b509
Merge remote-tracking branch 'origin/master' into fix_all_semantics
jgaleotti afe42f4
Add additional unit tests for Mongo heuristic operations and refactor…
jgaleotti eae56b1
Refactor Mongo heuristic calculations: extract helper class, simplify…
jgaleotti 617861e
Refactor Mongo heuristic calculations: extract helper class, simplify…
jgaleotti 236ab8e
Merge remote-tracking branch 'origin/master' into fix_all_semantics
jgaleotti be1815d
Rename methods in `MongoHeuristicsCalculatorHelper` for improved clar…
jgaleotti 9f73d5a
Merge branch 'master' into fix_all_semantics
LautaroPetaccio 02c4534
Add tests for Mongo semantics the heuristics calculator does not repr…
LautaroPetaccio 569aa59
Merge remote-tracking branch 'origin/master' into fix_all_semantics
jgaleotti 69c947a
Merge pull request #1762 from WebFuzzing/tests/mongo-heuristics-seman…
jgaleotti bba0b74
$mod with zero divisor is not accepted as a valid MongoDB query anymore.
jgaleotti 8791c29
evaluate $regex operation vs. an array checks that at least one eleme…
jgaleotti 3217b2f
remove //@Disabled
jgaleotti f48d59f
$eq checks for equality of List or elemens when comparing two lists.
jgaleotti e9ce235
$all semantics is re-implemented as an $and of $eq operations.
jgaleotti 49344be
refactor: left/right renamed to expected/actual
jgaleotti 01e1a82
refactor: renaming to follow semantics
jgaleotti 959df33
add support for parsing org.bson.types.Binary and org.bson.BsonBinary
jgaleotti 2549358
remove @Disabled for passing test
jgaleotti 7617de6
remove @Disabled for passing test
jgaleotti b48cc8a
add support of $eq and $ne comparisons among Binary values
jgaleotti f7b6c43
add TODO and exception message when $lte, $gte, $gt and $gte on byte[…
jgaleotti bce0256
$lte, $gte, $gt and $gte queries can accept null values / fix semanti…
jgaleotti 1646023
Merge remote-tracking branch 'origin/master' into fix_all_semantics
jgaleotti bdc1448
comparison operations for BsonRegularExpression data type
jgaleotti 848f00d
fix comparison to {"a": {"$not": /x/}}
jgaleotti 2ca76a5
fix semantics for $eq, $lte, $gt, $gte, $ne of documents
jgaleotti 0797c2e
fix semantics for $eq, $lte, $gt, $gte, $ne of ObjectIds
jgaleotti 640be3b
removed old semantics test case
jgaleotti 8daaddd
restore disabled test case
jgaleotti 42d72f5
support for $type operations with a list of types / support for "numb…
jgaleotti 747e5f1
fix test cases
jgaleotti aff379a
fix parsing of MongoDB queries. Now negative/fractional bitmasks are …
jgaleotti 5d15c36
fix parsing of $exists queries for non-boolean values (e.g. falsy and…
jgaleotti 4c20654
traverse documents only once (allows OneShotIterable)
jgaleotti ed35938
fixed issue with $comment
jgaleotti 92efc62
an $in operator matches a regex in the expected value
jgaleotti be05a10
fix $elemMatch within $all condition
jgaleotti 9d53c61
Merge remote-tracking branch 'origin/master' into fix_all_semantics
jgaleotti 5bbf6bb
added test case for $elemMatch within $all
jgaleotti d0a58bd
removed comments
jgaleotti 6fdafaf
Merge remote-tracking branch 'origin/master' into fix_all_semantics
jgaleotti 61ac4d3
specify visibility and documentation
jgaleotti c61e044
refactor moved utils to TruthnessUtils
jgaleotti d4e9c77
fix test case
jgaleotti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
973 changes: 319 additions & 654 deletions
973
...r/src/main/java/org/evomaster/client/java/controller/mongo/MongoHeuristicsCalculator.java
Large diffs are not rendered by default.
Oops, something went wrong.
656 changes: 656 additions & 0 deletions
656
...main/java/org/evomaster/client/java/controller/mongo/MongoHeuristicsCalculatorHelper.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 19 additions & 5 deletions
24
...er/src/main/java/org/evomaster/client/java/controller/mongo/operations/TypeOperation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,33 @@ | ||
| package org.evomaster.client.java.controller.mongo.operations; | ||
|
|
||
|
|
||
| import org.evomaster.client.java.controller.mongo.utils.BsonHelper; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Represent $type operation. | ||
| * Selects documents where the value of the field is an instance of the specified BSON type(s). | ||
| */ | ||
| public class TypeOperation extends QueryOperationWithField { | ||
| private final Object type; | ||
| private final List<Object> bsonTypes; | ||
|
|
||
| public TypeOperation(String fieldName, Object type) { | ||
| public TypeOperation(String fieldName, List<Object> bsonTypes) { | ||
| super(fieldName); | ||
| this.type = type; | ||
| Objects.requireNonNull(bsonTypes); | ||
| if (bsonTypes.isEmpty()) { | ||
| throw new IllegalArgumentException("BSON types list cannot be empty"); | ||
| } | ||
| for (Object type : bsonTypes) { | ||
| if (!BsonHelper.isBsonType(type)) { | ||
| throw new IllegalArgumentException("Invalid BSON type: " + type); | ||
| } | ||
| } | ||
| this.bsonTypes = bsonTypes; | ||
| } | ||
|
|
||
| public Object getType() { | ||
| return type; | ||
| public List<Object> getBsonTypes() { | ||
| return bsonTypes; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.