{"action":"created","comment":{"url":"https://api.github.com/repos/CommBank/maestro/pulls/comments/29023397","id":29023397,"diff_hunk":"@@ -0,0 +1,201 @@\n+//   Copyright 2014 Commonwealth Bank of Australia\n+//\n+//   Licensed under the Apache License, Version 2.0 (the \"License\");\n+//   you may not use this file except in compliance with the License.\n+//   You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+//   Unless required by applicable law or agreed to in writing, software\n+//   distributed under the License is distributed on an \"AS IS\" BASIS,\n+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+//   See the License for the specific language governing permissions and\n+//   limitations under the License.\n+\n+package au.com.cba.omnia.maestro.macros\n+\n+import au.com.cba.omnia.maestro.test.Spec\n+import au.com.cba.omnia.maestro.test.Arbitraries._\n+import au.com.cba.omnia.maestro.test.thrift.humbug.{Types => HTypes, _}\n+import au.com.cba.omnia.maestro.test.thrift.scrooge._\n+\n+\n+import com.twitter.util.Eval\n+\n+object AutomapSpec extends Spec { def is = s2\"\"\"\n+AutomapSpec\n+==================\n+\n+  Transforms\n+    can transform one struct to another without manual operations $autoTransform\n+    can transform one struct to another with manual operations $manualTransform\n+\n+  Humbug generated Thrift structures\n+    can be joined                                                                                  $joinHumbug\n+    can handle multiple equal input fields                                                         $multipleEqualSourcesHumbug\n+    throws exception when encountering multiple differing input fields                             $multipleDifferingSourcesHumbug\n+\n+  Scrooge generated Thrift structures\n+    can be joined                                                                                  $joinScrooge\n+    can handle multiple equal input fields                                                         $multipleEqualSourcesScrooge\n+    throws exception when encountering multiple differing input fields                             $multipleDifferingSourcesScrooge\n+\n+  Combined Humbug and Scrooge Thrift structures\n+    can join Scrooge and Humbug to Humbug                                                          $mixedToHumbug\n+    can join Scrooge and Humbug to Scrooge                                                         $mixedToScrooge\n+\n+\"\"\"\n+\n+  implicit val srcFields = Macros.mkFields[HTypes]\n+  implicit val dstFields = Macros.mkFields[Large]\n+  val imports =\n+    \"\"\"import au.com.cba.omnia.maestro.macros._\n+       import au.com.cba.omnia.maestro.test.thrift.humbug._\n+       import au.com.cba.omnia.maestro.test.thrift.scrooge._\n+    \"\"\"\n+\n+  def autoTransform = prop { (types: HTypes) =>\n+    val s1 = new SubOne()\n+    s1.stringField  = types.stringField\n+    s1.booleanField = types.booleanField\n+\n+    val s2 = new SubTwo()\n+    s2.intField    = types.intField\n+    s2.longField   = types.longField\n+    s2.doubleField = types.doubleField\n+\n+    val s3 = new SubThree()\n+    s3.longField = types.longField\n+    s3.intField  = types.intField\n+\n+    @automap def hToOne(x: HTypes): SubOne = ()\n+    hToOne(types) must_== s1\n+    @automap def hToTwo(x: HTypes): SubTwo = ()\n+    hToTwo(types) must_== s2\n+    @automap def hToThree(x: HTypes): SubThree = ()\n+    hToThree(types) must_== s3\n+  }\n+\n+  def manualTransform = prop { (types: HTypes) =>\n+    val s1 = new SubOne()\n+    s1.stringField  = types.stringField\n+    s1.booleanField = !types.booleanField\n+\n+    val s2 = new SubTwo()\n+    s2.intField    = types.intField + 1\n+    s2.longField   = types.longField - 1\n+    s2.doubleField = types.doubleField\n+\n+    @automap def hToOne(x: HTypes): SubOne = (\n+      booleanField := !x.booleanField\n+    )\n+    @automap def hToTwo(x: HTypes): SubTwo = (\n+      intField  := x.intField + 1,\n+      longField := x.longField - 1\n+    )\n+\n+    hToOne(types) must_== s1\n+    hToTwo(types) must_== s2\n+  }\n+\n+  val scroogeStructOne = JoinOneScrooge(\"some-string\", true, 42)\n+  val scroogeStructTwo = JoinTwoScrooge(\"some-string\", 1000L, 2d)\n+\n+  val scroogeDuplicateOk  = JoinOneDuplicateScrooge(42)\n+  val scroogeDuplicateBad = JoinOneDuplicateScrooge(13)\n+\n+  val scroogeIncompatible = JoinOneIncompatibleScrooge(\"not int\")\n+\n+  val humbugStructOne = {\n+    val one = new JoinOneHumbug\n+    one.stringField  = \"some-string\"\n+    one.booleanField = true\n+    one.someField    = 42\n+    one\n+  }\n+\n+  val humbugStructTwo = {\n+    val two = new JoinTwoHumbug\n+    two.stringField = \"some-string\"\n+    two.longField   = 1000L\n+    two.doubleField = 2d\n+    two\n+  }\n+\n+  val humbugDuplicateOk  = {\n+    val dup = new JoinOneDuplicateHumbug\n+    dup.someField = 42\n+\n+    dup\n+  }\n+\n+  val humbugDuplicateBad = {\n+    val dup = new JoinOneDuplicateHumbug\n+    dup.someField = 13\n+    dup\n+  }\n+\n+\n+  def joinHumbug = {\n+    @automap def join(x: JoinOneHumbug, y: JoinTwoHumbug): JoinableHumbug = ()    \n+\n+    val resultJoined = new JoinableHumbug\n+    resultJoined.booleanField = true\n+    resultJoined.longField    = 1000L\n+    resultJoined.someField    = 42\n+    join((humbugStructOne, humbugStructTwo)) must beEqualTo(resultJoined)\n+  }\n+\n+  def joinScrooge = {\n+    @automap def join(x: JoinOneScrooge, y: JoinTwoScrooge): JoinableScrooge = ()    \n+\n+    val resultJoined = JoinableScrooge(true, 1000, 42)\n+    join((scroogeStructOne, scroogeStructTwo)) must beEqualTo(resultJoined)\n+  }\n+\n+  def multipleEqualSourcesHumbug = {\n+    @automap def join(x: JoinOneHumbug, y: JoinTwoHumbug, z: JoinOneDuplicateHumbug): JoinableHumbug = ()    ","path":"maestro-macros/src/test/scala/au/com/cba/omnia/maestro/macros/AutomapSpec.scala","position":157,"original_position":157,"commit_id":"f7b1a444c2ceca57fe9cb0712bc4a681a79ee387","original_commit_id":"f7b1a444c2ceca57fe9cb0712bc4a681a79ee387","user":{"login":"stephanh","id":376868,"avatar_url":"https://avatars.githubusercontent.com/u/376868?v=3","gravatar_id":"","url":"https://api.github.com/users/stephanh","html_url":"https://github.com/stephanh","followers_url":"https://api.github.com/users/stephanh/followers","following_url":"https://api.github.com/users/stephanh/following{/other_user}","gists_url":"https://api.github.com/users/stephanh/gists{/gist_id}","starred_url":"https://api.github.com/users/stephanh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephanh/subscriptions","organizations_url":"https://api.github.com/users/stephanh/orgs","repos_url":"https://api.github.com/users/stephanh/repos","events_url":"https://api.github.com/users/stephanh/events{/privacy}","received_events_url":"https://api.github.com/users/stephanh/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/versioned/images/favicon.png) Issue found: [Whitespace at end of line](https://www.codacy.com/app/CommBank/maestro/file/580057832/issues/source?bid=2205397&fileBranchId=2256027#l157)","created_at":"2015-04-24T04:41:53Z","updated_at":"2015-04-24T04:41:53Z","html_url":"https://github.com/CommBank/maestro/pull/369#discussion_r29023397","pull_request_url":"https://api.github.com/repos/CommBank/maestro/pulls/369","_links":{"self":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/comments/29023397"},"html":{"href":"https://github.com/CommBank/maestro/pull/369#discussion_r29023397"},"pull_request":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/369"}}},"pull_request":{"url":"https://api.github.com/repos/CommBank/maestro/pulls/369","id":33516476,"html_url":"https://github.com/CommBank/maestro/pull/369","diff_url":"https://github.com/CommBank/maestro/pull/369.diff","patch_url":"https://github.com/CommBank/maestro/pull/369.patch","issue_url":"https://api.github.com/repos/CommBank/maestro/issues/369","number":369,"state":"open","locked":false,"title":"Transformer macro annotation","user":{"login":"shmookey","id":2177430,"avatar_url":"https://avatars.githubusercontent.com/u/2177430?v=3","gravatar_id":"","url":"https://api.github.com/users/shmookey","html_url":"https://github.com/shmookey","followers_url":"https://api.github.com/users/shmookey/followers","following_url":"https://api.github.com/users/shmookey/following{/other_user}","gists_url":"https://api.github.com/users/shmookey/gists{/gist_id}","starred_url":"https://api.github.com/users/shmookey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shmookey/subscriptions","organizations_url":"https://api.github.com/users/shmookey/orgs","repos_url":"https://api.github.com/users/shmookey/repos","events_url":"https://api.github.com/users/shmookey/events{/privacy}","received_events_url":"https://api.github.com/users/shmookey/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-17T05:59:03Z","updated_at":"2015-04-24T04:41:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c48a9f778cd21553ee55a27cc178c37a7a68143","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/CommBank/maestro/pulls/369/commits","review_comments_url":"https://api.github.com/repos/CommBank/maestro/pulls/369/comments","review_comment_url":"https://api.github.com/repos/CommBank/maestro/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CommBank/maestro/issues/369/comments","statuses_url":"https://api.github.com/repos/CommBank/maestro/statuses/f7b1a444c2ceca57fe9cb0712bc4a681a79ee387","head":{"label":"CommBank:feature-transformer","ref":"feature-transformer","sha":"f7b1a444c2ceca57fe9cb0712bc4a681a79ee387","user":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"repo":{"id":17347463,"name":"maestro","full_name":"CommBank/maestro","owner":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommBank/maestro","description":"Data Pipelines that are well typed and enforce good convention","fork":false,"url":"https://api.github.com/repos/CommBank/maestro","forks_url":"https://api.github.com/repos/CommBank/maestro/forks","keys_url":"https://api.github.com/repos/CommBank/maestro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommBank/maestro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommBank/maestro/teams","hooks_url":"https://api.github.com/repos/CommBank/maestro/hooks","issue_events_url":"https://api.github.com/repos/CommBank/maestro/issues/events{/number}","events_url":"https://api.github.com/repos/CommBank/maestro/events","assignees_url":"https://api.github.com/repos/CommBank/maestro/assignees{/user}","branches_url":"https://api.github.com/repos/CommBank/maestro/branches{/branch}","tags_url":"https://api.github.com/repos/CommBank/maestro/tags","blobs_url":"https://api.github.com/repos/CommBank/maestro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommBank/maestro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommBank/maestro/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommBank/maestro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommBank/maestro/statuses/{sha}","languages_url":"https://api.github.com/repos/CommBank/maestro/languages","stargazers_url":"https://api.github.com/repos/CommBank/maestro/stargazers","contributors_url":"https://api.github.com/repos/CommBank/maestro/contributors","subscribers_url":"https://api.github.com/repos/CommBank/maestro/subscribers","subscription_url":"https://api.github.com/repos/CommBank/maestro/subscription","commits_url":"https://api.github.com/repos/CommBank/maestro/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommBank/maestro/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommBank/maestro/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommBank/maestro/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommBank/maestro/contents/{+path}","compare_url":"https://api.github.com/repos/CommBank/maestro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommBank/maestro/merges","archive_url":"https://api.github.com/repos/CommBank/maestro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommBank/maestro/downloads","issues_url":"https://api.github.com/repos/CommBank/maestro/issues{/number}","pulls_url":"https://api.github.com/repos/CommBank/maestro/pulls{/number}","milestones_url":"https://api.github.com/repos/CommBank/maestro/milestones{/number}","notifications_url":"https://api.github.com/repos/CommBank/maestro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommBank/maestro/labels{/name}","releases_url":"https://api.github.com/repos/CommBank/maestro/releases{/id}","created_at":"2014-03-02T21:34:53Z","updated_at":"2015-04-23T08:02:12Z","pushed_at":"2015-04-24T04:39:26Z","git_url":"git://github.com/CommBank/maestro.git","ssh_url":"git@github.com:CommBank/maestro.git","clone_url":"https://github.com/CommBank/maestro.git","svn_url":"https://github.com/CommBank/maestro","homepage":"https://commbank.github.io/maestro","size":46010,"stargazers_count":29,"watchers_count":29,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":54,"forks":16,"open_issues":54,"watchers":29,"default_branch":"master"}},"base":{"label":"CommBank:master","ref":"master","sha":"348266f98abea68bfe2672ed40e4e52050ca55cf","user":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"repo":{"id":17347463,"name":"maestro","full_name":"CommBank/maestro","owner":{"login":"CommBank","id":4240076,"avatar_url":"https://avatars.githubusercontent.com/u/4240076?v=3","gravatar_id":"","url":"https://api.github.com/users/CommBank","html_url":"https://github.com/CommBank","followers_url":"https://api.github.com/users/CommBank/followers","following_url":"https://api.github.com/users/CommBank/following{/other_user}","gists_url":"https://api.github.com/users/CommBank/gists{/gist_id}","starred_url":"https://api.github.com/users/CommBank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommBank/subscriptions","organizations_url":"https://api.github.com/users/CommBank/orgs","repos_url":"https://api.github.com/users/CommBank/repos","events_url":"https://api.github.com/users/CommBank/events{/privacy}","received_events_url":"https://api.github.com/users/CommBank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommBank/maestro","description":"Data Pipelines that are well typed and enforce good convention","fork":false,"url":"https://api.github.com/repos/CommBank/maestro","forks_url":"https://api.github.com/repos/CommBank/maestro/forks","keys_url":"https://api.github.com/repos/CommBank/maestro/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommBank/maestro/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommBank/maestro/teams","hooks_url":"https://api.github.com/repos/CommBank/maestro/hooks","issue_events_url":"https://api.github.com/repos/CommBank/maestro/issues/events{/number}","events_url":"https://api.github.com/repos/CommBank/maestro/events","assignees_url":"https://api.github.com/repos/CommBank/maestro/assignees{/user}","branches_url":"https://api.github.com/repos/CommBank/maestro/branches{/branch}","tags_url":"https://api.github.com/repos/CommBank/maestro/tags","blobs_url":"https://api.github.com/repos/CommBank/maestro/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommBank/maestro/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommBank/maestro/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommBank/maestro/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommBank/maestro/statuses/{sha}","languages_url":"https://api.github.com/repos/CommBank/maestro/languages","stargazers_url":"https://api.github.com/repos/CommBank/maestro/stargazers","contributors_url":"https://api.github.com/repos/CommBank/maestro/contributors","subscribers_url":"https://api.github.com/repos/CommBank/maestro/subscribers","subscription_url":"https://api.github.com/repos/CommBank/maestro/subscription","commits_url":"https://api.github.com/repos/CommBank/maestro/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommBank/maestro/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommBank/maestro/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommBank/maestro/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommBank/maestro/contents/{+path}","compare_url":"https://api.github.com/repos/CommBank/maestro/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommBank/maestro/merges","archive_url":"https://api.github.com/repos/CommBank/maestro/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommBank/maestro/downloads","issues_url":"https://api.github.com/repos/CommBank/maestro/issues{/number}","pulls_url":"https://api.github.com/repos/CommBank/maestro/pulls{/number}","milestones_url":"https://api.github.com/repos/CommBank/maestro/milestones{/number}","notifications_url":"https://api.github.com/repos/CommBank/maestro/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommBank/maestro/labels{/name}","releases_url":"https://api.github.com/repos/CommBank/maestro/releases{/id}","created_at":"2014-03-02T21:34:53Z","updated_at":"2015-04-23T08:02:12Z","pushed_at":"2015-04-24T04:39:26Z","git_url":"git://github.com/CommBank/maestro.git","ssh_url":"git@github.com:CommBank/maestro.git","clone_url":"https://github.com/CommBank/maestro.git","svn_url":"https://github.com/CommBank/maestro","homepage":"https://commbank.github.io/maestro","size":46010,"stargazers_count":29,"watchers_count":29,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":54,"forks":16,"open_issues":54,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/369"},"html":{"href":"https://github.com/CommBank/maestro/pull/369"},"issue":{"href":"https://api.github.com/repos/CommBank/maestro/issues/369"},"comments":{"href":"https://api.github.com/repos/CommBank/maestro/issues/369/comments"},"review_comments":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/369/comments"},"review_comment":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CommBank/maestro/pulls/369/commits"},"statuses":{"href":"https://api.github.com/repos/CommBank/maestro/statuses/f7b1a444c2ceca57fe9cb0712bc4a681a79ee387"}}}}