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.write.denyValue;
14 import org.junit.Test;
15 import org.simantics.databoard.Bindings;
16 import org.simantics.db.ReadGraph;
17 import org.simantics.db.Resource;
18 import org.simantics.db.WriteGraph;
19 import org.simantics.db.common.request.ReadRequest;
20 import org.simantics.db.common.request.WriteResultRequest;
21 import org.simantics.db.exception.DatabaseException;
22 import org.simantics.db.testing.annotation.Fails;
23 import org.simantics.db.testing.base.ExistingDatabaseTest;
24 import org.simantics.db.testing.common.WriteQuery;
26 public class DenyValueTest extends ExistingDatabaseTest {
30 public void test() throws Exception{
32 final Resource r = getSession().syncRequest(new WriteResultRequest<Resource>() {
34 public Resource perform(WriteGraph g) throws DatabaseException {
35 Resource f = g.newResource();
36 g.claimValue(f, "A", Bindings.STRING);
43 getSession().syncRequest(new WriteQuery(this) {
45 public void run(WriteGraph g) throws Throwable {
53 getSession().syncRequest(new ReadRequest() {
55 public void run(ReadGraph g) throws DatabaseException {
57 String value = g.getPossibleValue(r, Bindings.STRING);
58 if(value != null) throw new AssertionError("Value was not removed!");