Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public final class TopicId implements Serializable {

private static final long serialVersionUID = -4913169763174877777L;
private static final String DELETED_TOPIC_NAME = "_deleted_topic_";
private static final String DELETED_TOPIC_NAME = "_deleted-topic_";
private static final TopicId DELETED_TOPIC = new TopicId(null, DELETED_TOPIC_NAME, true);

private final String project;
Expand Down Expand Up @@ -68,7 +68,7 @@ public String topic() {
/**
* Returns {@code true} if this object is the identity of a deleted topic, {@code false}
* otherwhise. If {@code isDeleted()} is {@code true}, {@link #topic()} returns
* "{@code _deleted_topic_}" and {@link #project()} returns {@code null}.
* "{@code _deleted-topic_}" and {@link #project()} returns {@code null}.
*/
public boolean isDeleted() {
return isDeleted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testToAndFromPb() {
SubscriptionInfo.fromPb(subscriptionInfo.toPb("project")));
com.google.pubsub.v1.Subscription subscription = SUBSCRIPTION_INFO.toPb("project");
subscriptionInfo =
SubscriptionInfo.fromPb(subscription.toBuilder().setTopic("_deleted_topic_").build());
SubscriptionInfo.fromPb(subscription.toBuilder().setTopic("_deleted-topic_").build());
assertEquals(TopicId.deletedTopic(), subscriptionInfo.topic());
assertEquals(NAME, subscriptionInfo.name());
assertEquals(PUSH_CONFIG, subscriptionInfo.pushConfig());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class TopicIdTest {
private static final String PROJECT = "project";
private static final String NAME = "topic";
private static final String TOPIC_PB = "projects/project/topics/topic";
private static final String DELETED_TOPIC_NAME = "_deleted-topic_";

@Test
public void testOf() {
Expand All @@ -45,7 +46,7 @@ public void testOf() {
public void testDeletedTopic() {
TopicId deletedTopic = TopicId.deletedTopic();
assertNull(deletedTopic.project());
assertEquals("_deleted_topic_", deletedTopic.topic());
assertEquals(DELETED_TOPIC_NAME, deletedTopic.topic());
assertTrue(deletedTopic.isDeleted());
assertSame(deletedTopic, TopicId.deletedTopic());
}
Expand All @@ -60,6 +61,7 @@ public void testToAndFromPb() {
topicPb = topicId.toPb("otherProject");
assertEquals("projects/otherProject/topics/topic", topicPb);
compareTopicId(TopicId.of("otherProject", NAME), TopicId.fromPb(topicPb));
assertSame(TopicId.deletedTopic(), TopicId.fromPb(DELETED_TOPIC_NAME));
}

private void compareTopicId(TopicId expected, TopicId value) {
Expand Down