You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/10/15 16:18:08 UTC
[18/50] [abbrv] usergrid git commit: remove integration tests
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f005aceb/stack/rest_integration_tests/test/queries/equals.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/queries/equals.js b/stack/rest_integration_tests/test/queries/equals.js
deleted file mode 100644
index 904646b..0000000
--- a/stack/rest_integration_tests/test/queries/equals.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var entities = require("../../lib/entities");
-var should = require("should");
-var async = require('async');
-var config = require('../../config');
-
-module.exports = {
- test: function() {
- describe("filter " + config.genericTestCollection1 + " with '=' and '!=' queries", function(done) {
- var query1 = "where consistentProperty = 'somethingConsistent'";
- maxNumberOfEntities = Math.max(config.numberOfEntities, 100);
- it('should return ' + config.numberOfEntities + ' results ' + query1, function(done) {
- entities.getWithQuery(config.genericTestCollection1, query1, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- body.entities.length.should.equal(config.numberOfEntities);
- body.entities.forEach(function(entity) {
- entity.consistentProperty.should.equal('somethingConsistent');
- });
- done();
- });
- });
-
- var query2 = "where title = 'A Tale of Two Cities'";
- maxNumberOfEntities = Math.max(config.numberOfEntities, 100);
- it('should return ' + config.numberOfEntities + ' results ' + query2, function(done) {
- entities.getWithQuery(config.genericTestCollection1, query2, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- body.entities.length.should.equal(config.numberOfEntities);
- body.entities.forEach(function(entity) {
- entity.title.should.equal('A Tale of Two Cities');
- });
- done();
- });
- });
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f005aceb/stack/rest_integration_tests/test/queries/location.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/queries/location.js b/stack/rest_integration_tests/test/queries/location.js
deleted file mode 100644
index 6fbc96a..0000000
--- a/stack/rest_integration_tests/test/queries/location.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var entities = require("../../lib/entities");
-var should = require("should");
-var async = require('async');
-var config = require('../../config');
-var response = require('../../lib/response');
-
-module.exports = {
- test: function() {
- describe("filter " + config.genericTestCollection2 + " with location queries", function(done) {
- var locationString = config.location.latitude + ", " + config.location.longitude;
- var query = "location within 1000 of " + locationString;
- maxNumberOfEntities = Math.max(config.numberOfEntities, 100);
- it("should return all results with a location within 1000m of " + locationString, function(done) {
- entities.getWithQuery(config.genericTestCollection2, query, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- body.entities.forEach(function(entity) {
- var distance = response.distanceInMeters(config.location, entity.location);
- distance.should.be.lessThan(1000);
- });
- done();
- });
- });
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f005aceb/stack/rest_integration_tests/test/queries/order.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/queries/order.js b/stack/rest_integration_tests/test/queries/order.js
deleted file mode 100644
index 8cbb78f..0000000
--- a/stack/rest_integration_tests/test/queries/order.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var entities = require("../../lib/entities");
-var should = require("should");
-var async = require('async');
-var config = require('../../config');
-
-module.exports = {
- test: function() {
- describe("sort " + config.genericTestCollection1 + " with 'order by' queries", function(done) {
- var query1 = "order by created desc";
- it('should return a subset of results ' + query1.replace('order', 'ordered'), function(done) {
- entities.getWithQuery(config.genericTestCollection1, query1, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- var comparisonArray = body.entities;
- comparisonArray.sort(function(a, b) {
- return a.created + b.created;
- });
- body.entities.should.equal(comparisonArray);
- done();
- });
- });
- var query2 = "order by created asc";
- it('should return a subset of results ' + query2.replace('order', 'ordered'), function(done) {
- entities.getWithQuery(config.genericTestCollection1, query2, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- var comparisonArray = body.entities;
- comparisonArray.sort(function(a, b) {
- return a.created - b.created;
- });
- body.entities.should.equal(comparisonArray);
- done();
- });
- });
- var query3 = "order by optionsProperty desc";
- it('should return a subset of results ' + query3.replace('order', 'ordered'), function(done) {
- entities.getWithQuery(config.genericTestCollection1, query3, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- var comparisonArray = body.entities;
- comparisonArray.sort(function(a, b) {
- if (a.optionsProperty > b.optionsProperty) return -1;
- if (a.optionsProperty < b.optionsProperty) return 1;
- return 0;
- });
- body.entities.should.equal(comparisonArray);
- done();
- });
- });
- var query4 = "order by optionsProperty asc";
- it('should return a subset of results ' + query4.replace('order', 'ordered'), function(done) {
- entities.getWithQuery(config.genericTestCollection1, query4, maxNumberOfEntities, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array);
- var comparisonArray = body.entities;
- comparisonArray.sort(function(a, b) {
- if (a.optionsProperty < b.optionsProperty) return -1;
- if (a.optionsProperty > b.optionsProperty) return 1;
- return 0;
- });
- done();
- });
- });
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f005aceb/stack/rest_integration_tests/test/setup.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/setup.js b/stack/rest_integration_tests/test/setup.js
deleted file mode 100644
index 4fbc664..0000000
--- a/stack/rest_integration_tests/test/setup.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// here we're going to do teardown of BaaS environment - deletion of users, entities, etc.
-var users = require("../lib/users");
-var entities = require("../lib/entities");
-var config = require("../config");
-var async = require("async");
-var uuid = require("uuid");
-var should = require("should");
-
-module.exports = {
- users: [],
- admins: [],
- do: function(cb) {
- console.log(" setup");
- async.parallel([
- function(cb) {
- // create admin user
- var id = uuid.v1().toString().replace("-", "");
- var admin = {
- username: id + "user",
- password: "pwd" + id,
- name: id + " name",
- email: id + "@uge2e.com"
- }
- users.add(admin, function(err, user) {
- users.addToRole(user.username, "admin", function(err) {
- module.exports.admins.push(admin);
- cb(err, err ? null : admin);
- });
- });
- },
- function(cb) {
- // create app users
- var size = config.numberOfUsers;
- var userArr = [];
- module.exports.users = userArr;
- for (var i = 0; i < size; i++) {
- var id = uuid.v1().toString().replace("-", "");
- userArr.push({
- username: id + "user",
- password: "pwd" + id,
- name: id + " name",
- email: id + "@uge2e.com"
- });
- }
- async.each(
- userArr,
- function(user, cb) {
- users.add(user, function(err, user) {
- cb(err, user);
- });
- },
- function(err, localUsers) {
- cb(err);
- }
- )
- },
- function(cb) {
- // create entities
- async.parallel([
- function(cb) {
- entities.create(config.genericTestCollection1, config.numberOfEntities, function(err, body) {
- cb(err);
- });
- },
- function(cb) {
- entities.create(config.genericTestCollection2, config.numberOfEntities, function(err, body) {
- cb(err);
- });
- },
- function(cb) {
- entities.create(config.consumableTestCollection, config.numberOfEntities, function(err, body) {
- cb(err);
- });
- }
- ],
- function(err, data) {
- cb(err);
- });
- }
- ],
- function(err, data) {
- should(err).be.null;
- console.log(" ✓".green + " done".grey);
- if (cb && typeof(cb) === 'function') cb(err);
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f005aceb/stack/rest_integration_tests/test/teardown.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/teardown.js b/stack/rest_integration_tests/test/teardown.js
deleted file mode 100644
index 7afdc97..0000000
--- a/stack/rest_integration_tests/test/teardown.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var entities = require("../lib/entities");
-var should = require("should");
-var async = require("async");
-var config = require("../config");
-var inflect = require("i")();
-
-module.exports = {
- do: function(cb) {
- console.log(" teardown");
- async.parallel([
- function(cb) {
- entities.deleteAll(config.usersCollection, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array).and.have.lengthOf(0);
- body.count.should.equal(0);
- cb(err);
- })
- },
- function(cb) {
- entities.deleteAll(config.genericTestCollection1, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array).and.have.lengthOf(0);
- body.count.should.equal(0);
- cb(err);
- })
- },
- function(cb) {
- entities.deleteAll(config.genericTestCollection2, function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array).and.have.lengthOf(0);
- body.count.should.equal(0);
- cb(err);
- })
- },
- function(cb) {
- entities.deleteAll(inflect.pluralize(config.consumableTestCollection), function(err, body) {
- should(err).be.null;
- body.entities.should.be.an.instanceOf(Array).and.have.lengthOf(0);
- body.count.should.equal(0);
- cb(err);
- })
- }
- ],
- function(err, data) {
- console.log(" ✓".green + " done".grey);
- if (cb && typeof(cb) === 'function') cb(err);
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f005aceb/stack/rest_integration_tests/test/users/create.js
----------------------------------------------------------------------
diff --git a/stack/rest_integration_tests/test/users/create.js b/stack/rest_integration_tests/test/users/create.js
deleted file mode 100644
index c62ccc4..0000000
--- a/stack/rest_integration_tests/test/users/create.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-var should = require("should");
-var uuid = require("uuid");
-var users = require("../../lib/users");
-
-module.exports = {
- test: function() {
- describe("create a user", function() {
- var username = "testuser" + uuid.v1();
- var password = "password";
- it("should successfully return a user object", function(done) {
- users.add({
- username: username,
- password: password,
- name: username + " name",
- email: username + "@uge2e.com"
- }, function(err, userBody) {
- should(err).be.null;
- userBody.should.not.be.null;
- users.login(username, password, function(err, body) {
- should(err).be.null;
- body.should.not.be.null;
- body.should.have.property("access_token");
- done();
- })
- });
- });
- });
- }
-}