diff --git a/firestore/integration_test_internal/src/bundle_test.cc b/firestore/integration_test_internal/src/bundle_test.cc index a3935a1b76..bdb0b54d6d 100644 --- a/firestore/integration_test_internal/src/bundle_test.cc +++ b/firestore/integration_test_internal/src/bundle_test.cc @@ -94,25 +94,6 @@ class BundleTest : public FirestoreIntegrationTest { MapFieldValue{{"k", FieldValue::String("b")}, {"bar", FieldValue::Integer(2)}})); } - - { - Query limit = AwaitResult(db->NamedQuery(kLimitQueryName)); - auto limit_snapshot = AwaitResult(limit.Get(Source::kCache)); - EXPECT_THAT( - QuerySnapshotToValues(limit_snapshot), - testing::ElementsAre(MapFieldValue{{"k", FieldValue::String("b")}, - {"bar", FieldValue::Integer(2)}})); - } - - { - Query limit_to_last = AwaitResult(db->NamedQuery(kLimitToLastQueryName)); - auto limit_to_last_snapshot = - AwaitResult(limit_to_last.Get(Source::kCache)); - EXPECT_THAT( - QuerySnapshotToValues(limit_to_last_snapshot), - testing::ElementsAre(MapFieldValue{{"k", FieldValue::String("a")}, - {"bar", FieldValue::Integer(1)}})); - } } }; @@ -259,21 +240,6 @@ TEST_F(BundleTest, LoadBundleWithDocumentsAlreadyPulledFromBackend) { testing::ElementsAre( MapFieldValue{{"bar", FieldValue::String("newValueA")}}, MapFieldValue{{"bar", FieldValue::String("newValueB")}})); - - { - Query limit = AwaitResult(db->NamedQuery(kLimitQueryName)); - EXPECT_THAT(QuerySnapshotToValues(AwaitResult(limit.Get(Source::kCache))), - testing::ElementsAre( - MapFieldValue{{"bar", FieldValue::String("newValueB")}})); - } - - { - Query limit_to_last = AwaitResult(db->NamedQuery(kLimitToLastQueryName)); - EXPECT_THAT( - QuerySnapshotToValues(AwaitResult(limit_to_last.Get(Source::kCache))), - testing::ElementsAre( - MapFieldValue{{"bar", FieldValue::String("newValueA")}})); - } } TEST_F(BundleTest, LoadedDocumentsShouldNotBeGarbageCollectedRightAway) { @@ -316,28 +282,6 @@ TEST_F(BundleTest, LoadDocumentsFromOtherProjectsShouldFail) { VerifyErrorProgress(progresses[1]); } -TEST_F(BundleTest, GetInvalidNamedQuery) { - Firestore* db = TestFirestore(); - { - auto future = db->NamedQuery("DOES_NOT_EXIST"); - Await(future); - EXPECT_EQ(future.status(), FutureStatus::kFutureStatusComplete); - EXPECT_EQ(future.error(), Error::kErrorNotFound); - } - { - auto future = db->NamedQuery(""); - Await(future); - EXPECT_EQ(future.status(), FutureStatus::kFutureStatusComplete); - EXPECT_EQ(future.error(), Error::kErrorNotFound); - } - { - auto future = db->NamedQuery("\xc3\x28"); - Await(future); - EXPECT_EQ(future.status(), FutureStatus::kFutureStatusComplete); - EXPECT_EQ(future.error(), Error::kErrorNotFound); - } -} - } // namespace } // namespace firestore } // namespace firebase diff --git a/firestore/src/common/firestore.cc b/firestore/src/common/firestore.cc index 47af9d858e..302a4843fc 100644 --- a/firestore/src/common/firestore.cc +++ b/firestore/src/common/firestore.cc @@ -343,10 +343,5 @@ Future Firestore::LoadBundle( return internal_->LoadBundle(bundle, std::move(progress_callback)); } -Future Firestore::NamedQuery(const std::string& query_name) { - if (!internal_) return FailedFuture(); - return internal_->NamedQuery(query_name); -} - } // namespace firestore } // namespace firebase diff --git a/firestore/src/include/firebase/firestore.h b/firestore/src/include/firebase/firestore.h index 63786c82f2..c0a2bdcc09 100644 --- a/firestore/src/include/firebase/firestore.h +++ b/firestore/src/include/firebase/firestore.h @@ -429,21 +429,6 @@ class Firestore { const std::string& bundle, std::function progress_callback); - /** - * Reads a Firestore `Query` from the local cache, identified by the given - * name. - * - * Named queries are packaged into bundles on the server side (along with the - * resulting documents) and loaded into local cache using `LoadBundle`. Once - * in the local cache, you can use this method to extract a query by name. - * - * If a query cannot be found, the returned future will complete with its - * `error()` set to a non-zero error code. - * - * @param query_name The name of the query to read from saved bundles. - */ - virtual Future NamedQuery(const std::string& query_name); - protected: /** * Default constructor, to be used only for mocking `Firestore`. diff --git a/firestore/src/main/firestore_main.cc b/firestore/src/main/firestore_main.cc index 95f7689f67..4ddadfddd0 100644 --- a/firestore/src/main/firestore_main.cc +++ b/firestore/src/main/firestore_main.cc @@ -378,22 +378,5 @@ Future FirestoreInternal::LoadBundle( return promise.future(); } -Future FirestoreInternal::NamedQuery(const std::string& query_name) { - auto promise = promise_factory_.CreatePromise(AsyncApi::kNamedQuery); - firestore_core_->GetNamedQuery( - query_name, - [this, promise](const absl::optional& query) mutable { - if (query.has_value()) { - promise.SetValue( - MakePublic(api::Query(query.value(), firestore_core_))); - } else { - promise.SetError( - Status(Error::kErrorNotFound, "Named query cannot be found")); - } - }); - - return promise.future(); -} - } // namespace firestore } // namespace firebase diff --git a/firestore/src/main/firestore_main.h b/firestore/src/main/firestore_main.h index eb25e28263..8c3338cdbb 100644 --- a/firestore/src/main/firestore_main.h +++ b/firestore/src/main/firestore_main.h @@ -100,7 +100,6 @@ class FirestoreInternal { Future LoadBundle( const std::string& bundle, std::function progress_callback); - Future NamedQuery(const std::string& query_name); // Manages the ListenerRegistrationInternal objects. void RegisterListenerRegistration(ListenerRegistrationInternal* registration);