forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMongoDBOptions.java
More file actions
71 lines (55 loc) · 2.99 KB
/
MongoDBOptions.java
File metadata and controls
71 lines (55 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package sqlancer.mongodb;
import static sqlancer.mongodb.MongoDBOptions.MongoDBOracleFactory.QUERY_PARTITIONING;
import static sqlancer.mongodb.MongoDBOptions.MongoDBOracleFactory.REMOVE_REDUCE;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.beust.jcommander.Parameter;
import sqlancer.DBMSSpecificOptions;
import sqlancer.OracleFactory;
import sqlancer.common.oracle.CompositeTestOracle;
import sqlancer.common.oracle.TestOracle;
import sqlancer.mongodb.test.MongoDBQueryPartitioningWhereTester;
import sqlancer.mongodb.test.MongoDBRemoveReduceTester;
public class MongoDBOptions implements DBMSSpecificOptions<MongoDBOptions.MongoDBOracleFactory> {
@Parameter(names = "--test-validation", description = "Enable/Disable validation of schema with Schema Validation", arity = 1)
public boolean testValidation = true;
@Parameter(names = "--test-null-inserts", description = "Enables to test inserting with null values, validation has to be off", arity = 1)
public boolean testNullInserts;
@Parameter(names = "--test-random-types", description = "Insert random types instead of schema types, validation has to be off", arity = 1)
public boolean testRandomTypes;
@Parameter(names = "--max-number-indexes", description = "The maximum number of indexes used.", arity = 1)
public int maxNumberIndexes = 15;
@Parameter(names = "--test-computed-values", description = "Enable adding computed values to query", arity = 1)
public boolean testComputedValues;
@Parameter(names = "--test-with-regex", description = "Enable Regex Leaf Nodes", arity = 1)
public boolean testWithRegex;
@Parameter(names = "--test-with-count", description = "Count the number of documents and check with count command", arity = 1)
public boolean testWithCount;
@Parameter(names = "--null-safety", description = "", arity = 1)
public boolean nullSafety;
@Parameter(names = "--oracle")
public List<MongoDBOracleFactory> oracles = Arrays.asList(QUERY_PARTITIONING, REMOVE_REDUCE);
@Override
public List<MongoDBOracleFactory> getTestOracleFactory() {
return oracles;
}
public enum MongoDBOracleFactory implements OracleFactory<MongoDBProvider.MongoDBGlobalState> {
QUERY_PARTITIONING {
@Override
public TestOracle create(MongoDBProvider.MongoDBGlobalState globalState) throws Exception {
List<TestOracle> oracles = new ArrayList<>();
oracles.add(new MongoDBQueryPartitioningWhereTester(globalState));
return new CompositeTestOracle(oracles, globalState);
}
},
REMOVE_REDUCE {
@Override
public TestOracle create(MongoDBProvider.MongoDBGlobalState globalState) throws Exception {
List<TestOracle> oracles = new ArrayList<>();
oracles.add(new MongoDBRemoveReduceTester(globalState));
return new CompositeTestOracle(oracles, globalState);
}
}
}
}