]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/src/org/simantics/db/tests/api/support/clusterControl/WriteNewResourceIntoCollectedCluster.java
Merge "Use Consumer interface instead of deprecated Callback interface"
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / api / support / clusterControl / WriteNewResourceIntoCollectedCluster.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.tests.api.support.clusterControl;
13
14 import org.junit.Test;
15 import org.simantics.db.WriteGraph;
16 import org.simantics.db.service.ClusterControl;
17 import org.simantics.db.service.ClusteringSupport;
18 import org.simantics.db.testing.base.ExistingDatabaseTest;
19 import org.simantics.db.testing.common.WriteQuery;
20
21 /**
22  * Creates large amount of instances in multiple transactions
23  * and the tries to verify that instances are written into the database.
24  * 
25  * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
26  *
27  */
28 public class WriteNewResourceIntoCollectedCluster extends ExistingDatabaseTest {
29         
30         @Test
31         public void test() throws Exception{
32
33         final long clusterId = getSession().getService(ClusteringSupport.class).getCluster(getSession().getRootLibrary());
34
35         getSession().getService(ClusterControl.class).collectClusters(Integer.MAX_VALUE);
36         
37         getSession().syncRequest(new WriteQuery(this) {
38             @Override
39             public void run(WriteGraph g) throws Throwable {
40                 
41                 g.newResource(clusterId);
42                 
43             }
44             
45         });
46         
47         checkException();
48                 
49         }
50
51 }