diff options
author | 2018-10-08 18:09:21 +0200 | |
---|---|---|
committer | 2018-10-08 18:09:21 +0200 | |
commit | 438c76457b55926e94c510f1c441670df50c404b (patch) | |
tree | 53277de465cb3a50a195796ff0b38c14c13ec142 | |
parent | Updated progress monitor for huge amount instance generation processes (diff) | |
download | VIATRA-Generator-438c76457b55926e94c510f1c441670df50c404b.tar.gz VIATRA-Generator-438c76457b55926e94c510f1c441670df50c404b.tar.zst VIATRA-Generator-438c76457b55926e94c510f1c441670df50c404b.zip |
Example standalone runs
13 files changed, 251 insertions, 0 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath new file mode 100644 index 00000000..1c96fe2f --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.classpath | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="src" path="src"/> | ||
6 | <classpathentry kind="src" path="xtend-gen"/> | ||
7 | <classpathentry kind="output" path="bin"/> | ||
8 | </classpath> | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.gitignore b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.gitignore new file mode 100644 index 00000000..5af458c2 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | /bin/ | ||
2 | /xtend-gen/* | ||
3 | /outputs/* | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project new file mode 100644 index 00000000..86c19a90 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.project | |||
@@ -0,0 +1,34 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>hu.bme.mit.inf.dslreasoner.application.FAMTest</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | <buildCommand> | ||
24 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
25 | <arguments> | ||
26 | </arguments> | ||
27 | </buildCommand> | ||
28 | </buildSpec> | ||
29 | <natures> | ||
30 | <nature>org.eclipse.pde.PluginNature</nature> | ||
31 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
32 | <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> | ||
33 | </natures> | ||
34 | </projectDescription> | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.settings/org.eclipse.jdt.core.prefs b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..295926d9 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,7 @@ | |||
1 | eclipse.preferences.version=1 | ||
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
4 | org.eclipse.jdt.core.compiler.compliance=1.8 | ||
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.source=1.8 | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF new file mode 100644 index 00000000..4e3222f9 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,15 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: FAMTest | ||
4 | Bundle-SymbolicName: hu.bme.mit.inf.dslreasoner.application.FAMTest;singleton:=true | ||
5 | Bundle-Version: 1.0.0.qualifier | ||
6 | Automatic-Module-Name: hu.bme.mit.inf.dslreasoner.application.FAMTest | ||
7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||
8 | Require-Bundle: com.google.guava, | ||
9 | org.eclipse.xtext.xbase.lib, | ||
10 | org.eclipse.xtend.lib, | ||
11 | org.eclipse.xtend.lib.macro, | ||
12 | hu.bme.mit.inf.dslreasoner.application;bundle-version="1.0.0", | ||
13 | org.junit;bundle-version="4.12.0", | ||
14 | org.eclipse.collections;bundle-version="7.1.1" | ||
15 | |||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties new file mode 100644 index 00000000..41eb6ade --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/build.properties | |||
@@ -0,0 +1,4 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = META-INF/,\ | ||
4 | . | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/ErrorousImports.vsconfig b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/ErrorousImports.vsconfig new file mode 100644 index 00000000..c4b67954 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/ErrorousImports.vsconfig | |||
@@ -0,0 +1,27 @@ | |||
1 | import epackage "error" | ||
2 | import viatra "error" | ||
3 | |||
4 | |||
5 | |||
6 | generate { | ||
7 | metamodel = { package functionalarchitecture } | ||
8 | constraints = { package hu.bme.mit.inf.dslreasoner.domains.fam } | ||
9 | partial-model = { "platform:/resource/FAM-Standalone+DF/inputs/FamInstance.xmi"} | ||
10 | solver = ViatraSolver | ||
11 | scope = { | ||
12 | #node += 5 | ||
13 | } | ||
14 | |||
15 | config = { | ||
16 | runtime = 10000, | ||
17 | log-level = normal | ||
18 | } | ||
19 | |||
20 | number = 5 | ||
21 | runs = 1 | ||
22 | |||
23 | debug = "platform:/resource/FAM-Standalone+DF/outputs/debug" | ||
24 | log = "platform:/resource/FAM-Standalone+DF/outputs/log.txt" | ||
25 | output = "platform:/resource/FAM-Standalone+DF/outputs/models" | ||
26 | statistics = "platform:/resource/FAM-Standalone+DF/outputs/statistics.csv" | ||
27 | } \ No newline at end of file | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig new file mode 100644 index 00000000..a95fa38c --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/configs/generation.vsconfig | |||
@@ -0,0 +1,27 @@ | |||
1 | import epackage "inputs/FamMetamodel.ecore" | ||
2 | import viatra "inputs/FamPatterns.vql" | ||
3 | |||
4 | |||
5 | |||
6 | generate { | ||
7 | metamodel = { package functionalarchitecture } | ||
8 | constraints = { package hu.bme.mit.inf.dslreasoner.domains.fam } | ||
9 | partial-model = { "inputs/FamInstance.xmi"} | ||
10 | solver = ViatraSolver | ||
11 | scope = { | ||
12 | #node = 5 | ||
13 | } | ||
14 | |||
15 | config = { | ||
16 | runtime = 10000, | ||
17 | log-level = normal | ||
18 | } | ||
19 | |||
20 | number = 5 | ||
21 | runs = 1 | ||
22 | |||
23 | debug = "outputs/debug" | ||
24 | log = "outputs/log.txt" | ||
25 | output = "outputs/models" | ||
26 | statistics = "outputs/statistics.csv" | ||
27 | } \ No newline at end of file | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamInstance.xmi b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamInstance.xmi new file mode 100644 index 00000000..1d9aeae4 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamInstance.xmi | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <functionalarchitecture:FunctionalArchitectureModel | ||
3 | xmi:version="2.0" | ||
4 | xmlns:xmi="http://www.omg.org/XMI" | ||
5 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
6 | xmlns:functionalarchitecture="http://www.inf.mit.bme.hu/viatrasolver/example/fam" | ||
7 | xsi:schemaLocation="http://www.inf.mit.bme.hu/viatrasolver/example/fam FamMetamodel.ecore"> | ||
8 | <rootElements | ||
9 | xsi:type="functionalarchitecture:Function"/> | ||
10 | </functionalarchitecture:FunctionalArchitectureModel> | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.ecore b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.ecore new file mode 100644 index 00000000..68943e55 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamMetamodel.ecore | |||
@@ -0,0 +1,61 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="functionalarchitecture" nsURI="http://www.inf.mit.bme.hu/viatrasolver/example/fam" | ||
4 | nsPrefix="functionalarchitecture"> | ||
5 | <eClassifiers xsi:type="ecore:EClass" name="FunctionalElement" abstract="true"> | ||
6 | <eStructuralFeatures xsi:type="ecore:EReference" name="interface" eType="#//FunctionalInterface" | ||
7 | containment="true" eOpposite="#//FunctionalInterface/element"/> | ||
8 | <eStructuralFeatures xsi:type="ecore:EReference" name="model" lowerBound="1" eType="#//FunctionalArchitectureModel" | ||
9 | volatile="true" transient="true" derived="true"> | ||
10 | <eAnnotations source="org.eclipse.viatra.query.querybasedfeature"> | ||
11 | <details key="patternFQN" value="hu.bme.mit.inf.dslreasoner.domains.fam.model"/> | ||
12 | </eAnnotations> | ||
13 | </eStructuralFeatures> | ||
14 | <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//Function" | ||
15 | eOpposite="#//Function/subElements"/> | ||
16 | </eClassifiers> | ||
17 | <eClassifiers xsi:type="ecore:EClass" name="FunctionalArchitectureModel"> | ||
18 | <eStructuralFeatures xsi:type="ecore:EReference" name="rootElements" upperBound="-1" | ||
19 | eType="#//FunctionalElement" containment="true"/> | ||
20 | </eClassifiers> | ||
21 | <eClassifiers xsi:type="ecore:EClass" name="Function" eSuperTypes="#//FunctionalElement"> | ||
22 | <eStructuralFeatures xsi:type="ecore:EReference" name="subElements" upperBound="-1" | ||
23 | eType="#//FunctionalElement" containment="true" eOpposite="#//FunctionalElement/parent"/> | ||
24 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" lowerBound="1" eType="#//FunctionType"/> | ||
25 | </eClassifiers> | ||
26 | <eClassifiers xsi:type="ecore:EClass" name="FAMTerminator"> | ||
27 | <eStructuralFeatures xsi:type="ecore:EReference" name="data" eType="#//FunctionalData" | ||
28 | eOpposite="#//FunctionalData/terminator"/> | ||
29 | </eClassifiers> | ||
30 | <eClassifiers xsi:type="ecore:EClass" name="InformationLink"> | ||
31 | <eStructuralFeatures xsi:type="ecore:EReference" name="from" eType="#//FunctionalOutput" | ||
32 | eOpposite="#//FunctionalOutput/outgoingLinks"/> | ||
33 | <eStructuralFeatures xsi:type="ecore:EReference" name="to" lowerBound="1" eType="#//FunctionalInput" | ||
34 | eOpposite="#//FunctionalInput/IncomingLinks"/> | ||
35 | </eClassifiers> | ||
36 | <eClassifiers xsi:type="ecore:EClass" name="FunctionalInterface"> | ||
37 | <eStructuralFeatures xsi:type="ecore:EReference" name="data" upperBound="-1" eType="#//FunctionalData" | ||
38 | containment="true" eOpposite="#//FunctionalData/interface"/> | ||
39 | <eStructuralFeatures xsi:type="ecore:EReference" name="element" eType="#//FunctionalElement" | ||
40 | eOpposite="#//FunctionalElement/interface"/> | ||
41 | </eClassifiers> | ||
42 | <eClassifiers xsi:type="ecore:EClass" name="FunctionalInput" eSuperTypes="#//FunctionalData"> | ||
43 | <eStructuralFeatures xsi:type="ecore:EReference" name="IncomingLinks" upperBound="-1" | ||
44 | eType="#//InformationLink" eOpposite="#//InformationLink/to"/> | ||
45 | </eClassifiers> | ||
46 | <eClassifiers xsi:type="ecore:EClass" name="FunctionalOutput" eSuperTypes="#//FunctionalData"> | ||
47 | <eStructuralFeatures xsi:type="ecore:EReference" name="outgoingLinks" upperBound="-1" | ||
48 | eType="#//InformationLink" containment="true" eOpposite="#//InformationLink/from"/> | ||
49 | </eClassifiers> | ||
50 | <eClassifiers xsi:type="ecore:EClass" name="FunctionalData" abstract="true"> | ||
51 | <eStructuralFeatures xsi:type="ecore:EReference" name="terminator" eType="#//FAMTerminator" | ||
52 | containment="true" eOpposite="#//FAMTerminator/data"/> | ||
53 | <eStructuralFeatures xsi:type="ecore:EReference" name="interface" eType="#//FunctionalInterface" | ||
54 | eOpposite="#//FunctionalInterface/data"/> | ||
55 | </eClassifiers> | ||
56 | <eClassifiers xsi:type="ecore:EEnum" name="FunctionType"> | ||
57 | <eLiterals name="Root"/> | ||
58 | <eLiterals name="Intermediate" value="1"/> | ||
59 | <eLiterals name="Leaf" value="2"/> | ||
60 | </eClassifiers> | ||
61 | </ecore:EPackage> | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql new file mode 100644 index 00000000..013d0419 --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/inputs/FamPatterns.vql | |||
@@ -0,0 +1,12 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.fam | ||
2 | |||
3 | import epackage "http://www.inf.mit.bme.hu/viatrasolver/example/fam" | ||
4 | |||
5 | @Constraint(message="terminatorAndInformation", severity="error", key={T}) | ||
6 | pattern terminatorAndInformation(T : FAMTerminator, I : InformationLink) = { | ||
7 | FunctionalOutput.outgoingLinks(Out,I); | ||
8 | FunctionalOutput.terminator(Out,T); | ||
9 | } or { | ||
10 | InformationLink.to(I,In); | ||
11 | FunctionalInput.terminator(In,T); | ||
12 | } \ No newline at end of file | ||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml new file mode 100644 index 00000000..2f4febdb --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/plugin.xml | |||
@@ -0,0 +1 @@ | |||
<?xml version="1.0" encoding="UTF-8"?><plugin/> | |||
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/hu/bme/mit/inf/dslreasoner/application/FAMTest/StandaloneScriptExecutionTests.xtend b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/hu/bme/mit/inf/dslreasoner/application/FAMTest/StandaloneScriptExecutionTests.xtend new file mode 100644 index 00000000..1768cd7f --- /dev/null +++ b/Tests/hu.bme.mit.inf.dslreasoner.application.FAMTest/src/hu/bme/mit/inf/dslreasoner/application/FAMTest/StandaloneScriptExecutionTests.xtend | |||
@@ -0,0 +1,42 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.application.FAMTest | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor | ||
4 | import org.junit.Test | ||
5 | import org.junit.Assert | ||
6 | |||
7 | class StandaloneScriptExecutionTests { | ||
8 | private def runWithPath(String path, String expectedMessage) { | ||
9 | val message = StandaloneScriptExecutor.executeScript(path) | ||
10 | Assert.assertEquals(expectedMessage,message) | ||
11 | } | ||
12 | private def runWithPathCheckingPrefix(String path, String prefix) { | ||
13 | val message = StandaloneScriptExecutor.executeScript(path) | ||
14 | Assert.assertTrue(message.startsWith(prefix)) | ||
15 | } | ||
16 | private def runWithPath(String path) { | ||
17 | runWithPath(path,null) | ||
18 | } | ||
19 | |||
20 | @Test | ||
21 | def void invalidExtension() { | ||
22 | runWithPath("invalid","Unsupported file extension: invalid") | ||
23 | } | ||
24 | @Test | ||
25 | def void nonexistingFile() { | ||
26 | runWithPathCheckingPrefix("invalid.vsconfig","Unable to load Configuration Script!") | ||
27 | } | ||
28 | @Test | ||
29 | def void errorousImports() { | ||
30 | runWithPath("configs/ErrorousImports.vsconfig",''' | ||
31 | The Configuration Script contains 4 errors: | ||
32 | Couldn't resolve reference to EPackage 'error'. | ||
33 | Couldn't resolve reference to PatternModel 'error'. | ||
34 | Couldn't resolve reference to EPackage 'functionalarchitecture'. | ||
35 | Couldn't resolve reference to PatternModel 'hu.bme.mit.inf.dslreasoner.domains.fam'. | ||
36 | ''') | ||
37 | } | ||
38 | @Test | ||
39 | def void generateFAM() { | ||
40 | runWithPath("configs/generation.vsconfig") | ||
41 | } | ||
42 | } \ No newline at end of file | ||