X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=tests%2Forg.simantics.db.tests%2Fsrc%2Forg%2Fsimantics%2Fdb%2Ftests%2Fapi%2FdelayedWrite%2FDelayedWriteGraphExceptionHandling.java;fp=tests%2Forg.simantics.db.tests%2Fsrc%2Forg%2Fsimantics%2Fdb%2Ftests%2Fapi%2FdelayedWrite%2FDelayedWriteGraphExceptionHandling.java;h=61a3e3bf4a8c11d063cd35fae2c1d3f480f58061;hb=67fd62f9c742337ec80eef658192db198a0efaac;hp=0000000000000000000000000000000000000000;hpb=cde82ba81327d5515fdca362f7f4c70f5103ae80;p=simantics%2Fplatform.git diff --git a/tests/org.simantics.db.tests/src/org/simantics/db/tests/api/delayedWrite/DelayedWriteGraphExceptionHandling.java b/tests/org.simantics.db.tests/src/org/simantics/db/tests/api/delayedWrite/DelayedWriteGraphExceptionHandling.java new file mode 100644 index 000000000..61a3e3bf4 --- /dev/null +++ b/tests/org.simantics.db.tests/src/org/simantics/db/tests/api/delayedWrite/DelayedWriteGraphExceptionHandling.java @@ -0,0 +1,38 @@ +package org.simantics.db.tests.api.delayedWrite; + +import org.junit.Test; +import org.simantics.db.Resource; +import org.simantics.db.WriteGraph; +import org.simantics.db.common.request.DelayedWriteRequest; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.testing.annotation.Fails; +import org.simantics.db.testing.base.ExistingDatabaseTest; + +/** + * This originated from Apros issue #3296. + * + * @author Tuukka Lehtonen + */ +public class DelayedWriteGraphExceptionHandling extends ExistingDatabaseTest { + + @Test + public void test() throws Exception { + try { + DelayedWriteRequest r = new DelayedWriteRequest() { + @Override + public void perform(WriteGraph graph) throws DatabaseException { + // Should throw an exception / error + graph.claim(null, null, null, null); + } + }; + getSession().sync(r); + } catch (DatabaseException e) { + // Should happen. + } + + // Just to check the database session is still alive. + Resource r = getSession().sync(new org.simantics.db.common.primitiverequest.Resource("http:/")); + + } + +}