]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/src/org/simantics/db/tests/api/write/denyValue/DenyValueTest.java
Added missing org.simantics.db.{tests,testing} plug-ins.
[simantics/platform.git] / tests / org.simantics.db.tests / src / org / simantics / db / tests / api / write / denyValue / DenyValueTest.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.write.denyValue;
13
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;
25
26 public class DenyValueTest extends ExistingDatabaseTest {
27
28         @Test
29         @Fails
30     public void test() throws Exception{
31
32         final Resource r = getSession().syncRequest(new WriteResultRequest<Resource>() {
33             @Override
34             public Resource perform(WriteGraph g) throws DatabaseException {
35                 Resource f = g.newResource();
36                 g.claimValue(f, "A", Bindings.STRING);
37                 return f;
38
39             }
40
41         });
42
43         getSession().syncRequest(new WriteQuery(this) {
44             @Override
45             public void run(WriteGraph g) throws Throwable {
46
47                 g.denyValue(r);
48
49             }
50
51         });
52
53         getSession().syncRequest(new ReadRequest() {
54             @Override
55             public void run(ReadGraph g) throws DatabaseException {
56
57                 String value = g.getPossibleValue(r, Bindings.STRING);
58                 if(value != null) throw new AssertionError("Value was not removed!");
59
60             }
61
62         });
63
64         checkException();
65
66     }
67
68 }