import org.junit.After;
import org.junit.Before;
import org.simantics.SimanticsPlatform;
+import org.simantics.db.AsyncReadGraph;
import org.simantics.db.ReadGraph;
import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.exception.ServiceNotFoundException;
import org.simantics.db.management.SessionContext;
+import org.simantics.db.procedure.AsyncProcedure;
+import org.simantics.db.request.AsyncRead;
import org.simantics.db.request.Read;
import org.simantics.db.service.LifecycleSupport;
import org.simantics.db.testing.impl.Configuration;
}
+ protected abstract class AsyncReadQuery<Result> implements AsyncRead<Result> {
+ protected Result result = null;
+
+ public abstract void run(AsyncReadGraph graph) throws Throwable;
+
+ @Override
+ public void perform(AsyncReadGraph graph, AsyncProcedure<Result> procedure) {
+ try {
+ run(graph);
+ } catch(Throwable t) {
+ if (DEBUG) {
+ new Exception().printStackTrace();
+ t.printStackTrace();
+ }
+ if (null == exception2)
+ exception2 = t;
+ }
+ }
+
+ }
+
protected abstract class TestReadRequest extends ReadQuery<Object> {
}
+ protected abstract class TestAsyncReadRequest extends AsyncReadQuery<Object> {
+
+ @Override
+ public int getFlags() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int threadHash() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ }
+
protected abstract class WriteOnlyQuery
extends WriteOnlyRequest
{