-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from SpineEventEngine/v1.7.2
Allow using Firebase RDB emulator with Firebase client
- Loading branch information
Showing
13 changed files
with
275 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
firebase-web/src/test/java/io/spine/web/firebase/rest/RestNodeUrlsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright 2021, TeamDev. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package io.spine.web.firebase.rest; | ||
|
||
import com.google.common.testing.NullPointerTester; | ||
import com.google.common.testing.NullPointerTester.Visibility; | ||
import io.spine.net.Urls; | ||
import io.spine.web.firebase.DatabaseUrl; | ||
import io.spine.web.firebase.DatabaseUrls; | ||
import io.spine.web.firebase.NodePaths; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat; | ||
|
||
@DisplayName("`RestNodeUrls` should") | ||
final class RestNodeUrlsTest { | ||
|
||
@Test | ||
@DisplayName("not accept `null`s") | ||
void notAcceptNulls() { | ||
NullPointerTester tester = new NullPointerTester(); | ||
tester.testConstructors(RestNodeUrls.class, Visibility.PACKAGE); | ||
tester.testAllPublicInstanceMethods(new RestNodeUrls(DatabaseUrl.getDefaultInstance())); | ||
} | ||
|
||
@Test | ||
@DisplayName("create a `RestNodeUrl` for the specified `NodePath` and remote RDB") | ||
void createRemoteDbUrl() { | ||
String dbUrl = "https://spine-dev.firebaseio.com"; | ||
RestNodeUrls factory = new RestNodeUrls(DatabaseUrls.from(dbUrl)); | ||
String node = "subscriptions/111"; | ||
RestNodeUrl result = factory.with(NodePaths.of(node)); | ||
assertThat(result.getUrl()) | ||
.isEqualTo(Urls.create(dbUrl + '/' + node + ".json")); | ||
} | ||
|
||
@Test | ||
@DisplayName("create a `RestNodeUrl` for the specified `NodePath` and local emulator") | ||
void createEmulatorUrl() { | ||
String dbUrl = "http://localhost:5000?ns=spine-dev"; | ||
RestNodeUrls factory = new RestNodeUrls(DatabaseUrls.from(dbUrl)); | ||
String node = "query/currentYear"; | ||
RestNodeUrl result = factory.with(NodePaths.of(node)); | ||
assertThat(result.getUrl()) | ||
.isEqualTo(Urls.create("http://localhost:5000/" + node + ".json?ns=spine-dev")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.