Skip to content

Commit 5ba489b

Browse files
committed
add log for jmessage api test case
1 parent 8d2b57e commit 5ba489b

File tree

4 files changed

+214
-111
lines changed

4 files changed

+214
-111
lines changed

example/main/java/cn/jpush/api/examples/IMGroupExample.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package cn.jpush.api.examples;
22

33
import cn.jpush.api.jmessage.JMessageClient;
4-
54
import cn.jpush.api.common.resp.APIConnectionException;
65
import cn.jpush.api.jmessage.base.connection.APIRequestException;
76

7+
import org.slf4j.Logger;
8+
import org.slf4j.LoggerFactory;
9+
810
public class IMGroupExample {
911

1012
protected static final Logger LOG = LoggerFactory.getLogger(IMGroupExample.class);
@@ -16,7 +18,7 @@ public static void testCreateGroup() {
1618
JMessageClient client = new JMessageClient(appkey, masterSecret);
1719
try {
1820
String res = client.createGroup("test_user", "test_gname1", "description", "test_user");
19-
System.out.println(res);
21+
LOG.info(res);
2022
} catch (APIConnectionException e) {
2123
LOG.error("Connection error. Should retry later. ", e);
2224
} catch (APIRequestException e) {
@@ -31,7 +33,7 @@ public static void testGetGroupInfo() {
3133

3234
try {
3335
String res = client.getGroupInfo(10003767);
34-
System.out.println(res);
36+
LOG.info(res);
3537
} catch (APIConnectionException e) {
3638
LOG.error("Connection error. Should retry later. ", e);
3739
} catch (APIRequestException e) {
@@ -46,7 +48,7 @@ public static void testGetGroupMemberList() {
4648

4749
try {
4850
String res = client.getGroupMembers(10003767);
49-
System.out.println(res);
51+
LOG.info(res);
5052
} catch (APIConnectionException e) {
5153
LOG.error("Connection error. Should retry later. ", e);
5254
} catch (APIRequestException e) {
@@ -61,7 +63,7 @@ public static void testGetGroupListByAppkey() {
6163

6264
try {
6365
String res = client.getGroupListByAppkey(0, 30);
64-
System.out.println(res);
66+
LOG.info(res);
6567
} catch (APIConnectionException e) {
6668
LOG.error("Connection error. Should retry later. ", e);
6769
} catch (APIRequestException e) {

example/main/java/cn/jpush/api/examples/IMUserExample.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package cn.jpush.api.examples;
22

33
import cn.jpush.api.jmessage.JMessageClient;
4-
54
import cn.jpush.api.common.resp.APIConnectionException;
65
import cn.jpush.api.jmessage.base.connection.APIRequestException;
76
import cn.jpush.api.jmessage.base.model.RegisterInfo;
7+
88
import org.slf4j.Logger;
99
import org.slf4j.LoggerFactory;
1010

@@ -41,7 +41,7 @@ public static void testRegisterUsers() {
4141
RegisterInfo[] regUsers = new RegisterInfo[users.size()];
4242

4343
String res = client.registerUsers(users.toArray(regUsers));
44-
System.out.println(res);
44+
LOG.info(res);
4545
} catch (APIConnectionException e) {
4646
LOG.error("Connection error. Should retry later. ", e);
4747
} catch (APIRequestException e) {
@@ -56,7 +56,7 @@ public static void testGetUserInfo() {
5656

5757
try {
5858
String res = client.getUserInfo("test_user");
59-
System.out.println(res);
59+
LOG.info(res);
6060
} catch (APIConnectionException e) {
6161
LOG.error("Connection error. Should retry later. ", e);
6262
} catch (APIRequestException e) {
@@ -99,7 +99,7 @@ public static void testGetUsers() {
9999

100100
try {
101101
String res = client.getUserList(0, 30);
102-
System.out.println(res);
102+
LOG.info(res);
103103
} catch (APIConnectionException e) {
104104
LOG.error("Connection error. Should retry later. ", e);
105105
} catch (APIRequestException e) {
@@ -114,7 +114,7 @@ public static void testGetGroupsByUser() {
114114

115115
try {
116116
String res = client.getGroupListByUser("test_user");
117-
System.out.println(res);
117+
LOG.info(res);
118118
} catch (APIConnectionException e) {
119119
LOG.error("Connection error. Should retry later. ", e);
120120
} catch (APIRequestException e) {

0 commit comments

Comments
 (0)