ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [4/4] incubator-ignite git commit: # ignite-843 WIP.
Date Thu, 25 Jun 2015 04:41:18 GMT
# 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 <anovikov@gridgain.com>
Authored: Thu Jun 25 11:41:30 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
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


Mime
View raw message