]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.tests.modelled/src/org/simantics/tests/modelled/TestsGraphUtils.java
Enhancements to modelled tests
[simantics/platform.git] / bundles / org.simantics.tests.modelled / src / org / simantics / tests / modelled / TestsGraphUtils.java
index e9ce7d06ff24d775992a896969cb71ccb034a0a7..c5253bd5a37ad138d159b4b7b938ad3a159cbf6e 100644 (file)
@@ -31,9 +31,24 @@ public class TestsGraphUtils {
 
     private static final String STS_TEST_PREFIX = "STSTest";
     private static final String STS_SUITE_PREFIX = "STSSuite";
+    private static final String STS_VARIABLE_PREFIX = "STSVariable";
     
     private TestsGraphUtils() {}
     
+    public static Resource createSTSVariable(WriteGraph graph, Resource parent) throws DatabaseException {
+        String name = NameUtils.findFreshEscapedName(graph, STS_VARIABLE_PREFIX, parent);
+        Resource stsVariable = graph.newResource();
+        
+        Layer0 L0 = Layer0.getInstance(graph);
+        TestsResource TESTS = TestsResource.getInstance(graph);
+        
+        graph.claim(parent, L0.ConsistsOf, L0.PartOf, stsVariable);
+        graph.claim(stsVariable, L0.InstanceOf, TESTS.STSVariable);
+        graph.claimLiteral(stsVariable, L0.HasName, name, Bindings.STRING);
+        graph.claimLiteral(stsVariable, TESTS.STSVariable_definition, "", Bindings.STRING);
+        return stsVariable;
+    }
+    
     public static Resource createSTSTest(WriteGraph graph, Resource parent) throws DatabaseException {
         String name = NameUtils.findFreshEscapedName(graph, STS_TEST_PREFIX, parent);
         Resource stsTest = graph.newResource();