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 @@ -153,7 +153,7 @@ protected String execute() throws FirebaseMessagingException {
* <p>The responses list obtained by calling {@link BatchResponse#getResponses()} on the return
* value corresponds to the order of input messages.
*
* @param messages A non-null, non-empty list containing up to 1000 messages.
* @param messages A non-null, non-empty list containing up to 100 messages.
* @return A {@link BatchResponse} indicating the result of the operation.
* @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
* delivery. An exception here indicates a total failure -- i.e. none of the messages in the
Expand All @@ -175,7 +175,7 @@ public BatchResponse sendAll(
* <p>The responses list obtained by calling {@link BatchResponse#getResponses()} on the return
* value corresponds to the order of input messages.
*
* @param messages A non-null, non-empty list containing up to 1000 messages.
* @param messages A non-null, non-empty list containing up to 100 messages.
* @param dryRun A boolean indicating whether to perform a dry run (validation only) of the send.
* @return A {@link BatchResponse} indicating the result of the operation.
* @throws FirebaseMessagingException If an error occurs while handing the messages off to FCM for
Expand All @@ -190,7 +190,7 @@ public BatchResponse sendAll(
/**
* Similar to {@link #sendAll(List)} but performs the operation asynchronously.
*
* @param messages A non-null, non-empty list containing up to 1000 messages.
* @param messages A non-null, non-empty list containing up to 100 messages.
* @return @return An {@code ApiFuture} that will complete with a {@link BatchResponse} when
* the messages have been sent.
*/
Expand All @@ -201,7 +201,7 @@ public ApiFuture<BatchResponse> sendAllAsync(@NonNull List<Message> messages) {
/**
* Similar to {@link #sendAll(List, boolean)} but performs the operation asynchronously.
*
* @param messages A non-null, non-empty list containing up to 1000 messages.
* @param messages A non-null, non-empty list containing up to 100 messages.
* @param dryRun A boolean indicating whether to perform a dry run (validation only) of the send.
* @return @return An {@code ApiFuture} that will complete with a {@link BatchResponse} when
* the messages have been sent, or when the emulation has finished.
Expand Down Expand Up @@ -288,8 +288,8 @@ private CallableOperation<BatchResponse, FirebaseMessagingException> sendAllOp(

final List<Message> immutableMessages = ImmutableList.copyOf(messages);
checkArgument(!immutableMessages.isEmpty(), "messages list must not be empty");
checkArgument(immutableMessages.size() <= 1000,
"messages list must not contain more than 1000 elements");
checkArgument(immutableMessages.size() <= 100,
"messages list must not contain more than 100 elements");
return new CallableOperation<BatchResponse,FirebaseMessagingException>() {
@Override
protected BatchResponse execute() throws FirebaseMessagingException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* Represents a message that can be sent to multiple devices via Firebase Cloud Messaging (FCM).
* Contains payload information as well as the list of device registration tokens to which the
* message should be sent. A single {@code MulticastMessage} may contain up to 1000 registration
* message should be sent. A single {@code MulticastMessage} may contain up to 100 registration
* tokens.
*
* <p>Instances of this class are thread-safe and immutable. Use {@link MulticastMessage.Builder}
Expand All @@ -53,7 +53,7 @@ public class MulticastMessage {
private MulticastMessage(Builder builder) {
this.tokens = builder.tokens.build();
checkArgument(!this.tokens.isEmpty(), "at least one token must be specified");
checkArgument(this.tokens.size() <= 1000, "no more than 1000 tokens can be specified");
checkArgument(this.tokens.size() <= 100, "no more than 100 tokens can be specified");
for (String token : this.tokens) {
checkArgument(!Strings.isNullOrEmpty(token), "none of the tokens can be null or empty");
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public static class Builder {
private Builder() {}

/**
* Adds a token to which the message should be sent. Up to 1000 tokens can be specified on
* Adds a token to which the message should be sent. Up to 100 tokens can be specified on
* a single instance of {@link MulticastMessage}.
*
* @param token A non-null, non-empty Firebase device registration token.
Expand All @@ -113,7 +113,7 @@ public Builder addToken(@NonNull String token) {
}

/**
* Adds a list of tokens to which the message should be sent. Up to 1000 tokens can be
* Adds a list of tokens to which the message should be sent. Up to 100 tokens can be
* specified on a single instance of {@link MulticastMessage}.
*
* @param tokens List of Firebase device registration tokens.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ public void testSendAll() throws Exception {
}

@Test
public void testSendThousand() throws Exception {
public void testSendHundred() throws Exception {
List<Message> messages = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
for (int i = 0; i < 100; i++) {
messages.add(Message.builder().setTopic("foo-bar-" + (i % 10)).build());
}

BatchResponse response = FirebaseMessaging.getInstance().sendAll(messages, true);

assertEquals(1000, response.getResponses().size());
assertEquals(1000, response.getSuccessCount());
assertEquals(100, response.getResponses().size());
assertEquals(100, response.getSuccessCount());
assertEquals(0, response.getFailureCount());
for (SendResponse sendResponse : response.getResponses()) {
if (!sendResponse.isSuccessful()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void testSendAllWithEmptyList() {
public void testSendAllWithTooManyMessages() {
FirebaseMessaging messaging = initDefaultMessaging();
ImmutableList.Builder<Message> listBuilder = ImmutableList.builder();
for (int i = 0; i < 1001; i++) {
for (int i = 0; i < 101; i++) {
listBuilder.add(Message.builder().setTopic("topic").build());
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public void testNoTokens() {
@Test
public void testTooManyTokens() {
MulticastMessage.Builder builder = MulticastMessage.builder();
for (int i = 0; i < 1001; i++) {
for (int i = 0; i < 101; i++) {
builder.addToken("token" + i);
}
try {
builder.build();
fail("No error thrown for more than 1000 tokens");
fail("No error thrown for more than 100 tokens");
} catch (IllegalArgumentException expected) {
// expected
}
Expand Down