Skip to content

Commit 522254e

Browse files
Merge branch 'master' into ssrc
2 parents 3f75c4e + 212ecea commit 522254e

File tree

6 files changed

+84
-18
lines changed

6 files changed

+84
-18
lines changed

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6060
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
6161
<skipUTs>${skipTests}</skipUTs>
62-
<netty.version>4.2.1.Final</netty.version>
62+
<netty.version>4.2.3.Final</netty.version>
6363
</properties>
6464

6565
<scm>
@@ -157,7 +157,7 @@
157157
<plugins>
158158
<plugin>
159159
<artifactId>maven-gpg-plugin</artifactId>
160-
<version>3.2.7</version>
160+
<version>3.2.8</version>
161161
<executions>
162162
<execution>
163163
<id>sign-artifacts</id>
@@ -215,7 +215,7 @@
215215
<plugin>
216216
<groupId>org.codehaus.mojo</groupId>
217217
<artifactId>exec-maven-plugin</artifactId>
218-
<version>3.5.0</version>
218+
<version>3.5.1</version>
219219
<executions>
220220
<execution>
221221
<phase>test</phase>
@@ -280,7 +280,7 @@
280280
<!-- Test Phase -->
281281
<plugin>
282282
<artifactId>maven-surefire-plugin</artifactId>
283-
<version>3.5.2</version>
283+
<version>3.5.3</version>
284284
<configuration>
285285
<skipTests>${skipUTs}</skipTests>
286286
</configuration>
@@ -367,7 +367,7 @@
367367
<plugins>
368368
<plugin>
369369
<artifactId>maven-project-info-reports-plugin</artifactId>
370-
<version>3.8.0</version>
370+
<version>3.9.0</version>
371371
<reportSets>
372372
<reportSet>
373373
<configuration>
@@ -385,7 +385,7 @@
385385
<dependency>
386386
<groupId>com.google.cloud</groupId>
387387
<artifactId>libraries-bom</artifactId>
388-
<version>26.59.0</version>
388+
<version>26.65.0</version>
389389
<type>pom</type>
390390
<scope>import</scope>
391391
</dependency>

src/main/java/com/google/firebase/cloud/FirestoreClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/**
2121
* {@code FirestoreClient} provides access to Google Cloud Firestore. Use this API to obtain a
22-
* <a href="https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/com/google/cloud/firestore/Firestore.html">{@code Firestore}</a>
22+
* <a href="https://cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Firestore">{@code Firestore}</a>
2323
* instance, which provides methods for updating and querying data in Firestore.
2424
*
2525
* <p>A Google Cloud project ID is required to access Firestore. FirestoreClient determines the
@@ -60,7 +60,7 @@ private FirestoreClient(FirebaseApp app, String databaseId) {
6060
* same instance for all invocations. The Firestore instance and all references obtained from it
6161
* becomes unusable, once the default app is deleted.
6262
*
63-
* @return A non-null <a href="https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/com/google/cloud/firestore/Firestore.html">{@code Firestore}</a>
63+
* @return A non-null <a href="https://cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Firestore">{@code Firestore}</a>
6464
* instance.
6565
*/
6666
@NonNull
@@ -74,7 +74,7 @@ public static Firestore getFirestore() {
7474
* obtained from it becomes unusable, once the specified app is deleted.
7575
*
7676
* @param app A non-null {@link FirebaseApp}.
77-
* @return A non-null <a href="https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/com/google/cloud/firestore/Firestore.html">{@code Firestore}</a>
77+
* @return A non-null <a href="https://cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Firestore">{@code Firestore}</a>
7878
* instance.
7979
*/
8080
@NonNull
@@ -90,7 +90,7 @@ public static Firestore getFirestore(FirebaseApp app) {
9090
*
9191
* @param app A non-null {@link FirebaseApp}.
9292
* @param database - The name of database.
93-
* @return A non-null <a href="https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/com/google/cloud/firestore/Firestore.html">{@code Firestore}</a>
93+
* @return A non-null <a href="https://cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Firestore">{@code Firestore}</a>
9494
* instance.
9595
*/
9696
@NonNull
@@ -104,7 +104,7 @@ public static Firestore getFirestore(FirebaseApp app, String database) {
104104
* references obtained from it becomes unusable, once the default app is deleted.
105105
*
106106
* @param database - The name of database.
107-
* @return A non-null <a href="https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/com/google/cloud/firestore/Firestore.html">{@code Firestore}</a>
107+
* @return A non-null <a href="https://cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Firestore">{@code Firestore}</a>
108108
* instance.
109109
*/
110110
@NonNull

src/main/java/com/google/firebase/cloud/StorageClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static synchronized StorageClient getInstance(FirebaseApp app) {
7171
* configured via {@link com.google.firebase.FirebaseOptions} when initializing the app. If
7272
* no bucket was configured via options, this method throws an exception.
7373
*
74-
* @return a cloud storage <a href="https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/com/google/cloud/storage/Bucket.html">{@code Bucket}</a>
74+
* @return a cloud storage <a href="https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.Bucket">{@code Bucket}</a>
7575
* instance.
7676
* @throws IllegalArgumentException If no bucket is configured via <code>FirebaseOptions</code>,
7777
* or if the bucket does not exist.
@@ -84,7 +84,7 @@ public Bucket bucket() {
8484
* Returns a cloud storage Bucket instance for the specified bucket name.
8585
*
8686
* @param name a non-null, non-empty bucket name.
87-
* @return a cloud storage <a href="https://googlecloudplatform.github.io/google-cloud-java/latest/google-cloud-clients/com/google/cloud/storage/Bucket.html">{@code Bucket}</a>
87+
* @return a cloud storage <a href="https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.Bucket">{@code Bucket}</a>
8888
* instance.
8989
* @throws IllegalArgumentException If the bucket name is null, empty, or if the specified
9090
* bucket does not exist.

src/test/java/com/google/firebase/auth/FirebaseUserManagerTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,23 @@ public void testGetUserByProviderUidWithPhone() throws Exception {
402402
TestResponseInterceptor interceptor = initializeAppForUserManagement(
403403
TestUtils.loadResource("getUser.json"));
404404
UserRecord userRecord = FirebaseAuth.getInstance()
405-
.getUserByProviderUidAsync("phone", "+1234567890").get();
405+
.getUserByProviderUidAsync(new String("phone"), "+1234567890").get();
406406
checkUserRecord(userRecord);
407407
checkRequestHeaders(interceptor);
408+
GenericJson parsed = parseRequestContent(interceptor);
409+
assertEquals(ImmutableList.of("+1234567890"), parsed.get("phoneNumber"));
408410
}
409411

410412
@Test
411413
public void testGetUserByProviderUidWithEmail() throws Exception {
412414
TestResponseInterceptor interceptor = initializeAppForUserManagement(
413415
TestUtils.loadResource("getUser.json"));
414416
UserRecord userRecord = FirebaseAuth.getInstance()
415-
.getUserByProviderUidAsync("email", "[email protected]").get();
417+
.getUserByProviderUidAsync(new String("email"), "[email protected]").get();
416418
checkUserRecord(userRecord);
417419
checkRequestHeaders(interceptor);
420+
GenericJson parsed = parseRequestContent(interceptor);
421+
assertEquals(ImmutableList.of("[email protected]"), parsed.get("email"));
418422
}
419423

420424
@Test
@@ -1248,20 +1252,22 @@ public void testDeleteProviderAndPhone() {
12481252

12491253
@Test
12501254
public void testDoubleDeletePhoneProvider() throws Exception {
1255+
String providerId = new String("phone");
12511256
UserRecord.UpdateRequest update = new UserRecord.UpdateRequest("uid")
12521257
.setPhoneNumber(null);
12531258

12541259
try {
1255-
update.setProvidersToUnlink(ImmutableList.of("phone"));
1260+
update.setProvidersToUnlink(ImmutableList.of(providerId));
12561261
fail("No error thrown for double delete phone provider");
12571262
} catch (IllegalArgumentException expected) {
12581263
}
12591264
}
12601265

12611266
@Test
12621267
public void testDoubleDeletePhoneProviderReverseOrder() throws Exception {
1268+
String providerId = new String("phone");
12631269
UserRecord.UpdateRequest update = new UserRecord.UpdateRequest("uid")
1264-
.setProvidersToUnlink(ImmutableList.of("phone"));
1270+
.setProvidersToUnlink(ImmutableList.of(providerId));
12651271

12661272
try {
12671273
update.setPhoneNumber(null);

src/test/java/com/google/firebase/snippets/FirebaseMessagingSnippets.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,36 @@ public void sendAll() throws FirebaseMessagingException {
149149
// [END send_all]
150150
}
151151

152+
public void sendEach() throws FirebaseMessagingException {
153+
String registrationToken = "YOUR_REGISTRATION_TOKEN";
154+
155+
// [START send_each]
156+
// Create a list containing up to 500 messages.
157+
List<Message> messages = Arrays.asList(
158+
Message.builder()
159+
.setNotification(Notification.builder()
160+
.setTitle("Price drop")
161+
.setBody("5% off all electronics")
162+
.build())
163+
.setToken(registrationToken)
164+
.build(),
165+
// ...
166+
Message.builder()
167+
.setNotification(Notification.builder()
168+
.setTitle("Price drop")
169+
.setBody("2% off all books")
170+
.build())
171+
.setTopic("readers-club")
172+
.build()
173+
);
174+
175+
BatchResponse response = FirebaseMessaging.getInstance().sendEach(messages);
176+
// See the BatchResponse reference documentation
177+
// for the contents of response.
178+
System.out.println(response.getSuccessCount() + " messages were sent successfully");
179+
// [END send_each]
180+
}
181+
152182
public void sendMulticast() throws FirebaseMessagingException {
153183
// [START send_multicast]
154184
// Create a list containing up to 500 registration tokens.
@@ -201,6 +231,36 @@ public void sendMulticastAndHandleErrors() throws FirebaseMessagingException {
201231
// [END send_multicast_error]
202232
}
203233

234+
public void sendEachForMulticastAndHandleErrors() throws FirebaseMessagingException {
235+
// [START send_each_for_multicast_error]
236+
// These registration tokens come from the client FCM SDKs.
237+
List<String> registrationTokens = Arrays.asList(
238+
"YOUR_REGISTRATION_TOKEN_1",
239+
// ...
240+
"YOUR_REGISTRATION_TOKEN_n"
241+
);
242+
243+
MulticastMessage message = MulticastMessage.builder()
244+
.putData("score", "850")
245+
.putData("time", "2:45")
246+
.addAllTokens(registrationTokens)
247+
.build();
248+
BatchResponse response = FirebaseMessaging.getInstance().sendEachForMulticast(message);
249+
if (response.getFailureCount() > 0) {
250+
List<SendResponse> responses = response.getResponses();
251+
List<String> failedTokens = new ArrayList<>();
252+
for (int i = 0; i < responses.size(); i++) {
253+
if (!responses.get(i).isSuccessful()) {
254+
// The order of responses corresponds to the order of the registration tokens.
255+
failedTokens.add(registrationTokens.get(i));
256+
}
257+
}
258+
259+
System.out.println("List of tokens that caused failures: " + failedTokens);
260+
}
261+
// [END send_each_for_multicast_error]
262+
}
263+
204264
public Message androidMessage() {
205265
// [START android_message]
206266
Message message = Message.builder()

src/test/java/com/google/firebase/snippets/FirebaseStorageSnippets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void initializeAppForStorage() throws IOException {
4242
Bucket bucket = StorageClient.getInstance().bucket();
4343

4444
// 'bucket' is an object defined in the google-cloud-storage Java library.
45-
// See http://googlecloudplatform.github.io/google-cloud-java/latest/apidocs/com/google/cloud/storage/Bucket.html
45+
// See https://cloud.google.com/java/docs/reference/google-cloud-storage/latest/com.google.cloud.storage.Bucket
4646
// for more details.
4747
// [END init_admin_sdk_for_storage]
4848
System.out.println("Retrieved bucket: " + bucket.getName());

0 commit comments

Comments
 (0)