Skip to content

Commit

Permalink
chore: removed retry class and used com.google.cloud.testing.Multiple… (
Browse files Browse the repository at this point in the history
#398)

* chore: removed retry class and used com.google.cloud.testing.MultipleAttempt

* xed lint
  • Loading branch information
munkhuushmgl authored and Shabirmean committed Nov 18, 2022
1 parent 6f54c12 commit 26ccfa4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 69 deletions.
7 changes: 7 additions & 0 deletions translate/snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
<version>1.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
<version>1.94.0</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
<!-- [END_EXCLUDE] -->
</dependencies>
<!-- [END translation_install_with_bom] -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand All @@ -49,7 +50,6 @@ public class BatchTranslateTextTests {

private ByteArrayOutputStream bout;
private PrintStream out;
@Rule public Retry retry = new Retry(3);

private static void cleanUpBucket() {
Storage storage = StorageOptions.getDefaultInstance().getService();
Expand Down Expand Up @@ -106,6 +106,9 @@ public void tearDown() {
System.setOut(originalPrintStream);
}

@Rule
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);

@Test
public void testBatchTranslateText()
throws InterruptedException, ExecutionException, IOException, TimeoutException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -57,7 +58,6 @@ public class BatchTranslateTextWithGlossaryAndModelTests {

private ByteArrayOutputStream bout;
private PrintStream out;
@Rule public Retry retry = new Retry(3);

private static final void cleanUpBucket() {
Storage storage = StorageOptions.getDefaultInstance().getService();
Expand Down Expand Up @@ -124,6 +124,9 @@ public void tearDown() throws InterruptedException, ExecutionException, IOExcept
System.setOut(originalPrintStream);
}

@Rule
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);

@Test
public void testBatchTranslateTextWithGlossaryAndModel()
throws InterruptedException, ExecutionException, IOException, TimeoutException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -122,7 +123,8 @@ public void tearDown() throws InterruptedException, ExecutionException, IOExcept
System.setOut(originalPrintStream);
}

@Rule public Retry retry = new Retry(3);
@Rule
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);

@Test
public void testBatchTranslateTextWithGlossary()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageOptions;
import com.google.cloud.testing.junit4.MultipleAttemptsRule;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
Expand Down Expand Up @@ -106,7 +107,8 @@ public void tearDown() {
System.setOut(originalPrintStream);
}

@Rule public Retry retry = new Retry(3);
@Rule
public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);

@Test
public void testBatchTranslateTextWithModel()
Expand Down
65 changes: 0 additions & 65 deletions translate/snippets/src/test/java/com/example/translate/Retry.java

This file was deleted.

0 comments on commit 26ccfa4

Please sign in to comment.