Skip to content

Commit e46edb7

Browse files
committed
model first version seems right
1 parent 114e796 commit e46edb7

File tree

8 files changed

+1666
-29
lines changed

8 files changed

+1666
-29
lines changed

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
all: install
2+
3+
install: compile shippable
4+
cp -rf appmagyar/* shippable
5+
6+
shippable:
7+
mkdir -p shippable
8+
9+
compile: zentaworkaround appmagyar.compiled codedocs
10+
11+
codedocs: shippable/appmagyar-testcases.xml
12+
13+
shippable/appmagyar-testcases.xml: appmagyar.richescape shippable
14+
zenta-xslt-runner -xsl:generate_test_cases.xslt -s appmagyar.richescape outputbase=shippable/appmagyar-
15+
16+
inputs/appmagyar.issues.xml:
17+
mkdir -p inputs
18+
touch inputs/appmagyar.issues.xml:
19+
20+
include /usr/share/zenta-tools/model.rules
21+
22+
clean:
23+
git clean -fdx
24+
rm -rf zenta-tools
25+
26+
zentaworkaround:
27+
mkdir -p ~/.zenta/.metadata/.plugins/org.eclipse.e4.workbench/
28+
cp workbench.xmi ~/.zenta/.metadata/.plugins/org.eclipse.e4.workbench/
29+
touch zentaworkaround
30+
31+
testenv:
32+
docker run --rm -p 5900:5900 -e PULL_REQUEST=false -e ORG_NAME=local -v $$(pwd):/appmagyar -w /appmagyar -it edemo/pdengine
33+

appmagyar.check

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<checks>
2+
<check
3+
title="Model Errors"
4+
modelfile="appmagyar.rich"
5+
modelbasepath="//error"
6+
modelnamepath="@type"
7+
modelvaluepath="concat(//element[@id=current()/@element]/@name,' ',@name)"
8+
modelerrorid="$p1/object/error/@errorID"
9+
inputfile="appmagyar.rich"
10+
referencemodel="appmagyar.rich"
11+
inputbasepath="//nonexistent"
12+
inputnamepath=""
13+
inputvaluepath=""
14+
inputerrorid="$p1"
15+
errorURL="concat('http://adadocs.demokracia.rulez.org/PDEngine/edemo/master/index.html#',$p1)"
16+
errortitlestring="zenta:modelErrorTitle($p1,$p4)"
17+
errordescription="zenta:modelErrorDescription($p1,$p4)"
18+
/>
19+
<check
20+
title="Unimplemented behaviours"
21+
modelfile="shippable/appmagyar-testcases.xml"
22+
modelbasepath="//testcase"
23+
modelnamepath="@name"
24+
modelvaluepath="''"
25+
modelerrorid="zenta:engineErrorId($p1)"
26+
inputfile="shippable/appmagyar-implementedTestCases.xml"
27+
inputbasepath="//testcase"
28+
inputnamepath="@modelmatch"
29+
inputvaluepath="''"
30+
inputerrorid="$p1//object/testcase/@name"
31+
errorURL="concat('http://adadocs.demokracia.rulez.org/PDEngine/edemo/master/index.html#',$p1)"
32+
errortitlestring="zenta:engineErrorTitle($p1)"
33+
errordescription="zenta:engineErrorDescription($p1, $p2)"
34+
/>
35+
</checks>

appmagyar.zenta

Lines changed: 812 additions & 29 deletions
Large diffs are not rendered by default.

docbook.local.xslt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE xml>
3+
<xsl:stylesheet
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5+
version='2.0'
6+
xmlns:html="http://www.w3.org/TR/xhtml1/transitional"
7+
xmlns:fn="http://www.w3.org/2005/xpath-functions"
8+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xmlns:zenta="http://magwas.rulez.org/zenta"
10+
>
11+
<!--exclude-result-prefixes="#default"-->
12+
13+
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
14+
15+
<xsl:template match="element[@xsi:type='Ada:varlistentry']" mode="elementTitle">
16+
<xsl:value-of select="@name"/>
17+
</xsl:template>
18+
19+
<xsl:template match="element[@id='basicobject']|connection[@id='basicrelation']" mode="varlistentry" priority="4">
20+
</xsl:template>
21+
22+
<!--xsl:template match="element[@xsi:type!='zenta:ZentaDiagramModel' and @xsi:type!='zenta:SketchModel']"
23+
mode="varlistentry" priority="5"/-->
24+
<xsl:template match="folder[property[@key='display']/@value='hidden']" mode="varlist"/>
25+
26+
<xsl:template match="element[@xsi:type!='zenta:ZentaDiagramModel' and @xsi:type!='zenta:SketchModel']"
27+
mode="elementDetails" priority="5">
28+
<para>
29+
<xsl:value-of select="concat('Is ', zenta:articledName(//element[@id=current()/@ancestor],'no'),'.')"/>
30+
</para>
31+
<para>
32+
<xsl:copy-of select="documentation/(*|text())"/>
33+
</para>
34+
<para>
35+
<xsl:if test="value">
36+
connections:
37+
<itemizedlist>
38+
<xsl:for-each select="value">
39+
<listitem>
40+
<xsl:variable name="atleast">
41+
<xsl:if test="number(@minOccurs) > 0">
42+
<xsl:value-of select="if (number(@minOccurs) > 0) then concat('at least ',@minOccurs,' ') else ''"/>
43+
</xsl:if>
44+
</xsl:variable>
45+
<xsl:variable name="atmost">
46+
<xsl:value-of select="if (number(@maxOccurs) > 0) then concat('at most ',@maxOccurs,' ') else '' "/>
47+
</xsl:variable>
48+
<xsl:variable name="numbers" select="if ($atmost!='' and $atleast!='') then concat($atleast,'and ',$atmost) else concat(
49+
$atleast,$atmost)"/>
50+
<!--xsl:value-of select="../@name"/-->
51+
It
52+
<xsl:value-of select="concat(' ',
53+
zenta:relationName(.),' ',
54+
if (@template='true') then $numbers else ''
55+
)"/>
56+
<link linkend="{@target}">
57+
<xsl:value-of select="@name"/>
58+
</link>
59+
</listitem>
60+
</xsl:for-each>
61+
</itemizedlist>
62+
</xsl:if>
63+
</para>
64+
</xsl:template>
65+
</xsl:stylesheet>

functions.local.xslt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE xml>
3+
<xsl:stylesheet
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5+
version='2.0'
6+
xmlns:xhtml="http://www.w3.org/TR/xhtml1/transitional"
7+
xmlns:fn="http://www.w3.org/2005/xpath-functions"
8+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xmlns:zenta="http://magwas.rulez.org/zenta">
10+
11+
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
12+
13+
<!--xsl:template match="element[@xsi:type='Ada:varlistentry']" mode="elementTitle">
14+
<xsl:value-of select="@name"/>
15+
</xsl:template>
16+
17+
<xsl:template match="element[@id='basicobject']|connection[@id='basicrelation']" mode="varlistentry">
18+
</xsl:template>
19+
20+
<xsl:template match="folder[property[@key='display']/@value='hidden']" mode="varlist"/-->
21+
22+
<xsl:function name="zenta:engineErrorDescription">
23+
<xsl:param name="entry"/>
24+
<xsl:param name="other"/>
25+
<xsl:variable name="testcase" select="$entry/object/testcase"/>
26+
Unimplemented behaviour.
27+
<variablelist>
28+
<varlistentry>
29+
<term>related feature:</term>
30+
<listitem><para>
31+
<ulink url="#{$testcase/@featureid}"><xsl:value-of select="$testcase/@feature"/></ulink>
32+
</para></listitem>
33+
</varlistentry>
34+
<varlistentry>
35+
<term>related operation:</term>
36+
<listitem><para>
37+
<ulink url="#{$testcase/@operationid}"><xsl:value-of select="$testcase/@operation"/></ulink>
38+
</para></listitem>
39+
</varlistentry>
40+
<varlistentry>
41+
<term>related behaviour:</term>
42+
<listitem><para>
43+
<ulink url="#{$testcase/@testcaseid}"><xsl:value-of select="$testcase/@testcase"/></ulink>
44+
</para></listitem>
45+
</varlistentry>
46+
</variablelist>
47+
<xsl:choose>
48+
<xsl:when test="$testcase/@featureid">
49+
issue markup:
50+
[Deviation in model](http://adadocs.demokracia.rulez.org/PDEngine/edemo/master/index.html#<xsl:value-of select="zenta:engineErrorId($entry)"/>)
51+
</xsl:when>
52+
<xsl:otherwise>
53+
issue markup:
54+
[Deviation in model](http://adadocs.demokracia.rulez.org/PDEngine/edemo/master/index.html#<xsl:value-of select="$entry//object/testcase/@name"/>)
55+
</xsl:otherwise>
56+
</xsl:choose>
57+
</xsl:function>
58+
<xsl:function name="zenta:engineErrorId">
59+
<xsl:param name="entry"/>
60+
<xsl:variable name="testcase" select="$entry/object/testcase"/>
61+
<xsl:choose>
62+
<xsl:when test="$testcase/@featureid">
63+
<xsl:value-of select="concat($testcase/@featureid,'-',$testcase/@operationid,'-',$testcase/@testcaseid)"/>
64+
</xsl:when>
65+
<xsl:otherwise>
66+
<xsl:value-of select="$testcase/@name"/>
67+
</xsl:otherwise>
68+
</xsl:choose>
69+
</xsl:function>
70+
<xsl:function name="zenta:engineErrorTitle">
71+
<xsl:param name="entry"/>
72+
<xsl:variable name="testcase" select="$entry/object/testcase"/>
73+
<xsl:value-of select="concat('Unimplemented feature',':',$testcase/@name)"/>
74+
</xsl:function>
75+
</xsl:stylesheet>
76+

generate_test_cases.xslt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?>
2+
<!DOCTYPE xml>
3+
<xsl:stylesheet version="2.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:zenta="http://magwas.rulez.org/zenta"
6+
xmlns:zentatools="java:org.rulez.magwas.zentatools.XPathFunctions"
7+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
8+
9+
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
10+
11+
<xsl:include href="xslt/functions.xslt"/>
12+
13+
<xsl:param name="outputbase"/>
14+
15+
<xsl:template match="/">
16+
<xsl:variable name="testcases">
17+
<testcases>
18+
<xsl:call-template name="testcases"/>
19+
</testcases>
20+
</xsl:variable>
21+
<xsl:result-document href="{$outputbase}testcases.txt">
22+
<xsl:copy-of select="zenta:writeTestcasesAsText($testcases)"/>
23+
</xsl:result-document>
24+
<xsl:result-document href="{$outputbase}testcases.xml">
25+
<xsl:copy-of select="$testcases"/>
26+
</xsl:result-document>
27+
</xsl:template>
28+
29+
<xsl:function name="zenta:writeTestcasesAsText">
30+
<xsl:param name="testcases"/>
31+
<xsl:for-each select="$testcases//testcase">
32+
----------------------------------------------------------------------------
33+
Behaviour: <xsl:value-of select="@name"/>
34+
@tested_feature("<xsl:value-of select="@feature"/>")
35+
@tested_operation("<xsl:value-of select="@operation"/>")
36+
@tested_behaviour("<xsl:value-of select="@testcase"/>")
37+
<xsl:if test="@addtestcase">
38+
@tested_aspect(<xsl:value-of select="@addtestcase"/>)
39+
</xsl:if>
40+
<xsl:text> </xsl:text><xsl:value-of select="replace(.,'\\n','\\n ')"/>
41+
<xsl:text>
42+
</xsl:text>
43+
</xsl:for-each>
44+
</xsl:function>
45+
46+
<xsl:template name="testcases">
47+
<xsl:variable name="root" select="/"/>
48+
<xsl:for-each select="//element[@xsi:type='Business Function']">
49+
<xsl:variable name="feature" select="."/>
50+
<xsl:for-each select="zenta:neighboursOnPath(/,$feature,'contains,1')">
51+
<xsl:variable name="operation" select="."/>
52+
<xsl:for-each select="zenta:neighboursOnPath($root,$operation,'does/is done by,1')">
53+
<xsl:variable name="testcase" select="."/>
54+
<testcase name="{concat($feature/@name,'/', $operation/@name, '; ', $testcase/@name)}"
55+
feature="{$feature/@name}"
56+
operation="{$operation/@name}"
57+
testcase="{$testcase/@name}"
58+
featureid="{$feature/@id}"
59+
operationid="{$operation/@id}"
60+
testcaseid="{$testcase/@id}">
61+
<xsl:copy-of select="$testcase/documentation/(text()|*)"/>
62+
</testcase>
63+
<xsl:for-each select="zenta:neighboursOnPath($root,$testcase,'is tested by/tests,2,testcase')">
64+
<xsl:variable name="addtestcase" select="."/>
65+
<testcase name="{concat($feature/@name,'/', $operation/@name, '; ', $testcase/@name, '/', $addtestcase/@name)}"
66+
feature="{concat(
67+
zenta:neighboursOnPath($root,$feature,'contains/iscontained by,2')/@name,'.',
68+
$feature/@name)}"
69+
operation="{$operation/@name}"
70+
testcase="{$testcase/@name}"
71+
additionaltestcase="{$addtestcase/@name}">
72+
<xsl:copy-of select="$testcase/documentation/(text()|*)"/>.
73+
<xsl:copy-of select="$addtestcase/documentation/(text()|*)"/>
74+
</testcase>
75+
</xsl:for-each>
76+
</xsl:for-each>
77+
</xsl:for-each>
78+
</xsl:for-each>
79+
</xsl:template>
80+
81+
</xsl:stylesheet>
82+

tools/prepare

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export DISPLAY=:0
2+
Xvnc4 -SecurityTypes none :0 &
3+

0 commit comments

Comments
 (0)