stat-analysis-query 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/query_constants.rb +13 -0
- data/lib/query_types.rb +14 -0
- data/lib/querymodel_constants.rb +13 -0
- data/lib/querymodel_types.rb +98 -0
- data/lib/stat-analysis-query.rb +9 -0
- data/lib/t_backend_service.rb +452 -0
- data/lib/t_discover_service.rb +673 -0
- data/lib/t_hot_service.rb +725 -0
- data/lib/t_recommend_service.rb +302 -0
- data/test/backend_test.rb +68 -0
- data/test/discover_test.rb +163 -0
- data/test/hot_test.rb +82 -0
- data/test/recommend_test.rb +52 -0
- metadata +60 -0
@@ -0,0 +1,302 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.0)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'query_types'
|
9
|
+
|
10
|
+
module Stat
|
11
|
+
module Query
|
12
|
+
module TRecommendService
|
13
|
+
class Client
|
14
|
+
include ::Thrift::Client
|
15
|
+
|
16
|
+
def indirectFollow(uid, count)
|
17
|
+
send_indirectFollow(uid, count)
|
18
|
+
return recv_indirectFollow()
|
19
|
+
end
|
20
|
+
|
21
|
+
def send_indirectFollow(uid, count)
|
22
|
+
send_message('indirectFollow', IndirectFollow_args, :uid => uid, :count => count)
|
23
|
+
end
|
24
|
+
|
25
|
+
def recv_indirectFollow()
|
26
|
+
result = receive_message(IndirectFollow_result)
|
27
|
+
return result.success unless result.success.nil?
|
28
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'indirectFollow failed: unknown result')
|
29
|
+
end
|
30
|
+
|
31
|
+
def indirectFollowPage(uid, pageSize, pageNo)
|
32
|
+
send_indirectFollowPage(uid, pageSize, pageNo)
|
33
|
+
return recv_indirectFollowPage()
|
34
|
+
end
|
35
|
+
|
36
|
+
def send_indirectFollowPage(uid, pageSize, pageNo)
|
37
|
+
send_message('indirectFollowPage', IndirectFollowPage_args, :uid => uid, :pageSize => pageSize, :pageNo => pageNo)
|
38
|
+
end
|
39
|
+
|
40
|
+
def recv_indirectFollowPage()
|
41
|
+
result = receive_message(IndirectFollowPage_result)
|
42
|
+
return result.success unless result.success.nil?
|
43
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'indirectFollowPage failed: unknown result')
|
44
|
+
end
|
45
|
+
|
46
|
+
def newV(uid, returnSize)
|
47
|
+
send_newV(uid, returnSize)
|
48
|
+
return recv_newV()
|
49
|
+
end
|
50
|
+
|
51
|
+
def send_newV(uid, returnSize)
|
52
|
+
send_message('newV', NewV_args, :uid => uid, :returnSize => returnSize)
|
53
|
+
end
|
54
|
+
|
55
|
+
def recv_newV()
|
56
|
+
result = receive_message(NewV_result)
|
57
|
+
return result.success unless result.success.nil?
|
58
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'newV failed: unknown result')
|
59
|
+
end
|
60
|
+
|
61
|
+
def categoryHotUser(uid, categoryids, count)
|
62
|
+
send_categoryHotUser(uid, categoryids, count)
|
63
|
+
return recv_categoryHotUser()
|
64
|
+
end
|
65
|
+
|
66
|
+
def send_categoryHotUser(uid, categoryids, count)
|
67
|
+
send_message('categoryHotUser', CategoryHotUser_args, :uid => uid, :categoryids => categoryids, :count => count)
|
68
|
+
end
|
69
|
+
|
70
|
+
def recv_categoryHotUser()
|
71
|
+
result = receive_message(CategoryHotUser_result)
|
72
|
+
return result.success unless result.success.nil?
|
73
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'categoryHotUser failed: unknown result')
|
74
|
+
end
|
75
|
+
|
76
|
+
def dislikeUser(uid, dislikeUid)
|
77
|
+
send_dislikeUser(uid, dislikeUid)
|
78
|
+
end
|
79
|
+
|
80
|
+
def send_dislikeUser(uid, dislikeUid)
|
81
|
+
send_message('dislikeUser', DislikeUser_args, :uid => uid, :dislikeUid => dislikeUid)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class Processor
|
86
|
+
include ::Thrift::Processor
|
87
|
+
|
88
|
+
def process_indirectFollow(seqid, iprot, oprot)
|
89
|
+
args = read_args(iprot, IndirectFollow_args)
|
90
|
+
result = IndirectFollow_result.new()
|
91
|
+
result.success = @handler.indirectFollow(args.uid, args.count)
|
92
|
+
write_result(result, oprot, 'indirectFollow', seqid)
|
93
|
+
end
|
94
|
+
|
95
|
+
def process_indirectFollowPage(seqid, iprot, oprot)
|
96
|
+
args = read_args(iprot, IndirectFollowPage_args)
|
97
|
+
result = IndirectFollowPage_result.new()
|
98
|
+
result.success = @handler.indirectFollowPage(args.uid, args.pageSize, args.pageNo)
|
99
|
+
write_result(result, oprot, 'indirectFollowPage', seqid)
|
100
|
+
end
|
101
|
+
|
102
|
+
def process_newV(seqid, iprot, oprot)
|
103
|
+
args = read_args(iprot, NewV_args)
|
104
|
+
result = NewV_result.new()
|
105
|
+
result.success = @handler.newV(args.uid, args.returnSize)
|
106
|
+
write_result(result, oprot, 'newV', seqid)
|
107
|
+
end
|
108
|
+
|
109
|
+
def process_categoryHotUser(seqid, iprot, oprot)
|
110
|
+
args = read_args(iprot, CategoryHotUser_args)
|
111
|
+
result = CategoryHotUser_result.new()
|
112
|
+
result.success = @handler.categoryHotUser(args.uid, args.categoryids, args.count)
|
113
|
+
write_result(result, oprot, 'categoryHotUser', seqid)
|
114
|
+
end
|
115
|
+
|
116
|
+
def process_dislikeUser(seqid, iprot, oprot)
|
117
|
+
args = read_args(iprot, DislikeUser_args)
|
118
|
+
@handler.dislikeUser(args.uid, args.dislikeUid)
|
119
|
+
return
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
125
|
+
|
126
|
+
class IndirectFollow_args
|
127
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
128
|
+
UID = 1
|
129
|
+
COUNT = 2
|
130
|
+
|
131
|
+
FIELDS = {
|
132
|
+
UID => {:type => ::Thrift::Types::I64, :name => 'uid'},
|
133
|
+
COUNT => {:type => ::Thrift::Types::I32, :name => 'count'}
|
134
|
+
}
|
135
|
+
|
136
|
+
def struct_fields; FIELDS; end
|
137
|
+
|
138
|
+
def validate
|
139
|
+
end
|
140
|
+
|
141
|
+
::Thrift::Struct.generate_accessors self
|
142
|
+
end
|
143
|
+
|
144
|
+
class IndirectFollow_result
|
145
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
146
|
+
SUCCESS = 0
|
147
|
+
|
148
|
+
FIELDS = {
|
149
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Stat::Query::IndirectFollowResult}}
|
150
|
+
}
|
151
|
+
|
152
|
+
def struct_fields; FIELDS; end
|
153
|
+
|
154
|
+
def validate
|
155
|
+
end
|
156
|
+
|
157
|
+
::Thrift::Struct.generate_accessors self
|
158
|
+
end
|
159
|
+
|
160
|
+
class IndirectFollowPage_args
|
161
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
162
|
+
UID = 1
|
163
|
+
PAGESIZE = 2
|
164
|
+
PAGENO = 3
|
165
|
+
|
166
|
+
FIELDS = {
|
167
|
+
UID => {:type => ::Thrift::Types::I64, :name => 'uid'},
|
168
|
+
PAGESIZE => {:type => ::Thrift::Types::I32, :name => 'pageSize'},
|
169
|
+
PAGENO => {:type => ::Thrift::Types::I32, :name => 'pageNo'}
|
170
|
+
}
|
171
|
+
|
172
|
+
def struct_fields; FIELDS; end
|
173
|
+
|
174
|
+
def validate
|
175
|
+
end
|
176
|
+
|
177
|
+
::Thrift::Struct.generate_accessors self
|
178
|
+
end
|
179
|
+
|
180
|
+
class IndirectFollowPage_result
|
181
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
182
|
+
SUCCESS = 0
|
183
|
+
|
184
|
+
FIELDS = {
|
185
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}}
|
186
|
+
}
|
187
|
+
|
188
|
+
def struct_fields; FIELDS; end
|
189
|
+
|
190
|
+
def validate
|
191
|
+
end
|
192
|
+
|
193
|
+
::Thrift::Struct.generate_accessors self
|
194
|
+
end
|
195
|
+
|
196
|
+
class NewV_args
|
197
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
198
|
+
UID = 1
|
199
|
+
RETURNSIZE = 2
|
200
|
+
|
201
|
+
FIELDS = {
|
202
|
+
UID => {:type => ::Thrift::Types::I64, :name => 'uid'},
|
203
|
+
RETURNSIZE => {:type => ::Thrift::Types::I32, :name => 'returnSize'}
|
204
|
+
}
|
205
|
+
|
206
|
+
def struct_fields; FIELDS; end
|
207
|
+
|
208
|
+
def validate
|
209
|
+
end
|
210
|
+
|
211
|
+
::Thrift::Struct.generate_accessors self
|
212
|
+
end
|
213
|
+
|
214
|
+
class NewV_result
|
215
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
216
|
+
SUCCESS = 0
|
217
|
+
|
218
|
+
FIELDS = {
|
219
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}}
|
220
|
+
}
|
221
|
+
|
222
|
+
def struct_fields; FIELDS; end
|
223
|
+
|
224
|
+
def validate
|
225
|
+
end
|
226
|
+
|
227
|
+
::Thrift::Struct.generate_accessors self
|
228
|
+
end
|
229
|
+
|
230
|
+
class CategoryHotUser_args
|
231
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
232
|
+
UID = 1
|
233
|
+
CATEGORYIDS = 2
|
234
|
+
COUNT = 3
|
235
|
+
|
236
|
+
FIELDS = {
|
237
|
+
UID => {:type => ::Thrift::Types::I64, :name => 'uid'},
|
238
|
+
CATEGORYIDS => {:type => ::Thrift::Types::STRING, :name => 'categoryids'},
|
239
|
+
COUNT => {:type => ::Thrift::Types::I32, :name => 'count'}
|
240
|
+
}
|
241
|
+
|
242
|
+
def struct_fields; FIELDS; end
|
243
|
+
|
244
|
+
def validate
|
245
|
+
end
|
246
|
+
|
247
|
+
::Thrift::Struct.generate_accessors self
|
248
|
+
end
|
249
|
+
|
250
|
+
class CategoryHotUser_result
|
251
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
252
|
+
SUCCESS = 0
|
253
|
+
|
254
|
+
FIELDS = {
|
255
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::I64}}
|
256
|
+
}
|
257
|
+
|
258
|
+
def struct_fields; FIELDS; end
|
259
|
+
|
260
|
+
def validate
|
261
|
+
end
|
262
|
+
|
263
|
+
::Thrift::Struct.generate_accessors self
|
264
|
+
end
|
265
|
+
|
266
|
+
class DislikeUser_args
|
267
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
268
|
+
UID = 1
|
269
|
+
DISLIKEUID = 2
|
270
|
+
|
271
|
+
FIELDS = {
|
272
|
+
UID => {:type => ::Thrift::Types::I64, :name => 'uid'},
|
273
|
+
DISLIKEUID => {:type => ::Thrift::Types::I64, :name => 'dislikeUid'}
|
274
|
+
}
|
275
|
+
|
276
|
+
def struct_fields; FIELDS; end
|
277
|
+
|
278
|
+
def validate
|
279
|
+
end
|
280
|
+
|
281
|
+
::Thrift::Struct.generate_accessors self
|
282
|
+
end
|
283
|
+
|
284
|
+
class DislikeUser_result
|
285
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
286
|
+
|
287
|
+
FIELDS = {
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
def struct_fields; FIELDS; end
|
292
|
+
|
293
|
+
def validate
|
294
|
+
end
|
295
|
+
|
296
|
+
::Thrift::Struct.generate_accessors self
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|
300
|
+
|
301
|
+
end
|
302
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "thrift_client"
|
3
|
+
require "test/unit"
|
4
|
+
require "stat-analysis-query"
|
5
|
+
|
6
|
+
|
7
|
+
class QueryTest < Test::Unit::TestCase
|
8
|
+
include Test::Unit::Assertions
|
9
|
+
|
10
|
+
def setup
|
11
|
+
super
|
12
|
+
root = File.expand_path("../..", __FILE__)
|
13
|
+
config = {
|
14
|
+
'protocol' => 'compact',
|
15
|
+
'transport' => 'socket',
|
16
|
+
'transport_wrapper' => 'framed',
|
17
|
+
'size' => 1,
|
18
|
+
'multiplexed' => true,
|
19
|
+
'client_class' => 'Stat::Query::TBackendService::Client',
|
20
|
+
'servers' => '127.0.0.1:9002'
|
21
|
+
}
|
22
|
+
|
23
|
+
@client = ThriftClient.new(config)
|
24
|
+
puts "setup"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_delHotRadio
|
28
|
+
assert_nothing_raised {@client.delHotRadio(1,[1,3,4,5,6,7,8])}
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_delHotSound
|
32
|
+
assert_nothing_raised {@client.delHotSound(1,nil,[1,3,4,5,6,7,8])}
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_delNewv
|
36
|
+
assert_nothing_raised {@client.delNewv(1,[1,3,4,5,6,7,8])}
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_delMostFollowedUser
|
40
|
+
assert_nothing_raised {@client.delMostFollowedUser(1,[1,3,4,5,6,7,8])}
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_delMostFavoritSound
|
44
|
+
assert_nothing_raised {@client.delMostFavoritSound(1,nil,[1,3,4,5,6,7,8])}
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_delRecentVTrack
|
48
|
+
assert_nothing_raised {@client.delRecentVTrack(1,nil,[1,3,4,5,6,7,8])}
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_delDayHotRadio
|
52
|
+
assert_nothing_raised {@client.delDayHotRadio(1,[1,3,4,5,6,7,8])}
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_delDayHotSound
|
56
|
+
assert_nothing_raised {@client.delDayHotSound(1,nil,[1,3,4,5,6,7,8])}
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_delHotAlbum
|
60
|
+
assert_nothing_raised {@client.delHotAlbum(1,nil,[1,3,4,5,6,7,8])}
|
61
|
+
end
|
62
|
+
|
63
|
+
def teardown
|
64
|
+
super
|
65
|
+
@client.destroy if @client
|
66
|
+
puts "teardown"
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,163 @@
|
|
1
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "thrift_client"
|
3
|
+
require "test/unit"
|
4
|
+
require "stat-analysis-query"
|
5
|
+
|
6
|
+
|
7
|
+
class QueryTest < Test::Unit::TestCase
|
8
|
+
include Test::Unit::Assertions
|
9
|
+
|
10
|
+
def setup
|
11
|
+
super
|
12
|
+
root = File.expand_path("../..", __FILE__)
|
13
|
+
config = {
|
14
|
+
'protocol' => 'compact',
|
15
|
+
'transport' => 'socket',
|
16
|
+
'transport_wrapper' => 'framed',
|
17
|
+
'size' => 1,
|
18
|
+
'multiplexed' => true,
|
19
|
+
'client_class' => 'Stat::Query::TDiscoverService::Client',
|
20
|
+
'servers' => '127.0.0.1:9002'
|
21
|
+
}
|
22
|
+
|
23
|
+
@client = ThriftClient.new(config)
|
24
|
+
puts "setup"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_selectWebTrackCategoryAndTag
|
28
|
+
assert_nothing_raised {@client.selectWebTrackCategoryAndTag()}
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_selectWebAlbumCategoryAndTag
|
32
|
+
assert_nothing_raised {@client.selectWebAlbumCategoryAndTag()}
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_selectWebHumanCategory
|
36
|
+
assert_nothing_raised {@client.selectWebHumanCategory()}
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_selectWebCategory
|
40
|
+
assert_nothing_raised {@client.selectWebCategory()}
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_selectWebAlbumTag
|
44
|
+
assert_nothing_raised {
|
45
|
+
@client.selectWebAlbumTag(1)
|
46
|
+
@client.selectWebAlbumTag(2)
|
47
|
+
@client.selectWebAlbumTag(3)
|
48
|
+
@client.selectWebAlbumTag(4)
|
49
|
+
@client.selectWebAlbumTag(5)
|
50
|
+
@client.selectWebAlbumTag(6)
|
51
|
+
@client.selectWebAlbumTag(7)
|
52
|
+
@client.selectWebAlbumTag(8)
|
53
|
+
@client.selectWebAlbumTag(9)
|
54
|
+
@client.selectWebAlbumTag(10)
|
55
|
+
@client.selectWebAlbumTag(11)
|
56
|
+
@client.selectWebAlbumTag(12)
|
57
|
+
@client.selectWebAlbumTag(13)
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_selectWebTrackTag
|
62
|
+
assert_nothing_raised {
|
63
|
+
@client.selectWebTrackTag(1)
|
64
|
+
@client.selectWebTrackTag(2)
|
65
|
+
@client.selectWebTrackTag(3)
|
66
|
+
@client.selectWebTrackTag(4)
|
67
|
+
@client.selectWebTrackTag(5)
|
68
|
+
@client.selectWebTrackTag(6)
|
69
|
+
@client.selectWebTrackTag(7)
|
70
|
+
@client.selectWebTrackTag(8)
|
71
|
+
@client.selectWebTrackTag(9)
|
72
|
+
@client.selectWebTrackTag(10)
|
73
|
+
@client.selectWebTrackTag(11)
|
74
|
+
@client.selectWebTrackTag(12)
|
75
|
+
@client.selectWebTrackTag(13)
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_selectMobileCategory
|
80
|
+
assert_nothing_raised {
|
81
|
+
@client.selectMobileCategory(1,"ios",1)
|
82
|
+
@client.selectMobileCategory(2,"ios",1)
|
83
|
+
@client.selectMobileCategory(1,"ios",2)
|
84
|
+
@client.selectMobileCategory(1,"android",1)
|
85
|
+
@client.selectMobileCategory(2,"android",1)
|
86
|
+
@client.selectMobileCategory(1,"android",2)
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_selectMobileHumanCategory
|
91
|
+
assert_nothing_raised {
|
92
|
+
@client.selectMobileHumanCategory(1,"ios",1)
|
93
|
+
@client.selectMobileHumanCategory(2,"ios",1)
|
94
|
+
@client.selectMobileHumanCategory(1,"ios",2)
|
95
|
+
@client.selectMobileHumanCategory(1,"android",1)
|
96
|
+
@client.selectMobileHumanCategory(2,"android",1)
|
97
|
+
@client.selectMobileHumanCategory(1,"android",2)
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_selectMobileAlbumTag
|
102
|
+
assert_nothing_raised {
|
103
|
+
@client.selectMobileAlbumTag(1)
|
104
|
+
@client.selectMobileAlbumTag(2)
|
105
|
+
@client.selectMobileAlbumTag(3)
|
106
|
+
@client.selectMobileAlbumTag(4)
|
107
|
+
@client.selectMobileAlbumTag(5)
|
108
|
+
@client.selectMobileAlbumTag(6)
|
109
|
+
@client.selectMobileAlbumTag(7)
|
110
|
+
@client.selectMobileAlbumTag(8)
|
111
|
+
@client.selectMobileAlbumTag(9)
|
112
|
+
@client.selectMobileAlbumTag(10)
|
113
|
+
@client.selectMobileAlbumTag(11)
|
114
|
+
@client.selectMobileAlbumTag(12)
|
115
|
+
@client.selectMobileAlbumTag(13)
|
116
|
+
}
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_selectMobileTrackTag
|
120
|
+
assert_nothing_raised {
|
121
|
+
@client.selectMobileTrackTag(1)
|
122
|
+
@client.selectMobileTrackTag(2)
|
123
|
+
@client.selectMobileTrackTag(3)
|
124
|
+
@client.selectMobileTrackTag(4)
|
125
|
+
@client.selectMobileTrackTag(5)
|
126
|
+
@client.selectMobileTrackTag(6)
|
127
|
+
@client.selectMobileTrackTag(7)
|
128
|
+
@client.selectMobileTrackTag(8)
|
129
|
+
@client.selectMobileTrackTag(9)
|
130
|
+
@client.selectMobileTrackTag(10)
|
131
|
+
@client.selectMobileTrackTag(11)
|
132
|
+
@client.selectMobileTrackTag(12)
|
133
|
+
@client.selectMobileTrackTag(13)
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_selectMobileMultiCategories
|
138
|
+
category_version = {}
|
139
|
+
category_version.store(1,"1")
|
140
|
+
category_version.store(2,"1")
|
141
|
+
category_version.store(3,"1")
|
142
|
+
category_version.store(4,"1")
|
143
|
+
category_version.store(5,"1")
|
144
|
+
category_version.store(6,"1")
|
145
|
+
category_version.store(7,"1")
|
146
|
+
category_version.store(8,"1")
|
147
|
+
category_version.store(9,"1")
|
148
|
+
category_version.store(10,"1")
|
149
|
+
category_version.store(11,"1")
|
150
|
+
assert_nothing_raised {
|
151
|
+
@client.selectMobileMultiCategories(category_version,"ios",1)
|
152
|
+
@client.selectMobileMultiCategories(category_version,"android",1)
|
153
|
+
@client.selectMobileMultiCategories(category_version,"ios",2)
|
154
|
+
@client.selectMobileMultiCategories(category_version,"android",2)
|
155
|
+
}
|
156
|
+
end
|
157
|
+
|
158
|
+
def teardown
|
159
|
+
super
|
160
|
+
@client.destroy if @client
|
161
|
+
puts "teardown"
|
162
|
+
end
|
163
|
+
end
|
data/test/hot_test.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "thrift_client"
|
3
|
+
require "test/unit"
|
4
|
+
require "stat-analysis-query"
|
5
|
+
|
6
|
+
|
7
|
+
class QueryTest < Test::Unit::TestCase
|
8
|
+
include Test::Unit::Assertions
|
9
|
+
|
10
|
+
def setup
|
11
|
+
super
|
12
|
+
root = File.expand_path("../..", __FILE__)
|
13
|
+
config = {
|
14
|
+
'protocol' => 'compact',
|
15
|
+
'transport' => 'socket',
|
16
|
+
'transport_wrapper' => 'framed',
|
17
|
+
'size' => 1,
|
18
|
+
'multiplexed' => true,
|
19
|
+
'client_class' => 'Stat::Query::THotService::Client',
|
20
|
+
'servers' => '127.0.0.1:9002'
|
21
|
+
}
|
22
|
+
|
23
|
+
@client = ThriftClient.new(config)
|
24
|
+
puts "setup"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_hotRadio
|
28
|
+
assert_nothing_raised {puts @client.hotRadio(1,1,1).inspect}
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_hotSound
|
32
|
+
assert_nothing_raised {puts @client.hotSound(1,nil,1,1).inspect}
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_newV
|
36
|
+
assert_nothing_raised {puts @client.newV(1,1,1).inspect}
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_mostFollowedUser
|
40
|
+
assert_nothing_raised {puts @client.mostFollowedUser(1,1,1).inspect}
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_mostFavoritSound
|
44
|
+
assert_nothing_raised {puts @client.mostFavoritSound(1,nil,1,1).inspect}
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_recentVTrack
|
48
|
+
assert_nothing_raised {puts @client.recentVTrack(1,nil,1,1).inspect}
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_hotRadioDay
|
52
|
+
assert_nothing_raised {puts @client.hotRadioDay(1,1,1).inspect}
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_hotSoundDay
|
56
|
+
assert_nothing_raised {puts @client.hotSoundDay(1,nil,1,1).inspect}
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_hotAlbum
|
60
|
+
assert_nothing_raised {puts @client.hotAlbum(1,nil,1,1).inspect}
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_hotRadioAndSound
|
64
|
+
categories = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
|
65
|
+
assert_nothing_raised {puts @client.hotRadioAndSound(categories).inspect}
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_hotCategoryAlbum
|
69
|
+
tags = ["remen", "23123"]
|
70
|
+
assert_nothing_raised {puts @client.hotCategoryAlbum(1,tags,1).inspect}
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_hotRadioRandom
|
74
|
+
assert_nothing_raised {puts @client.hotRadioRandom().inspect}
|
75
|
+
end
|
76
|
+
|
77
|
+
def teardown
|
78
|
+
super
|
79
|
+
@client.destroy if @client
|
80
|
+
puts "teardown"
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
require "thrift_client"
|
3
|
+
require "test/unit"
|
4
|
+
require "stat-analysis-query"
|
5
|
+
|
6
|
+
|
7
|
+
class QueryTest < Test::Unit::TestCase
|
8
|
+
include Test::Unit::Assertions
|
9
|
+
|
10
|
+
def setup
|
11
|
+
super
|
12
|
+
root = File.expand_path("../..", __FILE__)
|
13
|
+
config = {
|
14
|
+
'protocol' => 'compact',
|
15
|
+
'transport' => 'socket',
|
16
|
+
'transport_wrapper' => 'framed',
|
17
|
+
'size' => 1,
|
18
|
+
'multiplexed' => true,
|
19
|
+
'client_class' => 'Stat::Query::TRecommendService::Client',
|
20
|
+
'servers' => '127.0.0.1:9002'
|
21
|
+
}
|
22
|
+
|
23
|
+
@client = ThriftClient.new(config)
|
24
|
+
puts "setup"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_indirectFollow
|
28
|
+
assert_nothing_raised { puts @client.indirectFollow(3033,20) }
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_indirectFollowPage
|
32
|
+
assert_nothing_raised { puts @client.indirectFollowPage(3033,1,20) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_newV
|
36
|
+
assert_nothing_raised { puts @client.newV(3033,20) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_categoryHotUser
|
40
|
+
assert_nothing_raised { puts @client.categoryHotUser(3033,'1,2,3,4,5,6,7,8,9,10,11,12,13',20) }
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_dislikeUser
|
44
|
+
assert_nothing_raised { puts @client.dislikeUser(3033,3034) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def teardown
|
48
|
+
super
|
49
|
+
@client.destroy if @client
|
50
|
+
puts "teardown"
|
51
|
+
end
|
52
|
+
end
|