[mb-commits] branch, mbs-5609, updated. MBS-5609, add artist "member of band" artist relationship in webservice tests...
MusicBrainz Git Server <[email protected]> Wed, 09 Jan 2013 16:14:46 +0000
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1TsyIg-00045D-Cd@wiley> |
The branch, mbs-5609 has been updated
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=8325438618c2756317eed62d117f694bb26aa227 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=c48b220542b3459d7c885c85a1e2253c0ffa7c09 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=136c63be1c15d460c8b69bac9e2a6e1a1aedaf33 (commit)
from http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=03d74312092ab8fee37aeb4a68bc3d8bc91227bf (commit)
Summary of changes:
.../WebService/Serializer/JSON/2/Relation.pm | 4 +-
.../WebService/Serializer/JSON/2/Role/LifeSpan.pm | 4 +-
.../Server/WebService/Serializer/JSON/2/Utils.pm | 4 +-
script/release-group-sql-dump.pl | 12 ++++--
.../Server/Controller/WS/2/JSON/LookupArtist.pm | 37 ++++++++++++++++++++
.../Server/Controller/WS/2/LookupArtist.pm | 20 +++++++++++
t/sql/webservice.sql | 7 ++++
7 files changed, 78 insertions(+), 10 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8325438618c2756317eed62d117f694bb26aa227
Author: warp <[email protected]>
Date: Wed Jan 9 17:13:32 2013 +0100
MBS-5609, add artist "member of band" artist relationship in webservice tests (this tests a begin date).
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm
index 7a836b9..2b53865 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/JSON/LookupArtist.pm
@@ -662,4 +662,41 @@ test 'artist lookup with works (using l_recording_work)' => sub {
});
};
+
+test 'artist lookup with artist relations' => sub {
+
+ MusicBrainz::Server::Test->prepare_test_database(shift->c, '+webservice');
+
+ ws_test_json 'artist lookup with artist relations',
+ '/artist/678ba12a-e485-44c7-8eaf-25e61a78a61b?inc=artist-rels' => encode_json (
+ {
+ id => "678ba12a-e485-44c7-8eaf-25e61a78a61b",
+ name => "後藤真希",
+ "sort-name" => "Goto, Maki",
+ country => "JP",
+ disambiguation => "",
+ "life-span" => {
+ begin => "1985-09-23",
+ end => JSON::null,
+ ended => JSON::false,
+ },
+ type => "Person",
+ relations => [
+ {
+ type => 'member of band',
+ direction => 'forward',
+ artist => {
+ id => "802673f0-9b88-4e8a-bb5c-dd01d68b086f",
+ name => "7人祭",
+ "sort-name" => "7nin Matsuri",
+ disambiguation => "",
+ },
+ begin => '2001',
+ end => JSON::null,
+ ended => JSON::false,
+ }
+ ]
+ });
+};
+
1;
diff --git a/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupArtist.pm b/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupArtist.pm
index ccdf030..10f515c 100644
--- a/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupArtist.pm
+++ b/t/lib/t/MusicBrainz/Server/Controller/WS/2/LookupArtist.pm
@@ -291,6 +291,26 @@ ws_test 'artist lookup with works (using l_recording_work)',
</artist>
</metadata>';
+ws_test 'artist lookup with artist relations',
+ '/artist/678ba12a-e485-44c7-8eaf-25e61a78a61b?inc=artist-rels' =>
+ '<?xml version="1.0"?>
+<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
+ <artist type="Person" id="678ba12a-e485-44c7-8eaf-25e61a78a61b">
+ <name>後藤真希</name><sort-name>Goto, Maki</sort-name><gender>Female</gender><country>JP</country>
+ <life-span>
+ <begin>1985-09-23</begin>
+ </life-span>
+ <relation-list target-type="artist">
+ <relation type="member of band">
+ <target>802673f0-9b88-4e8a-bb5c-dd01d68b086f</target><begin>2001</begin>
+ <artist id="802673f0-9b88-4e8a-bb5c-dd01d68b086f">
+ <name>7人祭</name><sort-name>7nin Matsuri</sort-name>
+ </artist>
+ </relation>
+ </relation-list>
+ </artist>
+</metadata>';
+
};
1;
commit c48b220542b3459d7c885c85a1e2253c0ffa7c09
Author: warp <[email protected]>
Date: Wed Jan 9 17:13:14 2013 +0100
MBS-5609, rename dateperiod to date_period.
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relation.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relation.pm
index 048e582..10874d7 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relation.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Relation.pm
@@ -2,7 +2,7 @@ package MusicBrainz::Server::WebService::Serializer::JSON::2::Relation;
use Moose;
use Hash::Merge qw(merge);
use String::CamelCase qw(camelize);
-use MusicBrainz::Server::WebService::Serializer::JSON::2::Utils qw(boolean dateperiod serialize_entity);
+use MusicBrainz::Server::WebService::Serializer::JSON::2::Utils qw( date_period serialize_entity );
extends 'MusicBrainz::Server::WebService::Serializer::JSON::2';
@@ -16,7 +16,7 @@ sub serialize
$body->{type} = $entity->link->type->name;
$body->{direction} = $entity->direction == 2 ? "backward" : "forward";
- $body = merge ($body, dateperiod ($entity->link));
+ $body = merge ($body, date_period ($entity->link));
if ($entity->target_type eq 'artist' ||
$entity->target_type eq 'label' ||
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/LifeSpan.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/LifeSpan.pm
index bb19235..77333ce 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/LifeSpan.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Role/LifeSpan.pm
@@ -1,6 +1,6 @@
package MusicBrainz::Server::WebService::Serializer::JSON::2::Role::LifeSpan;
use Moose::Role;
-use MusicBrainz::Server::WebService::Serializer::JSON::2::Utils qw( boolean dateperiod );
+use MusicBrainz::Server::WebService::Serializer::JSON::2::Utils qw( date_period );
sub has_lifespan
{
@@ -18,7 +18,7 @@ around serialize => sub {
return $ret unless $toplevel;
- $ret->{"life-span"} = dateperiod ($entity);
+ $ret->{"life-span"} = date_period ($entity);
return $ret;
};
diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Utils.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Utils.pm
index ebe91c7..4f691cd 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Utils.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/Utils.pm
@@ -8,7 +8,7 @@ our @EXPORT_OK = qw(
boolean
list_of
number
- dateperiod
+ date_period
serializer
serialize_entity
);
@@ -35,7 +35,7 @@ sub number {
return defined $value ? $value + 0 : JSON::null;
}
-sub dateperiod {
+sub date_period {
my $entity = shift;
my %lifespan = (
commit 136c63be1c15d460c8b69bac9e2a6e1a1aedaf33
Author: warp <[email protected]>
Date: Wed Jan 9 17:12:16 2013 +0100
MBS-5609, remove some bitrot from script/release-group-sql-dump.pl and use it to add an l_artist_artist link in t/sql/webservice.sql.
diff --git a/script/release-group-sql-dump.pl b/script/release-group-sql-dump.pl
index ef4e61c..496aa6a 100755
--- a/script/release-group-sql-dump.pl
+++ b/script/release-group-sql-dump.pl
@@ -11,9 +11,13 @@ use Data::Dumper;
use DBDefs;
use MusicBrainz::Server::Test::Connector;
-my $readwrite = MusicBrainz::Server::DatabaseConnectionFactory->get ('READWRITE');
-my $schema = $readwrite->{schema};
-my $test_schema = MusicBrainz::Server::Test::Connector->_schema;
+use aliased 'MusicBrainz::Server::DatabaseConnectionFactory' => 'Databases';
+
+
+my $readwrite = Databases->get('READWRITE');
+my $schema = 'musicbrainz';
+my $test_schema = 'musicbrainz';
+
my %insert_dupe_check;
my %artist_dupe_check;
my @backup;
@@ -596,7 +600,7 @@ sub release_group
$core_entities{'release-group'}{$data->{id}} = 1;
- generic ($dbh, 'release_group_type', 'id', $data->{type});
+ generic ($dbh, 'release_group_primary_type', 'id', $data->{type});
generic_verbose ($dbh, 'release_name', 'id', $data->{name});
artist_credit ($dbh, $data->{artist_credit});
diff --git a/t/sql/webservice.sql b/t/sql/webservice.sql
index ab3908a..254ef94 100644
--- a/t/sql/webservice.sql
+++ b/t/sql/webservice.sql
@@ -4209,3 +4209,10 @@ INSERT INTO link (begin_date_day, attribute_count, begin_date_year, created, lin
INSERT INTO l_artist_work (link, entity1, entity0, id) VALUES
(1123780, (SELECT id FROM work WHERE gid='f5cdd40d-6dc3-358b-8d7d-22dd9d8f87a8'),
(SELECT id FROM artist WHERE gid='472bc127-8861-45e8-bc9e-31e8dd32de7a'), 1117124);
+
+INSERT INTO gender (name, id) VALUES ('Female', 2);
+INSERT INTO artist_name (name, id) VALUES ('Goto, Maki', 438952);
+INSERT INTO artist_name (name, id) VALUES ('後藤真希', 235500);
+INSERT INTO artist (edits_pending, ended, id, sort_name, gender, country, begin_date_day, last_updated, name, begin_date_year, end_date_day, comment, begin_date_month, end_date_month, type, end_date_year, gid) VALUES (0, '0', 82524, 438952, 2, 107, 23, '2012-08-27 03:34:50.942403+02', 235500, 1985, NULL, '', 9, NULL, 1, NULL, '678ba12a-e485-44c7-8eaf-25e61a78a61b');
+INSERT INTO link (begin_date_day, attribute_count, begin_date_year, link_type, created, ended, end_date_day, begin_date_month, end_date_month, id, end_date_year) VALUES (NULL, 0, 2001, 111, '2011-05-16 17:03:23.368437+02', '0', NULL, NULL, NULL, 6490, NULL);
+INSERT INTO l_artist_artist (link, last_updated, entity1, entity0, id, edits_pending) VALUES (6490, '2011-05-16 17:03:23.368437+02', 265420, 82524, 127517, 0);
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server
_______________________________________________
MusicBrainz-commits mailing list
[email protected]
http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-commits