diff options
Diffstat (limited to '')
-rw-r--r-- | test/unittests/schemas/acls-1.1.rng | 66 | ||||
-rw-r--r-- | test/unittests/schemas/acls-1.2.rng | 66 | ||||
-rw-r--r-- | test/unittests/schemas/constraints-1.0.rng | 180 | ||||
-rw-r--r-- | test/unittests/schemas/constraints-1.1.rng | 246 | ||||
-rw-r--r-- | test/unittests/schemas/constraints-1.2.rng | 219 | ||||
-rw-r--r-- | test/unittests/schemas/fencing.rng | 29 | ||||
-rw-r--r-- | test/unittests/schemas/nvset.rng | 35 | ||||
-rw-r--r-- | test/unittests/schemas/pacemaker-1.0.rng | 121 | ||||
-rw-r--r-- | test/unittests/schemas/pacemaker-1.1.rng | 161 | ||||
-rw-r--r-- | test/unittests/schemas/pacemaker-1.2.rng | 146 | ||||
-rw-r--r-- | test/unittests/schemas/resources-1.0.rng | 177 | ||||
-rw-r--r-- | test/unittests/schemas/resources-1.1.rng | 225 | ||||
-rw-r--r-- | test/unittests/schemas/resources-1.2.rng | 225 | ||||
-rw-r--r-- | test/unittests/schemas/rule.rng | 137 | ||||
-rw-r--r-- | test/unittests/schemas/score.rng | 18 | ||||
-rw-r--r-- | test/unittests/schemas/versions.rng | 24 |
16 files changed, 2075 insertions, 0 deletions
diff --git a/test/unittests/schemas/acls-1.1.rng b/test/unittests/schemas/acls-1.1.rng new file mode 100644 index 0000000..22cc631 --- /dev/null +++ b/test/unittests/schemas/acls-1.1.rng @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-acls"/> + </start> + + <define name="element-acls"> + <element name="acls"> + <zeroOrMore> + <choice> + <element name="acl_user"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <zeroOrMore> + <element name="role_ref"> + <attribute name="id"><data type="IDREF"/></attribute> + </element> + </zeroOrMore> + <zeroOrMore> + <ref name="element-acl"/> + </zeroOrMore> + </choice> + </element> + <element name="acl_role"> + <attribute name="id"><data type="ID"/></attribute> + <zeroOrMore> + <ref name="element-acl"/> + </zeroOrMore> + </element> + </choice> + </zeroOrMore> + </element> + </define> + + <define name="element-acl"> + <choice> + <element name="read"> + <ref name="attribute-acl"/> + </element> + <element name="write"> + <ref name="attribute-acl"/> + </element> + <element name="deny"> + <ref name="attribute-acl"/> + </element> + </choice> + </define> + + <define name="attribute-acl"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <attribute name="tag"><text/></attribute> + <attribute name="ref"><data type="IDREF"/></attribute> + <group> + <attribute name="tag"><text/></attribute> + <attribute name="ref"><data type="IDREF"/></attribute> + </group> + <attribute name="xpath"><text/></attribute> + </choice> + <optional> + <attribute name="attribute"><text/></attribute> + </optional> + </define> + +</grammar> diff --git a/test/unittests/schemas/acls-1.2.rng b/test/unittests/schemas/acls-1.2.rng new file mode 100644 index 0000000..22cc631 --- /dev/null +++ b/test/unittests/schemas/acls-1.2.rng @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-acls"/> + </start> + + <define name="element-acls"> + <element name="acls"> + <zeroOrMore> + <choice> + <element name="acl_user"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <zeroOrMore> + <element name="role_ref"> + <attribute name="id"><data type="IDREF"/></attribute> + </element> + </zeroOrMore> + <zeroOrMore> + <ref name="element-acl"/> + </zeroOrMore> + </choice> + </element> + <element name="acl_role"> + <attribute name="id"><data type="ID"/></attribute> + <zeroOrMore> + <ref name="element-acl"/> + </zeroOrMore> + </element> + </choice> + </zeroOrMore> + </element> + </define> + + <define name="element-acl"> + <choice> + <element name="read"> + <ref name="attribute-acl"/> + </element> + <element name="write"> + <ref name="attribute-acl"/> + </element> + <element name="deny"> + <ref name="attribute-acl"/> + </element> + </choice> + </define> + + <define name="attribute-acl"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <attribute name="tag"><text/></attribute> + <attribute name="ref"><data type="IDREF"/></attribute> + <group> + <attribute name="tag"><text/></attribute> + <attribute name="ref"><data type="IDREF"/></attribute> + </group> + <attribute name="xpath"><text/></attribute> + </choice> + <optional> + <attribute name="attribute"><text/></attribute> + </optional> + </define> + +</grammar> diff --git a/test/unittests/schemas/constraints-1.0.rng b/test/unittests/schemas/constraints-1.0.rng new file mode 100644 index 0000000..5a4474a --- /dev/null +++ b/test/unittests/schemas/constraints-1.0.rng @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-constraints"/> + </start> + + <define name="element-constraints"> + <zeroOrMore> + <choice> + <ref name="element-location"/> + <ref name="element-colocation"/> + <ref name="element-order"/> + </choice> + </zeroOrMore> + </define> + + <define name="element-location"> + <element name="rsc_location"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="rsc"><data type="IDREF"/></attribute> + <choice> + <group> + <externalRef href="score.rng"/> + <attribute name="node"><text/></attribute> + </group> + <oneOrMore> + <externalRef href="rule.rng"/> + </oneOrMore> + </choice> + <optional> + <ref name="element-lifetime"/> + </optional> + </element> + </define> + + <define name="element-resource-set"> + <element name="resource_set"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="sequential"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <externalRef href="score.rng"/> + </optional> + <oneOrMore> + <element name="resource_ref"> + <attribute name="id"><data type="IDREF"/></attribute> + </element> + </oneOrMore> + </group> + </choice> + </element> + </define> + + <define name="element-colocation"> + <element name="rsc_colocation"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + <attribute name="score-attribute-mangle"><text/></attribute> + </choice> + </optional> + <optional> + <ref name="element-lifetime"/> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <attribute name="with-rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="node-attribute"><text/></attribute> + </optional> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="with-rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-order"> + <element name="rsc_order"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <ref name="element-lifetime"/> + </optional> + <optional> + <attribute name="symmetrical"><data type="boolean"/></attribute> + </optional> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="kind"> + <ref name="order-types"/> + </attribute> + </choice> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="first"><data type="IDREF"/></attribute> + <attribute name="then"><data type="IDREF"/></attribute> + <optional> + <attribute name="first-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="then-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="attribute-actions"> + <choice> + <value>start</value> + <value>promote</value> + <value>demote</value> + <value>stop</value> + </choice> + </define> + + <define name="attribute-roles"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Master</value> + <value>Slave</value> + </choice> + </define> + + <define name="order-types"> + <choice> + <value>Optional</value> + <value>Mandatory</value> + <value>Serialize</value> + </choice> + </define> + + <define name="element-lifetime"> + <element name="lifetime"> + <oneOrMore> + <externalRef href="rule.rng"/> + </oneOrMore> + </element> + </define> + +</grammar> diff --git a/test/unittests/schemas/constraints-1.1.rng b/test/unittests/schemas/constraints-1.1.rng new file mode 100644 index 0000000..fff0fb7 --- /dev/null +++ b/test/unittests/schemas/constraints-1.1.rng @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-constraints"/> + </start> + + <define name="element-constraints"> + <zeroOrMore> + <choice> + <ref name="element-location"/> + <ref name="element-colocation"/> + <ref name="element-order"/> + <ref name="element-rsc_ticket"/> + </choice> + </zeroOrMore> + </define> + + <define name="element-location"> + <element name="rsc_location"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <choice> + <attribute name="rsc"><data type="IDREF"/></attribute> + <attribute name="rsc-pattern"><text/></attribute> + </choice> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + </choice> + <choice> + <group> + <choice> + <attribute name="domain"><data type="IDREF"/></attribute> + <group> + <attribute name="node"><text/></attribute> + <externalRef href="score.rng"/> + </group> + </choice> + </group> + <oneOrMore> + <externalRef href="rule.rng"/> + </oneOrMore> + </choice> + <optional> + <ref name="element-lifetime"/> + </optional> + </element> + </define> + + <define name="element-resource-set"> + <element name="resource_set"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="sequential"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="require-all"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <externalRef href="score.rng"/> + </optional> + <oneOrMore> + <element name="resource_ref"> + <attribute name="id"><data type="IDREF"/></attribute> + </element> + </oneOrMore> + </group> + </choice> + </element> + </define> + + <define name="element-colocation"> + <element name="rsc_colocation"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + <attribute name="score-attribute-mangle"><text/></attribute> + </choice> + </optional> + <optional> + <ref name="element-lifetime"/> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <attribute name="with-rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="node-attribute"><text/></attribute> + </optional> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="with-rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="rsc-instance"><data type="integer"/></attribute> + </optional> + <optional> + <attribute name="with-rsc-instance"><data type="integer"/></attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-order"> + <element name="rsc_order"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <ref name="element-lifetime"/> + </optional> + <optional> + <attribute name="symmetrical"><data type="boolean"/></attribute> + </optional> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="kind"> + <ref name="order-types"/> + </attribute> + </choice> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="first"><data type="IDREF"/></attribute> + <attribute name="then"><data type="IDREF"/></attribute> + <optional> + <attribute name="first-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="then-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="first-instance"><data type="integer"/></attribute> + </optional> + <optional> + <attribute name="then-instance"><data type="integer"/></attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-rsc_ticket"> + <element name="rsc_ticket"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + </choice> + <attribute name="ticket"><text/></attribute> + <optional> + <attribute name="loss-policy"> + <choice> + <value>stop</value> + <value>demote</value> + <value>fence</value> + <value>freeze</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <define name="attribute-actions"> + <choice> + <value>start</value> + <value>promote</value> + <value>demote</value> + <value>stop</value> + </choice> + </define> + + <define name="attribute-roles"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Master</value> + <value>Slave</value> + </choice> + </define> + + <define name="order-types"> + <choice> + <value>Optional</value> + <value>Mandatory</value> + <value>Serialize</value> + </choice> + </define> + + <define name="element-lifetime"> + <element name="lifetime"> + <oneOrMore> + <externalRef href="rule.rng"/> + </oneOrMore> + </element> + </define> + +</grammar> diff --git a/test/unittests/schemas/constraints-1.2.rng b/test/unittests/schemas/constraints-1.2.rng new file mode 100644 index 0000000..221140c --- /dev/null +++ b/test/unittests/schemas/constraints-1.2.rng @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-constraints"/> + </start> + + <define name="element-constraints"> + <zeroOrMore> + <choice> + <ref name="element-location"/> + <ref name="element-colocation"/> + <ref name="element-order"/> + <ref name="element-rsc_ticket"/> + </choice> + </zeroOrMore> + </define> + + <define name="element-location"> + <element name="rsc_location"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <choice> + <group> + <externalRef href="score.rng"/> + <attribute name="node"><text/></attribute> + </group> + <oneOrMore> + <externalRef href="rule.rng"/> + </oneOrMore> + </choice> + <optional> + <ref name="element-lifetime"/> + </optional> + </element> + </define> + + <define name="element-resource-set"> + <element name="resource_set"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="sequential"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="require-all"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <externalRef href="score.rng"/> + </optional> + <oneOrMore> + <element name="resource_ref"> + <attribute name="id"><data type="IDREF"/></attribute> + </element> + </oneOrMore> + </group> + </choice> + </element> + </define> + + <define name="element-colocation"> + <element name="rsc_colocation"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + <attribute name="score-attribute-mangle"><text/></attribute> + </choice> + </optional> + <optional> + <ref name="element-lifetime"/> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <attribute name="with-rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="node-attribute"><text/></attribute> + </optional> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + <optional> + <attribute name="with-rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-order"> + <element name="rsc_order"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <ref name="element-lifetime"/> + </optional> + <optional> + <attribute name="symmetrical"><data type="boolean"/></attribute> + </optional> + <optional> + <choice> + <externalRef href="score.rng"/> + <attribute name="kind"> + <ref name="order-types"/> + </attribute> + </choice> + </optional> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="first"><data type="IDREF"/></attribute> + <attribute name="then"><data type="IDREF"/></attribute> + <optional> + <attribute name="first-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + <optional> + <attribute name="then-action"> + <ref name="attribute-actions"/> + </attribute> + </optional> + </group> + </choice> + </element> + </define> + + <define name="element-rsc_ticket"> + <element name="rsc_ticket"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <oneOrMore> + <ref name="element-resource-set"/> + </oneOrMore> + <group> + <attribute name="rsc"><data type="IDREF"/></attribute> + <optional> + <attribute name="rsc-role"> + <ref name="attribute-roles"/> + </attribute> + </optional> + </group> + </choice> + <attribute name="ticket"><text/></attribute> + <optional> + <attribute name="loss-policy"> + <choice> + <value>stop</value> + <value>demote</value> + <value>fence</value> + <value>freeze</value> + </choice> + </attribute> + </optional> + </element> + </define> + + <define name="attribute-actions"> + <choice> + <value>start</value> + <value>promote</value> + <value>demote</value> + <value>stop</value> + </choice> + </define> + + <define name="attribute-roles"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Master</value> + <value>Slave</value> + </choice> + </define> + + <define name="order-types"> + <choice> + <value>Optional</value> + <value>Mandatory</value> + <value>Serialize</value> + </choice> + </define> + + <define name="element-lifetime"> + <element name="lifetime"> + <oneOrMore> + <externalRef href="rule.rng"/> + </oneOrMore> + </element> + </define> + +</grammar> diff --git a/test/unittests/schemas/fencing.rng b/test/unittests/schemas/fencing.rng new file mode 100644 index 0000000..87de5a8 --- /dev/null +++ b/test/unittests/schemas/fencing.rng @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-stonith"/> + </start> + + <define name="element-stonith"> + <element name="fencing-topology"> + <zeroOrMore> + <ref name="element-level"/> + </zeroOrMore> + </element> + </define> + + <define name="element-level"> + <element name="fencing-level"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="target"><text/></attribute> + <attribute name="index"><data type="positiveInteger"/></attribute> + <attribute name="devices"> + <data type="string"> + <param name="pattern">([a-zA-Z0-9_\.\-]+)(,[a-zA-Z0-9_\.\-]+)*</param> + </data> + </attribute> + </element> + </define> + +</grammar> diff --git a/test/unittests/schemas/nvset.rng b/test/unittests/schemas/nvset.rng new file mode 100644 index 0000000..0d7e72c --- /dev/null +++ b/test/unittests/schemas/nvset.rng @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- types: http://www.w3.org/TR/xmlschema-2/#dateTime --> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-nvset"/> + </start> + + <define name="element-nvset"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <interleave> + <optional> + <externalRef href="rule.rng"/> + </optional> + <zeroOrMore> + <element name="nvpair"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="name"><text/></attribute> + <optional> + <attribute name="value"><text/></attribute> + </optional> + </element> + </zeroOrMore> + <optional> + <externalRef href="score.rng"/> + </optional> + </interleave> + </group> + </choice> + </define> + +</grammar> diff --git a/test/unittests/schemas/pacemaker-1.0.rng b/test/unittests/schemas/pacemaker-1.0.rng new file mode 100644 index 0000000..7100393 --- /dev/null +++ b/test/unittests/schemas/pacemaker-1.0.rng @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- types: http://www.w3.org/TR/xmlschema-2/#dateTime --> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <element name="cib"> + <ref name="element-cib"/> + </element> + </start> + + <define name="element-cib"> + <ref name="attribute-options"/> + <element name="configuration"> + <interleave> + <element name="crm_config"> + <zeroOrMore> + <element name="cluster_property_set"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + <optional> + <element name="rsc_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </optional> + <optional> + <element name="op_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </optional> + <ref name="element-nodes"/> + <element name="resources"> + <externalRef href="resources-1.0.rng"/> + </element> + <element name="constraints"> + <externalRef href="constraints-1.0.rng"/> + </element> + </interleave> + </element> + <element name="status"> + <ref name="element-status"/> + </element> + </define> + + <define name="attribute-options"> + <externalRef href="versions.rng"/> + <optional> + <attribute name="crm_feature_set"><text/></attribute> + </optional> + <optional> + <attribute name="remote-tls-port"><data type="nonNegativeInteger"/></attribute> + </optional> + <optional> + <attribute name="remote-clear-port"><data type="nonNegativeInteger"/></attribute> + </optional> + <optional> + <attribute name="have-quorum"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="dc-uuid"><text/></attribute> + </optional> + <optional> + <attribute name="cib-last-written"><text/></attribute> + </optional> + <optional> + <attribute name="no-quorum-panic"><data type="boolean"/></attribute> + </optional> + </define> + + <define name="element-nodes"> + <element name="nodes"> + <zeroOrMore> + <element name="node"> + <attribute name="id"><text/></attribute> + <attribute name="uname"><text/></attribute> + <attribute name="type"> + <choice> + <value>normal</value> + <value>member</value> + <value>ping</value> + </choice> + </attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <zeroOrMore> + <element name="instance_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </zeroOrMore> + </element> + </define> + + <define name="element-status"> + <zeroOrMore> + <choice> + <attribute> + <anyName/> + <text/> + </attribute> + <element> + <anyName/> + <ref name="element-status"/> + </element> + <text/> + </choice> + </zeroOrMore> + </define> + +</grammar> diff --git a/test/unittests/schemas/pacemaker-1.1.rng b/test/unittests/schemas/pacemaker-1.1.rng new file mode 100644 index 0000000..50e9458 --- /dev/null +++ b/test/unittests/schemas/pacemaker-1.1.rng @@ -0,0 +1,161 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- types: http://www.w3.org/TR/xmlschema-2/#dateTime --> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <element name="cib"> + <ref name="element-cib"/> + </element> + </start> + + <define name="element-cib"> + <ref name="attribute-options"/> + <element name="configuration"> + <interleave> + <element name="crm_config"> + <zeroOrMore> + <element name="cluster_property_set"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + <optional> + <element name="rsc_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </optional> + <optional> + <element name="op_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </optional> + <ref name="element-nodes"/> + <element name="resources"> + <externalRef href="resources-1.1.rng"/> + </element> + <optional> + <element name="domains"> + <zeroOrMore> + <element name="domain"> + <attribute name="id"><data type="ID"/></attribute> + <zeroOrMore> + <element name="node"> + <attribute name="name"><text/></attribute> + <externalRef href="score.rng"/> + </element> + </zeroOrMore> + </element> + </zeroOrMore> + </element> + </optional> + <element name="constraints"> + <externalRef href="constraints-1.1.rng"/> + </element> + <optional> + <externalRef href="acls-1.1.rng"/> + </optional> + <optional> + <externalRef href="fencing.rng"/> + </optional> + </interleave> + </element> + <element name="status"> + <ref name="element-status"/> + </element> + </define> + + <define name="attribute-options"> + <externalRef href="versions.rng"/> + <optional> + <attribute name="crm_feature_set"><text/></attribute> + </optional> + <optional> + <attribute name="remote-tls-port"><data type="nonNegativeInteger"/></attribute> + </optional> + <optional> + <attribute name="remote-clear-port"><data type="nonNegativeInteger"/></attribute> + </optional> + <optional> + <attribute name="have-quorum"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="dc-uuid"><text/></attribute> + </optional> + <optional> + <attribute name="cib-last-written"><text/></attribute> + </optional> + <optional> + <attribute name="no-quorum-panic"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="update-origin"><text/></attribute> + </optional> + <optional> + <attribute name="update-client"><text/></attribute> + </optional> + <optional> + <attribute name="update-user"><text/></attribute> + </optional> + </define> + + <define name="element-nodes"> + <element name="nodes"> + <zeroOrMore> + <element name="node"> + <attribute name="id"><text/></attribute> + <attribute name="uname"><text/></attribute> + <optional> + <attribute name="type"> + <choice> + <value>normal</value> + <value>member</value> + <value>ping</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <optional> + <externalRef href="score.rng"/> + </optional> + <zeroOrMore> + <choice> + <element name="instance_attributes"> + <externalRef href="nvset.rng"/> + </element> + <element name="utilization"> + <externalRef href="nvset.rng"/> + </element> + </choice> + </zeroOrMore> + </element> + </zeroOrMore> + </element> + </define> + + <define name="element-status"> + <zeroOrMore> + <choice> + <attribute> + <anyName/> + <text/> + </attribute> + <element> + <anyName/> + <ref name="element-status"/> + </element> + <text/> + </choice> + </zeroOrMore> + </define> + +</grammar> diff --git a/test/unittests/schemas/pacemaker-1.2.rng b/test/unittests/schemas/pacemaker-1.2.rng new file mode 100644 index 0000000..33a7d2d --- /dev/null +++ b/test/unittests/schemas/pacemaker-1.2.rng @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- types: http://www.w3.org/TR/xmlschema-2/#dateTime --> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <element name="cib"> + <ref name="element-cib"/> + </element> + </start> + + <define name="element-cib"> + <ref name="attribute-options"/> + <element name="configuration"> + <interleave> + <element name="crm_config"> + <zeroOrMore> + <element name="cluster_property_set"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + <optional> + <element name="rsc_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </optional> + <optional> + <element name="op_defaults"> + <zeroOrMore> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </element> + </optional> + <ref name="element-nodes"/> + <element name="resources"> + <externalRef href="resources-1.2.rng"/> + </element> + <element name="constraints"> + <externalRef href="constraints-1.2.rng"/> + </element> + <optional> + <externalRef href="acls-1.2.rng"/> + </optional> + <optional> + <externalRef href="fencing.rng"/> + </optional> + </interleave> + </element> + <element name="status"> + <ref name="element-status"/> + </element> + </define> + + <define name="attribute-options"> + <externalRef href="versions.rng"/> + <optional> + <attribute name="crm_feature_set"><text/></attribute> + </optional> + <optional> + <attribute name="remote-tls-port"><data type="nonNegativeInteger"/></attribute> + </optional> + <optional> + <attribute name="remote-clear-port"><data type="nonNegativeInteger"/></attribute> + </optional> + <optional> + <attribute name="have-quorum"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="dc-uuid"><text/></attribute> + </optional> + <optional> + <attribute name="cib-last-written"><text/></attribute> + </optional> + <optional> + <attribute name="no-quorum-panic"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="update-origin"><text/></attribute> + </optional> + <optional> + <attribute name="update-client"><text/></attribute> + </optional> + <optional> + <attribute name="update-user"><text/></attribute> + </optional> + </define> + + <define name="element-nodes"> + <element name="nodes"> + <zeroOrMore> + <element name="node"> + <attribute name="id"><text/></attribute> + <attribute name="uname"><text/></attribute> + <optional> + <attribute name="type"> + <choice> + <value>normal</value> + <value>member</value> + <value>ping</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <optional> + <externalRef href="score.rng"/> + </optional> + <zeroOrMore> + <choice> + <element name="instance_attributes"> + <externalRef href="nvset.rng"/> + </element> + <element name="utilization"> + <externalRef href="nvset.rng"/> + </element> + </choice> + </zeroOrMore> + </element> + </zeroOrMore> + </element> + </define> + + <define name="element-status"> + <zeroOrMore> + <choice> + <attribute> + <anyName/> + <text/> + </attribute> + <element> + <anyName/> + <ref name="element-status"/> + </element> + <text/> + </choice> + </zeroOrMore> + </define> + +</grammar> diff --git a/test/unittests/schemas/resources-1.0.rng b/test/unittests/schemas/resources-1.0.rng new file mode 100644 index 0000000..7ea2228 --- /dev/null +++ b/test/unittests/schemas/resources-1.0.rng @@ -0,0 +1,177 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-resources"/> + </start> + + <define name="element-resources"> + <zeroOrMore> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + <ref name="element-clone"/> + <ref name="element-master"/> + </choice> + </zeroOrMore> + </define> + + <define name="element-primitive"> + <element name="primitive"> + <interleave> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <attribute name="class"><value>ocf</value></attribute> + <attribute name="provider"><text/></attribute> + </group> + <attribute name="class"> + <choice> + <value>lsb</value> + <value>heartbeat</value> + <value>stonith</value> + <value>upstart</value> + </choice> + </attribute> + </choice> + <attribute name="type"><text/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <ref name="element-resource-extra"/> + <ref name="element-operations"/> + </interleave> + </element> + </define> + + <define name="element-group"> + <element name="group"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <oneOrMore> + <ref name="element-primitive"/> + </oneOrMore> + </interleave> + </element> + </define> + + <define name="element-clone"> + <element name="clone"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + </choice> + </interleave> + </element> + </define> + + <define name="element-master"> + <element name="master"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + </choice> + </interleave> + </element> + </define> + + <define name="element-resource-extra"> + <zeroOrMore> + <choice> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + <element name="instance_attributes"> + <externalRef href="nvset.rng"/> + </element> + </choice> + </zeroOrMore> + </define> + + <define name="element-operations"> + <optional> + <element name="operations"> + <optional> + <attribute name="id"><data type="ID"/></attribute> + </optional> + <optional> + <attribute name="id-ref"><data type="IDREF"/></attribute> + </optional> + <zeroOrMore> + <element name="op"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="name"><text/></attribute> + <attribute name="interval"><text/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <optional> + <choice> + <attribute name="start-delay"><text/></attribute> + <attribute name="interval-origin"><text/></attribute> + </choice> + </optional> + <optional> + <attribute name="timeout"><text/></attribute> + </optional> + <optional> + <attribute name="enabled"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="record-pending"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="role"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Slave</value> + <value>Master</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="requires"> + <choice> + <value>nothing</value> + <value>quorum</value> + <value>fencing</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="on-fail"> + <choice> + <value>ignore</value> + <value>block</value> + <value>stop</value> + <value>restart</value> + <value>standby</value> + <value>fence</value> + </choice> + </attribute> + </optional> + <ref name="element-resource-extra"/> + </element> + </zeroOrMore> + </element> + </optional> + </define> + +</grammar> diff --git a/test/unittests/schemas/resources-1.1.rng b/test/unittests/schemas/resources-1.1.rng new file mode 100644 index 0000000..81a8f82 --- /dev/null +++ b/test/unittests/schemas/resources-1.1.rng @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-resources"/> + </start> + + <define name="element-resources"> + <zeroOrMore> + <choice> + <ref name="element-primitive"/> + <ref name="element-template"/> + <ref name="element-group"/> + <ref name="element-clone"/> + <ref name="element-master"/> + </choice> + </zeroOrMore> + </define> + + <define name="element-primitive"> + <element name="primitive"> + <interleave> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <choice> + <group> + <attribute name="class"><value>ocf</value></attribute> + <attribute name="provider"><text/></attribute> + </group> + <attribute name="class"> + <choice> + <value>lsb</value> + <value>heartbeat</value> + <value>stonith</value> + <value>upstart</value> + <value>service</value> + <value>systemd</value> + <value>nagios</value> + </choice> + </attribute> + </choice> + <attribute name="type"><text/></attribute> + </group> + <attribute name="template"><data type="IDREF"/></attribute> + </choice> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <ref name="element-resource-extra"/> + <ref name="element-operations"/> + <zeroOrMore> + <element name="utilization"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="element-template"> + <element name="template"> + <interleave> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <attribute name="class"><value>ocf</value></attribute> + <attribute name="provider"><text/></attribute> + </group> + <attribute name="class"> + <choice> + <value>lsb</value> + <value>heartbeat</value> + <value>stonith</value> + <value>upstart</value> + </choice> + </attribute> + </choice> + <attribute name="type"><text/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <ref name="element-resource-extra"/> + <ref name="element-operations"/> + <zeroOrMore> + <element name="utilization"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="element-group"> + <element name="group"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <oneOrMore> + <ref name="element-primitive"/> + </oneOrMore> + </interleave> + </element> + </define> + + <define name="element-clone"> + <element name="clone"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + </choice> + </interleave> + </element> + </define> + + <define name="element-master"> + <element name="master"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + </choice> + </interleave> + </element> + </define> + + <define name="element-resource-extra"> + <zeroOrMore> + <choice> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + <element name="instance_attributes"> + <externalRef href="nvset.rng"/> + </element> + </choice> + </zeroOrMore> + </define> + + <define name="element-operations"> + <optional> + <element name="operations"> + <optional> + <attribute name="id"><data type="ID"/></attribute> + </optional> + <optional> + <attribute name="id-ref"><data type="IDREF"/></attribute> + </optional> + <zeroOrMore> + <element name="op"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="name"><text/></attribute> + <attribute name="interval"><text/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <optional> + <choice> + <attribute name="start-delay"><text/></attribute> + <attribute name="interval-origin"><text/></attribute> + </choice> + </optional> + <optional> + <attribute name="timeout"><text/></attribute> + </optional> + <optional> + <attribute name="enabled"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="record-pending"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="role"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Slave</value> + <value>Master</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="requires"> + <choice> + <value>nothing</value> + <value>quorum</value> + <value>fencing</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="on-fail"> + <choice> + <value>ignore</value> + <value>block</value> + <value>stop</value> + <value>restart</value> + <value>standby</value> + <value>fence</value> + <value>restart-container</value> + </choice> + </attribute> + </optional> + <ref name="element-resource-extra"/> + </element> + </zeroOrMore> + </element> + </optional> + </define> + +</grammar> diff --git a/test/unittests/schemas/resources-1.2.rng b/test/unittests/schemas/resources-1.2.rng new file mode 100644 index 0000000..81a8f82 --- /dev/null +++ b/test/unittests/schemas/resources-1.2.rng @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-resources"/> + </start> + + <define name="element-resources"> + <zeroOrMore> + <choice> + <ref name="element-primitive"/> + <ref name="element-template"/> + <ref name="element-group"/> + <ref name="element-clone"/> + <ref name="element-master"/> + </choice> + </zeroOrMore> + </define> + + <define name="element-primitive"> + <element name="primitive"> + <interleave> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <choice> + <group> + <attribute name="class"><value>ocf</value></attribute> + <attribute name="provider"><text/></attribute> + </group> + <attribute name="class"> + <choice> + <value>lsb</value> + <value>heartbeat</value> + <value>stonith</value> + <value>upstart</value> + <value>service</value> + <value>systemd</value> + <value>nagios</value> + </choice> + </attribute> + </choice> + <attribute name="type"><text/></attribute> + </group> + <attribute name="template"><data type="IDREF"/></attribute> + </choice> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <ref name="element-resource-extra"/> + <ref name="element-operations"/> + <zeroOrMore> + <element name="utilization"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="element-template"> + <element name="template"> + <interleave> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <attribute name="class"><value>ocf</value></attribute> + <attribute name="provider"><text/></attribute> + </group> + <attribute name="class"> + <choice> + <value>lsb</value> + <value>heartbeat</value> + <value>stonith</value> + <value>upstart</value> + </choice> + </attribute> + </choice> + <attribute name="type"><text/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <ref name="element-resource-extra"/> + <ref name="element-operations"/> + <zeroOrMore> + <element name="utilization"> + <externalRef href="nvset.rng"/> + </element> + </zeroOrMore> + </interleave> + </element> + </define> + + <define name="element-group"> + <element name="group"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <oneOrMore> + <ref name="element-primitive"/> + </oneOrMore> + </interleave> + </element> + </define> + + <define name="element-clone"> + <element name="clone"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + </choice> + </interleave> + </element> + </define> + + <define name="element-master"> + <element name="master"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <interleave> + <ref name="element-resource-extra"/> + <choice> + <ref name="element-primitive"/> + <ref name="element-group"/> + </choice> + </interleave> + </element> + </define> + + <define name="element-resource-extra"> + <zeroOrMore> + <choice> + <element name="meta_attributes"> + <externalRef href="nvset.rng"/> + </element> + <element name="instance_attributes"> + <externalRef href="nvset.rng"/> + </element> + </choice> + </zeroOrMore> + </define> + + <define name="element-operations"> + <optional> + <element name="operations"> + <optional> + <attribute name="id"><data type="ID"/></attribute> + </optional> + <optional> + <attribute name="id-ref"><data type="IDREF"/></attribute> + </optional> + <zeroOrMore> + <element name="op"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="name"><text/></attribute> + <attribute name="interval"><text/></attribute> + <optional> + <attribute name="description"><text/></attribute> + </optional> + <optional> + <choice> + <attribute name="start-delay"><text/></attribute> + <attribute name="interval-origin"><text/></attribute> + </choice> + </optional> + <optional> + <attribute name="timeout"><text/></attribute> + </optional> + <optional> + <attribute name="enabled"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="record-pending"><data type="boolean"/></attribute> + </optional> + <optional> + <attribute name="role"> + <choice> + <value>Stopped</value> + <value>Started</value> + <value>Slave</value> + <value>Master</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="requires"> + <choice> + <value>nothing</value> + <value>quorum</value> + <value>fencing</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="on-fail"> + <choice> + <value>ignore</value> + <value>block</value> + <value>stop</value> + <value>restart</value> + <value>standby</value> + <value>fence</value> + <value>restart-container</value> + </choice> + </attribute> + </optional> + <ref name="element-resource-extra"/> + </element> + </zeroOrMore> + </element> + </optional> + </define> + +</grammar> diff --git a/test/unittests/schemas/rule.rng b/test/unittests/schemas/rule.rng new file mode 100644 index 0000000..242eff8 --- /dev/null +++ b/test/unittests/schemas/rule.rng @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + xmlns:ann="http://relaxng.org/ns/compatibility/annotations/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="element-rule"/> + </start> + + <define name="element-rule"> + <element name="rule"> + <choice> + <attribute name="id-ref"><data type="IDREF"/></attribute> + <group> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <externalRef href="score.rng"/> + <attribute name="score-attribute"><text/></attribute> + </choice> + <optional> + <attribute name="boolean-op"> + <choice> + <value>or</value> + <value>and</value> + </choice> + </attribute> + </optional> + <optional> + <attribute name="role"><text/></attribute> + </optional> + <oneOrMore> + <choice> + <element name="expression"> + <attribute name="id"><data type="ID"/></attribute> + <attribute name="attribute"><text/></attribute> + <attribute name="operation"> + <choice> + <value>lt</value> + <value>gt</value> + <value>lte</value> + <value>gte</value> + <value>eq</value> + <value>ne</value> + <value>defined</value> + <value>not_defined</value> + </choice> + </attribute> + <optional> + <attribute name="value"><text/></attribute> + </optional> + <optional> + <attribute name="type" ann:defaultValue="string"> + <choice> + <value>string</value> + <value>number</value> + <value>version</value> + </choice> + </attribute> + </optional> + </element> + <element name="date_expression"> + <attribute name="id"><data type="ID"/></attribute> + <choice> + <group> + <attribute name="operation"><value>in_range</value></attribute> + <choice> + <group> + <optional> + <attribute name="start"><text/></attribute> + </optional> + <attribute name="end"><text/></attribute> + </group> + <group> + <attribute name="start"><text/></attribute> + <element name="duration"> + <ref name="date-common"/> + </element> + </group> + </choice> + </group> + <group> + <attribute name="operation"><value>gt</value></attribute> + <attribute name="start"><text/></attribute> + </group> + <group> + <attribute name="operation"><value>lt</value></attribute> + <choice> + <attribute name="end"><text/></attribute> + </choice> + </group> + <group> + <attribute name="operation"><value>date_spec</value></attribute> + <element name="date_spec"> + <ref name="date-common"/> + </element> + </group> + </choice> + </element> + <ref name="element-rule"/> + </choice> + </oneOrMore> + </group> + </choice> + </element> + </define> + + <define name="date-common"> + <attribute name="id"><data type="ID"/></attribute> + <optional> + <attribute name="hours"><text/></attribute> + </optional> + <optional> + <attribute name="monthdays"><text/></attribute> + </optional> + <optional> + <attribute name="weekdays"><text/></attribute> + </optional> + <optional> + <attribute name="yearsdays"><text/></attribute> + </optional> + <optional> + <attribute name="months"><text/></attribute> + </optional> + <optional> + <attribute name="weeks"><text/></attribute> + </optional> + <optional> + <attribute name="years"><text/></attribute> + </optional> + <optional> + <attribute name="weekyears"><text/></attribute> + </optional> + <optional> + <attribute name="moon"><text/></attribute> + </optional> + </define> + +</grammar> diff --git a/test/unittests/schemas/score.rng b/test/unittests/schemas/score.rng new file mode 100644 index 0000000..57b10f2 --- /dev/null +++ b/test/unittests/schemas/score.rng @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="attribute-score"/> + </start> + + <define name="attribute-score"> + <attribute name="score"> + <choice> + <data type="integer"/> + <value>INFINITY</value> + <value>+INFINITY</value> + <value>-INFINITY</value> + </choice> + </attribute> + </define> +</grammar> diff --git a/test/unittests/schemas/versions.rng b/test/unittests/schemas/versions.rng new file mode 100644 index 0000000..ab4e4ea --- /dev/null +++ b/test/unittests/schemas/versions.rng @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" + datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> + <start> + <ref name="attribute-version"/> + </start> + + <define name="attribute-version"> + <attribute name="validate-with"> + <choice> + <value>none</value> + <value>pacemaker-0.6</value> + <value>transitional-0.6</value> + <value>pacemaker-0.7</value> + <value>pacemaker-1.0</value> + <value>pacemaker-1.1</value> + <value>pacemaker-1.2</value> + </choice> + </attribute> + <attribute name="admin_epoch"><data type="nonNegativeInteger"/></attribute> + <attribute name="epoch"><data type="nonNegativeInteger"/></attribute> + <attribute name="num_updates"><data type="nonNegativeInteger"/></attribute> + </define> +</grammar> |