{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/comments/49152317","id":49152317,"diff_hunk":"@@ -0,0 +1,178 @@\n+/*\n+ * Copyright 2015 Google Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * 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\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.google.gcloud.tests;\n+\n+import static java.nio.charset.StandardCharsets.UTF_8;\n+\n+import com.google.common.collect.ImmutableSet;\n+import com.google.gcloud.AuthCredentials;\n+import com.google.gcloud.bigquery.BaseTableInfo;\n+import com.google.gcloud.bigquery.BigQuery;\n+import com.google.gcloud.bigquery.BigQueryOptions;\n+import com.google.gcloud.bigquery.DatasetInfo;\n+import com.google.gcloud.bigquery.Field;\n+import com.google.gcloud.bigquery.Schema;\n+import com.google.gcloud.bigquery.TableId;\n+import com.google.gcloud.bigquery.TableInfo;\n+import com.google.gcloud.bigquery.testing.RemoteBigQueryHelper;\n+import com.google.gcloud.datastore.Datastore;\n+import com.google.gcloud.datastore.DatastoreOptions;\n+import com.google.gcloud.datastore.DateTime;\n+import com.google.gcloud.datastore.Entity;\n+import com.google.gcloud.datastore.Key;\n+import com.google.gcloud.datastore.KeyFactory;\n+import com.google.gcloud.resourcemanager.ProjectInfo;\n+import com.google.gcloud.resourcemanager.ResourceManager;\n+import com.google.gcloud.resourcemanager.ResourceManagerOptions;\n+import com.google.gcloud.storage.Blob;\n+import com.google.gcloud.storage.BlobId;\n+import com.google.gcloud.storage.BlobInfo;\n+import com.google.gcloud.storage.BucketInfo;\n+import com.google.gcloud.storage.Storage;\n+import com.google.gcloud.storage.StorageOptions;\n+import com.google.gcloud.storage.testing.RemoteGcsHelper;\n+\n+import java.io.IOException;\n+import java.io.PrintWriter;\n+import java.nio.ByteBuffer;\n+import java.nio.channels.WritableByteChannel;\n+import java.util.Iterator;\n+import java.util.Set;\n+\n+public class ServiceTests {\n+\n+  public static final Set<String> SUPPORTED_SERVICES =\n+      ImmutableSet.of(\"bigquery\", \"datastore\", \"resourcemanager\", \"storage\");\n+\n+  private static void runBigQueryActions(BigQuery bigquery, PrintWriter pw) {\n+    pw.println(\"Testing BigQuery.\");\n+    String datasetName = RemoteBigQueryHelper.generateDatasetName();\n+    bigquery.create(DatasetInfo.builder(datasetName).build());\n+    TableId tableId = TableId.of(datasetName, \"my_table\");\n+    BaseTableInfo info = bigquery.getTable(tableId);\n+    if (info == null) {\n+      pw.println(\"Creating table \" + tableId);\n+      Field integerField = Field.of(\"fieldName\", Field.Type.integer());\n+      bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));\n+    }\n+    RemoteBigQueryHelper.forceDelete(bigquery, datasetName);","path":"test-apps/shared/src/main/java/com/google/gcloud/tests/ServiceTests.java","position":72,"original_position":72,"commit_id":"59e0d0ac3e51156255792cea63c4381f03c24dd4","original_commit_id":"59e0d0ac3e51156255792cea63c4381f03c24dd4","user":{"login":"aozarov","id":8921691,"avatar_url":"https://avatars.githubusercontent.com/u/8921691?v=3","gravatar_id":"","url":"https://api.github.com/users/aozarov","html_url":"https://github.com/aozarov","followers_url":"https://api.github.com/users/aozarov/followers","following_url":"https://api.github.com/users/aozarov/following{/other_user}","gists_url":"https://api.github.com/users/aozarov/gists{/gist_id}","starred_url":"https://api.github.com/users/aozarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aozarov/subscriptions","organizations_url":"https://api.github.com/users/aozarov/orgs","repos_url":"https://api.github.com/users/aozarov/repos","events_url":"https://api.github.com/users/aozarov/events{/privacy}","received_events_url":"https://api.github.com/users/aozarov/received_events","type":"User","site_admin":false},"body":"A comment, saying that this test will create \"my_table\" and **delete** it at the end is important.\r\nAlso, maybe we should find an even more obscured name.","created_at":"2016-01-08T02:10:48Z","updated_at":"2016-01-08T02:10:48Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples/pull/3#discussion_r49152317","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/comments/49152317"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java-examples/pull/3#discussion_r49152317"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3","id":54847077,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples/pull/3","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples/pull/3.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples/pull/3.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues/3","number":3,"state":"open","locked":false,"title":"Create test apps","user":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-31T04:38:19Z","updated_at":"2016-01-08T02:10:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"409cd5cccbd09b464b69238d1e16c7133b632470","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues/3/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/statuses/59e0d0ac3e51156255792cea63c4381f03c24dd4","head":{"label":"ajkannan:add-tests-apps","ref":"add-tests-apps","sha":"59e0d0ac3e51156255792cea63c4381f03c24dd4","user":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"repo":{"id":47230707,"name":"gcloud-java-examples","full_name":"ajkannan/gcloud-java-examples","owner":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajkannan/gcloud-java-examples","description":"","fork":true,"url":"https://api.github.com/repos/ajkannan/gcloud-java-examples","forks_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/forks","keys_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/teams","hooks_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/hooks","issue_events_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/issues/events{/number}","events_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/events","assignees_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/assignees{/user}","branches_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/branches{/branch}","tags_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/tags","blobs_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/languages","stargazers_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/stargazers","contributors_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/contributors","subscribers_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/subscribers","subscription_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/subscription","commits_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/contents/{+path}","compare_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/merges","archive_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/downloads","issues_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/issues{/number}","pulls_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/labels{/name}","releases_url":"https://api.github.com/repos/ajkannan/gcloud-java-examples/releases{/id}","created_at":"2015-12-02T02:10:44Z","updated_at":"2015-12-02T02:10:44Z","pushed_at":"2016-01-07T21:56:28Z","git_url":"git://github.com/ajkannan/gcloud-java-examples.git","ssh_url":"git@github.com:ajkannan/gcloud-java-examples.git","clone_url":"https://github.com/ajkannan/gcloud-java-examples.git","svn_url":"https://github.com/ajkannan/gcloud-java-examples","homepage":null,"size":33,"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":"GoogleCloudPlatform:master","ref":"master","sha":"ea19575f9076426615b79c27662b68abe6bd54c5","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":46455682,"name":"gcloud-java-examples","full_name":"GoogleCloudPlatform/gcloud-java-examples","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples","description":"","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/releases{/id}","created_at":"2015-11-19T00:05:08Z","updated_at":"2015-12-01T00:12:22Z","pushed_at":"2016-01-07T21:56:28Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-java-examples.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-java-examples.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-java-examples","homepage":null,"size":20,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java-examples/pull/3"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues/3"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java-examples/statuses/59e0d0ac3e51156255792cea63c4381f03c24dd4"}}}}