@@ -52,7 +52,9 @@ public class AdminIT {
52
52
private static final String projectId = System .getenv ("GOOGLE_CLOUD_PROJECT" );
53
53
private static final String _suffix = UUID .randomUUID ().toString ();
54
54
private static final String topicId = "iam-topic-" + _suffix ;
55
- private static final String ingestionTopicId = "ingestion-topic-" + _suffix ;
55
+ private static final String kinesisIngestionTopicId = "kinesis-ingestion-topic-" + _suffix ;
56
+ private static final String cloudStorageIngestionTopicId =
57
+ "cloud-storage-ingestion-topic-" + _suffix ;
56
58
private static final String pullSubscriptionId = "iam-pull-subscription-" + _suffix ;
57
59
private static final String pushSubscriptionId = "iam-push-subscription-" + _suffix ;
58
60
private static final String orderedSubscriptionId = "iam-ordered-subscription-" + _suffix ;
@@ -75,9 +77,18 @@ public class AdminIT {
75
77
private static final String awsRoleArn = "arn:aws:iam::111111111111:role/fake-role-name" ;
76
78
private static final String gcpServiceAccount =
77
79
80
+ private static final String cloudStorageBucket = "pubsub-cloud-storage-bucket" ;
81
+ private static final String cloudStorageInputFormat = "text" ;
82
+ private static final String cloudStorageTextDelimiter = "," ;
83
+ private static final String cloudStorageMatchGlob = "**.txt" ;
84
+ private static final String cloudStorageMinimumObjectCreateTime = "1970-01-01T00:00:00Z" ;
85
+ private static final String cloudStorageMinimumObjectCreateTimeSeconds = "0" ;
78
86
79
87
private static final TopicName topicName = TopicName .of (projectId , topicId );
80
- private static final TopicName ingestionTopicName = TopicName .of (projectId , ingestionTopicId );
88
+ private static final TopicName kinesisIngestionTopicName =
89
+ TopicName .of (projectId , kinesisIngestionTopicId );
90
+ private static final TopicName cloudStorageIngestionTopicName =
91
+ TopicName .of (projectId , cloudStorageIngestionTopicId );
81
92
private static final SubscriptionName pullSubscriptionName =
82
93
SubscriptionName .of (projectId , pullSubscriptionId );
83
94
private static final SubscriptionName pushSubscriptionName =
@@ -304,9 +315,9 @@ public void testAdmin() throws Exception {
304
315
bout .reset ();
305
316
// Test create topic with Kinesis ingestion settings.
306
317
CreateTopicWithKinesisIngestionExample .createTopicWithKinesisIngestionExample (
307
- projectId , ingestionTopicId , streamArn , consumerArn , awsRoleArn , gcpServiceAccount );
318
+ projectId , kinesisIngestionTopicId , streamArn , consumerArn , awsRoleArn , gcpServiceAccount );
308
319
assertThat (bout .toString ())
309
- .contains ("google.pubsub.v1.Topic.name=" + ingestionTopicName .toString ());
320
+ .contains ("google.pubsub.v1.Topic.name=" + kinesisIngestionTopicName .toString ());
310
321
assertThat (bout .toString ()).contains (streamArn );
311
322
assertThat (bout .toString ()).contains (consumerArn );
312
323
assertThat (bout .toString ()).contains (awsRoleArn );
@@ -315,17 +326,40 @@ public void testAdmin() throws Exception {
315
326
bout .reset ();
316
327
// Test update existing Kinesis ingestion settings.
317
328
UpdateTopicTypeExample .updateTopicTypeExample (
318
- projectId , ingestionTopicId , streamArn , consumerArn2 , awsRoleArn , gcpServiceAccount );
329
+ projectId , kinesisIngestionTopicId , streamArn , consumerArn2 , awsRoleArn , gcpServiceAccount );
319
330
assertThat (bout .toString ())
320
- .contains ("google.pubsub.v1.Topic.name=" + ingestionTopicName .toString ());
331
+ .contains ("google.pubsub.v1.Topic.name=" + kinesisIngestionTopicName .toString ());
321
332
assertThat (bout .toString ()).contains (streamArn );
322
333
assertThat (bout .toString ()).contains (consumerArn2 );
323
334
assertThat (bout .toString ()).contains (awsRoleArn );
324
335
assertThat (bout .toString ()).contains (gcpServiceAccount );
325
336
326
337
bout .reset ();
327
338
// Test delete Kinesis ingestion topic.
328
- DeleteTopicExample .deleteTopicExample (projectId , ingestionTopicId );
339
+ DeleteTopicExample .deleteTopicExample (projectId , kinesisIngestionTopicId );
340
+ assertThat (bout .toString ()).contains ("Deleted topic." );
341
+
342
+ bout .reset ();
343
+ // Test create topic with Cloud Storage ingestion settings.
344
+ CreateTopicWithCloudStorageIngestionExample .createTopicWithCloudStorageIngestionExample (
345
+ projectId ,
346
+ cloudStorageIngestionTopicId ,
347
+ cloudStorageBucket ,
348
+ cloudStorageInputFormat ,
349
+ cloudStorageTextDelimiter ,
350
+ cloudStorageMatchGlob ,
351
+ cloudStorageMinimumObjectCreateTime );
352
+ assertThat (bout .toString ())
353
+ .contains ("google.pubsub.v1.Topic.name=" + cloudStorageIngestionTopicName .toString ());
354
+ assertThat (bout .toString ()).contains (cloudStorageBucket );
355
+ assertThat (bout .toString ()).contains (cloudStorageInputFormat );
356
+ assertThat (bout .toString ()).contains (cloudStorageTextDelimiter );
357
+ assertThat (bout .toString ()).contains (cloudStorageMatchGlob );
358
+ assertThat (bout .toString ()).contains (cloudStorageMinimumObjectCreateTimeSeconds );
359
+
360
+ bout .reset ();
361
+ // Test delete Cloud Storage ingestion topic.
362
+ DeleteTopicExample .deleteTopicExample (projectId , cloudStorageIngestionTopicId );
329
363
assertThat (bout .toString ()).contains ("Deleted topic." );
330
364
}
331
365
}
0 commit comments