FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix dpebot dependency failures. by dzlier-gcp · Pull Request #1260 · GoogleCloudPlatform/java-docs-samples · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) .xml  (2) All 2 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.example.appengine.spanner;

import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.spanner.Database;
import com.google.cloud.spanner.DatabaseClient;
import com.google.cloud.spanner.Key;
Expand All @@ -28,10 +29,13 @@
import com.google.cloud.spanner.Struct;
import com.google.common.base.Stopwatch;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

class SpannerTasks {
Expand Down Expand Up @@ -103,7 +107,8 @@ static class Album {

private static DatabaseClient databaseClient = null;

private static void createDatabase(PrintWriter pw) {
private static void createDatabase(PrintWriter pw) throws InterruptedException,
ExecutionException {
Iterable<String> statements =
Arrays.asList(
"CREATE TABLE Singers (\n"
Expand All @@ -122,8 +127,7 @@ private static void createDatabase(PrintWriter pw) {
SpannerClient.getDatabaseAdminClient()
.createDatabase(
SpannerClient.getInstanceId(), SpannerClient.getDatabaseId(), statements)
.waitFor()
.getResult();
.get();
pw.println("Created database [" + db.getId() + "]");
}

Expand Down Expand Up @@ -180,15 +184,15 @@ private static void read(PrintWriter pw) {
}
}

private static void addMarketingBudgetColumnToAlbums(PrintWriter pw) {
Operation<Void, UpdateDatabaseDdlMetadata> op =
SpannerClient.getDatabaseAdminClient()
.updateDatabaseDdl(
SpannerClient.getInstanceId(),
SpannerClient.getDatabaseId(),
Arrays.asList("ALTER TABLE Albums ADD COLUMN MarketingBudget INT64"),
null);
op.waitFor();
private static void addMarketingBudgetColumnToAlbums(PrintWriter pw) throws ExecutionException,
InterruptedException {
SpannerClient.getDatabaseAdminClient()
.updateDatabaseDdl(
SpannerClient.getInstanceId(),
SpannerClient.getDatabaseId(),
Collections.singletonList("ALTER TABLE Albums ADD COLUMN MarketingBudget INT64"),
null)
.get();
}

// Before executing this method, a new column MarketingBudget has to be added to the Albums
Expand Down Expand Up @@ -281,15 +285,14 @@ private static void queryMarketingBudget(PrintWriter pw) {
}
}

private static void addIndex() {
Operation<Void, UpdateDatabaseDdlMetadata> op =
SpannerClient.getDatabaseAdminClient()
.updateDatabaseDdl(
SpannerClient.getInstanceId(),
SpannerClient.getDatabaseId(),
Arrays.asList("CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)"),
null);
op.waitFor();
private static void addIndex() throws ExecutionException, InterruptedException {
SpannerClient.getDatabaseAdminClient()
.updateDatabaseDdl(
SpannerClient.getInstanceId(),
SpannerClient.getDatabaseId(),
Arrays.asList("CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)"),
null)
.get();
}

// Before running this example, add the index AlbumsByAlbumTitle by applying the DDL statement
Expand Down Expand Up @@ -328,17 +331,16 @@ private static void readUsingIndex(PrintWriter pw) {
}
}

private static void addStoringIndex() {
Operation<Void, UpdateDatabaseDdlMetadata> op =
SpannerClient.getDatabaseAdminClient()
.updateDatabaseDdl(
SpannerClient.getInstanceId(),
SpannerClient.getDatabaseId(),
Arrays.asList(
"CREATE INDEX AlbumsByAlbumTitle2 "
+ "ON Albums(AlbumTitle) STORING (MarketingBudget)"),
null);
op.waitFor();
private static void addStoringIndex() throws ExecutionException, InterruptedException {
SpannerClient.getDatabaseAdminClient()
.updateDatabaseDdl(
SpannerClient.getInstanceId(),
SpannerClient.getDatabaseId(),
Arrays.asList(
"CREATE INDEX AlbumsByAlbumTitle2 "
+ "ON Albums(AlbumTitle) STORING (MarketingBudget)"),
null)
.get();
}

// Before running this example, create a storing index AlbumsByAlbumTitle2 by applying the DDL
Expand Down Expand Up @@ -366,7 +368,7 @@ private static void readOnlyTransaction(PrintWriter pw) {
// ReadOnlyTransaction must be closed by calling close() on it to release resources held by it.
// We use a try-with-resource block to automatically do so.
try (ReadOnlyTransaction transaction =
SpannerClient.getDatabaseClient().readOnlyTransaction()) {
SpannerClient.getDatabaseClient().readOnlyTransaction()) {
ResultSet queryResultSet =
transaction.executeQuery(
Statement.of("SELECT SingerId, AlbumId, AlbumTitle FROM Albums"));
Expand All @@ -386,7 +388,7 @@ private static void readOnlyTransaction(PrintWriter pw) {
}
}

static void runTask(Task task, PrintWriter pw) {
static void runTask(Task task, PrintWriter pw) throws ExecutionException, InterruptedException {
Stopwatch stopwatch = Stopwatch.createStarted();
switch (task) {
case createDatabase:
Expand Down
2 changes: 1 addition & 1 deletion dataflow/spanner-io/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<apache_beam.version>2.8.0</apache_beam.version>
<apache_beam.version>2.3.0</apache_beam.version>
</properties>

<build>
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.cloudtasks.v2beta2.CloudTasks;
import com.google.api.services.cloudtasks.v2beta2.CloudTasksScopes;
import com.google.api.services.cloudtasks.v2beta2.model.AppEngineHttpRequest;
import com.google.api.services.cloudtasks.v2beta2.model.CreateTaskRequest;
import com.google.api.services.cloudtasks.v2beta2.model.Task;
import com.google.api.services.cloudtasks.v2beta3.CloudTasks;
import com.google.api.services.cloudtasks.v2beta3.CloudTasksScopes;
import com.google.api.services.cloudtasks.v2beta3.model.AppEngineHttpRequest;
import com.google.api.services.cloudtasks.v2beta3.model.CreateTaskRequest;
import com.google.api.services.cloudtasks.v2beta3.model.Task;
import com.google.common.io.BaseEncoding;
import java.io.IOException;
import java.io.PrintWriter;
Expand Down Expand Up @@ -99,8 +99,8 @@ private static Task createTask(
payload = BaseEncoding.base64().encode(payload.getBytes());
AppEngineHttpRequest postRequest = new AppEngineHttpRequest()
.setHttpMethod("POST")
.setRelativeUrl("/example_task_handler")
.setPayload(payload);
.setRelativeUri("/example_task_handler")
.setBody(payload);
Task task = new Task().setAppEngineHttpRequest(postRequest);

// Create the CreateTaskRequest
Expand Down
26 changes: 25 additions & 1 deletion logging/cloud-client/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.9</version>
<version>1.0.10</version>
<relativePath></relativePath>
</parent>

<properties>
Expand Down Expand Up @@ -56,4 +57,27 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin> <!-- Integration / System Tests -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<forkCount>3</forkCount>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Back | FazBrowse Home | New Git URL