27
27
import java .io .ByteArrayOutputStream ;
28
28
import java .io .IOException ;
29
29
import java .io .PrintStream ;
30
- import java .util .ArrayList ;
31
- import java .util .List ;
32
30
import java .util .UUID ;
33
31
import java .util .concurrent .ExecutionException ;
34
32
import java .util .concurrent .TimeoutException ;
@@ -47,11 +45,8 @@ public class BatchTranslateTextWithGlossaryAndModelTests {
47
45
private static final String PROJECT_ID = System .getenv ("GOOGLE_CLOUD_PROJECT" );
48
46
private static final String INPUT_URI =
49
47
"gs://cloud-samples-data/translation/text_with_custom_model_and_glossary.txt" ;
50
- private static final String GLOSSARY_ID =
51
- String .format ("test_%s" , UUID .randomUUID ().toString ().replace ("-" , "_" ).substring (0 , 26 ));
48
+ private static final String GLOSSARY_ID = "DO_NOT_DELETE_TEST_GLOSSARY" ;
52
49
private static final String MODEL_ID = "TRL2188848820815848149" ;
53
- private static final String GLOSSARY_INPUT_URI =
54
- "gs://cloud-samples-data/translation/glossary_ja.csv" ;
55
50
private static final String PREFIX = "BATCH_TRANSLATION_WITH_MODEL_OUTPUT/" ;
56
51
private static final String OUTPUT_URI =
57
52
String .format ("gs://%s/%s%s/" , PROJECT_ID , PREFIX , UUID .randomUUID ());
@@ -100,14 +95,9 @@ public static void checkRequirements() {
100
95
private PrintStream originalPrintStream ;
101
96
102
97
@ Before
103
- public void setUp () throws InterruptedException , ExecutionException , IOException {
104
- // Create a glossary that can be used in the test
98
+ public void setUp () {
105
99
PrintStream temp = new PrintStream (new ByteArrayOutputStream ());
106
100
System .setOut (temp );
107
- List <String > languageCodes = new ArrayList <>();
108
- languageCodes .add ("en" );
109
- languageCodes .add ("ja" );
110
- CreateGlossary .createGlossary (PROJECT_ID , GLOSSARY_ID , languageCodes , GLOSSARY_INPUT_URI );
111
101
112
102
bout = new ByteArrayOutputStream ();
113
103
out = new PrintStream (bout );
@@ -116,16 +106,13 @@ public void setUp() throws InterruptedException, ExecutionException, IOException
116
106
}
117
107
118
108
@ After
119
- public void tearDown () throws InterruptedException , ExecutionException , IOException {
109
+ public void tearDown () {
120
110
cleanUpBucket ();
121
- // Delete the created glossary
122
- DeleteGlossary .deleteGlossary (PROJECT_ID , GLOSSARY_ID );
123
111
System .out .flush ();
124
112
System .setOut (originalPrintStream );
125
113
}
126
114
127
- @ Rule
128
- public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule (3 );
115
+ @ Rule public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule (3 );
129
116
130
117
@ Test
131
118
public void testBatchTranslateTextWithGlossaryAndModel ()
0 commit comments