Skip to content
Snippets Groups Projects
Commit 25432945 authored by Daniel's avatar Daniel
Browse files

DEBUG: Added more benchmarking.

parent 8cf03773
Branches
Tags
No related merge requests found
...@@ -415,6 +415,7 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac ...@@ -415,6 +415,7 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac
} }
public void parse() throws ParsingException { public void parse() throws ParsingException {
final long t1 = System.currentTimeMillis();
CQLLexer lexer; CQLLexer lexer;
lexer = new CQLLexer(CharStreams.fromString(this.query)); lexer = new CQLLexer(CharStreams.fromString(this.query));
final CommonTokenStream tokens = new CommonTokenStream(lexer); final CommonTokenStream tokens = new CommonTokenStream(lexer);
...@@ -434,6 +435,8 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac ...@@ -434,6 +435,8 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac
this.type = cq.t; this.type = cq.t;
this.filter = cq.filter; this.filter = cq.filter;
this.selections = cq.s; this.selections = cq.s;
final long t2 = System.currentTimeMillis();
addBenchmark("parse (" + this.query + ")", t2 - t1);
} }
private String executeStrategy() throws QueryException { private String executeStrategy() throws QueryException {
......
...@@ -83,7 +83,7 @@ public class ScriptingResource extends AbstractCaosDBServerResource { ...@@ -83,7 +83,7 @@ public class ScriptingResource extends AbstractCaosDBServerResource {
@Override @Override
protected Representation httpPostInChildClass(Representation entity) throws Exception { protected Representation httpPostInChildClass(Representation entity) throws Exception {
if(isAnonymous()) { if (isAnonymous()) {
throw ServerMessages.AUTHORIZATION_ERROR; throw ServerMessages.AUTHORIZATION_ERROR;
} }
MediaType mediaType = entity.getMediaType(); MediaType mediaType = entity.getMediaType();
...@@ -205,12 +205,12 @@ public class ScriptingResource extends AbstractCaosDBServerResource { ...@@ -205,12 +205,12 @@ public class ScriptingResource extends AbstractCaosDBServerResource {
public Object generateAuthToken() { public Object generateAuthToken() {
return SessionToken.generate((Principal) getUser().getPrincipal(), null); return SessionToken.generate((Principal) getUser().getPrincipal(), null);
} }
boolean isAnonymous() { boolean isAnonymous() {
boolean ret = getUser().hasRole(UserSources.ANONYMOUS_ROLE); boolean ret = getUser().hasRole(UserSources.ANONYMOUS_ROLE);
return ret; return ret;
} }
public int callScript( public int callScript(
List<String> commandLine, Integer timeoutMs, List<FileProperties> files, Object authToken) List<String> commandLine, Integer timeoutMs, List<FileProperties> files, Object authToken)
throws Message { throws Message {
......
...@@ -99,6 +99,7 @@ public class EntityResource extends AbstractCaosDBServerResource { ...@@ -99,6 +99,7 @@ public class EntityResource extends AbstractCaosDBServerResource {
throws ConnectionException, IOException, SQLException, CaosDBException, throws ConnectionException, IOException, SQLException, CaosDBException,
NoSuchAlgorithmException, Exception { NoSuchAlgorithmException, Exception {
final long t1 = System.currentTimeMillis();
if (!this.get) { if (!this.get) {
getResponse().setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); getResponse().setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
return null; return null;
...@@ -112,6 +113,10 @@ public class EntityResource extends AbstractCaosDBServerResource { ...@@ -112,6 +113,10 @@ public class EntityResource extends AbstractCaosDBServerResource {
final Retrieve retrieve = new Retrieve(entityContainer); final Retrieve retrieve = new Retrieve(entityContainer);
retrieve.execute(); retrieve.execute();
final long t2 = System.currentTimeMillis();
entityContainer
.getTransactionBenchmark()
.addBenchmark(getClass().getSimpleName() + ".httpGetInChildClass", t2 - t1);
final Element rootElem = generateRootElement(); final Element rootElem = generateRootElement();
entityContainer.addToElement(rootElem); entityContainer.addToElement(rootElem);
doc.setRootElement(rootElem); doc.setRootElement(rootElem);
......
...@@ -613,9 +613,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass { ...@@ -613,9 +613,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass {
caller.cleanup(); caller.cleanup();
} }
/** /** Does the order of directory creation matter? */
* Does the order of directory creation matter?
*/
@Test @Test
public void testDirectoriesInWrongOrder() throws Message { public void testDirectoriesInWrongOrder() throws Message {
final String[] cmd = {testExecutable.getAbsolutePath()}; final String[] cmd = {testExecutable.getAbsolutePath()};
...@@ -645,9 +643,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass { ...@@ -645,9 +643,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass {
caller.cleanup(); caller.cleanup();
} }
/** /** Is the new home directory created correctly? */
* Is the new home directory created correctly?
*/
@Test @Test
public void testWorkingDirCreation() throws Exception { public void testWorkingDirCreation() throws Exception {
final String[] cmd = {testExecutable.getAbsolutePath()}; final String[] cmd = {testExecutable.getAbsolutePath()};
...@@ -660,9 +656,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass { ...@@ -660,9 +656,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass {
caller.cleanup(); caller.cleanup();
} }
/** /** Does copying files over to the new home directory work? */
* Does copying files over to the new home directory work?
*/
@Test @Test
public void testWorkingDirCopying() throws Exception { public void testWorkingDirCopying() throws Exception {
final String[] cmd = {testExecutable.getAbsolutePath()}; final String[] cmd = {testExecutable.getAbsolutePath()};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment