@alt-javascript/boot-camel-lite-extras-starter 1.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.
- package/README.md +45 -0
- package/index.js +70 -0
- package/package.json +50 -0
- package/src/CamelLiteExtrasAutoConfiguration.js +92 -0
- package/test/extras.test.js +189 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# boot-camel-lite-extras-starter
|
|
2
|
+
|
|
3
|
+
Extends `boot-camel-lite-starter` with CDI auto-configuration for the four broker-backed and coordination components: `amqp`, `sql`, `nosql` (MongoDB), and `master` (leader election).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install boot-camel-lite-extras-starter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`boot-camel-lite-starter` is a peer dependency and must be installed alongside it.
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
All keys are nested under `boot.camel-lite`. Each extra component can be individually disabled.
|
|
16
|
+
|
|
17
|
+
| Key | Type | Default | Description |
|
|
18
|
+
|-----|------|---------|-------------|
|
|
19
|
+
| `boot.camel-lite.amqp.enabled` | boolean | `true` | Register the `amqp:` component bean |
|
|
20
|
+
| `boot.camel-lite.sql.enabled` | boolean | `true` | Register the `sql:` component bean |
|
|
21
|
+
| `boot.camel-lite.nosql.enabled` | boolean | `true` | Register the `nosql:` component bean |
|
|
22
|
+
| `boot.camel-lite.master.enabled` | boolean | `true` | Register the `master:` component bean |
|
|
23
|
+
|
|
24
|
+
> **Note:** All component connection parameters (broker URLs, database URIs, backend selection, credentials) are URI-level options — not boot config level. For example: `amqp://myqueue?connectionUrl=amqp://localhost:5672`, `sql:query?dataSourceUrl=...`, `nosql:collection?uri=mongodb://localhost`. See each component's README for full URI option reference.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { camelLiteExtrasStarter } from 'boot-camel-lite-extras-starter';
|
|
30
|
+
|
|
31
|
+
const { applicationContext } = await camelLiteExtrasStarter({ config: cfg });
|
|
32
|
+
|
|
33
|
+
const ctx = applicationContext.get('camelLiteContext');
|
|
34
|
+
await ctx.ready();
|
|
35
|
+
|
|
36
|
+
const pt = applicationContext.get('camelProducerTemplate');
|
|
37
|
+
await pt.sendBody('direct:start', { event: 'hello' });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The entry function `camelLiteExtrasStarter(options)` initialises both the core starter beans and the extras component beans in a single pass.
|
|
41
|
+
|
|
42
|
+
## See Also
|
|
43
|
+
|
|
44
|
+
- [camel-lite root README](../../README.md)
|
|
45
|
+
- [boot-camel-lite-starter README](../boot-camel-lite-starter/README.md)
|
package/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* boot-camel-lite-extras-starter
|
|
3
|
+
*
|
|
4
|
+
* CDI auto-configuration for camel-lite extras: amqp, sql, nosql, master.
|
|
5
|
+
* Extends boot-camel-lite-starter (core + direct/seda/log/file/http/ftp/timer/cron).
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { camelLiteExtrasStarter } from '@alt-javascript/boot-camel-lite-extras-starter';
|
|
9
|
+
*
|
|
10
|
+
* const { applicationContext } = await camelLiteExtrasStarter({
|
|
11
|
+
* config: new EphemeralConfig({
|
|
12
|
+
* boot: {
|
|
13
|
+
* 'camel-lite': {
|
|
14
|
+
* nosql: { enabled: true },
|
|
15
|
+
* routes: [{
|
|
16
|
+
* definition: { route: { from: { uri: 'nosql:myCollection?url=jsnosqlc:memory:', steps: [] } } }
|
|
17
|
+
* }]
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* })
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* Config keys:
|
|
24
|
+
* boot.camel-lite.amqp.enabled — enable AMQP component (default: true)
|
|
25
|
+
* boot.camel-lite.sql.enabled — enable SQL component (default: true)
|
|
26
|
+
* boot.camel-lite.nosql.enabled — enable NoSQL component (default: true)
|
|
27
|
+
* boot.camel-lite.master.enabled — enable master: leader election (default: true)
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { ApplicationContext } from '@alt-javascript/cdi';
|
|
31
|
+
import { EphemeralConfig } from '@alt-javascript/config';
|
|
32
|
+
import {
|
|
33
|
+
camelLiteAutoConfiguration,
|
|
34
|
+
} from '@alt-javascript/boot-camel-lite-starter';
|
|
35
|
+
import {
|
|
36
|
+
camelLiteExtrasAutoConfiguration,
|
|
37
|
+
} from './src/CamelLiteExtrasAutoConfiguration.js';
|
|
38
|
+
|
|
39
|
+
export { camelLiteExtrasAutoConfiguration };
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Boot the application with camel-lite core + extras auto-configuration.
|
|
43
|
+
*
|
|
44
|
+
* @param {object} options
|
|
45
|
+
* @param {Array} [options.contexts] — CDI Context array (your beans)
|
|
46
|
+
* @param {object} [options.config] — config object or POJO
|
|
47
|
+
* @param {object} [options.startOptions] — forwarded to ApplicationContext.start()
|
|
48
|
+
* @returns {Promise<{applicationContext: ApplicationContext}>}
|
|
49
|
+
*/
|
|
50
|
+
export async function camelLiteExtrasStarter(options = {}) {
|
|
51
|
+
const { contexts = [], config, startOptions = {} } = options;
|
|
52
|
+
|
|
53
|
+
const cfg = config instanceof Object && typeof config.has === 'function'
|
|
54
|
+
? config
|
|
55
|
+
: new EphemeralConfig(config ?? {});
|
|
56
|
+
|
|
57
|
+
const [coreConfig, extrasConfig] = await Promise.all([
|
|
58
|
+
camelLiteAutoConfiguration(options),
|
|
59
|
+
camelLiteExtrasAutoConfiguration(options),
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
const applicationContext = new ApplicationContext({
|
|
63
|
+
config: cfg,
|
|
64
|
+
contexts: [...contexts, coreConfig, extrasConfig],
|
|
65
|
+
...startOptions,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
await applicationContext.start();
|
|
69
|
+
return { applicationContext };
|
|
70
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alt-javascript/boot-camel-lite-extras-starter",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@alt-javascript/boot": "^3.0.7",
|
|
10
|
+
"@alt-javascript/cdi": "^3.0.7",
|
|
11
|
+
"@alt-javascript/config": "^3.0.7",
|
|
12
|
+
"@alt-javascript/logger": "^3.0.7",
|
|
13
|
+
"@alt-javascript/common": "^3.0.7",
|
|
14
|
+
"@alt-javascript/boot-camel-lite-starter": "1.0.2",
|
|
15
|
+
"@alt-javascript/camel-lite-core": "1.0.2",
|
|
16
|
+
"@alt-javascript/camel-lite-component-amqp": "1.0.2",
|
|
17
|
+
"@alt-javascript/camel-lite-component-sql": "1.0.2",
|
|
18
|
+
"@alt-javascript/camel-lite-component-nosql": "1.0.2",
|
|
19
|
+
"@alt-javascript/camel-lite-component-master": "1.0.2"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "node --test"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/alt-javascript/camel-lite"
|
|
27
|
+
},
|
|
28
|
+
"author": "Craig Parravicini",
|
|
29
|
+
"contributors": [
|
|
30
|
+
"Claude (Anthropic)",
|
|
31
|
+
"Apache Camel — design inspiration and pattern source"
|
|
32
|
+
],
|
|
33
|
+
"keywords": [
|
|
34
|
+
"alt-javascript",
|
|
35
|
+
"camel",
|
|
36
|
+
"camel-lite",
|
|
37
|
+
"eai",
|
|
38
|
+
"eip",
|
|
39
|
+
"integration",
|
|
40
|
+
"boot",
|
|
41
|
+
"starter",
|
|
42
|
+
"cdi",
|
|
43
|
+
"dependency-injection",
|
|
44
|
+
"autoconfigure"
|
|
45
|
+
],
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/",
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CamelLiteExtrasAutoConfiguration — CDI auto-configuration for camel-lite extras.
|
|
3
|
+
*
|
|
4
|
+
* Extends boot-camel-lite-starter with four additional component auto-configurations:
|
|
5
|
+
* amqp: camelComponent.amqp — boot.camel-lite.amqp.enabled (default: true)
|
|
6
|
+
* sql: camelComponent.sql — boot.camel-lite.sql.enabled (default: true)
|
|
7
|
+
* nosql: camelComponent.nosql — boot.camel-lite.nosql.enabled (default: true)
|
|
8
|
+
* master: camelComponent.master — boot.camel-lite.master.enabled (default: true)
|
|
9
|
+
*
|
|
10
|
+
* Config keys:
|
|
11
|
+
* boot.camel-lite.amqp.enabled — enable AMQP component (default: true)
|
|
12
|
+
* boot.camel-lite.sql.enabled — enable SQL component (default: true)
|
|
13
|
+
* boot.camel-lite.nosql.enabled — enable NoSQL component (default: true)
|
|
14
|
+
* boot.camel-lite.master.enabled — enable master: leader election component (default: true)
|
|
15
|
+
*
|
|
16
|
+
* All component-level parameters (connection URLs, backend selection, etc.) are
|
|
17
|
+
* specified per-route in the URI, not at component registration time.
|
|
18
|
+
* The components themselves are stateless at construction — state lives in
|
|
19
|
+
* endpoints and consumers.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { LoggerFactory } from '@alt-javascript/logger';
|
|
23
|
+
import { PREFIX } from '@alt-javascript/boot-camel-lite-starter';
|
|
24
|
+
|
|
25
|
+
const log = LoggerFactory.getLogger('@alt-javascript/camel-lite/boot/CamelLiteExtrasAutoConfiguration');
|
|
26
|
+
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Generic wrapper factory (same pattern as boot-camel-lite-starter)
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
function makeComponentClass(scheme, ComponentClass) {
|
|
32
|
+
class ConfiguredComponent {
|
|
33
|
+
constructor() {
|
|
34
|
+
this._component = new ComponentClass();
|
|
35
|
+
}
|
|
36
|
+
getComponent() { return this._component; }
|
|
37
|
+
}
|
|
38
|
+
Object.defineProperty(ConfiguredComponent, 'name', { value: `CamelExtrasComponent_${scheme}` });
|
|
39
|
+
return ConfiguredComponent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function isEnabled(config, scheme) {
|
|
43
|
+
const key = `${PREFIX}.${scheme}.enabled`;
|
|
44
|
+
if (config.has(key)) {
|
|
45
|
+
const val = config.get(key);
|
|
46
|
+
return val !== false && val !== 'false';
|
|
47
|
+
}
|
|
48
|
+
return true; // enabled by default
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Extras component definitions
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
const EXTRAS_SCHEMES = ['amqp', 'sql', 'nosql', 'master'];
|
|
56
|
+
|
|
57
|
+
const EXTRAS_IMPORTS = {
|
|
58
|
+
amqp: () => import('@alt-javascript/camel-lite-component-amqp').then(m => m.AmqpComponent),
|
|
59
|
+
sql: () => import('@alt-javascript/camel-lite-component-sql').then(m => m.SqlComponent),
|
|
60
|
+
nosql: () => import('@alt-javascript/camel-lite-component-nosql').then(m => m.NosqlComponent),
|
|
61
|
+
master: () => import('@alt-javascript/camel-lite-component-master').then(m => m.MasterComponent),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns CDI component definitions for the extras camel-lite components.
|
|
66
|
+
* These are merged with camelLiteAutoConfiguration() by camelLiteExtrasStarter().
|
|
67
|
+
*
|
|
68
|
+
* @param {object} [options]
|
|
69
|
+
* @param {string[]} [options.schemes] — override extras scheme list
|
|
70
|
+
* @returns {Promise<Array>} CDI component definition array
|
|
71
|
+
*/
|
|
72
|
+
export async function camelLiteExtrasAutoConfiguration(options = {}) {
|
|
73
|
+
const schemes = options.schemes ?? EXTRAS_SCHEMES;
|
|
74
|
+
const defs = [];
|
|
75
|
+
|
|
76
|
+
for (const scheme of schemes) {
|
|
77
|
+
const beanName = `camelComponent.${scheme}`;
|
|
78
|
+
const ComponentClass = await EXTRAS_IMPORTS[scheme]();
|
|
79
|
+
const ConfiguredComponent = makeComponentClass(scheme, ComponentClass);
|
|
80
|
+
|
|
81
|
+
defs.push({
|
|
82
|
+
name: beanName,
|
|
83
|
+
Reference: ConfiguredComponent,
|
|
84
|
+
scope: 'singleton',
|
|
85
|
+
condition: (config) => isEnabled(config, scheme),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
log.debug(`CamelLiteExtrasAutoConfiguration: registered definition for '${scheme}'`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return defs;
|
|
92
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { describe, it, after } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { EphemeralConfig } from '@alt-javascript/config';
|
|
4
|
+
import { camelLiteExtrasStarter, camelLiteExtrasAutoConfiguration } from '../index.js';
|
|
5
|
+
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
// Helpers
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
const contexts = [];
|
|
11
|
+
|
|
12
|
+
async function bootExtras(config = {}) {
|
|
13
|
+
const cfg = new EphemeralConfig(config);
|
|
14
|
+
const { applicationContext } = await camelLiteExtrasStarter({ config: cfg });
|
|
15
|
+
contexts.push(applicationContext);
|
|
16
|
+
return applicationContext;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
after(async () => {
|
|
20
|
+
for (const ctx of contexts) {
|
|
21
|
+
try {
|
|
22
|
+
const c = ctx.get('camelLiteContext');
|
|
23
|
+
await c.camelContext?.stop();
|
|
24
|
+
} catch { /* ignore */ }
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// 1. Auto-configuration shape
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
describe('camelLiteExtrasAutoConfiguration: shape', () => {
|
|
33
|
+
it('returns definitions for all four extras components', async () => {
|
|
34
|
+
const defs = await camelLiteExtrasAutoConfiguration();
|
|
35
|
+
const names = defs.map(d => d.name);
|
|
36
|
+
assert.ok(names.includes('camelComponent.amqp'));
|
|
37
|
+
assert.ok(names.includes('camelComponent.sql'));
|
|
38
|
+
assert.ok(names.includes('camelComponent.nosql'));
|
|
39
|
+
assert.ok(names.includes('camelComponent.master'));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('each definition has a condition function', async () => {
|
|
43
|
+
const defs = await camelLiteExtrasAutoConfiguration();
|
|
44
|
+
for (const def of defs) {
|
|
45
|
+
assert.equal(typeof def.condition, 'function', `${def.name} should have a condition`);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('condition returns true when enabled flag absent (default on)', async () => {
|
|
50
|
+
const defs = await camelLiteExtrasAutoConfiguration();
|
|
51
|
+
const cfg = new EphemeralConfig({});
|
|
52
|
+
for (const def of defs) {
|
|
53
|
+
assert.equal(def.condition(cfg), true, `${def.name} should be enabled by default`);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('condition returns false when enabled=false', async () => {
|
|
58
|
+
const defs = await camelLiteExtrasAutoConfiguration();
|
|
59
|
+
for (const def of defs) {
|
|
60
|
+
const scheme = def.name.replace('camelComponent.', '');
|
|
61
|
+
const cfg = new EphemeralConfig({ boot: { 'camel-lite': { [scheme]: { enabled: false } } } });
|
|
62
|
+
assert.equal(def.condition(cfg), false, `${def.name} should be disabled`);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
// 2. Boot lifecycle with extras
|
|
69
|
+
// ---------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
describe('camelLiteExtrasStarter: boot lifecycle', () => {
|
|
72
|
+
it('boots ApplicationContext without throwing', async () => {
|
|
73
|
+
const appCtx = await bootExtras({});
|
|
74
|
+
assert.ok(appCtx);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('CamelContext is started after ready()', async () => {
|
|
78
|
+
const appCtx = await bootExtras({});
|
|
79
|
+
const ctx = appCtx.get('camelLiteContext');
|
|
80
|
+
await ctx.ready();
|
|
81
|
+
assert.equal(ctx.camelContext.started, true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('all extras components registered by default', async () => {
|
|
85
|
+
const appCtx = await bootExtras({});
|
|
86
|
+
const ctx = appCtx.get('camelLiteContext');
|
|
87
|
+
await ctx.ready();
|
|
88
|
+
const cc = ctx.camelContext;
|
|
89
|
+
assert.ok(cc.getComponent('amqp'), 'amqp component should be registered');
|
|
90
|
+
assert.ok(cc.getComponent('sql'), 'sql component should be registered');
|
|
91
|
+
assert.ok(cc.getComponent('nosql'), 'nosql component should be registered');
|
|
92
|
+
assert.ok(cc.getComponent('master'), 'master component should be registered');
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// 3. Per-component enable/disable
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
describe('extras components enable/disable', () => {
|
|
101
|
+
it('nosql: absent when boot.camel-lite.nosql.enabled=false', async () => {
|
|
102
|
+
const cfg = new EphemeralConfig({
|
|
103
|
+
boot: { 'camel-lite': { nosql: { enabled: false } } }
|
|
104
|
+
});
|
|
105
|
+
const { applicationContext } = await camelLiteExtrasStarter({ config: cfg });
|
|
106
|
+
contexts.push(applicationContext);
|
|
107
|
+
const ctx = applicationContext.get('camelLiteContext');
|
|
108
|
+
await ctx.ready();
|
|
109
|
+
assert.equal(ctx.camelContext.getComponent('nosql'), undefined);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('master: absent when boot.camel-lite.master.enabled=false', async () => {
|
|
113
|
+
const cfg = new EphemeralConfig({
|
|
114
|
+
boot: { 'camel-lite': { master: { enabled: false } } }
|
|
115
|
+
});
|
|
116
|
+
const { applicationContext } = await camelLiteExtrasStarter({ config: cfg });
|
|
117
|
+
contexts.push(applicationContext);
|
|
118
|
+
const ctx = applicationContext.get('camelLiteContext');
|
|
119
|
+
await ctx.ready();
|
|
120
|
+
assert.equal(ctx.camelContext.getComponent('master'), undefined);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// ---------------------------------------------------------------------------
|
|
125
|
+
// 4. Functional integration: nosql: via config route
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
describe('nosql: component functional with in-memory route', () => {
|
|
129
|
+
it('nosql: component usable in a route with jsnosqlc:memory:', async () => {
|
|
130
|
+
// Register the in-memory driver before using nosql:
|
|
131
|
+
await import('@alt-javascript/jsnosqlc-memory');
|
|
132
|
+
|
|
133
|
+
const cfg = new EphemeralConfig({
|
|
134
|
+
boot: {
|
|
135
|
+
'camel-lite': {
|
|
136
|
+
routes: [{
|
|
137
|
+
definition: {
|
|
138
|
+
route: {
|
|
139
|
+
from: {
|
|
140
|
+
uri: 'direct:nosql-test',
|
|
141
|
+
steps: [{
|
|
142
|
+
to: 'nosql:items?url=jsnosqlc:memory:&operation=insert'
|
|
143
|
+
}]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const { applicationContext } = await camelLiteExtrasStarter({ config: cfg });
|
|
153
|
+
contexts.push(applicationContext);
|
|
154
|
+
const clCtx = applicationContext.get('camelLiteContext');
|
|
155
|
+
await clCtx.ready();
|
|
156
|
+
|
|
157
|
+
const pt = applicationContext.get('camelProducerTemplate');
|
|
158
|
+
const exchange = await pt.sendBody('direct:nosql-test', { name: 'test' });
|
|
159
|
+
// insert may succeed or fail gracefully depending on nosql: component impl
|
|
160
|
+
// primary assertion: no crash, exchange is returned
|
|
161
|
+
assert.ok(exchange !== null);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// ---------------------------------------------------------------------------
|
|
166
|
+
// 5. master: component functional with file backend
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
describe('master: component functional via config route', () => {
|
|
170
|
+
it('master: component registers in CamelContext', async () => {
|
|
171
|
+
const appCtx = await bootExtras({});
|
|
172
|
+
const ctx = appCtx.get('camelLiteContext');
|
|
173
|
+
await ctx.ready();
|
|
174
|
+
assert.ok(ctx.camelContext.getComponent('master'));
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
// 6. sql: component registers
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
|
|
182
|
+
describe('sql: component functional', () => {
|
|
183
|
+
it('sql: component registers in CamelContext', async () => {
|
|
184
|
+
const appCtx = await bootExtras({});
|
|
185
|
+
const ctx = appCtx.get('camelLiteContext');
|
|
186
|
+
await ctx.ready();
|
|
187
|
+
assert.ok(ctx.camelContext.getComponent('sql'));
|
|
188
|
+
});
|
|
189
|
+
});
|