1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.tests.api.support.clusterControl;
14 import org.junit.Test;
15 import org.simantics.db.Resource;
16 import org.simantics.db.WriteGraph;
17 import org.simantics.db.common.request.WriteRequest;
18 import org.simantics.db.exception.DatabaseException;
19 import org.simantics.db.service.ClusterControl;
20 import org.simantics.db.testing.base.ExistingDatabaseTest;
24 * @author Antti Villberg
27 public class ClaimIntoNewResourceAfterIntermediateClusterCollect2 extends ExistingDatabaseTest {
30 public void test() throws Exception{
32 getSession().syncRequest(new WriteRequest() {
34 public void perform(WriteGraph graph) throws DatabaseException {
44 getSession().syncRequest(new WriteRequest() {
46 public void perform(WriteGraph graph) throws DatabaseException {
48 // Create some resources
49 for(int i=0;i<1000;i++) graph.newResource();
51 // Create and store a resource
52 Resource target = graph.newResource();
54 // Flush clusters including the one just created
55 getSession().getService(ClusterControl.class).collectClusters(Integer.MAX_VALUE);
57 // Write into the stored resource
58 graph.claim(target, target, target);