Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update shared config #2443

Merged
merged 13 commits into from
Mar 27, 2020
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/templates/appengine-flexible-deploy.mdpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ View the app at [localhost:8080](http://localhost:8080).

To deploy the app to App Engine, run

mvn clean appengine:deploy
mvn clean package appengine:deploy

After the deploy finishes (can take up to 10 minutes), you can view your application at
`https://YOUR_PROJECT.appspot.com`, where `YOUR_PROJECT` is your Google Cloud project ID. You can
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ repository.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>doc-samples</artifactId>
<version>1.0.11</version>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.13</version>
</parent>
```

Expand Down
2 changes: 1 addition & 1 deletion auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.11</version>
<version>1.0.13</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.common.collect.Lists;

import java.io.FileInputStream;
import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.11</version>
<version>1.0.13</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.cloud.automl.v1beta1.ModelName;
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.cloud.automl.v1beta1.PredictionServiceClient;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.cloud.automl.v1beta1.AutoMlClient;
import com.google.cloud.automl.v1beta1.DatasetName;
import com.google.protobuf.Empty;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.cloud.automl.v1beta1.AutoMlClient;
import com.google.cloud.automl.v1beta1.ModelName;
import com.google.protobuf.Empty;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.cloud.automl.v1beta1.ModelName;
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.protobuf.Empty;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
1 change: 0 additions & 1 deletion automl/beta/src/main/java/com/example/automl/GetModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.cloud.automl.v1beta1.AutoMlClient;
import com.google.cloud.automl.v1beta1.Model;
import com.google.cloud.automl.v1beta1.ModelName;

import java.io.IOException;

class GetModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.cloud.automl.v1beta1.AutoMlClient;
import com.google.cloud.automl.v1beta1.ModelEvaluation;
import com.google.cloud.automl.v1beta1.ModelEvaluationName;

import java.io.IOException;

class GetModelEvaluation {
Expand Down Expand Up @@ -64,8 +63,8 @@ static void getModelEvaluation(String projectId, String modelId, String modelEva

// [START automl_video_object_tracking_get_model_evaluation_beta]
System.out.format(
"Video Object Tracking Evaluation Metrics: %s\n",
modelEvaluation.getVideoObjectTrackingEvaluationMetrics());
"Video Object Tracking Evaluation Metrics: %s\n",
modelEvaluation.getVideoObjectTrackingEvaluationMetrics());
// [START automl_video_classification_get_model_evaluation_beta]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// [START automl_get_operation_status_beta]
import com.google.cloud.automl.v1beta1.AutoMlClient;
import com.google.longrunning.Operation;

import java.io.IOException;

class GetOperationStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.google.cloud.automl.v1beta1.GcsSource;
import com.google.cloud.automl.v1beta1.InputConfig;
import com.google.protobuf.Empty;

import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.ListDatasetsRequest;
import com.google.cloud.automl.v1beta1.LocationName;

import java.io.IOException;

class ListDatasets {
Expand Down Expand Up @@ -70,8 +69,8 @@ static void listDatasets(String projectId) throws IOException {

// [START automl_video_object_tracking_list_datasets_beta]
System.out.format(
"Video object tracking dataset metadata: %s\n",
dataset.getVideoObjectTrackingDatasetMetadata());
"Video object tracking dataset metadata: %s\n",
dataset.getVideoObjectTrackingDatasetMetadata());
// [END automl_video_object_tracking_list_datasets_beta]

// [START automl_tables_list_datasets_beta]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.cloud.automl.v1beta1.ListModelEvaluationsRequest;
import com.google.cloud.automl.v1beta1.ModelEvaluation;
import com.google.cloud.automl.v1beta1.ModelName;

import java.io.IOException;

class ListModelEvaluations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.cloud.automl.v1beta1.ListModelsRequest;
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.cloud.automl.v1beta1.Model;

import java.io.IOException;

class ListModels {
Expand Down
14 changes: 6 additions & 8 deletions automl/beta/src/main/java/com/example/automl/SetEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.ListDatasetsRequest;
import com.google.cloud.automl.v1beta1.LocationName;

import java.io.IOException;

class SetEndpoint {

// Change your endpoint
static void setEndpoint(String projectId) throws IOException {
// [START automl_set_endpoint]
AutoMlSettings settings = AutoMlSettings.newBuilder()
.setEndpoint("eu-automl.googleapis.com:443")
.build();
AutoMlSettings settings =
AutoMlSettings.newBuilder().setEndpoint("eu-automl.googleapis.com:443").build();

// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
Expand All @@ -43,10 +41,10 @@ static void setEndpoint(String projectId) throws IOException {
// [END automl_set_endpoint]

ListDatasetsRequest request =
ListDatasetsRequest.newBuilder()
.setParent(projectLocation.toString())
.setFilter("translation_dataset_metadata:*")
.build();
ListDatasetsRequest.newBuilder()
.setParent(projectLocation.toString())
.setFilter("translation_dataset_metadata:*")
.build();
// List all the datasets available
System.out.println("List of datasets:");
for (Dataset dataset : client.listDatasets(request).iterateAll()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.cloud.automl.v1beta1.ModelName;
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.cloud.automl.v1beta1.PredictionServiceClient;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.cloud.automl.v1beta1.TablesDatasetMetadata;

import java.io.IOException;

class TablesCreateDataset {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.cloud.automl.v1beta1.Model;
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.cloud.automl.v1beta1.TablesModelMetadata;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.cloud.automl.v1beta1.GcsSource;
import com.google.cloud.automl.v1beta1.InputConfig;
import com.google.protobuf.Empty;

import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ExecutionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.google.cloud.automl.v1beta1.Row;
import com.google.cloud.automl.v1beta1.TablesAnnotation;
import com.google.protobuf.Value;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.cloud.automl.v1beta1.UndeployModelRequest;
import com.google.protobuf.Empty;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.cloud.automl.v1beta1.VideoClassificationDatasetMetadata;

import java.io.IOException;

class VideoClassificationCreateDataset {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.cloud.automl.v1beta1.Model;
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.cloud.automl.v1beta1.VideoClassificationModelMetadata;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.cloud.automl.v1beta1.VideoObjectTrackingDatasetMetadata;

import java.io.IOException;

class VideoObjectTrackingCreateDataset {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.cloud.automl.v1beta1.Model;
import com.google.cloud.automl.v1beta1.OperationMetadata;
import com.google.cloud.automl.v1beta1.VideoObjectTrackingModelMetadata;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.concurrent.ExecutionException;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -73,11 +72,9 @@ public void testBatchPredict() {
String outputUri = String.format("gs://%s/TEST_BATCH_PREDICT/", BUCKET_ID);
BatchPredict.batchPredict(PROJECT_ID, MODEL_ID, inputUri, outputUri);
String got = bout.toString();
assertThat(got)
.contains("does not exist");
assertThat(got).contains("does not exist");
} catch (IOException | ExecutionException | InterruptedException e) {
assertThat(e.getMessage())
.contains("does not exist");
assertThat(e.getMessage()).contains("does not exist");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.cloud.automl.v1beta1.TextExtractionDatasetMetadata;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.UUID;
import java.util.concurrent.ExecutionException;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.concurrent.ExecutionException;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.concurrent.ExecutionException;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;


@RunWith(JUnit4.class)
public class DeployModelTest {
private static final String PROJECT_ID = System.getenv("AUTOML_PROJECT_ID");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
import com.google.cloud.automl.v1.ListModelEvaluationsRequest;
import com.google.cloud.automl.v1.ModelEvaluation;
import com.google.cloud.automl.v1.ModelName;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.longrunning.ListOperationsRequest;
import com.google.longrunning.Operation;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
import com.google.cloud.automl.v1beta1.Dataset;
import com.google.cloud.automl.v1beta1.LocationName;
import com.google.cloud.automl.v1beta1.TextExtractionDatasetMetadata;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.UUID;
import java.util.concurrent.ExecutionException;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
Expand Down Expand Up @@ -95,8 +93,7 @@ public void tearDown() throws InterruptedException, ExecutionException, IOExcept

@Test
public void testImportDataset() throws IOException, ExecutionException, InterruptedException {
ImportDataset.importDataset(
PROJECT_ID, datasetId, BUCKET + "/entity-extraction/dataset.csv");
ImportDataset.importDataset(PROJECT_ID, datasetId, BUCKET + "/entity-extraction/dataset.csv");
String got = bout.toString();
assertThat(got).contains("Dataset imported.");
}
Expand Down
Loading