]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.testing/src/org/simantics/db/testing/cases/FreshDatabaseTest.java
Minor fix and optimization for exporting TG and Pgraph with sharedlib
[simantics/platform.git] / bundles / org.simantics.db.testing / src / org / simantics / db / testing / cases / FreshDatabaseTest.java
1 package org.simantics.db.testing.cases;
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.After;
16 import org.junit.Before;
17 import org.simantics.SimanticsPlatform;
18 import org.simantics.db.Resource;
19 import org.simantics.db.Session;
20 import org.simantics.db.testing.common.DatabaseState;
21 import org.simantics.db.testing.common.TestBase;
22 import org.simantics.db.testing.common.TestSettings;
23 import org.simantics.db.testing.common.Tests;
24
25 public class FreshDatabaseTest extends TestBase {
26
27     public void configure(TestSettings settings) {
28
29     }
30
31     @Before
32     public void setUp() throws Exception {
33
34         TestBase.printStart(this);
35         TestSettings testSettings = TestSettings.getInstanceUnsafe();
36         configure(testSettings);
37 //        state = AcornTests.newSimanticsWorkspace(testSettings, null);
38         state = Tests.newSimanticsWorkspace(testSettings, null);
39
40         super.setUp();
41
42     }
43
44     @After
45     public void tearDown() throws Exception {
46         Tests.shutdown(state);
47         super.tearDown();
48     }
49
50     public Resource getProjectResource() {
51         return SimanticsPlatform.INSTANCE.projectResource;
52     }
53
54     protected Session getSession() {
55         return state.getSession();
56     }
57
58     public DatabaseState getState() {
59         return state;
60     }
61
62     public void reconnect() throws Exception {
63         setPrintStart(false);
64         tearDown();
65         setUp();
66         setPrintStart(true);
67     }
68 }