Skip to content

Commit

Permalink
Merge branch 'master' into bdd/3350-value-types
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelmegitt committed Aug 31, 2016
2 parents 4384db6 + 570c58f commit b605625
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 10 deletions.
16 changes: 16 additions & 0 deletions docs/source/filesystem_carriage_mechanism.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Filesystem Carriage Mechanism
=============================

The filesystem carriage mechanism writes produced documents to the filesystem and consumes documents from the filesystem. Along with the documents, it writes a manifest file named according to the format `manifest_<sequence identifier>.txt`. Documents are named following the format `<sequence identifier>_<sequence number>.xml`.

Each time a document is written to the file system, a line using the following format is appended to the manifest file:

`availability_time,path_to_xml_file`

For example:

`09:20:31.279,TestSequence1_474.xml`

The format is `hh:mm:ss.fff,path` where `fff` represents milliseconds digits.

The manifest file gives the availability time for each document along with the path to the corresponding document. The timeline used for the availability times is the same as the one used in the documents, indeed the carriage implementation uses the same clock (or time reference) as the node that produces the documents. The writing order and thus the reading order is from top to bottom.
5 changes: 4 additions & 1 deletion docs/source/nodes_and_carriage_mechanisms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ Nodes and Carriage Mechanisms

The following piece should present the decisions behind the Node architecture and the carriage mechanism pluggability.

.. graphviz:: classes_Node_and_CarriageImpl.dot
.. graphviz:: classes_Node_and_CarriageImpl.dot

.. toctree::
filesystem_carriage_mechanism
4 changes: 2 additions & 2 deletions ebu_tt_live/xsd1.1/ebutt_live.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Please note that the EBU-TT XML Schema is a helping document and NOT normative b
information.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="metadata" type="ebuttm:anyMetadata_type" minOccurs="0"/>
<xs:element name="metadata" type="ebuttm:bodyMetadata_type" minOccurs="0"/>
<xs:element name="div" type="tt:div_type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="ttm:agent" use="optional"/>
Expand Down Expand Up @@ -323,7 +323,7 @@ Please note that the EBU-TT XML Schema is a helping document and NOT normative b
annotation or metadata.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="metadata" type="ebuttm:anyMetadata_type" minOccurs="0"/>
<xs:element name="metadata" type="ebuttm:spanMetadata_type" minOccurs="0"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="br" type="tt:br_type"/>
<xs:element name="span" type="tt:span_type"/>
Expand Down
22 changes: 22 additions & 0 deletions ebu_tt_live/xsd1.1/ebutt_metadata.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,18 @@ Please note that the EBU-TT XML Schema is a helping document and NOT normative b
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="bodyMetadata_type">
<xs:complexContent>
<xs:extension base="ebuttm:metadataBase_type">
<xs:sequence>
<xs:element name="authoringTechnique" type="authoringTechnique_type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="transitionStyle" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="facet" type="facet_type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="divMetadata_type">
<xs:complexContent>
Expand All @@ -609,6 +621,16 @@ Please note that the EBU-TT XML Schema is a helping document and NOT normative b
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="spanMetadata_type">
<xs:complexContent>
<xs:extension base="ebuttm:metadataBase_type">
<xs:sequence>
<xs:element name="facet" type="facet_type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="stylingMetadata_type">
<xs:complexContent>
Expand Down
14 changes: 7 additions & 7 deletions testing/SPEC-CONFORMANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ The conformance requirements for EBU-TT Part 3 derive from the specification its
|R23|2.4|The Handover Manager node shall use a 'who claimed control most recently' algorithm for selecting the sequence, based on a control token parameter within each document.| |
|R24|2.4.1|All documents within a sequence that contain the element `ebuttp:authorsGroupIdentifier` shall have the same `ebuttp:authorsGroupIdentifier`.| |
|R25|2.4.1|when a document is received with a higher value `ebuttp:authorsGroupControlToken` than that most recently received in the currently selected sequence the Handover Manager shall switch to that document's sequence, i.e. it shall emit a document in its output sequence corresponding to the received document with the new control token without delay.| |
|R26|2.5|it is an error to apply more than one `facet` with the same term identifier to the same content element, where the term identifier is the combination of the term name and the link attribute's value.| |
|R27|2.5.1|If all the content in a document has a `facet` then the summary shall be `"all\_has"`.| |
|R28|2.5.1|If all the content in a document has\_not a `facet` then the summary shall be `"all\_has_not"`.| |
|R29|2.5.1|If there is a mix of has and has\_not and unknown or if some of the content does not have the `facet` then the summary shall be `"mixed"`.| |
|R30|2.5.1|If none of the document's content has the `facet` or all of the document's content has the `facet` described as unknown then the summary shall be `"unspecified"`.| |
|R26|2.5|it is an error to apply more than one `facet` with the same term identifier to the same content element, where the term identifier is the combination of the term name and the link attribute's value.|`bdd/features/validation/facet.feature` `(In)valid term identifier`|
|R27|2.5.1|If all the content in a document has a `facet` then the summary shall be `"all\_has"`.| `bdd/features/validation/facet.feature` `(In)valid term identifier`|
|R28|2.5.1|If all the content in a document has\_not a `facet` then the summary shall be `"all\_has_not"`.|`bdd/features/validation/facet.feature` `(In)valid facet summary` |
|R29|2.5.1|If there is a mix of has and has\_not and unknown or if some of the content does not have the `facet` then the summary shall be `"mixed"`.|`bdd/features/validation/facet.feature` `(In)valid facet summary` |
|R30|2.5.1|If none of the document's content has the `facet` or all of the document's content has the `facet` described as unknown then the summary shall be `"unspecified"`.| `bdd/features/validation/facet.feature` `(In)valid facet summary`|
|R31|2.6|If present, a `trace` element shall describe in text the action that generated the document, in the action attribute, and an identifier that performed that action, in the `generatedBy` attribute.|`bdd/features/validation/trace.feature` `(In)valid trace attributes`|
|R32|3.2.2.1|`ttp:timeBase` Cardinality 1..1|`bdd/features/validation/timeBase_attribute_mandatory.feature` `(In)valid ttp:timeBase`|
|R33|3.2.2.1|The `ttp:timeBase` element is as defined in [EBUTT1] with the addition that all time expressions of `dur` attributes shall denote a relative coordinate on the same timeline as the `begin` and `end` attributes.| |
Expand Down Expand Up @@ -72,8 +72,8 @@ The conformance requirements for EBU-TT Part 3 derive from the specification its
|R63|3.2.2.5|`p` `end` attribute: If the timebase is "smpte" the type shall be `ebuttdt:smpteTimingType`. | `bdd/features/validation/timeBase\_timeformat\_constraints.feature` `(In)valid times according to timeBase in p`|
|R64|3.2.2.5|`p` `end` attribute: If the timebase is "media" the type shall be `ebuttdt:mediaTimingType`. |`bdd/features/validation/timeBase\_timeformat\_constraints.feature` `(In)valid times according to timeBase in p`|
|R65|3.2.2.5|`p` `end` attribute: If the timebase is "clock" the type shall be `ebuttdt:clockTimingType`. |`bdd/features/validation/timeBase\_timeformat\_constraints.feature` `(In)valid times according to timeBase in p`|
|R66|3.2.2.6.1|Each distinctly identified facet shall have a separate `facet` element, where facets are identified by combination of the text content and the link attribute.| |
|R67|3.2.2.6.1|Elements shall NOT contain more than one `facet` element referring to the same term.| |
|R66|3.2.2.6.1|Each distinctly identified facet shall have a separate `facet` element, where facets are identified by combination of the text content and the link attribute.|`bdd/features/validation/facet.feature` `(In)valid term identifier`|
|R67|3.2.2.6.1|Elements shall NOT contain more than one `facet` element referring to the same term.|`bdd/features/validation/facet.feature` `(In)valid term identifier`|
|R68|3.3.1| `ebuttdt:delayTimingType` The content shall be constrained to a signed (positive or negative) number with an optional decimal fraction, followed by a time metric being one of: "h" (hours), "m" (minutes), "s" (seconds), "ms" (milliseconds).|`bdd/features/delayTimingType.feature` `(In)valid delayTimingType format`|
| | **Tech3350 v1.1**| | |
|R69|3|If `ttp:timeBase="smpte"` then the time expression of `begin` and `end` SHALL have the format hh:mm:ss:ff|`bdd/features/validation/timeBase\_timeformat\_constraints.feature`|
Expand Down
76 changes: 76 additions & 0 deletions testing/bdd/features/validation/facet.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@validation @syntax @sequence @xsd
Feature: Facet
Rules on use of ebuttm:facet and ebuttm:documentFacet


# SPEC-CONFORMANCE: R26 R66 R67
# skipped because the semantic validation does not check facets yet
@skip
Scenario: Invalid term identifier
Given an xml file <xml_file>
When it has facet1 applied to element <parent1>
And facet1 has attribute <link1>
And facet1 contains string <term1>
And it has facet2 applied to element <parent2>
And facet2 has attribute <link2>
And facet2 contains string <term2>
Then document is invalid

Examples:
| xml_file | parent1 | link1 | term1 | parent2 | link2 | term2 |
| facet.xml | body | http://link1.com | string1 | body | http://link1.com | string1 |


Scenario: Valid term identifier
Given an xml file <xml_file>
When it has facet1 applied to element <parent1>
And facet1 has attribute <link1>
And facet1 contains string <term1>
And it has facet2 applied to element <parent2>
And facet2 has attribute <link2>
And facet2 contains string <term2>
Then document is valid

Examples:
| xml_file | parent1 | link1 | term1 | parent2 | link2 | term2 |
| facet.xml | body | http://link1.com | string1 | div | http://link1.com | string1 |
| facet.xml | p | http://link1.com | string1 | p | http://link2.com | string2 |
| facet.xml | span | http://link1.com | string1 | span | http://link1.com | string2 |


# SPEC-CONFORMANCE: R27 R28 R29 R30
Scenario: Valid Facet Summary
Given an xml file <xml_file>
When it has element facet1 with attribute <expresses1>
And it has element facet2 with attribute <expresses2>
And it has element facet3 with attribute <expresses3>
And documentFacet has atribute <summary>
Then document is valid

Examples:
| xml_file | expresses1 | expresses2 | expresses3 | summary |
| facet.xml | has | has | has | all_has |
| facet.xml | has_not | has_not | has_not | all_has_not |
| facet.xml | has | has_not | has | mixed |
| facet.xml | unknown | has | has | mixed |
| facet.xml | | | | unspecified |
| facet.xml | unknown | unknown | unknown | unspecified |


Scenario: Invalid Facet Summary
Given an xml file <xml_file>
When it has element facet1 with attribute <expresses1>
And it has element facet2 with attribute <expresses2>
And it has element facet3 with attribute <expresses3>
And documentFacet has atribute <summary>
Then document is invalid

Examples:
| xml_file | expresses1 | expresses2 | expresses3 | summary |
| facet.xml | has_not | has_not | has_not | has |
| facet.xml | has | has_not | has | has |
| facet.xml | | | | has_not |
| facet.xml | unknown | unknown | unknown | has |
@skip # again semantic validation for that part is missing in the xml validation for now
| facet.xml | has | has | has | all_has_not |
| facet.xml | unknown | has | has | unspecified |
43 changes: 43 additions & 0 deletions testing/bdd/templates/facet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" ?>
<tt:tt ebuttp:sequenceIdentifier="testSequence001" ebuttp:sequenceNumber="1" ttp:clockMode="local" ttp:timeBase="clock" xml:lang="en-GB" xmlns:ebuttm="urn:ebu:tt:metadata" xmlns:ebuttp="urn:ebu:tt:parameters" xmlns:tt="http://www.w3.org/ns/ttml" xmlns:ttp="http://www.w3.org/ns/ttml#parameter" xmlns:xml="http://www.w3.org/XML/1998/namespace">
<tt:head>
<tt:metadata>
{% if document_facets %}
<ebuttm:documentMetadata>
{{document_facets}}
</ebuttm:documentMetadata>
{% else %}
<ebuttm:documentMetadata/>
{% endif %}
</tt:metadata>
</tt:head>
<tt:body>
{% if body_facets %}
<tt:metadata>
{{body_facets}}
</tt:metadata>
{% endif %}
<tt:div>
{% if div_facets %}
<tt:metadata>
{{div_facets}}
</tt:metadata>
{% endif %}
<tt:p xml:id="ID005">
{% if p_facets %}
<tt:metadata>
{{p_facets}}
</tt:metadata>
{% endif %}
<tt:span>
{% if span_facets %}
<tt:metadata>
{{span_facets}}
</tt:metadata>
{% endif %}
Some example text...
</tt:span>
</tt:p>
</tt:div>
</tt:body>
</tt:tt>
85 changes: 85 additions & 0 deletions testing/bdd/test_facet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
from pytest_bdd import when, scenarios


scenarios('features/validation/facet.feature')


@when('it has facet1 applied to element <parent1>')
def when_facet1_to_parent1(parent1, template_dict, test_context):
test_context['parent1'] = parent1
key = parent1 + "_facets"
if key in template_dict:
template_dict[key] += "<ebuttm:facet"
else:
template_dict[key] = "<ebuttm:facet"


@when('facet1 has attribute <link1>')
def when_facet1_link1(link1, template_dict, test_context):
key = test_context['parent1'] + "_facets"
if link1:
template_dict[key] += ' link="{}"'.format(link1)


@when('facet1 contains string <term1>')
def when_facet1_term1(term1, template_dict, test_context):
key = test_context['parent1'] + "_facets"
template_dict[key] += '>{}</ebuttm:facet>'.format(term1)


@when('it has facet2 applied to element <parent2>')
def when_facet2_to_parent2(parent2, template_dict, test_context):
test_context['parent2'] = parent2
key = parent2 + "_facets"
if key in template_dict:
template_dict[key] += "<ebuttm:facet"
else:
template_dict[key] = "<ebuttm:facet"


@when('facet2 has attribute <link2>')
def when_facet2_link2(link2, template_dict, test_context):
key = test_context['parent2'] + "_facets"
if link2:
template_dict[key] += ' link="{}"'.format(link2)


@when('facet2 contains string <term2>')
def when_facet2_term2(term2, template_dict, test_context):
key = test_context['parent2'] + "_facets"
template_dict[key] += '>{}</ebuttm:facet>'.format(term2)


@when('it has element facet1 with attribute <expresses1>')
def when_facet1_expresses1(expresses1, template_dict):
value = '<ebuttm:facet'
if expresses1:
value += ' expresses="{}">test_facet</ebuttm:facet>'.format(expresses1)
else:
value += '>test_facet</ebuttm:facet>'
template_dict['body_facets'] = value


@when('it has element facet2 with attribute <expresses2>')
def when_facet2_expresses2(expresses2, template_dict):
value = '<ebuttm:facet'
if expresses2:
value += ' expresses="{}">test_facet</ebuttm:facet>'.format(expresses2)
else:
value += '>test_facet</ebuttm:facet>'
template_dict['div_facets'] = value


@when('it has element facet3 with attribute <expresses3>')
def when_facet3_expresses3(expresses3, template_dict):
value = '<ebuttm:facet'
if expresses3:
value += ' expresses="{}">test_facet</ebuttm:facet>'.format(expresses3)
else:
value += '>test_facet</ebuttm:facet>'
template_dict['p_facets'] = value


@when('documentFacet has atribute <summary>')
def when_documentFacet_summary(summary, template_dict):
template_dict['document_facets'] = '<ebuttm:documentFacet summary="{}">test_facet</ebuttm:documentFacet>'.format(summary)

0 comments on commit b605625

Please sign in to comment.