Skip to content

Commit

Permalink
Added back datastore v1beta3 samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Nov 19, 2015
1 parent ab4f065 commit 089fe79
Show file tree
Hide file tree
Showing 9 changed files with 1,793 additions and 2 deletions.
1,329 changes: 1,329 additions & 0 deletions datastore/concepts.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
},
"dependencies": {
"async": "^1.5.0",
"gcloud": "^0.25.0"
"gcloud": "stephenplusplus/gcloud-node#spp--datastore-v1beta3"
}
}
2 changes: 1 addition & 1 deletion datastore/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (keyFile) {
options.keyFilename = keyFile;
}

var datastore = gcloud.datastore.dataset(options);
var datastore = gcloud.datastore(options);
// [END build_service]

/*
Expand Down
120 changes: 120 additions & 0 deletions test/datastore/entity.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Copyright 2015, Google, Inc.
// Licensed 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.

'use strict';

var Entity = require('../../datastore/concepts').Entity;
var entity;

describe('datastore/concepts/entity', function () {
before(function() {
var projectId = process.env.TEST_PROJECT_ID || 'nodejs-docs-samples';
entity = new Entity(projectId);
});

describe('incomplete key', function() {
it('saves with an incomplete key', function(done) {
entity.testIncompleteKey(done);
});
});

describe('testNamedKey', function() {
it('saves with a named key', function(done) {
entity.testNamedKey(done);
});
});

describe('testKeyWithParent', function() {
it('saves a key with a parent', function(done) {
entity.testKeyWithParent(done);
});
});

describe('testKeyWithMultiLevelParent', function() {
it('saves a key with multiple parents', function(done) {
entity.testKeyWithMultiLevelParent(done);
});
});

describe('testEntityWithParent', function() {
it('saves an entity with a parent', function(done) {
entity.testEntityWithParent(done);
});
});

describe('testProperties', function() {
it('saves an entity with properties', function(done) {
entity.testProperties(done);
});
});

describe('testArrayValue', function() {
it('saves an entity with arrays', function(done) {
entity.testArrayValue(done);
});
});

describe('testBasicEntity', function() {
it('saves a basic entity', function(done) {
entity.testBasicEntity(done);
});
});

describe('testUpsert', function() {
it('saves with an upsert', function(done) {
entity.testUpsert(done);
});
});

describe('testInsert', function() {
it('saves with an insert', function(done) {
entity.testInsert(done);
});
});

describe('testLookup', function() {
it('performs a lookup', function(done) {
entity.testLookup(done);
});
});

describe('testUpdate', function() {
it('saves with an update', function(done) {
entity.testUpdate(done);
});
});

describe('testDelete', function() {
it('deletes an entity', function(done) {
entity.testDelete(done);
});
});

describe('testBatchUpsert', function() {
it('performs a batch upsert', function(done) {
entity.testBatchUpsert(done);
});
});

describe('testBatchLookup', function() {
it('performs a batch lookup', function(done) {
entity.testBatchLookup(done);
});
});

describe('testBatchDelete', function() {
it('performs a batch delete', function(done) {
entity.testBatchDelete(done);
});
});
});
37 changes: 37 additions & 0 deletions test/datastore/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
indexes:
- kind: Task
properties:
- name: done
- name: priority
direction: desc
- kind: Task
properties:
- name: priority
- name: percent_complete
- kind: Task
properties:
- name: type
- name: priority
- kind: Task
properties:
- name: priority
- name: created
- kind: Task
properties:
- name: done
- name: created
- kind: Task
properties:
- name: type
- name: priority
direction: desc
- kind: Task
properties:
- name: type
- name: created
- kind: Task
properties:
- name: priority
direction: desc
- name: created

38 changes: 38 additions & 0 deletions test/datastore/indexes.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2015, Google, Inc.
// Licensed 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.

'use strict';

var Index = require('../../datastore/concepts').Index;
var index;

describe('datastore/concepts/indexes', function () {
before(function() {
var projectId = process.env.TEST_PROJECT_ID || 'nodejs-docs-samples';
index = new Index(projectId);
});

describe('unindexed properties', function() {
it('performs a query with a filter on an unindexed property',
function(done) {
index.testUnindexedPropertyQuery(done);
}
);
});

describe('exploding properties', function() {
it('inserts arrays of data', function(done) {
index.testExplodingProperties(done);
});
});
});
48 changes: 48 additions & 0 deletions test/datastore/metadata.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2015, Google, Inc.
// Licensed 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.

'use strict';

var Metadata = require('../../datastore/concepts').Metadata;
var metadata;

describe('datastore/concepts/metadata', function () {
before(function() {
var projectId = process.env.TEST_PROJECT_ID || 'nodejs-docs-samples';
metadata = new Metadata(projectId);
});

describe('namespace query', function() {
it('performs a namespace query', function(done) {
metadata.testNamespaceRunQuery(done);
});
});

describe('kinds query', function() {
it('performs a kind query', function(done) {
metadata.testKindRunQuery(done);
});
});

describe('property query', function() {
it('performs a property query', function(done) {
metadata.testPropertyRunQuery(done);
});
});

describe('property by kind query', function() {
it('performs a property by kind query', function(done) {
metadata.testPropertyByKindRunQuery(done);
});
});
});
Loading

0 comments on commit 089fe79

Please sign in to comment.