Skip to content

Commit 3b8249c

Browse files
authored
chore: moving the rest of the vision samples (#291)
* chore: moving the rest of the vision samples * fixed pom issue * deleted facedetection app sample * refactored printout stream
1 parent 39d19d4 commit 3b8249c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+442
-36
lines changed

vision/snippets/src/test/java/com/example/vision/AsyncBatchAnnotateImagesTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class AsyncBatchAnnotateImagesTest {
4646

4747
private ByteArrayOutputStream bout;
4848
private PrintStream out;
49+
private PrintStream originalPrintStream;
4950

5051
private static void requireEnvVar(String varName) {
5152
assertNotNull(
@@ -62,12 +63,14 @@ public static void checkRequirements() {
6263
public void setUp() {
6364
bout = new ByteArrayOutputStream();
6465
out = new PrintStream(bout);
66+
originalPrintStream = System.out;
6567
System.setOut(out);
6668
}
6769

6870
@After
6971
public void tearDown() {
70-
System.setOut(null);
72+
System.out.flush();
73+
System.setOut(originalPrintStream);
7174

7275
Storage storage = StorageOptions.getDefaultInstance().getService();
7376

vision/snippets/src/test/java/com/example/vision/BatchAnnotateFilesGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@
3333
public class BatchAnnotateFilesGcsTest {
3434
private ByteArrayOutputStream bout;
3535
private PrintStream out;
36+
private PrintStream originalPrintStream;
3637

3738
@Before
3839
public void setUp() {
3940
bout = new ByteArrayOutputStream();
4041
out = new PrintStream(bout);
42+
originalPrintStream = System.out;
4143
System.setOut(out);
4244
}
4345

4446
@After
4547
public void tearDown() {
46-
System.setOut(null);
48+
System.out.flush();
49+
System.setOut(originalPrintStream);
4750
}
4851

4952
@Test

vision/snippets/src/test/java/com/example/vision/BatchAnnotateFilesTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@
3333
public class BatchAnnotateFilesTest {
3434
private ByteArrayOutputStream bout;
3535
private PrintStream out;
36+
private PrintStream originalPrintStream;
3637

3738
@Before
3839
public void setUp() {
3940
bout = new ByteArrayOutputStream();
4041
out = new PrintStream(bout);
42+
originalPrintStream = System.out;
4143
System.setOut(out);
4244
}
4345

4446
@After
4547
public void tearDown() {
46-
System.setOut(null);
48+
System.out.flush();
49+
System.setOut(originalPrintStream);
4750
}
4851

4952
@Test

vision/snippets/src/test/java/com/example/vision/DetectBetaIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,22 @@ public class DetectBetaIT {
4343
private static final String OUTPUT_PREFIX = "OUTPUT_VISION_BETA_" + UUID.randomUUID().toString();
4444
private ByteArrayOutputStream bout;
4545
private PrintStream out;
46+
private PrintStream originalPrintStream;
4647
private DetectBeta app;
4748

4849
@Before
4950
public void setUp() throws IOException {
5051
bout = new ByteArrayOutputStream();
5152
out = new PrintStream(bout);
53+
originalPrintStream = System.out;
5254
System.setOut(out);
5355
app = new DetectBeta();
5456
}
5557

5658
@After
5759
public void tearDown() {
58-
System.setOut(null);
60+
System.out.flush();
61+
System.setOut(originalPrintStream);
5962
}
6063

6164
@Test

vision/snippets/src/test/java/com/example/vision/DetectCropHintsGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ public class DetectCropHintsGcsTest {
3636

3737
private ByteArrayOutputStream bout;
3838
private PrintStream out;
39+
private PrintStream originalPrintStream;
3940

4041
@Before
4142
public void setUp() {
4243
bout = new ByteArrayOutputStream();
4344
out = new PrintStream(bout);
45+
originalPrintStream = System.out;
4446
System.setOut(out);
4547
}
4648

4749
@After
4850
public void tearDown() {
49-
System.setOut(null);
51+
System.out.flush();
52+
System.setOut(originalPrintStream);
5053
}
5154

5255
@Test

vision/snippets/src/test/java/com/example/vision/DetectCropHintsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@
3333
public class DetectCropHintsTest {
3434
private ByteArrayOutputStream bout;
3535
private PrintStream out;
36+
private PrintStream originalPrintStream;
3637

3738
@Before
3839
public void setUp() {
3940
bout = new ByteArrayOutputStream();
4041
out = new PrintStream(bout);
42+
originalPrintStream = System.out;
4143
System.setOut(out);
4244
}
4345

4446
@After
4547
public void tearDown() {
46-
System.setOut(null);
48+
System.out.flush();
49+
System.setOut(originalPrintStream);
4750
}
4851

4952
@Test

vision/snippets/src/test/java/com/example/vision/DetectFacesGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@ public class DetectFacesGcsTest {
3535

3636
private ByteArrayOutputStream bout;
3737
private PrintStream out;
38+
private PrintStream originalPrintStream;
3839

3940
@Before
4041
public void setUp() {
4142
bout = new ByteArrayOutputStream();
4243
out = new PrintStream(bout);
44+
originalPrintStream = System.out;
4345
System.setOut(out);
4446
}
4547

4648
@After
4749
public void tearDown() {
48-
System.setOut(null);
50+
System.out.flush();
51+
System.setOut(originalPrintStream);
4952
}
5053

5154
@Test

vision/snippets/src/test/java/com/example/vision/DetectFacesTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@
3232
public class DetectFacesTest {
3333
private ByteArrayOutputStream bout;
3434
private PrintStream out;
35+
private PrintStream originalPrintStream;
3536

3637
@Before
3738
public void setUp() {
3839
bout = new ByteArrayOutputStream();
3940
out = new PrintStream(bout);
41+
originalPrintStream = System.out;
4042
System.setOut(out);
4143
}
4244

4345
@After
4446
public void tearDown() {
45-
System.setOut(null);
47+
System.out.flush();
48+
System.setOut(originalPrintStream);
4649
}
4750

4851
@Test

vision/snippets/src/test/java/com/example/vision/DetectIT.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
public class DetectIT {
3939
private ByteArrayOutputStream bout;
4040
private PrintStream out;
41+
private PrintStream originalPrintStream;
4142
private static final String ASSET_BUCKET = "cloud-samples-data";
4243
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
4344
private static final String OUTPUT_BUCKET = PROJECT_ID;
@@ -47,12 +48,14 @@ public class DetectIT {
4748
public void setUp() {
4849
bout = new ByteArrayOutputStream();
4950
out = new PrintStream(bout);
51+
originalPrintStream = System.out;
5052
System.setOut(out);
5153
}
5254

5355
@After
5456
public void tearDown() {
55-
System.setOut(null);
57+
System.out.flush();
58+
System.setOut(originalPrintStream);
5659
}
5760

5861
@Test

vision/snippets/src/test/java/com/example/vision/DetectLabelsGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,20 @@ public class DetectLabelsGcsTest {
3434

3535
private ByteArrayOutputStream bout;
3636
private PrintStream out;
37+
private PrintStream originalPrintStream;
3738

3839
@Before
3940
public void setUp() {
4041
bout = new ByteArrayOutputStream();
4142
out = new PrintStream(bout);
43+
originalPrintStream = System.out;
4244
System.setOut(out);
4345
}
4446

4547
@After
4648
public void tearDown() {
47-
System.setOut(null);
49+
System.out.flush();
50+
System.setOut(originalPrintStream);
4851
}
4952

5053
@Test

vision/snippets/src/test/java/com/example/vision/DetectLabelsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@
3232
public class DetectLabelsTest {
3333
private ByteArrayOutputStream bout;
3434
private PrintStream out;
35+
private PrintStream originalPrintStream;
3536

3637
@Before
3738
public void setUp() {
3839
bout = new ByteArrayOutputStream();
3940
out = new PrintStream(bout);
41+
originalPrintStream = System.out;
4042
System.setOut(out);
4143
}
4244

4345
@After
4446
public void tearDown() {
45-
System.setOut(null);
47+
System.out.flush();
48+
System.setOut(originalPrintStream);
4649
}
4750

4851
@Test

vision/snippets/src/test/java/com/example/vision/DetectLandmarksGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ public class DetectLandmarksGcsTest {
3636

3737
private ByteArrayOutputStream bout;
3838
private PrintStream out;
39+
private PrintStream originalPrintStream;
3940

4041
@Before
4142
public void setUp() {
4243
bout = new ByteArrayOutputStream();
4344
out = new PrintStream(bout);
45+
originalPrintStream = System.out;
4446
System.setOut(out);
4547
}
4648

4749
@After
4850
public void tearDown() {
49-
System.setOut(null);
51+
System.out.flush();
52+
System.setOut(originalPrintStream);
5053
}
5154

5255
@Test

vision/snippets/src/test/java/com/example/vision/DetectLandmarksTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@
3232
public class DetectLandmarksTest {
3333
private ByteArrayOutputStream bout;
3434
private PrintStream out;
35+
private PrintStream originalPrintStream;
3536

3637
@Before
3738
public void setUp() {
3839
bout = new ByteArrayOutputStream();
3940
out = new PrintStream(bout);
41+
originalPrintStream = System.out;
4042
System.setOut(out);
4143
}
4244

4345
@After
4446
public void tearDown() {
45-
System.setOut(null);
47+
System.out.flush();
48+
System.setOut(originalPrintStream);
4649
}
4750

4851
@Test

vision/snippets/src/test/java/com/example/vision/DetectLogosGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@ public class DetectLogosGcsTest {
3535

3636
private ByteArrayOutputStream bout;
3737
private PrintStream out;
38+
private PrintStream originalPrintStream;
3839

3940
@Before
4041
public void setUp() {
4142
bout = new ByteArrayOutputStream();
4243
out = new PrintStream(bout);
44+
originalPrintStream = System.out;
4345
System.setOut(out);
4446
}
4547

4648
@After
4749
public void tearDown() {
48-
System.setOut(null);
50+
System.out.flush();
51+
System.setOut(originalPrintStream);
4952
}
5053

5154
@Test

vision/snippets/src/test/java/com/example/vision/DetectLogosTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@
3232
public class DetectLogosTest {
3333
private ByteArrayOutputStream bout;
3434
private PrintStream out;
35+
private PrintStream originalPrintStream;
3536

3637
@Before
3738
public void setUp() {
3839
bout = new ByteArrayOutputStream();
3940
out = new PrintStream(bout);
41+
originalPrintStream = System.out;
4042
System.setOut(out);
4143
}
4244

4345
@After
4446
public void tearDown() {
45-
System.setOut(null);
47+
System.out.flush();
48+
System.setOut(originalPrintStream);
4649
}
4750

4851
@Test

vision/snippets/src/test/java/com/example/vision/DetectPropertiesGcsTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@ public class DetectPropertiesGcsTest {
3535

3636
private ByteArrayOutputStream bout;
3737
private PrintStream out;
38+
private PrintStream originalPrintStream;
3839

3940
@Before
4041
public void setUp() {
4142
bout = new ByteArrayOutputStream();
4243
out = new PrintStream(bout);
44+
originalPrintStream = System.out;
4345
System.setOut(out);
4446
}
4547

4648
@After
4749
public void tearDown() {
48-
System.setOut(null);
50+
System.out.flush();
51+
System.setOut(originalPrintStream);
4952
}
5053

5154
@Test

vision/snippets/src/test/java/com/example/vision/DetectPropertiesTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@
3232
public class DetectPropertiesTest {
3333
private ByteArrayOutputStream bout;
3434
private PrintStream out;
35+
private PrintStream originalPrintStream;
3536

3637
@Before
3738
public void setUp() {
3839
bout = new ByteArrayOutputStream();
3940
out = new PrintStream(bout);
41+
originalPrintStream = System.out;
4042
System.setOut(out);
4143
}
4244

4345
@After
4446
public void tearDown() {
45-
System.setOut(null);
47+
System.out.flush();
48+
System.setOut(originalPrintStream);
4649
}
4750

4851
@Test

0 commit comments

Comments
 (0)