File tree Expand file tree Collapse file tree 3 files changed +19
-13
lines changed
main/java/com/example/task
test/java/com/example/task Expand file tree Collapse file tree 3 files changed +19
-13
lines changed Original file line number Diff line number Diff line change 17
17
package com .example .task ;
18
18
19
19
// [START cloud_tasks_create_http_task]
20
- import com .google .cloud .tasks .v2beta3 .CloudTasksClient ;
21
- import com .google .cloud .tasks .v2beta3 .HttpMethod ;
22
- import com .google .cloud .tasks .v2beta3 .HttpRequest ;
23
- import com .google .cloud .tasks .v2beta3 .QueueName ;
24
- import com .google .cloud .tasks .v2beta3 .Task ;
20
+ import com .google .cloud .tasks .v2 .CloudTasksClient ;
21
+ import com .google .cloud .tasks .v2 .HttpMethod ;
22
+ import com .google .cloud .tasks .v2 .HttpRequest ;
23
+ import com .google .cloud .tasks .v2 .QueueName ;
24
+ import com .google .cloud .tasks .v2 .Task ;
25
25
import com .google .protobuf .ByteString ;
26
26
import java .nio .charset .Charset ;
27
27
Original file line number Diff line number Diff line change 17
17
package com .example .task ;
18
18
19
19
// [START cloud_tasks_create_http_task_with_token]
20
- import com .google .cloud .tasks .v2beta3 .CloudTasksClient ;
21
- import com .google .cloud .tasks .v2beta3 .HttpMethod ;
22
- import com .google .cloud .tasks .v2beta3 .HttpRequest ;
23
- import com .google .cloud .tasks .v2beta3 .OidcToken ;
24
- import com .google .cloud .tasks .v2beta3 .QueueName ;
25
- import com .google .cloud .tasks .v2beta3 .Task ;
20
+ import com .google .cloud .tasks .v2 .CloudTasksClient ;
21
+ import com .google .cloud .tasks .v2 .HttpMethod ;
22
+ import com .google .cloud .tasks .v2 .HttpRequest ;
23
+ import com .google .cloud .tasks .v2 .OidcToken ;
24
+ import com .google .cloud .tasks .v2 .QueueName ;
25
+ import com .google .cloud .tasks .v2 .Task ;
26
26
import com .google .protobuf .ByteString ;
27
27
import java .nio .charset .Charset ;
28
28
Original file line number Diff line number Diff line change 18
18
19
19
import static com .google .common .truth .Truth .assertThat ;
20
20
21
+ import com .google .cloud .tasks .v2 .CloudTasksClient ;
22
+ import com .google .cloud .tasks .v2 .QueueName ;
21
23
import java .io .ByteArrayOutputStream ;
22
24
import java .io .PrintStream ;
23
25
import org .junit .After ;
24
26
import org .junit .Before ;
25
- import org .junit .Rule ;
26
27
import org .junit .Test ;
27
- import org .junit .rules .Timeout ;
28
28
import org .junit .runner .RunWith ;
29
29
import org .junit .runners .JUnit4 ;
30
30
@@ -49,6 +49,12 @@ public void setUp() {
49
49
@ After
50
50
public void tearDown () {
51
51
System .setOut (null );
52
+ try (CloudTasksClient client = CloudTasksClient .create ()) {
53
+ String queuePath = QueueName .of (PROJECT_ID , LOCATION_ID , QUEUE_ID ).toString ();
54
+ client .purgeQueue (queuePath );
55
+ } catch (Exception e ) {
56
+ System .out .println ("Error with queue purge." );
57
+ }
52
58
}
53
59
54
60
@ Test
You can’t perform that action at this time.
0 commit comments