From b872399fe0c8a444cc5b52a89fd3baff9cd18aab Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Thu, 26 May 2016 13:27:57 +0200 Subject: [PATCH] Fix deleted topic name: _deleted_topic_ -> _deleted-topic_ (#1023) --- .../src/main/java/com/google/cloud/pubsub/TopicId.java | 4 ++-- .../java/com/google/cloud/pubsub/SubscriptionInfoTest.java | 2 +- .../src/test/java/com/google/cloud/pubsub/TopicIdTest.java | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java index a86d7ad84977..458df8372dd4 100644 --- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java +++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/TopicId.java @@ -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; @@ -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; diff --git a/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionInfoTest.java b/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionInfoTest.java index be832a9c8994..36846f06f26a 100644 --- a/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionInfoTest.java +++ b/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/SubscriptionInfoTest.java @@ -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()); diff --git a/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/TopicIdTest.java b/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/TopicIdTest.java index a75732709be9..c8d5da25bc89 100644 --- a/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/TopicIdTest.java +++ b/gcloud-java-pubsub/src/test/java/com/google/cloud/pubsub/TopicIdTest.java @@ -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() { @@ -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()); } @@ -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) {