+package org.simantics.db.tests.api.support.virtualGraphSupport;
+
+import java.util.UUID;
+
+import org.simantics.db.Resource;
+import org.simantics.db.VirtualGraph;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.WriteResultRequest;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.service.VirtualGraphSupport;
+import org.simantics.db.testing.base.WriteReadTest;
+
+public class VirtualGraphTest6 extends WriteReadTest {
+
+ @Override
+ protected void write(WriteGraph graph) throws DatabaseException {
+
+ VirtualGraphSupport support = graph.getService(VirtualGraphSupport.class);
+ VirtualGraph virt = support.getMemoryPersistent(UUID.randomUUID().toString());
+
+ Resource other = graph.syncRequest(new WriteResultRequest<Resource>(virt) {
+
+ @Override
+ public Resource perform(WriteGraph graph) throws DatabaseException {
+ Resource other = graph.newResource();
+ if (DEBUG)
+ System.err.println("other=" + other);
+ graph.claim(written, L0.ConsistsOf, L0.PartOf, other);
+ return other;
+ }
+
+ });
+
+ Resource single = graph.getSingleObject(written, L0.ConsistsOf);
+ if (DEBUG)
+ System.err.println("single=" + single);
+ assertNotNull(single);
+ assertTrue(single.equals(other));
+
+ }
+
+}
\ No newline at end of file