Skip to content

Commit 089fe79

Browse files
committed
Added back datastore v1beta3 samples.
1 parent ab4f065 commit 089fe79

File tree

9 files changed

+1793
-2
lines changed

9 files changed

+1793
-2
lines changed

datastore/concepts.js

Lines changed: 1329 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
@@ -9,6 +9,6 @@
99
},
1010
"dependencies": {
1111
"async": "^1.5.0",
12-
"gcloud": "^0.25.0"
12+
"gcloud": "stephenplusplus/gcloud-node#spp--datastore-v1beta3"
1313
}
1414
}

datastore/tasks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (keyFile) {
3333
options.keyFilename = keyFile;
3434
}
3535

36-
var datastore = gcloud.datastore.dataset(options);
36+
var datastore = gcloud.datastore(options);
3737
// [END build_service]
3838

3939
/*

test/datastore/entity.test.js

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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 Entity = require('../../datastore/concepts').Entity;
17+
var entity;
18+
19+
describe('datastore/concepts/entity', function () {
20+
before(function() {
21+
var projectId = process.env.TEST_PROJECT_ID || 'nodejs-docs-samples';
22+
entity = new Entity(projectId);
23+
});
24+
25+
describe('incomplete key', function() {
26+
it('saves with an incomplete key', function(done) {
27+
entity.testIncompleteKey(done);
28+
});
29+
});
30+
31+
describe('testNamedKey', function() {
32+
it('saves with a named key', function(done) {
33+
entity.testNamedKey(done);
34+
});
35+
});
36+
37+
describe('testKeyWithParent', function() {
38+
it('saves a key with a parent', function(done) {
39+
entity.testKeyWithParent(done);
40+
});
41+
});
42+
43+
describe('testKeyWithMultiLevelParent', function() {
44+
it('saves a key with multiple parents', function(done) {
45+
entity.testKeyWithMultiLevelParent(done);
46+
});
47+
});
48+
49+
describe('testEntityWithParent', function() {
50+
it('saves an entity with a parent', function(done) {
51+
entity.testEntityWithParent(done);
52+
});
53+
});
54+
55+
describe('testProperties', function() {
56+
it('saves an entity with properties', function(done) {
57+
entity.testProperties(done);
58+
});
59+
});
60+
61+
describe('testArrayValue', function() {
62+
it('saves an entity with arrays', function(done) {
63+
entity.testArrayValue(done);
64+
});
65+
});
66+
67+
describe('testBasicEntity', function() {
68+
it('saves a basic entity', function(done) {
69+
entity.testBasicEntity(done);
70+
});
71+
});
72+
73+
describe('testUpsert', function() {
74+
it('saves with an upsert', function(done) {
75+
entity.testUpsert(done);
76+
});
77+
});
78+
79+
describe('testInsert', function() {
80+
it('saves with an insert', function(done) {
81+
entity.testInsert(done);
82+
});
83+
});
84+
85+
describe('testLookup', function() {
86+
it('performs a lookup', function(done) {
87+
entity.testLookup(done);
88+
});
89+
});
90+
91+
describe('testUpdate', function() {
92+
it('saves with an update', function(done) {
93+
entity.testUpdate(done);
94+
});
95+
});
96+
97+
describe('testDelete', function() {
98+
it('deletes an entity', function(done) {
99+
entity.testDelete(done);
100+
});
101+
});
102+
103+
describe('testBatchUpsert', function() {
104+
it('performs a batch upsert', function(done) {
105+
entity.testBatchUpsert(done);
106+
});
107+
});
108+
109+
describe('testBatchLookup', function() {
110+
it('performs a batch lookup', function(done) {
111+
entity.testBatchLookup(done);
112+
});
113+
});
114+
115+
describe('testBatchDelete', function() {
116+
it('performs a batch delete', function(done) {
117+
entity.testBatchDelete(done);
118+
});
119+
});
120+
});

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: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 Index = require('../../datastore/concepts').Index;
17+
var index;
18+
19+
describe('datastore/concepts/indexes', function () {
20+
before(function() {
21+
var projectId = process.env.TEST_PROJECT_ID || 'nodejs-docs-samples';
22+
index = new Index(projectId);
23+
});
24+
25+
describe('unindexed properties', function() {
26+
it('performs a query with a filter on an unindexed property',
27+
function(done) {
28+
index.testUnindexedPropertyQuery(done);
29+
}
30+
);
31+
});
32+
33+
describe('exploding properties', function() {
34+
it('inserts arrays of data', function(done) {
35+
index.testExplodingProperties(done);
36+
});
37+
});
38+
});

test/datastore/metadata.test.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 Metadata = require('../../datastore/concepts').Metadata;
17+
var metadata;
18+
19+
describe('datastore/concepts/metadata', function () {
20+
before(function() {
21+
var projectId = process.env.TEST_PROJECT_ID || 'nodejs-docs-samples';
22+
metadata = new Metadata(projectId);
23+
});
24+
25+
describe('namespace query', function() {
26+
it('performs a namespace query', function(done) {
27+
metadata.testNamespaceRunQuery(done);
28+
});
29+
});
30+
31+
describe('kinds query', function() {
32+
it('performs a kind query', function(done) {
33+
metadata.testKindRunQuery(done);
34+
});
35+
});
36+
37+
describe('property query', function() {
38+
it('performs a property query', function(done) {
39+
metadata.testPropertyRunQuery(done);
40+
});
41+
});
42+
43+
describe('property by kind query', function() {
44+
it('performs a property by kind query', function(done) {
45+
metadata.testPropertyByKindRunQuery(done);
46+
});
47+
});
48+
});

0 commit comments

Comments
 (0)