Comparing version 0.11.1 to 0.12.0
@@ -231,2 +231,6 @@ /** | ||
var ContextClass = context.balance.getContextClass(); | ||
// 确保缓存被初始化 | ||
if (!contextCache[serviceID]) { | ||
contextCache[serviceID] = {}; | ||
} | ||
// 从缓存中获取BalanceContext避免重复创建 | ||
@@ -233,0 +237,0 @@ if (!contextCache[serviceID].balance) { |
@@ -84,2 +84,3 @@ /** | ||
} | ||
clientCache[config.wsdl] = client; | ||
request(client); | ||
@@ -86,0 +87,0 @@ }); |
{ | ||
"name": "node-ral", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "a rpc client for node", | ||
@@ -28,3 +28,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"binary-search": "1.3.0", | ||
"binary-search": "1.3.2", | ||
"chai": "3.5.0", | ||
@@ -36,6 +36,7 @@ "form-data": "0.2.0", | ||
"protobufjs": "5.0.1", | ||
"redis": "^2.6.2", | ||
"soap": "0.13.0", | ||
"underscore": "1.8.3", | ||
"urlencode": "1.1.0", | ||
"yog-log": "0.1.0" | ||
"yog-log": "0.1.1" | ||
}, | ||
@@ -48,5 +49,5 @@ "devDependencies": { | ||
"istanbul": "0.4.4", | ||
"mocha": "2.5.3", | ||
"should": "10.0.0" | ||
"mocha": "3.0.2", | ||
"should": "11.1.0" | ||
} | ||
} |
@@ -22,2 +22,3 @@ /** | ||
var RawConverter = require('../lib/ext/converter/rawConverter.js'); | ||
var RedisConverter = require('../lib/ext/converter/redisConverter.js'); | ||
var util = require('../lib/util.js'); | ||
@@ -237,3 +238,3 @@ var _ = require('underscore'); | ||
server.close(); | ||
data2.toString().should.be.match(/hear you 张三李四.*9999$/); | ||
data2.toString().should.be.match(/hear you 张三李四.*end$/); | ||
done(); | ||
@@ -265,3 +266,3 @@ }); | ||
server.close(); | ||
data2.toString().should.be.match(/hear you �������.*9999$/); | ||
data2.toString().should.be.match(/hear you �������.*end$/); | ||
done(); | ||
@@ -367,3 +368,3 @@ }); | ||
server.close(); | ||
resData.toString().should.be.match(/hear you 张三李四.*9999$/); | ||
resData.toString().should.be.match(/hear you 张三李四.*end$/); | ||
done(); | ||
@@ -429,2 +430,80 @@ }); | ||
describe('redis converter', function () { | ||
it('has right name', function () { | ||
var converter = new RedisConverter(); | ||
converter.getName().should.be.equal('redis'); | ||
}); | ||
it('has right catagory', function () { | ||
var converter = new RedisConverter(); | ||
converter.getCategory().should.be.equal('converter'); | ||
}); | ||
it('direct pass array data', function () { | ||
var converter = new RedisConverter(); | ||
var data = ['a', 'b']; | ||
var pack = converter.pack({}, data); | ||
pack.should.be.eql(['a', 'b']); | ||
}); | ||
it('convert key value to array data', function () { | ||
var converter = new RedisConverter(); | ||
var data = { | ||
key: 'foo', | ||
value: 'bar' | ||
}; | ||
var pack = converter.pack({}, data); | ||
pack.should.be.eql(['foo', 'bar']); | ||
}); | ||
it('convert multi value', function () { | ||
var converter = new RedisConverter(); | ||
var data = { | ||
key: 'foo', | ||
value: ['bar1', 'bar2'] | ||
}; | ||
var pack = converter.pack({}, data); | ||
pack.should.be.eql(['foo', 'bar1', 'bar2']); | ||
}); | ||
it('convert array value in multi value', function () { | ||
var converter = new RedisConverter(); | ||
var data = { | ||
key: 'foo', | ||
value: [['bar1'], 'bar2'] | ||
}; | ||
var pack = converter.pack({}, data); | ||
pack.should.be.eql(['foo', ['bar1'], 'bar2']); | ||
}); | ||
it('only use key', function () { | ||
var converter = new RedisConverter(); | ||
var data = { | ||
key: 'foo' | ||
}; | ||
var pack = converter.pack({}, data); | ||
pack.should.be.eql(['foo']); | ||
}); | ||
it('use raw key', function () { | ||
var converter = new RedisConverter(); | ||
var data = 'foo'; | ||
var pack = converter.pack({}, data); | ||
pack.should.be.eql(['foo']); | ||
}); | ||
it('invalid param', function () { | ||
var converter = new RedisConverter(); | ||
var data = { | ||
foo: 'bar' | ||
}; | ||
try { | ||
var pack = converter.pack({}, data); | ||
(pack === null).should.be.ok; | ||
} catch (e) { | ||
e.should.be.ok; | ||
} | ||
}); | ||
}); | ||
describe('stream converter', function () { | ||
@@ -459,3 +538,3 @@ it('has right name', function () { | ||
server.close(); | ||
data.toString().should.be.match(/hear you 张三李四.*9999$/); | ||
data.toString().should.be.match(/hear you 张三李四.*end$/); | ||
done(); | ||
@@ -462,0 +541,0 @@ }); |
@@ -213,3 +213,3 @@ /** | ||
it.only('should dont mock anything when RAL_MOCK is null', function (done) { | ||
it('should dont mock anything when RAL_MOCK is null', function (done) { | ||
delete process.env.RAL_MOCK; | ||
@@ -216,0 +216,0 @@ ral.init({ |
@@ -175,3 +175,3 @@ /** | ||
server.close(); | ||
data.toString().should.be.match(/hear you.*9999$/); | ||
data.toString().should.be.match(/hear you.*end$/); | ||
done(); | ||
@@ -192,3 +192,3 @@ }); | ||
server.close(); | ||
data.toString().should.be.match(/hear you hefangshi.*9999$/); | ||
data.toString().should.be.match(/hear you hefangshi.*end$/); | ||
done(); | ||
@@ -209,3 +209,3 @@ }); | ||
server.close(); | ||
data.toString().should.be.match(/hear you hefangshi.*9999$/); | ||
data.toString().should.be.match(/hear you hefangshi.*end$/); | ||
done(); | ||
@@ -293,3 +293,3 @@ }); | ||
data.toString().should.be.match( | ||
/hear you hefangshi with file http_protocol_post_test.js.*9999$/); | ||
/hear you hefangshi with file http_protocol_post_test.js.*end$/); | ||
done(); | ||
@@ -314,3 +314,3 @@ }); | ||
server.close(); | ||
data.toString().should.be.match(/hear you hefangshi.*9999$/); | ||
data.toString().should.be.match(/hear you hefangshi.*end$/); | ||
done(); | ||
@@ -337,3 +337,3 @@ }); | ||
data.toString().should.be.match( | ||
/hear you �η�ʯ with file http_protocol_post_test.js.*9999$/); | ||
/hear you �η�ʯ with file http_protocol_post_test.js.*end$/); | ||
done(); | ||
@@ -340,0 +340,0 @@ }); |
@@ -113,7 +113,7 @@ /** | ||
response.write(content); | ||
var padding = []; | ||
for (var i = 0; i < 10000; i++) { | ||
padding.push(i); | ||
// var padding = []; | ||
for (var i = 0; i < 100000; i++) { | ||
response.write(i.toString()); | ||
} | ||
response.write(padding.join()); | ||
response.write('end'); | ||
response.end(); | ||
@@ -120,0 +120,0 @@ } |
@@ -172,6 +172,7 @@ /** | ||
var padding = []; | ||
for (var i = 0; i < 10000; i++) { | ||
padding.push(i); | ||
for (var i = 0; i < 100000; i++) { | ||
response.write(i.toString()); | ||
} | ||
response.write(padding.join()); | ||
response.write('end'); | ||
// response.write(padding.join()); | ||
response.end(); | ||
@@ -178,0 +179,0 @@ }); |
@@ -701,2 +701,20 @@ /** | ||
it('work fine with large data request', function (done) { | ||
before(function (ok) { | ||
isInited.on('done', ok); | ||
}); | ||
ral('GET_QS_SERV', { | ||
url: 'http://tb1.bdstatic.com/tb/mobile/n/static/beyond/widget/thread-submit/index_8a04bf5.js', | ||
unpack: 'string', | ||
timeout: 5000, | ||
rejectUnauthorized: false | ||
}).on('data', function (data) { | ||
data.should.match(/\}\);\n$/); | ||
done(); | ||
}).on('error', function (err) { | ||
err.should.not.be.ok; | ||
done(); | ||
}); | ||
}); | ||
it('work fine with http url request', function (done) { | ||
@@ -703,0 +721,0 @@ before(function (ok) { |
364856
99
10666
12
+ Addedredis@^2.6.2
+ Addedbinary-search@1.3.2(transitive)
+ Addeddouble-ended-queue@2.1.0-0(transitive)
+ Addedredis@2.8.0(transitive)
+ Addedredis-commands@1.7.0(transitive)
+ Addedredis-parser@2.6.0(transitive)
+ Addedyog-log@0.1.1(transitive)
- Removedbinary-search@1.3.0(transitive)
- Removedyog-log@0.1.0(transitive)
Updatedbinary-search@1.3.2
Updatedyog-log@0.1.1