diff --git a/.kokoro/presubmit.cfg b/.kokoro/presubmit.cfg index 3d41a167b56..cb822f09e7a 100644 --- a/.kokoro/presubmit.cfg +++ b/.kokoro/presubmit.cfg @@ -19,4 +19,3 @@ env_vars: { key: "TRAMPOLINE_BUILD_FILE" value: "github/java-docs-samples/.kokoro/tests/diff_tests.sh" } - diff --git a/appengine-java8/bigtable/pom.xml b/appengine-java8/bigtable/pom.xml index 7ac24c65bc9..1db5001999b 100644 --- a/appengine-java8/bigtable/pom.xml +++ b/appengine-java8/bigtable/pom.xml @@ -37,8 +37,8 @@ limitations under the License. 1.8 1.8 - YOUR_PROJECT_ID - YOUR_INSTANCE_ID + java-docs-samples-testing + instance false diff --git a/appengine/datastore/pom.xml b/appengine/datastore/pom.xml index a17fdbd53af..f365daf6ebc 100644 --- a/appengine/datastore/pom.xml +++ b/appengine/datastore/pom.xml @@ -41,4 +41,93 @@ indexes-perfect + + + com.google.auto.value + auto-value + 1.5.3 + provided + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + com.google.guava + guava + 20.0 + + + + joda-time + joda-time + 2.9.9 + + + + javax.servlet + servlet-api + 2.5 + provided + + + + com.google.appengine + appengine-api-1.0-sdk + 1.9.63 + + + + + junit + junit + 4.12 + test + + + org.mockito + mockito-all + 1.10.19 + test + + + com.google.appengine + appengine-testing + 1.9.59 + test + + + com.google.appengine + appengine-api-stubs + 1.9.59 + test + + + com.google.appengine + appengine-tools-sdk + 1.9.59 + test + + + com.google.truth + truth + 0.37 + test + + + + + + ${project.build.directory}/${project.build.finalName}/WEB-INF/classes + + + + com.google.appengine + appengine-maven-plugin + 1.9.59 + + + diff --git a/container-registry/container-analysis/src/main/java/com/example/containeranalysis/Samples.java b/container-registry/container-analysis/src/main/java/com/example/containeranalysis/Samples.java index 4cf69253da6..eef0ff4a31c 100644 --- a/container-registry/container-analysis/src/main/java/com/example/containeranalysis/Samples.java +++ b/container-registry/container-analysis/src/main/java/com/example/containeranalysis/Samples.java @@ -30,11 +30,7 @@ import com.google.containeranalysis.v1alpha1.Occurrence; import com.google.containeranalysis.v1alpha1.VulnerabilityType; import com.google.containeranalysis.v1alpha1.VulnerabilityType.VulnerabilityDetails; -import com.google.pubsub.v1.PubsubMessage; -import com.google.pubsub.v1.PushConfig; -import com.google.pubsub.v1.Subscription; -import com.google.pubsub.v1.SubscriptionName; -import com.google.pubsub.v1.TopicName; +import com.google.pubsub.v1.*; /** * API usage samples @@ -292,7 +288,7 @@ public static int pubSub(String subscriptionId, int timeout, String projectId) t try { // subscribe to the requested pubsub channel - SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); + ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(projectId, subscriptionId); subscriber = Subscriber.newBuilder(subscriptionName, receiver).build(); subscriber.startAsync().awaitRunning(); // listen to messages for 'listenTimeout' seconds @@ -339,8 +335,8 @@ public static Subscription createOccurrenceSubscription(String subscriptionId, S String topicId = "resource-notes-occurrences-v1alpha1"; try (SubscriptionAdminClient client = SubscriptionAdminClient.create()) { PushConfig config = PushConfig.getDefaultInstance(); - TopicName topicName = TopicName.of(projectId, topicId); - SubscriptionName subscriptionName = SubscriptionName.of(projectId, subscriptionId); + ProjectTopicName topicName = ProjectTopicName.of(projectId, topicId); + ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(projectId, subscriptionId); Subscription sub = client.createSubscription(subscriptionName, topicName, config, 0); return sub; } diff --git a/container-registry/container-analysis/src/test/java/com/example/containeranalysis/SamplesTests.java b/container-registry/container-analysis/src/test/java/com/example/containeranalysis/SamplesTests.java index 657844bd23b..56c636c1282 100644 --- a/container-registry/container-analysis/src/test/java/com/example/containeranalysis/SamplesTests.java +++ b/container-registry/container-analysis/src/test/java/com/example/containeranalysis/SamplesTests.java @@ -25,7 +25,7 @@ import com.google.containeranalysis.v1alpha1.Note; import com.google.containeranalysis.v1alpha1.Occurrence; import com.google.containeranalysis.v1alpha1.VulnerabilityType.VulnerabilityDetails; -import com.google.pubsub.v1.SubscriptionName; +import com.google.pubsub.v1.ProjectSubscriptionName; import java.util.Date; import org.junit.After; import org.junit.Before; @@ -194,7 +194,7 @@ public void testPubSub() throws Exception { int newCount; int tries; String subscriptionId = "drydockOccurrences"; - SubscriptionName subscriptionName = SubscriptionName.of(PROJECT_ID, subscriptionId); + ProjectSubscriptionName subscriptionName = ProjectSubscriptionName.of(PROJECT_ID, subscriptionId); Samples.createOccurrenceSubscription(subscriptionId, PROJECT_ID); Subscriber subscriber = null; diff --git a/dataflow/spanner-io/pom.xml b/dataflow/spanner-io/pom.xml index 165efbffa65..1cf6e857bdd 100644 --- a/dataflow/spanner-io/pom.xml +++ b/dataflow/spanner-io/pom.xml @@ -79,6 +79,10 @@ com.google.api.grpc grpc-google-common-protos + + io.grpc + grpc-core + diff --git a/errorreporting/src/main/java/com/example/errorreporting/QuickStart.java b/errorreporting/src/main/java/com/example/errorreporting/QuickStart.java index 334d7c44fe7..8f399b08bcf 100644 --- a/errorreporting/src/main/java/com/example/errorreporting/QuickStart.java +++ b/errorreporting/src/main/java/com/example/errorreporting/QuickStart.java @@ -38,7 +38,7 @@ public static void main(String[] args) throws Exception { // Google Cloud Platform Project ID String projectId = (args.length > 0) ? args[0] : ServiceOptions.getDefaultProjectId(); - ProjectName projectName = ProjectName.create(projectId); + ProjectName projectName = ProjectName.of(projectId); // Instantiate an Error Reporting Client try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) { diff --git a/monitoring/cloud-client/src/main/java/com/example/monitoring/QuickstartSample.java b/monitoring/cloud-client/src/main/java/com/example/monitoring/QuickstartSample.java index c777b6d6caf..151594b819b 100644 --- a/monitoring/cloud-client/src/main/java/com/example/monitoring/QuickstartSample.java +++ b/monitoring/cloud-client/src/main/java/com/example/monitoring/QuickstartSample.java @@ -65,7 +65,7 @@ public static void main(String... args) throws Exception { List pointList = new ArrayList<>(); pointList.add(point); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); // Prepares the metric descriptor Map metricLabels = new HashMap(); @@ -93,7 +93,7 @@ public static void main(String... args) throws Exception { timeSeriesList.add(timeSeries); CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .addAllTimeSeries(timeSeriesList) .build(); diff --git a/monitoring/cloud-client/src/main/java/com/example/monitoring/Snippets.java b/monitoring/cloud-client/src/main/java/com/example/monitoring/Snippets.java index 0781c86c206..363d0618fd1 100644 --- a/monitoring/cloud-client/src/main/java/com/example/monitoring/Snippets.java +++ b/monitoring/cloud-client/src/main/java/com/example/monitoring/Snippets.java @@ -21,7 +21,9 @@ import com.google.api.MonitoredResource; import com.google.api.MonitoredResourceDescriptor; import com.google.cloud.monitoring.v3.MetricServiceClient; -import com.google.cloud.monitoring.v3.PagedResponseWrappers; +import com.google.cloud.monitoring.v3.MetricServiceClient.ListMetricDescriptorsPagedResponse; +import com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; +import com.google.cloud.monitoring.v3.MetricServiceClient.ListTimeSeriesPagedResponse; import com.google.monitoring.v3.Aggregation; import com.google.monitoring.v3.CreateMetricDescriptorRequest; import com.google.monitoring.v3.CreateTimeSeriesRequest; @@ -92,7 +94,7 @@ void createMetricDescriptor(String type) throws IOException { String metricType = CUSTOM_METRIC_DOMAIN + "/" + type; final MetricServiceClient client = MetricServiceClient.create(); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); MetricDescriptor descriptor = MetricDescriptor.newBuilder() .setType(metricType) @@ -102,7 +104,7 @@ void createMetricDescriptor(String type) throws IOException { .build(); CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .setMetricDescriptor(descriptor) .build(); @@ -119,7 +121,7 @@ void deleteMetricDescriptor(String name) throws IOException { // [START monitoring_delete_metric] String projectId = System.getProperty("projectId"); final MetricServiceClient client = MetricServiceClient.create(); - MetricDescriptorName metricName = MetricDescriptorName.create(projectId, name); + MetricDescriptorName metricName = MetricDescriptorName.of(projectId, name); client.deleteMetricDescriptor(metricName); System.out.println("Deleted descriptor " + name); // [END monitoring_delete_metric] @@ -155,7 +157,7 @@ void writeTimeSeries() throws IOException { List pointList = new ArrayList<>(); pointList.add(point); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); // Prepares the metric descriptor Map metricLabels = new HashMap(); @@ -185,7 +187,7 @@ void writeTimeSeries() throws IOException { timeSeriesList.add(timeSeries); CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .addAllTimeSeries(timeSeriesList) .build(); @@ -203,7 +205,7 @@ void listTimeSeriesHeaders() throws IOException { // [START monitoring_read_timeseries_fields] MetricServiceClient metricServiceClient = MetricServiceClient.create(); String projectId = System.getProperty("projectId"); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); // Restrict time to last 20 minutes long startMillis = System.currentTimeMillis() - ((60 * 20) * 1000); @@ -213,15 +215,14 @@ void listTimeSeriesHeaders() throws IOException { .build(); ListTimeSeriesRequest.Builder requestBuilder = ListTimeSeriesRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .setFilter("metric.type=\"compute.googleapis.com/instance/cpu/utilization\"") .setInterval(interval) .setView(ListTimeSeriesRequest.TimeSeriesView.HEADERS); ListTimeSeriesRequest request = requestBuilder.build(); - PagedResponseWrappers.ListTimeSeriesPagedResponse response = metricServiceClient - .listTimeSeries(request); + ListTimeSeriesPagedResponse response = metricServiceClient.listTimeSeries(request); System.out.println("Got timeseries headers: "); for (TimeSeries ts : response.iterateAll()) { @@ -237,7 +238,7 @@ void listTimeSeries(String filter) throws IOException { // [START monitoring_read_timeseries_simple] MetricServiceClient metricServiceClient = MetricServiceClient.create(); String projectId = System.getProperty("projectId"); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); // Restrict time to last 20 minutes long startMillis = System.currentTimeMillis() - ((60 * 20) * 1000); @@ -247,14 +248,13 @@ void listTimeSeries(String filter) throws IOException { .build(); ListTimeSeriesRequest.Builder requestBuilder = ListTimeSeriesRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .setFilter(filter) .setInterval(interval); ListTimeSeriesRequest request = requestBuilder.build(); - PagedResponseWrappers.ListTimeSeriesPagedResponse response = metricServiceClient - .listTimeSeries(request); + ListTimeSeriesPagedResponse response = metricServiceClient.listTimeSeries(request); System.out.println("Got timeseries: "); for (TimeSeries ts : response.iterateAll()) { @@ -270,7 +270,7 @@ void listTimeSeriesAggregrate() throws IOException { // [START monitoring_read_timeseries_align] MetricServiceClient metricServiceClient = MetricServiceClient.create(); String projectId = System.getProperty("projectId"); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); // Restrict time to last 20 minutes long startMillis = System.currentTimeMillis() - ((60 * 20) * 1000); @@ -285,14 +285,14 @@ void listTimeSeriesAggregrate() throws IOException { .build(); ListTimeSeriesRequest.Builder requestBuilder = ListTimeSeriesRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .setFilter("metric.type=\"compute.googleapis.com/instance/cpu/utilization\"") .setInterval(interval) .setAggregation(aggregation); ListTimeSeriesRequest request = requestBuilder.build(); - PagedResponseWrappers.ListTimeSeriesPagedResponse response = metricServiceClient + ListTimeSeriesPagedResponse response = metricServiceClient .listTimeSeries(request); System.out.println("Got timeseries: "); @@ -309,7 +309,7 @@ void listTimeSeriesReduce() throws IOException { // [START monitoring_read_timeseries_reduce] MetricServiceClient metricServiceClient = MetricServiceClient.create(); String projectId = System.getProperty("projectId"); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); // Restrict time to last 20 minutes long startMillis = System.currentTimeMillis() - ((60 * 20) * 1000); @@ -325,14 +325,14 @@ void listTimeSeriesReduce() throws IOException { .build(); ListTimeSeriesRequest.Builder requestBuilder = ListTimeSeriesRequest.newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .setFilter("metric.type=\"compute.googleapis.com/instance/cpu/utilization\"") .setInterval(interval) .setAggregation(aggregation); ListTimeSeriesRequest request = requestBuilder.build(); - PagedResponseWrappers.ListTimeSeriesPagedResponse response = metricServiceClient + ListTimeSeriesPagedResponse response = metricServiceClient .listTimeSeries(request); System.out.println("Got timeseries: "); @@ -351,14 +351,13 @@ void listMetricDescriptors() throws IOException { String projectId = System.getProperty("projectId"); final MetricServiceClient client = MetricServiceClient.create(); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest .newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .build(); - PagedResponseWrappers.ListMetricDescriptorsPagedResponse response = - client.listMetricDescriptors(request); + ListMetricDescriptorsPagedResponse response = client.listMetricDescriptors(request); System.out.println("Listing descriptors: "); @@ -377,17 +376,16 @@ void listMonitoredResources() throws IOException { String projectId = System.getProperty("projectId"); final MetricServiceClient client = MetricServiceClient.create(); - ProjectName name = ProjectName.create(projectId); + ProjectName name = ProjectName.of(projectId); ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest .newBuilder() - .setNameWithProjectName(name) + .setName(name.toString()) .build(); System.out.println("Listing monitored resource descriptors: "); - PagedResponseWrappers.ListMonitoredResourceDescriptorsPagedResponse response = client - .listMonitoredResourceDescriptors(request); + ListMonitoredResourceDescriptorsPagedResponse response = client.listMonitoredResourceDescriptors(request); for (MonitoredResourceDescriptor d : response.iterateAll()) { System.out.println(d.getType()); @@ -406,7 +404,7 @@ void describeMonitoredResources(String type) throws IOException { String projectId = System.getProperty("projectId"); final MetricServiceClient client = MetricServiceClient.create(); - MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.create(projectId, type); + MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of(projectId, type); MonitoredResourceDescriptor response = client.getMonitoredResourceDescriptor(name); System.out.println("Printing monitored resource descriptor: ");