{"action":"created","comment":{"url":"https://api.github.com/repos/motech-implementations/mim/pulls/comments/31643059","id":31643059,"diff_hunk":"@@ -0,0 +1,165 @@\n+package org.motechproject.nms.testing.it.flw;\n+\n+import org.joda.time.DateTime;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.junit.runner.RunWith;\n+import org.motechproject.nms.flw.domain.FrontLineWorker;\n+import org.motechproject.nms.flw.domain.FrontLineWorkerStatus;\n+import org.motechproject.nms.flw.repository.FrontLineWorkerDataService;\n+import org.motechproject.nms.flw.service.FrontLineWorkerImportService;\n+import org.motechproject.nms.region.domain.Circle;\n+import org.motechproject.nms.region.domain.District;\n+import org.motechproject.nms.region.domain.Language;\n+import org.motechproject.nms.region.domain.LanguageLocation;\n+import org.motechproject.nms.region.domain.State;\n+import org.motechproject.nms.region.repository.CircleDataService;\n+import org.motechproject.nms.region.repository.DistrictDataService;\n+import org.motechproject.nms.region.repository.HealthBlockDataService;\n+import org.motechproject.nms.region.repository.HealthFacilityDataService;\n+import org.motechproject.nms.region.repository.HealthFacilityTypeDataService;\n+import org.motechproject.nms.region.repository.HealthSubFacilityDataService;\n+import org.motechproject.nms.region.repository.LanguageDataService;\n+import org.motechproject.nms.region.repository.LanguageLocationDataService;\n+import org.motechproject.nms.region.repository.NationalDefaultLanguageLocationDataService;\n+import org.motechproject.nms.region.repository.StateDataService;\n+import org.motechproject.nms.region.repository.TalukaDataService;\n+import org.motechproject.nms.region.repository.VillageDataService;\n+import org.motechproject.testing.osgi.BasePaxIT;\n+import org.motechproject.testing.osgi.container.MotechNativeTestContainerFactory;\n+import org.ops4j.pax.exam.ExamFactory;\n+import org.ops4j.pax.exam.junit.PaxExam;\n+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;\n+import org.ops4j.pax.exam.spi.reactors.PerSuite;\n+\n+import javax.inject.Inject;\n+import java.io.Reader;\n+import java.io.StringReader;\n+import java.util.Arrays;\n+\n+import static org.junit.Assert.assertEquals;\n+import static org.junit.Assert.assertNotNull;\n+import static org.motechproject.nms.testing.it.utils.LocationDataUtils.createCircle;\n+import static org.motechproject.nms.testing.it.utils.LocationDataUtils.createDistrict;\n+import static org.motechproject.nms.testing.it.utils.LocationDataUtils.createLanguage;\n+import static org.motechproject.nms.testing.it.utils.LocationDataUtils.createLanguageLocation;\n+import static org.motechproject.nms.testing.it.utils.LocationDataUtils.createState;\n+\n+@RunWith(PaxExam.class)\n+@ExamReactorStrategy(PerSuite.class)\n+@ExamFactory(MotechNativeTestContainerFactory.class)\n+public class FrontLineWorkerImportServiceBundleIT extends BasePaxIT {\n+\n+    @Inject\n+    private NationalDefaultLanguageLocationDataService nationalDefaultLanguageLocationDataService;\n+    @Inject\n+    private LanguageDataService languageDataService;\n+    @Inject\n+    private LanguageLocationDataService languageLocationDataService;\n+    @Inject\n+    private StateDataService stateDataService;\n+    @Inject\n+    private DistrictDataService districtDataService;\n+    @Inject\n+    private TalukaDataService talukaDataService;\n+    @Inject\n+    private VillageDataService villageDataService;\n+    @Inject\n+    private HealthBlockDataService healthBlockDataService;\n+    @Inject\n+    private HealthFacilityTypeDataService healthFacilityTypeDataService;\n+    @Inject\n+    private HealthFacilityDataService healthFacilityDataService;\n+    @Inject\n+    private HealthSubFacilityDataService healthSubFacilityDataService;\n+    @Inject\n+    private CircleDataService circleDataService;\n+    @Inject\n+    private FrontLineWorkerDataService frontLineWorkerDataService;\n+\n+    @Inject\n+    private FrontLineWorkerImportService frontLineWorkerImportService;\n+\n+    @Before\n+    public void setUp() {\n+        for (FrontLineWorker flw: frontLineWorkerDataService.retrieveAll()) {\n+            flw.setStatus(FrontLineWorkerStatus.INVALID);\n+            flw.setInvalidationDate(new DateTime().withDate(2011, 8, 1));\n+\n+            frontLineWorkerDataService.update(flw);\n+        }\n+        frontLineWorkerDataService.deleteAll();\n+        nationalDefaultLanguageLocationDataService.deleteAll();\n+        languageLocationDataService.deleteAll();\n+        languageDataService.deleteAll();\n+        healthSubFacilityDataService.deleteAll();\n+        healthFacilityDataService.deleteAll();\n+        healthFacilityTypeDataService.deleteAll();\n+        healthBlockDataService.deleteAll();\n+        villageDataService.deleteAll();\n+        talukaDataService.deleteAll();\n+        districtDataService.deleteAll();\n+        stateDataService.deleteAll();\n+        circleDataService.deleteAll();\n+","path":"testing/src/test/java/org/motechproject/nms/testing/it/flw/FrontLineWorkerImportServiceBundleIT.java","position":104,"original_position":104,"commit_id":"48c78f85ff02dc20232c24d584211047ec9e5e1d","original_commit_id":"48c78f85ff02dc20232c24d584211047ec9e5e1d","user":{"login":"larubbio","id":51527,"avatar_url":"https://avatars.githubusercontent.com/u/51527?v=3","gravatar_id":"","url":"https://api.github.com/users/larubbio","html_url":"https://github.com/larubbio","followers_url":"https://api.github.com/users/larubbio/followers","following_url":"https://api.github.com/users/larubbio/following{/other_user}","gists_url":"https://api.github.com/users/larubbio/gists{/gist_id}","starred_url":"https://api.github.com/users/larubbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larubbio/subscriptions","organizations_url":"https://api.github.com/users/larubbio/orgs","repos_url":"https://api.github.com/users/larubbio/repos","events_url":"https://api.github.com/users/larubbio/events{/privacy}","received_events_url":"https://api.github.com/users/larubbio/received_events","type":"User","site_admin":false},"body":"Instead of calling all of the deleteAll you can call TestingServiceImpl.clearDatabase()","created_at":"2015-06-03T16:43:18Z","updated_at":"2015-06-03T16:43:18Z","html_url":"https://github.com/motech-implementations/mim/pull/295#discussion_r31643059","pull_request_url":"https://api.github.com/repos/motech-implementations/mim/pulls/295","_links":{"self":{"href":"https://api.github.com/repos/motech-implementations/mim/pulls/comments/31643059"},"html":{"href":"https://github.com/motech-implementations/mim/pull/295#discussion_r31643059"},"pull_request":{"href":"https://api.github.com/repos/motech-implementations/mim/pulls/295"}}},"pull_request":{"url":"https://api.github.com/repos/motech-implementations/mim/pulls/295","id":36833611,"html_url":"https://github.com/motech-implementations/mim/pull/295","diff_url":"https://github.com/motech-implementations/mim/pull/295.diff","patch_url":"https://github.com/motech-implementations/mim/pull/295.patch","issue_url":"https://api.github.com/repos/motech-implementations/mim/issues/295","number":295,"state":"open","locked":false,"title":"#101: FLW Data Import","user":{"login":"kamknitt","id":5548137,"avatar_url":"https://avatars.githubusercontent.com/u/5548137?v=3","gravatar_id":"","url":"https://api.github.com/users/kamknitt","html_url":"https://github.com/kamknitt","followers_url":"https://api.github.com/users/kamknitt/followers","following_url":"https://api.github.com/users/kamknitt/following{/other_user}","gists_url":"https://api.github.com/users/kamknitt/gists{/gist_id}","starred_url":"https://api.github.com/users/kamknitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamknitt/subscriptions","organizations_url":"https://api.github.com/users/kamknitt/orgs","repos_url":"https://api.github.com/users/kamknitt/repos","events_url":"https://api.github.com/users/kamknitt/events{/privacy}","received_events_url":"https://api.github.com/users/kamknitt/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-03T13:44:03Z","updated_at":"2015-06-03T16:43:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15d65546059556efc25c0952336b46519cb96145","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/motech-implementations/mim/pulls/295/commits","review_comments_url":"https://api.github.com/repos/motech-implementations/mim/pulls/295/comments","review_comment_url":"https://api.github.com/repos/motech-implementations/mim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/motech-implementations/mim/issues/295/comments","statuses_url":"https://api.github.com/repos/motech-implementations/mim/statuses/48c78f85ff02dc20232c24d584211047ec9e5e1d","head":{"label":"motech-implementations:101","ref":"101","sha":"48c78f85ff02dc20232c24d584211047ec9e5e1d","user":{"login":"motech-implementations","id":6608253,"avatar_url":"https://avatars.githubusercontent.com/u/6608253?v=3","gravatar_id":"","url":"https://api.github.com/users/motech-implementations","html_url":"https://github.com/motech-implementations","followers_url":"https://api.github.com/users/motech-implementations/followers","following_url":"https://api.github.com/users/motech-implementations/following{/other_user}","gists_url":"https://api.github.com/users/motech-implementations/gists{/gist_id}","starred_url":"https://api.github.com/users/motech-implementations/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech-implementations/subscriptions","organizations_url":"https://api.github.com/users/motech-implementations/orgs","repos_url":"https://api.github.com/users/motech-implementations/repos","events_url":"https://api.github.com/users/motech-implementations/events{/privacy}","received_events_url":"https://api.github.com/users/motech-implementations/received_events","type":"Organization","site_admin":false},"repo":{"id":33508795,"name":"mim","full_name":"motech-implementations/mim","owner":{"login":"motech-implementations","id":6608253,"avatar_url":"https://avatars.githubusercontent.com/u/6608253?v=3","gravatar_id":"","url":"https://api.github.com/users/motech-implementations","html_url":"https://github.com/motech-implementations","followers_url":"https://api.github.com/users/motech-implementations/followers","following_url":"https://api.github.com/users/motech-implementations/following{/other_user}","gists_url":"https://api.github.com/users/motech-implementations/gists{/gist_id}","starred_url":"https://api.github.com/users/motech-implementations/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech-implementations/subscriptions","organizations_url":"https://api.github.com/users/motech-implementations/orgs","repos_url":"https://api.github.com/users/motech-implementations/repos","events_url":"https://api.github.com/users/motech-implementations/events{/privacy}","received_events_url":"https://api.github.com/users/motech-implementations/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/motech-implementations/mim","description":"mim","fork":false,"url":"https://api.github.com/repos/motech-implementations/mim","forks_url":"https://api.github.com/repos/motech-implementations/mim/forks","keys_url":"https://api.github.com/repos/motech-implementations/mim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/motech-implementations/mim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/motech-implementations/mim/teams","hooks_url":"https://api.github.com/repos/motech-implementations/mim/hooks","issue_events_url":"https://api.github.com/repos/motech-implementations/mim/issues/events{/number}","events_url":"https://api.github.com/repos/motech-implementations/mim/events","assignees_url":"https://api.github.com/repos/motech-implementations/mim/assignees{/user}","branches_url":"https://api.github.com/repos/motech-implementations/mim/branches{/branch}","tags_url":"https://api.github.com/repos/motech-implementations/mim/tags","blobs_url":"https://api.github.com/repos/motech-implementations/mim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/motech-implementations/mim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/motech-implementations/mim/git/refs{/sha}","trees_url":"https://api.github.com/repos/motech-implementations/mim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/motech-implementations/mim/statuses/{sha}","languages_url":"https://api.github.com/repos/motech-implementations/mim/languages","stargazers_url":"https://api.github.com/repos/motech-implementations/mim/stargazers","contributors_url":"https://api.github.com/repos/motech-implementations/mim/contributors","subscribers_url":"https://api.github.com/repos/motech-implementations/mim/subscribers","subscription_url":"https://api.github.com/repos/motech-implementations/mim/subscription","commits_url":"https://api.github.com/repos/motech-implementations/mim/commits{/sha}","git_commits_url":"https://api.github.com/repos/motech-implementations/mim/git/commits{/sha}","comments_url":"https://api.github.com/repos/motech-implementations/mim/comments{/number}","issue_comment_url":"https://api.github.com/repos/motech-implementations/mim/issues/comments{/number}","contents_url":"https://api.github.com/repos/motech-implementations/mim/contents/{+path}","compare_url":"https://api.github.com/repos/motech-implementations/mim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/motech-implementations/mim/merges","archive_url":"https://api.github.com/repos/motech-implementations/mim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/motech-implementations/mim/downloads","issues_url":"https://api.github.com/repos/motech-implementations/mim/issues{/number}","pulls_url":"https://api.github.com/repos/motech-implementations/mim/pulls{/number}","milestones_url":"https://api.github.com/repos/motech-implementations/mim/milestones{/number}","notifications_url":"https://api.github.com/repos/motech-implementations/mim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/motech-implementations/mim/labels{/name}","releases_url":"https://api.github.com/repos/motech-implementations/mim/releases{/id}","created_at":"2015-04-06T22:18:18Z","updated_at":"2015-05-09T02:09:40Z","pushed_at":"2015-06-03T13:44:04Z","git_url":"git://github.com/motech-implementations/mim.git","ssh_url":"git@github.com:motech-implementations/mim.git","clone_url":"https://github.com/motech-implementations/mim.git","svn_url":"https://github.com/motech-implementations/mim","homepage":null,"size":16899,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":60,"forks":3,"open_issues":60,"watchers":1,"default_branch":"master"}},"base":{"label":"motech-implementations:master","ref":"master","sha":"fa2dae12c34fdc149a84bed5dd05e16ebcf99cdb","user":{"login":"motech-implementations","id":6608253,"avatar_url":"https://avatars.githubusercontent.com/u/6608253?v=3","gravatar_id":"","url":"https://api.github.com/users/motech-implementations","html_url":"https://github.com/motech-implementations","followers_url":"https://api.github.com/users/motech-implementations/followers","following_url":"https://api.github.com/users/motech-implementations/following{/other_user}","gists_url":"https://api.github.com/users/motech-implementations/gists{/gist_id}","starred_url":"https://api.github.com/users/motech-implementations/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech-implementations/subscriptions","organizations_url":"https://api.github.com/users/motech-implementations/orgs","repos_url":"https://api.github.com/users/motech-implementations/repos","events_url":"https://api.github.com/users/motech-implementations/events{/privacy}","received_events_url":"https://api.github.com/users/motech-implementations/received_events","type":"Organization","site_admin":false},"repo":{"id":33508795,"name":"mim","full_name":"motech-implementations/mim","owner":{"login":"motech-implementations","id":6608253,"avatar_url":"https://avatars.githubusercontent.com/u/6608253?v=3","gravatar_id":"","url":"https://api.github.com/users/motech-implementations","html_url":"https://github.com/motech-implementations","followers_url":"https://api.github.com/users/motech-implementations/followers","following_url":"https://api.github.com/users/motech-implementations/following{/other_user}","gists_url":"https://api.github.com/users/motech-implementations/gists{/gist_id}","starred_url":"https://api.github.com/users/motech-implementations/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/motech-implementations/subscriptions","organizations_url":"https://api.github.com/users/motech-implementations/orgs","repos_url":"https://api.github.com/users/motech-implementations/repos","events_url":"https://api.github.com/users/motech-implementations/events{/privacy}","received_events_url":"https://api.github.com/users/motech-implementations/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/motech-implementations/mim","description":"mim","fork":false,"url":"https://api.github.com/repos/motech-implementations/mim","forks_url":"https://api.github.com/repos/motech-implementations/mim/forks","keys_url":"https://api.github.com/repos/motech-implementations/mim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/motech-implementations/mim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/motech-implementations/mim/teams","hooks_url":"https://api.github.com/repos/motech-implementations/mim/hooks","issue_events_url":"https://api.github.com/repos/motech-implementations/mim/issues/events{/number}","events_url":"https://api.github.com/repos/motech-implementations/mim/events","assignees_url":"https://api.github.com/repos/motech-implementations/mim/assignees{/user}","branches_url":"https://api.github.com/repos/motech-implementations/mim/branches{/branch}","tags_url":"https://api.github.com/repos/motech-implementations/mim/tags","blobs_url":"https://api.github.com/repos/motech-implementations/mim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/motech-implementations/mim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/motech-implementations/mim/git/refs{/sha}","trees_url":"https://api.github.com/repos/motech-implementations/mim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/motech-implementations/mim/statuses/{sha}","languages_url":"https://api.github.com/repos/motech-implementations/mim/languages","stargazers_url":"https://api.github.com/repos/motech-implementations/mim/stargazers","contributors_url":"https://api.github.com/repos/motech-implementations/mim/contributors","subscribers_url":"https://api.github.com/repos/motech-implementations/mim/subscribers","subscription_url":"https://api.github.com/repos/motech-implementations/mim/subscription","commits_url":"https://api.github.com/repos/motech-implementations/mim/commits{/sha}","git_commits_url":"https://api.github.com/repos/motech-implementations/mim/git/commits{/sha}","comments_url":"https://api.github.com/repos/motech-implementations/mim/comments{/number}","issue_comment_url":"https://api.github.com/repos/motech-implementations/mim/issues/comments{/number}","contents_url":"https://api.github.com/repos/motech-implementations/mim/contents/{+path}","compare_url":"https://api.github.com/repos/motech-implementations/mim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/motech-implementations/mim/merges","archive_url":"https://api.github.com/repos/motech-implementations/mim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/motech-implementations/mim/downloads","issues_url":"https://api.github.com/repos/motech-implementations/mim/issues{/number}","pulls_url":"https://api.github.com/repos/motech-implementations/mim/pulls{/number}","milestones_url":"https://api.github.com/repos/motech-implementations/mim/milestones{/number}","notifications_url":"https://api.github.com/repos/motech-implementations/mim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/motech-implementations/mim/labels{/name}","releases_url":"https://api.github.com/repos/motech-implementations/mim/releases{/id}","created_at":"2015-04-06T22:18:18Z","updated_at":"2015-05-09T02:09:40Z","pushed_at":"2015-06-03T13:44:04Z","git_url":"git://github.com/motech-implementations/mim.git","ssh_url":"git@github.com:motech-implementations/mim.git","clone_url":"https://github.com/motech-implementations/mim.git","svn_url":"https://github.com/motech-implementations/mim","homepage":null,"size":16899,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":60,"forks":3,"open_issues":60,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/motech-implementations/mim/pulls/295"},"html":{"href":"https://github.com/motech-implementations/mim/pull/295"},"issue":{"href":"https://api.github.com/repos/motech-implementations/mim/issues/295"},"comments":{"href":"https://api.github.com/repos/motech-implementations/mim/issues/295/comments"},"review_comments":{"href":"https://api.github.com/repos/motech-implementations/mim/pulls/295/comments"},"review_comment":{"href":"https://api.github.com/repos/motech-implementations/mim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/motech-implementations/mim/pulls/295/commits"},"statuses":{"href":"https://api.github.com/repos/motech-implementations/mim/statuses/48c78f85ff02dc20232c24d584211047ec9e5e1d"}}}}