]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/src/org/simantics/db/tests/client/ReserveIdsTest1.java
Added missing org.simantics.db.{tests,testing} plug-ins.
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / client / ReserveIdsTest1.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.client;
13
14
15 import org.junit.Test;
16 import org.simantics.db.Session;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.db.service.ClusteringSupport;
19 import org.simantics.db.testing.base.ExistingDatabaseTest;
20
21 /**
22  * Tests that reserving cluster identifier works.
23  * Note that this test makes assumptions on implementatioin.
24  */
25 public class ReserveIdsTest1 extends ExistingDatabaseTest {
26     @Test
27     public void test() throws DatabaseException {
28         Session s = getSession();
29         ClusteringSupport cs = s.getService(ClusteringSupport.class);
30         long cid1 = cs.createCluster();
31         for (int i=0; i<100; ++i)
32             cs.createCluster();
33         long cid2 = cs.createCluster();
34         assertTrue(cid2 == cid1 + 101);
35    }
36 }