gorealis v2 refactor (#5)
* Changing default timeout for start maintenance. * Upgrading dependencies to gorealis v2 and thrift 0.12.0 * Refactored to update to gorealis v2.
This commit is contained in:
parent
ad4dd9606e
commit
6ab5c9334d
1335 changed files with 137431 additions and 61530 deletions
145
vendor/git.apache.org/thrift.git/lib/js/test/test-jq.js
generated
vendored
145
vendor/git.apache.org/thrift.git/lib/js/test/test-jq.js
generated
vendored
|
@ -33,126 +33,127 @@
|
|||
//////////////////////////////////
|
||||
//jQuery asynchronous tests
|
||||
jQuery.ajaxSetup({ timeout: 0 });
|
||||
$(document).ajaxError( function() { QUnit.start(); } );
|
||||
|
||||
module("jQ Async Manual");
|
||||
QUnit.module('jQ Async Manual');
|
||||
|
||||
test("testI32", function() {
|
||||
expect( 2 );
|
||||
QUnit.stop();
|
||||
QUnit.test('testI32', function(assert) {
|
||||
assert.expect(2);
|
||||
const done = assert.async(2);
|
||||
|
||||
var transport = new Thrift.Transport();
|
||||
var protocol = new Thrift.Protocol(transport);
|
||||
var client = new ThriftTest.ThriftTestClient(protocol);
|
||||
const transport = new Thrift.Transport();
|
||||
const protocol = new Thrift.Protocol(transport);
|
||||
const client = new ThriftTest.ThriftTestClient(protocol);
|
||||
|
||||
var jqxhr = jQuery.ajax({
|
||||
url: "/service",
|
||||
data: client.send_testI32(Math.pow(-2,31)),
|
||||
type: "POST",
|
||||
const jqxhr = jQuery.ajax({
|
||||
url: '/service',
|
||||
data: client.send_testI32(Math.pow(-2, 31)),
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
dataType: "text",
|
||||
success: function(res){
|
||||
transport.setRecvBuffer( res );
|
||||
equal(client.recv_testI32(), Math.pow(-2,31));
|
||||
dataType: 'text',
|
||||
success: function(res) {
|
||||
transport.setRecvBuffer(res);
|
||||
assert.equal(client.recv_testI32(), Math.pow(-2, 31));
|
||||
done();
|
||||
},
|
||||
error: function() { ok(false); },
|
||||
error: function() { assert.ok(false); },
|
||||
complete: function() {
|
||||
ok(true);
|
||||
QUnit.start();
|
||||
assert.ok(true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test("testI64", function() {
|
||||
expect( 2 );
|
||||
QUnit.stop();
|
||||
QUnit.test('testI64', function(assert) {
|
||||
assert.expect(2);
|
||||
const done = assert.async(2);
|
||||
|
||||
var transport = new Thrift.Transport();
|
||||
var protocol = new Thrift.Protocol(transport);
|
||||
var client = new ThriftTest.ThriftTestClient(protocol);
|
||||
const transport = new Thrift.Transport();
|
||||
const protocol = new Thrift.Protocol(transport);
|
||||
const client = new ThriftTest.ThriftTestClient(protocol);
|
||||
|
||||
jQuery.ajax({
|
||||
url: "/service",
|
||||
url: '/service',
|
||||
//This is usually 2^61 but JS cannot represent anything over 2^52 accurately
|
||||
data: client.send_testI64(Math.pow(-2,52)),
|
||||
type: "POST",
|
||||
data: client.send_testI64(Math.pow(-2, 52)),
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
dataType: "text",
|
||||
success: function(res){
|
||||
transport.setRecvBuffer( res );
|
||||
dataType: 'text',
|
||||
success: function(res) {
|
||||
transport.setRecvBuffer(res);
|
||||
//This is usually 2^61 but JS cannot represent anything over 2^52 accurately
|
||||
equal(client.recv_testI64(), Math.pow(-2,52));
|
||||
assert.equal(client.recv_testI64(), Math.pow(-2, 52));
|
||||
done();
|
||||
},
|
||||
error: function() { ok(false); },
|
||||
error: function() { assert.ok(false); },
|
||||
complete: function() {
|
||||
ok(true);
|
||||
QUnit.start();
|
||||
assert.ok(true);
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
module("jQ Async");
|
||||
test("I32", function() {
|
||||
expect( 3 );
|
||||
QUnit.module('jQ Async');
|
||||
QUnit.test('I32', function(assert) {
|
||||
assert.expect(3);
|
||||
|
||||
QUnit.stop();
|
||||
client.testI32(Math.pow(2,30), function(result) {
|
||||
equal(result, Math.pow(2,30));
|
||||
QUnit.start();
|
||||
const done = assert.async(3);
|
||||
client.testI32(Math.pow(2, 30), function(result) {
|
||||
assert.equal(result, Math.pow(2, 30));
|
||||
done();
|
||||
});
|
||||
|
||||
QUnit.stop();
|
||||
var jqxhr = client.testI32(Math.pow(-2,31), function(result) {
|
||||
equal(result, Math.pow(-2,31));
|
||||
const jqxhr = client.testI32(Math.pow(-2, 31), function(result) {
|
||||
assert.equal(result, Math.pow(-2, 31));
|
||||
done();
|
||||
});
|
||||
|
||||
jqxhr.success(function(result) {
|
||||
equal(result, Math.pow(-2,31));
|
||||
QUnit.start();
|
||||
assert.equal(result, Math.pow(-2, 31));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test("I64", function() {
|
||||
expect( 4 );
|
||||
QUnit.test('I64', function(assert) {
|
||||
assert.expect(4);
|
||||
|
||||
QUnit.stop();
|
||||
const done = assert.async(4);
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
client.testI64(Math.pow(2,52), function(result) {
|
||||
equal(result, Math.pow(2,52));
|
||||
QUnit.start();
|
||||
client.testI64(Math.pow(2, 52), function(result) {
|
||||
assert.equal(result, Math.pow(2, 52));
|
||||
done();
|
||||
});
|
||||
|
||||
QUnit.stop();
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
client.testI64(Math.pow(-2,52), function(result) {
|
||||
equal(result, Math.pow(-2,52));
|
||||
client.testI64(Math.pow(-2, 52), function(result) {
|
||||
assert.equal(result, Math.pow(-2, 52));
|
||||
done();
|
||||
})
|
||||
.error( function(xhr, status, e) { ok(false, e.message); } )
|
||||
.error(function(xhr, status, e) { assert.ok(false, e.message); })
|
||||
.success(function(result) {
|
||||
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
|
||||
equal(result, Math.pow(-2,52));
|
||||
assert.equal(result, Math.pow(-2, 52));
|
||||
done();
|
||||
})
|
||||
.complete(function() {
|
||||
ok(true);
|
||||
QUnit.start();
|
||||
assert.ok(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test("Xception", function() {
|
||||
expect( 2 );
|
||||
QUnit.test('Xception', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
QUnit.stop();
|
||||
const done = assert.async(2);
|
||||
|
||||
var dfd = client.testException("Xception", function(result) {
|
||||
ok(false);
|
||||
QUnit.start();
|
||||
const dfd = client.testException('Xception', function(result) {
|
||||
assert.ok(false);
|
||||
done();
|
||||
})
|
||||
.error(function(xhr, status, e){
|
||||
equal(e.errorCode, 1001);
|
||||
equal(e.message, "Xception");
|
||||
//QUnit.start();
|
||||
//Note start is not required here because:
|
||||
//$(document).ajaxError( function() { QUnit.start(); } );
|
||||
.error(function(xhr, status, e) {
|
||||
assert.equal(e.errorCode, 1001);
|
||||
assert.equal(e.message, 'Xception');
|
||||
done();
|
||||
$(document).ajaxError( function() { done(); } );
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue