-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.7 add option to ignore "All players are not subscribed"
- Loading branch information
Jens Klingsporn
committed
Jan 15, 2018
1 parent
7f9c308
commit 6bacd1d
Showing
8 changed files
with
152 additions
and
17 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
43 changes: 43 additions & 0 deletions
43
src/main/java/io/github/jklingsporn/vertx/push/PushClientOptions.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,43 @@ | ||
package io.github.jklingsporn.vertx.push; | ||
|
||
/** | ||
* Created by jensklingsporn on 10.01.18. | ||
* @since 1.7 | ||
*/ | ||
public class PushClientOptions { | ||
|
||
private String appId; | ||
private String restApiKey; | ||
/** | ||
* When set to <code>true</code> it will silently ignore the "All included players are not subscribed"-error by OneSignal | ||
* instead of creating an expensive OneSignalException. | ||
*/ | ||
private boolean ignoreAllPlayersAreNotSubscribed=false; | ||
|
||
public String getAppId() { | ||
return appId; | ||
} | ||
|
||
public PushClientOptions setAppId(String appId) { | ||
this.appId = appId; | ||
return this; | ||
} | ||
|
||
public String getRestApiKey() { | ||
return restApiKey; | ||
} | ||
|
||
public PushClientOptions setRestApiKey(String restApiKey) { | ||
this.restApiKey = restApiKey; | ||
return this; | ||
} | ||
|
||
public boolean isIgnoreAllPlayersAreNotSubscribed() { | ||
return ignoreAllPlayersAreNotSubscribed; | ||
} | ||
|
||
public PushClientOptions setIgnoreAllPlayersAreNotSubscribed(boolean ignoreAllPlayersAreNotSubscribed) { | ||
this.ignoreAllPlayersAreNotSubscribed = ignoreAllPlayersAreNotSubscribed; | ||
return this; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/test/java/io/github/jklingsporn/vertx/push/PushClientCreateTest.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,33 @@ | ||
package io.github.jklingsporn.vertx.push; | ||
|
||
import io.vertx.core.Vertx; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Created by jensklingsporn on 15.01.18. | ||
*/ | ||
public class PushClientCreateTest { | ||
|
||
@Test(expected = NullPointerException.class) | ||
public void emptyPushClientOptionsShouldFail(){ | ||
PushClient.create(Vertx.vertx(), new PushClientOptions()); | ||
} | ||
|
||
@Test(expected = NullPointerException.class) | ||
public void noRestAPIKeyInPushClientOptionsShouldFail(){ | ||
PushClient.create(Vertx.vertx(), new PushClientOptions().setAppId("foo")); | ||
} | ||
|
||
@Test(expected = NullPointerException.class) | ||
public void noAppIdInPushClientOptionsShouldFail(){ | ||
PushClient.create(Vertx.vertx(), new PushClientOptions().setRestApiKey("bar")); | ||
} | ||
|
||
@Test | ||
public void createPushClientWithRegularOptionsShouldSucceed(){ | ||
PushClient pushClient = PushClient.create(Vertx.vertx(), new PushClientOptions().setAppId("foo").setRestApiKey("bar")); | ||
Assert.assertNotNull(pushClient); | ||
} | ||
|
||
} |