Merge pull request #5230 from solgenomics/topic/open_pollinated
[sgn.git] / t / selenium2 / brapi / brapi.t.old
blob98f24c891b9a37fbaa5e58e707c049080f3a7a1c
2 use strict;
3 use lib 't/lib';
5 use Test::More;
6 use SGN::Test::WWW::WebDriver;
7 use JSON::Any;
8 use Data::Dumper;
10 my $d = SGN::Test::WWW::WebDriver->new();
11 my $j = JSON::Any->new();
13     #Authentication
15     $d->get_ok('/brapi/v1/token?grant_type=wrongtype&username=johndoe&password=secretpw');
16     ok($d->driver->get_page_source()=~/Grant Type Not Supported/, "authentication call bad grant type");
18     $d->get_ok('/brapi/v1/token?grant_type=password&username=johndoe&password=wrong');
19     ok($d->driver->get_page_source()=~/Incorrect Password/, "authentication call bad password");
21     $d->get_ok('/brapi/v1/token?grant_type=password&username=janedoe&password=secretpw');
22     my $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
23     my $auth = $j->jsonToObj($json_response);
24     my $session_token = $auth->{session_token};
27     #Germplasm
29     #Germplasm Search by Name
31     $d->get_ok('/brapi/v1/germplasm?name=test*&matchMethod=wildcard&session_token='.$session_token);
32     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
33     my $germplasm = $j->jsonToObj($json_response);
34     #print STDERR Dumper $germplasm;
35     is_deeply($germplasm, {
36           'metadata' => {
37                           'status' => [],
38                           'pagination' => {
39                                             'totalCount' => '10',
40                                             'currentPage' => 1,
41                                             'totalPages' => 1,
42                                             'pageSize' => 20
43                                           }
44                         },
45           'result' => {
46                         'data' => [
47                                     {
48                                       'pedigree' => undef,
49                                       'germplasmName' => 'test_accession1',
50                                       'defaultDisplayName' => 'test_accession1',
51                                       'synonyms' => [],
52                                       'seedSource' => '',
53                                       'germplasmDbId' => 38840,
54                                       'accessionNumber' => '',
55                                       'germplasmPUI' => 'test_accession1'
56                                     },
57                                     {
58                                       'pedigree' => undef,
59                                       'germplasmName' => 'test_accession2',
60                                       'defaultDisplayName' => 'test_accession2',
61                                       'synonyms' => [],
62                                       'seedSource' => '',
63                                       'germplasmDbId' => 38841,
64                                       'accessionNumber' => '',
65                                       'germplasmPUI' => 'test_accession2'
66                                     },
67                                     {
68                                       'pedigree' => undef,
69                                       'germplasmName' => 'test_accession3',
70                                       'defaultDisplayName' => 'test_accession3',
71                                       'synonyms' => [],
72                                       'seedSource' => '',
73                                       'germplasmDbId' => 38842,
74                                       'accessionNumber' => '',
75                                       'germplasmPUI' => 'test_accession3'
76                                     },
77                                     {
78                                       'pedigree' => undef,
79                                       'germplasmName' => 'test_accession4',
80                                       'defaultDisplayName' => 'test_accession4',
81                                       'synonyms' => [],
82                                       'seedSource' => '',
83                                       'germplasmDbId' => 38843,
84                                       'accessionNumber' => '',
85                                       'germplasmPUI' => 'test_accession4'
86                                     },
87                                     {
88                                       'pedigree' => undef,
89                                       'germplasmName' => 'test_accession5',
90                                       'defaultDisplayName' => 'test_accession5',
91                                       'synonyms' => [],
92                                       'seedSource' => '',
93                                       'germplasmDbId' => 38844,
94                                       'accessionNumber' => '',
95                                       'germplasmPUI' => 'test_accession5'
96                                     },
97                                     {
98                                       'pedigree' => 'test_accession4/test_accession5',
99                                       'germplasmName' => 'test5P001',
100                                       'defaultDisplayName' => 'test5P001',
101                                       'synonyms' => [],
102                                       'seedSource' => '',
103                                       'germplasmDbId' => 38873,
104                                       'accessionNumber' => '',
105                                       'germplasmPUI' => 'test5P001'
106                                     },
107                                     {
108                                       'pedigree' => 'test_accession4/test_accession5',
109                                       'germplasmName' => 'test5P002',
110                                       'defaultDisplayName' => 'test5P002',
111                                       'synonyms' => [],
112                                       'seedSource' => '',
113                                       'germplasmDbId' => 38874,
114                                       'accessionNumber' => '',
115                                       'germplasmPUI' => 'test5P002'
116                                     },
117                                     {
118                                       'pedigree' => 'test_accession4/test_accession5',
119                                       'germplasmName' => 'test5P003',
120                                       'defaultDisplayName' => 'test5P003',
121                                       'synonyms' => [],
122                                       'seedSource' => '',
123                                       'germplasmDbId' => 38875,
124                                       'accessionNumber' => '',
125                                       'germplasmPUI' => 'test5P003'
126                                     },
127                                     {
128                                       'pedigree' => 'test_accession4/test_accession5',
129                                       'germplasmName' => 'test5P004',
130                                       'defaultDisplayName' => 'test5P004',
131                                       'synonyms' => [],
132                                       'seedSource' => '',
133                                       'germplasmDbId' => 38876,
134                                       'accessionNumber' => '',
135                                       'germplasmPUI' => 'test5P004'
136                                     },
137                                     {
138                                       'pedigree' => 'test_accession4/test_accession5',
139                                       'germplasmName' => 'test5P005',
140                                       'defaultDisplayName' => 'test5P005',
141                                       'synonyms' => [],
142                                       'seedSource' => '',
143                                       'germplasmDbId' => 38877,
144                                       'accessionNumber' => '',
145                                       'germplasmPUI' => 'test5P005'
146                                     }
147                                   ]
148                       }
149         }, 'germplasm test');
151     #Germplasm Details by germplasmId
153     $d->get_ok('/brapi/v1/germplasm/38843?session_token='.$session_token);
154     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
155     my $germplasm_detail = $j->jsonToObj($json_response);
156     #print STDERR Dumper $germplasm_detail;
158     is_deeply($germplasm_detail, {
159           'metadata' => {
160                           'status' => [],
161                           'pagination' => {
162                                             'totalCount' => 1,
163                                             'currentPage' => 1,
164                                             'totalPages' => 1,
165                                             'pageSize' => 20
166                                           }
167                         },
168           'result' => {
169                         'pedigree' => undef,
170                         'germplasmName' => 'test_accession4',
171                         'defaultDisplayName' => 'test_accession4',
172                         'synonyms' => [],
173                         'seedSource' => '',
174                         'germplasmDbId' => '38843',
175                         'accessionNumber' => 'test_accession4',
176                         'germplasmPUI' => 'test_accession4'
177                       }
178         }, 'germplasm detail test'); 
181     
183     #Germplasm MCPD
185     #$d->get_ok('/brapi/v1/germplasm/38843/MCPD');
186     #ok($d->driver->get_page_source()=~/test_accession4/, "germplasm MCPD detail call");
188     #Germplasm Details List by StudyId
190     $d->get_ok('/brapi/v1/studies/139/germplasm?session_token='.$session_token);
191     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
192     my $studies_germplasm = $j->jsonToObj($json_response);
193     #print STDERR Dumper $studies_germplasm;
195     is_deeply($studies_germplasm, {
196           'metadata' => {
197                           'status' => [],
198                           'pagination' => {
199                                             'totalCount' => 374,
200                                             'currentPage' => 1,
201                                             'totalPages' => 19,
202                                             'pageSize' => 20
203                                           }
204                         },
205           'result' => {
206                         'studyName' => 'Kasese solgs trial',
207                         'data' => [
208                                     {
209                                       'pedigree' => undef,
210                                       'studyEntryNumberId' => '',
211                                       'germplasmName' => 'UG120001',
212                                       'synonyms' => [],
213                                       'defaultDisplayName' => 'UG120001',
214                                       'seedSource' => '',
215                                       'germplasmDbId' => 38878,
216                                       'accessionNumber' => 'UG120001',
217                                       'germplasmPUI' => 'UG120001'
218                                     },
219                                     {
220                                       'pedigree' => undef,
221                                       'studyEntryNumberId' => '',
222                                       'germplasmName' => 'UG120002',
223                                       'synonyms' => [],
224                                       'defaultDisplayName' => 'UG120002',
225                                       'seedSource' => '',
226                                       'germplasmDbId' => 38879,
227                                       'accessionNumber' => 'UG120002',
228                                       'germplasmPUI' => 'UG120002'
229                                     },
230                                     {
231                                       'pedigree' => undef,
232                                       'studyEntryNumberId' => '',
233                                       'germplasmName' => 'UG120003',
234                                       'synonyms' => [],
235                                       'defaultDisplayName' => 'UG120003',
236                                       'seedSource' => '',
237                                       'germplasmDbId' => 38880,
238                                       'accessionNumber' => 'UG120003',
239                                       'germplasmPUI' => 'UG120003'
240                                     },
241                                     {
242                                       'pedigree' => undef,
243                                       'studyEntryNumberId' => '',
244                                       'germplasmName' => 'UG120004',
245                                       'synonyms' => [],
246                                       'defaultDisplayName' => 'UG120004',
247                                       'seedSource' => '',
248                                       'germplasmDbId' => 38881,
249                                       'accessionNumber' => 'UG120004',
250                                       'germplasmPUI' => 'UG120004'
251                                     },
252                                     {
253                                       'pedigree' => undef,
254                                       'studyEntryNumberId' => '',
255                                       'germplasmName' => 'UG120005',
256                                       'synonyms' => [],
257                                       'defaultDisplayName' => 'UG120005',
258                                       'seedSource' => '',
259                                       'germplasmDbId' => 38882,
260                                       'accessionNumber' => 'UG120005',
261                                       'germplasmPUI' => 'UG120005'
262                                     },
263                                     {
264                                       'pedigree' => undef,
265                                       'studyEntryNumberId' => '',
266                                       'germplasmName' => 'UG120006',
267                                       'synonyms' => [],
268                                       'defaultDisplayName' => 'UG120006',
269                                       'seedSource' => '',
270                                       'germplasmDbId' => 38883,
271                                       'accessionNumber' => 'UG120006',
272                                       'germplasmPUI' => 'UG120006'
273                                     },
274                                     {
275                                       'pedigree' => undef,
276                                       'studyEntryNumberId' => '',
277                                       'germplasmName' => 'UG120007',
278                                       'synonyms' => [],
279                                       'defaultDisplayName' => 'UG120007',
280                                       'seedSource' => '',
281                                       'germplasmDbId' => 38884,
282                                       'accessionNumber' => 'UG120007',
283                                       'germplasmPUI' => 'UG120007'
284                                     },
285                                     {
286                                       'pedigree' => undef,
287                                       'studyEntryNumberId' => '',
288                                       'germplasmName' => 'UG120008',
289                                       'synonyms' => [],
290                                       'defaultDisplayName' => 'UG120008',
291                                       'seedSource' => '',
292                                       'germplasmDbId' => 38885,
293                                       'accessionNumber' => 'UG120008',
294                                       'germplasmPUI' => 'UG120008'
295                                     },
296                                     {
297                                       'pedigree' => undef,
298                                       'studyEntryNumberId' => '',
299                                       'germplasmName' => 'UG120009',
300                                       'synonyms' => [],
301                                       'defaultDisplayName' => 'UG120009',
302                                       'seedSource' => '',
303                                       'germplasmDbId' => 38886,
304                                       'accessionNumber' => 'UG120009',
305                                       'germplasmPUI' => 'UG120009'
306                                     },
307                                     {
308                                       'pedigree' => undef,
309                                       'studyEntryNumberId' => '',
310                                       'germplasmName' => 'UG120010',
311                                       'synonyms' => [],
312                                       'defaultDisplayName' => 'UG120010',
313                                       'seedSource' => '',
314                                       'germplasmDbId' => 38887,
315                                       'accessionNumber' => 'UG120010',
316                                       'germplasmPUI' => 'UG120010'
317                                     },
318                                     {
319                                       'pedigree' => undef,
320                                       'studyEntryNumberId' => '',
321                                       'germplasmName' => 'UG120011',
322                                       'synonyms' => [],
323                                       'defaultDisplayName' => 'UG120011',
324                                       'seedSource' => '',
325                                       'germplasmDbId' => 38888,
326                                       'accessionNumber' => 'UG120011',
327                                       'germplasmPUI' => 'UG120011'
328                                     },
329                                     {
330                                       'pedigree' => undef,
331                                       'studyEntryNumberId' => '',
332                                       'germplasmName' => 'UG120012',
333                                       'synonyms' => [],
334                                       'defaultDisplayName' => 'UG120012',
335                                       'seedSource' => '',
336                                       'germplasmDbId' => 38889,
337                                       'accessionNumber' => 'UG120012',
338                                       'germplasmPUI' => 'UG120012'
339                                     },
340                                     {
341                                       'pedigree' => undef,
342                                       'studyEntryNumberId' => '',
343                                       'germplasmName' => 'UG120013',
344                                       'synonyms' => [],
345                                       'defaultDisplayName' => 'UG120013',
346                                       'seedSource' => '',
347                                       'germplasmDbId' => 38890,
348                                       'accessionNumber' => 'UG120013',
349                                       'germplasmPUI' => 'UG120013'
350                                     },
351                                     {
352                                       'pedigree' => undef,
353                                       'studyEntryNumberId' => '',
354                                       'germplasmName' => 'UG120014',
355                                       'synonyms' => [],
356                                       'defaultDisplayName' => 'UG120014',
357                                       'seedSource' => '',
358                                       'germplasmDbId' => 38891,
359                                       'accessionNumber' => 'UG120014',
360                                       'germplasmPUI' => 'UG120014'
361                                     },
362                                     {
363                                       'pedigree' => undef,
364                                       'studyEntryNumberId' => '',
365                                       'germplasmName' => 'UG120015',
366                                       'synonyms' => [],
367                                       'defaultDisplayName' => 'UG120015',
368                                       'seedSource' => '',
369                                       'germplasmDbId' => 38892,
370                                       'accessionNumber' => 'UG120015',
371                                       'germplasmPUI' => 'UG120015'
372                                     },
373                                     {
374                                       'pedigree' => undef,
375                                       'studyEntryNumberId' => '',
376                                       'germplasmName' => 'UG120016',
377                                       'synonyms' => [],
378                                       'defaultDisplayName' => 'UG120016',
379                                       'seedSource' => '',
380                                       'germplasmDbId' => 38893,
381                                       'accessionNumber' => 'UG120016',
382                                       'germplasmPUI' => 'UG120016'
383                                     },
384                                     {
385                                       'pedigree' => undef,
386                                       'studyEntryNumberId' => '',
387                                       'germplasmName' => 'UG120017',
388                                       'synonyms' => [],
389                                       'defaultDisplayName' => 'UG120017',
390                                       'seedSource' => '',
391                                       'germplasmDbId' => 38894,
392                                       'accessionNumber' => 'UG120017',
393                                       'germplasmPUI' => 'UG120017'
394                                     },
395                                     {
396                                       'pedigree' => undef,
397                                       'studyEntryNumberId' => '',
398                                       'germplasmName' => 'UG120018',
399                                       'synonyms' => [],
400                                       'defaultDisplayName' => 'UG120018',
401                                       'seedSource' => '',
402                                       'germplasmDbId' => 38895,
403                                       'accessionNumber' => 'UG120018',
404                                       'germplasmPUI' => 'UG120018'
405                                     },
406                                     {
407                                       'pedigree' => undef,
408                                       'studyEntryNumberId' => '',
409                                       'germplasmName' => 'UG120019',
410                                       'synonyms' => [],
411                                       'defaultDisplayName' => 'UG120019',
412                                       'seedSource' => '',
413                                       'germplasmDbId' => 38896,
414                                       'accessionNumber' => 'UG120019',
415                                       'germplasmPUI' => 'UG120019'
416                                     },
417                                     {
418                                       'pedigree' => undef,
419                                       'studyEntryNumberId' => '',
420                                       'germplasmName' => 'UG120020',
421                                       'synonyms' => [],
422                                       'defaultDisplayName' => 'UG120020',
423                                       'seedSource' => '',
424                                       'germplasmDbId' => 38897,
425                                       'accessionNumber' => 'UG120020',
426                                       'germplasmPUI' => 'UG120020'
427                                     }
428                                   ],
429                         'studyDbId' => '139'
430                       }
431         }, 'study germplasm test');
433     #Germplasm Pedigree
435     $d->get_ok('/brapi/v1/germplasm/38846/pedigree?session_token='.$session_token);
436     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
437     my $germplasm_pedigree = $j->jsonToObj($json_response);
438     #print STDERR Dumper $germplasm_pedigree;
440     is_deeply($germplasm_pedigree, {
441           'metadata' => {
442                           'status' => [],
443                           'pagination' => {
444                                             'totalCount' => 1,
445                                             'currentPage' => 1,
446                                             'totalPages' => 1,
447                                             'pageSize' => 20
448                                           }
449                         },
450           'result' => {
451                         'pedigree' => 'test_accession4/test_accession5',
452                         'parent2Id' => 38844,
453                         'germplasmDbId' => '38846',
454                         'parent1Id' => 38843
455                       }
456         }, 'germplasm pedigree test');
458     #Germplasm Markerprofiles
460     #$d->get_ok('/brapi/v1/germplasm/39024/markerprofiles?session_token='.$session_token);
461     #my $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
462     #my $germplasm_markerprofiles = $j->jsonToObj($json_response);
463     #print STDERR Dumper $germplasm_markerprofiles;
465     
466     #Germplasm Attributes
468     #
472     #MarkerProfiles
474     #Markerprofile search
476     $d->get_ok('/brapi/v1/markerprofiles?session_token='.$session_token);
477     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
478     my $markerprofiles = $j->jsonToObj($json_response);
479     #print STDERR Dumper $markerprofiles;
481     is_deeply($markerprofiles, {
482           'metadata' => {
483                           'status' => [],
484                           'pagination' => {
485                                             'totalCount' => 535,
486                                             'currentPage' => 1,
487                                             'totalPages' => 27,
488                                             'pageSize' => 20
489                                           }
490                         },
491           'result' => {
492                         'data' => [
493                                     {
494                                       'resultCount' => 500,
495                                       'markerProfileDbId' => 1622,
496                                       'germplasmDbId' => 38937,
497                                       'extractDbId' => '',
498                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
499                                     },
500                                     {
501                                       'resultCount' => 500,
502                                       'markerProfileDbId' => 1623,
503                                       'germplasmDbId' => 38994,
504                                       'extractDbId' => '',
505                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
506                                     },
507                                     {
508                                       'resultCount' => 500,
509                                       'markerProfileDbId' => 1624,
510                                       'germplasmDbId' => 39006,
511                                       'extractDbId' => '',
512                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
513                                     },
514                                     {
515                                       'resultCount' => 500,
516                                       'markerProfileDbId' => 1625,
517                                       'germplasmDbId' => 39045,
518                                       'extractDbId' => '',
519                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
520                                     },
521                                     {
522                                       'resultCount' => 500,
523                                       'markerProfileDbId' => 1626,
524                                       'germplasmDbId' => 38881,
525                                       'extractDbId' => '',
526                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
527                                     },
528                                     {
529                                       'resultCount' => 500,
530                                       'markerProfileDbId' => 1627,
531                                       'germplasmDbId' => 39007,
532                                       'extractDbId' => '',
533                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
534                                     },
535                                     {
536                                       'resultCount' => 500,
537                                       'markerProfileDbId' => 1628,
538                                       'germplasmDbId' => 39027,
539                                       'extractDbId' => '',
540                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
541                                     },
542                                     {
543                                       'resultCount' => 500,
544                                       'markerProfileDbId' => 1629,
545                                       'germplasmDbId' => 39028,
546                                       'extractDbId' => '',
547                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
548                                     },
549                                     {
550                                       'resultCount' => 500,
551                                       'markerProfileDbId' => 1630,
552                                       'germplasmDbId' => 39033,
553                                       'extractDbId' => '',
554                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
555                                     },
556                                     {
557                                       'resultCount' => 500,
558                                       'markerProfileDbId' => 1631,
559                                       'germplasmDbId' => 38917,
560                                       'extractDbId' => '',
561                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
562                                     },
563                                     {
564                                       'resultCount' => 500,
565                                       'markerProfileDbId' => 1632,
566                                       'germplasmDbId' => 39044,
567                                       'extractDbId' => '',
568                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
569                                     },
570                                     {
571                                       'resultCount' => 500,
572                                       'markerProfileDbId' => 1633,
573                                       'germplasmDbId' => 39050,
574                                       'extractDbId' => '',
575                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
576                                     },
577                                     {
578                                       'resultCount' => 500,
579                                       'markerProfileDbId' => 1634,
580                                       'germplasmDbId' => 39070,
581                                       'extractDbId' => '',
582                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
583                                     },
584                                     {
585                                       'resultCount' => 500,
586                                       'markerProfileDbId' => 1635,
587                                       'germplasmDbId' => 38884,
588                                       'extractDbId' => '',
589                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
590                                     },
591                                     {
592                                       'resultCount' => 500,
593                                       'markerProfileDbId' => 1636,
594                                       'germplasmDbId' => 38981,
595                                       'extractDbId' => '',
596                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
597                                     },
598                                     {
599                                       'resultCount' => 500,
600                                       'markerProfileDbId' => 1637,
601                                       'germplasmDbId' => 38998,
602                                       'extractDbId' => '',
603                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
604                                     },
605                                     {
606                                       'resultCount' => 500,
607                                       'markerProfileDbId' => 1638,
608                                       'germplasmDbId' => 39078,
609                                       'extractDbId' => '',
610                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
611                                     },
612                                     {
613                                       'resultCount' => 500,
614                                       'markerProfileDbId' => 1639,
615                                       'germplasmDbId' => 39052,
616                                       'extractDbId' => '',
617                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
618                                     },
619                                     {
620                                       'resultCount' => 500,
621                                       'markerProfileDbId' => 1640,
622                                       'germplasmDbId' => 38946,
623                                       'extractDbId' => '',
624                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
625                                     },
626                                     {
627                                       'resultCount' => 500,
628                                       'markerProfileDbId' => 1641,
629                                       'germplasmDbId' => 39024,
630                                       'extractDbId' => '',
631                                       'analysisMethod' => 'GBS ApeKI genotyping v4'
632                                     }
633                                   ]
634                       }
635         }, 'markerprofiles test');
637     #Markerprofile data
639     $d->get_ok('/brapi/v1/markerprofiles/1622?session_token='.$session_token);
640     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
641     my $markerprofiles_detail = $j->jsonToObj($json_response);
642     #print STDERR Dumper $markerprofiles_detail;
644     is_deeply($markerprofiles_detail, {
645           'metadata' => {
646                           'status' => [],
647                           'pagination' => {
648                                             'totalCount' => 500,
649                                             'currentPage' => 1,
650                                             'totalPages' => 25,
651                                             'pageSize' => 20
652                                           }
653                         },
654           'result' => {
655                         'markerprofileDbId' => '1622',
656                         'data' => [
657                                     {
658                                       'S5_36739' => 'AA'
659                                     },
660                                     {
661                                       'S13_92567' => 'BB'
662                                     },
663                                     {
664                                       'S69_57277' => 'AB'
665                                     },
666                                     {
667                                       'S80_224901' => 'AA'
668                                     },
669                                     {
670                                       'S80_232173' => 'BB'
671                                     },
672                                     {
673                                       'S80_265728' => 'AA'
674                                     },
675                                     {
676                                       'S97_219243' => 'AB'
677                                     },
678                                     {
679                                       'S224_309814' => 'BB'
680                                     },
681                                     {
682                                       'S248_174244' => 'BB'
683                                     },
684                                     {
685                                       'S318_245078' => 'AA'
686                                     },
687                                     {
688                                       'S325_476494' => 'AB'
689                                     },
690                                     {
691                                       'S341_311907' => 'BB'
692                                     },
693                                     {
694                                       'S341_745165' => 'BB'
695                                     },
696                                     {
697                                       'S341_927602' => 'BB'
698                                     },
699                                     {
700                                       'S435_153155' => 'BB'
701                                     },
702                                     {
703                                       'S620_130205' => 'BB'
704                                     },
705                                     {
706                                       'S784_76866' => 'BB'
707                                     },
708                                     {
709                                       'S821_289681' => 'AA'
710                                     },
711                                     {
712                                       'S823_109683' => 'AA'
713                                     },
714                                     {
715                                       'S823_119622' => 'BB'
716                                     }
717                                   ],
718                         'germplasmDbId' => 38937,
719                         'extractDbId' => '',
720                         'analysisMethod' => 'GBS ApeKI genotyping v4',
721                         'encoding' => 'AA,BB,AB'
722                       }
723         }, 'markerprofiles detail test');
727     $d->get_ok('/brapi/v1/maps?session_token='.$session_token);
728     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
729     my $maps = $j->jsonToObj($json_response);
730     #print STDERR Dumper $maps;
732     is_deeply($maps, {
733           'metadata' => {
734                           'status' => [],
735                           'pagination' => {
736                                             'totalCount' => 1,
737                                             'currentPage' => 1,
738                                             'totalPages' => 1,
739                                             'pageSize' => 20
740                                           }
741                         },
742           'result' => {
743                         'data' => [
744                                     {
745                                       'name' => 'GBS ApeKI genotyping v4',
746                                       'publishedDate' => undef,
747                                       'species' => 'Cassava SNP genotypes for stock 520 20 24 25 29 30 44 46 108 109 112 114 520name = UG120066, id = 38937)',
748                                       'mapId' => 1,
749                                       'comments' => '',
750                                       'markerCount' => 500,
751                                       'unit' => 'bp',
752                                       'linkageGroupCount' => 268,
753                                       'type' => 'physical'
754                                     }
755                                   ]
756                       }
757         }, 'maps data test');
759     $d->get_ok('/brapi/v1/maps/1?session_token='.$session_token);
760     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
761     my $maps_detail = $j->jsonToObj($json_response);
762     #print STDERR Dumper $maps_detail;
764     is_deeply($maps_detail, {
765           'metadata' => {
766                           'status' => [],
767                           'pagination' => {
768                                             'totalCount' => 268,
769                                             'currentPage' => 1,
770                                             'totalPages' => 14,
771                                             'pageSize' => 20
772                                           }
773                         },
774           'result' => {
775                         'unit' => 'bp',
776                         'name' => 'GBS ApeKI genotyping v4',
777                         'linkageGroups' => [
778                                              {
779                                                'numberMarkers' => 1,
780                                                'maxPosition' => '185859',
781                                                'linkageGroupId' => 'S10114'
782                                              },
783                                              {
784                                                'numberMarkers' => 2,
785                                                'maxPosition' => '899514',
786                                                'linkageGroupId' => 'S10173'
787                                              },
788                                              {
789                                                'numberMarkers' => 1,
790                                                'maxPosition' => '146006',
791                                                'linkageGroupId' => 'S10241'
792                                              },
793                                              {
794                                                'numberMarkers' => 1,
795                                                'maxPosition' => '465354',
796                                                'linkageGroupId' => 'S1027'
797                                              },
798                                              {
799                                                'numberMarkers' => 1,
800                                                'maxPosition' => '21679',
801                                                'linkageGroupId' => 'S10367'
802                                              },
803                                              {
804                                                'numberMarkers' => 1,
805                                                'maxPosition' => '216535',
806                                                'linkageGroupId' => 'S1046'
807                                              },
808                                              {
809                                                'numberMarkers' => 3,
810                                                'maxPosition' => '529025',
811                                                'linkageGroupId' => 'S10493'
812                                              },
813                                              {
814                                                'numberMarkers' => 3,
815                                                'maxPosition' => '96591',
816                                                'linkageGroupId' => 'S10551'
817                                              },
818                                              {
819                                                'numberMarkers' => 5,
820                                                'maxPosition' => '996687',
821                                                'linkageGroupId' => 'S10563'
822                                              },
823                                              {
824                                                'numberMarkers' => 2,
825                                                'maxPosition' => '585587',
826                                                'linkageGroupId' => 'S10689'
827                                              },
828                                              {
829                                                'numberMarkers' => 1,
830                                                'maxPosition' => '25444',
831                                                'linkageGroupId' => 'S10780'
832                                              },
833                                              {
834                                                'numberMarkers' => 2,
835                                                'maxPosition' => '244349',
836                                                'linkageGroupId' => 'S10797'
837                                              },
838                                              {
839                                                'numberMarkers' => 1,
840                                                'maxPosition' => '781226',
841                                                'linkageGroupId' => 'S10963'
842                                              },
843                                              {
844                                                'numberMarkers' => 1,
845                                                'maxPosition' => '78443',
846                                                'linkageGroupId' => 'S11106'
847                                              },
848                                              {
849                                                'numberMarkers' => 2,
850                                                'maxPosition' => '231468',
851                                                'linkageGroupId' => 'S11179'
852                                              },
853                                              {
854                                                'numberMarkers' => 1,
855                                                'maxPosition' => '108022',
856                                                'linkageGroupId' => 'S11267'
857                                              },
858                                              {
859                                                'numberMarkers' => 1,
860                                                'maxPosition' => '16826',
861                                                'linkageGroupId' => 'S1127'
862                                              },
863                                              {
864                                                'numberMarkers' => 1,
865                                                'maxPosition' => '135336',
866                                                'linkageGroupId' => 'S11279'
867                                              },
868                                              {
869                                                'numberMarkers' => 4,
870                                                'maxPosition' => '591849',
871                                                'linkageGroupId' => 'S11297'
872                                              },
873                                              {
874                                                'numberMarkers' => 2,
875                                                'maxPosition' => '582872',
876                                                'linkageGroupId' => 'S11341'
877                                              }
878                                            ],
879                         'type' => 'physical',
880                         'mapId' => 1
881                       }
882         }, 'map details test');
884     $d->get_ok('/brapi/v1/maps/1/positions?session_token='.$session_token);
885     $json_response = $d->find_element_ok('body', 'tag_name', "find body")->get_text();
886     my $maps_position = $j->jsonToObj($json_response);
887     #print STDERR Dumper $maps_position;
889     is_deeply($maps_position, {
890           'metadata' => {
891                           'status' => [],
892                           'pagination' => {
893                                             'totalCount' => 500,
894                                             'currentPage' => 1,
895                                             'totalPages' => 25,
896                                             'pageSize' => 20
897                                           }
898                         },
899           'result' => {
900                         'data' => [
901                                     {
902                                       'markerName' => 'S5_36739',
903                                       'linkageGroup' => 'S5',
904                                       'markerId' => 'S5_36739',
905                                       'location' => '36739'
906                                     },
907                                     {
908                                       'markerName' => 'S13_92567',
909                                       'linkageGroup' => 'S13',
910                                       'markerId' => 'S13_92567',
911                                       'location' => '92567'
912                                     },
913                                     {
914                                       'markerName' => 'S69_57277',
915                                       'linkageGroup' => 'S69',
916                                       'markerId' => 'S69_57277',
917                                       'location' => '57277'
918                                     },
919                                     {
920                                       'markerName' => 'S80_224901',
921                                       'linkageGroup' => 'S80',
922                                       'markerId' => 'S80_224901',
923                                       'location' => '224901'
924                                     },
925                                     {
926                                       'markerName' => 'S80_232173',
927                                       'linkageGroup' => 'S80',
928                                       'markerId' => 'S80_232173',
929                                       'location' => '232173'
930                                     },
931                                     {
932                                       'markerName' => 'S80_265728',
933                                       'linkageGroup' => 'S80',
934                                       'markerId' => 'S80_265728',
935                                       'location' => '265728'
936                                     },
937                                     {
938                                       'markerName' => 'S97_219243',
939                                       'linkageGroup' => 'S97',
940                                       'markerId' => 'S97_219243',
941                                       'location' => '219243'
942                                     },
943                                     {
944                                       'markerName' => 'S224_309814',
945                                       'linkageGroup' => 'S224',
946                                       'markerId' => 'S224_309814',
947                                       'location' => '309814'
948                                     },
949                                     {
950                                       'markerName' => 'S248_174244',
951                                       'linkageGroup' => 'S248',
952                                       'markerId' => 'S248_174244',
953                                       'location' => '174244'
954                                     },
955                                     {
956                                       'markerName' => 'S318_245078',
957                                       'linkageGroup' => 'S318',
958                                       'markerId' => 'S318_245078',
959                                       'location' => '245078'
960                                     },
961                                     {
962                                       'markerName' => 'S325_476494',
963                                       'linkageGroup' => 'S325',
964                                       'markerId' => 'S325_476494',
965                                       'location' => '476494'
966                                     },
967                                     {
968                                       'markerName' => 'S341_311907',
969                                       'linkageGroup' => 'S341',
970                                       'markerId' => 'S341_311907',
971                                       'location' => '311907'
972                                     },
973                                     {
974                                       'markerName' => 'S341_745165',
975                                       'linkageGroup' => 'S341',
976                                       'markerId' => 'S341_745165',
977                                       'location' => '745165'
978                                     },
979                                     {
980                                       'markerName' => 'S341_927602',
981                                       'linkageGroup' => 'S341',
982                                       'markerId' => 'S341_927602',
983                                       'location' => '927602'
984                                     },
985                                     {
986                                       'markerName' => 'S435_153155',
987                                       'linkageGroup' => 'S435',
988                                       'markerId' => 'S435_153155',
989                                       'location' => '153155'
990                                     },
991                                     {
992                                       'markerName' => 'S620_130205',
993                                       'linkageGroup' => 'S620',
994                                       'markerId' => 'S620_130205',
995                                       'location' => '130205'
996                                     },
997                                     {
998                                       'markerName' => 'S784_76866',
999                                       'linkageGroup' => 'S784',
1000                                       'markerId' => 'S784_76866',
1001                                       'location' => '76866'
1002                                     },
1003                                     {
1004                                       'markerName' => 'S821_289681',
1005                                       'linkageGroup' => 'S821',
1006                                       'markerId' => 'S821_289681',
1007                                       'location' => '289681'
1008                                     },
1009                                     {
1010                                       'markerName' => 'S823_109683',
1011                                       'linkageGroup' => 'S823',
1012                                       'markerId' => 'S823_109683',
1013                                       'location' => '109683'
1014                                     },
1015                                     {
1016                                       'markerName' => 'S823_119622',
1017                                       'linkageGroup' => 'S823',
1018                                       'markerId' => 'S823_119622',
1019                                       'location' => '119622'
1020                                     }
1021                                   ]
1022                       }
1023         }, 'maps positions test');
1026 done_testing();