]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/src/org/simantics/db/tests/api/delayedWrite/DelayedWriteGraphExceptionHandling.java
Added missing org.simantics.db.{tests,testing} plug-ins.
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / api / delayedWrite / DelayedWriteGraphExceptionHandling.java
1 package org.simantics.db.tests.api.delayedWrite;
2
3 import org.junit.Test;
4 import org.simantics.db.Resource;
5 import org.simantics.db.WriteGraph;
6 import org.simantics.db.common.request.DelayedWriteRequest;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.db.testing.annotation.Fails;
9 import org.simantics.db.testing.base.ExistingDatabaseTest;
10
11 /**
12  * This originated from Apros issue #3296.
13  * 
14  * @author Tuukka Lehtonen
15  */
16 public class DelayedWriteGraphExceptionHandling extends ExistingDatabaseTest {
17
18     @Test
19     public void test() throws Exception {
20         try {
21             DelayedWriteRequest r = new DelayedWriteRequest() {
22                 @Override
23                 public void perform(WriteGraph graph) throws DatabaseException {
24                     // Should throw an exception / error
25                     graph.claim(null, null, null, null);
26                 }
27             };
28             getSession().sync(r);
29         } catch (DatabaseException e) {
30             // Should happen.
31         }
32
33         // Just to check the database session is still alive.
34         Resource r = getSession().sync(new org.simantics.db.common.primitiverequest.Resource("http:/"));
35
36     }
37
38 }