forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStoneDBOptions.java
More file actions
99 lines (89 loc) · 4.16 KB
/
Copy pathStoneDBOptions.java
File metadata and controls
99 lines (89 loc) · 4.16 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package sqlancer.stonedb;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import sqlancer.DBMSSpecificOptions;
import sqlancer.OracleFactory;
import sqlancer.common.oracle.CompositeTestOracle;
import sqlancer.common.oracle.TestOracle;
import sqlancer.stonedb.StoneDBOptions.StoneDBOracleFactory;
import sqlancer.stonedb.StoneDBProvider.StoneDBGlobalState;
import sqlancer.stonedb.oracle.StoneDBAggregateOracle;
import sqlancer.stonedb.oracle.StoneDBFuzzOracle;
import sqlancer.stonedb.oracle.StoneDBNoRECOracle;
import sqlancer.stonedb.oracle.StoneDBQueryPartitioningDistinctTester;
import sqlancer.stonedb.oracle.StoneDBQueryPartitioningGroupByTester;
import sqlancer.stonedb.oracle.StoneDBQueryPartitioningHavingTester;
import sqlancer.stonedb.oracle.StoneDBQueryPartitioningWhereTester;
@Parameters(separators = "=", commandDescription = "StoneDB (default host: " + StoneDBOptions.DEFAULT_HOST
+ ", default port: " + StoneDBOptions.DEFAULT_PORT + ")")
public class StoneDBOptions implements DBMSSpecificOptions<StoneDBOracleFactory> {
public static final String DEFAULT_HOST = "localhost";
public static final int DEFAULT_PORT = 3306;
@Parameter(names = "--test-8-version", description = "Let SQLancer test the StoneDB 8.0, otherwise, SQLancer will test the StoneDB 5.7", arity = 1)
public boolean test80Version = true;
@Parameter(names = "--oracle")
public List<StoneDBOracleFactory> oracles = List.of(StoneDBOracleFactory.NOREC);
public enum StoneDBOracleFactory implements OracleFactory<StoneDBGlobalState> {
FUZZER {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBFuzzOracle(globalState);
}
},
NOREC {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBNoRECOracle(globalState);
}
},
QUERY_PARTITIONING {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
List<TestOracle<StoneDBGlobalState>> oracles = new ArrayList<>();
oracles.add(new StoneDBQueryPartitioningWhereTester(globalState));
oracles.add(new StoneDBQueryPartitioningHavingTester(globalState));
oracles.add(new StoneDBAggregateOracle(globalState));
oracles.add(new StoneDBQueryPartitioningDistinctTester(globalState));
oracles.add(new StoneDBQueryPartitioningGroupByTester(globalState));
return new CompositeTestOracle<>(oracles, globalState);
}
},
HAVING {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBQueryPartitioningHavingTester(globalState);
}
},
WHERE {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBQueryPartitioningWhereTester(globalState);
}
},
GROUP_BY {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBQueryPartitioningGroupByTester(globalState);
}
},
AGGREGATE {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBAggregateOracle(globalState);
}
},
DISTINCT {
@Override
public TestOracle<StoneDBGlobalState> create(StoneDBGlobalState globalState) throws SQLException {
return new StoneDBQueryPartitioningDistinctTester(globalState);
}
}
}
@Override
public List<StoneDBOracleFactory> getTestOracleFactory() {
return oracles;
}
}