package org.simantics.db.tests.api.support.virtualGraphSupport; import java.util.UUID; import org.junit.Test; import org.simantics.databoard.Bindings; import org.simantics.db.Resource; import org.simantics.db.VirtualGraph; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.request.WriteResultRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ServiceException; import org.simantics.db.service.VirtualGraphSupport; import org.simantics.db.testing.base.ExistingDatabaseTest; public class PersistentSetValueIntoVirtualResourceTest extends ExistingDatabaseTest { @Test public void test() throws Exception{ VirtualGraphSupport vgs = getSession().getService(VirtualGraphSupport.class); VirtualGraph vg = vgs.getMemoryPersistent(UUID.randomUUID().toString()); final Resource virtual = getSession().syncRequest(new WriteResultRequest(vg) { @Override public Resource perform(WriteGraph graph) throws DatabaseException { return graph.newResource(); } }); checkException(); try { getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException { graph.claimValue(virtual, "Name", Bindings.STRING); } }); } catch (ServiceException e) { if (DEBUG) e.printStackTrace(); return; } fail("Should throw."); } }