{"action":"created","comment":{"url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/comments/51792327","id":51792327,"diff_hunk":"@@ -0,0 +1,73 @@\n+/*\n+ * Copyright 2016 Fluo authors (see AUTHORS)\n+ * \n+ * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\n+ * in compliance with the License. You may obtain a copy of the License at\n+ * \n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ * \n+ * Unless required by applicable law or agreed to in writing, software distributed under the License\n+ * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n+ * or implied. See the License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+\n+package io.fluo.recipes.accumulo.export;\n+\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.Map;\n+\n+import io.fluo.api.data.Bytes;\n+import io.fluo.api.data.RowColumn;\n+import org.apache.accumulo.core.data.Mutation;\n+import org.junit.Assert;\n+import org.junit.Test;\n+\n+public class DifferenceExportTest {\n+\n+  public class DiffExport extends DifferenceExport<String, String> {\n+\n+    DiffExport(String oldV, String newV) {\n+      super(oldV, newV);\n+    }\n+\n+    @Override\n+    protected Map<RowColumn, Bytes> generateData(String key, String val) {\n+      return (val == null) ? Collections.emptyMap() : Collections.singletonMap(new RowColumn(\"r:\"\n+          + key), Bytes.of(\"v:\" + val));\n+    }\n+  }\n+\n+  public static Mutation makePut(String key, String val, long seq) {\n+    Mutation m = new Mutation(\"r:\" + key);\n+    m.put(\"\", \"\", seq, \"v:\" + val);\n+    return m;\n+  }\n+\n+  public static Mutation makeDel(String key, String val) {\n+    Mutation m = new Mutation(\"r:\" + key);\n+    m.putDelete(\"\", \"\");\n+    return m;\n+  }\n+\n+  @Test\n+  public void testDifferenceExport() {\n+    Collection<Mutation> mutations;\n+\n+    mutations = new DiffExport(null, \"a\").toMutations(\"k1\", 1);\n+    Assert.assertEquals(1, mutations.size());\n+    Assert.assertTrue(mutations.contains(makePut(\"k1\", \"a\", 1)));\n+\n+    mutations = new DiffExport(\"b\", \"b\").toMutations(\"k2\", 2);\n+    Assert.assertEquals(0, mutations.size());\n+\n+    mutations = new DiffExport(\"c\", \"d\").toMutations(\"k3\", 3);\n+    Assert.assertEquals(1, mutations.size());\n+    Assert.assertTrue(mutations.contains(makePut(\"k3\", \"d\", 3)));\n+\n+    mutations = new DiffExport(\"e\", null).toMutations(\"k\", 4);\n+    Assert.assertEquals(1, mutations.size());\n+    Assert.assertTrue(mutations.contains(makeDel(\"k\", \"e\")));\n+  }","path":"modules/accumulo/src/test/java/io/fluo/recipes/accumulo/export/DifferenceExportTest.java","position":72,"original_position":72,"commit_id":"8a5ef4f5e871b2229c28a9c03eb9e2813f783c31","original_commit_id":"8a5ef4f5e871b2229c28a9c03eb9e2813f783c31","user":{"login":"keith-turner","id":1268739,"avatar_url":"https://avatars.githubusercontent.com/u/1268739?v=3","gravatar_id":"","url":"https://api.github.com/users/keith-turner","html_url":"https://github.com/keith-turner","followers_url":"https://api.github.com/users/keith-turner/followers","following_url":"https://api.github.com/users/keith-turner/following{/other_user}","gists_url":"https://api.github.com/users/keith-turner/gists{/gist_id}","starred_url":"https://api.github.com/users/keith-turner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keith-turner/subscriptions","organizations_url":"https://api.github.com/users/keith-turner/orgs","repos_url":"https://api.github.com/users/keith-turner/repos","events_url":"https://api.github.com/users/keith-turner/events{/privacy}","received_events_url":"https://api.github.com/users/keith-turner/received_events","type":"User","site_admin":false},"body":"need to test case that generates a put and a delete","created_at":"2016-02-03T21:45:46Z","updated_at":"2016-02-03T21:45:46Z","html_url":"https://github.com/fluo-io/fluo-recipes/pull/51#discussion_r51792327","pull_request_url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51","_links":{"self":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/comments/51792327"},"html":{"href":"https://github.com/fluo-io/fluo-recipes/pull/51#discussion_r51792327"},"pull_request":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51"}}},"pull_request":{"url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51","id":58058280,"html_url":"https://github.com/fluo-io/fluo-recipes/pull/51","diff_url":"https://github.com/fluo-io/fluo-recipes/pull/51.diff","patch_url":"https://github.com/fluo-io/fluo-recipes/pull/51.patch","issue_url":"https://api.github.com/repos/fluo-io/fluo-recipes/issues/51","number":51,"state":"open","locked":false,"title":"AccumuloExporter now exports AccumuloExports to allow different value…","user":{"login":"mikewalch","id":730698,"avatar_url":"https://avatars.githubusercontent.com/u/730698?v=3","gravatar_id":"","url":"https://api.github.com/users/mikewalch","html_url":"https://github.com/mikewalch","followers_url":"https://api.github.com/users/mikewalch/followers","following_url":"https://api.github.com/users/mikewalch/following{/other_user}","gists_url":"https://api.github.com/users/mikewalch/gists{/gist_id}","starred_url":"https://api.github.com/users/mikewalch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikewalch/subscriptions","organizations_url":"https://api.github.com/users/mikewalch/orgs","repos_url":"https://api.github.com/users/mikewalch/repos","events_url":"https://api.github.com/users/mikewalch/events{/privacy}","received_events_url":"https://api.github.com/users/mikewalch/received_events","type":"User","site_admin":false},"body":"…s types to share the export queue.\r\n\r\nCreated DifferenceExport class which creates mutations by comparing the old and new data.  Created unit\r\ntest for DifferenceExport class.","created_at":"2016-02-02T22:08:24Z","updated_at":"2016-02-03T21:45:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53432961707d96ff39c72c9326ef6b5e078bfd09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51/commits","review_comments_url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51/comments","review_comment_url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fluo-io/fluo-recipes/issues/51/comments","statuses_url":"https://api.github.com/repos/fluo-io/fluo-recipes/statuses/8a5ef4f5e871b2229c28a9c03eb9e2813f783c31","head":{"label":"mikewalch:accumulo-export","ref":"accumulo-export","sha":"8a5ef4f5e871b2229c28a9c03eb9e2813f783c31","user":{"login":"mikewalch","id":730698,"avatar_url":"https://avatars.githubusercontent.com/u/730698?v=3","gravatar_id":"","url":"https://api.github.com/users/mikewalch","html_url":"https://github.com/mikewalch","followers_url":"https://api.github.com/users/mikewalch/followers","following_url":"https://api.github.com/users/mikewalch/following{/other_user}","gists_url":"https://api.github.com/users/mikewalch/gists{/gist_id}","starred_url":"https://api.github.com/users/mikewalch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikewalch/subscriptions","organizations_url":"https://api.github.com/users/mikewalch/orgs","repos_url":"https://api.github.com/users/mikewalch/repos","events_url":"https://api.github.com/users/mikewalch/events{/privacy}","received_events_url":"https://api.github.com/users/mikewalch/received_events","type":"User","site_admin":false},"repo":{"id":42184370,"name":"fluo-recipes","full_name":"mikewalch/fluo-recipes","owner":{"login":"mikewalch","id":730698,"avatar_url":"https://avatars.githubusercontent.com/u/730698?v=3","gravatar_id":"","url":"https://api.github.com/users/mikewalch","html_url":"https://github.com/mikewalch","followers_url":"https://api.github.com/users/mikewalch/followers","following_url":"https://api.github.com/users/mikewalch/following{/other_user}","gists_url":"https://api.github.com/users/mikewalch/gists{/gist_id}","starred_url":"https://api.github.com/users/mikewalch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikewalch/subscriptions","organizations_url":"https://api.github.com/users/mikewalch/orgs","repos_url":"https://api.github.com/users/mikewalch/repos","events_url":"https://api.github.com/users/mikewalch/events{/privacy}","received_events_url":"https://api.github.com/users/mikewalch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mikewalch/fluo-recipes","description":"Implementation of common Fluo patterns","fork":true,"url":"https://api.github.com/repos/mikewalch/fluo-recipes","forks_url":"https://api.github.com/repos/mikewalch/fluo-recipes/forks","keys_url":"https://api.github.com/repos/mikewalch/fluo-recipes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikewalch/fluo-recipes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikewalch/fluo-recipes/teams","hooks_url":"https://api.github.com/repos/mikewalch/fluo-recipes/hooks","issue_events_url":"https://api.github.com/repos/mikewalch/fluo-recipes/issues/events{/number}","events_url":"https://api.github.com/repos/mikewalch/fluo-recipes/events","assignees_url":"https://api.github.com/repos/mikewalch/fluo-recipes/assignees{/user}","branches_url":"https://api.github.com/repos/mikewalch/fluo-recipes/branches{/branch}","tags_url":"https://api.github.com/repos/mikewalch/fluo-recipes/tags","blobs_url":"https://api.github.com/repos/mikewalch/fluo-recipes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikewalch/fluo-recipes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikewalch/fluo-recipes/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikewalch/fluo-recipes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikewalch/fluo-recipes/statuses/{sha}","languages_url":"https://api.github.com/repos/mikewalch/fluo-recipes/languages","stargazers_url":"https://api.github.com/repos/mikewalch/fluo-recipes/stargazers","contributors_url":"https://api.github.com/repos/mikewalch/fluo-recipes/contributors","subscribers_url":"https://api.github.com/repos/mikewalch/fluo-recipes/subscribers","subscription_url":"https://api.github.com/repos/mikewalch/fluo-recipes/subscription","commits_url":"https://api.github.com/repos/mikewalch/fluo-recipes/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikewalch/fluo-recipes/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikewalch/fluo-recipes/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikewalch/fluo-recipes/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikewalch/fluo-recipes/contents/{+path}","compare_url":"https://api.github.com/repos/mikewalch/fluo-recipes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikewalch/fluo-recipes/merges","archive_url":"https://api.github.com/repos/mikewalch/fluo-recipes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikewalch/fluo-recipes/downloads","issues_url":"https://api.github.com/repos/mikewalch/fluo-recipes/issues{/number}","pulls_url":"https://api.github.com/repos/mikewalch/fluo-recipes/pulls{/number}","milestones_url":"https://api.github.com/repos/mikewalch/fluo-recipes/milestones{/number}","notifications_url":"https://api.github.com/repos/mikewalch/fluo-recipes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikewalch/fluo-recipes/labels{/name}","releases_url":"https://api.github.com/repos/mikewalch/fluo-recipes/releases{/id}","deployments_url":"https://api.github.com/repos/mikewalch/fluo-recipes/deployments","created_at":"2015-09-09T14:40:18Z","updated_at":"2016-01-14T14:33:46Z","pushed_at":"2016-02-02T22:14:36Z","git_url":"git://github.com/mikewalch/fluo-recipes.git","ssh_url":"git@github.com:mikewalch/fluo-recipes.git","clone_url":"https://github.com/mikewalch/fluo-recipes.git","svn_url":"https://github.com/mikewalch/fluo-recipes","homepage":"http://fluo.io","size":195,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"fluo-io:master","ref":"master","sha":"6e98054bee1eab9a37df189f7a870e8a5744c952","user":{"login":"fluo-io","id":8184450,"avatar_url":"https://avatars.githubusercontent.com/u/8184450?v=3","gravatar_id":"","url":"https://api.github.com/users/fluo-io","html_url":"https://github.com/fluo-io","followers_url":"https://api.github.com/users/fluo-io/followers","following_url":"https://api.github.com/users/fluo-io/following{/other_user}","gists_url":"https://api.github.com/users/fluo-io/gists{/gist_id}","starred_url":"https://api.github.com/users/fluo-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fluo-io/subscriptions","organizations_url":"https://api.github.com/users/fluo-io/orgs","repos_url":"https://api.github.com/users/fluo-io/repos","events_url":"https://api.github.com/users/fluo-io/events{/privacy}","received_events_url":"https://api.github.com/users/fluo-io/received_events","type":"Organization","site_admin":false},"repo":{"id":41892061,"name":"fluo-recipes","full_name":"fluo-io/fluo-recipes","owner":{"login":"fluo-io","id":8184450,"avatar_url":"https://avatars.githubusercontent.com/u/8184450?v=3","gravatar_id":"","url":"https://api.github.com/users/fluo-io","html_url":"https://github.com/fluo-io","followers_url":"https://api.github.com/users/fluo-io/followers","following_url":"https://api.github.com/users/fluo-io/following{/other_user}","gists_url":"https://api.github.com/users/fluo-io/gists{/gist_id}","starred_url":"https://api.github.com/users/fluo-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fluo-io/subscriptions","organizations_url":"https://api.github.com/users/fluo-io/orgs","repos_url":"https://api.github.com/users/fluo-io/repos","events_url":"https://api.github.com/users/fluo-io/events{/privacy}","received_events_url":"https://api.github.com/users/fluo-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fluo-io/fluo-recipes","description":"Implementation of common Fluo patterns","fork":false,"url":"https://api.github.com/repos/fluo-io/fluo-recipes","forks_url":"https://api.github.com/repos/fluo-io/fluo-recipes/forks","keys_url":"https://api.github.com/repos/fluo-io/fluo-recipes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fluo-io/fluo-recipes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fluo-io/fluo-recipes/teams","hooks_url":"https://api.github.com/repos/fluo-io/fluo-recipes/hooks","issue_events_url":"https://api.github.com/repos/fluo-io/fluo-recipes/issues/events{/number}","events_url":"https://api.github.com/repos/fluo-io/fluo-recipes/events","assignees_url":"https://api.github.com/repos/fluo-io/fluo-recipes/assignees{/user}","branches_url":"https://api.github.com/repos/fluo-io/fluo-recipes/branches{/branch}","tags_url":"https://api.github.com/repos/fluo-io/fluo-recipes/tags","blobs_url":"https://api.github.com/repos/fluo-io/fluo-recipes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fluo-io/fluo-recipes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fluo-io/fluo-recipes/git/refs{/sha}","trees_url":"https://api.github.com/repos/fluo-io/fluo-recipes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fluo-io/fluo-recipes/statuses/{sha}","languages_url":"https://api.github.com/repos/fluo-io/fluo-recipes/languages","stargazers_url":"https://api.github.com/repos/fluo-io/fluo-recipes/stargazers","contributors_url":"https://api.github.com/repos/fluo-io/fluo-recipes/contributors","subscribers_url":"https://api.github.com/repos/fluo-io/fluo-recipes/subscribers","subscription_url":"https://api.github.com/repos/fluo-io/fluo-recipes/subscription","commits_url":"https://api.github.com/repos/fluo-io/fluo-recipes/commits{/sha}","git_commits_url":"https://api.github.com/repos/fluo-io/fluo-recipes/git/commits{/sha}","comments_url":"https://api.github.com/repos/fluo-io/fluo-recipes/comments{/number}","issue_comment_url":"https://api.github.com/repos/fluo-io/fluo-recipes/issues/comments{/number}","contents_url":"https://api.github.com/repos/fluo-io/fluo-recipes/contents/{+path}","compare_url":"https://api.github.com/repos/fluo-io/fluo-recipes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fluo-io/fluo-recipes/merges","archive_url":"https://api.github.com/repos/fluo-io/fluo-recipes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fluo-io/fluo-recipes/downloads","issues_url":"https://api.github.com/repos/fluo-io/fluo-recipes/issues{/number}","pulls_url":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls{/number}","milestones_url":"https://api.github.com/repos/fluo-io/fluo-recipes/milestones{/number}","notifications_url":"https://api.github.com/repos/fluo-io/fluo-recipes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fluo-io/fluo-recipes/labels{/name}","releases_url":"https://api.github.com/repos/fluo-io/fluo-recipes/releases{/id}","deployments_url":"https://api.github.com/repos/fluo-io/fluo-recipes/deployments","created_at":"2015-09-04T01:24:21Z","updated_at":"2016-01-13T22:41:58Z","pushed_at":"2016-02-03T21:27:15Z","git_url":"git://github.com/fluo-io/fluo-recipes.git","ssh_url":"git@github.com:fluo-io/fluo-recipes.git","clone_url":"https://github.com/fluo-io/fluo-recipes.git","svn_url":"https://github.com/fluo-io/fluo-recipes","homepage":"http://fluo.io","size":199,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51"},"html":{"href":"https://github.com/fluo-io/fluo-recipes/pull/51"},"issue":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/issues/51"},"comments":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/fluo-io/fluo-recipes/statuses/8a5ef4f5e871b2229c28a9c03eb9e2813f783c31"}}}}