Require windshaft-0.9 for multilayer support

This commit is contained in:
Sandro Santilli 2013-02-25 15:08:28 +01:00
parent 9b04abb36c
commit f076b0c4d1
4 changed files with 318 additions and 29 deletions

View File

@ -1,6 +1,7 @@
1.1.7 (DD//MM//YY)
-----
* Do not let /etc/services confuse FD checker (munin plugin)
* Multilayer support (#72)
1.1.6 (19//02//13)
-----

192
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "windshaft-cartodb",
"version": "1.1.6",
"version": "1.1.7",
"dependencies": {
"cluster2": {
"version": "0.3.5-cdb02",
@ -32,10 +32,10 @@
"version": "0.8.3"
},
"npm": {
"version": "1.1.69",
"version": "1.1.65",
"dependencies": {
"semver": {
"version": "1.1.1"
"version": "1.1.0"
},
"ini": {
"version": "1.0.5"
@ -50,12 +50,7 @@
"version": "1.1.14"
},
"minimatch": {
"version": "0.2.9",
"dependencies": {
"sigmund": {
"version": "1.0.0"
}
}
"version": "0.2.8"
},
"nopt": {
"version": "2.0.0"
@ -71,7 +66,7 @@
"version": "1.0.5"
},
"tar": {
"version": "0.1.14"
"version": "0.1.13"
},
"fstream": {
"version": "0.1.19"
@ -98,7 +93,7 @@
"version": "2.0.4"
},
"node-gyp": {
"version": "0.7.3"
"version": "0.7.1"
},
"fstream-npm": {
"version": "0.1.3",
@ -132,7 +127,7 @@
}
},
"read-package-json": {
"version": "0.1.11"
"version": "0.1.8"
},
"read-installed": {
"version": "0.0.3"
@ -164,7 +159,7 @@
"version": "0.0.16",
"dependencies": {
"config-chain": {
"version": "1.1.3",
"version": "1.1.2",
"dependencies": {
"proto-list": {
"version": "1.2.2"
@ -187,8 +182,20 @@
"version": "1.3.3"
},
"grainstore": {
"version": "0.10.10",
"version": "0.11.1",
"dependencies": {
"underscore": {
"version": "1.3.3"
},
"step": {
"version": "0.0.5"
},
"semver": {
"version": "1.1.2"
},
"generic-pool": {
"version": "1.0.12"
},
"carto": {
"version": "0.9.3-cdb2",
"from": "git://github.com/CartoDB/carto.git#cdb-0.9",
@ -197,18 +204,23 @@
"version": "0.1.14",
"dependencies": {
"sax": {
"version": "0.4.2"
"version": "0.5.1"
}
}
}
}
},
"mapnik-reference": {
"version": "5.0.0-cdb1",
"from": "git://github.com/CartoDB/mapnik-reference.git#cdb-5.0"
"version": "5.0.4"
},
"redis": {
"version": "0.7.3"
},
"hiredis": {
"version": "0.1.14"
},
"millstone": {
"version": "0.5.13",
"version": "0.5.15",
"dependencies": {
"request": {
"version": "2.11.4",
@ -235,27 +247,61 @@
}
},
"srs": {
"version": "0.2.18"
"version": "0.2.20"
},
"zipfile": {
"version": "0.3.3"
"version": "0.3.4"
},
"sqlite3": {
"version": "2.1.5"
},
"mime": {
"version": "1.2.7"
"version": "1.2.9"
},
"mkdirp": {
"version": "0.3.4"
}
}
},
"libxmljs": {
"version": "0.5.4"
},
"mocha": {
"version": "1.2.1",
"dependencies": {
"commander": {
"version": "0.6.1"
},
"growl": {
"version": "1.5.1"
},
"jade": {
"version": "0.26.3",
"dependencies": {
"mkdirp": {
"version": "0.3.0"
}
}
},
"diff": {
"version": "1.0.2"
},
"debug": {
"version": "0.7.0"
}
}
}
}
},
"windshaft": {
"version": "0.8.5",
"version": "0.9.0",
"dependencies": {
"underscore": {
"version": "1.3.3"
},
"step": {
"version": "0.0.5"
},
"express": {
"version": "2.5.11",
"dependencies": {
@ -279,10 +325,10 @@
}
},
"tilelive": {
"version": "4.3.3",
"version": "4.3.1",
"dependencies": {
"optimist": {
"version": "0.3.5",
"version": "0.3.4",
"dependencies": {
"wordwrap": {
"version": "0.0.2"
@ -296,13 +342,58 @@
},
"tilelive-mapnik": {
"version": "0.3.3-cdb2",
"from": "git://github.com/Vizzuality/tilelive-mapnik.git#6061c65a",
"dependencies": {
"step": {
"version": "0.0.5"
},
"underscore": {
"version": "1.3.3"
},
"generic-pool": {
"version": "1.0.12"
},
"eio": {
"version": "0.1.0"
},
"sphericalmercator": {
"version": "1.0.2"
},
"expresso": {
"version": "0.9.2"
}
}
},
"redis": {
"version": "0.7.2"
},
"hiredis": {
"version": "0.1.14"
},
"semver": {
"version": "1.1.0"
},
"mocha": {
"version": "1.2.1",
"dependencies": {
"commander": {
"version": "0.6.1"
},
"growl": {
"version": "1.5.1"
},
"jade": {
"version": "0.26.3",
"dependencies": {
"mkdirp": {
"version": "0.3.0"
}
}
},
"diff": {
"version": "1.0.2"
},
"debug": {
"version": "0.7.0"
}
}
}
@ -324,7 +415,56 @@
"version": "2.9.202"
},
"mapnik": {
"version": "0.7.18"
"version": "0.7.22",
"dependencies": {
"mocha": {
"version": "1.6.0",
"dependencies": {
"commander": {
"version": "0.6.1"
},
"growl": {
"version": "1.5.1"
},
"jade": {
"version": "0.26.3",
"dependencies": {
"mkdirp": {
"version": "0.3.0"
}
}
},
"diff": {
"version": "1.0.2"
},
"debug": {
"version": "0.7.0"
},
"mkdirp": {
"version": "0.3.3"
},
"ms": {
"version": "0.3.0"
}
}
},
"jshint": {
"version": "0.5.9",
"dependencies": {
"argsparser": {
"version": "0.0.6"
},
"minimatch": {
"version": "0.2.7",
"dependencies": {
"lru-cache": {
"version": "2.0.4"
}
}
}
}
}
}
},
"semver": {
"version": "1.1.1"

View File

@ -21,10 +21,10 @@
"cluster2": "git://github.com/CartoDB/cluster2.git#cdb_production",
"node-varnish": "0.1.1",
"underscore" : "~1.3.3",
"grainstore" : "~0.10.10",
"windshaft" : "~0.8.4",
"grainstore" : "~0.11.1",
"windshaft" : "~0.9.0",
"step": "0.0.x",
"generic-pool": "1.0.x",
"generic-pool": "~1.0.12",
"redis": "0.7.2",
"hiredis": "~0.1.14",
"request": "2.9.202",

View File

@ -0,0 +1,148 @@
var assert = require('../support/assert');
var tests = module.exports = {};
var _ = require('underscore');
var redis = require('redis');
var querystring = require('querystring');
var semver = require('semver');
var mapnik = require('mapnik');
var Step = require('step');
require(__dirname + '/../support/test_helper');
var windshaft_fixtures = __dirname + '/../../node_modules/windshaft/test/fixtures';
var CartodbWindshaft = require(__dirname + '/../../lib/cartodb/cartodb_windshaft');
var serverOptions = require(__dirname + '/../../lib/cartodb/server_options');
var server = new CartodbWindshaft(serverOptions);
server.setMaxListeners(0);
suite('multilayer', function() {
var redis_client = redis.createClient(global.environment.redis.port);
suiteSetup(function(){
});
test("layergroup with 2 layers, each with its style", 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'
} },
{ 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'
} }
]
};
var expected_token = "d442ca6d3ece793b9c16c02a1d1ea5f2";
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 };
// TODO: check last modified
//expectedBody.layercount = 2;
if ( expected_token ) 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");
assert.imageEqualsFile(res.body, 'test/fixtures/test_table_0_0_0_multilayer1.png', 2,
function(err, similarity) {
next(err);
});
});
},
function do_get_grid_layer0(err)
{
if ( err ) throw err;
var next = this;
assert.response(server, {
url: '/tiles/layergroup/' + expected_token
+ '/layer0/0/0/0.grid.json?interactivity=cartodb_id',
headers: {host: 'localhost' },
method: 'GET'
}, {}, function(res) {
assert.equal(res.statusCode, 200, res.body);
assert.equal(res.headers['content-type'], "text/javascript; charset=utf-8; charset=utf-8");
assert.utfgridEqualsFile(res.body, 'test/fixtures/test_table_0_0_0_multilayer1.layer0.grid.json', 2,
function(err, similarity) {
next(err);
});
});
},
function do_get_grid_layer1(err)
{
if ( err ) throw err;
var next = this;
assert.response(server, {
url: '/tiles/layergroup/' + expected_token
+ '/layer1/0/0/0.grid.json?interactivity=cartodb_id',
headers: {host: 'localhost' },
method: 'GET'
}, {}, function(res) {
assert.equal(res.statusCode, 200, res.body);
assert.equal(res.headers['content-type'], "text/javascript; charset=utf-8; charset=utf-8");
assert.utfgridEqualsFile(res.body, 'test/fixtures/test_table_0_0_0_multilayer1.layer1.grid.json', 2,
function(err, similarity) {
next(err);
});
});
},
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);
});
});
}
);
});
suiteTeardown(function(done) {
// This test will add map_style records, like
// 'map_style|null|publicuser|my_table',
redis_client.keys("map_style|*", function(err, matches) {
_.each(matches, function(k) { redis_client.del(k); });
done();
});
});
});