Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20AB818047 for ; Thu, 25 Jun 2015 04:41:26 +0000 (UTC) Received: (qmail 88140 invoked by uid 500); 25 Jun 2015 04:41:26 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 88107 invoked by uid 500); 25 Jun 2015 04:41:26 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 88098 invoked by uid 99); 25 Jun 2015 04:41:26 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jun 2015 04:41:26 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8725F1828EB for ; Thu, 25 Jun 2015 04:41:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.791 X-Spam-Level: X-Spam-Status: No, score=0.791 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id B9zQ2loTaEwC for ; Thu, 25 Jun 2015 04:41:15 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 76EE3275FF for ; Thu, 25 Jun 2015 04:41:15 +0000 (UTC) Received: (qmail 87593 invoked by uid 99); 25 Jun 2015 04:41:15 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Jun 2015 04:41:15 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 29380E3607; Thu, 25 Jun 2015 04:41:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anovikov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 25 Jun 2015 04:41:18 -0000 Message-Id: In-Reply-To: <4817158afc034b03be9d03fb43a58db9@git.apache.org> References: <4817158afc034b03be9d03fb43a58db9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/4] incubator-ignite git commit: # ignite-843 WIP. # ignite-843 WIP. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0370ff05 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0370ff05 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0370ff05 Branch: refs/heads/ignite-843 Commit: 0370ff05a5d1b94f9946e3eec9490bcd04c3bc95 Parents: 172c0ba Author: Andrey Authored: Thu Jun 25 11:41:30 2015 +0700 Committer: Andrey Committed: Thu Jun 25 11:41:30 2015 +0700 ---------------------------------------------------------------------- modules/webconfig/nodejs/app.js | 10 ++++---- modules/webconfig/nodejs/db.js | 10 -------- modules/webconfig/nodejs/package.json | 4 ++- .../public/javascripts/controllers/caches.js | 3 ++- .../public/javascripts/controllers/clusters.js | 3 ++- .../javascripts/controllers/persistences.js | 3 ++- modules/webconfig/nodejs/routes/caches.js | 2 +- modules/webconfig/nodejs/routes/persistences.js | 24 ++++++++++++++++++ .../webconfig/nodejs/test/routes/persistence.js | 26 ++++++++++++++++++++ 9 files changed, 65 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/app.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/app.js b/modules/webconfig/nodejs/app.js index de3fd06..1141b19 100644 --- a/modules/webconfig/nodejs/app.js +++ b/modules/webconfig/nodejs/app.js @@ -94,11 +94,11 @@ app.use('/rest/auth', authRouter); app.use('/rest/configGenerator', configGenerator); // Catch 404 and forward to error handler. -//app.use(function (req, res, next) { -// var err = new Error('Not Found'); -// err.status = 404; -// next(err); -//}); +app.use(function (req, res, next) { + var err = new Error('Not Found'); + err.status = 404; + next(err); +}); // Error handlers. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/db.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/db.js b/modules/webconfig/nodejs/db.js index 1a2a5e7..4493438 100644 --- a/modules/webconfig/nodejs/db.js +++ b/modules/webconfig/nodejs/db.js @@ -45,13 +45,6 @@ exports.Space = mongoose.model('Space', new Schema({ }] })); -var DiscoveryObj = { - className: String, enum: ['TcpDiscoveryVmIpFinder', 'TcpDiscoveryMulticastIpFinder', 'TcpDiscoveryS3IpFinder', - 'TcpDiscoveryCloudIpFinder', 'TcpDiscoveryGoogleStorageIpFinder', 'TcpDiscoveryJdbcIpFinder', - 'TcpDiscoverySharedFsIpFinder'], - addresses: [String] -}; - var evictionPolicyType = { kind: {type: String, enum: ['LRU', 'RND', 'FIFO', 'Sorted']}, LRU: { @@ -154,9 +147,6 @@ var CacheSchema = new Schema({ exports.Cache = mongoose.model('Cache', CacheSchema); -// Define discovery model. -exports.Discovery = mongoose.model('Discovery', new Schema(DiscoveryObj)); - // Define cluster schema. var ClusterSchema = new Schema({ space: {type: ObjectId, ref: 'Space'}, http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/package.json ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/package.json b/modules/webconfig/nodejs/package.json index dd968cb..2c1d6dd 100644 --- a/modules/webconfig/nodejs/package.json +++ b/modules/webconfig/nodejs/package.json @@ -28,6 +28,8 @@ "serve-favicon": "~2.2.0" }, "devDependencies": { - "supertest": "^1.0.1" + "supertest": "^1.0.1", + "mocha": "~2.0.1", + "should": "~3.1.3" } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/public/javascripts/controllers/caches.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js index 0b9c330..1ae5921 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js @@ -92,7 +92,8 @@ configuratorModule.controller('cachesController', ['$scope', '$alert', '$http', $scope.backupItem = angular.fromJson(sessionStorage.cacheBackupItem); $scope.$watch('backupItem', function (val) { - sessionStorage.cacheBackupItem = angular.toJson(val); + if (val) + sessionStorage.cacheBackupItem = angular.toJson(val); }, true); }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js index 9da81d8..fc4cdf1 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js @@ -111,7 +111,8 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http' $scope.backupItem = angular.fromJson(sessionStorage.clusterBackupItem); $scope.$watch('backupItem', function (val) { - sessionStorage.clusterBackupItem = angular.toJson(val); + if (val) + sessionStorage.clusterBackupItem = angular.toJson(val); }, true); }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js b/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js index d1857ecc..6024073 100644 --- a/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js +++ b/modules/webconfig/nodejs/public/javascripts/controllers/persistences.js @@ -43,7 +43,8 @@ configuratorModule.controller('persistenceController', ['$scope', '$alert', '$ht $scope.backupItem = angular.fromJson(sessionStorage.persistenceBackupItem); $scope.$watch('backupItem', function (val) { - sessionStorage.persistenceBackupItem = angular.toJson(val); + if (val) + sessionStorage.persistenceBackupItem = angular.toJson(val); }, true); }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/routes/caches.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/routes/caches.js b/modules/webconfig/nodejs/routes/caches.js index 9018f9a..7de5d57 100644 --- a/modules/webconfig/nodejs/routes/caches.js +++ b/modules/webconfig/nodejs/routes/caches.js @@ -58,7 +58,7 @@ router.get('/', function(req, res) { */ router.post('/save', function(req, res) { if (req.body._id) - db.Cache.update({_id: req.body._id}, req.body, {upsert: true}, function(err, cache) { + db.Cache.update({_id: req.body._id}, req.body, {upsert: true}, function(err) { if (err) return res.status(500).send(err.message); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/routes/persistences.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/routes/persistences.js b/modules/webconfig/nodejs/routes/persistences.js index 787453f..d891b04 100644 --- a/modules/webconfig/nodejs/routes/persistences.js +++ b/modules/webconfig/nodejs/routes/persistences.js @@ -88,4 +88,28 @@ router.post('/remove', function(req, res) { }) }); +// +router.post('/pg', function(req, res) { + var pg = require('pg'); + + //var connectionString = process.env.DATABASE_URL || 'postgres://localhost:5432/ggmonitor'; + + pg.connect(req.body.connectionString, function(err, client, done) { + if(err) + res.status(500).send(err.message); + + client.query('select * from information_schema.tables', function(err, result) { + //call `done()` to release the client back to the pool + done(); + + if(err) + res.status(500).send(err.message); + + console.log(result.rows[0]); + + res.sendStatus(200); + }); + }); +}); + module.exports = router; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0370ff05/modules/webconfig/nodejs/test/routes/persistence.js ---------------------------------------------------------------------- diff --git a/modules/webconfig/nodejs/test/routes/persistence.js b/modules/webconfig/nodejs/test/routes/persistence.js new file mode 100644 index 0000000..5d86d83 --- /dev/null +++ b/modules/webconfig/nodejs/test/routes/persistence.js @@ -0,0 +1,26 @@ +var request = require('supertest'), + should = require('should'), + express = require('express'), + persistenceRouter = require('../../routes/persistence'); + +var app = express(); + +app.use(require('body-parser').json()); + +app.use('/rest/persistence', persistenceRouter); + +describe('request.persistence', function(){ + var agent = request.agent(app); + + it('should return 200', function(done){ + agent + .post('/rest/persistence/pg') + .send({ connectionString: 'postgres://localhost:5432/ggmonitor' }) + .end(function(err, res) { + if (err) + throw err; + + done(); + }); + }); +}); \ No newline at end of file