-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#251 Add option of creating project.
Place holder for loading nodes.
- Loading branch information
pmeijer
committed
Mar 18, 2015
1 parent
a8e6ab7
commit 4b7f122
Showing
5 changed files
with
155 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*jshint node:true, mocha:true*/ | ||
/** | ||
* @author pmeijer / https://github.com/pmeijer | ||
*/ | ||
|
||
var testFixture = require('../_globals'); | ||
|
||
describe('AddOnBase', function () { | ||
'use strict'; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/*jshint node:true, mocha:true*/ | ||
/** | ||
* @author pmeijer / https://github.com/pmeijer | ||
*/ | ||
|
||
var testFixture = require('../../_globals'); | ||
|
||
describe('TestAddOn', function () { | ||
'use strict'; | ||
|
||
var expect = testFixture.expect, | ||
WebGME = testFixture.WebGME, | ||
Core = testFixture.WebGME.core, | ||
addOnName = 'TestAddOn', | ||
TestAddOn = testFixture.requirejs('addon/' + addOnName + '/' + addOnName + '/' + addOnName); | ||
|
||
var getConnectedStorage = function (webGMESessionId, gmeConfig, callback) { | ||
var connStorage = new WebGME.clientStorage({ | ||
globConf: gmeConfig, | ||
type: 'node', | ||
host: (gmeConfig.server.https.enable === true ? 'https' : 'http') + '://127.0.0.1', | ||
webGMESessionId: webGMESessionId | ||
}); | ||
connStorage.openDatabase(function (err) { | ||
callback(err, connStorage); | ||
}); | ||
}; | ||
|
||
var getConnectedProject = function (storage, projectName, callback) { | ||
storage.getProjectNames(function (err, names) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
console.log('names', names); | ||
if (names.indexOf(projectName) === -1) { | ||
return callback(new Error('nonexsistent project')); | ||
} | ||
storage.openProject(projectName, callback); | ||
}); | ||
}; | ||
|
||
it('should start', function (done) { | ||
var gmeConfig = testFixture.getGmeConfig(), | ||
server, | ||
importParam = { | ||
filePath: './test/asset/sm_basic.json', | ||
projectName: 'testAddOn', | ||
branchName: 'master', | ||
gmeConfig: gmeConfig, | ||
storage: null | ||
}; | ||
gmeConfig.server.port = 9001; | ||
server = WebGME.standaloneServer(gmeConfig); | ||
server.start(function () { | ||
getConnectedStorage('sessionId', gmeConfig, function (err, storage) { | ||
console.log('getConnectedStorage'); | ||
expect(err).equal(null); | ||
importParam.storage = storage; | ||
testFixture.importProject(importParam, function (err, result) { | ||
expect(err).equal(null); | ||
console.log('importProject'); | ||
getConnectedProject(storage, importParam.projectName, function (err, project) { | ||
console.log('getConnectedProject'); | ||
var startParam, | ||
addon; | ||
addon = new TestAddOn(Core, storage, gmeConfig); | ||
expect(err).equal(null); | ||
startParam = { | ||
projectName: importParam.projectName, | ||
branchName: importParam.branchName, | ||
project: project | ||
}; | ||
addon.start(startParam, function (err) { | ||
expect(err).equal(null); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters