orator 2.0.4 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ var _MockSettings = (
17
17
  {
18
18
  Product: 'MockOratorAlternate',
19
19
  ProductVersion: '0.0.0',
20
- APIServerPort: 8080,
20
+ APIServerPort: 8099,
21
21
  APIWorkers: 3,
22
22
  APIWorkerRestart: false
23
23
  });
@@ -135,19 +135,19 @@ suite
135
135
  function(fDone)
136
136
  {
137
137
 
138
- libSuperTest('http://localhost:8080/')
138
+ libSuperTest('http://localhost:8099/')
139
139
  .get('PIN')
140
140
  .end(
141
141
  function (pError, pResponse)
142
142
  {
143
143
  Expect(pResponse.text)
144
144
  .to.contain('PON');
145
- libSuperTest('http://localhost:8080/')
145
+ libSuperTest('http://localhost:8099/')
146
146
  .get('ThirdAPI')
147
147
  .end(
148
148
  function (pError, pResponse)
149
149
  {
150
- libSuperTest('http://localhost:8080/')
150
+ libSuperTest('http://localhost:8099/')
151
151
  .get('Test.css')
152
152
  .end(
153
153
  function (pError, pResponse)
@@ -155,7 +155,7 @@ suite
155
155
  _Orator.settings.Profiling.TraceLog = true;
156
156
  Expect(pResponse.text)
157
157
  .to.contain('50000px');
158
- libSuperTest('http://localhost:8080/')
158
+ libSuperTest('http://localhost:8099/')
159
159
  .get('content/')
160
160
  .end(
161
161
  function (pError, pResponse)
@@ -191,7 +191,7 @@ suite
191
191
 
192
192
  for(var i=0; i<DISTRIBUTION_LOAD_COUNT; i++)
193
193
  {
194
- libSuperTest('http://localhost:8080/')
194
+ libSuperTest('http://localhost:8099/')
195
195
  .get('GetPID')
196
196
  .end(
197
197
  function (pError, pResponse)
@@ -230,4 +230,4 @@ suite
230
230
  );
231
231
  }
232
232
  }
233
- );
233
+ );
@@ -40,6 +40,14 @@ suite
40
40
  }
41
41
  );
42
42
 
43
+ suiteTeardown
44
+ (
45
+ function()
46
+ {
47
+ _Orator.stopWebServer();
48
+ }
49
+ );
50
+
43
51
  suite
44
52
  (
45
53
  'Request Logging Server Start',
@@ -51,16 +59,25 @@ suite
51
59
  function(fDone)
52
60
  {
53
61
  _Orator.webServer.get (
54
- '/PINGOLo',
55
- function (pRequest, pResponse, fNext)
62
+ '/PINGOLo',
63
+ function (pRequest, pResponse, fNext)
56
64
  {
57
65
  pResponse.send('Loggo');
58
66
  fNext();
59
67
  }
60
68
  );
61
69
  _Orator.webServer.get (
62
- '/PINataGOLo',
63
- async function (pRequest, pResponse)
70
+ '/PINataGOLo',
71
+ function (pRequest, pResponse, fNext)
72
+ {
73
+ throw new Error("Something absolutely dire has occurred.");
74
+ pResponse.send('Loggso');
75
+ fNext();
76
+ }
77
+ );
78
+ _Orator.webServer.get (
79
+ '/PINataGOLo_promise',
80
+ async function (pRequest, pResponse)
64
81
  {
65
82
  return Promise.reject("Something absolutely dire has occurred.");
66
83
  }
@@ -93,6 +110,8 @@ suite
93
110
  }
94
111
  else
95
112
  {
113
+ Expect(pResponse.statusCode)
114
+ .to.equal(500);
96
115
  Expect(pResponse.text)
97
116
  .to.contain('dire');
98
117
  }
@@ -107,11 +126,38 @@ suite
107
126
  );
108
127
  test
109
128
  (
110
- 'rejected promises should throw properly.',
129
+ 'uncaught exceptions should throw properly.',
111
130
  function(fDone)
112
131
  {
113
132
  libSuperTest('http://localhost:8085/')
114
133
  .get('PINataGOLo')
134
+ .end(
135
+ function (pError, pResponse)
136
+ {
137
+ if (pError)
138
+ {
139
+ console.log('Error on Logfile Results: '+JSON.stringify(pError));
140
+ Expect('Logged Request Error').to.equal('Nothing');
141
+ }
142
+ else
143
+ {
144
+ Expect(pResponse.statusCode)
145
+ .to.equal(500);
146
+ Expect(pResponse.text)
147
+ .to.contain('dire');
148
+ }
149
+ fDone();
150
+ }
151
+ );
152
+ }
153
+ );
154
+ test
155
+ (
156
+ 'rejected promises should throw properly.',
157
+ function(fDone)
158
+ {
159
+ libSuperTest('http://localhost:8085/')
160
+ .get('PINataGOLo_promise')
115
161
  .end(
116
162
  function (pError, pResponse)
117
163
  {
@@ -133,4 +179,4 @@ suite
133
179
  }
134
180
  );
135
181
  }
136
- );
182
+ );
@@ -0,0 +1,4 @@
1
+ .content
2
+ {
3
+ font-size: 50000px;
4
+ }
@@ -0,0 +1 @@
1
+ <html><head></head><body>Um</body></html>
package/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- services:
2
- - mongodb
3
- language: node_js
4
- node_js:
5
- - "8"
6
- addons:
7
- code_climate:
8
- repo_token: 63ba2b0cf307133c314376df4b05fa8f0aa5e98919eb76488ad27a07f163cb77
9
- after_success:
10
- - npm run coverage
11
- after_script:
12
- - cat coverage/lcov.info | ./node_modules/codeclimate-test-reporter/bin/codeclimate.js
13
- - cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
14
- notifications:
15
- slack: paviateam:C1q99hL9XXpiPpau2PUrVZPC
package/Debug-Harness.js DELETED
@@ -1,24 +0,0 @@
1
- // Load the orator module with a few settings
2
- var libOrator = require(__dirname+'/source/Orator.js').new(
3
- {
4
- Product: 'MyMicroserviceHash',
5
- ProductVersion: '9.8.7',
6
-
7
- "APIServerPort": 8080
8
- });
9
-
10
- // Add an API endpoint
11
- libOrator.webServer.get
12
- (
13
- '/test/:hash',
14
- function(pRequest, pResponse, fNext)
15
- {
16
- // Send back whatever was sent as "name" in the URI
17
- pResponse.send(pRequest.params);
18
- libOrator.fable.log.info('WTF');
19
- return fNext();
20
- }
21
- );
22
-
23
- // Start the web service
24
- libOrator.startWebServer();
@@ -1,90 +0,0 @@
1
- /**
2
- * Unit tests for the Orator Server
3
- *
4
- * @license MIT
5
- *
6
- * @author Steven Velozo <steven@velozo.com>
7
- */
8
-
9
- var Chai = require("chai");
10
- var Expect = Chai.expect;
11
- var Assert = Chai.assert;
12
-
13
- var libSuperTest = require('supertest');
14
-
15
- var _MockSettings = (
16
- {
17
- Product: 'MockOratorCHROMENOTRACE',
18
- APIServerPort: 8083,
19
- Profiling: (
20
- {
21
- // Tracelog is just log-based request timing encapsulation.
22
- TraceLog: false,
23
-
24
- // These profiling settings determine if we generate cpu or call graphs
25
- Enabled: true,
26
- Folder: '/tmp/',
27
- // Currently supported profile types: CallGrinder or ChromeCPU
28
- Type: 'ChromeCPU'
29
- })
30
-
31
- });
32
-
33
- suite
34
- (
35
- 'Orator',
36
- function()
37
- {
38
- var _Orator;
39
-
40
- setup
41
- (
42
- function()
43
- {
44
- _Orator = require('../source/Orator.js').new(_MockSettings);
45
- }
46
- );
47
-
48
- suite
49
- (
50
- 'Alternate (chromecpu) without Trace Server Start',
51
- function()
52
- {
53
- test
54
- (
55
- 'simple routes should work',
56
- function(fDone)
57
- {
58
- _Orator.webServer.get (
59
- '/PI',
60
- function (pRequest, pResponse, fNext)
61
- {
62
- pResponse.send('PO');
63
- fNext();
64
- }
65
- );
66
- _Orator.startWebServer();
67
- libSuperTest('http://localhost:8083/')
68
- .get('PI')
69
- .end(
70
- function (pError, pResponse)
71
- {
72
- if (pError)
73
- {
74
- console.log('Error on Inverted Results: '+JSON.stringify(pError));
75
- Expect('No Trace Request Error').to.equal('Nothing');
76
- }
77
- else
78
- {
79
- Expect(pResponse.text)
80
- .to.contain('PO');
81
- }
82
- fDone();
83
- }
84
- );
85
- }
86
- );
87
- }
88
- );
89
- }
90
- );
@@ -1,95 +0,0 @@
1
- /**
2
- * Unit tests for the Orator Server
3
- *
4
- * @license MIT
5
- *
6
- * @author Steven Velozo <steven@velozo.com>
7
- */
8
-
9
- var Chai = require("chai");
10
- var Expect = Chai.expect;
11
- var Assert = Chai.assert;
12
-
13
- var libSuperTest = require('supertest');
14
-
15
- var _MockSettings = (
16
- {
17
- Product: 'MockOratorCHROME',
18
- APIServerPort: 8081,
19
- Profiling: (
20
- {
21
- // Tracelog is just log-based request timing encapsulation.
22
- TraceLog: true,
23
-
24
- // These profiling settings determine if we generate cpu or call graphs
25
- Enabled: true,
26
- Folder: '/tmp/',
27
- // Currently supported profile types: CallGrinder or ChromeCPU
28
- Type: 'ChromeCPU'
29
- })
30
-
31
- });
32
-
33
- suite
34
- (
35
- 'Orator',
36
- function()
37
- {
38
- var _Orator;
39
-
40
- setup
41
- (
42
- function()
43
- {
44
- _Orator = require('../source/Orator.js').new(_MockSettings);
45
- }
46
- );
47
-
48
- suite
49
- (
50
- 'Alternate (chromecpu) Server Start',
51
- function()
52
- {
53
- test
54
- (
55
- 'simple routes should work',
56
- function(fDone)
57
- {
58
- _Orator.webServer.get (
59
- '/PINGO',
60
- function (pRequest, pResponse, fNext)
61
- {
62
- let tmpMemory = false;
63
- for (var i = 0; i < 1000; i++)
64
- {
65
- tmpMemory = process.memoryUsage();
66
- }
67
- pResponse.send('PONGO');
68
- fNext();
69
- }
70
- );
71
- _Orator.startWebServer();
72
- libSuperTest('http://localhost:8081/')
73
- .get('PINGO')
74
- .end(
75
- function (pError, pResponse)
76
- {
77
- if (pError)
78
- {
79
- console.log('Error on Inverted Results: '+JSON.stringify(pError));
80
- Expect('Chrome Trace Request Error').to.equal('Nothing');
81
- }
82
- else
83
- {
84
- Expect(pResponse.text)
85
- .to.contain('PONGO');
86
- }
87
- fDone();
88
- }
89
- );
90
- }
91
- );
92
- }
93
- );
94
- }
95
- );