Skip to content

Commit 3e89cea

Browse files
committed
test file
1 parent 5634520 commit 3e89cea

File tree

4 files changed

+101
-16
lines changed

4 files changed

+101
-16
lines changed

test/t_conversation_msg.go

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,41 @@ func DoTestDeleteAllMsgFromLocalAndSvr() {
5050
var deleteConversationCallback DeleteConversationCallBack
5151
open_im_sdk.DeleteAllMsgFromLocalAndSvr(deleteConversationCallback, utils.OperationIDGenerator())
5252
}
53+
func DoTestSearchLocalMessages() {
54+
//[SearchLocalMessages args: {"conversationID":"single_707010937","keywordList":["1"],"keywordListMatchType":0,"senderUserIDList":[],"messageTypeList":[],"searchTimePosition":0,"searchTimePeriod":0,"pageIndex":1,"count":200}]
55+
var testSearchLocalMessagesCallBack SearchLocalMessagesCallBack
56+
testSearchLocalMessagesCallBack.OperationID = utils.OperationIDGenerator()
57+
var params sdk_params_callback.SearchLocalMessagesParams
58+
params.KeywordList = []string{"1"}
59+
params.ConversationID = "single_707010937"
60+
params.Count = 200
61+
params.PageIndex = 1
62+
//s:=strings.Trim(params.KeywordList[0],"")
63+
//fmt.Println(len(s),s)
64+
//params.KeywordListMatchType = 1
65+
//params.MessageTypeList = []int{105}
66+
open_im_sdk.SearchLocalMessages(testSearchLocalMessagesCallBack, testSearchLocalMessagesCallBack.OperationID, utils.StructToJsonString(params))
67+
}
5368

5469
func DoTestGetHistoryMessage(userID string) {
5570
var testGetHistoryCallBack GetHistoryCallBack
5671
testGetHistoryCallBack.OperationID = utils.OperationIDGenerator()
5772
var params sdk_params_callback.GetHistoryMessageListParams
5873
params.UserID = userID
59-
params.Count = 10
74+
params.ConversationID = "single_707008149"
75+
params.Count = 20
6076
open_im_sdk.GetHistoryMessageList(testGetHistoryCallBack, testGetHistoryCallBack.OperationID, utils.StructToJsonString(params))
6177
}
78+
func DoTestGetHistoryMessageReverse(userID string) {
79+
var testGetHistoryReverseCallBack GetHistoryReverseCallBack
80+
testGetHistoryReverseCallBack.OperationID = utils.OperationIDGenerator()
81+
var params sdk_params_callback.GetHistoryMessageListParams
82+
params.UserID = userID
83+
params.Count = 10
84+
params.ConversationID = "single_707008149"
85+
params.StartClientMsgID = "d40dde77f29b14d3a16ca6f422776890"
86+
open_im_sdk.GetHistoryMessageListReverse(testGetHistoryReverseCallBack, testGetHistoryReverseCallBack.OperationID, utils.StructToJsonString(params))
87+
}
6288
func DoTestGetGroupHistoryMessage() {
6389
var testGetHistoryCallBack GetHistoryCallBack
6490
testGetHistoryCallBack.OperationID = utils.OperationIDGenerator()
@@ -68,6 +94,15 @@ func DoTestGetGroupHistoryMessage() {
6894
open_im_sdk.GetHistoryMessageList(testGetHistoryCallBack, testGetHistoryCallBack.OperationID, utils.StructToJsonString(params))
6995
}
7096

97+
//func DoTestGetGroupHistoryMessage() {
98+
// var testGetHistoryCallBack GetHistoryCallBack
99+
// testGetHistoryCallBack.OperationID = utils.OperationIDGenerator()
100+
// var params sdk_params_callback.GetHistoryMessageListParams
101+
// params.GroupID = "cb7aaa8e5f83d92db2ed1573cd01870c"
102+
// params.Count = 10
103+
// open_im_sdk.GetHistoryMessageList(testGetHistoryCallBack, testGetHistoryCallBack.OperationID, utils.StructToJsonString(params))
104+
//}
105+
71106
//func DoTestDeleteConversation(conversationID string) {
72107
// var testDeleteConversation DeleteConversationCallBack
73108
// open_im_sdk.DeleteConversation(conversationID, testDeleteConversation)
@@ -313,6 +348,30 @@ func (g GetHistoryCallBack) OnSuccess(data string) {
313348
log.Info(g.OperationID, "get History success ", data)
314349
}
315350

351+
type GetHistoryReverseCallBack struct {
352+
OperationID string
353+
}
354+
355+
func (g GetHistoryReverseCallBack) OnError(errCode int32, errMsg string) {
356+
log.Info(g.OperationID, "GetHistoryReverseCallBack err", errCode, errMsg)
357+
}
358+
359+
func (g GetHistoryReverseCallBack) OnSuccess(data string) {
360+
log.Info(g.OperationID, "GetHistoryReverseCallBack success ", data)
361+
}
362+
363+
type SearchLocalMessagesCallBack struct {
364+
OperationID string
365+
}
366+
367+
func (g SearchLocalMessagesCallBack) OnError(errCode int32, errMsg string) {
368+
log.Info(g.OperationID, "SearchLocalMessagesCallBack err", errCode, errMsg)
369+
}
370+
371+
func (g SearchLocalMessagesCallBack) OnSuccess(data string) {
372+
log.Info(g.OperationID, "SearchLocalMessagesCallBack success ", data)
373+
}
374+
316375
type MsgListenerCallBak struct {
317376
}
318377

@@ -345,17 +404,18 @@ func (t TestSearchLocalMessages) OnError(errCode int32, errMsg string) {
345404
func (t TestSearchLocalMessages) OnSuccess(data string) {
346405
log.Info(t.OperationID, "SearchLocalMessages , OnSuccess %v\n", data)
347406
}
348-
func DoTestSearchLocalMessages() {
349-
var t TestSearchLocalMessages
350-
operationID := utils.OperationIDGenerator()
351-
t.OperationID = operationID
352-
var p sdk_params_callback.SearchLocalMessagesParams
353-
//p.SessionType = constant.SingleChatType
354407

355-
p.KeywordList = []string{}
356-
p.SearchTimePeriod = 24 * 60 * 60 * 10
357-
open_im_sdk.SearchLocalMessages(t, operationID, utils.StructToJsonString(p))
358-
}
408+
//func DoTestSearchLocalMessages() {
409+
// var t TestSearchLocalMessages
410+
// operationID := utils.OperationIDGenerator()
411+
// t.OperationID = operationID
412+
// var p sdk_params_callback.SearchLocalMessagesParams
413+
// //p.SessionType = constant.SingleChatType
414+
// p.SourceID = "18090680773"
415+
// p.KeywordList = []string{}
416+
// p.SearchTimePeriod = 24 * 60 * 60 * 10
417+
// open_im_sdk.SearchLocalMessages(t, operationID, utils.StructToJsonString(p))
418+
//}
359419

360420
type TestDeleteConversation struct {
361421
OperationID string
@@ -399,11 +459,11 @@ func (c conversationCallBack) OnSyncServerFailed() {
399459
}
400460

401461
func (c conversationCallBack) OnNewConversation(conversationList string) {
402-
// log.Info("", "OnNewConversation returnList is ", conversationList)
462+
//log.Info("", "OnNewConversation returnList is ", conversationList)
403463
}
404464

405465
func (c conversationCallBack) OnConversationChanged(conversationList string) {
406-
// log.Info("", "OnConversationChanged returnList is", conversationList)
466+
log.Info("", "OnConversationChanged returnList is", conversationList)
407467
}
408468

409469
func (c conversationCallBack) OnTotalUnreadMessageCountChanged(totalUnreadCount int32) {

test/t_friend_sdk.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ type BaseSuccessFailed struct {
363363
errCode int
364364
errMsg string
365365
funcName string
366+
time time.Time
366367
}
367368

368369
func (b *BaseSuccessFailed) OnError(errCode int32, errMsg string) {
@@ -375,11 +376,12 @@ func (b *BaseSuccessFailed) OnError(errCode int32, errMsg string) {
375376
func (b *BaseSuccessFailed) OnSuccess(data string) {
376377
b.errCode = 1
377378
b.successData = data
378-
log.Info("login success", data)
379+
log.Info("login success", data, time.Since(b.time))
379380
}
380381

381382
func InOutlllogin(uid, tk string) {
382383
var callback BaseSuccessFailed
384+
callback.time = time.Now()
383385
callback.funcName = utils.GetSelfFuncName()
384386
operationID := utils.OperationIDGenerator()
385387
// log.Info(operationID, " login start ")
@@ -404,11 +406,11 @@ func InOutLogou() {
404406
func InOutDoTest(uid, tk, ws, api string) {
405407
var cf sdk_struct.IMConfig
406408
cf.ApiAddr = api
407-
cf.Platform = 1
409+
cf.Platform = 2
408410
cf.WsAddr = ws
409411
cf.Platform = 2
410412
cf.DataDir = "./"
411-
cf.LogLevel = 6
413+
cf.LogLevel = 4
412414

413415
var s string
414416
b, _ := json.Marshal(cf)

test/t_group_sdk.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,32 @@ func (t testGetGroupsInfo) OnError(errCode int32, errMsg string) {
172172
log.Info(t.OperationID, "testGetGroupsInfo,onError", errCode, errMsg)
173173
}
174174

175+
type testSearchGroups struct {
176+
OperationID string
177+
}
178+
179+
func (t testSearchGroups) OnSuccess(data string) {
180+
log.Info(t.OperationID, "testSearchGroups,onSuccess", data)
181+
}
182+
183+
func (t testSearchGroups) OnError(errCode int32, errMsg string) {
184+
log.Info(t.OperationID, "testSearchGroups,onError", errCode, errMsg)
185+
}
175186
func DoTestGetGroupsInfo() {
176187
var test testGetGroupsInfo
177188
groupIDList := []string{"8a33030b726bd4792c8410aadfacaa35", "e91805bae94ae3a00eb629f74e83605a"}
178189
list := utils.StructToJsonString(groupIDList)
179190
log.Info(test.OperationID, "test getGroupsInfo input", list)
180191
open_im_sdk.GetGroupsInfo(test, test.OperationID, list)
181192
}
193+
func DoTestSearchGroups() {
194+
var test testGetGroupsInfo
195+
var params sdk_params_callback.SearchGroupsParam
196+
params.KeywordList = []string{"17"}
197+
//params.IsSearchGroupID =true
198+
params.IsSearchGroupName = true
199+
open_im_sdk.SearchGroups(test, test.OperationID, utils.StructToJsonString(params))
200+
}
182201

183202
type testJoinGroup struct {
184203
OperationID string

test/t_signaling.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
type testSignalingListener struct {
1111
}
1212

13+
func (s *testSignalingListener) OnHangUp(hangUpCallback string) {
14+
panic("implement me")
15+
}
16+
1317
func (s *testSignalingListener) OnReceiveNewInvitation(receiveNewInvitationCallback string) {
1418
log.Info("", utils.GetSelfFuncName(), "listener ", receiveNewInvitationCallback)
1519
}

0 commit comments

Comments
 (0)