{"action":"created","comment":{"url":"https://api.github.com/repos/threatgrid/ctia/pulls/comments/83395584","pull_request_review_id":4242691,"id":83395584,"diff_hunk":"@@ -0,0 +1,66 @@\n+(ns ctia.flows.hooks.redismq-event-hook-test\n+  (:require [clj-momo.test-helpers.core :as mth]\n+            [clojure.test :refer [deftest is join-fixtures testing use-fixtures]]\n+            [ctia.domain.entities :refer [schema-version]]\n+            [ctia.lib.redis :as lr]\n+            [redismq.core :as rmq]\n+            [ctia.flows.hooks.event-hooks :as hooks]\n+            [ctia.flows.hooks.event-hooks :as eh]\n+            \n+            [ctia.properties :refer [properties]]\n+            [ctim.domain.id :as id]\n+            [ctim.schemas.common :as c]\n+            [ctia.test-helpers\n+             [atom :as at-helpers]\n+             [core :as test-helpers :refer [post]]])\n+  (:import [java.util.concurrent CountDownLatch TimeUnit]))\n+\n+(defn fixture-properties:redismq-hook [f]\n+  (test-helpers/with-properties [\"ctia.hook.redismq.enabled\" true\n+                                 \"ctia.hook.redismq.queue-name\" \"test-ctim-event-queue\"]\n+    (f)))\n+\n+(use-fixtures :once mth/fixture-schema-validation)\n+\n+(use-fixtures :each (join-fixtures [test-helpers/fixture-properties:clean\n+                                    at-helpers/fixture-properties:atom-memory-store\n+                                    fixture-properties:redismq-hook\n+                                    test-helpers/fixture-ctia\n+                                    test-helpers/fixture-allow-all-auth]))\n+\n+(deftest ^:integration test-redismq\n+  (testing \"Events are published to redismq queue\"\n+    (let [queue (:queue (eh/redismq-publisher))]\n+      (rmq/flush-queue queue)\n+      (post \"ctia/judgement\"\n+            :body {:observable {:value \"1.2.3.4\"\n+                                :type \"ip\"}\n+                   :disposition 1\n+                   :source \"source\"\n+                   :tlp \"green\"\n+                   :priority 100\n+                   :severity 100\n+                   :confidence \"Low\"\n+                   :valid_time {:start_time \"2016-02-11T00:40:48.212-00:00\"}})\n+      (post \"ctia/judgement\"\n+            :body {:observable {:value \"1.2.3.4\"\n+                                :type \"ip\"}\n+                   :disposition 2\n+                   :source \"source\"\n+                   :tlp \"green\"\n+                   :priority 100\n+                   :severity 100\n+                   :confidence \"Low\"\n+                   :valid_time {:start_time \"2016-02-11T00:40:48.212-00:00\"}})\n+      (post \"ctia/judgement\"\n+            :body {:observable {:value \"1.2.3.4\"\n+                                :type \"ip\"}\n+                   :disposition 3\n+                   :source \"source\"\n+                   :tlp \"green\"\n+                   :priority 100\n+                   :severity 100\n+                   :confidence \"Low\"\n+                   :valid_time {:start_time \"2016-02-11T00:40:48.212-00:00\"}})\n+      (is (= 3 (rmq/current-depth queue)))\n+      )))","path":"test/ctia/flows/hooks/redismq_event_hook_test.clj","position":66,"original_position":66,"commit_id":"81599b908f3aa5f702d7f165fb4d8f91e45394cb","original_commit_id":"81599b908f3aa5f702d7f165fb4d8f91e45394cb","user":{"login":"yogsototh","id":93899,"avatar_url":"https://avatars.githubusercontent.com/u/93899?v=3","gravatar_id":"","url":"https://api.github.com/users/yogsototh","html_url":"https://github.com/yogsototh","followers_url":"https://api.github.com/users/yogsototh/followers","following_url":"https://api.github.com/users/yogsototh/following{/other_user}","gists_url":"https://api.github.com/users/yogsototh/gists{/gist_id}","starred_url":"https://api.github.com/users/yogsototh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yogsototh/subscriptions","organizations_url":"https://api.github.com/users/yogsototh/orgs","repos_url":"https://api.github.com/users/yogsototh/repos","events_url":"https://api.github.com/users/yogsototh/events{/privacy}","received_events_url":"https://api.github.com/users/yogsototh/received_events","type":"User","site_admin":false},"body":"Also it might be safer to check the values of queued entities.","created_at":"2016-10-14T10:21:47Z","updated_at":"2016-10-14T10:22:29Z","html_url":"https://github.com/threatgrid/ctia/pull/434#discussion_r83395584","pull_request_url":"https://api.github.com/repos/threatgrid/ctia/pulls/434","_links":{"self":{"href":"https://api.github.com/repos/threatgrid/ctia/pulls/comments/83395584"},"html":{"href":"https://github.com/threatgrid/ctia/pull/434#discussion_r83395584"},"pull_request":{"href":"https://api.github.com/repos/threatgrid/ctia/pulls/434"}}},"pull_request":{"url":"https://api.github.com/repos/threatgrid/ctia/pulls/434","id":89302106,"html_url":"https://github.com/threatgrid/ctia/pull/434","diff_url":"https://github.com/threatgrid/ctia/pull/434.diff","patch_url":"https://github.com/threatgrid/ctia/pull/434.patch","issue_url":"https://api.github.com/repos/threatgrid/ctia/issues/434","number":434,"state":"open","locked":false,"title":"RedisMQ Event Queue Hook","user":{"login":"craigbro","id":37200,"avatar_url":"https://avatars.githubusercontent.com/u/37200?v=3","gravatar_id":"","url":"https://api.github.com/users/craigbro","html_url":"https://github.com/craigbro","followers_url":"https://api.github.com/users/craigbro/followers","following_url":"https://api.github.com/users/craigbro/following{/other_user}","gists_url":"https://api.github.com/users/craigbro/gists{/gist_id}","starred_url":"https://api.github.com/users/craigbro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigbro/subscriptions","organizations_url":"https://api.github.com/users/craigbro/orgs","repos_url":"https://api.github.com/users/craigbro/repos","events_url":"https://api.github.com/users/craigbro/events{/privacy}","received_events_url":"https://api.github.com/users/craigbro/received_events","type":"User","site_admin":false},"body":"Add support for RedisMQ Event Queue, defaults to disabled","created_at":"2016-10-13T23:39:55Z","updated_at":"2016-10-14T10:22:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb43b576b5e3c327bea2bebc68e46ddfa19e75e7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/threatgrid/ctia/pulls/434/commits","review_comments_url":"https://api.github.com/repos/threatgrid/ctia/pulls/434/comments","review_comment_url":"https://api.github.com/repos/threatgrid/ctia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/threatgrid/ctia/issues/434/comments","statuses_url":"https://api.github.com/repos/threatgrid/ctia/statuses/81599b908f3aa5f702d7f165fb4d8f91e45394cb","head":{"label":"craigbro:redismq-hook","ref":"redismq-hook","sha":"81599b908f3aa5f702d7f165fb4d8f91e45394cb","user":{"login":"craigbro","id":37200,"avatar_url":"https://avatars.githubusercontent.com/u/37200?v=3","gravatar_id":"","url":"https://api.github.com/users/craigbro","html_url":"https://github.com/craigbro","followers_url":"https://api.github.com/users/craigbro/followers","following_url":"https://api.github.com/users/craigbro/following{/other_user}","gists_url":"https://api.github.com/users/craigbro/gists{/gist_id}","starred_url":"https://api.github.com/users/craigbro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigbro/subscriptions","organizations_url":"https://api.github.com/users/craigbro/orgs","repos_url":"https://api.github.com/users/craigbro/repos","events_url":"https://api.github.com/users/craigbro/events{/privacy}","received_events_url":"https://api.github.com/users/craigbro/received_events","type":"User","site_admin":false},"repo":{"id":55706211,"name":"ctia","full_name":"craigbro/ctia","owner":{"login":"craigbro","id":37200,"avatar_url":"https://avatars.githubusercontent.com/u/37200?v=3","gravatar_id":"","url":"https://api.github.com/users/craigbro","html_url":"https://github.com/craigbro","followers_url":"https://api.github.com/users/craigbro/followers","following_url":"https://api.github.com/users/craigbro/following{/other_user}","gists_url":"https://api.github.com/users/craigbro/gists{/gist_id}","starred_url":"https://api.github.com/users/craigbro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigbro/subscriptions","organizations_url":"https://api.github.com/users/craigbro/orgs","repos_url":"https://api.github.com/users/craigbro/repos","events_url":"https://api.github.com/users/craigbro/events{/privacy}","received_events_url":"https://api.github.com/users/craigbro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/craigbro/ctia","description":"Cisco Threat Intelligence API","fork":true,"url":"https://api.github.com/repos/craigbro/ctia","forks_url":"https://api.github.com/repos/craigbro/ctia/forks","keys_url":"https://api.github.com/repos/craigbro/ctia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craigbro/ctia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craigbro/ctia/teams","hooks_url":"https://api.github.com/repos/craigbro/ctia/hooks","issue_events_url":"https://api.github.com/repos/craigbro/ctia/issues/events{/number}","events_url":"https://api.github.com/repos/craigbro/ctia/events","assignees_url":"https://api.github.com/repos/craigbro/ctia/assignees{/user}","branches_url":"https://api.github.com/repos/craigbro/ctia/branches{/branch}","tags_url":"https://api.github.com/repos/craigbro/ctia/tags","blobs_url":"https://api.github.com/repos/craigbro/ctia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craigbro/ctia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craigbro/ctia/git/refs{/sha}","trees_url":"https://api.github.com/repos/craigbro/ctia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craigbro/ctia/statuses/{sha}","languages_url":"https://api.github.com/repos/craigbro/ctia/languages","stargazers_url":"https://api.github.com/repos/craigbro/ctia/stargazers","contributors_url":"https://api.github.com/repos/craigbro/ctia/contributors","subscribers_url":"https://api.github.com/repos/craigbro/ctia/subscribers","subscription_url":"https://api.github.com/repos/craigbro/ctia/subscription","commits_url":"https://api.github.com/repos/craigbro/ctia/commits{/sha}","git_commits_url":"https://api.github.com/repos/craigbro/ctia/git/commits{/sha}","comments_url":"https://api.github.com/repos/craigbro/ctia/comments{/number}","issue_comment_url":"https://api.github.com/repos/craigbro/ctia/issues/comments{/number}","contents_url":"https://api.github.com/repos/craigbro/ctia/contents/{+path}","compare_url":"https://api.github.com/repos/craigbro/ctia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craigbro/ctia/merges","archive_url":"https://api.github.com/repos/craigbro/ctia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craigbro/ctia/downloads","issues_url":"https://api.github.com/repos/craigbro/ctia/issues{/number}","pulls_url":"https://api.github.com/repos/craigbro/ctia/pulls{/number}","milestones_url":"https://api.github.com/repos/craigbro/ctia/milestones{/number}","notifications_url":"https://api.github.com/repos/craigbro/ctia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craigbro/ctia/labels{/name}","releases_url":"https://api.github.com/repos/craigbro/ctia/releases{/id}","deployments_url":"https://api.github.com/repos/craigbro/ctia/deployments","created_at":"2016-04-07T15:31:12Z","updated_at":"2016-04-07T15:31:13Z","pushed_at":"2016-10-14T00:28:51Z","git_url":"git://github.com/craigbro/ctia.git","ssh_url":"git@github.com:craigbro/ctia.git","clone_url":"https://github.com/craigbro/ctia.git","svn_url":"https://github.com/craigbro/ctia","homepage":"","size":2077,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"threatgrid:master","ref":"master","sha":"52bd5453f47defef73bb78461bd4dfa3479d7feb","user":{"login":"threatgrid","id":337733,"avatar_url":"https://avatars.githubusercontent.com/u/337733?v=3","gravatar_id":"","url":"https://api.github.com/users/threatgrid","html_url":"https://github.com/threatgrid","followers_url":"https://api.github.com/users/threatgrid/followers","following_url":"https://api.github.com/users/threatgrid/following{/other_user}","gists_url":"https://api.github.com/users/threatgrid/gists{/gist_id}","starred_url":"https://api.github.com/users/threatgrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/threatgrid/subscriptions","organizations_url":"https://api.github.com/users/threatgrid/orgs","repos_url":"https://api.github.com/users/threatgrid/repos","events_url":"https://api.github.com/users/threatgrid/events{/privacy}","received_events_url":"https://api.github.com/users/threatgrid/received_events","type":"Organization","site_admin":false},"repo":{"id":47668849,"name":"ctia","full_name":"threatgrid/ctia","owner":{"login":"threatgrid","id":337733,"avatar_url":"https://avatars.githubusercontent.com/u/337733?v=3","gravatar_id":"","url":"https://api.github.com/users/threatgrid","html_url":"https://github.com/threatgrid","followers_url":"https://api.github.com/users/threatgrid/followers","following_url":"https://api.github.com/users/threatgrid/following{/other_user}","gists_url":"https://api.github.com/users/threatgrid/gists{/gist_id}","starred_url":"https://api.github.com/users/threatgrid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/threatgrid/subscriptions","organizations_url":"https://api.github.com/users/threatgrid/orgs","repos_url":"https://api.github.com/users/threatgrid/repos","events_url":"https://api.github.com/users/threatgrid/events{/privacy}","received_events_url":"https://api.github.com/users/threatgrid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/threatgrid/ctia","description":"Cisco Threat Intelligence API","fork":false,"url":"https://api.github.com/repos/threatgrid/ctia","forks_url":"https://api.github.com/repos/threatgrid/ctia/forks","keys_url":"https://api.github.com/repos/threatgrid/ctia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/threatgrid/ctia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/threatgrid/ctia/teams","hooks_url":"https://api.github.com/repos/threatgrid/ctia/hooks","issue_events_url":"https://api.github.com/repos/threatgrid/ctia/issues/events{/number}","events_url":"https://api.github.com/repos/threatgrid/ctia/events","assignees_url":"https://api.github.com/repos/threatgrid/ctia/assignees{/user}","branches_url":"https://api.github.com/repos/threatgrid/ctia/branches{/branch}","tags_url":"https://api.github.com/repos/threatgrid/ctia/tags","blobs_url":"https://api.github.com/repos/threatgrid/ctia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/threatgrid/ctia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/threatgrid/ctia/git/refs{/sha}","trees_url":"https://api.github.com/repos/threatgrid/ctia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/threatgrid/ctia/statuses/{sha}","languages_url":"https://api.github.com/repos/threatgrid/ctia/languages","stargazers_url":"https://api.github.com/repos/threatgrid/ctia/stargazers","contributors_url":"https://api.github.com/repos/threatgrid/ctia/contributors","subscribers_url":"https://api.github.com/repos/threatgrid/ctia/subscribers","subscription_url":"https://api.github.com/repos/threatgrid/ctia/subscription","commits_url":"https://api.github.com/repos/threatgrid/ctia/commits{/sha}","git_commits_url":"https://api.github.com/repos/threatgrid/ctia/git/commits{/sha}","comments_url":"https://api.github.com/repos/threatgrid/ctia/comments{/number}","issue_comment_url":"https://api.github.com/repos/threatgrid/ctia/issues/comments{/number}","contents_url":"https://api.github.com/repos/threatgrid/ctia/contents/{+path}","compare_url":"https://api.github.com/repos/threatgrid/ctia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/threatgrid/ctia/merges","archive_url":"https://api.github.com/repos/threatgrid/ctia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/threatgrid/ctia/downloads","issues_url":"https://api.github.com/repos/threatgrid/ctia/issues{/number}","pulls_url":"https://api.github.com/repos/threatgrid/ctia/pulls{/number}","milestones_url":"https://api.github.com/repos/threatgrid/ctia/milestones{/number}","notifications_url":"https://api.github.com/repos/threatgrid/ctia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/threatgrid/ctia/labels{/name}","releases_url":"https://api.github.com/repos/threatgrid/ctia/releases{/id}","deployments_url":"https://api.github.com/repos/threatgrid/ctia/deployments","created_at":"2015-12-09T04:41:06Z","updated_at":"2016-09-04T09:52:57Z","pushed_at":"2016-10-14T00:28:52Z","git_url":"git://github.com/threatgrid/ctia.git","ssh_url":"git@github.com:threatgrid/ctia.git","clone_url":"https://github.com/threatgrid/ctia.git","svn_url":"https://github.com/threatgrid/ctia","homepage":"","size":2168,"stargazers_count":3,"watchers_count":3,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":71,"forks":9,"open_issues":71,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/threatgrid/ctia/pulls/434"},"html":{"href":"https://github.com/threatgrid/ctia/pull/434"},"issue":{"href":"https://api.github.com/repos/threatgrid/ctia/issues/434"},"comments":{"href":"https://api.github.com/repos/threatgrid/ctia/issues/434/comments"},"review_comments":{"href":"https://api.github.com/repos/threatgrid/ctia/pulls/434/comments"},"review_comment":{"href":"https://api.github.com/repos/threatgrid/ctia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/threatgrid/ctia/pulls/434/commits"},"statuses":{"href":"https://api.github.com/repos/threatgrid/ctia/statuses/81599b908f3aa5f702d7f165fb4d8f91e45394cb"}}}}
{"actor":{"display_login":"yogsototh"}}