|
|
|
@ -22,9 +22,11 @@ serverOptions = ServerOptions();
|
|
|
|
|
var server = new CartodbWindshaft(serverOptions);
|
|
|
|
|
server.setMaxListeners(0);
|
|
|
|
|
|
|
|
|
|
['/tiles/layergroup', '/u/localhost/tiles/layergroup'].forEach(function(layergroup_url) {
|
|
|
|
|
[true, false].forEach(function(cdbQueryTablesFromPostgresEnabledValue) {
|
|
|
|
|
|
|
|
|
|
suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function() {
|
|
|
|
|
var suiteName = 'multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue + ";layergroup_url=" + layergroup_url;
|
|
|
|
|
suite(suiteName, function() {
|
|
|
|
|
|
|
|
|
|
var redis_client = redis.createClient(global.environment.redis.port);
|
|
|
|
|
var sqlapi_server;
|
|
|
|
@ -66,7 +68,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -94,7 +96,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -135,7 +137,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/localhost@' + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
url: layergroup_url + '/localhost@' + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -152,7 +154,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/0/0/0/0.grid.json',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -170,7 +172,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/1/0/0/0.grid.json',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -222,7 +224,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost'}
|
|
|
|
|
}, {}, function(res, err) { next(err, res); });
|
|
|
|
@ -255,7 +257,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost'}
|
|
|
|
|
}, {}, function(res, err) { next(err, res); });
|
|
|
|
@ -299,7 +301,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost'}
|
|
|
|
|
}, {}, function(res) {
|
|
|
|
@ -321,7 +323,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify(layergroup)),
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost'}
|
|
|
|
|
}, {}, function(res) {
|
|
|
|
@ -352,7 +354,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -379,7 +381,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb10/1/0/0.png',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb10/1/0/0.png',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -418,7 +420,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb11/4/0/0.png',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb11/4/0/0.png',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -457,7 +459,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/0/1/0/0.grid.json',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -475,7 +477,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/0/4/0/0.grid.json',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -539,7 +541,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -561,7 +563,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
+ statskey + ":stat_tag:" + layergroup.stat_tag + " to be 1, got " + val);
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -620,7 +622,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -648,7 +650,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -688,7 +690,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?map_key=1234',
|
|
|
|
|
url: layergroup_url + '?map_key=1234',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -716,7 +718,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?map_key=1234',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?map_key=1234',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -737,7 +739,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/0/0/0/0.grid.json?map_key=1234',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -751,7 +753,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/1/0/0/0.grid.json?map_key=1234',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -766,7 +768,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -782,7 +784,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/0/0/0/0.grid.json',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -798,7 +800,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token
|
|
|
|
|
url: layergroup_url + "/" + expected_token
|
|
|
|
|
+ '/1/0/0/0.grid.json',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
method: 'GET'
|
|
|
|
@ -849,7 +851,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?map_key=1234',
|
|
|
|
|
url: layergroup_url + '?map_key=1234',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -878,7 +880,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?map_key=1234',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?map_key=1234',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -908,7 +910,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?map_key=1234',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?map_key=1234',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -1044,7 +1046,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -1068,7 +1070,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -1120,7 +1122,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?api_key=1234',
|
|
|
|
|
url: layergroup_url + '?api_key=1234',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -1146,7 +1148,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
if ( err ) throw err;
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup/' + expected_token + ':cb0/0/0/0.png?api_key=1234',
|
|
|
|
|
url: layergroup_url + "/" + expected_token + ':cb0/0/0/0.png?api_key=1234',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {host: 'localhost' },
|
|
|
|
|
encoding: 'binary'
|
|
|
|
@ -1211,7 +1213,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
assert.ok(data.length > 1024*64);
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup?api_key=1234',
|
|
|
|
|
url: layergroup_url + '?api_key=1234',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: data
|
|
|
|
@ -1268,7 +1270,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -1310,7 +1312,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
{
|
|
|
|
|
var next = this;
|
|
|
|
|
assert.response(server, {
|
|
|
|
|
url: '/tiles/layergroup',
|
|
|
|
|
url: layergroup_url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
|
|
|
data: JSON.stringify(layergroup)
|
|
|
|
@ -1334,7 +1336,7 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var layergroupTtlRequest = {
|
|
|
|
|
url: '/tiles/layergroup?config=' + encodeURIComponent(JSON.stringify({
|
|
|
|
|
url: layergroup_url + '?config=' + encodeURIComponent(JSON.stringify({
|
|
|
|
|
version: '1.0.0',
|
|
|
|
|
layers: [
|
|
|
|
|
{ options: {
|
|
|
|
@ -1442,3 +1444,4 @@ suite('multilayer:postgres=' + cdbQueryTablesFromPostgresEnabledValue, function(
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|