{"action":"created","comment":{"url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments/51293794","id":51293794,"diff_hunk":"@@ -927,4 +928,59 @@ public void getPresentationLocales_shouldReturnLanguageLocaleIfItIsSpecifiedInAl\n \t\tAssert.assertTrue(\"en\", presentationLocales.contains(new Locale(\"en\")));\n \t\tAssert.assertTrue(\"es\", presentationLocales.contains(new Locale(\"es\")));\n \t}\n+\t\n+\t/**\n+\t * @see AdministrationService#getPresentationLocales()\n+\t */\n+\t@Test\n+\t@Verifies(value = \"should preserve insertion in Set returned by method\", method = \"getPresentationLocales()\")\n+\tpublic void getPresentationLocales_shouldPreserveInsertionInSetReturnedByMethod()\n+\t\t\tthrows Exception {\n+\t\tString globalPropertyLocaleListAllowedData = \"en_GB, es, ja_JP, it_IT, pl_PL\";\n+\t\t//The order of languages and locales is described above and should be followed bt `presentationLocales` Set\n+\t\tContext.getAdministrationService().saveGlobalProperty(\n+\t\t\t\tnew GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST, globalPropertyLocaleListAllowedData));\n+\t\t\n+\t\tList<Locale> locales = new ArrayList<Locale>();\n+\t\t//Add data in random order and verify that order is maintained in the end by checking against order in global property\n+\t\tlocales.add(new Locale(\"pl\", \"PL\"));\n+\t\tlocales.add(new Locale(\"es\"));\n+\t\tlocales.add(new Locale(\"en\"));\n+\t\tlocales.add(new Locale(\"it\", \"IT\"));\n+\t\t\n+\t\tMutableResourceBundleMessageSource mutableResourceBundleMessageSource = Mockito\n+\t\t\t\t.mock(MutableResourceBundleMessageSource.class);\n+\t\tMockito.when(mutableResourceBundleMessageSource.getLocales()).thenReturn(locales);","path":"api/src/test/java/org/openmrs/api/AdministrationServiceTest.java","position":34,"original_position":34,"commit_id":"14a27005c79d8a7fb2b0e4cbd400bd45cfbc8bca","original_commit_id":"14a27005c79d8a7fb2b0e4cbd400bd45cfbc8bca","user":{"login":"djazayeri","id":1165236,"avatar_url":"https://avatars.githubusercontent.com/u/1165236?v=3","gravatar_id":"","url":"https://api.github.com/users/djazayeri","html_url":"https://github.com/djazayeri","followers_url":"https://api.github.com/users/djazayeri/followers","following_url":"https://api.github.com/users/djazayeri/following{/other_user}","gists_url":"https://api.github.com/users/djazayeri/gists{/gist_id}","starred_url":"https://api.github.com/users/djazayeri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djazayeri/subscriptions","organizations_url":"https://api.github.com/users/djazayeri/orgs","repos_url":"https://api.github.com/users/djazayeri/repos","events_url":"https://api.github.com/users/djazayeri/events{/privacy}","received_events_url":"https://api.github.com/users/djazayeri/received_events","type":"User","site_admin":false},"body":"My preference would be to inline the definition of locales, as just `Arrays.asList(new Locale(...), ...)`","created_at":"2016-01-29T18:09:59Z","updated_at":"2016-01-29T18:09:59Z","html_url":"https://github.com/openmrs/openmrs-core/pull/1690#discussion_r51293794","pull_request_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690","_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments/51293794"},"html":{"href":"https://github.com/openmrs/openmrs-core/pull/1690#discussion_r51293794"},"pull_request":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690"}}},"pull_request":{"url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690","id":57667116,"html_url":"https://github.com/openmrs/openmrs-core/pull/1690","diff_url":"https://github.com/openmrs/openmrs-core/pull/1690.diff","patch_url":"https://github.com/openmrs/openmrs-core/pull/1690.patch","issue_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/1690","number":1690,"state":"open","locked":false,"title":"[TRUNK-4818] : Changed `presentationLocale` to LinkedHashSet to Preserve Insertion Order of Locales","user":{"login":"bholagabbar","id":11693595,"avatar_url":"https://avatars.githubusercontent.com/u/11693595?v=3","gravatar_id":"","url":"https://api.github.com/users/bholagabbar","html_url":"https://github.com/bholagabbar","followers_url":"https://api.github.com/users/bholagabbar/followers","following_url":"https://api.github.com/users/bholagabbar/following{/other_user}","gists_url":"https://api.github.com/users/bholagabbar/gists{/gist_id}","starred_url":"https://api.github.com/users/bholagabbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bholagabbar/subscriptions","organizations_url":"https://api.github.com/users/bholagabbar/orgs","repos_url":"https://api.github.com/users/bholagabbar/repos","events_url":"https://api.github.com/users/bholagabbar/events{/privacy}","received_events_url":"https://api.github.com/users/bholagabbar/received_events","type":"User","site_admin":false},"body":"**Issue**:[TRUNK-4818](https://issues.openmrs.org/browse/TRUNK-4818): \r\nIn AdministrationServiceImpl.getPresentationLocales() the set we return is a HashSet, but this causes us to lose the ordering of locales (that ultimately comes from an admin-configured global property)\r\n\r\nInstead we should use a LinkedHashSet, in order to preserve the order of locales we get from getAllowedLocales() (and ultimately the admin configured via a global property).<br>\r\n**Fix**: Changed `presentationLocales` from `HashSet` to `LinkedHashSet` to preserve insertion order as discussed in ticket. Also added a Unit Test","created_at":"2016-01-29T16:13:36Z","updated_at":"2016-01-29T18:09:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71fa4b01dbd42c6b57a67f5f25d3bebf04a3ee28","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690/commits","review_comments_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690/comments","review_comment_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/1690/comments","statuses_url":"https://api.github.com/repos/openmrs/openmrs-core/statuses/14a27005c79d8a7fb2b0e4cbd400bd45cfbc8bca","head":{"label":"bholagabbar:TRUNK-4818-bg","ref":"TRUNK-4818-bg","sha":"14a27005c79d8a7fb2b0e4cbd400bd45cfbc8bca","user":{"login":"bholagabbar","id":11693595,"avatar_url":"https://avatars.githubusercontent.com/u/11693595?v=3","gravatar_id":"","url":"https://api.github.com/users/bholagabbar","html_url":"https://github.com/bholagabbar","followers_url":"https://api.github.com/users/bholagabbar/followers","following_url":"https://api.github.com/users/bholagabbar/following{/other_user}","gists_url":"https://api.github.com/users/bholagabbar/gists{/gist_id}","starred_url":"https://api.github.com/users/bholagabbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bholagabbar/subscriptions","organizations_url":"https://api.github.com/users/bholagabbar/orgs","repos_url":"https://api.github.com/users/bholagabbar/repos","events_url":"https://api.github.com/users/bholagabbar/events{/privacy}","received_events_url":"https://api.github.com/users/bholagabbar/received_events","type":"User","site_admin":false},"repo":{"id":48685815,"name":"openmrs-core","full_name":"bholagabbar/openmrs-core","owner":{"login":"bholagabbar","id":11693595,"avatar_url":"https://avatars.githubusercontent.com/u/11693595?v=3","gravatar_id":"","url":"https://api.github.com/users/bholagabbar","html_url":"https://github.com/bholagabbar","followers_url":"https://api.github.com/users/bholagabbar/followers","following_url":"https://api.github.com/users/bholagabbar/following{/other_user}","gists_url":"https://api.github.com/users/bholagabbar/gists{/gist_id}","starred_url":"https://api.github.com/users/bholagabbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bholagabbar/subscriptions","organizations_url":"https://api.github.com/users/bholagabbar/orgs","repos_url":"https://api.github.com/users/bholagabbar/repos","events_url":"https://api.github.com/users/bholagabbar/events{/privacy}","received_events_url":"https://api.github.com/users/bholagabbar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bholagabbar/openmrs-core","description":"OpenMRS API and web application code","fork":true,"url":"https://api.github.com/repos/bholagabbar/openmrs-core","forks_url":"https://api.github.com/repos/bholagabbar/openmrs-core/forks","keys_url":"https://api.github.com/repos/bholagabbar/openmrs-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bholagabbar/openmrs-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bholagabbar/openmrs-core/teams","hooks_url":"https://api.github.com/repos/bholagabbar/openmrs-core/hooks","issue_events_url":"https://api.github.com/repos/bholagabbar/openmrs-core/issues/events{/number}","events_url":"https://api.github.com/repos/bholagabbar/openmrs-core/events","assignees_url":"https://api.github.com/repos/bholagabbar/openmrs-core/assignees{/user}","branches_url":"https://api.github.com/repos/bholagabbar/openmrs-core/branches{/branch}","tags_url":"https://api.github.com/repos/bholagabbar/openmrs-core/tags","blobs_url":"https://api.github.com/repos/bholagabbar/openmrs-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bholagabbar/openmrs-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bholagabbar/openmrs-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/bholagabbar/openmrs-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bholagabbar/openmrs-core/statuses/{sha}","languages_url":"https://api.github.com/repos/bholagabbar/openmrs-core/languages","stargazers_url":"https://api.github.com/repos/bholagabbar/openmrs-core/stargazers","contributors_url":"https://api.github.com/repos/bholagabbar/openmrs-core/contributors","subscribers_url":"https://api.github.com/repos/bholagabbar/openmrs-core/subscribers","subscription_url":"https://api.github.com/repos/bholagabbar/openmrs-core/subscription","commits_url":"https://api.github.com/repos/bholagabbar/openmrs-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/bholagabbar/openmrs-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/bholagabbar/openmrs-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/bholagabbar/openmrs-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/bholagabbar/openmrs-core/contents/{+path}","compare_url":"https://api.github.com/repos/bholagabbar/openmrs-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bholagabbar/openmrs-core/merges","archive_url":"https://api.github.com/repos/bholagabbar/openmrs-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bholagabbar/openmrs-core/downloads","issues_url":"https://api.github.com/repos/bholagabbar/openmrs-core/issues{/number}","pulls_url":"https://api.github.com/repos/bholagabbar/openmrs-core/pulls{/number}","milestones_url":"https://api.github.com/repos/bholagabbar/openmrs-core/milestones{/number}","notifications_url":"https://api.github.com/repos/bholagabbar/openmrs-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bholagabbar/openmrs-core/labels{/name}","releases_url":"https://api.github.com/repos/bholagabbar/openmrs-core/releases{/id}","deployments_url":"https://api.github.com/repos/bholagabbar/openmrs-core/deployments","created_at":"2015-12-28T09:49:16Z","updated_at":"2016-01-20T15:07:52Z","pushed_at":"2016-01-29T16:05:37Z","git_url":"git://github.com/bholagabbar/openmrs-core.git","ssh_url":"git@github.com:bholagabbar/openmrs-core.git","clone_url":"https://github.com/bholagabbar/openmrs-core.git","svn_url":"https://github.com/bholagabbar/openmrs-core","homepage":"http://openmrs.org","size":227484,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openmrs:master","ref":"master","sha":"8ef110c9b2d4a5ba655a902a0445d304daef7195","user":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"repo":{"id":5187976,"name":"openmrs-core","full_name":"openmrs/openmrs-core","owner":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmrs/openmrs-core","description":"OpenMRS API and web application code","fork":false,"url":"https://api.github.com/repos/openmrs/openmrs-core","forks_url":"https://api.github.com/repos/openmrs/openmrs-core/forks","keys_url":"https://api.github.com/repos/openmrs/openmrs-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmrs/openmrs-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmrs/openmrs-core/teams","hooks_url":"https://api.github.com/repos/openmrs/openmrs-core/hooks","issue_events_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/events{/number}","events_url":"https://api.github.com/repos/openmrs/openmrs-core/events","assignees_url":"https://api.github.com/repos/openmrs/openmrs-core/assignees{/user}","branches_url":"https://api.github.com/repos/openmrs/openmrs-core/branches{/branch}","tags_url":"https://api.github.com/repos/openmrs/openmrs-core/tags","blobs_url":"https://api.github.com/repos/openmrs/openmrs-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmrs/openmrs-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmrs/openmrs-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmrs/openmrs-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmrs/openmrs-core/statuses/{sha}","languages_url":"https://api.github.com/repos/openmrs/openmrs-core/languages","stargazers_url":"https://api.github.com/repos/openmrs/openmrs-core/stargazers","contributors_url":"https://api.github.com/repos/openmrs/openmrs-core/contributors","subscribers_url":"https://api.github.com/repos/openmrs/openmrs-core/subscribers","subscription_url":"https://api.github.com/repos/openmrs/openmrs-core/subscription","commits_url":"https://api.github.com/repos/openmrs/openmrs-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmrs/openmrs-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmrs/openmrs-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmrs/openmrs-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmrs/openmrs-core/contents/{+path}","compare_url":"https://api.github.com/repos/openmrs/openmrs-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmrs/openmrs-core/merges","archive_url":"https://api.github.com/repos/openmrs/openmrs-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmrs/openmrs-core/downloads","issues_url":"https://api.github.com/repos/openmrs/openmrs-core/issues{/number}","pulls_url":"https://api.github.com/repos/openmrs/openmrs-core/pulls{/number}","milestones_url":"https://api.github.com/repos/openmrs/openmrs-core/milestones{/number}","notifications_url":"https://api.github.com/repos/openmrs/openmrs-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmrs/openmrs-core/labels{/name}","releases_url":"https://api.github.com/repos/openmrs/openmrs-core/releases{/id}","deployments_url":"https://api.github.com/repos/openmrs/openmrs-core/deployments","created_at":"2012-07-26T04:54:29Z","updated_at":"2016-01-28T09:02:55Z","pushed_at":"2016-01-29T16:39:48Z","git_url":"git://github.com/openmrs/openmrs-core.git","ssh_url":"git@github.com:openmrs/openmrs-core.git","clone_url":"https://github.com/openmrs/openmrs-core.git","svn_url":"https://github.com/openmrs/openmrs-core","homepage":"http://openmrs.org","size":235980,"stargazers_count":274,"watchers_count":274,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1319,"mirror_url":null,"open_issues_count":5,"forks":1319,"open_issues":5,"watchers":274,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690"},"html":{"href":"https://github.com/openmrs/openmrs-core/pull/1690"},"issue":{"href":"https://api.github.com/repos/openmrs/openmrs-core/issues/1690"},"comments":{"href":"https://api.github.com/repos/openmrs/openmrs-core/issues/1690/comments"},"review_comments":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690/comments"},"review_comment":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmrs/openmrs-core/pulls/1690/commits"},"statuses":{"href":"https://api.github.com/repos/openmrs/openmrs-core/statuses/14a27005c79d8a7fb2b0e4cbd400bd45cfbc8bca"}}}}