From 204a491d2321a5bc031dc187912176d17aff9a0e Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Thu, 6 Oct 2016 16:18:01 -0700 Subject: [PATCH 01/13] Add new quickstart samples. --- .../example/bigquery/QuickstartSample.java | 39 +++++++++++++++++ pubsub/cloud-client/pom.xml | 43 +++++++++++++++++++ .../com/example/pubsub/QuickstartSample.java | 37 ++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java create mode 100644 pubsub/cloud-client/pom.xml create mode 100644 pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java diff --git a/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java b/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java new file mode 100644 index 00000000000..0d16859acd7 --- /dev/null +++ b/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java @@ -0,0 +1,39 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.bigquery; + +// [START bigquery_quickstart] +// Imports the Google Cloud client library +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.Dataset; +import com.google.cloud.bigquery.DatasetInfo; + +public class QuickstartSample { + public static void main(String... args) throws Exception { + // Instantiates a client + BigQuery bigquery = BigQueryOptions.defaultInstance().service(); + // The name for the new dataset + String datasetName = "my_new_dataset"; + Dataset dataset = null; + DatasetInfo datasetInfo = DatasetInfo.builder(datasetName).build(); + // Creates the new dataset + dataset = bigquery.create(datasetInfo); + System.out.printf("Dataset %s created.%n", dataset.datasetId().dataset()); + } +} +// [END bigquery_quickstart] diff --git a/pubsub/cloud-client/pom.xml b/pubsub/cloud-client/pom.xml new file mode 100644 index 00000000000..89c38be7aa2 --- /dev/null +++ b/pubsub/cloud-client/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + come.example.pubsub + pubsub-google-cloud-samples + jar + + + + doc-samples + com.google.cloud + 1.0.0 + ../.. + + + + 1.8 + 1.8 + UTF-8 + + + + + com.google.cloud + google-cloud-pubsub + 0.4.0 + + + diff --git a/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java b/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java new file mode 100644 index 00000000000..3988c09b1c7 --- /dev/null +++ b/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java @@ -0,0 +1,37 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.pubsub; + +// [START pubsub_quickstart] +// Imports the Google Cloud client library +import com.google.cloud.pubsub.PubSub; +import com.google.cloud.pubsub.PubSubOptions; +import com.google.cloud.pubsub.Topic; +import com.google.cloud.pubsub.TopicInfo; + +public class QuickstartSample { + public static void main(String... args) throws Exception { + // Instantiates a client + PubSub pubsub = PubSubOptions.defaultInstance().service(); + // The name for the new topic + String topicName = "my-new-topic"; + // Creates the new topic + Topic topic = pubsub.create(TopicInfo.of(topicName)); + System.out.printf("Topic %s created.%n", topic.name()); + } +} +// [END pubsub_quickstart] From da12e72b31b4bfd97faff427d4c3e3bb7d1421c4 Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Thu, 6 Oct 2016 16:31:51 -0700 Subject: [PATCH 02/13] Add Datastore quickstart sample. --- datastore/cloud-client/pom.xml | 43 +++++++++++++++++ .../example/datastore/QuickstartSample.java | 46 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 datastore/cloud-client/pom.xml create mode 100644 datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java diff --git a/datastore/cloud-client/pom.xml b/datastore/cloud-client/pom.xml new file mode 100644 index 00000000000..4cd8b09d92a --- /dev/null +++ b/datastore/cloud-client/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + come.example.datastore + datastore-google-cloud-samples + jar + + + + doc-samples + com.google.cloud + 1.0.0 + ../.. + + + + 1.8 + 1.8 + UTF-8 + + + + + com.google.cloud + google-cloud-datastore + 0.4.0 + + + diff --git a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java new file mode 100644 index 00000000000..f595a391f97 --- /dev/null +++ b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java @@ -0,0 +1,46 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.datastore; + +// [START bigquery_quickstart] +// Imports the Google Cloud client library +import com.google.cloud.datastore.Datastore; +import com.google.cloud.datastore.DatastoreOptions; +import com.google.cloud.datastore.Entity; +import com.google.cloud.datastore.Key; +import com.google.cloud.datastore.KeyFactory; + +public class QuickstartSample { + public static void main(String... args) throws Exception { + // Instantiates a client + Datastore datastore = DatastoreOptions.defaultInstance().service(); + // The kind for the new entity + String kind = "Task"; + // The name/ID for the new entity + String name = "sampletask1"; + // The Cloud Datastore key for the new entity + Key taskKey = datastore.newKeyFactory().kind(kind).newKey(name); + // Prepares the new entity + Entity task = Entity.builder(taskKey) + .set("description", "Buy milk") + .build(); + // Saves the entity + datastore.put(task); + System.out.printf("Saved %s: %s%n", task.key().name(), task.getString("description")); + } +} +// [END bigquery_quickstart] From d9996e7d86da261cb438c42794f57e7d20bbd67c Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Thu, 6 Oct 2016 16:34:15 -0700 Subject: [PATCH 03/13] Remove import. --- .../src/main/java/com/example/datastore/QuickstartSample.java | 1 - 1 file changed, 1 deletion(-) diff --git a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java index f595a391f97..d2a85856f65 100644 --- a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java +++ b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java @@ -22,7 +22,6 @@ import com.google.cloud.datastore.DatastoreOptions; import com.google.cloud.datastore.Entity; import com.google.cloud.datastore.Key; -import com.google.cloud.datastore.KeyFactory; public class QuickstartSample { public static void main(String... args) throws Exception { From cb6521821b7c53ddf6c9673c60d52f4f35f851db Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Thu, 6 Oct 2016 16:34:59 -0700 Subject: [PATCH 04/13] Fixed region tag. --- .../src/main/java/com/example/datastore/QuickstartSample.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java index d2a85856f65..51704ffd8a9 100644 --- a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java +++ b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java @@ -16,7 +16,7 @@ package com.example.datastore; -// [START bigquery_quickstart] +// [START datastore_quickstart] // Imports the Google Cloud client library import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.DatastoreOptions; @@ -42,4 +42,4 @@ public static void main(String... args) throws Exception { System.out.printf("Saved %s: %s%n", task.key().name(), task.getString("description")); } } -// [END bigquery_quickstart] +// [END datastore_quickstart] From bb3f49ea4d05d1d0bdca65da8c904c19e943c1bc Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Thu, 6 Oct 2016 16:44:28 -0700 Subject: [PATCH 05/13] Add Translate API quickstart sample. --- translate/cloud-client/pom.xml | 43 +++++++++++++++++++ .../example/translate/QuickstartSample.java | 42 ++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 translate/cloud-client/pom.xml create mode 100644 translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java diff --git a/translate/cloud-client/pom.xml b/translate/cloud-client/pom.xml new file mode 100644 index 00000000000..cc2f51a0f6e --- /dev/null +++ b/translate/cloud-client/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + come.example.translate + translate-google-cloud-samples + jar + + + + doc-samples + com.google.cloud + 1.0.0 + ../.. + + + + 1.8 + 1.8 + UTF-8 + + + + + com.google.cloud + google-cloud-translate + 0.4.0 + + + diff --git a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java new file mode 100644 index 00000000000..4baf2633968 --- /dev/null +++ b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java @@ -0,0 +1,42 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.translate; + +// [START translate_quickstart] +// Imports the Google Cloud client library +import com.google.cloud.translate.Translate; +import com.google.cloud.translate.Translate.TranslateOption; +import com.google.cloud.translate.TranslateOptions; +import com.google.cloud.translate.Translation; + +public class QuickstartSample { + public static void main(String... args) throws Exception { + // Instantiates a client + Translate translate = TranslateOptions.builder().apiKey("YOUR_API_KEY").build().service(); + // The text to translate + String text = "Hello, world!"; + // Translates some text into Russian + Translation translation = translate.translate( + text, + TranslateOption.sourceLanguage("en"), + TranslateOption.targetLanguage("ru") + ); + System.out.printf("Text: %s%n", text); + System.out.printf("Translation: %s%n", translation.translatedText()); + } +} +// [END translate_quickstart] From 8a1d549f7b499858bacf09bca3af98a7b3421307 Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Fri, 7 Oct 2016 10:23:52 -0700 Subject: [PATCH 06/13] Add Storage quickstart sample. --- .../example/bigquery/QuickstartSample.java | 7 ++- .../example/datastore/QuickstartSample.java | 4 ++ .../com/example/pubsub/QuickstartSample.java | 3 ++ storage/cloud-client/pom.xml | 43 +++++++++++++++++++ .../com/example/storage/QuickstartSample.java | 40 +++++++++++++++++ .../example/translate/QuickstartSample.java | 3 ++ 6 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 storage/cloud-client/pom.xml create mode 100644 storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java diff --git a/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java b/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java index 0d16859acd7..aa727880cf9 100644 --- a/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java +++ b/bigquery/cloud-client/src/main/java/com/example/bigquery/QuickstartSample.java @@ -27,12 +27,17 @@ public class QuickstartSample { public static void main(String... args) throws Exception { // Instantiates a client BigQuery bigquery = BigQueryOptions.defaultInstance().service(); + // The name for the new dataset String datasetName = "my_new_dataset"; + + // Prepares a new dataset Dataset dataset = null; DatasetInfo datasetInfo = DatasetInfo.builder(datasetName).build(); - // Creates the new dataset + + // Creates the dataset dataset = bigquery.create(datasetInfo); + System.out.printf("Dataset %s created.%n", dataset.datasetId().dataset()); } } diff --git a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java index 51704ffd8a9..397e842d547 100644 --- a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java +++ b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java @@ -27,18 +27,22 @@ public class QuickstartSample { public static void main(String... args) throws Exception { // Instantiates a client Datastore datastore = DatastoreOptions.defaultInstance().service(); + // The kind for the new entity String kind = "Task"; // The name/ID for the new entity String name = "sampletask1"; // The Cloud Datastore key for the new entity Key taskKey = datastore.newKeyFactory().kind(kind).newKey(name); + // Prepares the new entity Entity task = Entity.builder(taskKey) .set("description", "Buy milk") .build(); + // Saves the entity datastore.put(task); + System.out.printf("Saved %s: %s%n", task.key().name(), task.getString("description")); } } diff --git a/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java b/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java index 3988c09b1c7..c5d97ed5087 100644 --- a/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java +++ b/pubsub/cloud-client/src/main/java/com/example/pubsub/QuickstartSample.java @@ -27,10 +27,13 @@ public class QuickstartSample { public static void main(String... args) throws Exception { // Instantiates a client PubSub pubsub = PubSubOptions.defaultInstance().service(); + // The name for the new topic String topicName = "my-new-topic"; + // Creates the new topic Topic topic = pubsub.create(TopicInfo.of(topicName)); + System.out.printf("Topic %s created.%n", topic.name()); } } diff --git a/storage/cloud-client/pom.xml b/storage/cloud-client/pom.xml new file mode 100644 index 00000000000..024c2aa85f7 --- /dev/null +++ b/storage/cloud-client/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + come.example.storage + storage-google-cloud-samples + jar + + + + doc-samples + com.google.cloud + 1.0.0 + ../.. + + + + 1.8 + 1.8 + UTF-8 + + + + + com.google.cloud + google-cloud-storage + 0.4.0 + + + diff --git a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java new file mode 100644 index 00000000000..83dce6ab0f2 --- /dev/null +++ b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java @@ -0,0 +1,40 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.storage; + +// [START storage_quickstart] +// Imports the Google Cloud client library +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import com.google.cloud.storage.Bucket; +import com.google.cloud.storage.BucketInfo; + +public class QuickstartSample { + public static void main(String... args) throws Exception { + // Instantiates a client + Storage storage = StorageOptions.defaultInstance().service(); + + // The name for the new bucket + String bucketName = "my-new-bucket"; + + // Creates the new bucket + Bucket bucket = storage.create(BucketInfo.of(bucketName)); + + System.out.printf("Bucket %s created.%n", bucket.name()); + } +} +// [END storage_quickstart] diff --git a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java index 4baf2633968..1baf95c74d1 100644 --- a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java +++ b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java @@ -27,14 +27,17 @@ public class QuickstartSample { public static void main(String... args) throws Exception { // Instantiates a client Translate translate = TranslateOptions.builder().apiKey("YOUR_API_KEY").build().service(); + // The text to translate String text = "Hello, world!"; + // Translates some text into Russian Translation translation = translate.translate( text, TranslateOption.sourceLanguage("en"), TranslateOption.targetLanguage("ru") ); + System.out.printf("Text: %s%n", text); System.out.printf("Translation: %s%n", translation.translatedText()); } From 7b4389bc3a8c28e680a07ced83f5f797ce1e3a58 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Mon, 24 Oct 2016 16:46:22 -0700 Subject: [PATCH 07/13] Add integration tests to BigQuery quickstart sample. --- bigquery/cloud-client/README.md | 4 ++ .../example/bigquery/QuickstartSampleIT.java | 72 +++++++++++++++++++ ...SampleTest.java => SyncQuerySampleIT.java} | 3 +- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 bigquery/cloud-client/src/test/java/com/example/bigquery/QuickstartSampleIT.java rename bigquery/cloud-client/src/test/java/com/example/bigquery/{SyncQuerySampleTest.java => SyncQuerySampleIT.java} (95%) diff --git a/bigquery/cloud-client/README.md b/bigquery/cloud-client/README.md index 1046596da9e..d067a8389d5 100644 --- a/bigquery/cloud-client/README.md +++ b/bigquery/cloud-client/README.md @@ -22,6 +22,10 @@ You can then run a given `ClassName` via: -DpropertyName=propertyValue \ -Dexec.args="any arguments to the app" +### Creating a new dataset (using the quickstart sample) + + mvn exec:java -Dexec.mainClass=com.example.bigquery.QuickstartSample + ### Running a synchronous query mvn exec:java -Dexec.mainClass=com.example.bigquery.SyncQuerySample \ diff --git a/bigquery/cloud-client/src/test/java/com/example/bigquery/QuickstartSampleIT.java b/bigquery/cloud-client/src/test/java/com/example/bigquery/QuickstartSampleIT.java new file mode 100644 index 00000000000..9632de23bc6 --- /dev/null +++ b/bigquery/cloud-client/src/test/java/com/example/bigquery/QuickstartSampleIT.java @@ -0,0 +1,72 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.bigquery; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.cloud.bigquery.BigQuery; +import com.google.cloud.bigquery.BigQuery.DatasetDeleteOption; +import com.google.cloud.bigquery.BigQueryOptions; +import com.google.cloud.bigquery.DatasetId; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * Tests for quickstart sample. + */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class QuickstartSampleIT { + private ByteArrayOutputStream bout; + private PrintStream out; + + private static final void deleteMyNewDataset() { + BigQuery bigquery = BigQueryOptions.defaultInstance().service(); + String datasetName = "my_new_dataset"; + DatasetId datasetId = DatasetId.of(datasetName); + DatasetDeleteOption deleteContents = DatasetDeleteOption.deleteContents(); + bigquery.delete(datasetId, deleteContents); + } + + @Before + public void setUp() { + deleteMyNewDataset(); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + deleteMyNewDataset(); + } + + @Test + public void testQuickstart() throws Exception { + QuickstartSample.main(); + String got = bout.toString(); + assertThat(got).contains("Dataset my_new_dataset created."); + } +} diff --git a/bigquery/cloud-client/src/test/java/com/example/bigquery/SyncQuerySampleTest.java b/bigquery/cloud-client/src/test/java/com/example/bigquery/SyncQuerySampleIT.java similarity index 95% rename from bigquery/cloud-client/src/test/java/com/example/bigquery/SyncQuerySampleTest.java rename to bigquery/cloud-client/src/test/java/com/example/bigquery/SyncQuerySampleIT.java index f606f2d9937..38359596e21 100644 --- a/bigquery/cloud-client/src/test/java/com/example/bigquery/SyncQuerySampleTest.java +++ b/bigquery/cloud-client/src/test/java/com/example/bigquery/SyncQuerySampleIT.java @@ -31,7 +31,8 @@ * Tests for synchronous query sample. */ @RunWith(JUnit4.class) -public class SyncQuerySampleTest { +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class SyncQuerySampleIT { private ByteArrayOutputStream bout; private PrintStream out; From 9c5635d8204b4a93fc8ab4a8aa8857c3a2576a7e Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Mon, 24 Oct 2016 17:29:58 -0700 Subject: [PATCH 08/13] Add integration tests for Datastore quickstart. --- bigquery/cloud-client/pom.xml | 2 +- datastore/cloud-client/README.md | 26 +++++++ datastore/cloud-client/pom.xml | 14 ++++ .../example/datastore/QuickstartSample.java | 4 +- .../example/datastore/QuickstartSampleIT.java | 72 +++++++++++++++++++ 5 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 datastore/cloud-client/README.md create mode 100644 datastore/cloud-client/src/test/java/com/example/datastore/QuickstartSampleIT.java diff --git a/bigquery/cloud-client/pom.xml b/bigquery/cloud-client/pom.xml index 680e3436154..887e1446cbb 100644 --- a/bigquery/cloud-client/pom.xml +++ b/bigquery/cloud-client/pom.xml @@ -50,7 +50,7 @@ com.google.truth truth - 0.29 + 0.30 test diff --git a/datastore/cloud-client/README.md b/datastore/cloud-client/README.md new file mode 100644 index 00000000000..26557f4e0ae --- /dev/null +++ b/datastore/cloud-client/README.md @@ -0,0 +1,26 @@ +# Getting Started with Cloud Datastore and the Google Cloud Client libraries + +[Google Cloud Datastore][Datastore] is a highly-scalable NoSQL database for your applications. +These sample Java applications demonstrate how to access the Datastore API using +the [Google Cloud Client Library for Java][google-cloud-java]. + +[Datastore]: https://cloud.google.com/datastore/ +[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java + +## Quickstart + +Install [Maven](http://maven.apache.org/). + +Build your project with: + + mvn clean package -DskipTests + +You can then run a given `ClassName` via: + + mvn exec:java -Dexec.mainClass=com.example.bigquery.ClassName \ + -DpropertyName=propertyValue \ + -Dexec.args="any arguments to the app" + +### Creating a new entity (using the quickstart sample) + + mvn exec:java -Dexec.mainClass=com.example.datastore.QuickstartSample diff --git a/datastore/cloud-client/pom.xml b/datastore/cloud-client/pom.xml index 4cd8b09d92a..105ac0f8bb9 100644 --- a/datastore/cloud-client/pom.xml +++ b/datastore/cloud-client/pom.xml @@ -39,5 +39,19 @@ google-cloud-datastore 0.4.0 + + + + junit + junit + 4.12 + test + + + com.google.truth + truth + 0.30 + test + diff --git a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java index 397e842d547..1864a1e8f10 100644 --- a/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java +++ b/datastore/cloud-client/src/main/java/com/example/datastore/QuickstartSample.java @@ -37,8 +37,8 @@ public static void main(String... args) throws Exception { // Prepares the new entity Entity task = Entity.builder(taskKey) - .set("description", "Buy milk") - .build(); + .set("description", "Buy milk") + .build(); // Saves the entity datastore.put(task); diff --git a/datastore/cloud-client/src/test/java/com/example/datastore/QuickstartSampleIT.java b/datastore/cloud-client/src/test/java/com/example/datastore/QuickstartSampleIT.java new file mode 100644 index 00000000000..cd7d8adc00d --- /dev/null +++ b/datastore/cloud-client/src/test/java/com/example/datastore/QuickstartSampleIT.java @@ -0,0 +1,72 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.datastore; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.cloud.datastore.Datastore; +import com.google.cloud.datastore.DatastoreOptions; +import com.google.cloud.datastore.Key; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * Tests for quickstart sample. + */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class QuickstartSampleIT { + private ByteArrayOutputStream bout; + private PrintStream out; + + private static final void deleteTestEntity() { + Datastore datastore = DatastoreOptions.defaultInstance().service(); + String kind = "Task"; + String name = "sampletask1"; + Key taskKey = datastore.newKeyFactory().kind(kind).newKey(name); + datastore.delete(taskKey); + } + + @Before + public void setUp() { + deleteTestEntity(); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + deleteTestEntity(); + } + + @Test + public void testQuickstart() throws Exception { + QuickstartSample.main(); + String got = bout.toString(); + assertThat(got).contains("Saved sampletask1: Buy milk"); + } +} +// [END datastore_quickstart] From 1f0c8a5df12f26320095bf20796e6baf0b85ee4d Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 25 Oct 2016 16:19:28 -0700 Subject: [PATCH 09/13] Add quickstarts to root module. Fixes checkstyle errors in samples. --- pom.xml | 9 +++++++-- .../java/com/example/storage/QuickstartSample.java | 4 ++-- .../java/com/example/translate/QuickstartSample.java | 11 ++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 4a20dcfe128..75f7b6fe8be 100644 --- a/pom.xml +++ b/pom.xml @@ -77,12 +77,13 @@ appengine/users appengine/xmpp bigquery + bigquery/cloud-client compute/cmdline compute/error-reporting compute/mailjet compute/sendgrid datastore - logging + datastore/cloud-client flexible/analytics flexible/async-rest flexible/cloudsql @@ -101,15 +102,19 @@ --> flexible/static-files flexible/twilio + language/analysis + logging monitoring/v2 monitoring/v3 + pubsub/cloud-client speech/grpc + storage/cloud-client storage/json-api storage/storage-transfer storage/xml-api/cmdline-sample storage/xml-api/serviceaccount-appengine-sample taskqueue/deferred - language/analysis + translate/cloud-client unittests vision/face-detection vision/label diff --git a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java index 83dce6ab0f2..403dc67f7a4 100644 --- a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java +++ b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java @@ -18,10 +18,10 @@ // [START storage_quickstart] // Imports the Google Cloud client library -import com.google.cloud.storage.Storage; -import com.google.cloud.storage.StorageOptions; import com.google.cloud.storage.Bucket; import com.google.cloud.storage.BucketInfo; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; public class QuickstartSample { public static void main(String... args) throws Exception { diff --git a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java index 1baf95c74d1..f2efd757507 100644 --- a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java +++ b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java @@ -32,11 +32,12 @@ public static void main(String... args) throws Exception { String text = "Hello, world!"; // Translates some text into Russian - Translation translation = translate.translate( - text, - TranslateOption.sourceLanguage("en"), - TranslateOption.targetLanguage("ru") - ); + Translation translation = + translate.translate( + text, + TranslateOption.sourceLanguage("en"), + TranslateOption.targetLanguage("ru")); + System.out.printf("Text: %s%n", text); System.out.printf("Translation: %s%n", translation.translatedText()); From 4236fddc8b0f02ed81badb4fa9b58b8a1ba3adc3 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Tue, 25 Oct 2016 16:45:42 -0700 Subject: [PATCH 10/13] Add system tests to pubsub quickstart. --- pubsub/cloud-client/README.md | 27 ++++++++ pubsub/cloud-client/pom.xml | 14 ++++ .../example/pubsub/QuickstartSampleIT.java | 69 +++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 pubsub/cloud-client/README.md create mode 100644 pubsub/cloud-client/src/test/java/com/example/pubsub/QuickstartSampleIT.java diff --git a/pubsub/cloud-client/README.md b/pubsub/cloud-client/README.md new file mode 100644 index 00000000000..7c6ed464660 --- /dev/null +++ b/pubsub/cloud-client/README.md @@ -0,0 +1,27 @@ +# Getting Started with Cloud Pub/Sub and the Google Cloud Client libraries + +[Google Cloud Pub/Sub][pubsub] is a fully-managed real-time messaging service that allows you to +send and receive messages between independent applications. +These sample Java applications demonstrate how to access the Pub/Sub API using +the [Google Cloud Client Library for Java][google-cloud-java]. + +[pubsub]: https://cloud.google.com/pubsub/ +[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java + +## Quickstart + +Install [Maven](http://maven.apache.org/). + +Build your project with: + + mvn clean package -DskipTests + +You can then run a given `ClassName` via: + + mvn exec:java -Dexec.mainClass=com.example.pubsub.ClassName \ + -DpropertyName=propertyValue \ + -Dexec.args="any arguments to the app" + +### Creating a new topic (using the quickstart sample) + + mvn exec:java -Dexec.mainClass=com.example.pubsub.QuickstartSample diff --git a/pubsub/cloud-client/pom.xml b/pubsub/cloud-client/pom.xml index 89c38be7aa2..57be42e8713 100644 --- a/pubsub/cloud-client/pom.xml +++ b/pubsub/cloud-client/pom.xml @@ -39,5 +39,19 @@ google-cloud-pubsub 0.4.0 + + + + junit + junit + 4.12 + test + + + com.google.truth + truth + 0.30 + test + diff --git a/pubsub/cloud-client/src/test/java/com/example/pubsub/QuickstartSampleIT.java b/pubsub/cloud-client/src/test/java/com/example/pubsub/QuickstartSampleIT.java new file mode 100644 index 00000000000..a5adf198539 --- /dev/null +++ b/pubsub/cloud-client/src/test/java/com/example/pubsub/QuickstartSampleIT.java @@ -0,0 +1,69 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.pubsub; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.cloud.pubsub.PubSub; +import com.google.cloud.pubsub.PubSubOptions; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * Tests for quickstart sample. + */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class QuickstartSampleIT { + private ByteArrayOutputStream bout; + private PrintStream out; + + private static final void deleteTestTopic() { + PubSub pubsub = PubSubOptions.defaultInstance().service(); + String topicName = "my-new-topic"; + pubsub.deleteTopic(topicName); + } + + @Before + public void setUp() { + deleteTestTopic(); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + deleteTestTopic(); + } + + @Test + public void testQuickstart() throws Exception { + QuickstartSample.main(); + String got = bout.toString(); + assertThat(got).contains("Topic my-new-topic created."); + } +} +// [END datastore_quickstart] From cf58018daeac3ab8ee5c5b77244c37760e05a01c Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 26 Oct 2016 09:43:33 -0700 Subject: [PATCH 11/13] Add tests to Storage quickstart. Had to update the sample to accept a bucket name argument, since bucket names must be globally unique. (And we actually want to be able to run the sample for integration / system tests.) --- storage/cloud-client/README.md | 28 ++++++++ storage/cloud-client/pom.xml | 14 ++++ .../com/example/storage/QuickstartSample.java | 2 +- .../example/storage/QuickstartSampleIT.java | 70 +++++++++++++++++++ 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 storage/cloud-client/README.md create mode 100644 storage/cloud-client/src/test/java/com/example/storage/QuickstartSampleIT.java diff --git a/storage/cloud-client/README.md b/storage/cloud-client/README.md new file mode 100644 index 00000000000..a6a53da067f --- /dev/null +++ b/storage/cloud-client/README.md @@ -0,0 +1,28 @@ +# Getting Started with Cloud Storage and the Google Cloud Client libraries + +[Google Cloud Storage][storage] is unified object storage for developers and enterprises, from live +data serving to data analytics/ML to data archival. +These sample Java applications demonstrate how to access the Cloud Storage API using +the [Google Cloud Client Library for Java][google-cloud-java]. + +[storage]: https://cloud.google.com/storage/ +[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java + +## Quickstart + +Install [Maven](http://maven.apache.org/). + +Build your project with: + + mvn clean package -DskipTests + +You can then run a given `ClassName` via: + + mvn exec:java -Dexec.mainClass=com.example.storage.ClassName \ + -DpropertyName=propertyValue \ + -Dexec.args="any arguments to the app" + +### Creating a new bucket (using the quickstart sample) + + mvn exec:java -Dexec.mainClass=com.example.storage.QuickstartSample \ + -Dexec.args="my-bucket-name" diff --git a/storage/cloud-client/pom.xml b/storage/cloud-client/pom.xml index 024c2aa85f7..a5ef11e6e90 100644 --- a/storage/cloud-client/pom.xml +++ b/storage/cloud-client/pom.xml @@ -39,5 +39,19 @@ google-cloud-storage 0.4.0 + + + + junit + junit + 4.12 + test + + + com.google.truth + truth + 0.30 + test + diff --git a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java index 403dc67f7a4..ed5ad2e0d15 100644 --- a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java +++ b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java @@ -29,7 +29,7 @@ public static void main(String... args) throws Exception { Storage storage = StorageOptions.defaultInstance().service(); // The name for the new bucket - String bucketName = "my-new-bucket"; + String bucketName = args[0]; // Creates the new bucket Bucket bucket = storage.create(BucketInfo.of(bucketName)); diff --git a/storage/cloud-client/src/test/java/com/example/storage/QuickstartSampleIT.java b/storage/cloud-client/src/test/java/com/example/storage/QuickstartSampleIT.java new file mode 100644 index 00000000000..3dd2b0ac69a --- /dev/null +++ b/storage/cloud-client/src/test/java/com/example/storage/QuickstartSampleIT.java @@ -0,0 +1,70 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.storage; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.UUID; + +/** + * Tests for quickstart sample. + */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class QuickstartSampleIT { + private String bucketName; + private ByteArrayOutputStream bout; + private PrintStream out; + + private static final void deleteBucket(String bucketName) { + Storage storage = StorageOptions.defaultInstance().service(); + storage.delete(bucketName); + } + + @Before + public void setUp() { + bucketName = "my-new-bucket-" + UUID.randomUUID().toString(); + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + deleteBucket(bucketName); + } + + @Test + public void testQuickstart() throws Exception { + QuickstartSample.main(bucketName); + String got = bout.toString(); + assertThat(got).contains(String.format("Bucket %s created.", bucketName)); + } +} +// [END datastore_quickstart] From 5da7970f221cd4524e59deddc81b42795b1b4902 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 26 Oct 2016 10:37:55 -0700 Subject: [PATCH 12/13] Add system tests to Translate sample. --- .../com/example/storage/QuickstartSample.java | 2 +- translate/cloud-client/README.md | 28 ++++++++ translate/cloud-client/pom.xml | 14 ++++ .../example/translate/QuickstartSample.java | 6 +- .../example/translate/QuickstartSampleIT.java | 65 +++++++++++++++++++ 5 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 translate/cloud-client/README.md create mode 100644 translate/cloud-client/src/test/java/com/example/translate/QuickstartSampleIT.java diff --git a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java index ed5ad2e0d15..23a4155a585 100644 --- a/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java +++ b/storage/cloud-client/src/main/java/com/example/storage/QuickstartSample.java @@ -29,7 +29,7 @@ public static void main(String... args) throws Exception { Storage storage = StorageOptions.defaultInstance().service(); // The name for the new bucket - String bucketName = args[0]; + String bucketName = args[0]; // "my-new-bucket"; // Creates the new bucket Bucket bucket = storage.create(BucketInfo.of(bucketName)); diff --git a/translate/cloud-client/README.md b/translate/cloud-client/README.md new file mode 100644 index 00000000000..30e53275591 --- /dev/null +++ b/translate/cloud-client/README.md @@ -0,0 +1,28 @@ +# Getting Started with Google Translate API and the Google Cloud Client libraries + +[Google Translate API][translate] provides a simple programmatic interface for translating an +arbitrary string into any supported language. +These sample Java applications demonstrate how to access the Cloud Storage API using +the [Google Cloud Client Library for Java][google-cloud-java]. + +[translate]: https://cloud.google.com/translate/ +[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java + +## Quickstart + +Install [Maven](http://maven.apache.org/). + +Build your project with: + + mvn clean package -DskipTests + +You can then run a given `ClassName` via: + + mvn exec:java -Dexec.mainClass=com.example.translate.ClassName \ + -DpropertyName=propertyValue \ + -Dexec.args="any arguments to the app" + +### Translate a string (using the quickstart sample) + + mvn exec:java -Dexec.mainClass=com.example.translate.QuickstartSample \ + -Dexec.args="YOUR_API_KEY" diff --git a/translate/cloud-client/pom.xml b/translate/cloud-client/pom.xml index cc2f51a0f6e..31cc2efe147 100644 --- a/translate/cloud-client/pom.xml +++ b/translate/cloud-client/pom.xml @@ -39,5 +39,19 @@ google-cloud-translate 0.4.0 + + + + junit + junit + 4.12 + test + + + com.google.truth + truth + 0.30 + test + diff --git a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java index f2efd757507..75523d0dcaf 100644 --- a/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java +++ b/translate/cloud-client/src/main/java/com/example/translate/QuickstartSample.java @@ -26,7 +26,11 @@ public class QuickstartSample { public static void main(String... args) throws Exception { // Instantiates a client - Translate translate = TranslateOptions.builder().apiKey("YOUR_API_KEY").build().service(); + Translate translate = + TranslateOptions.builder() + .apiKey(args[0]) // .apiKey("YOUR_API_KEY") + .build() + .service(); // The text to translate String text = "Hello, world!"; diff --git a/translate/cloud-client/src/test/java/com/example/translate/QuickstartSampleIT.java b/translate/cloud-client/src/test/java/com/example/translate/QuickstartSampleIT.java new file mode 100644 index 00000000000..c91651b2a74 --- /dev/null +++ b/translate/cloud-client/src/test/java/com/example/translate/QuickstartSampleIT.java @@ -0,0 +1,65 @@ +/* + Copyright 2016, Google, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.example.translate; + +import static com.google.common.truth.Truth.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +/** + * Tests for quickstart sample. + */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class QuickstartSampleIT { + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + System.setOut(null); + } + + @Test + public void testQuickstart() throws Exception { + // Arrange + String apiKey = System.getenv("GOOGLE_API_KEY"); + + // Act + QuickstartSample.main(apiKey); + + // Assert + String got = bout.toString(); + assertThat(got).contains("Text: Hello, world!"); + assertThat(got).contains("Translation: "); + } +} +// [END datastore_quickstart] From 5f7c4a5c5f9e54217aef9c721f961524ad7ab3e5 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 26 Oct 2016 11:24:57 -0700 Subject: [PATCH 13/13] Add secrets for GOOGLE_API_KEY and Translate tests. Translate API requires an API key, not a service account key. --- pom.xml | 1 + secrets.env.EXAMPLE | 3 +++ secrets.env.enc | Bin 128 -> 192 bytes translate/pom.xml | 7 +++++-- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 secrets.env.EXAMPLE diff --git a/pom.xml b/pom.xml index 75f7b6fe8be..db1ffdb59df 100644 --- a/pom.xml +++ b/pom.xml @@ -114,6 +114,7 @@ storage/xml-api/cmdline-sample storage/xml-api/serviceaccount-appengine-sample taskqueue/deferred + translate translate/cloud-client unittests vision/face-detection diff --git a/secrets.env.EXAMPLE b/secrets.env.EXAMPLE new file mode 100644 index 00000000000..ce6f489c186 --- /dev/null +++ b/secrets.env.EXAMPLE @@ -0,0 +1,3 @@ +export AWS_ACCESS_KEY_ID=MY_KEY_ID +export AWS_SECRET_ACCESS_KEY=MY_ACCESS_KEY +export GOOGLE_API_KEY=MY_API_KEY diff --git a/secrets.env.enc b/secrets.env.enc index 3396fd8346143a7b3caef1e3647593c4b8e5c9e1..f0558306a88ea7675b265b415c97b6618046c256 100644 GIT binary patch literal 192 zcmV;x06+gbTd14U({u?Fc!Y0Z=j2JsWbN~n6Tbws%R5M^_!5YBmg-v44)QS*e>S`{ zFqJEYBfX7wYf^YcjB_uR!F!2R8oF%EV+-o7e%q78kw|T`0TZ_k2g_u;As8{VSY2g^ z2W#U3#E!VUaqA5hkvc^SN^4J=nQ2+sz?FhDQg{@Ux7j~3qrIOd6V63xbM{`9JrWD* u0{^5H;X@P$oO$ zON%q2z6li|pypQ(hnqF3L+jsQgS-PDtWZX}J(Giz(SL9Z7fg6d;M4u$fvSFJ>7V4Z i6!}{)sRb-L!0bXQ8}=|?@mR#k%S8nhCg9=onz_kP0zQ%e diff --git a/translate/pom.xml b/translate/pom.xml index 2eddfbdd0df..d04b0fe12b8 100644 --- a/translate/pom.xml +++ b/translate/pom.xml @@ -25,12 +25,15 @@ limitations under the License. 1.8 UTF-8 + + + doc-samples com.google.cloud - shared-configuration 1.0.0 - ../java-repo-tools + .. + com.google.cloud