{"action":"created","comment":{"url":"https://api.github.com/repos/jtalks-org/jcommune/pulls/comments/41701200","id":41701200,"diff_hunk":"@@ -0,0 +1,118 @@\n+/**\n+ * Copyright (C) 2011  JTalks.org Team\n+ * This library is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 2.1 of the License, or (at your option) any later version.\n+ * This library is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ * Lesser General Public License for more details.\n+ * You should have received a copy of the GNU Lesser General Public\n+ * License along with this library; if not, write to the Free Software\n+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n+ */\n+package org.jtalks.jcommune.model.dao.hibernate;\n+\n+import org.hibernate.SessionFactory;\n+import org.hibernate.classic.Session;\n+import org.jtalks.jcommune.model.dao.TopicDraftDao;\n+import org.jtalks.jcommune.model.entity.JCUser;\n+import org.jtalks.jcommune.model.entity.ObjectsFactory;\n+import org.jtalks.jcommune.model.entity.PersistedObjectsFactory;\n+import org.jtalks.jcommune.model.entity.TopicDraft;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.test.context.ContextConfiguration;\n+import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;\n+import org.springframework.test.context.transaction.TransactionConfiguration;\n+import org.springframework.transaction.annotation.Transactional;\n+import org.testng.annotations.BeforeMethod;\n+import org.testng.annotations.Test;\n+\n+import static org.testng.Assert.*;\n+\n+/**\n+ * @author Dmitry S. Dolzhenko\n+ */\n+@ContextConfiguration(locations = {\"classpath:/org/jtalks/jcommune/model/entity/applicationContext-dao.xml\"})\n+@TransactionConfiguration(transactionManager = \"transactionManager\", defaultRollback = true)\n+@Transactional\n+public class TopicDraftHibernateDaoTest extends AbstractTransactionalTestNGSpringContextTests {\n+    @Autowired\n+    private SessionFactory sessionFactory;\n+    @Autowired\n+    private TopicDraftDao dao;\n+\n+    private Session session;\n+\n+    @BeforeMethod\n+    public void setUp() throws Exception {\n+        session = sessionFactory.getCurrentSession();\n+        PersistedObjectsFactory.setSession(session);\n+    }\n+\n+    /*===== Common methods =====*/\n+\n+    @Test\n+    public void testGet() {\n+        TopicDraft topicDraft = PersistedObjectsFactory.getDefaultTopicDraft();\n+\n+        TopicDraft result = dao.get(topicDraft.getId());","path":"jcommune-model/src/test/java/org/jtalks/jcommune/model/dao/hibernate/TopicDraftHibernateDaoTest.java","position":60,"original_position":60,"commit_id":"a97532257c970fa565de99a4d2d2cd036cca7ea4","original_commit_id":"a97532257c970fa565de99a4d2d2cd036cca7ea4","user":{"login":"ctapobep","id":702510,"avatar_url":"https://avatars.githubusercontent.com/u/702510?v=3","gravatar_id":"","url":"https://api.github.com/users/ctapobep","html_url":"https://github.com/ctapobep","followers_url":"https://api.github.com/users/ctapobep/followers","following_url":"https://api.github.com/users/ctapobep/following{/other_user}","gists_url":"https://api.github.com/users/ctapobep/gists{/gist_id}","starred_url":"https://api.github.com/users/ctapobep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctapobep/subscriptions","organizations_url":"https://api.github.com/users/ctapobep/orgs","repos_url":"https://api.github.com/users/ctapobep/repos","events_url":"https://api.github.com/users/ctapobep/events{/privacy}","received_events_url":"https://api.github.com/users/ctapobep/received_events","type":"User","site_admin":false},"body":"This doesn't test anything unless you clear the session cache.","created_at":"2015-10-10T20:30:14Z","updated_at":"2015-10-10T20:30:14Z","html_url":"https://github.com/jtalks-org/jcommune/pull/133#discussion_r41701200","pull_request_url":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133","_links":{"self":{"href":"https://api.github.com/repos/jtalks-org/jcommune/pulls/comments/41701200"},"html":{"href":"https://github.com/jtalks-org/jcommune/pull/133#discussion_r41701200"},"pull_request":{"href":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133"}}},"pull_request":{"url":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133","id":47296194,"html_url":"https://github.com/jtalks-org/jcommune/pull/133","diff_url":"https://github.com/jtalks-org/jcommune/pull/133.diff","patch_url":"https://github.com/jtalks-org/jcommune/pull/133.patch","issue_url":"https://api.github.com/repos/jtalks-org/jcommune/issues/133","number":133,"state":"open","locked":false,"title":"JC-2201 Save Drafts on writing topics","user":{"login":"dsdolzhenko","id":1327453,"avatar_url":"https://avatars.githubusercontent.com/u/1327453?v=3","gravatar_id":"","url":"https://api.github.com/users/dsdolzhenko","html_url":"https://github.com/dsdolzhenko","followers_url":"https://api.github.com/users/dsdolzhenko/followers","following_url":"https://api.github.com/users/dsdolzhenko/following{/other_user}","gists_url":"https://api.github.com/users/dsdolzhenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dsdolzhenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsdolzhenko/subscriptions","organizations_url":"https://api.github.com/users/dsdolzhenko/orgs","repos_url":"https://api.github.com/users/dsdolzhenko/repos","events_url":"https://api.github.com/users/dsdolzhenko/events{/privacy}","received_events_url":"https://api.github.com/users/dsdolzhenko/received_events","type":"User","site_admin":false},"body":" - add new entities: TopicDraft and PollDraft\r\n - add DAO and services for manipulate with draft topics\r\n - add methods into TopicController for save, update and delete draft topics\r\n - update TopicController, CodeReviewController and\r\n    QuestionAndAnswerController for showing saved drafts","created_at":"2015-10-09T17:07:41Z","updated_at":"2015-10-10T20:30:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3aecdd3b0fbf74ab189d24d852c3c5330abe92fb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133/commits","review_comments_url":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133/comments","review_comment_url":"https://api.github.com/repos/jtalks-org/jcommune/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jtalks-org/jcommune/issues/133/comments","statuses_url":"https://api.github.com/repos/jtalks-org/jcommune/statuses/a97532257c970fa565de99a4d2d2cd036cca7ea4","head":{"label":"dsdolzhenko:JC-2201","ref":"JC-2201","sha":"a97532257c970fa565de99a4d2d2cd036cca7ea4","user":{"login":"dsdolzhenko","id":1327453,"avatar_url":"https://avatars.githubusercontent.com/u/1327453?v=3","gravatar_id":"","url":"https://api.github.com/users/dsdolzhenko","html_url":"https://github.com/dsdolzhenko","followers_url":"https://api.github.com/users/dsdolzhenko/followers","following_url":"https://api.github.com/users/dsdolzhenko/following{/other_user}","gists_url":"https://api.github.com/users/dsdolzhenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dsdolzhenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsdolzhenko/subscriptions","organizations_url":"https://api.github.com/users/dsdolzhenko/orgs","repos_url":"https://api.github.com/users/dsdolzhenko/repos","events_url":"https://api.github.com/users/dsdolzhenko/events{/privacy}","received_events_url":"https://api.github.com/users/dsdolzhenko/received_events","type":"User","site_admin":false},"repo":{"id":43314055,"name":"jcommune","full_name":"dsdolzhenko/jcommune","owner":{"login":"dsdolzhenko","id":1327453,"avatar_url":"https://avatars.githubusercontent.com/u/1327453?v=3","gravatar_id":"","url":"https://api.github.com/users/dsdolzhenko","html_url":"https://github.com/dsdolzhenko","followers_url":"https://api.github.com/users/dsdolzhenko/followers","following_url":"https://api.github.com/users/dsdolzhenko/following{/other_user}","gists_url":"https://api.github.com/users/dsdolzhenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dsdolzhenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsdolzhenko/subscriptions","organizations_url":"https://api.github.com/users/dsdolzhenko/orgs","repos_url":"https://api.github.com/users/dsdolzhenko/repos","events_url":"https://api.github.com/users/dsdolzhenko/events{/privacy}","received_events_url":"https://api.github.com/users/dsdolzhenko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dsdolzhenko/jcommune","description":"JTalks JCommune - a forum engine","fork":true,"url":"https://api.github.com/repos/dsdolzhenko/jcommune","forks_url":"https://api.github.com/repos/dsdolzhenko/jcommune/forks","keys_url":"https://api.github.com/repos/dsdolzhenko/jcommune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dsdolzhenko/jcommune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dsdolzhenko/jcommune/teams","hooks_url":"https://api.github.com/repos/dsdolzhenko/jcommune/hooks","issue_events_url":"https://api.github.com/repos/dsdolzhenko/jcommune/issues/events{/number}","events_url":"https://api.github.com/repos/dsdolzhenko/jcommune/events","assignees_url":"https://api.github.com/repos/dsdolzhenko/jcommune/assignees{/user}","branches_url":"https://api.github.com/repos/dsdolzhenko/jcommune/branches{/branch}","tags_url":"https://api.github.com/repos/dsdolzhenko/jcommune/tags","blobs_url":"https://api.github.com/repos/dsdolzhenko/jcommune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dsdolzhenko/jcommune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dsdolzhenko/jcommune/git/refs{/sha}","trees_url":"https://api.github.com/repos/dsdolzhenko/jcommune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dsdolzhenko/jcommune/statuses/{sha}","languages_url":"https://api.github.com/repos/dsdolzhenko/jcommune/languages","stargazers_url":"https://api.github.com/repos/dsdolzhenko/jcommune/stargazers","contributors_url":"https://api.github.com/repos/dsdolzhenko/jcommune/contributors","subscribers_url":"https://api.github.com/repos/dsdolzhenko/jcommune/subscribers","subscription_url":"https://api.github.com/repos/dsdolzhenko/jcommune/subscription","commits_url":"https://api.github.com/repos/dsdolzhenko/jcommune/commits{/sha}","git_commits_url":"https://api.github.com/repos/dsdolzhenko/jcommune/git/commits{/sha}","comments_url":"https://api.github.com/repos/dsdolzhenko/jcommune/comments{/number}","issue_comment_url":"https://api.github.com/repos/dsdolzhenko/jcommune/issues/comments{/number}","contents_url":"https://api.github.com/repos/dsdolzhenko/jcommune/contents/{+path}","compare_url":"https://api.github.com/repos/dsdolzhenko/jcommune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dsdolzhenko/jcommune/merges","archive_url":"https://api.github.com/repos/dsdolzhenko/jcommune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dsdolzhenko/jcommune/downloads","issues_url":"https://api.github.com/repos/dsdolzhenko/jcommune/issues{/number}","pulls_url":"https://api.github.com/repos/dsdolzhenko/jcommune/pulls{/number}","milestones_url":"https://api.github.com/repos/dsdolzhenko/jcommune/milestones{/number}","notifications_url":"https://api.github.com/repos/dsdolzhenko/jcommune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dsdolzhenko/jcommune/labels{/name}","releases_url":"https://api.github.com/repos/dsdolzhenko/jcommune/releases{/id}","created_at":"2015-09-28T16:54:49Z","updated_at":"2015-09-28T16:54:55Z","pushed_at":"2015-10-10T15:28:31Z","git_url":"git://github.com/dsdolzhenko/jcommune.git","ssh_url":"git@github.com:dsdolzhenko/jcommune.git","clone_url":"https://github.com/dsdolzhenko/jcommune.git","svn_url":"https://github.com/dsdolzhenko/jcommune","homepage":"http://jtalks.org","size":38076,"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":"jtalks-org:master","ref":"master","sha":"eaae789bea33c590c4740ff4dc9a910f0d7354b9","user":{"login":"jtalks-org","id":702525,"avatar_url":"https://avatars.githubusercontent.com/u/702525?v=3","gravatar_id":"","url":"https://api.github.com/users/jtalks-org","html_url":"https://github.com/jtalks-org","followers_url":"https://api.github.com/users/jtalks-org/followers","following_url":"https://api.github.com/users/jtalks-org/following{/other_user}","gists_url":"https://api.github.com/users/jtalks-org/gists{/gist_id}","starred_url":"https://api.github.com/users/jtalks-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtalks-org/subscriptions","organizations_url":"https://api.github.com/users/jtalks-org/orgs","repos_url":"https://api.github.com/users/jtalks-org/repos","events_url":"https://api.github.com/users/jtalks-org/events{/privacy}","received_events_url":"https://api.github.com/users/jtalks-org/received_events","type":"Organization","site_admin":false},"repo":{"id":2316202,"name":"jcommune","full_name":"jtalks-org/jcommune","owner":{"login":"jtalks-org","id":702525,"avatar_url":"https://avatars.githubusercontent.com/u/702525?v=3","gravatar_id":"","url":"https://api.github.com/users/jtalks-org","html_url":"https://github.com/jtalks-org","followers_url":"https://api.github.com/users/jtalks-org/followers","following_url":"https://api.github.com/users/jtalks-org/following{/other_user}","gists_url":"https://api.github.com/users/jtalks-org/gists{/gist_id}","starred_url":"https://api.github.com/users/jtalks-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtalks-org/subscriptions","organizations_url":"https://api.github.com/users/jtalks-org/orgs","repos_url":"https://api.github.com/users/jtalks-org/repos","events_url":"https://api.github.com/users/jtalks-org/events{/privacy}","received_events_url":"https://api.github.com/users/jtalks-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jtalks-org/jcommune","description":"JTalks JCommune - a forum engine","fork":false,"url":"https://api.github.com/repos/jtalks-org/jcommune","forks_url":"https://api.github.com/repos/jtalks-org/jcommune/forks","keys_url":"https://api.github.com/repos/jtalks-org/jcommune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jtalks-org/jcommune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jtalks-org/jcommune/teams","hooks_url":"https://api.github.com/repos/jtalks-org/jcommune/hooks","issue_events_url":"https://api.github.com/repos/jtalks-org/jcommune/issues/events{/number}","events_url":"https://api.github.com/repos/jtalks-org/jcommune/events","assignees_url":"https://api.github.com/repos/jtalks-org/jcommune/assignees{/user}","branches_url":"https://api.github.com/repos/jtalks-org/jcommune/branches{/branch}","tags_url":"https://api.github.com/repos/jtalks-org/jcommune/tags","blobs_url":"https://api.github.com/repos/jtalks-org/jcommune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jtalks-org/jcommune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jtalks-org/jcommune/git/refs{/sha}","trees_url":"https://api.github.com/repos/jtalks-org/jcommune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jtalks-org/jcommune/statuses/{sha}","languages_url":"https://api.github.com/repos/jtalks-org/jcommune/languages","stargazers_url":"https://api.github.com/repos/jtalks-org/jcommune/stargazers","contributors_url":"https://api.github.com/repos/jtalks-org/jcommune/contributors","subscribers_url":"https://api.github.com/repos/jtalks-org/jcommune/subscribers","subscription_url":"https://api.github.com/repos/jtalks-org/jcommune/subscription","commits_url":"https://api.github.com/repos/jtalks-org/jcommune/commits{/sha}","git_commits_url":"https://api.github.com/repos/jtalks-org/jcommune/git/commits{/sha}","comments_url":"https://api.github.com/repos/jtalks-org/jcommune/comments{/number}","issue_comment_url":"https://api.github.com/repos/jtalks-org/jcommune/issues/comments{/number}","contents_url":"https://api.github.com/repos/jtalks-org/jcommune/contents/{+path}","compare_url":"https://api.github.com/repos/jtalks-org/jcommune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jtalks-org/jcommune/merges","archive_url":"https://api.github.com/repos/jtalks-org/jcommune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jtalks-org/jcommune/downloads","issues_url":"https://api.github.com/repos/jtalks-org/jcommune/issues{/number}","pulls_url":"https://api.github.com/repos/jtalks-org/jcommune/pulls{/number}","milestones_url":"https://api.github.com/repos/jtalks-org/jcommune/milestones{/number}","notifications_url":"https://api.github.com/repos/jtalks-org/jcommune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jtalks-org/jcommune/labels{/name}","releases_url":"https://api.github.com/repos/jtalks-org/jcommune/releases{/id}","created_at":"2011-09-02T20:12:43Z","updated_at":"2015-09-25T10:24:56Z","pushed_at":"2015-10-10T15:28:31Z","git_url":"git://github.com/jtalks-org/jcommune.git","ssh_url":"git@github.com:jtalks-org/jcommune.git","clone_url":"https://github.com/jtalks-org/jcommune.git","svn_url":"https://github.com/jtalks-org/jcommune","homepage":"http://jtalks.org","size":56344,"stargazers_count":56,"watchers_count":56,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":8,"forks":72,"open_issues":8,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133"},"html":{"href":"https://github.com/jtalks-org/jcommune/pull/133"},"issue":{"href":"https://api.github.com/repos/jtalks-org/jcommune/issues/133"},"comments":{"href":"https://api.github.com/repos/jtalks-org/jcommune/issues/133/comments"},"review_comments":{"href":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133/comments"},"review_comment":{"href":"https://api.github.com/repos/jtalks-org/jcommune/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jtalks-org/jcommune/pulls/133/commits"},"statuses":{"href":"https://api.github.com/repos/jtalks-org/jcommune/statuses/a97532257c970fa565de99a4d2d2cd036cca7ea4"}}}}