]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/TestCompiler.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.graph.compiler / tests / org / simantics / graph / compiler / tests / TestCompiler.java
diff --git a/bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/TestCompiler.java b/bundles/org.simantics.graph.compiler/tests/org/simantics/graph/compiler/tests/TestCompiler.java
new file mode 100644 (file)
index 0000000..0557c0c
--- /dev/null
@@ -0,0 +1,36 @@
+package org.simantics.graph.compiler.tests;\r
+\r
+import java.io.File;\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+\r
+import org.simantics.graph.compiler.ExternalFileLoader;\r
+import org.simantics.graph.compiler.GraphCompiler;\r
+import org.simantics.graph.compiler.GraphCompilerPreferences;\r
+import org.simantics.graph.representation.TransferableGraph1;\r
+import org.simantics.ltk.FileSource;\r
+import org.simantics.ltk.ISource;\r
+\r
+public class TestCompiler {\r
+\r
+       public static void main(String[] args) throws Exception {\r
+               Collection<ISource> sources = new ArrayList<ISource>();\r
+               File dir = new File("d:/apros6/org.simantics.layer0/graph");\r
+               for(File f : dir.listFiles())\r
+                       if(f.getName().endsWith(".pgraph"))\r
+                               sources.add(new FileSource(f));\r
+               GraphCompiler.compile("1.0", sources, \r
+                               Collections.<TransferableGraph1>emptyList(), \r
+                               new ExternalFileLoader() {                                      \r
+                                       @Override\r
+                                       public byte[] load(String fileName) throws IOException {\r
+                                               throw new FileNotFoundException();\r
+                                       }\r
+                               },\r
+                               new GraphCompilerPreferences());\r
+       }\r
+       \r
+}\r