]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.db.tests/src/org/simantics/db/tests/api/readGraph/forObjectSet/ForObjectSetTest1.java
Multiple reader thread support for db client
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / api / readGraph / forObjectSet / ForObjectSetTest1.java
index 1a6a3a0b44a01604c301b73b6f899af061dcd527..dc492e20cfa1af451cd2d2cc3808806f87c3239d 100644 (file)
@@ -45,33 +45,43 @@ public class ForObjectSetTest1 extends ExistingDatabaseTest {
                                graph.claim(relation, b.SubrelationOf, b.IsRelatedTo);
                                graph.claim(relation, b.InverseOf, relation);
                                
                                graph.claim(relation, b.SubrelationOf, b.IsRelatedTo);
                                graph.claim(relation, b.InverseOf, relation);
                                
-                               graph.forObjectSet(graph.getRootLibrary(), relation, new AsyncSetListener<Resource>() {
-
-                                       @Override
-                                       public void add(AsyncReadGraph graph, Resource result) {
-                                               synchronized(this) {
-                                                       adds++;
-                                               }
-                                       }
-
-                                       @Override
-                                       public void remove(AsyncReadGraph graph, Resource result) {
-                                               synchronized(this) {
-                                                       removes++;
-                                               }
-                                       }
-
-                                       @Override
-                                       public void exception(AsyncReadGraph graph, Throwable t) {
-                                               exception = t;
-                                       }
-
-                                       @Override
-                                       public boolean isDisposed() {
-                                               return false;
-                                       }
-                                       
-                               });
+                       session.syncRequest(new TestAsyncReadRequest() {
+
+                           @Override
+                           public void run(AsyncReadGraph graph) throws Throwable {
+
+                                               graph.forObjectSet(graph.getRootLibrary(), relation, new AsyncSetListener<Resource>() {
+
+                                                       @Override
+                                                       public void add(AsyncReadGraph graph, Resource result) {
+                                                               synchronized(this) {
+                                                                       adds++;
+                                                               }
+                                                       }
+
+                                                       @Override
+                                                       public void remove(AsyncReadGraph graph, Resource result) {
+                                                               synchronized(this) {
+                                                                       removes++;
+                                                               }
+                                                       }
+
+                                                       @Override
+                                                       public void exception(AsyncReadGraph graph, Throwable t) {
+                                                               exception = t;
+                                                       }
+
+                                                       @Override
+                                                       public boolean isDisposed() {
+                                                               return false;
+                                                       }
+                                                       
+                                               });
+                               
+                           }
+                           
+                       });
+                       
                        }
                        
                });
                        }
                        
                });