Revert backward incompatible changes in multilayer handling
This commit is contained in:
parent
3383c44eb7
commit
106e95940d
8
NEWS.md
8
NEWS.md
@ -1,18 +1,12 @@
|
|||||||
1.2.0
|
1.1.9
|
||||||
-----
|
-----
|
||||||
|
|
||||||
WARNING: starting from this commit the multilayer grid fetching
|
|
||||||
route changed to NOT include layer name nor interactivity
|
|
||||||
(now specified solely as part of layergroup configuration)
|
|
||||||
|
|
||||||
* Handle SQL API errors by requesting no Varnish cache
|
* Handle SQL API errors by requesting no Varnish cache
|
||||||
* Fix X-Cache-Channel for multilayer (by token) responses
|
* Fix X-Cache-Channel for multilayer (by token) responses
|
||||||
* Add last_modified field to POST layergroup response (#72)
|
* Add last_modified field to POST layergroup response (#72)
|
||||||
* Deprecate signal handler for USR1, add handler for USR2 (#71)
|
* Deprecate signal handler for USR1, add handler for USR2 (#71)
|
||||||
* Fix support for ampersend characters in CartoCSS
|
* Fix support for ampersend characters in CartoCSS
|
||||||
* Add support for LZMA compressed GET parameters
|
* Add support for LZMA compressed GET parameters
|
||||||
* Remove interactivity config from multilayer grid fetching route
|
|
||||||
* Require interactivity param in single-layer grid fetching request (#69)
|
|
||||||
|
|
||||||
1.1.8
|
1.1.8
|
||||||
-----
|
-----
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"cluster2": "git://github.com/CartoDB/cluster2.git#cdb_production",
|
"cluster2": "git://github.com/CartoDB/cluster2.git#cdb_production",
|
||||||
"node-varnish": "0.1.1",
|
"node-varnish": "0.1.1",
|
||||||
"underscore" : "~1.3.3",
|
"underscore" : "~1.3.3",
|
||||||
"windshaft" : "~0.10.0",
|
"windshaft" : "~0.11.0",
|
||||||
"step": "0.0.x",
|
"step": "0.0.x",
|
||||||
"generic-pool": "~1.0.12",
|
"generic-pool": "~1.0.12",
|
||||||
"redis": "0.7.2",
|
"redis": "0.7.2",
|
||||||
|
@ -26,7 +26,7 @@ suite('multilayer', function() {
|
|||||||
sqlapi_server = new SQLAPIEmu(global.environment.sqlapi.port, done);
|
sqlapi_server = new SQLAPIEmu(global.environment.sqlapi.port, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("layergroup with 2 layers, each with its style, grid in layer 0", function(done) {
|
test("layergroup with 2 layers, each with its style", function(done) {
|
||||||
|
|
||||||
var layergroup = {
|
var layergroup = {
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
@ -34,8 +34,7 @@ suite('multilayer', function() {
|
|||||||
{ options: {
|
{ options: {
|
||||||
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, 5e6, 0) as the_geom_webmercator from test_table limit 2',
|
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, 5e6, 0) as the_geom_webmercator from test_table limit 2',
|
||||||
cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }',
|
cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }',
|
||||||
cartocss_version: '2.0.1',
|
cartocss_version: '2.0.1'
|
||||||
interactivity: [ 'cartodb_id' ]
|
|
||||||
} },
|
} },
|
||||||
{ options: {
|
{ options: {
|
||||||
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, -5e6, 0) as the_geom_webmercator from test_table limit 2 offset 2',
|
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, -5e6, 0) as the_geom_webmercator from test_table limit 2 offset 2',
|
||||||
@ -45,7 +44,7 @@ suite('multilayer', function() {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var expected_token = "9b8b9742efba192ce6c534c83cba0186";
|
var expected_token = "d55208dccb30b5ff972562f563db0d22";
|
||||||
Step(
|
Step(
|
||||||
function do_post()
|
function do_post()
|
||||||
{
|
{
|
||||||
@ -117,7 +116,7 @@ suite('multilayer', function() {
|
|||||||
var next = this;
|
var next = this;
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/tiles/layergroup/' + expected_token
|
url: '/tiles/layergroup/' + expected_token
|
||||||
+ '/0/0/0.grid.json',
|
+ '/layer0/0/0/0.grid.json?interactivity=cartodb_id',
|
||||||
headers: {host: 'localhost' },
|
headers: {host: 'localhost' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function(res) {
|
}, {}, function(res) {
|
||||||
@ -129,118 +128,13 @@ suite('multilayer', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function finish(err) {
|
|
||||||
var errors = [];
|
|
||||||
if ( err ) {
|
|
||||||
errors.push(err.message);
|
|
||||||
console.log("Error: " + err);
|
|
||||||
}
|
|
||||||
redis_client.keys("map_style|cartodb_test_user_1_db|~" + expected_token, function(err, matches) {
|
|
||||||
if ( err ) errors.push(err.message);
|
|
||||||
assert.equal(matches.length, 1, "Missing expected token " + expected_token + " from redis: " + matches);
|
|
||||||
redis_client.del(matches, function(err) {
|
|
||||||
if ( err ) errors.push(err.message);
|
|
||||||
if ( errors.length ) done(new Error(errors));
|
|
||||||
else done(null);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("layergroup with 2 layers, each with its style, grid in layer 1", function(done) {
|
|
||||||
|
|
||||||
var layergroup = {
|
|
||||||
version: '1.0.0',
|
|
||||||
layers: [
|
|
||||||
{ options: {
|
|
||||||
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, 5e6, 0) as the_geom_webmercator from test_table limit 2',
|
|
||||||
cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }',
|
|
||||||
cartocss_version: '2.0.1',
|
|
||||||
interactivity: [ 'fake' ] // unused, not being the topmost
|
|
||||||
} },
|
|
||||||
{ options: {
|
|
||||||
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, -5e6, 0) as the_geom_webmercator from test_table limit 2 offset 2',
|
|
||||||
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
|
|
||||||
cartocss_version: '2.0.2',
|
|
||||||
interactivity: [ 'cartodb_id' ]
|
|
||||||
} }
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
var expected_token = "20c5377296dee4124e6fd2f72309c6eb";
|
|
||||||
Step(
|
|
||||||
function do_post()
|
|
||||||
{
|
|
||||||
var next = this;
|
|
||||||
assert.response(server, {
|
|
||||||
url: '/tiles/layergroup',
|
|
||||||
method: 'POST',
|
|
||||||
headers: {host: 'localhost', 'Content-Type': 'application/json' },
|
|
||||||
data: JSON.stringify(layergroup)
|
|
||||||
}, {}, function(res) {
|
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
|
||||||
var parsedBody = JSON.parse(res.body);
|
|
||||||
var expectedBody = { layergroupid: expected_token };
|
|
||||||
// check last modified
|
|
||||||
var qTables = JSON.stringify({
|
|
||||||
'q': 'SELECT CDB_QueryTables($windshaft$'
|
|
||||||
+ layergroup.layers[0].options.sql + ';'
|
|
||||||
+ layergroup.layers[1].options.sql
|
|
||||||
+ '$windshaft$)'
|
|
||||||
});
|
|
||||||
expectedBody.last_updated = JSON.stringify({
|
|
||||||
'q': 'SELECT EXTRACT(EPOCH FROM max(updated_at)) as max '
|
|
||||||
+ 'FROM CDB_TableMetadata m WHERE m.tabname::name = any (\'{'
|
|
||||||
+ qTables + '}\')'
|
|
||||||
});
|
|
||||||
if ( expected_token ) {
|
|
||||||
//assert.equal(parsedBody.layergroupid, expectedBody.layergroupid);
|
|
||||||
//assert.equal(parsedBody.last_updated, expectedBody.last_updated);
|
|
||||||
assert.deepEqual(parsedBody, expectedBody);
|
|
||||||
}
|
|
||||||
else expected_token = parsedBody.layergroupid;
|
|
||||||
next(null, res);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function do_get_tile(err)
|
|
||||||
{
|
|
||||||
if ( err ) throw err;
|
|
||||||
var next = this;
|
|
||||||
assert.response(server, {
|
|
||||||
url: '/tiles/layergroup/' + expected_token + '/0/0/0.png',
|
|
||||||
method: 'GET',
|
|
||||||
headers: {host: 'localhost' },
|
|
||||||
encoding: 'binary'
|
|
||||||
}, {}, function(res) {
|
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
|
||||||
assert.equal(res.headers['content-type'], "image/png");
|
|
||||||
|
|
||||||
// Check X-Cache-Channel
|
|
||||||
var cc = res.headers['x-cache-channel'];
|
|
||||||
assert.ok(cc);
|
|
||||||
var dbname = 'cartodb_test_user_1_db'
|
|
||||||
assert.equal(cc.substring(0, dbname.length), dbname);
|
|
||||||
var jsonquery = cc.substring(dbname.length+1);
|
|
||||||
var sentquery = JSON.parse(jsonquery);
|
|
||||||
assert.equal(sentquery.q, 'SELECT CDB_QueryTables($windshaft$'
|
|
||||||
+ layergroup.layers[0].options.sql + ';'
|
|
||||||
+ layergroup.layers[1].options.sql
|
|
||||||
+ '$windshaft$)');
|
|
||||||
|
|
||||||
assert.imageEqualsFile(res.body, 'test/fixtures/test_table_0_0_0_multilayer1.png', 2,
|
|
||||||
function(err, similarity) {
|
|
||||||
next(err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function do_get_grid_layer1(err)
|
function do_get_grid_layer1(err)
|
||||||
{
|
{
|
||||||
if ( err ) throw err;
|
if ( err ) throw err;
|
||||||
var next = this;
|
var next = this;
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/tiles/layergroup/' + expected_token
|
url: '/tiles/layergroup/' + expected_token
|
||||||
+ '/0/0/0.grid.json',
|
+ '/layer1/0/0/0.grid.json?interactivity=cartodb_id',
|
||||||
headers: {host: 'localhost' },
|
headers: {host: 'localhost' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function(res) {
|
}, {}, function(res) {
|
||||||
@ -271,6 +165,7 @@ suite('multilayer', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test("layergroup can hold substitution tokens", function(done) {
|
test("layergroup can hold substitution tokens", function(done) {
|
||||||
|
|
||||||
var layergroup = {
|
var layergroup = {
|
||||||
@ -280,13 +175,12 @@ suite('multilayer', function() {
|
|||||||
sql: 'select 1 as cartodb_id, '
|
sql: 'select 1 as cartodb_id, '
|
||||||
+ 'ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!)) as the_geom_webmercator',
|
+ 'ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!)) as the_geom_webmercator',
|
||||||
cartocss: '#layer { polygon-fill:red; }',
|
cartocss: '#layer { polygon-fill:red; }',
|
||||||
cartocss_version: '2.0.1',
|
cartocss_version: '2.0.1'
|
||||||
interactivity: ['cartodb_id']
|
|
||||||
} }
|
} }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
var expected_token = "71c795a09d5e351c937a0b4bcbd867e5";
|
var expected_token = "20f5710c00e3a1b0b4950de65ef0d875";
|
||||||
Step(
|
Step(
|
||||||
function do_post()
|
function do_post()
|
||||||
{
|
{
|
||||||
@ -386,7 +280,7 @@ suite('multilayer', function() {
|
|||||||
var next = this;
|
var next = this;
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/tiles/layergroup/' + expected_token
|
url: '/tiles/layergroup/' + expected_token
|
||||||
+ '/1/0/0.grid.json',
|
+ '/layer0/1/0/0.grid.json?interactivity=cartodb_id',
|
||||||
headers: {host: 'localhost' },
|
headers: {host: 'localhost' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function(res) {
|
}, {}, function(res) {
|
||||||
@ -404,7 +298,7 @@ suite('multilayer', function() {
|
|||||||
var next = this;
|
var next = this;
|
||||||
assert.response(server, {
|
assert.response(server, {
|
||||||
url: '/tiles/layergroup/' + expected_token
|
url: '/tiles/layergroup/' + expected_token
|
||||||
+ '/4/0/0.grid.json',
|
+ '/layer0/4/0/0.grid.json?interactivity=cartodb_id',
|
||||||
headers: {host: 'localhost' },
|
headers: {host: 'localhost' },
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}, {}, function(res) {
|
}, {}, function(res) {
|
||||||
|
Loading…
Reference in New Issue
Block a user