Skip to content

Commit

Permalink
Fix build errors caused by dependency updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
dzlier committed Mar 26, 2018
1 parent c881816 commit b377d44
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 40 deletions.
1 change: 0 additions & 1 deletion .kokoro/presubmit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/java-docs-samples/.kokoro/tests/diff_tests.sh"
}

89 changes: 89 additions & 0 deletions appengine/datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,93 @@
<module>indexes-perfect</module>
</modules>

<dependencies>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<version>1.5.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId> <!-- @Nullable annotations -->
<version>3.0.2</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.63</version>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>1.9.59</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>1.9.59</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-tools-sdk</artifactId>
<version>1.9.59</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>0.37</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- Parent POM defines ${appengine.sdk.version} (updates frequently). -->
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.59</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
import com.google.containeranalysis.v1alpha1.Occurrence;
import com.google.containeranalysis.v1alpha1.VulnerabilityType;
import com.google.containeranalysis.v1alpha1.VulnerabilityType.VulnerabilityDetails;
import com.google.pubsub.v1.ProjectSubscriptionName;
import com.google.pubsub.v1.ProjectTopicName;
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;

/**
* API usage samples
Expand Down Expand Up @@ -292,7 +292,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
Expand Down Expand Up @@ -339,8 +339,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions dataflow/spanner-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
<groupId>com.google.api.grpc</groupId>
<artifactId>grpc-google-common-protos</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void main(String... args) throws Exception {
List<Point> pointList = new ArrayList<>();
pointList.add(point);

ProjectName name = ProjectName.create(projectId);
ProjectName name = ProjectName.of(projectId);

// Prepares the metric descriptor
Map<String, String> metricLabels = new HashMap<String, String>();
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -102,7 +104,7 @@ void createMetricDescriptor(String type) throws IOException {
.build();

CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder()
.setNameWithProjectName(name)
.setName(name.toString())
.setMetricDescriptor(descriptor)
.build();

Expand All @@ -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]
Expand Down Expand Up @@ -155,7 +157,7 @@ void writeTimeSeries() throws IOException {
List<Point> pointList = new ArrayList<>();
pointList.add(point);

ProjectName name = ProjectName.create(projectId);
ProjectName name = ProjectName.of(projectId);

// Prepares the metric descriptor
Map<String, String> metricLabels = new HashMap<String, String>();
Expand Down Expand Up @@ -185,7 +187,7 @@ void writeTimeSeries() throws IOException {
timeSeriesList.add(timeSeries);

CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder()
.setNameWithProjectName(name)
.setName(name.toString())
.addAllTimeSeries(timeSeriesList)
.build();

Expand All @@ -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);
Expand All @@ -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()) {
Expand All @@ -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);
Expand All @@ -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()) {
Expand All @@ -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);
Expand All @@ -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: ");
Expand All @@ -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);
Expand All @@ -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: ");
Expand All @@ -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: ");

Expand All @@ -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());
Expand All @@ -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: ");
Expand Down

0 comments on commit b377d44

Please sign in to comment.