1 package org.simantics.db.testing.common;
3 import org.simantics.db.WriteGraph;
4 import org.simantics.db.common.request.WriteRequest;
5 import org.simantics.db.exception.DatabaseException;
7 public abstract class WriteQuery extends WriteRequest {
12 private final TestBase testBase;
17 public WriteQuery(TestBase testBase) {
18 this.testBase = testBase;
22 * Since some SimpleGraphRequest can only handle Exceptions, we need to wrap other Throwables inside Exceptions
26 public final void perform(WriteGraph g) throws DatabaseException {
29 } catch(Throwable t) {
30 new Exception().printStackTrace();
32 if (null == this.testBase.exception2)
33 this.testBase.exception2 = t;
34 if (t instanceof Exception)
35 throw new DatabaseException(t);
36 throw new DatabaseException("Wrapping thrown non exception to exception.", t);
40 public abstract void run(WriteGraph g) throws Throwable;