{"action":"created","comment":{"url":"https://api.github.com/repos/motech/motech/pulls/comments/54703118","id":54703118,"diff_hunk":"@@ -114,6 +129,56 @@ public void testMessageController() throws IOException, InterruptedException {\n         assertTrue(\"No messages listed\", json.size() > 0);\n     }\n \n+    @Test\n+    public void testUploadBundleFromRepository() throws IOException, InterruptedException {\n+        boolean isUploadSuccessful = uploadBundle(\"Repository\", \"org.motechproject:cms-lite:LATEST\", null, \"on\");\n+\n+        assertTrue(isUploadSuccessful);\n+    }\n+\n+    @Test\n+    public void testUploadBundleFromFile() throws IOException, InterruptedException {\n+        File file = new File(\"src/test/resources/motech-upload-test-bundle.jar\");\n+\n+        boolean isUploadSuccessful = uploadBundle(\"File\", null, file, \"on\");\n+\n+        assertTrue(isUploadSuccessful);\n+    }\n+\n+    private boolean uploadBundle(String moduleSource, String moduleId, File bundleFile, String startBundle) throws IOException, InterruptedException {\n+        String uri = String.format(\"http://%s:%d/admin/api/bundles/upload/\", HOST, PORT);\n+\n+        HttpPost httpPost = new HttpPost(uri);\n+        MultipartEntityBuilder entity = MultipartEntityBuilder.create();\n+        Charset chars = Charset.forName(\"UTF-8\");\n+        entity.setCharset(chars);\n+        entity.addTextBody(\"moduleSource\", moduleSource, ContentType.MULTIPART_FORM_DATA);\n+        if (moduleSource.equals(\"Repository\")) entity.addTextBody(\"moduleId\", moduleId, ContentType.MULTIPART_FORM_DATA);\n+        else if (moduleSource.equals(\"File\")) {\n+            if (bundleFile == null) {\n+                return false;\n+            }\n+            entity.addBinaryBody(\"bundleFile\", bundleFile);\n+        }\n+        else return false;\n+        entity.addTextBody(\"startBundle\", startBundle, ContentType.MULTIPART_FORM_DATA);\n+\n+        httpPost.setEntity(entity.build());\n+\n+        int bundlesCountBeforeUpload = bundleContext.getBundles().length;\n+        HttpResponse response = getHttpClient().execute(httpPost);\n+        EntityUtils.consume(response.getEntity());\n+        int bundlesCountAfterUpload = bundleContext.getBundles().length;\n+\n+        if (response.getStatusLine().getStatusCode() != 200) {\n+            return false;\n+        }\n+\n+        int bundleState = bundleContext.getBundles()[bundlesCountAfterUpload-1].getState();","path":"modules/admin/src/test/java/org/motechproject/admin/it/AdminBundleIT.java","position":94,"original_position":94,"commit_id":"7251c285b3a4aae99b4515af6dc0589edd09a535","original_commit_id":"7251c285b3a4aae99b4515af6dc0589edd09a535","user":{"login":"sebbrudzinski","id":8852946,"avatar_url":"https://avatars.githubusercontent.com/u/8852946?v=3","gravatar_id":"","url":"https://api.github.com/users/sebbrudzinski","html_url":"https://github.com/sebbrudzinski","followers_url":"https://api.github.com/users/sebbrudzinski/followers","following_url":"https://api.github.com/users/sebbrudzinski/following{/other_user}","gists_url":"https://api.github.com/users/sebbrudzinski/gists{/gist_id}","starred_url":"https://api.github.com/users/sebbrudzinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebbrudzinski/subscriptions","organizations_url":"https://api.github.com/users/sebbrudzinski/orgs","repos_url":"https://api.github.com/users/sebbrudzinski/repos","events_url":"https://api.github.com/users/sebbrudzinski/events{/privacy}","received_events_url":"https://api.github.com/users/sebbrudzinski/received_events","type":"User","site_admin":false},"body":"Is the order of the returned bundles guaranteed by the framework? If not, we should find the bundle by symbolic name.","created_at":"2016-03-02T10:08:50Z","updated_at":"2016-03-02T10:08:50Z","html_url":"https://github.com/motech/motech/pull/377#discussion_r54703118","pull_request_url":"https://api.github.com/repos/motech/motech/pulls/377","_links":{"self":{"href":"https://api.github.com/repos/motech/motech/pulls/comments/54703118"},"html":{"href":"https://github.com/motech/motech/pull/377#discussion_r54703118"},"pull_request":{"href":"https://api.github.com/repos/motech/motech/pulls/377"}}},"pull_request":{"url":"https://api.github.com/repos/motech/motech/pulls/377","id":60862307,"html_url":"https://github.com/motech/motech/pull/377","diff_url":"https://github.com/motech/motech/pull/377.diff","patch_url":"https://github.com/motech/motech/pull/377.patch","issue_url":"https://api.github.com/repos/motech/motech/issues/377","number":377,"state":"open","locked":false,"title":"MOTECH-1450 IT for adding modules at runtime through the Admin UI. Just for Repository","user":{"login":"lkukielka","id":17404322,"avatar_url":"https://avatars.githubusercontent.com/u/17404322?v=3","gravatar_id":"","url":"https://api.github.com/users/lkukielka","html_url":"https://github.com/lkukielka","followers_url":"https://api.github.com/users/lkukielka/followers","following_url":"https://api.github.com/users/lkukielka/following{/other_user}","gists_url":"https://api.github.com/users/lkukielka/gists{/gist_id}","starred_url":"https://api.github.com/users/lkukielka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lkukielka/subscriptions","organizations_url":"https://api.github.com/users/lkukielka/orgs","repos_url":"https://api.github.com/users/lkukielka/repos","events_url":"https://api.github.com/users/lkukielka/events{/privacy}","received_events_url":"https://api.github.com/users/lkukielka/received_events","type":"User","site_admin":false},"body":"First IT, only for Repository.","created_at":"2016-02-26T15:59:09Z","updated_at":"2016-03-02T10:08:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"affd0b0705ab584b6c363fa4c73bbafc8df81a1e","assignee":{"login":"sebbrudzinski","id":8852946,"avatar_url":"https://avatars.githubusercontent.com/u/8852946?v=3","gravatar_id":"","url":"https://api.github.com/users/sebbrudzinski","html_url":"https://github.com/sebbrudzinski","followers_url":"https://api.github.com/users/sebbrudzinski/followers","following_url":"https://api.github.com/users/sebbrudzinski/following{/other_user}","gists_url":"https://api.github.com/users/sebbrudzinski/gists{/gist_id}","starred_url":"https://api.github.com/users/sebbrudzinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebbrudzinski/subscriptions","organizations_url":"https://api.github.com/users/sebbrudzinski/orgs","repos_url":"https://api.github.com/users/sebbrudzinski/repos","events_url":"https://api.github.com/users/sebbrudzinski/events{/privacy}","received_events_url":"https://api.github.com/users/sebbrudzinski/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/motech/motech/pulls/377/commits","review_comments_url":"https://api.github.com/repos/motech/motech/pulls/377/comments","review_comment_url":"https://api.github.com/repos/motech/motech/pulls/comments{/number}","comments_url":"https://api.github.com/repos/motech/motech/issues/377/comments","statuses_url":"https://api.github.com/repos/motech/motech/statuses/7251c285b3a4aae99b4515af6dc0589edd09a535","head":{"label":"lkukielka:MOTECH-1450","ref":"MOTECH-1450","sha":"7251c285b3a4aae99b4515af6dc0589edd09a535","user":{"login":"lkukielka","id":17404322,"avatar_url":"https://avatars.githubusercontent.com/u/17404322?v=3","gravatar_id":"","url":"https://api.github.com/users/lkukielka","html_url":"https://github.com/lkukielka","followers_url":"https://api.github.com/users/lkukielka/followers","following_url":"https://api.github.com/users/lkukielka/following{/other_user}","gists_url":"https://api.github.com/users/lkukielka/gists{/gist_id}","starred_url":"https://api.github.com/users/lkukielka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lkukielka/subscriptions","organizations_url":"https://api.github.com/users/lkukielka/orgs","repos_url":"https://api.github.com/users/lkukielka/repos","events_url":"https://api.github.com/users/lkukielka/events{/privacy}","received_events_url":"https://api.github.com/users/lkukielka/received_events","type":"User","site_admin":false},"repo":{"id":52283389,"name":"motech","full_name":"lkukielka/motech","owner":{"login":"lkukielka","id":17404322,"avatar_url":"https://avatars.githubusercontent.com/u/17404322?v=3","gravatar_id":"","url":"https://api.github.com/users/lkukielka","html_url":"https://github.com/lkukielka","followers_url":"https://api.github.com/users/lkukielka/followers","following_url":"https://api.github.com/users/lkukielka/following{/other_user}","gists_url":"https://api.github.com/users/lkukielka/gists{/gist_id}","starred_url":"https://api.github.com/users/lkukielka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lkukielka/subscriptions","organizations_url":"https://api.github.com/users/lkukielka/orgs","repos_url":"https://api.github.com/users/lkukielka/repos","events_url":"https://api.github.com/users/lkukielka/events{/privacy}","received_events_url":"https://api.github.com/users/lkukielka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lkukielka/motech","description":"Mobile Technology for Community Health","fork":true,"url":"https://api.github.com/repos/lkukielka/motech","forks_url":"https://api.github.com/repos/lkukielka/motech/forks","keys_url":"https://api.github.com/repos/lkukielka/motech/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lkukielka/motech/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lkukielka/motech/teams","hooks_url":"https://api.github.com/repos/lkukielka/motech/hooks","issue_events_url":"https://api.github.com/repos/lkukielka/motech/issues/events{/number}","events_url":"https://api.github.com/repos/lkukielka/motech/events","assignees_url":"https://api.github.com/repos/lkukielka/motech/assignees{/user}","branches_url":"https://api.github.com/repos/lkukielka/motech/branches{/branch}","tags_url":"https://api.github.com/repos/lkukielka/motech/tags","blobs_url":"https://api.github.com/repos/lkukielka/motech/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lkukielka/motech/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lkukielka/motech/git/refs{/sha}","trees_url":"https://api.github.com/repos/lkukielka/motech/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lkukielka/motech/statuses/{sha}","languages_url":"https://api.github.com/repos/lkukielka/motech/languages","stargazers_url":"https://api.github.com/repos/lkukielka/motech/stargazers","contributors_url":"https://api.github.com/repos/lkukielka/motech/contributors","subscribers_url":"https://api.github.com/repos/lkukielka/motech/subscribers","subscription_url":"https://api.github.com/repos/lkukielka/motech/subscription","commits_url":"https://api.github.com/repos/lkukielka/motech/commits{/sha}","git_commits_url":"https://api.github.com/repos/lkukielka/motech/git/commits{/sha}","comments_url":"https://api.github.com/repos/lkukielka/motech/comments{/number}","issue_comment_url":"https://api.github.com/repos/lkukielka/motech/issues/comments{/number}","contents_url":"https://api.github.com/repos/lkukielka/motech/contents/{+path}","compare_url":"https://api.github.com/repos/lkukielka/motech/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lkukielka/motech/merges","archive_url":"https://api.github.com/repos/lkukielka/motech/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lkukielka/motech/downloads","issues_url":"https://api.github.com/repos/lkukielka/motech/issues{/number}","pulls_url":"https://api.github.com/repos/lkukielka/motech/pulls{/number}","milestones_url":"https://api.github.com/repos/lkukielka/motech/milestones{/number}","notifications_url":"https://api.github.com/repos/lkukielka/motech/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lkukielka/motech/labels{/name}","releases_url":"https://api.github.com/repos/lkukielka/motech/releases{/id}","deployments_url":"https://api.github.com/repos/lkukielka/motech/deployments","created_at":"2016-02-22T15:31:48Z","updated_at":"2016-02-22T15:31:55Z","pushed_at":"2016-03-02T09:42:07Z","git_url":"git://github.com/lkukielka/motech.git","ssh_url":"git@github.com:lkukielka/motech.git","clone_url":"https://github.com/lkukielka/motech.git","svn_url":"https://github.com/lkukielka/motech","homepage":"http://docs.motechproject.org","size":43528,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"motech:master","ref":"master","sha":"a71987a60fd3683275db7d4851ae89f35a62646a","user":{"login":"motech","id":477919,"avatar_url":"https://avatars.githubusercontent.com/u/477919?v=3","gravatar_id":"","url":"https://api.github.com/users/motech","html_url":"https://github.com/motech","followers_url":"https://api.github.com/users/motech/followers","following_url":"https://api.github.com/users/motech/following{/other_user}","gists_url":"https://api.github.com/users/motech/gists{/gist_id}","starred_url":"https://api.github.com/users/motech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech/subscriptions","organizations_url":"https://api.github.com/users/motech/orgs","repos_url":"https://api.github.com/users/motech/repos","events_url":"https://api.github.com/users/motech/events{/privacy}","received_events_url":"https://api.github.com/users/motech/received_events","type":"Organization","site_admin":false},"repo":{"id":40527870,"name":"motech","full_name":"motech/motech","owner":{"login":"motech","id":477919,"avatar_url":"https://avatars.githubusercontent.com/u/477919?v=3","gravatar_id":"","url":"https://api.github.com/users/motech","html_url":"https://github.com/motech","followers_url":"https://api.github.com/users/motech/followers","following_url":"https://api.github.com/users/motech/following{/other_user}","gists_url":"https://api.github.com/users/motech/gists{/gist_id}","starred_url":"https://api.github.com/users/motech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech/subscriptions","organizations_url":"https://api.github.com/users/motech/orgs","repos_url":"https://api.github.com/users/motech/repos","events_url":"https://api.github.com/users/motech/events{/privacy}","received_events_url":"https://api.github.com/users/motech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/motech/motech","description":"Mobile Technology for Community Health","fork":false,"url":"https://api.github.com/repos/motech/motech","forks_url":"https://api.github.com/repos/motech/motech/forks","keys_url":"https://api.github.com/repos/motech/motech/keys{/key_id}","collaborators_url":"https://api.github.com/repos/motech/motech/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/motech/motech/teams","hooks_url":"https://api.github.com/repos/motech/motech/hooks","issue_events_url":"https://api.github.com/repos/motech/motech/issues/events{/number}","events_url":"https://api.github.com/repos/motech/motech/events","assignees_url":"https://api.github.com/repos/motech/motech/assignees{/user}","branches_url":"https://api.github.com/repos/motech/motech/branches{/branch}","tags_url":"https://api.github.com/repos/motech/motech/tags","blobs_url":"https://api.github.com/repos/motech/motech/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/motech/motech/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/motech/motech/git/refs{/sha}","trees_url":"https://api.github.com/repos/motech/motech/git/trees{/sha}","statuses_url":"https://api.github.com/repos/motech/motech/statuses/{sha}","languages_url":"https://api.github.com/repos/motech/motech/languages","stargazers_url":"https://api.github.com/repos/motech/motech/stargazers","contributors_url":"https://api.github.com/repos/motech/motech/contributors","subscribers_url":"https://api.github.com/repos/motech/motech/subscribers","subscription_url":"https://api.github.com/repos/motech/motech/subscription","commits_url":"https://api.github.com/repos/motech/motech/commits{/sha}","git_commits_url":"https://api.github.com/repos/motech/motech/git/commits{/sha}","comments_url":"https://api.github.com/repos/motech/motech/comments{/number}","issue_comment_url":"https://api.github.com/repos/motech/motech/issues/comments{/number}","contents_url":"https://api.github.com/repos/motech/motech/contents/{+path}","compare_url":"https://api.github.com/repos/motech/motech/compare/{base}...{head}","merges_url":"https://api.github.com/repos/motech/motech/merges","archive_url":"https://api.github.com/repos/motech/motech/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/motech/motech/downloads","issues_url":"https://api.github.com/repos/motech/motech/issues{/number}","pulls_url":"https://api.github.com/repos/motech/motech/pulls{/number}","milestones_url":"https://api.github.com/repos/motech/motech/milestones{/number}","notifications_url":"https://api.github.com/repos/motech/motech/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/motech/motech/labels{/name}","releases_url":"https://api.github.com/repos/motech/motech/releases{/id}","deployments_url":"https://api.github.com/repos/motech/motech/deployments","created_at":"2015-08-11T07:26:54Z","updated_at":"2016-01-12T16:30:12Z","pushed_at":"2016-03-02T09:42:08Z","git_url":"git://github.com/motech/motech.git","ssh_url":"git@github.com:motech/motech.git","clone_url":"https://github.com/motech/motech.git","svn_url":"https://github.com/motech/motech","homepage":"http://docs.motechproject.org","size":45044,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":21,"forks":31,"open_issues":21,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/motech/motech/pulls/377"},"html":{"href":"https://github.com/motech/motech/pull/377"},"issue":{"href":"https://api.github.com/repos/motech/motech/issues/377"},"comments":{"href":"https://api.github.com/repos/motech/motech/issues/377/comments"},"review_comments":{"href":"https://api.github.com/repos/motech/motech/pulls/377/comments"},"review_comment":{"href":"https://api.github.com/repos/motech/motech/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/motech/motech/pulls/377/commits"},"statuses":{"href":"https://api.github.com/repos/motech/motech/statuses/7251c285b3a4aae99b4515af6dc0589edd09a535"}}}}