{"action":"created","comment":{"url":"https://api.github.com/repos/dcos/cosmos/pulls/comments/76323239","id":76323239,"diff_hunk":"@@ -0,0 +1,87 @@\n+package com.mesosphere.cosmos\n+\n+import com.mesosphere.universe.v3.circe.Decoders._\n+import cats.data.Xor\n+import com.mesosphere.cosmos.http.MediaTypes\n+import com.mesosphere.cosmos.rpc.v1.model.{PublishRequest, PublishResponse}\n+import com.mesosphere.cosmos.test.{CosmosIntegrationTestClient, TestUtil}\n+import com.mesosphere.universe.v3.model.PackageDefinition.ReleaseVersion\n+import com.mesosphere.universe.v3.model._\n+import org.scalatest.FreeSpec\n+import com.twitter.bijection.Conversion.asMethod\n+import com.mesosphere.cosmos.converter.Common._\n+import com.mesosphere.cosmos.rpc.v1.circe.Decoders\n+import com.mesosphere.cosmos.rpc.v1.circe.Encoders\n+\n+\n+\n+class PackageStorageIntegrationSpec extends FreeSpec {\n+  private[this] val cosmosClient = CosmosIntegrationTestClient.CosmosClient\n+\n+  private[this] def nameAndRelease(pkg: PackageDefinition): (String, ReleaseVersion) = pkg match {\n+    case v2: V2Package => (v2.name, v2.releaseVersion)\n+    case v3: V3Package => (v3.name, v3.releaseVersion)\n+  }\n+\n+  private[this] def getRepo: Repository = {\n+    val Xor.Right(repo: Repository) = cosmosClient.callEndpoint[Unit, Repository](\n+      \"package/storage/repository\",\n+      (),\n+      MediaTypes.any,\n+      MediaTypes.UniverseV3Repository,\n+      method = \"GET\"\n+    )\n+    repo\n+  }\n+\n+  private[this] def putBundle(bundle: BundleDefinition): PublishResponse = {\n+    val Xor.Right(resp: PublishResponse) = cosmosClient.callEndpoint[PublishRequest, PublishResponse](\n+      \"package/publish\",\n+      PublishRequest(bundle),\n+      MediaTypes.PublishRequest,\n+      MediaTypes.PublishResponse\n+    )(Decoders.publishResponse, Encoders.publishRequest)\n+    resp\n+  }\n+\n+  \"The package storage repository will serve a repository that\" - {\n+    \"contains all published packages in any order\" - {\n+\n+\n+      val bundles: List[(BundleDefinition, PackageDefinition)] = (0 to 8).map { i =>\n+        val (b, _) = TestUtil.MaximalV3ModelV2PackageDefinition.as[(V2Bundle, ReleaseVersion)]\n+        val bundle  = b.copy(name = \"package\" + (i / 3))\n+        val pkg = (bundle , ReleaseVersion(i % 3).get).as[V2Package]\n+        (bundle , pkg)\n+      }.toList\n+\n+      \"when no packages have been published\" - {\n+        assertResult(Repository(List()))(getRepo)\n+      }\n+\n+      \"when a single package has been published\" - {\n+        val (bundle , pkg) = bundles.head\n+        putBundle(bundle )\n+        assertResult(\n+          Repository(List(pkg)))(\n+          getRepo\n+        )\n+      }\n+\n+      \"when multiple packages have been published\" - {\n+        bundles.tail.foreach { case (bundle , pkg) =>\n+          putBundle(bundle )\n+          assert(getRepo.packages.contains(pkg))\n+        }\n+      }\n+\n+      \"such that for all packages with the same name, the release version \" +\n+        \"ordering matches the publishing ordering\" - {\n+        val expected = bundles.map(_._2).sortBy(nameAndRelease)\n+        val actual = getRepo.packages.sortBy(nameAndRelease)\n+        assertResult(expected)(actual)\n+      }\n+    }\n+\n+  }\n+}","path":"cosmos-server/src/it/scala/com/mesosphere/cosmos/PackageStorageIntegrationSpec.scala","position":87,"original_position":87,"commit_id":"cbfc4e7e9a9618e6b7bafe403abe444edea2950c","original_commit_id":"cbfc4e7e9a9618e6b7bafe403abe444edea2950c","user":{"login":"cruhland","id":1936682,"avatar_url":"https://avatars.githubusercontent.com/u/1936682?v=3","gravatar_id":"","url":"https://api.github.com/users/cruhland","html_url":"https://github.com/cruhland","followers_url":"https://api.github.com/users/cruhland/followers","following_url":"https://api.github.com/users/cruhland/following{/other_user}","gists_url":"https://api.github.com/users/cruhland/gists{/gist_id}","starred_url":"https://api.github.com/users/cruhland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cruhland/subscriptions","organizations_url":"https://api.github.com/users/cruhland/orgs","repos_url":"https://api.github.com/users/cruhland/repos","events_url":"https://api.github.com/users/cruhland/events{/privacy}","received_events_url":"https://api.github.com/users/cruhland/received_events","type":"User","site_admin":false},"body":"Nitpick: add newline.","created_at":"2016-08-25T20:58:47Z","updated_at":"2016-08-25T20:58:47Z","html_url":"https://github.com/dcos/cosmos/pull/462#discussion_r76323239","pull_request_url":"https://api.github.com/repos/dcos/cosmos/pulls/462","_links":{"self":{"href":"https://api.github.com/repos/dcos/cosmos/pulls/comments/76323239"},"html":{"href":"https://github.com/dcos/cosmos/pull/462#discussion_r76323239"},"pull_request":{"href":"https://api.github.com/repos/dcos/cosmos/pulls/462"}}},"pull_request":{"url":"https://api.github.com/repos/dcos/cosmos/pulls/462","id":80546964,"html_url":"https://github.com/dcos/cosmos/pull/462","diff_url":"https://github.com/dcos/cosmos/pull/462.diff","patch_url":"https://github.com/dcos/cosmos/pull/462.patch","issue_url":"https://api.github.com/repos/dcos/cosmos/issues/462","number":462,"state":"open","locked":false,"title":"Package Publish V1","user":{"login":"larioj","id":9968087,"avatar_url":"https://avatars.githubusercontent.com/u/9968087?v=3","gravatar_id":"","url":"https://api.github.com/users/larioj","html_url":"https://github.com/larioj","followers_url":"https://api.github.com/users/larioj/followers","following_url":"https://api.github.com/users/larioj/following{/other_user}","gists_url":"https://api.github.com/users/larioj/gists{/gist_id}","starred_url":"https://api.github.com/users/larioj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larioj/subscriptions","organizations_url":"https://api.github.com/users/larioj/orgs","repos_url":"https://api.github.com/users/larioj/repos","events_url":"https://api.github.com/users/larioj/events{/privacy}","received_events_url":"https://api.github.com/users/larioj/received_events","type":"User","site_admin":false},"body":"Using this for testing","created_at":"2016-08-09T01:08:45Z","updated_at":"2016-08-25T20:58:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb4915356f548fe94e678353450a56c129ad9b74","assignee":{"login":"larioj","id":9968087,"avatar_url":"https://avatars.githubusercontent.com/u/9968087?v=3","gravatar_id":"","url":"https://api.github.com/users/larioj","html_url":"https://github.com/larioj","followers_url":"https://api.github.com/users/larioj/followers","following_url":"https://api.github.com/users/larioj/following{/other_user}","gists_url":"https://api.github.com/users/larioj/gists{/gist_id}","starred_url":"https://api.github.com/users/larioj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larioj/subscriptions","organizations_url":"https://api.github.com/users/larioj/orgs","repos_url":"https://api.github.com/users/larioj/repos","events_url":"https://api.github.com/users/larioj/events{/privacy}","received_events_url":"https://api.github.com/users/larioj/received_events","type":"User","site_admin":false},"assignees":[{"login":"larioj","id":9968087,"avatar_url":"https://avatars.githubusercontent.com/u/9968087?v=3","gravatar_id":"","url":"https://api.github.com/users/larioj","html_url":"https://github.com/larioj","followers_url":"https://api.github.com/users/larioj/followers","following_url":"https://api.github.com/users/larioj/following{/other_user}","gists_url":"https://api.github.com/users/larioj/gists{/gist_id}","starred_url":"https://api.github.com/users/larioj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larioj/subscriptions","organizations_url":"https://api.github.com/users/larioj/orgs","repos_url":"https://api.github.com/users/larioj/repos","events_url":"https://api.github.com/users/larioj/events{/privacy}","received_events_url":"https://api.github.com/users/larioj/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dcos/cosmos/milestones/16","html_url":"https://github.com/dcos/cosmos/milestones/package.dcos:%20the%20how","labels_url":"https://api.github.com/repos/dcos/cosmos/milestones/16/labels","id":1937918,"number":16,"title":"package.dcos: the how","description":"","creator":{"login":"jsancio","id":794394,"avatar_url":"https://avatars.githubusercontent.com/u/794394?v=3","gravatar_id":"","url":"https://api.github.com/users/jsancio","html_url":"https://github.com/jsancio","followers_url":"https://api.github.com/users/jsancio/followers","following_url":"https://api.github.com/users/jsancio/following{/other_user}","gists_url":"https://api.github.com/users/jsancio/gists{/gist_id}","starred_url":"https://api.github.com/users/jsancio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsancio/subscriptions","organizations_url":"https://api.github.com/users/jsancio/orgs","repos_url":"https://api.github.com/users/jsancio/repos","events_url":"https://api.github.com/users/jsancio/events{/privacy}","received_events_url":"https://api.github.com/users/jsancio/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":0,"state":"open","created_at":"2016-08-11T21:35:42Z","updated_at":"2016-08-22T22:01:56Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dcos/cosmos/pulls/462/commits","review_comments_url":"https://api.github.com/repos/dcos/cosmos/pulls/462/comments","review_comment_url":"https://api.github.com/repos/dcos/cosmos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dcos/cosmos/issues/462/comments","statuses_url":"https://api.github.com/repos/dcos/cosmos/statuses/cbfc4e7e9a9618e6b7bafe403abe444edea2950c","head":{"label":"larioj:PackageStore","ref":"PackageStore","sha":"cbfc4e7e9a9618e6b7bafe403abe444edea2950c","user":{"login":"larioj","id":9968087,"avatar_url":"https://avatars.githubusercontent.com/u/9968087?v=3","gravatar_id":"","url":"https://api.github.com/users/larioj","html_url":"https://github.com/larioj","followers_url":"https://api.github.com/users/larioj/followers","following_url":"https://api.github.com/users/larioj/following{/other_user}","gists_url":"https://api.github.com/users/larioj/gists{/gist_id}","starred_url":"https://api.github.com/users/larioj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larioj/subscriptions","organizations_url":"https://api.github.com/users/larioj/orgs","repos_url":"https://api.github.com/users/larioj/repos","events_url":"https://api.github.com/users/larioj/events{/privacy}","received_events_url":"https://api.github.com/users/larioj/received_events","type":"User","site_admin":false},"repo":{"id":62762410,"name":"cosmos","full_name":"larioj/cosmos","owner":{"login":"larioj","id":9968087,"avatar_url":"https://avatars.githubusercontent.com/u/9968087?v=3","gravatar_id":"","url":"https://api.github.com/users/larioj","html_url":"https://github.com/larioj","followers_url":"https://api.github.com/users/larioj/followers","following_url":"https://api.github.com/users/larioj/following{/other_user}","gists_url":"https://api.github.com/users/larioj/gists{/gist_id}","starred_url":"https://api.github.com/users/larioj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larioj/subscriptions","organizations_url":"https://api.github.com/users/larioj/orgs","repos_url":"https://api.github.com/users/larioj/repos","events_url":"https://api.github.com/users/larioj/events{/privacy}","received_events_url":"https://api.github.com/users/larioj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/larioj/cosmos","description":"An orderly, harmonius, complete system for DC/OS - package management","fork":true,"url":"https://api.github.com/repos/larioj/cosmos","forks_url":"https://api.github.com/repos/larioj/cosmos/forks","keys_url":"https://api.github.com/repos/larioj/cosmos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/larioj/cosmos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/larioj/cosmos/teams","hooks_url":"https://api.github.com/repos/larioj/cosmos/hooks","issue_events_url":"https://api.github.com/repos/larioj/cosmos/issues/events{/number}","events_url":"https://api.github.com/repos/larioj/cosmos/events","assignees_url":"https://api.github.com/repos/larioj/cosmos/assignees{/user}","branches_url":"https://api.github.com/repos/larioj/cosmos/branches{/branch}","tags_url":"https://api.github.com/repos/larioj/cosmos/tags","blobs_url":"https://api.github.com/repos/larioj/cosmos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/larioj/cosmos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/larioj/cosmos/git/refs{/sha}","trees_url":"https://api.github.com/repos/larioj/cosmos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/larioj/cosmos/statuses/{sha}","languages_url":"https://api.github.com/repos/larioj/cosmos/languages","stargazers_url":"https://api.github.com/repos/larioj/cosmos/stargazers","contributors_url":"https://api.github.com/repos/larioj/cosmos/contributors","subscribers_url":"https://api.github.com/repos/larioj/cosmos/subscribers","subscription_url":"https://api.github.com/repos/larioj/cosmos/subscription","commits_url":"https://api.github.com/repos/larioj/cosmos/commits{/sha}","git_commits_url":"https://api.github.com/repos/larioj/cosmos/git/commits{/sha}","comments_url":"https://api.github.com/repos/larioj/cosmos/comments{/number}","issue_comment_url":"https://api.github.com/repos/larioj/cosmos/issues/comments{/number}","contents_url":"https://api.github.com/repos/larioj/cosmos/contents/{+path}","compare_url":"https://api.github.com/repos/larioj/cosmos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/larioj/cosmos/merges","archive_url":"https://api.github.com/repos/larioj/cosmos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/larioj/cosmos/downloads","issues_url":"https://api.github.com/repos/larioj/cosmos/issues{/number}","pulls_url":"https://api.github.com/repos/larioj/cosmos/pulls{/number}","milestones_url":"https://api.github.com/repos/larioj/cosmos/milestones{/number}","notifications_url":"https://api.github.com/repos/larioj/cosmos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/larioj/cosmos/labels{/name}","releases_url":"https://api.github.com/repos/larioj/cosmos/releases{/id}","deployments_url":"https://api.github.com/repos/larioj/cosmos/deployments","created_at":"2016-07-07T00:33:47Z","updated_at":"2016-07-07T00:33:49Z","pushed_at":"2016-08-25T18:39:58Z","git_url":"git://github.com/larioj/cosmos.git","ssh_url":"git@github.com:larioj/cosmos.git","clone_url":"https://github.com/larioj/cosmos.git","svn_url":"https://github.com/larioj/cosmos","homepage":"","size":974,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"dcos:master","ref":"master","sha":"f9ae6a2e5408e14ca217ad0cd50112275a49bd27","user":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"repo":{"id":47585661,"name":"cosmos","full_name":"dcos/cosmos","owner":{"login":"dcos","id":17648048,"avatar_url":"https://avatars.githubusercontent.com/u/17648048?v=3","gravatar_id":"","url":"https://api.github.com/users/dcos","html_url":"https://github.com/dcos","followers_url":"https://api.github.com/users/dcos/followers","following_url":"https://api.github.com/users/dcos/following{/other_user}","gists_url":"https://api.github.com/users/dcos/gists{/gist_id}","starred_url":"https://api.github.com/users/dcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcos/subscriptions","organizations_url":"https://api.github.com/users/dcos/orgs","repos_url":"https://api.github.com/users/dcos/repos","events_url":"https://api.github.com/users/dcos/events{/privacy}","received_events_url":"https://api.github.com/users/dcos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dcos/cosmos","description":"An orderly, harmonius, complete system for DC/OS - package management","fork":false,"url":"https://api.github.com/repos/dcos/cosmos","forks_url":"https://api.github.com/repos/dcos/cosmos/forks","keys_url":"https://api.github.com/repos/dcos/cosmos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dcos/cosmos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dcos/cosmos/teams","hooks_url":"https://api.github.com/repos/dcos/cosmos/hooks","issue_events_url":"https://api.github.com/repos/dcos/cosmos/issues/events{/number}","events_url":"https://api.github.com/repos/dcos/cosmos/events","assignees_url":"https://api.github.com/repos/dcos/cosmos/assignees{/user}","branches_url":"https://api.github.com/repos/dcos/cosmos/branches{/branch}","tags_url":"https://api.github.com/repos/dcos/cosmos/tags","blobs_url":"https://api.github.com/repos/dcos/cosmos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dcos/cosmos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dcos/cosmos/git/refs{/sha}","trees_url":"https://api.github.com/repos/dcos/cosmos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dcos/cosmos/statuses/{sha}","languages_url":"https://api.github.com/repos/dcos/cosmos/languages","stargazers_url":"https://api.github.com/repos/dcos/cosmos/stargazers","contributors_url":"https://api.github.com/repos/dcos/cosmos/contributors","subscribers_url":"https://api.github.com/repos/dcos/cosmos/subscribers","subscription_url":"https://api.github.com/repos/dcos/cosmos/subscription","commits_url":"https://api.github.com/repos/dcos/cosmos/commits{/sha}","git_commits_url":"https://api.github.com/repos/dcos/cosmos/git/commits{/sha}","comments_url":"https://api.github.com/repos/dcos/cosmos/comments{/number}","issue_comment_url":"https://api.github.com/repos/dcos/cosmos/issues/comments{/number}","contents_url":"https://api.github.com/repos/dcos/cosmos/contents/{+path}","compare_url":"https://api.github.com/repos/dcos/cosmos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dcos/cosmos/merges","archive_url":"https://api.github.com/repos/dcos/cosmos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dcos/cosmos/downloads","issues_url":"https://api.github.com/repos/dcos/cosmos/issues{/number}","pulls_url":"https://api.github.com/repos/dcos/cosmos/pulls{/number}","milestones_url":"https://api.github.com/repos/dcos/cosmos/milestones{/number}","notifications_url":"https://api.github.com/repos/dcos/cosmos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dcos/cosmos/labels{/name}","releases_url":"https://api.github.com/repos/dcos/cosmos/releases{/id}","deployments_url":"https://api.github.com/repos/dcos/cosmos/deployments","created_at":"2015-12-07T23:23:49Z","updated_at":"2016-08-24T19:38:57Z","pushed_at":"2016-08-25T18:39:58Z","git_url":"git://github.com/dcos/cosmos.git","ssh_url":"git@github.com:dcos/cosmos.git","clone_url":"https://github.com/dcos/cosmos.git","svn_url":"https://github.com/dcos/cosmos","homepage":"","size":1136,"stargazers_count":32,"watchers_count":32,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":64,"forks":12,"open_issues":64,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dcos/cosmos/pulls/462"},"html":{"href":"https://github.com/dcos/cosmos/pull/462"},"issue":{"href":"https://api.github.com/repos/dcos/cosmos/issues/462"},"comments":{"href":"https://api.github.com/repos/dcos/cosmos/issues/462/comments"},"review_comments":{"href":"https://api.github.com/repos/dcos/cosmos/pulls/462/comments"},"review_comment":{"href":"https://api.github.com/repos/dcos/cosmos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dcos/cosmos/pulls/462/commits"},"statuses":{"href":"https://api.github.com/repos/dcos/cosmos/statuses/cbfc4e7e9a9618e6b7bafe403abe444edea2950c"}}}}
{"actor":{"display_login":"cruhland"}}