Skip to content

Commit daa12aa

Browse files
committed
Merge pull request #33 from GoogleCloudPlatform/datastore-v1beta3
Added back datastore v1beta3 samples.
2 parents 5b9734e + 5216d71 commit daa12aa

File tree

9 files changed

+1859
-1
lines changed

9 files changed

+1859
-1
lines changed

datastore/concepts.js

Lines changed: 1316 additions & 0 deletions
Large diffs are not rendered by default.

datastore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
},
1515
"dependencies": {
1616
"async": "^1.5.2",
17-
"gcloud": "^0.27.0"
17+
"gcloud": "^0.28.0"
1818
}
1919
}

test/datastore/entity.test.js

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// Copyright 2015, Google, Inc.
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
'use strict';
15+
16+
var testUtil = require('./util.js');
17+
18+
var Entity = require('../../datastore/concepts').Entity;
19+
var entity;
20+
21+
describe('datastore/concepts/entity', function () {
22+
before(function() {
23+
var projectId = process.env.GCLOUD_PROJECT || 'nodejs-docs-samples';
24+
entity = new Entity(projectId);
25+
});
26+
27+
after(function(done) {
28+
var datastore = entity.datastore;
29+
var query = datastore.createQuery('Task');
30+
31+
testUtil.deleteEntities(datastore, query, done);
32+
});
33+
34+
describe('incomplete key', function() {
35+
it('saves with an incomplete key', function(done) {
36+
entity.testIncompleteKey(done);
37+
});
38+
});
39+
40+
describe('testNamedKey', function() {
41+
it('saves with a named key', function(done) {
42+
entity.testNamedKey(done);
43+
});
44+
});
45+
46+
describe('testKeyWithParent', function() {
47+
it('saves a key with a parent', function(done) {
48+
entity.testKeyWithParent(done);
49+
});
50+
});
51+
52+
describe('testKeyWithMultiLevelParent', function() {
53+
it('saves a key with multiple parents', function(done) {
54+
entity.testKeyWithMultiLevelParent(done);
55+
});
56+
});
57+
58+
describe('testEntityWithParent', function() {
59+
it('saves an entity with a parent', function(done) {
60+
entity.testEntityWithParent(done);
61+
});
62+
});
63+
64+
describe('testProperties', function() {
65+
it('saves an entity with properties', function(done) {
66+
entity.testProperties(done);
67+
});
68+
});
69+
70+
describe('testArrayValue', function() {
71+
it('saves an entity with arrays', function(done) {
72+
entity.testArrayValue(done);
73+
});
74+
});
75+
76+
describe('testBasicEntity', function() {
77+
it('saves a basic entity', function(done) {
78+
entity.testBasicEntity(done);
79+
});
80+
});
81+
82+
describe('testInsert', function() {
83+
it('saves with an insert', function(done) {
84+
entity.testInsert(done);
85+
});
86+
});
87+
88+
describe('testLookup', function() {
89+
it('performs a lookup', function(done) {
90+
entity.testLookup(done);
91+
});
92+
});
93+
94+
describe('testUpdate', function() {
95+
it('saves with an update', function(done) {
96+
entity.testUpdate(done);
97+
});
98+
});
99+
100+
describe('testDelete', function() {
101+
it('deletes an entity', function(done) {
102+
entity.testDelete(done);
103+
});
104+
});
105+
106+
describe('testBatchUpsert', function() {
107+
it('performs a batch upsert', function(done) {
108+
entity.testBatchUpsert(done);
109+
});
110+
});
111+
112+
describe('testBatchLookup', function() {
113+
it('performs a batch lookup', function(done) {
114+
entity.testBatchLookup(done);
115+
});
116+
});
117+
118+
describe('testBatchDelete', function() {
119+
it('performs a batch delete', function(done) {
120+
entity.testBatchDelete(done);
121+
});
122+
});
123+
});

test/datastore/index.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
indexes:
2+
- kind: Task
3+
properties:
4+
- name: done
5+
- name: priority
6+
direction: desc
7+
- kind: Task
8+
properties:
9+
- name: priority
10+
- name: percent_complete
11+
- kind: Task
12+
properties:
13+
- name: type
14+
- name: priority
15+
- kind: Task
16+
properties:
17+
- name: priority
18+
- name: created
19+
- kind: Task
20+
properties:
21+
- name: done
22+
- name: created
23+
- kind: Task
24+
properties:
25+
- name: type
26+
- name: priority
27+
direction: desc
28+
- kind: Task
29+
properties:
30+
- name: type
31+
- name: created
32+
- kind: Task
33+
properties:
34+
- name: priority
35+
direction: desc
36+
- name: created
37+

test/datastore/indexes.test.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2015, Google, Inc.
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
'use strict';
15+
16+
var testUtil = require('./util.js');
17+
18+
var Index = require('../../datastore/concepts').Index;
19+
var index;
20+
21+
describe('datastore/concepts/indexes', function () {
22+
before(function() {
23+
var projectId = process.env.GCLOUD_PROJECT || 'nodejs-docs-samples';
24+
index = new Index(projectId);
25+
});
26+
27+
after(function(done) {
28+
var datastore = index.datastore;
29+
var query = datastore.createQuery('Task');
30+
31+
testUtil.deleteEntities(datastore, query, done);
32+
});
33+
34+
describe('unindexed properties', function() {
35+
it('performs a query with a filter on an unindexed property',
36+
function(done) {
37+
index.testUnindexedPropertyQuery(done);
38+
}
39+
);
40+
});
41+
42+
describe('exploding properties', function() {
43+
it('inserts arrays of data', function(done) {
44+
index.testExplodingProperties(done);
45+
});
46+
});
47+
});

test/datastore/metadata.test.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright 2015, Google, Inc.
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
'use strict';
15+
16+
var testUtil = require('./util.js');
17+
18+
var Metadata = require('../../datastore/concepts').Metadata;
19+
var metadata;
20+
21+
describe('datastore/concepts/metadata', function () {
22+
before(function() {
23+
var projectId = process.env.GCLOUD_PROJECT || 'nodejs-docs-samples';
24+
metadata = new Metadata(projectId);
25+
});
26+
27+
after(function(done) {
28+
var datastore = metadata.datastore;
29+
var query = datastore.createQuery('Task');
30+
31+
testUtil.deleteEntities(datastore, query, done);
32+
});
33+
34+
describe('namespace query', function() {
35+
it('performs a namespace query', function(done) {
36+
metadata.testNamespaceRunQuery(done);
37+
});
38+
});
39+
40+
describe('kinds query', function() {
41+
it('performs a kind query', function(done) {
42+
metadata.testKindRunQuery(done);
43+
});
44+
});
45+
46+
describe('property query', function() {
47+
it('performs a property query', function(done) {
48+
metadata.testPropertyRunQuery(done);
49+
});
50+
});
51+
52+
describe('property by kind query', function() {
53+
it('performs a property by kind query', function(done) {
54+
metadata.testPropertyByKindRunQuery(done);
55+
});
56+
});
57+
});

0 commit comments

Comments
 (0)