]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/src/org/simantics/db/tests/regression/bugs/Issue3288Test1.java
Merge "Accept existential variables as record shorthand fields"
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / regression / bugs / Issue3288Test1.java
1 package org.simantics.db.tests.regression.bugs;
2 /*******************************************************************************
3  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4  * in Industry THTH ry.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  *     VTT Technical Research Centre of Finland - initial API and implementation
12  *******************************************************************************/
13
14
15 import org.junit.Test;
16 import org.simantics.db.Resource;
17 import org.simantics.db.VirtualGraph;
18 import org.simantics.db.WriteGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.db.request.Write;
21 import org.simantics.db.testing.cases.FreshDatabaseTest;
22 import org.simantics.layer0.Layer0;
23 /**
24  * Meant to be run together wit Issue3288Test2.
25  * This test stops server in the middle of transaction.
26  * Issue3288Test2 can be used to visually check that recovery does at least something.
27  * At the moment both must be manually run with separate runs.  
28  */
29 public class Issue3288Test1 extends FreshDatabaseTest {
30     @Test
31     public void test() throws DatabaseException {
32         getSession().syncRequest(new Modi());
33     }
34     private static class Modi implements Write {
35         @Override
36         public VirtualGraph getProvider() {
37             return null;
38         }
39         @Override
40         public void perform(WriteGraph graph) throws DatabaseException {
41             Resource rl = graph.getRootLibrary();
42             Layer0 l0 = Layer0.getInstance(graph);
43             Resource r = graph.newResource();
44             graph.claim(rl, l0.ConsistsOf, r);
45             graph.flushCluster(rl);
46             System.setSecurityManager(null);
47             System.exit(666);
48         }
49     }
50 }