Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functional regression test for zxtunes.com and zxart.ee remote API.
- Loading branch information
1 parent
24655d5
commit 39bc7e3
Showing
4 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
all: authors.err authors.tracks topTunes.err parties.err toptunes.err | ||
|
||
clean: | ||
rm -f *.xml *.err *.ids | ||
|
||
authors.tracks: authors.ids | ||
for id in $$(cat $^); do $(MAKE) author.$${id}.err ; done | ||
|
||
parties.tracks: parties.ids | ||
for id in $$(cat $^); do $(MAKE) party.$${id}.err ; done | ||
|
||
author.%.xml: | ||
wget http://zxart.ee/zxtune/action:tunes/authorId:$* -O $@ | ||
|
||
party.%.xml: | ||
wget http://zxart.ee/zxtune/action:tunes/partyId:$* -O $@ | ||
|
||
toptunes.xml: | ||
wget http://zxart.ee/zxtune/action:topTunes -O $@ | ||
|
||
%.xml: | ||
wget http://zxart.ee/zxtune/action:$* -O $@ | ||
|
||
%.err: %.xml | ||
xmllint --schema zxart.xsd $^ > $@ 2>&1 && rm $@ | ||
|
||
%.ids: %.xml | ||
sed -nr 's/.*id>(.*?)<\/id>.*/\1/pg' $^ | sort > $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0"?> | ||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0"> | ||
<xsd:element name="response"> | ||
<xsd:complexType><xsd:sequence> | ||
<xsd:element name="responseStatus" type="xsd:string" fixed="success"/> | ||
<xsd:element name="responseData"> | ||
<xsd:complexType><xsd:sequence> | ||
<xsd:element name="totalAmount" type="xsd:integer"/> | ||
<xsd:element name="authors" type="authorsList" minOccurs="0"/> | ||
<xsd:element name="parties" type="partiesList" minOccurs="0"/> | ||
<xsd:element name="tunes" type="tunesList" minOccurs="0"/> | ||
</xsd:sequence></xsd:complexType> | ||
</xsd:element> | ||
</xsd:sequence></xsd:complexType> | ||
</xsd:element> | ||
|
||
<xsd:complexType name="authorsList"><xsd:sequence> | ||
<xsd:element name="author" type="author" maxOccurs="unbounded"/> | ||
</xsd:sequence></xsd:complexType> | ||
|
||
<xsd:complexType name="author"><xsd:all> | ||
<xsd:element name="id" type="xsd:integer"/> | ||
<xsd:element name="title" type="nonEmptyString"/> | ||
<xsd:element name="tunesQuantity" type="xsd:integer"/> | ||
<xsd:element name="realName" type="nonEmptyString" minOccurs="0"/> | ||
<xsd:element name="city" type="xsd:integer" minOccurs="0"/> | ||
<xsd:element name="country" type="xsd:integer" minOccurs="0"/> | ||
</xsd:all></xsd:complexType> | ||
|
||
<xsd:complexType name="partiesList"><xsd:sequence> | ||
<xsd:element name="party" type="party" maxOccurs="unbounded"/> | ||
</xsd:sequence></xsd:complexType> | ||
|
||
<xsd:complexType name="party"><xsd:all> | ||
<xsd:element name="id" type="xsd:integer"/> | ||
<xsd:element name="title" type="nonEmptyString"/> | ||
<xsd:element name="year" type="xsd:integer"/> | ||
<xsd:element name="city" type="xsd:integer" minOccurs="0"/> | ||
<xsd:element name="country" type="xsd:integer" minOccurs="0"/> | ||
</xsd:all></xsd:complexType> | ||
|
||
<xsd:complexType name="tunesList"><xsd:sequence> | ||
<xsd:element name="tune" type="tune" maxOccurs="unbounded" minOccurs="0"/> | ||
</xsd:sequence></xsd:complexType> | ||
|
||
<xsd:complexType name="tune"><xsd:all> | ||
<xsd:element name="id" type="xsd:integer"/> | ||
<xsd:element name="title" type="nonEmptyString"/> | ||
<xsd:element name="originalFileName" type="xsd:string"/> | ||
<xsd:element name="votes" type="xsd:decimal"/> | ||
<xsd:element name="year" type="xsd:integer" minOccurs="0"/> | ||
<xsd:element name="time" type="duration" minOccurs="0"/> <!-- !!!!! --> | ||
<xsd:element name="compo" type="xsd:string" minOccurs="0"/> | ||
<xsd:element name="partyplace" type="xsd:integer" minOccurs="0"/> | ||
<xsd:element name="internalAuthor" type="nonEmptyString" minOccurs="0"/> | ||
<xsd:element name="internalTitle" type="nonEmptyString" minOccurs="0"/> | ||
<xsd:element name="authors" type="idslist"/> | ||
</xsd:all></xsd:complexType> | ||
|
||
<xsd:complexType name="idslist"><xsd:sequence> | ||
<xsd:element name="id" type="xsd:integer" maxOccurs="unbounded"/> | ||
</xsd:sequence></xsd:complexType> | ||
|
||
<xsd:simpleType name="nonEmptyString"> | ||
<xsd:restriction base="xsd:string"> | ||
<xsd:minLength value="1"/> | ||
<xsd:pattern value=".*[^\s].*"/> | ||
</xsd:restriction> | ||
</xsd:simpleType> | ||
|
||
<xsd:simpleType name="duration"> | ||
<xsd:restriction base="xsd:string"> | ||
<xsd:pattern value="(\d+:)?\d+:\d\d\.\d\d"/> | ||
</xsd:restriction> | ||
</xsd:simpleType> | ||
</xsd:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
all: authors.err authors.tracks | ||
|
||
clean: | ||
rm *.err *.xml *.ids *.tmp | ||
|
||
download = wget $(1) -O $(2).tmp && xmllint --format $(2).tmp > $(2) 2>&1 && rm -f $(2).tmp || mv $(2).tmp $(2) | ||
|
||
authors.tracks: authors.ids | ||
for id in $$(cat $^); do $(MAKE) author.$${id}.err ; done | ||
|
||
authors.xml: | ||
$(call download,"http://www.zxtunes.com/xml.php?scope=authors&fields=nickname%2Cname%2Ctracks",$@) | ||
|
||
author.%.xml: | ||
$(call download,"http://www.zxtunes.com/xml.php?scope=tracks&fields=filename%2Ctitle%2Cduration%2Cdate&author_id=$*",$@) | ||
|
||
%.err: %.xml | ||
xmllint --schema zxtunes.xsd $^ > $@ 2>&1 && rm $@ | ||
|
||
%.ids: %.xml | ||
sed -nr 's/.*id=.([0-9]+).*/\1/pg' $^ | sort > $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0"?> | ||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0"> | ||
<xsd:element name="zxtunes"> | ||
<xsd:complexType> | ||
<xsd:choice> | ||
<xsd:element name="authors" type="authorsList"/> | ||
<xsd:element name="tracks" type="tracksList"/> | ||
</xsd:choice> | ||
<xsd:attribute name="version" type="xsd:integer"/> | ||
</xsd:complexType> | ||
</xsd:element> | ||
|
||
<xsd:complexType name="authorsList"><xsd:sequence> | ||
<xsd:element name="author" type="author" maxOccurs="unbounded"/> | ||
</xsd:sequence></xsd:complexType> | ||
|
||
<xsd:complexType name="author"> | ||
<xsd:all> | ||
<xsd:element name="nickname" type="nonEmptyString"/> | ||
<xsd:element name="name" type="nonEmptyString" minOccurs="0"/> | ||
<xsd:element name="tracks" type="xsd:integer" minOccurs="0"/> | ||
</xsd:all> | ||
<xsd:attribute name="id" type="xsd:integer"/> | ||
</xsd:complexType> | ||
|
||
<xsd:complexType name="tracksList"><xsd:sequence> | ||
<xsd:element name="track" type="track" maxOccurs="unbounded" minOccurs="0"/> | ||
</xsd:sequence></xsd:complexType> | ||
|
||
<xsd:complexType name="track"> | ||
<xsd:all> | ||
<xsd:element name="filename" type="nonEmptyString"/> | ||
<xsd:element name="date" type="xsd:integer" minOccurs="0"/> | ||
<xsd:element name="title" type="nonEmptyString" minOccurs="0"/> | ||
<xsd:element name="duration" type="xsd:integer" minOccurs="0"/> | ||
</xsd:all> | ||
<xsd:attribute name="id" type="xsd:integer"/> | ||
</xsd:complexType> | ||
|
||
<xsd:simpleType name="nonEmptyString"> | ||
<xsd:restriction base="xsd:string"> | ||
<xsd:minLength value="1"/> | ||
<xsd:pattern value=".*[^\s].*"/> | ||
</xsd:restriction> | ||
</xsd:simpleType> | ||
|
||
</xsd:schema> |