Commit 64bac8ee authored by Stanley Clark's avatar Stanley Clark Committed by Stanley Clark
Browse files

Added possibility to turn off access control

parent ec79c293
......@@ -19,8 +19,10 @@ public class Main {
get("/time", (Request request, Response response) -> {
RequestProps rp = new RequestProps(request);
String[] headers = {"case", "num_results", "user_id", "ra", "apriori", "plan", "expand", "string", "db"};
TestSuite testSuite = new TestSuite(new Pipeline(rp.getUserIds()), headers, rp.getQueries(), rp.getNumTrials());
String[] headers = {"case", "num_results", "user_id", "ra", "apriori", "plan", "expand", "string", "db", "ac"};
TestSuite testSuite = new TestSuite(
new Pipeline(rp.getUserIds(), rp.accessControlEnabled()), headers, rp.getQueries(), rp.getNumTrials()
);
testSuite.run();
return "";
});
......
......@@ -17,6 +17,7 @@ public class RequestProps {
private int queryNum = 0;
private List<Integer> queries;
private int numTrials = 0;
private boolean enableAccessControl = true;
RequestProps(Request request) {
if (request.queryParams("userId") != null) {
......@@ -44,6 +45,10 @@ public class RequestProps {
if (request.queryParams("numTrials") != null) {
numTrials = Integer.parseInt(request.queryParams("numTrials"));
}
if (request.queryParams("enableAccessControl") != null) {
enableAccessControl = Boolean.parseBoolean(request.queryParams("enableAccessControl"));
}
}
private String getQuery() {
......@@ -70,4 +75,8 @@ public class RequestProps {
public int getNumTrials() {
return numTrials;
}
public boolean accessControlEnabled() {
return enableAccessControl;
}
}
......@@ -16,9 +16,11 @@ public class Pipeline implements IQueryRun {
private int userId;
private final List<Integer> userIds;
private final boolean enableAC;
public Pipeline(List<Integer> userIds) {
public Pipeline(List<Integer> userIds, boolean enableAC) {
this.userIds = userIds;
this.enableAC = enableAC;
}
/**
......@@ -45,14 +47,19 @@ public class Pipeline implements IQueryRun {
}
}
/** * Run a query pipeline once.
/**
* Run a query pipeline once.
*
* @param testSuite The test suite to use
*/
public void runN(TestSuite testSuite) {
Middleware mw = TestSuite.getMiddleware(new Environment(userId), rules).reset(sql);
testSuite.time("ra", mw::buildRaTree);
testSuite.time("apriori", mw::makeApriori);
if (enableAC) {
testSuite.time("apriori", mw::makeApriori);
}
testSuite.time("plan", mw::plan);
testSuite.time("expand", mw::expandSecRaOperators);
testSuite.time("string", mw::genPostgresPlan);
......@@ -88,5 +95,6 @@ public class Pipeline implements IQueryRun {
public void addRunNProps(TestSuite testSuite) {
testSuite.addEntry("case", Integer.toString(caseNum));
testSuite.addEntry("user_id", Integer.toString(userId));
testSuite.addEntry("ac_enabled", Boolean.toString(enableAC));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment