Merge pull request #4073 from solgenomics/topic/fix_another_type_id_issue
[sgn.git] / t / unit_mech / AJAX / _BrAPI_v1.t
blob90688f5511792be3efb795b77d8ab20377c0d2b8
2 use strict;
3 use warnings;
5 use lib 't/lib';
6 use SGN::Test::Fixture;
7 use Test::More;
8 use Test::WWW::Mechanize;
9 use Math::Round qw | round |;
11 #Needed to update IO::Socket::SSL
12 use Data::Dumper;
13 use JSON;
14 local $Data::Dumper::Indent = 0;
16 my $f = SGN::Test::Fixture->new(); # calculate db stats
18 my $mech = Test::WWW::Mechanize->new;
19 my $response; my $searchId;
21 $mech->post_ok('http://localhost:3010/brapi/v1/token', [ "username"=> "janedoe", "password"=> "secretpw", "grant_type"=> "password" ]);
22 $response = decode_json $mech->content;
23 print STDERR Dumper $response;
24 is($response->{'metadata'}->{'status'}->[2]->{'message'}, 'Login Successfull');
25 is($response->{'userDisplayName'}, 'Jane Doe');
26 is($response->{'expires_in'}, '7200');
28 $mech->delete_ok('http://localhost:3010/brapi/v1/token');
29 $response = decode_json $mech->content;
30 print STDERR Dumper $response;
31 is($response->{'metadata'}->{'status'}->[2]->{'message'}, 'User Logged Out');
33 $mech->post_ok('http://localhost:3010/brapi/v1/token', [ "username"=> "janedoe", "password"=> "secretpw", "grant_type"=> "password" ]);
34 $response = decode_json $mech->content;
35 print STDERR Dumper $response;
36 is($response->{'metadata'}->{'status'}->[2]->{'message'}, 'Login Successfull');
37 is($response->{'userDisplayName'}, 'Jane Doe');
38 is($response->{'expires_in'}, '7200');
39 my $access_token = $response->{access_token};
40 $mech->default_header("Content-Type" => "application/json");
41 $mech->default_header('Authorization'=> 'Bearer ' . $access_token);
43 # Start tests
44 $mech->get_ok('http://localhost:3010/brapi/v1/calls');
45 $response = decode_json $mech->content;
46 print STDERR Dumper $response;
48 is_deeply($response, {'metadata' => {'datafiles' => [],'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Calls'},{'message' => 'Calls result constructed','messageType' => 'INFO'}],'pagination' => {'pageSize' => 1000,'totalPages' => 1,'totalCount' => 90,'currentPage' => 0}},'result' => {'data' => [{'call' => 'token','methods' => ['POST','DELETE'],'datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2','1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'calls'},{'versions' => ['1.0','1.2','1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'observationlevels'},{'versions' => ['1.0','1.2'],'datatypes' => ['json'],'call' => 'germplasm-search','methods' => ['GET','POST']},{'call' => 'search/germplasm','methods' => ['GET','POST'],'datatypes' => ['json'],'versions' => ['1.3']},{'versions' => ['1.3'],'methods' => ['GET'],'call' => 'germplasm','datatypes' => ['json']},{'versions' => ['1.0','1.2','1.3'],'methods' => ['GET'],'call' => 'germplasm/{germplasmDbId}','datatypes' => ['json']},{'versions' => ['1.0','1.2','1.3'],'datatypes' => ['json'],'call' => 'germplasm/{germplasmDbId}/pedigree','methods' => ['GET']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'germplasm/{germplasmDbId}/progeny','versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'germplasm/{germplasmDbId}/markerprofiles','versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'germplasm/{germplasmDbId}/attributes','versions' => ['1.0','1.2']},{'versions' => ['1.0','1.2','1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'attributes'},{'call' => 'attributes/categories','methods' => ['GET'],'datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'markerprofiles','versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2','1.3'],'datatypes' => ['json'],'call' => 'markerprofiles/{markerprofileDbId}','methods' => ['GET']},{'datatypes' => ['json'],'call' => 'markerprofiles/methods','methods' => ['GET'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2'],'datatypes' => ['json','tsv','csv','xls'],'methods' => ['GET','POST'],'call' => 'allelematrix-search'},{'versions' => ['1.0','1.2'],'datatypes' => ['json','tsv','csv','xls'],'methods' => ['GET','POST'],'call' => 'allelematrices-search'},{'datatypes' => ['json'],'call' => 'search/allelematrices','methods' => ['GET','POST'],'versions' => ['1.3']},{'call' => 'allelematrices','methods' => ['GET'],'datatypes' => ['json'],'versions' => ['1.3']},{'call' => 'programs','methods' => ['GET','POST'],'datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'call' => 'crops','methods' => ['GET'],'versions' => ['1.0','1.2','1.3']},{'methods' => ['GET','POST'],'call' => 'seasons','datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'methods' => ['GET','POST'],'call' => 'studytypes','datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'call' => 'trials','methods' => ['GET','POST'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2','1.3'],'call' => 'trials/{trialDbId}','methods' => ['GET'],'datatypes' => ['json']},{'datatypes' => ['json'],'methods' => ['GET','POST'],'call' => 'studies-search','versions' => ['1.0','1.2']},{'versions' => ['1.3'],'methods' => ['GET','POST'],'call' => 'search/studies','datatypes' => ['json']},{'methods' => ['GET'],'call' => 'studies','datatypes' => ['json'],'versions' => ['1.3']},{'versions' => ['1.0','1.2','1.3'],'call' => 'studies/{studyDbId}','methods' => ['GET'],'datatypes' => ['json']},{'call' => 'studies/{studyDbId}/germplasm','methods' => ['GET'],'datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2','1.3'],'methods' => ['GET'],'call' => 'studies/{studyDbId}/observationvariables','datatypes' => ['json']},{'versions' => ['1.0','1.2','1.3'],'call' => 'studies/{studyDbId}/observationunits','methods' => ['GET'],'datatypes' => ['json']},{'datatypes' => ['json','csv','xls','tsv'],'methods' => ['GET'],'call' => 'studies/{studyDbId}/table','versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2'],'datatypes' => ['json'],'call' => 'studies/{studyDbId}/layout','methods' => ['GET']},{'methods' => ['GET'],'call' => 'studies/{studyDbId}/layouts','datatypes' => ['json'],'versions' => ['1.3']},{'datatypes' => ['json'],'call' => 'studies/{studyDbId}/observations','methods' => ['GET'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2'],'call' => 'phenotypes-search','methods' => ['GET','POST'],'datatypes' => ['json']},{'call' => 'search/phenotypes','methods' => ['GET','POST'],'datatypes' => ['json'],'versions' => ['1.3']},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['GET','POST'],'call' => 'phenotypes'},{'datatypes' => ['json'],'call' => 'phenotypes-search/table','methods' => ['GET','POST'],'versions' => ['1.0','1.2']},{'methods' => ['GET','POST'],'call' => 'phenotypes-search/tsv','datatypes' => ['json'],'versions' => ['1.0','1.2']},{'versions' => ['1.0','1.2'],'datatypes' => ['json'],'methods' => ['GET','POST'],'call' => 'phenotypes-search/csv'},{'call' => 'observationunits','methods' => ['GET'],'datatypes' => ['json'],'versions' => ['1.3']},{'datatypes' => ['json'],'methods' => ['GET','POST'],'call' => 'search/observationunits','versions' => ['1.3']},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'observationtables'},{'versions' => ['1.3'],'datatypes' => ['json'],'call' => 'search/observationtables','methods' => ['GET','POST']},{'methods' => ['GET'],'call' => 'traits','datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'call' => 'traits','methods' => ['POST'],'versions' => ['1.3']},{'versions' => ['1.0','1.2'],'datatypes' => ['json'],'call' => 'traits/{traitDbId}','methods' => ['GET']},{'datatypes' => ['json'],'call' => 'traits/{traitDbId}','methods' => ['PUT'],'versions' => ['1.3']},{'call' => 'maps','methods' => ['GET'],'datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2','1.3'],'call' => 'maps/{mapDbId}','methods' => ['GET'],'datatypes' => ['json']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'maps/{mapDbId}/positions','versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'call' => 'maps/{mapDbId}/positions/id','methods' => ['GET'],'versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'call' => 'locations','methods' => ['GET'],'versions' => ['1.0','1.2','1.3']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'variables/datatypes','versions' => ['1.0','1.2','1.3']},{'methods' => ['GET'],'call' => 'ontologies','datatypes' => ['json'],'versions' => ['1.0','1.2','1.3']},{'versions' => ['1.0','1.2','1.3'],'call' => 'variables','methods' => ['GET'],'datatypes' => ['json']},{'versions' => ['1.0','1.2','1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'variables/{observationVariableDbId}'},{'datatypes' => ['json'],'call' => 'variables-search','methods' => ['GET','POST'],'versions' => ['1.0','1.2']},{'datatypes' => ['json'],'methods' => ['GET','POST'],'call' => 'samples-search','versions' => ['1.0','1.2']},{'datatypes' => ['json'],'call' => 'search/samples','methods' => ['GET','POST'],'versions' => ['1.3']},{'versions' => ['1.3'],'datatypes' => ['json'],'call' => 'samples','methods' => ['GET']},{'versions' => ['1.0','1.2','1.3'],'methods' => ['GET'],'call' => 'samples/{sampleDbId}','datatypes' => ['json']},{'datatypes' => ['json'],'call' => 'images','methods' => ['GET','POST'],'versions' => ['1.3']},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['GET','PUT'],'call' => 'images/{imageDbId}'},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['PUT'],'call' => 'images/{imageDbId}/imagecontent'},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['GET','POST'],'call' => 'lists'},{'versions' => ['1.3'],'datatypes' => ['json'],'call' => 'lists/{listDbId}','methods' => ['GET','PUT']},{'call' => 'lists/{listDbId}/items','methods' => ['POST'],'datatypes' => ['json'],'versions' => ['1.3']},{'methods' => ['GET'],'call' => 'markers','datatypes' => ['json'],'versions' => ['1.0','1.3']},{'methods' => ['GET'],'call' => 'markers/{markerDbId}','datatypes' => ['json'],'versions' => ['1.0','1.1','1.2','1.3']},{'methods' => ['GET','POST'],'call' => 'methods','datatypes' => ['json'],'versions' => ['1.3']},{'call' => 'methods/{methodDbId}','methods' => ['GET','PUT'],'datatypes' => ['json'],'versions' => ['1.3']},{'datatypes' => ['json'],'call' => 'people','methods' => ['GET','POST'],'versions' => ['1.3']},{'datatypes' => ['json'],'call' => 'people/{personDbId}','methods' => ['GET','PUT'],'versions' => ['1.3']},{'versions' => ['1.3'],'call' => 'scales','methods' => ['GET','POST'],'datatypes' => ['json']},{'versions' => ['1.3'],'methods' => ['GET','PUT'],'call' => 'scales/{scaleDbId}','datatypes' => ['json']},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'search/germplasm/{searchResultsDbId}'},{'datatypes' => ['json'],'call' => 'search/images','methods' => ['POST'],'versions' => ['1.3']},{'datatypes' => ['json'],'call' => 'search/images/{searchResultsDbId}','methods' => ['GET'],'versions' => ['1.3']},{'call' => 'search/markers','methods' => ['POST'],'datatypes' => ['json'],'versions' => ['1.3']},{'datatypes' => ['json'],'methods' => ['GET'],'call' => 'search/markers/{searchResultsDbId}','versions' => ['1.3']},{'call' => 'search/observationtables/{searchResultsDbId}','methods' => ['GET'],'datatypes' => ['json'],'versions' => ['1.3']},{'methods' => ['GET'],'call' => 'search/observationunits/searchResultsDbId','datatypes' => ['json'],'versions' => ['1.3']},{'versions' => ['1.3'],'call' => 'search/programs','methods' => ['POST'],'datatypes' => ['json']},{'methods' => ['GET'],'call' => 'search/programs/{searchResultsDbId}','datatypes' => ['json'],'versions' => ['1.3']},{'datatypes' => ['json'],'call' => 'search/samples/{searchResultsDbId}','methods' => ['GET'],'versions' => ['1.3']},{'versions' => ['1.3'],'datatypes' => ['json'],'methods' => ['GET'],'call' => 'search/studies/{searchResultsDbId}'}]}}, 'check calls response content');
50 $mech->get_ok('http://localhost:3010/brapi/v1/calls?pageSize=50&datatype=tsv');
51 $response = decode_json $mech->content;
52 print STDERR Dumper $response;
54 is_deeply($response, {'metadata' => {'pagination' => {'totalCount' => 3,'pageSize' => 1000,'totalPages' => 1,'currentPage' => 0},'datafiles' => [],'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=50','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Calls','messageType' => 'INFO'},{'message' => 'Calls result constructed','messageType' => 'INFO'}]},'result' => {'data' => [{'methods' => ['GET','POST'],'call' => 'allelematrix-search','versions' => ['1.0','1.2'],'datatypes' => ['json','tsv','csv','xls']},{'call' => 'allelematrices-search','methods' => ['GET','POST'],'datatypes' => ['json','tsv','csv','xls'],'versions' => ['1.0','1.2']},{'methods' => ['GET'],'call' => 'studies/{studyDbId}/table','versions' => ['1.0','1.2','1.3'],'datatypes' => ['json','csv','xls','tsv']}]}}, 'check calls response content');
56 $mech->get_ok('http://localhost:3010/brapi/v1/observationlevels');
57 $response = decode_json $mech->content;
58 print STDERR Dumper $response;
59 is_deeply($response, {'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v1::ObservationVariables','messageType' => 'INFO'},{'message' => 'Observation Levels result constructed','messageType' => 'INFO'}],'datafiles' => [],'pagination' => {'totalPages' => 1,'pageSize' => 10,'totalCount' => 4,'currentPage' => 0}},'result' => {'data' => ['plant','plot','tissue_sample','all']}}, 'observationlevels');
61 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm-search?pageSize=2&page=3&access_token='.$access_token);
62 $response = decode_json $mech->content;
63 print STDERR Dumper $response;
64 is_deeply($response, {'result' => {'data' => [{'countryOfOriginCode' => '','pedigree' => 'test_accession4/test_accession5','germplasmGenus' => 'Lycopersicon','breedingMethodDbId' =>''||undef,'germplasmPUI' => '','subtaxa' => undef,'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP002','typeOfGermplasmStorageCode' => [],'acquisitionDate' => '','species' => 'Solanum lycopersicum','defaultDisplayName' => 'new_test_crossP002','germplasmDbId' => 38847,'speciesAuthority' => undef,'synonyms' => [],'commonCropName' => 'tomato','donors' => [],'instituteCode' => '','genus' => 'Lycopersicon','taxonIds' => [],'instituteName' => '','subtaxaAuthority' => undef,'biologicalStatusOfAccessionCode' => '0','accessionNumber' => '','documentationURL' =>undef,'seedSource' => '','germplasmSpecies' => 'Solanum lycopersicum'},{'typeOfGermplasmStorageCode' => [],'germplasmName' => 'new_test_crossP003','germplasmSeedSource' => '','subtaxa' => undef,'countryOfOriginCode' => '','germplasmGenus' => 'Lycopersicon','breedingMethodDbId' =>''||undef,'germplasmPUI' => '','pedigree' => 'test_accession4/test_accession5','speciesAuthority' => undef,'defaultDisplayName' => 'new_test_crossP003','germplasmDbId' => 38848,'species' => 'Solanum lycopersicum','acquisitionDate' => '','donors' => [],'instituteCode' => '','synonyms' => [],'commonCropName' => 'tomato','accessionNumber' => '','biologicalStatusOfAccessionCode' => '0','subtaxaAuthority' => undef,'instituteName' => '','taxonIds' => [],'genus' => 'Lycopersicon','documentationURL' =>undef,'seedSource' => '','germplasmSpecies' => 'Solanum lycopersicum'}]},'metadata' => {'datafiles' => [],'pagination' => {'totalPages' => 240,'pageSize' => 2,'totalCount' => 479,'currentPage' => 3},'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=3, pageSize=2'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Germplasm'},{'messageType' => 'INFO','message' => 'Germplasm-search result constructed'}]}}, 'germplasm-search');
66 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm-search?pageSize=2&page=5&access_token='.$access_token);
67 $response = decode_json $mech->content;
68 print STDERR Dumper $response;
69 is_deeply($response, {'result' => {'data' => [{'pedigree' => 'test_accession4/test_accession5','countryOfOriginCode' => '','germplasmPUI' => '','subtaxa' => undef,'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP006','typeOfGermplasmStorageCode' => [],'acquisitionDate' => '','species' => 'Solanum lycopersicum','defaultDisplayName' => 'new_test_crossP006','germplasmDbId' => 38851,'speciesAuthority' => undef,'synonyms' => [],'commonCropName' => 'tomato','instituteCode' => '','donors' => [],'genus' => 'Lycopersicon','taxonIds' => [],'instituteName' => '','subtaxaAuthority' => undef,'biologicalStatusOfAccessionCode' => '0','accessionNumber' => '','germplasmSpecies' => 'Solanum lycopersicum','breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon'},{'subtaxa' => undef,'countryOfOriginCode' => '','pedigree' => 'test_accession4/test_accession5','germplasmPUI' => '','typeOfGermplasmStorageCode' => [],'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP007','species' => 'Solanum lycopersicum','germplasmDbId' => 38852,'defaultDisplayName' => 'new_test_crossP007','acquisitionDate' => '','speciesAuthority' => undef,'donors' => [],'instituteCode' => '','commonCropName' => 'tomato','synonyms' => [],'subtaxaAuthority' => undef,'genus' => 'Lycopersicon','taxonIds' => [],'instituteName' => '','accessionNumber' => '','biologicalStatusOfAccessionCode' => '0','germplasmSpecies' => 'Solanum lycopersicum','breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon'}]},'metadata' => {'pagination' => {'currentPage' => 5,'totalCount' => 479,'pageSize' => 2,'totalPages' => 240},'datafiles' => [],'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=5, pageSize=2'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Germplasm'},{'messageType' => 'INFO','message' => 'Germplasm-search result constructed'}]}}, 'germplasm-search');
71 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm-search?pageSize=2&page=0&germplasmDbId=38849&access_token='.$access_token);
72 $response = decode_json $mech->content;
73 print STDERR Dumper $response;
74 is_deeply($response, {'result' => {'data' => [{'subtaxa' => undef,'germplasmPUI' => '','pedigree' => 'test_accession4/test_accession5','countryOfOriginCode' => '','typeOfGermplasmStorageCode' => [],'germplasmName' => 'new_test_crossP004','germplasmSeedSource' => '','germplasmDbId' => 38849,'defaultDisplayName' => 'new_test_crossP004','species' => 'Solanum lycopersicum','acquisitionDate' => '','speciesAuthority' => undef,'donors' => [],'instituteCode' => '','commonCropName' => 'tomato','synonyms' => [],'subtaxaAuthority' => undef,'instituteName' => '','taxonIds' => [],'genus' => 'Lycopersicon','accessionNumber' => '','biologicalStatusOfAccessionCode' => '0','breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon','germplasmSpecies' => 'Solanum lycopersicum'}]},'metadata' => {'pagination' => {'totalPages' => 1,'pageSize' => 2,'currentPage' => 0,'totalCount' => 1},'datafiles' => [],'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=2','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Germplasm'},{'messageType' => 'INFO','message' => 'Germplasm-search result constructed'}]}}, 'germplasm-search');
76 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm-search?pageSize=2&page=4&germplasmName=te%&matchMethod=wildcard&access_token='.$access_token);
77 $response = decode_json $mech->content;
78 print STDERR Dumper $response;
79 is_deeply($response, {'metadata' => {'datafiles' => [],'pagination' => {'currentPage' => 4,'totalCount' => 25,'pageSize' => 2,'totalPages' => 13},'status' => [{'message' => 'BrAPI base call found with page=4, pageSize=2','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Germplasm'},{'message' => 'Germplasm-search result constructed','messageType' => 'INFO'}]},'result' => {'data' => [{'donors' => [],'instituteCode' => '','commonCropName' => 'tomato','synonyms' => [],'accessionNumber' => '','biologicalStatusOfAccessionCode' => '0','subtaxaAuthority' => undef,'genus' => 'Lycopersicon','taxonIds' => [],'instituteName' => '','typeOfGermplasmStorageCode' => [],'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP009','subtaxa' => undef,'germplasmPUI' => '','countryOfOriginCode' => '','pedigree' => 'test_accession4/test_accession5','speciesAuthority' => undef,'species' => 'Solanum lycopersicum','germplasmDbId' => 38854,'defaultDisplayName' => 'new_test_crossP009','acquisitionDate' => '','breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon','germplasmSpecies' => 'Solanum lycopersicum'},{'accessionNumber' => '','biologicalStatusOfAccessionCode' => '0','subtaxaAuthority' => undef,'genus' => 'Lycopersicon','taxonIds' => [],'instituteName' => '','instituteCode' => '','donors' => [],'commonCropName' => 'tomato','synonyms' => [],'speciesAuthority' => undef,'defaultDisplayName' => 'new_test_crossP010','germplasmDbId' => 38855,'species' => 'Solanum lycopersicum','acquisitionDate' => '','typeOfGermplasmStorageCode' => [],'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP010','subtaxa' => undef,'pedigree' => 'test_accession4/test_accession5','germplasmPUI' => '','countryOfOriginCode' => '','breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon','germplasmSpecies' => 'Solanum lycopersicum'}]}}, 'germplasm-search');
81 $mech->post_ok('http://localhost:3010/brapi/v1/germplasm-search', ['access_token'=>$access_token, 'pageSize'=>'1', 'page'=>'5', 'germplasmNames'=>['t%'], 'matchMethod'=>'wildcard'] );
82 $response = decode_json $mech->content;
83 print STDERR Dumper $response;
84 is_deeply($response, {'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=5, pageSize=1','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Germplasm'},{'message' => 'Germplasm-search result constructed','messageType' => 'INFO'}],'datafiles' => [],'pagination' => {'totalCount' => 31,'currentPage' => 5,'pageSize' => 1,'totalPages' => 31}},'result' => {'data' => [{'commonCropName' => 'tomato','synonyms' => [],'donors' => [],'instituteCode' => '','genus' => 'Lycopersicon','instituteName' => '','taxonIds' => [],'subtaxaAuthority' => undef,'biologicalStatusOfAccessionCode' => '0','accessionNumber' => '','countryOfOriginCode' => '','pedigree' => 'test_accession4/test_accession5','germplasmPUI' => '','subtaxa' => undef,'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP002','typeOfGermplasmStorageCode' => [],'acquisitionDate' => '','species' => 'Solanum lycopersicum','defaultDisplayName' => 'new_test_crossP002','germplasmDbId' => 38847,'speciesAuthority' => undef,'breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon','germplasmSpecies' => 'Solanum lycopersicum'}]}}, 'germplasm-search post');
86 $mech->post_ok('http://localhost:3010/brapi/v1/search/germplasm', ['access_token'=>$access_token, 'pageSize'=>'1', 'page'=>'5', 'germplasmNames'=>['t%'], 'matchMethod'=>'wildcard'] );
87 $response = decode_json $mech->content;
88 $searchId = $response->{result} ->{searchResultsDbId};
89 print STDERR Dumper $response;
90 $mech->get_ok('http://localhost:3010/brapi/v1/search/germplasm/'. $searchId . '?access_token='.$access_token );
91 $response = decode_json $mech->content;
92 print STDERR Dumper $response;
93 is_deeply($response, {'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=5, pageSize=1','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Germplasm'},{'message' => 'Germplasm-search result constructed','messageType' => 'INFO'}],'datafiles' => [],'pagination' => {'totalCount' => 31,'currentPage' => 5,'pageSize' => 1,'totalPages' => 31}},'result' => {'data' => [{'commonCropName' => 'tomato','synonyms' => [],'donors' => [],'instituteCode' => '','genus' => 'Lycopersicon','instituteName' => '','taxonIds' => [],'subtaxaAuthority' => undef,'biologicalStatusOfAccessionCode' => '0','accessionNumber' => '','countryOfOriginCode' => '','pedigree' => 'test_accession4/test_accession5','germplasmPUI' => '','subtaxa' => undef,'germplasmSeedSource' => '','germplasmName' => 'new_test_crossP002','typeOfGermplasmStorageCode' => [],'acquisitionDate' => '','species' => 'Solanum lycopersicum','defaultDisplayName' => 'new_test_crossP002','germplasmDbId' => 38847,'speciesAuthority' => undef,'breedingMethodDbId' =>undef,'documentationURL' =>undef,'seedSource' => '','germplasmGenus' => 'Lycopersicon','germplasmSpecies' => 'Solanum lycopersicum'}]}}, 'germplasm-search post');
95 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm/38876?access_token='.$access_token);
96 $response = decode_json $mech->content;
97 print STDERR Dumper $response;
98 is_deeply($response, {'metadata' => {'datafiles' => [],'pagination' => {'totalPages' => 1,'pageSize' => 1,'totalCount' => 1,'currentPage' => 0},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Germplasm','messageType' => 'INFO'},{'message' => 'Germplasm detail result constructed','messageType' => 'INFO'}]},'result' => {'instituteCode' => '','donors' => [],'commonCropName' => 'tomato','synonyms' => [],'accessionNumber' => '','biologicalStatusOfAccessionCode' => '0','subtaxaAuthority' => undef,'instituteName' => '','taxonIds' => [],'genus' => 'Lycopersicon','typeOfGermplasmStorageCode' => [],'germplasmName' => 'test5P004','germplasmSeedSource' => '','subtaxa' => undef,'germplasmPUI' => '','countryOfOriginCode' => '','pedigree' => 'test_accession4/test_accession5','speciesAuthority' => undef,'defaultDisplayName' => 'test5P004','species' => 'Solanum lycopersicum','germplasmDbId' => 38876,'acquisitionDate' => ''}}, 'germplasm detail');
100 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm/38876/pedigree?access_token='.$access_token);
101 $response = decode_json $mech->content;
102 print STDERR Dumper $response;
103 is_deeply($response, {'metadata' => {'datafiles' => [],'pagination' => {'pageSize' => 1,'totalPages' => 1,'currentPage' => 0,'totalCount' => 1},'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v1::Germplasm','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Germplasm pedigree result constructed'}]},'result' => {'parent2DbId' => 38844,'pedigree' => 'test_accession4/test_accession5','parent2Type' => 'MALE','parent2Id' => 38844,'parent1DbId' => 38843,'parent2Name' => 'test_accession5','siblings' => [{'defaultDisplayName' => 'new_test_crossP001','germplasmDbId' => '38846'},{'germplasmDbId' => '38847','defaultDisplayName' => 'new_test_crossP002'},{'defaultDisplayName' => 'new_test_crossP003','germplasmDbId' => '38848'},{'defaultDisplayName' => 'new_test_crossP004','germplasmDbId' => '38849'},{'germplasmDbId' => '38850','defaultDisplayName' => 'new_test_crossP005'},{'defaultDisplayName' => 'new_test_crossP006','germplasmDbId' => '38851'},{'defaultDisplayName' => 'new_test_crossP007','germplasmDbId' => '38852'},{'germplasmDbId' => '38853','defaultDisplayName' => 'new_test_crossP008'},{'defaultDisplayName' => 'new_test_crossP009','germplasmDbId' => '38854'},{'germplasmDbId' => '38855','defaultDisplayName' => 'new_test_crossP010'},{'defaultDisplayName' => 'test5P001','germplasmDbId' => '38873'},{'defaultDisplayName' => 'test5P002','germplasmDbId' => '38874'},{'germplasmDbId' => '38875','defaultDisplayName' => 'test5P003'},{'germplasmDbId' => '38877','defaultDisplayName' => 'test5P005'}],'crossingYear' => undef,'crossingPlan' => undef,'germplasmDbId' => '38876','defaultDisplayName' => 'test5P004','parent1Name' => 'test_accession4','parent1Type' => 'FEMALE','parent1Id' => 38843,'familyCode' => undef}}, 'germplasm pedigree');
105 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm/38843/progeny?access_token='.$access_token);
106 $response = decode_json $mech->content;
107 print STDERR Dumper $response;
108 is_deeply($response, {'result' => {'data' => [{'progenyGermplasmDbId' => 38846,'defaultDisplayName' => 'new_test_crossP001','germplasmDbId' => 38846,'parentType' => 'FEMALE'},{'defaultDisplayName' => 'new_test_crossP002','germplasmDbId' => 38847,'progenyGermplasmDbId' => 38847,'parentType' => 'FEMALE'},{'parentType' => 'FEMALE','progenyGermplasmDbId' => 38848,'defaultDisplayName' => 'new_test_crossP003','germplasmDbId' => 38848},{'progenyGermplasmDbId' => 38849,'defaultDisplayName' => 'new_test_crossP004','germplasmDbId' => 38849,'parentType' => 'FEMALE'},{'progenyGermplasmDbId' => 38850,'defaultDisplayName' => 'new_test_crossP005','germplasmDbId' => 38850,'parentType' => 'FEMALE'},{'progenyGermplasmDbId' => 38851,'defaultDisplayName' => 'new_test_crossP006','germplasmDbId' => 38851,'parentType' => 'FEMALE'},{'parentType' => 'FEMALE','defaultDisplayName' => 'new_test_crossP007','germplasmDbId' => 38852,'progenyGermplasmDbId' => 38852},{'germplasmDbId' => 38853,'defaultDisplayName' => 'new_test_crossP008','progenyGermplasmDbId' => 38853,'parentType' => 'FEMALE'},{'parentType' => 'FEMALE','progenyGermplasmDbId' => 38854,'defaultDisplayName' => 'new_test_crossP009','germplasmDbId' => 38854},{'germplasmDbId' => 38855,'defaultDisplayName' => 'new_test_crossP010','progenyGermplasmDbId' => 38855,'parentType' => 'FEMALE'}],'progeny' => [{'parentType' => 'FEMALE','progenyGermplasmDbId' => 38846,'germplasmDbId' => 38846,'defaultDisplayName' => 'new_test_crossP001'},{'parentType' => 'FEMALE','germplasmDbId' => 38847,'defaultDisplayName' => 'new_test_crossP002','progenyGermplasmDbId' => 38847},{'progenyGermplasmDbId' => 38848,'defaultDisplayName' => 'new_test_crossP003','germplasmDbId' => 38848,'parentType' => 'FEMALE'},{'germplasmDbId' => 38849,'defaultDisplayName' => 'new_test_crossP004','progenyGermplasmDbId' => 38849,'parentType' => 'FEMALE'},{'parentType' => 'FEMALE','defaultDisplayName' => 'new_test_crossP005','germplasmDbId' => 38850,'progenyGermplasmDbId' => 38850},{'parentType' => 'FEMALE','progenyGermplasmDbId' => 38851,'germplasmDbId' => 38851,'defaultDisplayName' => 'new_test_crossP006'},{'progenyGermplasmDbId' => 38852,'germplasmDbId' => 38852,'defaultDisplayName' => 'new_test_crossP007','parentType' => 'FEMALE'},{'defaultDisplayName' => 'new_test_crossP008','germplasmDbId' => 38853,'progenyGermplasmDbId' => 38853,'parentType' => 'FEMALE'},{'germplasmDbId' => 38854,'defaultDisplayName' => 'new_test_crossP009','progenyGermplasmDbId' => 38854,'parentType' => 'FEMALE'},{'defaultDisplayName' => 'new_test_crossP010','germplasmDbId' => 38855,'progenyGermplasmDbId' => 38855,'parentType' => 'FEMALE'}],'defaultDisplayName' => 'test_accession4','germplasmDbId' => '38843'},'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Germplasm','messageType' => 'INFO'},{'message' => 'Germplasm progeny result constructed','messageType' => 'INFO'}],'pagination' => {'totalCount' => 15,'currentPage' => 0,'pageSize' => 10,'totalPages' => 2},'datafiles' => []}}, 'germplasm progeny');
110 $mech->get_ok('http://localhost:3010/brapi/v1/germplasm/38937/markerprofiles?access_token='.$access_token);
111 $response = decode_json $mech->content;
112 print STDERR Dumper $response;
113 is_deeply($response, {'result' => {'markerprofileDbIds' => [1622,1934],'germplasmDbId' => '38937'},'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v1::Germplasm','messageType' => 'INFO'},{'message' => 'Germplasm markerprofiles result constructed','messageType' => 'INFO'}],'pagination' => {'totalCount' => 2,'currentPage' => 0,'pageSize' => 10,'totalPages' => 1},'datafiles' => []}}, 'germplasm markerprofile');
115 $mech->get_ok('http://localhost:3010/brapi/v1/markerprofiles?pageSize=2&page=3&access_token='.$access_token);
116 $response = decode_json $mech->content;
117 print STDERR Dumper $response;
118 is_deeply($response, {'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=3, pageSize=2'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Markerprofiles'},{'message' => 'Markerprofiles-search result constructed','messageType' => 'INFO'}],'pagination' => {'pageSize' => 2,'totalCount' => 535,'totalPages' => 268,'currentPage' => 3},'datafiles' => []},'result' => {'data' => [{'uniqueDisplayName' => 'UG120004|78264','analysisMethod' => 'GBS ApeKI genotyping v4','extractDbId' => '38881','germplasmDbId' => '38881','resultCount' => 500,'sampleDbId' => '38881','markerprofileDbId' => '533'},{'markerprofileDbId' => '837','sampleDbId' => '38881','uniqueDisplayName' => 'UG120004|79798','resultCount' => 500,'analysisMethod' => 'GBS ApeKI genotyping v4','extractDbId' => '38881','germplasmDbId' => '38881'}]}}, 'markerprofile');
120 $mech->get_ok('http://localhost:3010/brapi/v1/markerprofiles?pageSize=1&page=1&germplasmDbId=38937&access_token='.$access_token);
121 $response = decode_json $mech->content;
122 print STDERR Dumper $response;
123 is_deeply($response, {'result' => {'data' => [{'uniqueDisplayName' => 'UG120066|79802','analysisMethod' => 'GBS ApeKI genotyping v4','extractDbId' => '38937','germplasmDbId' => '38937','resultCount' => 500,'sampleDbId' => '38937','markerprofileDbId' => '841'}]},'metadata' => {'datafiles' => [],'pagination' => {'currentPage' => 1,'totalPages' => 2,'totalCount' => 2,'pageSize' => 1},'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=1, pageSize=1'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Markerprofiles'},{'message' => 'Markerprofiles-search result constructed','messageType' => 'INFO'}]}}, 'markerprofile');
125 $mech->get_ok('http://localhost:3010/brapi/v1/markerprofiles?pageSize=2&page=3&methodDbId=1&access_token='.$access_token);
126 $response = decode_json $mech->content;
127 print STDERR Dumper $response;
128 is_deeply($response, {'result' => {'data' => [{'analysisMethod' => 'GBS ApeKI genotyping v4','extractDbId' => '38881','sampleDbId' => '38881','markerprofileDbId' => '533','germplasmDbId' => '38881','resultCount' => 500,'uniqueDisplayName' => 'UG120004|78264'},{'markerprofileDbId' => '837','sampleDbId' => '38881','extractDbId' => '38881','germplasmDbId' => '38881','analysisMethod' => 'GBS ApeKI genotyping v4','uniqueDisplayName' => 'UG120004|79798','resultCount' => 500}]},'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=3, pageSize=2','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Markerprofiles','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Markerprofiles-search result constructed'}],'datafiles' => [],'pagination' => {'pageSize' => 2,'totalPages' => 268,'totalCount' => 535,'currentPage' => 3}}}, 'markerprofile');
130 $mech->get_ok('http://localhost:3010/brapi/v1/markerprofiles/533?access_token='.$access_token);
131 $response = decode_json $mech->content;
132 print STDERR Dumper $response;
133 is_deeply($response, {'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Markerprofiles','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Markerprofiles detail result constructed'}],'datafiles' => [],'pagination' => undef},'result' => {'uniqueDisplayName' => 'UG120004|78264','sampleDbId' => '38881','extractDbId' => '38881','markerprofileDbId' => '533','germplasmDbId' => '38881','data' => [{'S5_36739' => '0'},{'S13_92567' => '1'},{'S69_57277' => '0'},{'S80_224901' => '1'},{'S80_232173' => '1'},{'S80_265728' => '0'},{'S97_219243' => '1'},{'S224_309814' => '0'},{'S248_174244' => '1'},{'S318_245078' => '2'}],'analysisMethod' => 'GBS ApeKI genotyping v4'}}, 'markerprofile');
135 $mech->post_ok('http://localhost:3010/brapi/v1/allelematrices-search?access_token='.$access_token, ['markerprofileDbId'=>[841,533], 'format'=>'json'] );
136 $response = decode_json $mech->content;
137 print STDERR Dumper $response;
138 is_deeply($response, {'result' => {'data' => [['S10114_185859','533','0'],['S10173_777651','533','0'],['S10173_899514','533','0'],['S10241_146006','533','1'],['S1027_465354','533','1'],['S10367_21679','533','1'],['S1046_216535','533','2'],['S10493_191533','533','0'],['S10493_282956','533','2'],['S10493_529025','533','0']]},'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Markerprofiles'},{'messageType' => 'INFO','message' => 'Markerprofiles allelematrix result constructed'}],'datafiles' => [],'pagination' => {'pageSize' => 10,'totalCount' => 1000,'totalPages' => 100,'currentPage' => 0}}}, 'allelematrices-search');
140 $mech->get_ok('http://localhost:3010/brapi/v1/programs?access_token='.$access_token );
141 $response = decode_json $mech->content;
142 print STDERR Dumper $response;
143 is_deeply($response, {'result' => {'data' => [{'objective' => 'test','programDbId' => '134','abbreviation' => '','programName' => 'test','commonCropName' => 'Cassava','leadPerson' => ''}]},'metadata' => {'datafiles' => [],'pagination' => {'pageSize' => 10,'totalPages' => 1,'totalCount' => 1,'currentPage' => 0},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Programs'},{'message' => 'Program list result constructed','messageType' => 'INFO'}]}}, 'programs');
145 $mech->get_ok('http://localhost:3010/brapi/v1/crops?access_token='.$access_token );
146 $response = decode_json $mech->content;
147 print STDERR Dumper $response;
148 is_deeply($response, {'result' => {'data' => ['Cassava']},'metadata' => {'datafiles' => [],'pagination' => {'pageSize' => 10,'totalPages' => 1,'currentPage' => 0,'totalCount' => 1},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Crops'},{'message' => 'Crops result constructed','messageType' => 'INFO'}]}}, 'crops');
150 $mech->get_ok('http://localhost:3010/brapi/v1/seasons?access_token='.$access_token );
151 $response = decode_json $mech->content;
152 print STDERR Dumper $response;
153 is_deeply($response, {'result' => {'data' => [{'seasonDbId' => '2014','season' => '','year' => '2014'},{'season' => '','year' => '2015','seasonDbId' => '2015'},{'seasonDbId' => '2016','year' => '2016','season' => ''},{'seasonDbId' => '2017','year' => '2017','season' => ''}]},'metadata' => {'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v1::Studies','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Seasons list result constructed'}],'datafiles' => [],'pagination' => {'totalPages' => 1,'currentPage' => 0,'pageSize' => 10,'totalCount' => 4}}}, 'seasons');
155 $mech->get_ok('http://localhost:3010/brapi/v1/studytypes?access_token='.$access_token );
156 $response = decode_json $mech->content;
157 print STDERR Dumper $response;
158 is_deeply($response, {'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Studies'},{'messageType' => 'INFO','message' => 'StudyTypes list result constructed'}],'pagination' => {'totalCount' => 20,'currentPage' => 0,'totalPages' => 2,'pageSize' => 10},'datafiles' => []},'result' => {'data' => [{'name' => 'Seedling Nursery','description' => 'seedling'},{'description' => 'phenotyping_trial','name' => 'phenotyping_trial'},{'name' => 'genotyping_trial','description' => 'genotyping_trial'},{'description' => '','name' => 'Advanced Yield Trial'},{'name' => 'Preliminary Yield Trial','description' => ''},{'name' => 'Uniform Yield Trial','description' => ''},{'name' => 'Variety Release Trial','description' => ''},{'name' => 'Clonal Evaluation','description' => ''},{'name' => 'genetic_gain_trial','description' => ''},{'name' => 'storage_trial','description' => ''}]}}, 'studyTypes');
160 $mech->get_ok('http://localhost:3010/brapi/v1/studytypes?pageSize=2&page=2&access_token='.$access_token);
161 $response = decode_json $mech->content;
162 print STDERR Dumper $response;
163 is_deeply($response, {'result' => {'data' => [{'description' => '','name' => 'Preliminary Yield Trial'},{'description' => '','name' => 'Uniform Yield Trial'}]},'metadata' => {'datafiles' => [],'pagination' => {'pageSize' => 2,'totalPages' => 10,'totalCount' => 20,'currentPage' => 2},'status' => [{'message' => 'BrAPI base call found with page=2, pageSize=2','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Studies','messageType' => 'INFO'},{'message' => 'StudyTypes list result constructed','messageType' => 'INFO'}]}}, 'studyTypes');
165 # $mech->get_ok('http://localhost:3010/brapi/v1/trials?pageSize=2&page=0&access_token='.$access_token);
166 # $response = decode_json $mech->content;
167 # print STDERR Dumper $response;
168 # is_deeply($response, {}, 'trials');
170 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=2&access_token='.$access_token );
171 $response = decode_json $mech->content;
172 print STDERR Dumper $response;
173 is_deeply($response, {"result"=>{"data"=>[{"trialDbId"=>"","studyType"=>undef,"studyDbId"=>"137","programName"=>"test","commonCropName"=>"Cassava","studyTypeName"=>"","programDbId"=>"134","locationName"=>"test_location","startDate"=>"2017-07-04","endDate"=>"2017-07-21","studyTypeDbId"=>"","additionalInfo"=>{"description"=>"test trial","design"=>"CRD"},"active"=>JSON::true,"trialName"=>undef,"name"=>"test_trial","documentationURL"=>"","seasons"=>[{"seasonDbId"=>"","year"=>"2014","season"=>""}],"locationDbId"=>"23","studyName"=>"test_trial"},{"studyName"=>"trial2 NaCRRI","name"=>"trial2 NaCRRI","trialName"=>undef,"seasons"=>[{"season"=>"","year"=>"2014","seasonDbId"=>""}],"documentationURL"=>"","locationDbId"=>"23","programDbId"=>"134","locationName"=>"test_location","startDate"=>undef,"active"=>JSON::true,"endDate"=>undef,"studyTypeDbId"=>"","additionalInfo"=>{"description"=>"another trial for solGS","design"=>"CRD"},"studyDbId"=>"141","programName"=>"test","trialDbId"=>"","studyType"=>undef,"commonCropName"=>"Cassava","studyTypeName"=>""}]},"metadata"=>{"datafiles"=>[],"pagination"=>{"currentPage"=>2,"totalPages"=>3,"totalCount"=>6,"pageSize"=>2},"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=2, pageSize=2"},{"messageType"=>"INFO","message"=>"Loading CXGN::BrAPI::v1::Studies"},{"message"=>"Studies-search result constructed","messageType"=>"INFO"}]}}, 'studies-search');
175 $mech->post_ok('http://localhost:3010/brapi/v1/search/studies?access_token='.$access_token , ['pageSize'=>'2', 'page'=>'2']);
176 $response = decode_json $mech->content;
177 $searchId = $response->{result} ->{searchResultsDbId};
178 print STDERR Dumper $response;
179 $mech->get_ok('http://localhost:3010/brapi/v1/search/studies/'. $searchId . '?access_token='.$access_token );
180 $response = decode_json $mech->content;
181 print STDERR Dumper $response;
182 is_deeply($response, {"result"=>{"data"=>[{"trialDbId"=>"","studyType"=>undef,"studyDbId"=>"137","programName"=>"test","commonCropName"=>"Cassava","studyTypeName"=>"","programDbId"=>"134","locationName"=>"test_location","startDate"=>"2017-07-04","endDate"=>"2017-07-21","studyTypeDbId"=>"","additionalInfo"=>{"description"=>"test trial","design"=>"CRD"},"active"=>JSON::true,"trialName"=>undef,"name"=>"test_trial","documentationURL"=>"","seasons"=>[{"seasonDbId"=>"","year"=>"2014","season"=>""}],"locationDbId"=>"23","studyName"=>"test_trial"},{"studyName"=>"trial2 NaCRRI","name"=>"trial2 NaCRRI","trialName"=>undef,"seasons"=>[{"season"=>"","year"=>"2014","seasonDbId"=>""}],"documentationURL"=>"","locationDbId"=>"23","programDbId"=>"134","locationName"=>"test_location","startDate"=>undef,"active"=>JSON::true,"endDate"=>undef,"studyTypeDbId"=>"","additionalInfo"=>{"description"=>"another trial for solGS","design"=>"CRD"},"studyDbId"=>"141","programName"=>"test","trialDbId"=>"","studyType"=>undef,"commonCropName"=>"Cassava","studyTypeName"=>""}]},"metadata"=>{"datafiles"=>[],"pagination"=>{"currentPage"=>2,"totalPages"=>3,"totalCount"=>6,"pageSize"=>2},"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=2, pageSize=2"},{"messageType"=>"INFO","message"=>"Loading CXGN::BrAPI::v1::Studies"},{"message"=>"Studies-search result constructed","messageType"=>"INFO"}]}}, 'studies-search');
184 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&programDbIds=100&access_token='.$access_token );
185 $response = decode_json $mech->content;
186 print STDERR Dumper $response;
187 is_deeply($response, {"result"=>{"data"=>[]},"metadata"=>{"status"=>[{"message"=>"BrAPI base call found with page=0, pageSize=2","messageType"=>"INFO"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"message"=>"Studies-search result constructed","messageType"=>"INFO"}],"pagination"=>{"totalCount"=>0,"pageSize"=>2,"totalPages"=>0,"currentPage"=>0},"datafiles"=>[]}}, 'studies-search with program');
189 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&programDbIds=134&access_token='.$access_token );
190 $response = decode_json $mech->content;
191 print STDERR Dumper $response;
192 is_deeply($response, {"metadata"=>{"datafiles"=>[],"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=0, pageSize=2"},{"messageType"=>"INFO","message"=>"Loading CXGN::BrAPI::v1::Studies"},{"message"=>"Studies-search result constructed","messageType"=>"INFO"}],"pagination"=>{"currentPage"=>0,"pageSize"=>2,"totalCount"=>6,"totalPages"=>3}},"result"=>{"data"=>[{"studyTypeName"=>"","name"=>"CASS_6Genotypes_Sampling_2015","additionalInfo"=>{"design"=>"RCBD","description"=>"Copy of trial with postcomposed phenotypes from cassbase."},"commonCropName"=>"Cassava","documentationURL"=>"","active"=>JSON::true,"locationName"=>"test_location","trialName"=>undef,"startDate"=>undef,"seasons"=>[{"season"=>"","seasonDbId"=>"","year"=>"2017"}],"programName"=>"test","studyDbId"=>"165","studyName"=>"CASS_6Genotypes_Sampling_2015","studyTypeDbId"=>"","trialDbId"=>"","programDbId"=>"134","locationDbId"=>"23","endDate"=>undef,"studyType"=>"Preliminary Yield Trial"},{"studyType"=>"Clonal Evaluation","endDate"=>undef,"programDbId"=>"134","locationDbId"=>"23","studyName"=>"Kasese solgs trial","trialDbId"=>"","studyTypeDbId"=>"","programName"=>"test","seasons"=>[{"season"=>"","year"=>"2014","seasonDbId"=>""}],"studyDbId"=>"139","startDate"=>undef,"active"=>JSON::true,"locationName"=>"test_location","trialName"=>undef,"additionalInfo"=>{"design"=>"Alpha","description"=>"This trial was loaded into the fixture to test solgs."},"commonCropName"=>"Cassava","documentationURL"=>"","studyTypeName"=>"","name"=>"Kasese solgs trial"}]}}, 'studies-search with program');
194 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&trialDbIds=167&access_token='.$access_token );
195 $response = decode_json $mech->content;
196 print STDERR Dumper $response;
197 is_deeply($response, {"metadata"=>{"datafiles"=>[],"status"=>[{"message"=>"BrAPI base call found with page=0, pageSize=2","messageType"=>"INFO"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Studies-search result constructed"}],"pagination"=>{"currentPage"=>0,"totalPages"=>0,"totalCount"=>0,"pageSize"=>2}},"result"=>{"data"=>[]}}, 'studies-search with trial');
199 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&studyLocations=test_location&access_token='.$access_token );
200 $response = decode_json $mech->content;
201 print STDERR Dumper $response;
202 is_deeply($response, {"metadata"=>{"datafiles"=>[],"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=0, pageSize=2"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Studies-search result constructed"}],"pagination"=>{"totalPages"=>3,"totalCount"=>6,"currentPage"=>0,"pageSize"=>2}},"result"=>{"data"=>[{"studyName"=>"CASS_6Genotypes_Sampling_2015","documentationURL"=>"","seasons"=>[{"season"=>"","year"=>"2017","seasonDbId"=>""}],"locationDbId"=>"23","name"=>"CASS_6Genotypes_Sampling_2015","trialName"=>undef,"studyTypeDbId"=>"","additionalInfo"=>{"description"=>"Copy of trial with postcomposed phenotypes from cassbase.","design"=>"RCBD"},"endDate"=>undef,"active"=>JSON::true,"programDbId"=>"134","startDate"=>undef,"locationName"=>"test_location","commonCropName"=>"Cassava","studyTypeName"=>"","studyType"=>"Preliminary Yield Trial","trialDbId"=>"","programName"=>"test","studyDbId"=>"165"},{"name"=>"Kasese solgs trial","trialName"=>undef,"seasons"=>[{"seasonDbId"=>"","season"=>"","year"=>"2014"}],"documentationURL"=>"","locationDbId"=>"23","studyName"=>"Kasese solgs trial","programName"=>"test","studyDbId"=>"139","trialDbId"=>"","studyType"=>"Clonal Evaluation","studyTypeName"=>"","commonCropName"=>"Cassava","programDbId"=>"134","startDate"=>undef,"locationName"=>"test_location","active"=>JSON::true,"studyTypeDbId"=>"","endDate"=>undef,"additionalInfo"=>{"design"=>"Alpha","description"=>"This trial was loaded into the fixture to test solgs."}}]}}, 'studies-search');
204 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&locationName=test_location&studyType=Clonal%20Evaluation&access_token='.$access_token );
205 $response = decode_json $mech->content;
206 print STDERR Dumper $response;
207 is_deeply($response, {"result"=>{"data"=>[{"documentationURL"=>"","seasons"=>[{"year"=>"2014","season"=>"","seasonDbId"=>""}],"locationDbId"=>"23","trialName"=>undef,"name"=>"Kasese solgs trial","studyName"=>"Kasese solgs trial","studyTypeName"=>"","commonCropName"=>"Cassava","trialDbId"=>"","studyType"=>"Clonal Evaluation","programName"=>"test","studyDbId"=>"139","studyTypeDbId"=>"","endDate"=>undef,"additionalInfo"=>{"design"=>"Alpha","description"=>"This trial was loaded into the fixture to test solgs."},"active"=>JSON::true,"programDbId"=>"134","startDate"=>undef,"locationName"=>"test_location"}]},"metadata"=>{"pagination"=>{"currentPage"=>0,"totalPages"=>1,"totalCount"=>1,"pageSize"=>2},"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=0, pageSize=2"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"message"=>"Studies-search result constructed","messageType"=>"INFO"}],"datafiles"=>[]}}, 'studies-search');
209 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&programName=test&access_token='.$access_token );
210 $response = decode_json $mech->content;
211 print STDERR Dumper $response;
212 is_deeply($response, {"metadata"=>{"pagination"=>{"currentPage"=>0,"totalCount"=>6,"totalPages"=>3,"pageSize"=>2},"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=0, pageSize=2"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Studies-search result constructed"}],"datafiles"=>[]},"result"=>{"data"=>[{"seasons"=>[{"year"=>"2017","season"=>"","seasonDbId"=>""}],"documentationURL"=>"","locationDbId"=>"23","trialName"=>undef,"name"=>"CASS_6Genotypes_Sampling_2015","studyName"=>"CASS_6Genotypes_Sampling_2015","commonCropName"=>"Cassava","studyTypeName"=>"","studyDbId"=>"165","programName"=>"test","studyType"=>"Preliminary Yield Trial","trialDbId"=>"","active"=>JSON::true,"studyTypeDbId"=>"","endDate"=>undef,"additionalInfo"=>{"description"=>"Copy of trial with postcomposed phenotypes from cassbase.","design"=>"RCBD"},"programDbId"=>"134","startDate"=>undef,"locationName"=>"test_location"},{"commonCropName"=>"Cassava","studyTypeName"=>"","studyDbId"=>"139","programName"=>"test","trialDbId"=>"","studyType"=>"Clonal Evaluation","active"=>JSON::true,"studyTypeDbId"=>"","endDate"=>undef,"additionalInfo"=>{"description"=>"This trial was loaded into the fixture to test solgs.","design"=>"Alpha"},"programDbId"=>"134","startDate"=>undef,"locationName"=>"test_location","seasons"=>[{"seasonDbId"=>"","season"=>"","year"=>"2014"}],"documentationURL"=>"","locationDbId"=>"23","trialName"=>undef,"name"=>"Kasese solgs trial","studyName"=>"Kasese solgs trial"}]}}, 'studies-search');
214 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&germplasmNames=TMEB693&access_token='.$access_token );
215 $response = decode_json $mech->content;
216 print STDERR Dumper $response;
217 is_deeply($response, {"result"=>{"data"=>[{"studyTypeDbId"=>"","trialDbId"=>"","studyName"=>"CASS_6Genotypes_Sampling_2015","studyDbId"=>"165","programName"=>"test","seasons"=>[{"season"=>"","seasonDbId"=>"","year"=>"2017"}],"endDate"=>undef,"studyType"=>"Preliminary Yield Trial","locationDbId"=>"23","programDbId"=>"134","documentationURL"=>"","commonCropName"=>"Cassava","additionalInfo"=>{"description"=>"Copy of trial with postcomposed phenotypes from cassbase.","design"=>"RCBD"},"name"=>"CASS_6Genotypes_Sampling_2015","studyTypeName"=>"","startDate"=>undef,"trialName"=>undef,"locationName"=>"test_location","active"=>JSON::true}]},"metadata"=>{"datafiles"=>[],"pagination"=>{"currentPage"=>0,"pageSize"=>2,"totalCount"=>1,"totalPages"=>1},"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=0, pageSize=2"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Studies-search result constructed"}]}}, 'studies-search with germplasm name');
219 $mech->post_ok('http://localhost:3010/brapi/v1/studies-search?pageSize=2&page=0&observationVariableDbIds=77549&access_token='.$access_token );
220 $response = decode_json $mech->content;
221 print STDERR Dumper $response;
222 is_deeply($response, {"result"=>{"data"=>[{"name"=>"CASS_6Genotypes_Sampling_2015","studyTypeName"=>"","documentationURL"=>"","commonCropName"=>"Cassava","additionalInfo"=>{"design"=>"RCBD","description"=>"Copy of trial with postcomposed phenotypes from cassbase."},"trialName"=>undef,"locationName"=>"test_location","active"=>JSON::true,"startDate"=>undef,"studyDbId"=>"165","seasons"=>[{"season"=>"","year"=>"2017","seasonDbId"=>""}],"programName"=>"test","trialDbId"=>"","studyTypeDbId"=>"","studyName"=>"CASS_6Genotypes_Sampling_2015","locationDbId"=>"23","programDbId"=>"134","endDate"=>undef,"studyType"=>"Preliminary Yield Trial"}]},"metadata"=>{"datafiles"=>[],"pagination"=>{"currentPage"=>0,"pageSize"=>2,"totalCount"=>1,"totalPages"=>1},"status"=>[{"messageType"=>"INFO","message"=>"BrAPI base call found with page=0, pageSize=2"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Studies-search result constructed"}]}}, 'studies-search with trait');
224 $mech->get_ok('http://localhost:3010/brapi/v1/studies/139?access_token='.$access_token);
225 $response = decode_json $mech->content;
226 print STDERR Dumper $response;
228 $response->{result}->{location}->{longitude} = round($response->{result}->{location}->{longitude});
229 $response->{result}->{location}->{latitude} = round($response->{result}->{location}->{latitude});
231 is_deeply($response,{'metadata' => {'pagination' => {'totalCount' => 1,'totalPages' => 1,'currentPage' => 0,'pageSize' => 10},'datafiles' => [],'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Studies'},{'message' => 'Studies detail result constructed','messageType' => 'INFO'}]},'result' => {'startDate' => undef,'studyName' => 'Kasese solgs trial','studyTypeName' => '','studyDescription' => 'This trial was loaded into the fixture to test solgs.','seasons' => ['2014'],'contacts' => undef,'additionalInfo' => {},'programName' => 'test','trialName' => 'test','endDate' => undef,'active' => JSON::true,'lastUpdate' => {'timestamp' => undef,'version' => ''},'studyTypeDbId' => '','studyDbId' => '139','studyType' => 'Clonal Evaluation','license' => '','documentationURL' => '','programDbId' => '134','location' => {'abbreviation' => '','locationName' => 'test_location','locationDbId' => '23','documentationURL' => '','locationType' => '','countryCode' => 'USA','countryName' => 'United States','longitude' => '-116','additionalInfo' => {'geodetic datum' => undef,'breeding_program' => '134'},'latitude' => '33','altitude' => '109','name' => 'test_location','instituteName' => '','instituteAddress' => ''},'dataLinks' => [],'trialDbId' => '134','commonCropName' => 'Cassava'}}, 'study details');
233 $mech->get_ok('http://localhost:3010/brapi/v1/studies/139/germplasm?access_token='.$access_token);
234 $response = decode_json $mech->content;
235 print STDERR Dumper $response;
236 is_deeply($response, {'result' => {'studyName' => 'Kasese solgs trial','data' => [{'accessionNumber' => '','germplasmDbId' => '38878','seedSource' => '','entryNumber' => '','germplasmName' => 'UG120001','synonyms' => [],'pedigree' => '','germplasmPUI' => ''},{'germplasmDbId' => '38879','accessionNumber' => '','pedigree' => '','germplasmPUI' => '','seedSource' => '','entryNumber' => '','germplasmName' => 'UG120002','synonyms' => []},{'accessionNumber' => '','germplasmDbId' => '38880','entryNumber' => '','seedSource' => '','synonyms' => [],'germplasmName' => 'UG120003','pedigree' => '','germplasmPUI' => ''},{'germplasmDbId' => '38881','accessionNumber' => '','germplasmPUI' => '','pedigree' => '','synonyms' => [],'germplasmName' => 'UG120004','entryNumber' => '','seedSource' => ''},{'germplasmDbId' => '38882','accessionNumber' => '','germplasmPUI' => '','pedigree' => '','germplasmName' => 'UG120005','synonyms' => [],'entryNumber' => '','seedSource' => ''},{'synonyms' => [],'germplasmName' => 'UG120006','seedSource' => '','entryNumber' => '','germplasmPUI' => '','pedigree' => '','accessionNumber' => '','germplasmDbId' => '38883'},{'pedigree' => '','germplasmPUI' => '','germplasmName' => 'UG120007','synonyms' => [],'seedSource' => '','entryNumber' => '','germplasmDbId' => '38884','accessionNumber' => ''},{'accessionNumber' => '','germplasmDbId' => '38885','entryNumber' => '','seedSource' => '','synonyms' => [],'germplasmName' => 'UG120008','germplasmPUI' => '','pedigree' => ''},{'accessionNumber' => '','germplasmDbId' => '38886','entryNumber' => '','seedSource' => '','synonyms' => [],'germplasmName' => 'UG120009','pedigree' => '','germplasmPUI' => ''},{'seedSource' => '','entryNumber' => '','germplasmName' => 'UG120010','synonyms' => [],'germplasmPUI' => '','pedigree' => '','accessionNumber' => '','germplasmDbId' => '38887'}],'studyDbId' => '139'},'metadata' => {'pagination' => {'totalPages' => 38,'pageSize' => 10,'totalCount' => 374,'currentPage' => 0},'datafiles' => [],'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=0, pageSize=10'},{'message' => 'Loading CXGN::BrAPI::v1::Studies','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Studies-germplasm result constructed'}]}}, 'study germplasm');
238 $mech->get_ok('http://localhost:3010/brapi/v1/studies/165/observationvariables?pageSize=2&page=1&access_token='.$access_token);
239 $response = decode_json $mech->content;
240 print STDERR Dumper $response;
241 is_deeply($response, {"result"=>{"studyDbId"=>"165","studyName"=>"CASS_6Genotypes_Sampling_2015","data"=>[{"ontologyReference"=>{"ontologyName"=>"COMP","documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyDbId"=>"305"},"observationVariableName"=>"cass sink leaf|ADP|ug/g|week 16","submissionTimeStamp"=>undef,"institution"=>"","ontologyName"=>"COMP","crop"=>"Cassava","synonyms"=>[],"contextOfUse"=>[],"observationVariableDbId"=>"cass sink leaf|ADP|ug/g|week 16|COMP:0000010","xref"=>"COMP:0000010","documentationURL"=>"","method"=>{"class"=>"","description"=>"","reference"=>"","formula"=>"","methodDbId"=>"","ontologyReference"=>{"ontologyName"=>"COMP","documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyDbId"=>"305"},"name"=>"","methodName"=>""},"language"=>"EN","growthStage"=>"","scale"=>{"validValues"=>{"min"=>undef,"categories"=>[],"max"=>undef},"scaleName"=>"","xref"=>"","dataType"=>"Numerical","ontologyReference"=>{"ontologyName"=>"COMP","documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyDbId"=>"305"},"scaleDbId"=>"","decimalPlaces"=>undef,"name"=>""},"scientist"=>"","name"=>"cass sink leaf|ADP|ug/g|week 16|COMP:0000010","ontologyDbId"=>"305","trait"=>{"ontologyReference"=>{"ontologyName"=>"COMP","documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyDbId"=>"305"},"entity"=>"","mainAbbreviation"=>"","alternativeAbbreviations"=>[],"traitName"=>"cass sink leaf|ADP|ug/g|week 16","name"=>"cass sink leaf|ADP|ug/g|week 16","traitDbId"=>"COMP:0000010","status"=>JSON::true,"class"=>"","description"=>undef,"synonyms"=>[],"xref"=>"COMP:0000010"},"status"=>JSON::true,"defaultValue"=>""},{"method"=>{"name"=>"","methodName"=>"","ontologyReference"=>{"documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyName"=>"COMP","ontologyDbId"=>"305"},"reference"=>"","formula"=>"","methodDbId"=>"","class"=>"","description"=>""},"language"=>"EN","growthStage"=>"","scale"=>{"scaleName"=>"","xref"=>"","dataType"=>"Numerical","validValues"=>{"min"=>undef,"categories"=>[],"max"=>undef},"name"=>"","ontologyReference"=>{"documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyName"=>"COMP","ontologyDbId"=>"305"},"scaleDbId"=>"","decimalPlaces"=>undef},"scientist"=>"","ontologyDbId"=>"305","name"=>"cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002","trait"=>{"status"=>JSON::true,"class"=>"","description"=>undef,"synonyms"=>[],"xref"=>"COMP:0000002","entity"=>"","ontologyReference"=>{"documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyName"=>"COMP","ontologyDbId"=>"305"},"mainAbbreviation"=>"","alternativeAbbreviations"=>[],"traitName"=>"cass source leaf|3-phosphoglyceric acid|ug/g|week 16","name"=>"cass source leaf|3-phosphoglyceric acid|ug/g|week 16","traitDbId"=>"COMP:0000002"},"status"=>JSON::true,"defaultValue"=>"","ontologyReference"=>{"documentationURL"=>{"URL"=>"","type"=>""},"version"=>"","ontologyName"=>"COMP","ontologyDbId"=>"305"},"observationVariableName"=>"cass source leaf|3-phosphoglyceric acid|ug/g|week 16","submissionTimeStamp"=>undef,"institution"=>"","ontologyName"=>"COMP","crop"=>"Cassava","synonyms"=>[],"contextOfUse"=>[],"observationVariableDbId"=>"cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002","documentationURL"=>"","xref"=>"COMP:0000002"}]},"metadata"=>{"status"=>[{"message"=>"BrAPI base call found with page=1, pageSize=2","messageType"=>"INFO"},{"message"=>"Loading CXGN::BrAPI::v1::Studies","messageType"=>"INFO"},{"message"=>"Studies observation variables result constructed","messageType"=>"INFO"}],"pagination"=>{"totalPages"=>6,"currentPage"=>1,"pageSize"=>2,"totalCount"=>12},"datafiles"=>[]}}, 'study variables');
243 $mech->get_ok('http://localhost:3010/brapi/v1/studies/165/observationunits?pageSize=1&page=1&access_token='.$access_token);
244 $response = decode_json $mech->content;
245 print STDERR Dumper $response;
246 is_deeply($response, {"result"=>{"data"=>[{"plantNumber"=>undef,"observationUnitName"=>"CASS_6Genotypes_104","plotNumber"=>"104","observationUnitDbId"=>"41295","programName"=>"test","studyDbId"=>"165","studyLocationDbId"=>"23","entryNumber"=>"","Y"=>undef,"entryType"=>"test","pedigree"=>"NA/NA","germplasmDbId"=>"41282","studyLocation"=>"test_location","X"=>undef,"studyName"=>"CASS_6Genotypes_Sampling_2015","observationLevel"=>"plot","treatments"=>[{"factor"=>"No ManagementFactor","modality"=>undef}],"germplasmName"=>"IITA-TMS-IBA980002","replicate"=>undef,"observationUnitXref"=>[],"observations"=>[{"observationVariableDbId"=>"77559","observationDbId"=>"740348","observationTimestamp"=>undef,"collector"=>"johndoe","season"=>{"season"=>"","year"=>"2017","seasonDbId"=>""},"value"=>"221.6135","observationVariableName"=>"cass sink leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000013"},{"observationDbId"=>"740349","observationVariableDbId"=>"77557","observationTimestamp"=>undef,"collector"=>"johndoe","season"=>{"seasonDbId"=>"","year"=>"2017","season"=>""},"observationVariableName"=>"cass sink leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000011","value"=>"36.12425"},{"observationVariableDbId"=>"77556","observationDbId"=>"740350","observationTimestamp"=>undef,"collector"=>"johndoe","season"=>{"season"=>"","year"=>"2017","seasonDbId"=>""},"observationVariableName"=>"cass sink leaf|ADP|ug/g|week 16|COMP:0000010","value"=>"316.489"},{"value"=>"908.9045","observationVariableName"=>"cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002","season"=>{"season"=>"","year"=>"2017","seasonDbId"=>""},"observationTimestamp"=>undef,"collector"=>"johndoe","observationVariableDbId"=>"77548","observationDbId"=>"740351"},{"observationTimestamp"=>undef,"collector"=>"johndoe","observationVariableDbId"=>"77553","observationDbId"=>"740352","value"=>"29.6934","observationVariableName"=>"cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007","season"=>{"seasonDbId"=>"","season"=>"","year"=>"2017"}},{"observationDbId"=>"740353","observationVariableDbId"=>"77549","observationTimestamp"=>undef,"collector"=>"johndoe","season"=>{"year"=>"2017","season"=>"","seasonDbId"=>""},"observationVariableName"=>"cass source leaf|ADP|ug/g|week 16|COMP:0000003","value"=>"162.9475"},{"observationVariableName"=>"cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006","value"=>"23.09545","season"=>{"season"=>"","year"=>"2017","seasonDbId"=>""},"observationTimestamp"=>undef,"collector"=>"johndoe","observationVariableDbId"=>"77552","observationDbId"=>"740354"},{"collector"=>"johndoe","observationTimestamp"=>undef,"observationVariableDbId"=>"77550","observationDbId"=>"740355","observationVariableName"=>"cass storage root|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000004","value"=>"14.3795","season"=>{"seasonDbId"=>"","season"=>"","year"=>"2017"}},{"season"=>{"seasonDbId"=>"","year"=>"2017","season"=>""},"observationVariableName"=>"cass storage root|ADP|ug/g|week 16|COMP:0000005","value"=>"85.9106","observationVariableDbId"=>"77551","observationDbId"=>"740356","collector"=>"johndoe","observationTimestamp"=>undef},{"observationTimestamp"=>undef,"collector"=>"johndoe","observationVariableDbId"=>"77558","observationDbId"=>"740357","observationVariableName"=>"cass upper stem|3-phosphoglyceric acid|ug/g|week 16|COMP:0000012","value"=>"54.2099","season"=>{"year"=>"2017","season"=>"","seasonDbId"=>""}},{"observationVariableName"=>"cass upper stem|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000008","value"=>"13.8628","season"=>{"seasonDbId"=>"","year"=>"2017","season"=>""},"observationTimestamp"=>undef,"collector"=>"johndoe","observationVariableDbId"=>"77554","observationDbId"=>"740358"},{"observationTimestamp"=>undef,"collector"=>"johndoe","observationDbId"=>"740359","observationVariableDbId"=>"77555","observationVariableName"=>"cass upper stem|ADP|ug/g|week 16|COMP:0000009","value"=>"341.041","season"=>{"seasonDbId"=>"","year"=>"2017","season"=>""}}],"blockNumber"=>undef,"observationLevels"=>"plot"}]},"metadata"=>{"datafiles"=>[],"pagination"=>{"currentPage"=>1,"totalPages"=>19,"totalCount"=>19,"pageSize"=>1},"status"=>[{"message"=>"BrAPI base call found with page=1, pageSize=1","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Loading CXGN::BrAPI::v1::Studies"},{"message"=>"Studies observations result constructed","messageType"=>"INFO"}]}}, 'study observation units');
248 $mech->get_ok('http://localhost:3010/brapi/v1/studies/165/table?access_token='.$access_token);
249 $response = decode_json $mech->content;
250 print STDERR Dumper $response;
251 is_deeply($response, {'metadata' => {'pagination' => {'currentPage' => 0,'pageSize' => 10,'totalCount' => 19,'totalPages' => 2},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Studies','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Studies observations table result constructed'}],'datafiles' => []},'result' => {'observationVariableNames' => ['cass sink leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000013','cass sink leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000011','cass sink leaf|ADP|ug/g|week 16|COMP:0000010','cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002','cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007','cass source leaf|ADP|ug/g|week 16|COMP:0000003','cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006','cass storage root|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000004','cass storage root|ADP|ug/g|week 16|COMP:0000005','cass upper stem|3-phosphoglyceric acid|ug/g|week 16|COMP:0000012','cass upper stem|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000008','cass upper stem|ADP|ug/g|week 16|COMP:0000009','notes'],'data' => [['studyYear','programDbId','programName','programDescription','studyDbId','studyName','studyDescription','studyDesign','plotWidth','plotLength','fieldSize','fieldTrialIsPlannedToBeGenotyped','fieldTrialIsPlannedToCross','plantingDate','harvestDate','locationDbId','locationName','germplasmDbId','germplasmName','germplasmSynonyms','observationLevel','observationUnitDbId','observationUnitName','replicate','blockNumber','plotNumber','rowNumber','colNumber','entryType','plantNumber','plantedSeedlotStockDbId','plantedSeedlotStockUniquename','plantedSeedlotCurrentCount','plantedSeedlotCurrentWeightGram','plantedSeedlotBoxName','plantedSeedlotTransactionCount','plantedSeedlotTransactionWeight','plantedSeedlotTransactionDescription','availableGermplasmSeedlotUniquenames','cass sink leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000013','cass sink leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000011','cass sink leaf|ADP|ug/g|week 16|COMP:0000010','cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002','cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007','cass source leaf|ADP|ug/g|week 16|COMP:0000003','cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006','cass storage root|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000004','cass storage root|ADP|ug/g|week 16|COMP:0000005','cass upper stem|3-phosphoglyceric acid|ug/g|week 16|COMP:0000012','cass upper stem|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000008','cass upper stem|ADP|ug/g|week 16|COMP:0000009','notes'],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41283,'IITA-TMS-IBA980581','','plot',41284,'CASS_6Genotypes_103','1','1','103',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','601.518','39.84365','655.92','1259.08','17.38275','192.1495','67.9959','20.3038','102.0875','108.56995','28.83915','379.16',undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41282,'IITA-TMS-IBA980002','','plot',41295,'CASS_6Genotypes_104','1','1','104',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','221.6135','36.12425','316.489','908.9045','29.6934','162.9475','23.09545','14.3795','85.9106','54.2099','13.8628','341.041',undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41279,'IITA-TMS-IBA30572','','plot',41296,'CASS_6Genotypes_105','1','1','105',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','662.087','46.1458','559.441','1974.265','38.1064','484.765','33.1455','16.7238','98.71395','97.8179','35.4435','439.9695',undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41281,'IITA-TMS-IBA011412','','plot',41297,'CASS_6Genotypes_106','1','1','106',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','612.37','23.788','604.5625','646.902','26.60415','192.46','39.6698','16.78125','107.74','78.72305','28.3805','469.818',undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41280,'TMEB693','','plot',41298,'CASS_6Genotypes_107','1','1','107',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','198.089','47.64845','485.944','779.191','21.12875','147.0405','31.554','10.59626','46.41935','101.7506','30.86975','423.355',undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',40326,'BLANK','','plot',41299,'CASS_6Genotypes_201','1','2','201',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'',undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef,undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41280,'TMEB693','','plot',41300,'CASS_6Genotypes_202','1','2','202',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','250.228','39.2627','478.0445','1295.29','21.56485','169.757','26.2744','5.31292','39.4774','61.51325','36.2316','241.418',undef],['2017',134,'test','test',165,'CASS_6Genotypes_Sampling_2015','Copy of trial with postcomposed phenotypes from cassbase.','RCBD',undef,undef,undef,undef,undef,undef,undef,'23','test_location',41282,'IITA-TMS-IBA980002','','plot',41301,'CASS_6Genotypes_203','1','2','203',undef,undef,'test',undef,undef,undef,undef,undef,undef,undef,undef,undef,'','245.679','29.4029','299.096','1013.111','17.04795','202.893','40.306','7.442495','75.2132','57.47695','20.43645','303.3225',undef]],'observationVariableDbIds' => [77559,77557,77556,77548,77553,77549,77552,77550,77551,77558,77554,77555,0],'headerRow' => ['studyYear','programDbId','programName','programDescription','studyDbId','studyName','studyDescription','studyDesign','plotWidth','plotLength','fieldSize','fieldTrialIsPlannedToBeGenotyped','fieldTrialIsPlannedToCross','plantingDate','harvestDate','locationDbId','locationName','germplasmDbId','germplasmName','germplasmSynonyms','observationLevel','observationUnitDbId','observationUnitName','replicate','blockNumber','plotNumber','rowNumber','colNumber','entryType','plantNumber','plantedSeedlotStockDbId','plantedSeedlotStockUniquename','plantedSeedlotCurrentCount','plantedSeedlotCurrentWeightGram','plantedSeedlotBoxName','plantedSeedlotTransactionCount','plantedSeedlotTransactionWeight','plantedSeedlotTransactionDescription','availableGermplasmSeedlotUniquenames']}}, 'study table');
253 $mech->get_ok('http://localhost:3010/brapi/v1/studies/165/layout?pageSize=2&page=1&access_token='.$access_token);
254 $response = decode_json $mech->content;
255 print STDERR Dumper $response;
256 is_deeply($response, {'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=1, pageSize=2','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Studies','messageType' => 'INFO'},{'message' => 'Studies layout result constructed','messageType' => 'INFO'}],'datafiles' => [],'pagination' => {'totalPages' => 10,'pageSize' => 2,'totalCount' => 19,'currentPage' => 1}},'result' => {'data' => [{'germplasmDbId' => 41279,'blockNumber' => '1','observationLevel' => 'plot','X' => '','observationUnitDbId' => 41296,'studyDbId' => '165','replicate' => '1','additionalInfo' => {'plantNames' => [],'plotNumber' => '105','designType' => 'RCBD','plotImageDbIds' => [],'plantDbIds' => [], 'seedLotDbId' => undef, 'seedLotName' => undef},'observationUnitName' => 'CASS_6Genotypes_105','entryType' => 'Test','germplasmName' => 'IITA-TMS-IBA30572','Y' => ''},{'X' => '','observationUnitDbId' => 41297,'studyDbId' => '165','blockNumber' => '1','germplasmDbId' => 41281,'observationLevel' => 'plot','Y' => '','germplasmName' => 'IITA-TMS-IBA011412','entryType' => 'Test','replicate' => '1','additionalInfo' => {'plotNumber' => '106','plantNames' => [],'plantDbIds' => [],'plotImageDbIds' => [],'designType' => 'RCBD','seedLotDbId' => undef, 'seedLotName' => undef },'observationUnitName' => 'CASS_6Genotypes_106'}]}}, 'study layout');
258 $mech->get_ok('http://localhost:3010/brapi/v1/studies/165/observations?pageSize=2&page=1&access_token='.$access_token);
259 $response = decode_json $mech->content;
260 print STDERR Dumper $response;
261 is_deeply($response, {'result' => {'data' => [{'value' => '655.92','uploadedBy' => 'johndoe','operator' => 'johndoe','observationDbId' => 740338,'germplasmName' => 'IITA-TMS-IBA980581','observationUnitName' => 'CASS_6Genotypes_103','studyDbId' => 165,'germplasmDbId' => 41283,'observationVariableName' => 'cass sink leaf|ADP|ug/g|week 16|COMP:0000010','observationVariableDbId' => 77556,'observationLevel' => 'plot','observationUnitDbId' => 41284,'season' => {},'observationTimestamp' => undef},{'studyDbId' => 165,'germplasmDbId' => 41283,'operator' => 'johndoe','uploadedBy' => 'johndoe','value' => '1259.08','observationDbId' => 740339,'germplasmName' => 'IITA-TMS-IBA980581','observationUnitName' => 'CASS_6Genotypes_103','season' => {},'observationTimestamp' => undef,'observationVariableName' => 'cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002','observationVariableDbId' => 77548,'observationLevel' => 'plot','observationUnitDbId' => 41284}]},'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=1, pageSize=2','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::Studies'},{'messageType' => 'INFO','message' => 'Studies observations granular result constructed'}],'datafiles' => [],'pagination' => {'totalPages' => 99,'currentPage' => 1,'pageSize' => 2,'totalCount' => 198}}}, 'study observations');
263 $mech->get_ok('http://localhost:3010/brapi/v1/phenotypes-search?pageSize=2&access_token='.$access_token);
264 $response = decode_json $mech->content;
265 print STDERR Dumper $response;
266 is_deeply($response, {'metadata' => {'pagination' => {'pageSize' => 2,'currentPage' => 0,'totalPages' => 977,'totalCount' => 1954},'datafiles' => [],'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=2','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::ObservationUnits'},{'messageType' => 'INFO','message' => 'Phenotype search result constructed'}]},'result' => {'data' => [{'germplasmDbId' => '41283','treatments' => [{'factor' => 'No ManagementFactor','modality' => ''}],'replicate' => '1','pedigree' => undef,'germplasmName' => 'IITA-TMS-IBA980581','programName' => 'test','observationUnitXref' => [],'studyLocationDbId' => '23','blockNumber' => '1','studyName' => 'CASS_6Genotypes_Sampling_2015','observationLevels' => 'plot','observationUnitDbId' => '41284','plotNumber' => '103','observationLevel' => 'plot','Y' => undef,'plantNumber' => undef,'X' => undef,'studyDbId' => '165','studyLocation' => 'test_location','entryType' => 'test','observationUnitName' => 'CASS_6Genotypes_103','observations' => [{'observationVariableName' => 'cass sink leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000013','collector' => 'johndoe','value' => '601.518','observationVariableDbId' => '77559','observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740336'},{'observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740337','observationVariableDbId' => '77557','value' => '39.84365','collector' => 'johndoe','observationVariableName' => 'cass sink leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000011'},{'value' => '655.92','observationVariableDbId' => '77556','observationDbId' => '740338','observationTimeStamp' => undef,'season' => '2017','collector' => 'johndoe','observationVariableName' => 'cass sink leaf|ADP|ug/g|week 16|COMP:0000010'},{'season' => '2017','observationTimeStamp' => undef,'observationDbId' => '740339','observationVariableDbId' => '77548','value' => '1259.08','collector' => 'johndoe','observationVariableName' => 'cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002'},{'collector' => 'johndoe','observationVariableName' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007','observationDbId' => '740340','season' => '2017','observationTimeStamp' => undef,'observationVariableDbId' => '77553','value' => '17.38275'},{'observationVariableName' => 'cass source leaf|ADP|ug/g|week 16|COMP:0000003','collector' => 'johndoe','value' => '192.1495','observationVariableDbId' => '77549','observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740341'},{'collector' => 'johndoe','observationVariableName' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006','season' => '2017','observationTimeStamp' => undef,'observationDbId' => '740342','value' => '67.9959','observationVariableDbId' => '77552'},{'observationVariableName' => 'cass storage root|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000004','collector' => 'johndoe','observationVariableDbId' => '77550','value' => '20.3038','observationDbId' => '740343','season' => '2017','observationTimeStamp' => undef},{'observationDbId' => '740344','season' => '2017','observationTimeStamp' => undef,'observationVariableDbId' => '77551','value' => '102.0875','observationVariableName' => 'cass storage root|ADP|ug/g|week 16|COMP:0000005','collector' => 'johndoe'},{'collector' => 'johndoe','observationVariableName' => 'cass upper stem|3-phosphoglyceric acid|ug/g|week 16|COMP:0000012','value' => '108.56995','observationVariableDbId' => '77558','observationDbId' => '740345','observationTimeStamp' => undef,'season' => '2017'},{'observationVariableDbId' => '77554','value' => '28.83915','observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740346','observationVariableName' => 'cass upper stem|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000008','collector' => 'johndoe'},{'collector' => 'johndoe','observationVariableName' => 'cass upper stem|ADP|ug/g|week 16|COMP:0000009','observationDbId' => '740347','season' => '2017','observationTimeStamp' => undef,'observationVariableDbId' => '77555','value' => '379.16'}],'entryNumber' => ''}]}}, 'phenotype search');
268 $mech->post_ok('http://localhost:3010/brapi/v1/search/observationunits?access_token='.$access_token, ['pageSize'=>'2']);
269 $response = decode_json $mech->content;
270 $searchId = $response->{result} ->{searchResultsDbId};
271 print STDERR Dumper $response;
272 $mech->get_ok('http://localhost:3010/brapi/v1/search/observationunits/'. $searchId . '?access_token='.$access_token );
273 $response = decode_json $mech->content;
274 print STDERR Dumper $response;
275 is_deeply($response, {'metadata' => {'pagination' => {'pageSize' => 2,'currentPage' => 0,'totalPages' => 977,'totalCount' => 1954},'datafiles' => [],'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=2','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::ObservationUnits'},{'messageType' => 'INFO','message' => 'Phenotype search result constructed'}]},'result' => {'data' => [{'germplasmDbId' => '41283','treatments' => [{'factor' => 'No ManagementFactor','modality' => ''}],'replicate' => '1','pedigree' => undef,'germplasmName' => 'IITA-TMS-IBA980581','programName' => 'test','observationUnitXref' => [],'studyLocationDbId' => '23','blockNumber' => '1','studyName' => 'CASS_6Genotypes_Sampling_2015','observationLevels' => 'plot','observationUnitDbId' => '41284','plotNumber' => '103','observationLevel' => 'plot','Y' => undef,'plantNumber' => undef,'X' => undef,'studyDbId' => '165','studyLocation' => 'test_location','entryType' => 'test','observationUnitName' => 'CASS_6Genotypes_103','observations' => [{'observationVariableName' => 'cass sink leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000013','collector' => 'johndoe','value' => '601.518','observationVariableDbId' => '77559','observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740336'},{'observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740337','observationVariableDbId' => '77557','value' => '39.84365','collector' => 'johndoe','observationVariableName' => 'cass sink leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000011'},{'value' => '655.92','observationVariableDbId' => '77556','observationDbId' => '740338','observationTimeStamp' => undef,'season' => '2017','collector' => 'johndoe','observationVariableName' => 'cass sink leaf|ADP|ug/g|week 16|COMP:0000010'},{'season' => '2017','observationTimeStamp' => undef,'observationDbId' => '740339','observationVariableDbId' => '77548','value' => '1259.08','collector' => 'johndoe','observationVariableName' => 'cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002'},{'collector' => 'johndoe','observationVariableName' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007','observationDbId' => '740340','season' => '2017','observationTimeStamp' => undef,'observationVariableDbId' => '77553','value' => '17.38275'},{'observationVariableName' => 'cass source leaf|ADP|ug/g|week 16|COMP:0000003','collector' => 'johndoe','value' => '192.1495','observationVariableDbId' => '77549','observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740341'},{'collector' => 'johndoe','observationVariableName' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006','season' => '2017','observationTimeStamp' => undef,'observationDbId' => '740342','value' => '67.9959','observationVariableDbId' => '77552'},{'observationVariableName' => 'cass storage root|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000004','collector' => 'johndoe','observationVariableDbId' => '77550','value' => '20.3038','observationDbId' => '740343','season' => '2017','observationTimeStamp' => undef},{'observationDbId' => '740344','season' => '2017','observationTimeStamp' => undef,'observationVariableDbId' => '77551','value' => '102.0875','observationVariableName' => 'cass storage root|ADP|ug/g|week 16|COMP:0000005','collector' => 'johndoe'},{'collector' => 'johndoe','observationVariableName' => 'cass upper stem|3-phosphoglyceric acid|ug/g|week 16|COMP:0000012','value' => '108.56995','observationVariableDbId' => '77558','observationDbId' => '740345','observationTimeStamp' => undef,'season' => '2017'},{'observationVariableDbId' => '77554','value' => '28.83915','observationTimeStamp' => undef,'season' => '2017','observationDbId' => '740346','observationVariableName' => 'cass upper stem|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000008','collector' => 'johndoe'},{'collector' => 'johndoe','observationVariableName' => 'cass upper stem|ADP|ug/g|week 16|COMP:0000009','observationDbId' => '740347','season' => '2017','observationTimeStamp' => undef,'observationVariableDbId' => '77555','value' => '379.16'}],'entryNumber' => ''}]}}, 'phenotype search');
277 $mech->get_ok('http://localhost:3010/brapi/v1/phenotypes-search?pageSize=2&studyDbId=165&observationVariableDbId=77551&access_token='.$access_token);
278 $response = decode_json $mech->content;
279 print STDERR Dumper $response;
280 is_deeply($response, {'result' => {'data' => [{'germplasmName' => 'IITA-TMS-IBA980581','X' => undef,'plantNumber' => undef,'observationLevel' => 'plot','observationLevels' => 'plot','plotNumber' => '103','pedigree' => undef,'programName' => 'test','studyLocation' => 'test_location','Y' => undef,'entryType' => 'test','studyLocationDbId' => '23','studyDbId' => '165','replicate' => '1','observationUnitXref' => [],'observationUnitDbId' => '41284','treatments' => [{'factor' => 'No ManagementFactor','modality' => ''}],'studyName' => 'CASS_6Genotypes_Sampling_2015','observations' => [{'season' => '2017','observationVariableName' => 'cass sink leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000013','observationDbId' => '740336','value' => '601.518','observationTimeStamp' => undef,'observationVariableDbId' => '77559','collector' => 'johndoe'},{'observationTimeStamp' => undef,'value' => '39.84365','observationDbId' => '740337','season' => '2017','observationVariableName' => 'cass sink leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000011','collector' => 'johndoe','observationVariableDbId' => '77557'},{'observationVariableDbId' => '77556','collector' => 'johndoe','value' => '655.92','observationTimeStamp' => undef,'observationVariableName' => 'cass sink leaf|ADP|ug/g|week 16|COMP:0000010','season' => '2017','observationDbId' => '740338'},{'observationDbId' => '740339','season' => '2017','observationVariableName' => 'cass source leaf|3-phosphoglyceric acid|ug/g|week 16|COMP:0000002','observationTimeStamp' => undef,'value' => '1259.08','collector' => 'johndoe','observationVariableDbId' => '77548'},{'observationVariableDbId' => '77553','collector' => 'johndoe','observationVariableName' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007','season' => '2017','observationDbId' => '740340','value' => '17.38275','observationTimeStamp' => undef},{'observationVariableName' => 'cass source leaf|ADP|ug/g|week 16|COMP:0000003','season' => '2017','observationDbId' => '740341','value' => '192.1495','observationTimeStamp' => undef,'observationVariableDbId' => '77549','collector' => 'johndoe'},{'observationVariableDbId' => '77552','collector' => 'johndoe','season' => '2017','observationVariableName' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006','observationDbId' => '740342','value' => '67.9959','observationTimeStamp' => undef},{'value' => '20.3038','observationTimeStamp' => undef,'observationVariableName' => 'cass storage root|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000004','season' => '2017','observationDbId' => '740343','observationVariableDbId' => '77550','collector' => 'johndoe'},{'observationVariableName' => 'cass storage root|ADP|ug/g|week 16|COMP:0000005','season' => '2017','observationDbId' => '740344','value' => '102.0875','observationTimeStamp' => undef,'observationVariableDbId' => '77551','collector' => 'johndoe'},{'observationVariableDbId' => '77558','collector' => 'johndoe','season' => '2017','observationVariableName' => 'cass upper stem|3-phosphoglyceric acid|ug/g|week 16|COMP:0000012','observationDbId' => '740345','value' => '108.56995','observationTimeStamp' => undef},{'value' => '28.83915','observationTimeStamp' => undef,'season' => '2017','observationVariableName' => 'cass upper stem|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000008','observationDbId' => '740346','observationVariableDbId' => '77554','collector' => 'johndoe'},{'value' => '379.16','observationTimeStamp' => undef,'observationVariableName' => 'cass upper stem|ADP|ug/g|week 16|COMP:0000009','season' => '2017','observationDbId' => '740347','observationVariableDbId' => '77555','collector' => 'johndoe'}],'germplasmDbId' => '41283','blockNumber' => '1','entryNumber' => '','observationUnitName' => 'CASS_6Genotypes_103'}]},'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=2','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::ObservationUnits'},{'messageType' => 'INFO','message' => 'Phenotype search result constructed'}],'pagination' => {'totalPages' => 10,'pageSize' => 2,'currentPage' => 0,'totalCount' => 19},'datafiles' => []}}, 'phenotype search study 165');
282 $mech->get_ok('http://localhost:3010/brapi/v1/traits?pageSize=1&page=1&access_token='.$access_token );
283 $response = decode_json $mech->content;
284 print STDERR Dumper $response;
285 is_deeply($response, {'metadata' => {'datafiles' => [],'pagination' => {'totalPages' => 257,'currentPage' => 1,'totalCount' => 257,'pageSize' => 1},'status' => [{'message' => 'BrAPI base call found with page=1, pageSize=1','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Traits','messageType' => 'INFO'},{'message' => 'Traits list result constructed','messageType' => 'INFO'}]},'result' => {'data' => [{'description' => 'Estimation of amylopectin content of cassava roots in percentage(%).','traitDbId' => '70761','traitId' => 'CO_334:0000121','defaultValue' => '','traitName' => 'amylopectin content ug/g in percentage','observationVariables' => ['amylopectin content ug/g in percentage|CO_334:0000121'],'name' => 'amylopectin content ug/g in percentage'}]}}, 'traits');
287 # $mech->get_ok('http://localhost:3010/brapi/v1/maps?pageSize=1&page=1&access_token='.$access_token );
288 # $response = decode_json $mech->content;
289 # print STDERR Dumper $response;
290 # is_deeply($response, {'metadata' => {'datafiles' => [],'pagination' => {'totalCount' => 1,'currentPage' => 1,'pageSize' => 1,'totalPages' => 1},'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=1, pageSize=1'},{'message' => 'Loading CXGN::BrAPI::v1::GenomeMaps','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Maps list result constructed'}]},'result' => {'data' => [{'markerCount' => '0','species' => 'Solanum lycopersicum','name' => 'Tomato Pachytene Chromosomes','unit' => 'cM','type' => 'Genetic','linkageGroupCount' => 12,'comments' => 'This map shows the pachytene chromosomes of tomato. It is only for illustrative purposes and does not contain any markers. <br /><br />Images courtesy of Prof. Stephen Stack, Colorado State University.','mapDbId' => 'pachy'}]}}, 'maps');
292 $mech->get_ok('http://localhost:3010/brapi/v1/locations?pageSize=1&page=1&access_token='.$access_token );
293 $response = decode_json $mech->content;
294 print STDERR Dumper $response;
296 foreach my $d (@{$response->{result}->{data}}) {
298         $d->{longitude} = round($d->{longitude});
299         $d->{latitude} = round($d->{latitude});
302 is_deeply($response, {'metadata' => {'pagination' => {'totalCount' => 4,'totalPages' => 4,'pageSize' => 1,'currentPage' => 1},'datafiles' => [],'status' => [{'messageType' => 'INFO','message' => 'BrAPI base call found with page=1, pageSize=1'},{'message' => 'Loading CXGN::BrAPI::v1::Locations','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Locations list result constructed'}]},'result' => {'data' => [{'documentationURL' => undef,'locationDbId' => '24','locationType' => '','countryCode' => 'USA','countryName' => 'United States','longitude' => '-76','abbreviation' => '','locationName' => 'Cornell Biotech','altitude' => '274','name' => 'Cornell Biotech','instituteName' => '','instituteAddress' => '','latitude' => '42','additionalInfo' => {'geodetic datum' => undef,'breeding_program' => '134'}}]}}, 'location');
304 # $mech->get_ok('http://localhost:3010/brapi/v1/ontologies?access_token='.$access_token );
305 # $response = decode_json $mech->content;
306 # print STDERR Dumper $response;
307 # is_deeply($response, {"metadata"=>{"datafiles"=>[],"status"=>[{"message"=>"BrAPI base call found with page=0, pageSize=10","messageType"=>"INFO"},{"messageType"=>"INFO","message"=>"Loading CXGN::BrAPI::v1::ObservationVariables"},{"message"=>"Ontologies result constructed","messageType"=>"INFO"}],"pagination"=>{"totalPages"=>1,"totalCount"=>2,"pageSize"=>10,"currentPage"=>0}},"result"=>{"data"=>[{"description"=>"CGIAR cassava trait ontology","copyright"=>"","ontologyName"=>"CO_334","version"=>"","authors"=>"","ontologyDbId"=>"186","ontologyDbxrefAccession"=>"0000000","licence"=>""},{"copyright"=>"","description"=>"fieldbook_image","ontologyName"=>"CO_334","authors"=>"","version"=>"","ontologyDbxrefAccession"=>"0010472","licence"=>"","ontologyDbId"=>"186"}]}}, 'ontologies');
309 $mech->get_ok('http://localhost:3010/brapi/v1/variables?access_token='.$access_token );
310 $response = decode_json $mech->content;
311 print STDERR Dumper $response;
312 is_deeply($response, {'metadata' => {'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::ObservationVariables','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Observationvariable search result constructed'}],'pagination' => {'totalPages' => 26,'pageSize' => 10,'totalCount' => 257,'currentPage' => 0},'datafiles' => []},'result' => {'data' => [{'language' => '','submissionTimestamp' => undef,'contextOfUse' => [],'documentationURL' => '','trait' => {'traitDbId' => 'CO_334:0000047','entity' => '','xref' => 'CO_334:0000047','mainAbbreviations' => '','name' => 'abscisic acid content of leaf ug/g','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'attribute' => 'abscisic acid content of leaf ug/g','class' => '','alternativeAbbreviations' => [],'traitName' => 'abscisic acid content of leaf ug/g','status' => '','description' => 'Abscisic acid content of leaf sample.','synonyms' => ['abscon','AbsCt_Meas_ugg']},'ontologyName' => 'CO_334','defaultValue' => '','synonyms' => ['abscon','AbsCt_Meas_ugg'],'status' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),'institution' => 'http://localhost:3010','scale' => {'ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'URL' => '','type' => ''}},'scaleDbId' => '','name' => '','xref' => '','validValues' => {'max' => undef,'min' => undef,'categories' => []},'decimalPlaces' => undef,'scaleName' => '','dataType' => 'Numerical'},'ontologyDbId' => '186','method' => {'formula' => '','description' => '','reference' => '','methodDbId' => '','name' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'methodName' => '','class' => ''},'scientist' => '','observationVariableName' => 'abscisic acid content of leaf ug/g','xref' => 'CO_334:0000047','crop' => 'Cassava','growthStage' => '','observationVariableDbId' => 70692,'ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','version' => '','documentationURL' => {'URL' => '','type' => ''}},'name' => 'abscisic acid content of leaf ug/g|CO_334:0000047'},{'name' => 'amylopectin content ug/g in percentage|CO_334:0000121','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'URL' => '','type' => ''}},'observationVariableDbId' => 70761,'growthStage' => '','crop' => 'Cassava','xref' => 'CO_334:0000121','observationVariableName' => 'amylopectin content ug/g in percentage','scientist' => '','method' => {'reference' => '','methodDbId' => '','name' => '','ontologyReference' => {'version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyDbId' => '186','ontologyName' => 'CO_334'},'formula' => '','methodName' => '','description' => '','class' => ''},'ontologyDbId' => '186','scale' => {'dataType' => 'Numerical','scaleName' => '','decimalPlaces' => undef,'xref' => '','validValues' => {'max' => undef,'min' => undef,'categories' => []},'scaleDbId' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','version' => '','documentationURL' => {'URL' => '','type' => ''}},'name' => ''},'institution' => 'http://localhost:3010','status' => JSON::true,'defaultValue' => '','synonyms' => ['amylp','AmylPCt_Meas_pct'],'ontologyName' => 'CO_334','trait' => {'description' => 'Estimation of amylopectin content of cassava roots in percentage(%).','synonyms' => ['amylp','AmylPCt_Meas_pct'],'status' => '','traitName' => 'amylopectin content ug/g in percentage','alternativeAbbreviations' => [],'class' => '','attribute' => 'amylopectin content ug/g in percentage','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'type' => '','URL' => ''},'version' => ''},'name' => 'amylopectin content ug/g in percentage','mainAbbreviations' => '','xref' => 'CO_334:0000121','entity' => '','traitDbId' => 'CO_334:0000121'},'documentationURL' => '','contextOfUse' => [],'submissionTimestamp' => undef,'language' => ''},{'ontologyName' => 'CO_334','trait' => {'traitName' => 'amylose amylopectin root content ratio','status' => '','synonyms' => ['amylrt','AmylR_Comp_r'],'description' => 'The amylose content of a cassava root sample divided by the amylopectin content of the same sample.','alternativeAbbreviations' => [],'attribute' => 'amylose amylopectin root content ratio','class' => '','mainAbbreviations' => '','name' => 'amylose amylopectin root content ratio','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'xref' => 'CO_334:0000124','traitDbId' => 'CO_334:0000124','entity' => ''},'submissionTimestamp' => undef,'contextOfUse' => [],'language' => '','documentationURL' => '','institution' => 'http://localhost:3010','scale' => {'decimalPlaces' => undef,'dataType' => 'Numerical','scaleName' => '','name' => '','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'scaleDbId' => '','validValues' => {'max' => undef,'min' => undef,'categories' => []},'xref' => ''},'ontologyDbId' => '186','status' => JSON::true,'defaultValue' => '','synonyms' => ['amylrt','AmylR_Comp_r'],'method' => {'methodDbId' => '','reference' => '','ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'name' => '','formula' => '','class' => '','description' => '','methodName' => ''},'observationVariableName' => 'amylose amylopectin root content ratio','scientist' => '','observationVariableDbId' => 70752,'name' => 'amylose amylopectin root content ratio|CO_334:0000124','ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'xref' => 'CO_334:0000124','growthStage' => '','crop' => 'Cassava'},{'status' => JSON::true,'synonyms' => ['amyl','AmylCt_Meas_pct'],'defaultValue' => '','institution' => 'http://localhost:3010','ontologyDbId' => '186','scale' => {'decimalPlaces' => undef,'scaleDbId' => '','ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'name' => '','xref' => '','dataType' => 'Numerical','validValues' => {'categories' => [],'min' => undef,'max' => undef},'scaleName' => ''},'contextOfUse' => [],'submissionTimestamp' => undef,'language' => '','documentationURL' => '','ontologyName' => 'CO_334','trait' => {'alternativeAbbreviations' => [],'attribute' => 'amylose content in ug/g percentage','class' => '','traitName' => 'amylose content in ug/g percentage','status' => '','description' => 'Estimation of amylose content of cassava roots in percentage (%).','synonyms' => ['amyl','AmylCt_Meas_pct'],'traitDbId' => 'CO_334:0000075','entity' => '','mainAbbreviations' => '','name' => 'amylose content in ug/g percentage','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'type' => '','URL' => ''},'version' => ''},'xref' => 'CO_334:0000075'},'xref' => 'CO_334:0000075','growthStage' => '','crop' => 'Cassava','observationVariableDbId' => 70676,'name' => 'amylose content in ug/g percentage|CO_334:0000075','ontologyReference' => {'version' => '','documentationURL' => {'type' => '','URL' => ''},'ontologyDbId' => '186','ontologyName' => 'CO_334'},'method' => {'class' => '','methodName' => '','description' => '','formula' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','version' => '','documentationURL' => {'type' => '','URL' => ''}},'name' => '','methodDbId' => '','reference' => ''},'observationVariableName' => 'amylose content in ug/g percentage','scientist' => ''},{'synonyms' => ['anther','AnthCol_VisClsn_1to5'],'defaultValue' => '','status' => JSON::true,'ontologyDbId' => '186','scale' => {'decimalPlaces' => undef,'scaleName' => '','dataType' => 'Numerical','name' => '','scaleDbId' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','version' => '','documentationURL' => {'URL' => '','type' => ''}},'validValues' => {'max' => undef,'min' => undef,'categories' => []},'xref' => ''},'institution' => 'http://localhost:3010','documentationURL' => '','language' => '','submissionTimestamp' => undef,'contextOfUse' => [],'trait' => {'attribute' => 'anther color','class' => '','alternativeAbbreviations' => [],'traitName' => 'anther color','status' => '','synonyms' => ['anther','AnthCol_VisClsn_1to5'],'description' => 'Visual scoring of anther color with 1 = cream, 2 = yellow, and 3 = other.','traitDbId' => 'CO_334:0000061','entity' => '','xref' => 'CO_334:0000061','mainAbbreviations' => '','name' => 'anther color','ontologyReference' => {'version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyName' => 'CO_334','ontologyDbId' => '186'}},'ontologyName' => 'CO_334','crop' => 'Cassava','growthStage' => '','xref' => 'CO_334:0000061','ontologyReference' => {'version' => '','documentationURL' => {'type' => '','URL' => ''},'ontologyName' => 'CO_334','ontologyDbId' => '186'},'name' => 'anther color|CO_334:0000061','observationVariableDbId' => 70717,'scientist' => '','observationVariableName' => 'anther color','method' => {'formula' => '','methodName' => '','class' => '','description' => '','reference' => '','methodDbId' => '','name' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'}}},{'trait' => {'entity' => '','traitDbId' => 'CO_334:0000103','xref' => 'CO_334:0000103','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'URL' => '','type' => ''}},'name' => 'anthocyanin pigmentation visual rating 0-3','mainAbbreviations' => '','class' => '','attribute' => 'anthocyanin pigmentation visual rating 0-3','alternativeAbbreviations' => [],'synonyms' => ['anthop','ACyanPig_VisScg_0to3'],'description' => 'Visual rating of distribution of anthocyanin pigmentation with 0 = absent, 1 = top part, 2 = central part, 3 = totally pigmented.','status' => '','traitName' => 'anthocyanin pigmentation visual rating 0-3'},'ontologyName' => 'CO_334','language' => '','submissionTimestamp' => undef,'contextOfUse' => [],'documentationURL' => '','institution' => 'http://localhost:3010','ontologyDbId' => '186','scale' => {'validValues' => {'categories' => [],'min' => undef,'max' => undef},'xref' => '','name' => '','scaleDbId' => '','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'scaleName' => '','dataType' => 'Numerical','decimalPlaces' => undef},'defaultValue' => '','synonyms' => ['anthop','ACyanPig_VisScg_0to3'],'status' => JSON::true,'method' => {'methodName' => '','class' => '','description' => '','formula' => '','name' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'type' => '','URL' => ''},'version' => ''},'reference' => '','methodDbId' => ''},'scientist' => '','observationVariableName' => 'anthocyanin pigmentation visual rating 0-3','observationVariableDbId' => 70775,'ontologyReference' => {'version' => '','documentationURL' => {'type' => '','URL' => ''},'ontologyName' => 'CO_334','ontologyDbId' => '186'},'name' => 'anthocyanin pigmentation visual rating 0-3|CO_334:0000103','xref' => 'CO_334:0000103','crop' => 'Cassava','growthStage' => ''},{'observationVariableDbId' => 70693,'ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'name' => 'apical branching|CO_334:0000086','xref' => 'CO_334:0000086','crop' => 'Cassava','growthStage' => '','method' => {'methodName' => '','class' => '','reference' => '','methodDbId' => '','name' => '','ontologyReference' => {'version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyName' => 'CO_334','ontologyDbId' => '186'},'formula' => '','description' => ''},'scientist' => '','observationVariableName' => 'apical branching','institution' => 'http://localhost:3010','ontologyDbId' => '186','scale' => {'decimalPlaces' => undef,'ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'scaleDbId' => '','name' => '','xref' => '','dataType' => 'Numerical','validValues' => {'categories' => [],'min' => undef,'max' => undef},'scaleName' => ''},'synonyms' => ['brntim','FstBrnchTim_Count_wk'],'defaultValue' => '','status' => JSON::true,'trait' => {'traitName' => 'apical branching','synonyms' => ['brntim','FstBrnchTim_Count_wk'],'description' => 'Number of weeks from planting to first apical branching associated with the formation of inflorescence.','status' => '','alternativeAbbreviations' => [],'attribute' => 'apical branching','class' => '','mainAbbreviations' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'name' => 'apical branching','xref' => 'CO_334:0000086','traitDbId' => 'CO_334:0000086','entity' => ''},'ontologyName' => 'CO_334','language' => '','submissionTimestamp' => undef,'contextOfUse' => [],'documentationURL' => ''},{'ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'type' => '','URL' => ''},'version' => ''},'name' => 'apical pubescence|CO_334:0000026','observationVariableDbId' => 70743,'crop' => 'Cassava','growthStage' => '','xref' => 'CO_334:0000026','scientist' => '','observationVariableName' => 'apical pubescence','method' => {'reference' => '','methodDbId' => '','name' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'formula' => '','methodName' => '','description' => '','class' => ''},'ontologyDbId' => '186','scale' => {'scaleName' => '','dataType' => 'Numerical','decimalPlaces' => undef,'validValues' => {'min' => undef,'categories' => [],'max' => undef},'xref' => '','name' => '','scaleDbId' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'URL' => '','type' => ''},'version' => ''}},'institution' => 'http://localhost:3010','defaultValue' => '','synonyms' => ['apubes','LfPub_VisClsn_0to7'],'status' => JSON::true,'trait' => {'alternativeAbbreviations' => [],'class' => '','attribute' => 'apical pubescence','status' => '','synonyms' => ['apubes','LfPub_VisClsn_0to7'],'description' => 'Visual rating of young leaf pubescence with 0 = absent or glabrous, 3 = little pubescence, 5 = moderate pubescence, and 7 = high pubescence.','traitName' => 'apical pubescence','entity' => '','traitDbId' => 'CO_334:0000026','name' => 'apical pubescence','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'mainAbbreviations' => '','xref' => 'CO_334:0000026'},'ontologyName' => 'CO_334','documentationURL' => '','language' => '','submissionTimestamp' => undef,'contextOfUse' => []},{'status' => JSON::true,'defaultValue' => '','synonyms' => ['AscACt_Meas_pct'],'scale' => {'decimalPlaces' => undef,'scaleName' => '','dataType' => 'Numerical','scaleDbId' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'name' => '','xref' => '','validValues' => {'min' => undef,'categories' => [],'max' => undef}},'ontologyDbId' => '186','institution' => 'http://localhost:3010','documentationURL' => '','submissionTimestamp' => undef,'contextOfUse' => [],'language' => '','ontologyName' => 'CO_334','trait' => {'ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','version' => '','documentationURL' => {'URL' => '','type' => ''}},'name' => 'ascorbic acid in root percentage','mainAbbreviations' => '','xref' => 'CO_334:0000065','entity' => '','traitDbId' => 'CO_334:0000065','description' => 'Antioxidant and water soluble vitamin of cassava storage root.','synonyms' => ['AscACt_Meas_pct'],'status' => '','traitName' => 'ascorbic acid in root percentage','alternativeAbbreviations' => [],'class' => '','attribute' => 'ascorbic acid in root percentage'},'growthStage' => '','crop' => 'Cassava','xref' => 'CO_334:0000065','name' => 'ascorbic acid in root percentage|CO_334:0000065','ontologyReference' => {'version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyName' => 'CO_334','ontologyDbId' => '186'},'observationVariableDbId' => 70739,'observationVariableName' => 'ascorbic acid in root percentage','scientist' => '','method' => {'methodName' => '','class' => '','formula' => '','description' => '','reference' => '','methodDbId' => '','name' => '','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','documentationURL' => {'type' => '','URL' => ''},'version' => ''}}},{'method' => {'methodDbId' => '','reference' => '','ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'name' => '','formula' => '','class' => '','description' => '','methodName' => ''},'observationVariableName' => 'ash content in percentage','scientist' => '','observationVariableDbId' => 70663,'name' => 'ash content in percentage|CO_334:0000066','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyDbId' => '186','ontologyName' => 'CO_334'},'xref' => 'CO_334:0000066','growthStage' => '','crop' => 'Cassava','ontologyName' => 'CO_334','trait' => {'xref' => 'CO_334:0000066','name' => 'ash content in percentage','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'mainAbbreviations' => '','entity' => '','traitDbId' => 'CO_334:0000066','status' => '','description' => 'Residue left behind after all organic matter has been burnt off, a measure of total mineral salts in a food estimated in percentage (%).','synonyms' => ['ash','MinCt_Burng_pct'],'traitName' => 'ash content in percentage','class' => '','attribute' => 'ash content in percentage','alternativeAbbreviations' => []},'contextOfUse' => [],'submissionTimestamp' => undef,'language' => '','documentationURL' => '','institution' => 'http://localhost:3010','scale' => {'validValues' => {'max' => undef,'categories' => [],'min' => undef},'xref' => '','name' => '','scaleDbId' => '','ontologyReference' => {'ontologyName' => 'CO_334','ontologyDbId' => '186','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'dataType' => 'Numerical','scaleName' => '','decimalPlaces' => undef},'ontologyDbId' => '186','status' => JSON::true,'defaultValue' => '','synonyms' => ['ash','MinCt_Burng_pct']}]}} , 'variables');
314 $mech->get_ok('http://localhost:3010/brapi/v1/variables-search?page=24&pageSize=3&access_token='.$access_token );
315 $response = decode_json $mech->content;
316 print STDERR Dumper $response;
317 is_deeply($response,{'result' => {'data' => [{'scientist' => '','trait' => {'class' => '','alternativeAbbreviations' => [],'ontologyReference' => {'version' => '','documentationURL' => {'type' => '','URL' => ''},'ontologyName' => 'COMP','ontologyDbId' => '305'},'name' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16','xref' => 'COMP:0000007','synonyms' => ['cass source leaf_ADP alpha-D-glucoside_ug/g_Wk16'],'attribute' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16','traitName' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16','traitDbId' => 'COMP:0000007','description' => undef,'entity' => '','mainAbbreviations' => '','status' => ''},'contextOfUse' => [],'growthStage' => '','submissionTimestamp' => undef,'status' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),'ontologyName' => 'COMP','crop' => 'Cassava','scale' => {'decimalPlaces' => undef,'xref' => '','dataType' => 'Numerical','scaleDbId' => '','ontologyReference' => {'ontologyDbId' => '305','ontologyName' => 'COMP','documentationURL' => {'type' => '','URL' => ''},'version' => ''},'scaleName' => '','validValues' => {'categories' => [],'min' => undef,'max' => undef},'name' => ''},'ontologyDbId' => '305','name' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16|COMP:0000007','defaultValue' => '','language' => '','ontologyReference' => {'ontologyDbId' => '305','ontologyName' => 'COMP','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'institution' => 'http://localhost:3010','method' => {'methodName' => '','methodDbId' => '','formula' => '','class' => '','ontologyReference' => {'version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyName' => 'COMP','ontologyDbId' => '305'},'reference' => '','name' => '','description' => ''},'observationVariableDbId' => 77553,'documentationURL' => '','synonyms' => ['cass source leaf_ADP alpha-D-glucoside_ug/g_Wk16'],'xref' => 'COMP:0000007','observationVariableName' => 'cass source leaf|ADP alpha-D-glucoside|ug/g|week 16'},{'ontologyName' => 'COMP','growthStage' => '','submissionTimestamp' => undef,'status' => JSON::true,'trait' => {'class' => '','alternativeAbbreviations' => [],'ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'COMP','ontologyDbId' => '305'},'name' => 'cass source leaf|ADP|ug/g|week 16','xref' => 'COMP:0000003','synonyms' => ['cass source leaf_ADP_ug/g_Wk16'],'attribute' => 'cass source leaf|ADP|ug/g|week 16','traitName' => 'cass source leaf|ADP|ug/g|week 16','traitDbId' => 'COMP:0000003','entity' => '','description' => undef,'mainAbbreviations' => '','status' => ''},'contextOfUse' => [],'scientist' => '','synonyms' => ['cass source leaf_ADP_ug/g_Wk16'],'documentationURL' => '','xref' => 'COMP:0000003','observationVariableName' => 'cass source leaf|ADP|ug/g|week 16','observationVariableDbId' => 77549,'defaultValue' => '','ontologyReference' => {'ontologyName' => 'COMP','version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyDbId' => '305'},'language' => '','institution' => 'http://localhost:3010','method' => {'class' => '','ontologyReference' => {'ontologyDbId' => '305','ontologyName' => 'COMP','version' => '','documentationURL' => {'URL' => '','type' => ''}},'reference' => '','name' => '','description' => '','methodName' => '','methodDbId' => '','formula' => ''},'crop' => 'Cassava','scale' => {'dataType' => 'Numerical','scaleDbId' => '','ontologyReference' => {'ontologyName' => 'COMP','version' => '','documentationURL' => {'URL' => '','type' => ''},'ontologyDbId' => '305'},'scaleName' => '','validValues' => {'max' => undef,'categories' => [],'min' => undef},'name' => '','decimalPlaces' => undef,'xref' => ''},'ontologyDbId' => '305','name' => 'cass source leaf|ADP|ug/g|week 16|COMP:0000003'},{'synonyms' => ['cass storage root_3-phosphoglyceric acid_ug/g_Wk16'],'documentationURL' => '','xref' => 'COMP:0000006','observationVariableName' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16','observationVariableDbId' => 77552,'defaultValue' => '','ontologyReference' => {'ontologyDbId' => '305','version' => '','documentationURL' => {'type' => '','URL' => ''},'ontologyName' => 'COMP'},'institution' => 'http://localhost:3010','language' => '','method' => {'methodName' => '','methodDbId' => '','formula' => '','class' => '','ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'COMP','ontologyDbId' => '305'},'reference' => '','name' => '','description' => ''},'crop' => 'Cassava','scale' => {'scaleName' => '','validValues' => {'min' => undef,'categories' => [],'max' => undef},'name' => '','scaleDbId' => '','dataType' => 'Numerical','ontologyReference' => {'ontologyDbId' => '305','ontologyName' => 'COMP','documentationURL' => {'URL' => '','type' => ''},'version' => ''},'xref' => '','decimalPlaces' => undef},'ontologyDbId' => '305','name' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16|COMP:0000006','ontologyName' => 'COMP','growthStage' => '','submissionTimestamp' => undef,'status' => JSON::true,'trait' => {'status' => '','mainAbbreviations' => '','entity' => '','description' => undef,'traitDbId' => 'COMP:0000006','traitName' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16','attribute' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16','synonyms' => ['cass storage root_3-phosphoglyceric acid_ug/g_Wk16'],'xref' => 'COMP:0000006','name' => 'cass storage root|3-phosphoglyceric acid|ug/g|week 16','ontologyReference' => {'ontologyDbId' => '305','version' => '','documentationURL' => {'type' => '','URL' => ''},'ontologyName' => 'COMP'},'class' => '','alternativeAbbreviations' => []},'contextOfUse' => [],'scientist' => ''}]},'metadata' => {'datafiles' => [],'status' => [{'message' => 'BrAPI base call found with page=24, pageSize=3','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Loading CXGN::BrAPI::v1::ObservationVariables'},{'messageType' => 'INFO','message' => 'Observationvariable search result constructed'}],'pagination' => {'pageSize' => 3,'currentPage' => 24,'totalPages' => 86,'totalCount' => 257}}}, 'variables-search');
319 $mech->post_ok('http://localhost:3010/brapi/v1/search/variables?access_token='.$access_token,['page'=>'24']);
320 $response = decode_json $mech->content;
321 $searchId = $response->{result} ->{searchResultsDbId};
322 print STDERR Dumper $response;
323 $mech->get_ok('http://localhost:3010/brapi/v1/search/variables/'. $searchId . '?access_token='.$access_token );
324 $response = decode_json $mech->content;
325 print STDERR Dumper $response;
326 # is_deeply($response, {'metadata' => {'datafiles' => [],'status' => [{'message' => 'BrAPI base call found with page=24, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::ObservationVariables','messageType' => 'INFO'},{'message' => 'Observationvariable search result constructed','messageType' => 'INFO'}],'pagination' => {'pageSize' => 10,'totalCount' => 245,'totalPages' => 25,'currentPage' => 24}},'result' => {'data' => [{'status' => JSON::true,'scientist' => '','language' => '','observationVariableDbId' => 76828,'name' => 'weight of mashed cassava cake in kg|CO_334:0000243','ontologyDbId' => '186','crop' => 'Cassava','xref' => 'CO_334:0000243','synonyms' => [],'growthStage' => '','ontologyName' => 'CO_334','submissionTimestamp' => undef,'method' => {'methodDbId' => '','methodName' => '','formula' => '','reference' => '','class' => '','name' => '','description' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'}},'ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'ontologyDbId' => '186','version' => '','ontologyName' => 'CO_334'},'institution' => 'http://localhost:3010','observationVariableName' => 'weight of mashed cassava cake in kg','documentationURL' => '','scale' => {'scaleName' => '','scaleDbId' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'dataType' => 'Numerical','validValues' => {'categories' => [],'max' => undef,'min' => undef},'xref' => '','name' => '','decimalPlaces' => undef},'contextOfUse' => [],'trait' => {'name' => 'weight of mashed cassava cake in kg','xref' => 'CO_334:0000243','synonyms' => [],'status' => '','entity' => '','mainAbbreviations' => '','traitName' => 'weight of mashed cassava cake in kg','class' => '','attribute' => 'weight of mashed cassava cake in kg','description' => 'Weight of cassava cake after pressing and dehydrating using hydraulic press. Measured in kilogram (kg)','alternativeAbbreviations' => [],'ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'traitDbId' => 'CO_334:0000243'},'defaultValue' => ''},{'language' => '','scientist' => '','status' => JSON::true,'synonyms' => [],'ontologyName' => 'CO_334','growthStage' => '','method' => {'ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'reference' => '','name' => '','description' => '','class' => '','formula' => '','methodName' => '','methodDbId' => ''},'submissionTimestamp' => undef,'ontologyDbId' => '186','crop' => 'Cassava','xref' => 'CO_334:0000231','observationVariableDbId' => 76615,'name' => 'yield per year|CO_334:0000231','institution' => 'http://localhost:3010','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'ontologyName' => 'CO_334','version' => '','ontologyDbId' => '186'},'defaultValue' => '','trait' => {'alternativeAbbreviations' => [],'class' => '','description' => 'Annual root yield estimated in tonnes per hectare (t/ha) using yield per hectare as a function of the crop duration. Trait description provided by Hernan Ceballos in CIAT','attribute' => 'yield per year','traitDbId' => 'CO_334:0000231','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'ontologyDbId' => '186','version' => '','ontologyName' => 'CO_334'},'xref' => 'CO_334:0000231','synonyms' => [],'name' => 'yield per year','entity' => '','traitName' => 'yield per year','mainAbbreviations' => '','status' => ''},'contextOfUse' => [],'scale' => {'ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'dataType' => 'Numerical','scaleName' => '','scaleDbId' => '','name' => '','decimalPlaces' => undef,'validValues' => {'categories' => [],'max' => undef,'min' => undef},'xref' => ''},'documentationURL' => '','observationVariableName' => 'yield per year'},{'observationVariableDbId' => 70745,'name' => 'young stem growth habit|CO_334:0000104','ontologyDbId' => '186','crop' => 'Cassava','xref' => 'CO_334:0000104','growthStage' => '','ontologyName' => 'CO_334','synonyms' => [],'submissionTimestamp' => undef,'method' => {'class' => '','reference' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'description' => '','name' => '','methodName' => '','methodDbId' => '','formula' => ''},'status' => JSON::true,'scientist' => '','language' => '','observationVariableName' => 'young stem growth habit','documentationURL' => '','contextOfUse' => [],'scale' => {'name' => '','decimalPlaces' => undef,'xref' => '','validValues' => {'min' => undef,'max' => undef,'categories' => []},'ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'ontologyDbId' => '186','version' => '','ontologyName' => 'CO_334'},'dataType' => 'Numerical','scaleName' => '','scaleDbId' => ''},'trait' => {'traitName' => 'young stem growth habit','mainAbbreviations' => '','entity' => '','status' => '','synonyms' => [],'xref' => 'CO_334:0000104','name' => 'young stem growth habit','traitDbId' => 'CO_334:0000104','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'ontologyName' => 'CO_334','version' => '','ontologyDbId' => '186'},'alternativeAbbreviations' => [],'description' => 'Visual rating of growth habit of young stem with 1= straight and 2 = zig-zag.','attribute' => 'young stem growth habit','class' => ''},'defaultValue' => '','ontologyReference' => {'ontologyDbId' => '186','version' => '','ontologyName' => 'CO_334','documentationURL' => {'URL' => '','type' => ''}},'institution' => 'http://localhost:3010'},{'name' => 'young stem pubescence|CO_334:0000025','observationVariableDbId' => 70733,'method' => {'ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'name' => '','description' => '','class' => '','reference' => '','formula' => '','methodName' => '','methodDbId' => ''},'submissionTimestamp' => undef,'synonyms' => [],'growthStage' => '','ontologyName' => 'CO_334','xref' => 'CO_334:0000025','ontologyDbId' => '186','crop' => 'Cassava','scientist' => '','status' => JSON::true,'language' => '','documentationURL' => '','observationVariableName' => 'young stem pubescence','defaultValue' => '','scale' => {'scaleName' => '','scaleDbId' => '','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'dataType' => 'Numerical','xref' => '','validValues' => {'min' => undef,'max' => undef,'categories' => []},'name' => '','decimalPlaces' => undef},'contextOfUse' => [],'trait' => {'status' => '','entity' => '','mainAbbreviations' => '','traitName' => 'young stem pubescence','name' => 'young stem pubescence','xref' => 'CO_334:0000025','synonyms' => [],'ontologyReference' => {'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => '','documentationURL' => {'type' => '','URL' => ''}},'traitDbId' => 'CO_334:0000025','class' => '','attribute' => 'young stem pubescence','description' => 'Visual rating of young stem pubescence with 0 = absent or glabrous, 3 = little pubescence, 5 = moderate pubescence, and 7 = high pubescence.','alternativeAbbreviations' => []},'ontologyReference' => {'ontologyDbId' => '186','version' => '','ontologyName' => 'CO_334','documentationURL' => {'type' => '','URL' => ''}},'institution' => 'http://localhost:3010'},{'language' => '','status' => JSON::true,'scientist' => '','xref' => 'CO_334:0000078','ontologyDbId' => '186','crop' => 'Cassava','method' => {'formula' => '','methodDbId' => '','methodName' => '','description' => '','name' => '','ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'ontologyName' => 'CO_334','version' => '','ontologyDbId' => '186'},'reference' => '','class' => ''},'submissionTimestamp' => undef,'growthStage' => '','ontologyName' => 'CO_334','synonyms' => [],'name' => 'zinc content in storage root ug/g|CO_334:0000078','observationVariableDbId' => 70660,'institution' => 'http://localhost:3010','ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'ontologyDbId' => '186','ontologyName' => 'CO_334','version' => ''},'contextOfUse' => [],'trait' => {'ontologyReference' => {'documentationURL' => {'type' => '','URL' => ''},'version' => '','ontologyName' => 'CO_334','ontologyDbId' => '186'},'traitDbId' => 'CO_334:0000078','attribute' => 'zinc content in storage root ug/g','description' => 'Total zinc content in cassava storage root.','class' => '','alternativeAbbreviations' => [],'status' => '','mainAbbreviations' => '','traitName' => 'zinc content in storage root ug/g','entity' => '','name' => 'zinc content in storage root ug/g','synonyms' => [],'xref' => 'CO_334:0000078'},'scale' => {'dataType' => 'Numerical','ontologyReference' => {'documentationURL' => {'URL' => '','type' => ''},'ontologyDbId' => '186','version' => '','ontologyName' => 'CO_334'},'scaleDbId' => '','scaleName' => '','name' => '','decimalPlaces' => undef,'validValues' => {'min' => undef,'max' => undef,'categories' => []},'xref' => ''},'defaultValue' => '','observationVariableName' => 'zinc content in storage root ug/g','documentationURL' => ''}]}}, 'variables-search');
328 $mech->get_ok('http://localhost:3010/brapi/v1/samples-search?access_token='.$access_token );
329 $response = decode_json $mech->content;
330 print STDERR Dumper $response;
331 is_deeply($response, {'result' => {'data' => []},'metadata' => {'datafiles' => [],'pagination' => {'totalPages' => 0,'pageSize' => 10,'currentPage' => 0,'totalCount' => 0},'status' => [{'message' => 'BrAPI base call found with page=0, pageSize=10','messageType' => 'INFO'},{'message' => 'Loading CXGN::BrAPI::v1::Samples','messageType' => 'INFO'},{'messageType' => 'INFO','message' => 'Sample search result constructed'}]}}, 'samples');
333 $f->clean_up_db();
335 done_testing();