Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dummy app stubs in on-core to test dependency failure mechanisms
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use strict"; | ||
|
||
var di = require('di'), | ||
_ = require('lodash'), | ||
core = require('..')(di), | ||
injector = new di.Injector( | ||
_.flatten([ | ||
core.injectables, | ||
require('./dummyapp') | ||
]) | ||
), | ||
logger = injector.get('Logger').initialize('DummyApp'), | ||
dummyApp = injector.get('DummyApp'); | ||
|
||
dummyApp.start() | ||
.catch(function(err) { | ||
logger.critical('Failure starting dummyAppy' + err.stack); | ||
process.nextTick(function(){ | ||
process.exit(1); | ||
}); | ||
}); |
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,26 @@ | ||
"use strict"; | ||
|
||
var di = require('di'); | ||
module.exports = Runner; | ||
di.annotate(Runner, new di.Provide('DummyApp')); | ||
di.annotate(Runner, new di.Inject( | ||
'Services.Core', | ||
'Services.Messenger', | ||
'Promise' | ||
) | ||
); | ||
|
||
function Runner(core, messenger, Promise) { | ||
function start() { | ||
return core.start(). | ||
then(function() { | ||
}); | ||
} | ||
function stop() { | ||
return core.stop(); | ||
} | ||
return { | ||
start: start, | ||
stop: stop | ||
}; | ||
} |