public class TestPubsub extends java.lang.Object implements org.junit.rules.TestRule
Deletes topic on shutdown.
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
Description description) |
void |
checkIfAnySubscriptionExists(java.lang.String project,
Duration timeoutDuration)
Check if topics exist.
|
static TestPubsub |
create()
Creates an instance of this rule.
|
void |
publish(java.util.List<PubsubMessage> messages)
Publish messages to
topicPath() . |
PubsubClient.TopicPath |
topicPath()
Topic path where events will be published to.
|
public static TestPubsub create()
Loads GCP configuration from TestPipelineOptions
.
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, Description description)
apply
in interface org.junit.rules.TestRule
public PubsubClient.TopicPath topicPath()
public void publish(java.util.List<PubsubMessage> messages) throws java.io.IOException
topicPath()
.java.io.IOException
public void checkIfAnySubscriptionExists(java.lang.String project, Duration timeoutDuration) throws java.lang.InterruptedException, java.lang.IllegalArgumentException, java.io.IOException, java.util.concurrent.TimeoutException
project
- GCP project identifier.timeoutDuration
- Joda duration that sets a period of time before checking times out.java.lang.InterruptedException
java.lang.IllegalArgumentException
java.io.IOException
java.util.concurrent.TimeoutException