Skip to content

Commit 681182f

Browse files
averikitschdzlier-gcp
authored andcommitted
Add quotes to variable
1 parent 891195a commit 681182f

File tree

16 files changed

+96
-27
lines changed

16 files changed

+96
-27
lines changed

.kokoro/tests/run_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ if [[ "$SCRIPT_DEBUG" != "true" ]]; then
5959
# For Tasks samples
6060
export QUEUE_ID=my-appengine-queue
6161
export LOCATION_ID=us-east1
62-
# For Datalabeling samples
63-
export DATALABELING_ENDPOINT=test-datalabeling.sandbox.googleapis.com:443
62+
# For Datalabeling samples to hit the testing endpoint
63+
export DATALABELING_ENDPOINT="test-datalabeling.sandbox.googleapis.com:443"
6464
source "${KOKORO_GFILE_DIR}/aws-secrets.sh"
6565
source "${KOKORO_GFILE_DIR}/storage-hmac-credentials.sh"
6666
source "${KOKORO_GFILE_DIR}/dlp_secrets.txt"

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/CreateAnnotationSpecSet.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,28 @@
3333
class CreateAnnotationSpecSet {
3434

3535
// Create an annotation spec set.
36-
static void createAnnotationSpecSet(String projectId) {
36+
static void createAnnotationSpecSet(String projectId) throws IOException {
3737
// String projectId = "YOUR_PROJECT_ID";
3838

3939
Map<String, String> annotationLabels = new HashMap<>();
4040
annotationLabels.put("label_1", "label_1_description");
4141
annotationLabels.put("label_2", "label_2_description");
4242

43+
// [END datalabeling_create_annotation_spec_set_beta]
4344
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4445
if (endpoint == null) {
4546
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
4647
}
48+
// [START datalabeling_create_annotation_spec_set_beta]
4749

50+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
51+
.newBuilder()
52+
// [END datalabeling_create_annotation_spec_set_beta]
53+
.setEndpoint(endpoint)
54+
// [START datalabeling_create_annotation_spec_set_beta]
55+
.build();
4856
try (DataLabelingServiceClient dataLabelingServiceClient =
49-
DataLabelingServiceClient.create(
50-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
57+
DataLabelingServiceClient.create(settings)) {
5158
ProjectName projectName = ProjectName.of(projectId);
5259

5360
List<AnnotationSpec> annotationSpecs = new ArrayList<>();

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/CreateDataset.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,25 @@
2727
class CreateDataset {
2828

2929
// Create a dataset that is initially empty.
30-
static void createDataset(String projectId, String datasetName) {
30+
static void createDataset(String projectId, String datasetName) throws IOException {
3131
// String projectId = "YOUR_PROJECT_ID";
3232
// String datasetName = "YOUR_DATASET_DISPLAY_NAME";
3333

34+
// [END datalabeling_create_dataset_beta]
3435
String endpoint = System.getenv("DATALABELING_ENDPOINT");
3536
if (endpoint == null) {
3637
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
3738
}
39+
// [START datalabeling_create_dataset_beta]
3840

41+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
42+
.newBuilder()
43+
// [END datalabeling_create_dataset_beta]
44+
.setEndpoint(endpoint)
45+
// [START datalabeling_create_dataset_beta]
46+
.build();
3947
try (DataLabelingServiceClient dataLabelingServiceClient =
40-
DataLabelingServiceClient.create(
41-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
48+
DataLabelingServiceClient.create(settings)) {
4249
ProjectName projectName = ProjectName.of(projectId);
4350

4451
Dataset dataset =

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/CreateInstruction.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,25 @@
3232
class CreateInstruction {
3333

3434
// Create a instruction for a dataset.
35-
static void createInstruction(String projectId, String pdfUri) {
35+
static void createInstruction(String projectId, String pdfUri) throws IOException {
3636
// String projectId = "YOUR_PROJECT_ID";
3737
// String pdfUri = "gs://YOUR_BUCKET_ID/path_to_pdf_or_csv";
3838

39+
// [END datalabeling_create_instruction_beta]
3940
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4041
if (endpoint == null) {
4142
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
4243
}
44+
// [START datalabeling_create_instruction_beta]
4345

46+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
47+
.newBuilder()
48+
// [END datalabeling_create_instruction_beta]
49+
.setEndpoint(endpoint)
50+
// [START datalabeling_create_instruction_beta]
51+
.build();
4452
try (DataLabelingServiceClient dataLabelingServiceClient =
45-
DataLabelingServiceClient.create(
46-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
53+
DataLabelingServiceClient.create(settings)) {
4754
ProjectName projectName = ProjectName.of(projectId);
4855

4956
// There are two types of instructions: CSV (CsvInstruction) or PDF (PdfInstruction)

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/ExportData.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
class ExportData {
3535

3636
// Export data from an annotated dataset.
37-
static void exportData(String datasetName, String annotatedDatasetName, String gcsOutputUri) {
37+
static void exportData(String datasetName, String annotatedDatasetName, String gcsOutputUri)
38+
throws IOException {
3839
// String datasetName = DataLabelingServiceClient.formatDatasetName(
3940
// "YOUR_PROJECT_ID", "YOUR_DATASETS_UUID");
4041
// String annotatedDatasetName = DataLabelingServiceClient.formatAnnotatedDatasetName(
@@ -43,14 +44,21 @@ static void exportData(String datasetName, String annotatedDatasetName, String g
4344
// "YOUR_ANNOTATED_DATASET_UUID");
4445
// String gcsOutputUri = "gs://YOUR_BUCKET_ID/export_path";
4546

47+
// [END datalabeling_export_data_beta]
4648
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4749
if (endpoint == null) {
4850
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
4951
}
52+
// [START datalabeling_export_data_beta]
5053

54+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
55+
.newBuilder()
56+
// [END datalabeling_export_data_beta]
57+
.setEndpoint(endpoint)
58+
// [START datalabeling_export_data_beta]
59+
.build();
5160
try (DataLabelingServiceClient dataLabelingServiceClient =
52-
DataLabelingServiceClient.create(
53-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
61+
DataLabelingServiceClient.create(settings)) {
5462
GcsDestination gcsDestination = GcsDestination.newBuilder()
5563
.setOutputUri(gcsOutputUri)
5664
.setMimeType("text/csv")

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/ImportData.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,26 @@
3232
class ImportData {
3333

3434
// Import data to an existing dataset.
35-
static void importData(String datasetName, String gcsSourceUri) {
35+
static void importData(String datasetName, String gcsSourceUri) throws IOException {
3636
// String datasetName = DataLabelingServiceClient.formatDatasetName(
3737
// "YOUR_PROJECT_ID", "YOUR_DATASETS_UUID");
3838
// String gcsSourceUri = "gs://YOUR_BUCKET_ID/path_to_data";
3939

40+
// [END datalabeling_import_data_beta]
4041
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4142
if (endpoint == null) {
4243
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
4344
}
45+
// [START datalabeling_import_data_beta]
4446

47+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
48+
.newBuilder()
49+
// [END datalabeling_import_data_beta]
50+
.setEndpoint(endpoint)
51+
// [START datalabeling_import_data_beta]
52+
.build();
4553
try (DataLabelingServiceClient dataLabelingServiceClient =
46-
DataLabelingServiceClient.create(
47-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
54+
DataLabelingServiceClient.create(settings)) {
4855
GcsSource gcsSource = GcsSource.newBuilder()
4956
.setInputUri(gcsSourceUri)
5057
.setMimeType("text/csv")

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/LabelImage.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class LabelImage {
3636
static void labelImage(
3737
String formattedInstructionName,
3838
String formattedAnnotationSpecSetName,
39-
String formattedDatasetName) {
39+
String formattedDatasetName) throws IOException {
4040
// String formattedInstructionName = DataLabelingServiceClient.formatInstructionName(
4141
// "YOUR_PROJECT_ID", "YOUR_INSTRUCTION_UUID");
4242
// String formattedAnnotationSpecSetName =
@@ -45,14 +45,21 @@ static void labelImage(
4545
// String formattedDatasetName = DataLabelingServiceClient.formatDatasetName(
4646
// "YOUR_PROJECT_ID", "YOUR_DATASET_UUID");
4747

48+
// [END datalabeling_label_image_beta]
4849
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4950
if (endpoint == null) {
5051
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
5152
}
53+
// [START datalabeling_label_image_beta]
5254

55+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
56+
.newBuilder()
57+
// [END datalabeling_label_image_beta]
58+
.setEndpoint(endpoint)
59+
// [START datalabeling_label_image_beta]
60+
.build();
5361
try (DataLabelingServiceClient dataLabelingServiceClient =
54-
DataLabelingServiceClient.create(
55-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
62+
DataLabelingServiceClient.create(settings)) {
5663
HumanAnnotationConfig humanAnnotationConfig =
5764
HumanAnnotationConfig.newBuilder()
5865
.setAnnotatedDatasetDisplayName("annotated_displayname")

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/LabelText.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class LabelText {
3636
static void labelText(
3737
String formattedInstructionName,
3838
String formattedAnnotationSpecSetName,
39-
String formattedDatasetName) {
39+
String formattedDatasetName) throws IOException {
4040
// String formattedInstructionName = DataLabelingServiceClient.formatInstructionName(
4141
// "YOUR_PROJECT_ID", "YOUR_INSTRUCTION_UUID");
4242
// String formattedAnnotationSpecSetName =
@@ -45,14 +45,21 @@ static void labelText(
4545
// String formattedDatasetName = DataLabelingServiceClient.formatDatasetName(
4646
// "YOUR_PROJECT_ID", "YOUR_DATASET_UUID");
4747

48+
// [END datalabeling_label_text_beta]
4849
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4950
if (endpoint == null) {
5051
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
5152
}
53+
// [START datalabeling_label_text_beta]
5254

55+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
56+
.newBuilder()
57+
// [END datalabeling_label_text_beta]
58+
.setEndpoint(endpoint)
59+
// [START datalabeling_label_text_beta]
60+
.build();
5361
try (DataLabelingServiceClient dataLabelingServiceClient =
54-
DataLabelingServiceClient.create(
55-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
62+
DataLabelingServiceClient.create(settings)) {
5663
HumanAnnotationConfig humanAnnotationConfig =
5764
HumanAnnotationConfig.newBuilder()
5865
.setAnnotatedDatasetDisplayName("annotated_displayname")

datalabeling/beta/cloud-client/src/main/java/com/example/datalabeling/LabelVideo.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LabelVideo {
3434

3535
// Start a Video Labeling Task
3636
static void labelVideo(String formattedInstructionName, String formattedAnnotationSpecSetName,
37-
String formattedDatasetName) {
37+
String formattedDatasetName) throws IOException {
3838
// String formattedInstructionName = DataLabelingServiceClient.formatInstructionName(
3939
// "YOUR_PROJECT_ID", "YOUR_INSTRUCTION_UUID");
4040
// String formattedAnnotationSpecSetName =
@@ -43,14 +43,21 @@ static void labelVideo(String formattedInstructionName, String formattedAnnotati
4343
// String formattedDatasetName = DataLabelingServiceClient.formatDatasetName(
4444
// "YOUR_PROJECT_ID", "YOUR_DATASET_UUID");
4545

46+
// [END datalabeling_label_video_beta]
4647
String endpoint = System.getenv("DATALABELING_ENDPOINT");
4748
if (endpoint == null) {
4849
endpoint = DataLabelingServiceSettings.getDefaultEndpoint();
4950
}
51+
// [START datalabeling_label_video_beta]
5052

53+
DataLabelingServiceSettings settings = DataLabelingServiceSettings
54+
.newBuilder()
55+
// [END datalabeling_label_video_beta]
56+
.setEndpoint(endpoint)
57+
// [START datalabeling_label_video_beta]
58+
.build();
5159
try (DataLabelingServiceClient dataLabelingServiceClient =
52-
DataLabelingServiceClient.create(
53-
DataLabelingServiceSettings.newBuilder().setEndpoint(endpoint).build())) {
60+
DataLabelingServiceClient.create(settings)) {
5461
HumanAnnotationConfig humanAnnotationConfig = HumanAnnotationConfig.newBuilder()
5562
.setAnnotatedDatasetDisplayName("annotated_displayname")
5663
.setAnnotatedDatasetDescription("annotated_description")

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/CreateAnnotationSpecSetIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.hamcrest.CoreMatchers;
3030
import org.junit.After;
3131
import org.junit.Before;
32+
import org.junit.Ignore;
3233
import org.junit.Test;
3334
import org.junit.runner.RunWith;
3435
import org.junit.runners.JUnit4;
@@ -37,6 +38,7 @@
3738
* Integration (system) tests for {@link CreateAnnotationSpecSet}.
3839
*/
3940
@RunWith(JUnit4.class)
41+
@Ignore("b/146064330")
4042
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4143
public class CreateAnnotationSpecSetIT {
4244

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/CreateDatasetIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.hamcrest.CoreMatchers;
3030
import org.junit.After;
3131
import org.junit.Before;
32+
import org.junit.Ignore;
3233
import org.junit.Test;
3334
import org.junit.runner.RunWith;
3435
import org.junit.runners.JUnit4;
@@ -37,6 +38,7 @@
3738
* Integration (system) tests for {@link CreateDataset}.
3839
*/
3940
@RunWith(JUnit4.class)
41+
@Ignore("b/146064330")
4042
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4143
public class CreateDatasetIT {
4244

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/CreateInstructionIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.hamcrest.CoreMatchers;
3030
import org.junit.After;
3131
import org.junit.Before;
32+
import org.junit.Ignore;
3233
import org.junit.Test;
3334
import org.junit.runner.RunWith;
3435
import org.junit.runners.JUnit4;
@@ -37,6 +38,7 @@
3738
* Integration (system) tests for {@link CreateInstruction}.
3839
*/
3940
@RunWith(JUnit4.class)
41+
@Ignore("b/146064330")
4042
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4143
public class CreateInstructionIT {
4244

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/ImportDataIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* Integration (system) tests for {@link ImportData}.
3939
*/
4040
@RunWith(JUnit4.class)
41+
@Ignore("b/146064330")
4142
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4243
public class ImportDataIT {
4344

@@ -103,7 +104,6 @@ public void tearDown() {
103104
}
104105

105106
@Test
106-
@Ignore("b/146064330")
107107
public void testImportDataset() {
108108
ImportData.importData(dataset.getName(), GCS_SOURCE_URI);
109109

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/LabelImageIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.io.PrintStream;
3333
import org.junit.After;
3434
import org.junit.Before;
35+
import org.junit.Ignore;
3536
import org.junit.Test;
3637
import org.junit.runner.RunWith;
3738
import org.junit.runners.JUnit4;
@@ -40,6 +41,7 @@
4041
* Integration (system) tests for {@link LabelImage}.
4142
*/
4243
@RunWith(JUnit4.class)
44+
@Ignore("b/146064330")
4345
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4446
public class LabelImageIT {
4547
private static String PROJECT_ID = System.getenv().get("GOOGLE_CLOUD_PROJECT");

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/LabelTextIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
import java.io.PrintStream;
3838
import org.junit.After;
3939
import org.junit.Before;
40+
import org.junit.Ignore;
4041
import org.junit.Test;
4142
import org.junit.runner.RunWith;
4243
import org.junit.runners.JUnit4;
4344

4445
/** Integration (system) tests for {@link LabelText}. */
4546
@RunWith(JUnit4.class)
47+
@Ignore("b/146064330")
4648
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4749
public class LabelTextIT {
4850
private static String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");

datalabeling/beta/cloud-client/src/test/java/com/example/datalabeling/LabelVideoIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
import java.io.PrintStream;
3838
import org.junit.After;
3939
import org.junit.Before;
40+
import org.junit.Ignore;
4041
import org.junit.Test;
4142
import org.junit.runner.RunWith;
4243
import org.junit.runners.JUnit4;
4344

4445
/** Integration (system) tests for {@link LabelVideo}. */
4546
@RunWith(JUnit4.class)
47+
@Ignore("b/146064330")
4648
@SuppressWarnings("checkstyle:abbreviationaswordinname")
4749
public class LabelVideoIT {
4850
private static String PROJECT_ID = System.getenv().get("GOOGLE_CLOUD_PROJECT");

0 commit comments

Comments
 (0)