karavan-core 4.8.0 → 99.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of karavan-core might be problematic. Click here for more details.
- package/index.js +3 -0
- package/package.json +8 -58
- package/.bebelrc +0 -3
- package/.mocharc.json +0 -11
- package/.prettierignore +0 -9
- package/.prettierrc +0 -14
- package/src/core/api/CamelDefinitionApi.ts +0 -3271
- package/src/core/api/CamelDefinitionApiExt.ts +0 -757
- package/src/core/api/CamelDefinitionYaml.ts +0 -412
- package/src/core/api/CamelDefinitionYamlStep.ts +0 -4733
- package/src/core/api/CamelDisplayUtil.ts +0 -143
- package/src/core/api/CamelUtil.ts +0 -360
- package/src/core/api/ComponentApi.ts +0 -368
- package/src/core/api/KameletApi.ts +0 -147
- package/src/core/api/MainConfigurationApi.ts +0 -47
- package/src/core/api/ProjectModelApi.ts +0 -75
- package/src/core/api/SpiBeanApi.ts +0 -104
- package/src/core/api/TemplateApi.ts +0 -58
- package/src/core/api/TopologyUtils.ts +0 -392
- package/src/core/api/VariableUtil.ts +0 -104
- package/src/core/model/CamelDefinition.ts +0 -3783
- package/src/core/model/CamelMetadata.ts +0 -2714
- package/src/core/model/ComponentModels.ts +0 -106
- package/src/core/model/IntegrationDefinition.ts +0 -188
- package/src/core/model/KameletModels.ts +0 -223
- package/src/core/model/MainConfigurationModel.ts +0 -37
- package/src/core/model/ProjectModel.ts +0 -43
- package/src/core/model/SpiBeanModels.ts +0 -53
- package/src/core/model/TopologyDefinition.ts +0 -117
- package/test/addStep.spec.ts +0 -124
- package/test/addStep1.yaml +0 -27
- package/test/allowableValues.camel.yaml +0 -19
- package/test/allowableValues.spec.ts +0 -30
- package/test/avro-serialize-action.kamelet.yaml +0 -70
- package/test/beans.spec.ts +0 -92
- package/test/beans1.yaml +0 -36
- package/test/beans2.yaml +0 -42
- package/test/beans3.yaml +0 -7
- package/test/checkRequired.spec.ts +0 -53
- package/test/circuitBreaker.spec.ts +0 -57
- package/test/circuitBreaker.yaml +0 -19
- package/test/cloneDefinition.spec.ts +0 -106
- package/test/createKamelet.spec.ts +0 -38
- package/test/cxf.json +0 -615
- package/test/cxf.spec.ts +0 -44
- package/test/cxf.yaml +0 -15
- package/test/deleteStep.spec.ts +0 -74
- package/test/demo.spec.ts +0 -49
- package/test/demo.yaml +0 -32
- package/test/doCatchOnWhen.camel.yaml +0 -20
- package/test/doCatchOnWhen.spec.ts +0 -36
- package/test/errorHandler.spec.ts +0 -38
- package/test/errorHandler1.yaml +0 -27
- package/test/expression.spec.ts +0 -55
- package/test/findStep.spec.ts +0 -112
- package/test/findStep.yaml +0 -65
- package/test/getElementProperties.spec.ts +0 -32
- package/test/getElementPropertiesByName.spec.ts +0 -31
- package/test/getExpressionLanguage.spec.ts +0 -40
- package/test/hasElementWithId.camel.yaml +0 -98
- package/test/hasElementWithId.spec.ts +0 -57
- package/test/hasElementWithId1.camel.yaml +0 -16
- package/test/hasElementWithIdError.camel.yaml +0 -98
- package/test/integration.spec.ts +0 -60
- package/test/integration1.yaml +0 -24
- package/test/integration2.yaml +0 -23
- package/test/integrationToYaml.spec.ts +0 -51
- package/test/intercept.spec.ts +0 -62
- package/test/intercept.yaml +0 -19
- package/test/is-not-integration.yaml +0 -5114
- package/test/isIntegration.spec.ts +0 -45
- package/test/kamelet.spec.ts +0 -61
- package/test/metadata/components.json +0 -697
- package/test/metadata/kamelets.yaml +0 -23414
- package/test/metadata/spiBeans.json +0 -3094
- package/test/multiObjectProperties.spec.ts +0 -46
- package/test/multiObjectProperties1.yaml +0 -19
- package/test/multiple.spec.ts +0 -38
- package/test/multiple.yaml +0 -29
- package/test/openapi.spec.ts +0 -48
- package/test/openapi.yaml +0 -7
- package/test/placeholder.spec.ts +0 -32
- package/test/placeholder.yaml +0 -133
- package/test/plain-try-catch.yaml +0 -31
- package/test/plain.spec.ts +0 -72
- package/test/plain1.yaml +0 -22
- package/test/plain2.yaml +0 -13
- package/test/plain3.yaml +0 -5
- package/test/plain4.yaml +0 -5
- package/test/postgresql-source.kamelet.yaml +0 -113
- package/test/restConfigDsl.yaml +0 -15
- package/test/restDsl.spec.ts +0 -83
- package/test/restDsl.yaml +0 -29
- package/test/routes.spec.ts +0 -37
- package/test/routes1.yaml +0 -31
- package/test/supported-components.json +0 -1221
- package/test/supportedComponents.spec.ts +0 -34
- package/test/template1.AggregationStrategy.java +0 -21
- package/test/template1.Processor.java +0 -13
- package/test/template2.AggregationStrategy.java +0 -21
- package/test/template2.Processor.java +0 -13
- package/test/templateApi.spec.ts +0 -45
- package/test/timer-source.kamelet.yaml +0 -75
- package/test/tod.spec.ts +0 -31
- package/test/tod.yaml +0 -9
- package/test/topology.spec.ts +0 -51
- package/test/topology1.camel.yaml +0 -56
- package/test/topology2.camel.yaml +0 -44
- package/test/topology3.camel.yaml +0 -27
- package/test/tsconfig.testing.json +0 -14
- package/test/updateStep.spec.ts +0 -72
- package/test/variable1.camel.yaml +0 -42
- package/test/variable2.camel.yaml +0 -42
- package/test/variables.spec.ts +0 -34
- package/tsconfig.json +0 -34
@@ -1,98 +0,0 @@
|
|
1
|
-
- rest:
|
2
|
-
id: rest-328e
|
3
|
-
description: >-
|
4
|
-
It has a broken design for long endpoint descriptions and a dual topology
|
5
|
-
view rendering
|
6
|
-
get:
|
7
|
-
- id: get-5ab7
|
8
|
-
to: direct:hello
|
9
|
-
- route:
|
10
|
-
id: route-0dc7
|
11
|
-
description: Audit Start
|
12
|
-
nodePrefixId: route-972
|
13
|
-
from:
|
14
|
-
id: from-846a
|
15
|
-
description: Audit Start
|
16
|
-
uri: direct
|
17
|
-
parameters:
|
18
|
-
name: start
|
19
|
-
steps:
|
20
|
-
- to:
|
21
|
-
id: to-3597
|
22
|
-
uri: kafka
|
23
|
-
parameters:
|
24
|
-
topic: audit
|
25
|
-
- route:
|
26
|
-
id: route-a54e
|
27
|
-
description: Audit Finish
|
28
|
-
nodePrefixId: route-1d1
|
29
|
-
from:
|
30
|
-
id: from-47d5
|
31
|
-
description: Audit Finish
|
32
|
-
uri: direct
|
33
|
-
parameters:
|
34
|
-
name: finish
|
35
|
-
steps:
|
36
|
-
- to:
|
37
|
-
id: to-3cf2
|
38
|
-
uri: kafka
|
39
|
-
parameters:
|
40
|
-
topic: audit
|
41
|
-
- route:
|
42
|
-
id: route-07ed
|
43
|
-
description: Audit Step
|
44
|
-
nodePrefixId: route-833
|
45
|
-
from:
|
46
|
-
id: from-e007
|
47
|
-
uri: direct
|
48
|
-
parameters:
|
49
|
-
name: step
|
50
|
-
steps:
|
51
|
-
- to:
|
52
|
-
id: to-fa9e
|
53
|
-
uri: kafka
|
54
|
-
parameters:
|
55
|
-
topic: audit
|
56
|
-
- route:
|
57
|
-
id: hello
|
58
|
-
from:
|
59
|
-
id: from-3f49
|
60
|
-
uri: direct
|
61
|
-
parameters:
|
62
|
-
name: hello
|
63
|
-
steps:
|
64
|
-
- to:
|
65
|
-
id: to-428d
|
66
|
-
uri: activemq
|
67
|
-
- to:
|
68
|
-
id: to-fed7
|
69
|
-
uri: kafka
|
70
|
-
- routeConfiguration:
|
71
|
-
id: auditedRoute
|
72
|
-
intercept:
|
73
|
-
- intercept:
|
74
|
-
id: intercept-0deb
|
75
|
-
steps:
|
76
|
-
- to:
|
77
|
-
id: to-b470
|
78
|
-
uri: direct
|
79
|
-
parameters:
|
80
|
-
name: step
|
81
|
-
interceptFrom:
|
82
|
-
- interceptFrom:
|
83
|
-
id: interceptFrom-4041
|
84
|
-
steps:
|
85
|
-
- to:
|
86
|
-
id: to-6861
|
87
|
-
uri: direct
|
88
|
-
parameters:
|
89
|
-
name: start
|
90
|
-
onCompletion:
|
91
|
-
- onCompletion:
|
92
|
-
id: onCompletion-3dab
|
93
|
-
steps:
|
94
|
-
- to:
|
95
|
-
id: to-dd4e
|
96
|
-
uri: direct
|
97
|
-
parameters:
|
98
|
-
name: finish
|
@@ -1,57 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
* contributor license agreements. See the NOTICE file distributed with
|
4
|
-
* this work for additional information regarding copyright ownership.
|
5
|
-
* The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
* (the "License"); you may not use this file except in compliance with
|
7
|
-
* the License. You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import {expect} from 'chai';
|
18
|
-
import 'mocha';
|
19
|
-
import {
|
20
|
-
FromDefinition,
|
21
|
-
LogDefinition,
|
22
|
-
WhenDefinition,
|
23
|
-
ChoiceDefinition,
|
24
|
-
MulticastDefinition,
|
25
|
-
ExpressionDefinition,
|
26
|
-
RouteDefinition, TryDefinition,CatchDefinition
|
27
|
-
} from "../src/core/model/CamelDefinition";
|
28
|
-
import {CamelDefinitionApiExt} from "../src/core/api/CamelDefinitionApiExt";
|
29
|
-
import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
|
30
|
-
import {SimpleExpression} from "../src/core/model/CamelDefinition";
|
31
|
-
import {Integration} from "../src/core/model/IntegrationDefinition";
|
32
|
-
import * as fs from 'fs';
|
33
|
-
|
34
|
-
describe('Check for id duplicates', () => {
|
35
|
-
|
36
|
-
it('Check YAML OK', () => {
|
37
|
-
const yaml = fs.readFileSync('test/hasElementWithId.camel.yaml',{encoding:'utf8', flag:'r'});
|
38
|
-
const i1 = CamelDefinitionYaml.yamlToIntegration("hasElementWithId.camel.yaml", yaml);
|
39
|
-
|
40
|
-
expect(CamelDefinitionApiExt.hasElementWithId(i1, 'from-47d5')).to.equal(1);
|
41
|
-
});
|
42
|
-
|
43
|
-
it('Check YAML OK', () => {
|
44
|
-
const yaml = fs.readFileSync('test/hasElementWithId1.camel.yaml',{encoding:'utf8', flag:'r'});
|
45
|
-
const i1 = CamelDefinitionYaml.yamlToIntegration("hasElementWithId.camel.yaml", yaml);
|
46
|
-
|
47
|
-
expect(CamelDefinitionApiExt.hasElementWithId(i1, 'fhello-world')).to.equal(2);
|
48
|
-
});
|
49
|
-
|
50
|
-
it('Check YAML Error', () => {
|
51
|
-
const yaml = fs.readFileSync('test/hasElementWithIdError.camel.yaml', { encoding: 'utf8', flag: 'r' });
|
52
|
-
const i1 = CamelDefinitionYaml.yamlToIntegration('hasElementWithId.camel.yaml', yaml);
|
53
|
-
|
54
|
-
expect(CamelDefinitionApiExt.hasElementWithId(i1, 'from-47d5')).to.equal(2);
|
55
|
-
});
|
56
|
-
|
57
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-0dc7
|
3
|
-
description: Audit Start
|
4
|
-
nodePrefixId: route-972
|
5
|
-
from:
|
6
|
-
id: fhello-world
|
7
|
-
description: Audit Start
|
8
|
-
uri: direct
|
9
|
-
parameters:
|
10
|
-
name: start
|
11
|
-
steps:
|
12
|
-
- to:
|
13
|
-
id: fhello-world
|
14
|
-
uri: kafka
|
15
|
-
parameters:
|
16
|
-
topic: audit
|
@@ -1,98 +0,0 @@
|
|
1
|
-
- rest:
|
2
|
-
id: rest-328e
|
3
|
-
description: >-
|
4
|
-
It has a broken design for long endpoint descriptions and a dual topology
|
5
|
-
view rendering
|
6
|
-
get:
|
7
|
-
- id: get-5ab7
|
8
|
-
to: direct:hello
|
9
|
-
- route:
|
10
|
-
id: route-0dc7
|
11
|
-
description: Audit Start
|
12
|
-
nodePrefixId: route-972
|
13
|
-
from:
|
14
|
-
id: from-47d5
|
15
|
-
description: Audit Start
|
16
|
-
uri: direct
|
17
|
-
parameters:
|
18
|
-
name: start
|
19
|
-
steps:
|
20
|
-
- to:
|
21
|
-
id: to-3597
|
22
|
-
uri: kafka
|
23
|
-
parameters:
|
24
|
-
topic: audit
|
25
|
-
- route:
|
26
|
-
id: route-a54e
|
27
|
-
description: Audit Finish
|
28
|
-
nodePrefixId: route-1d1
|
29
|
-
from:
|
30
|
-
id: from-47d5
|
31
|
-
description: Audit Finish
|
32
|
-
uri: direct
|
33
|
-
parameters:
|
34
|
-
name: finish
|
35
|
-
steps:
|
36
|
-
- to:
|
37
|
-
id: to-3cf2
|
38
|
-
uri: kafka
|
39
|
-
parameters:
|
40
|
-
topic: audit
|
41
|
-
- route:
|
42
|
-
id: route-07ed
|
43
|
-
description: Audit Step
|
44
|
-
nodePrefixId: route-833
|
45
|
-
from:
|
46
|
-
id: from-e007
|
47
|
-
uri: direct
|
48
|
-
parameters:
|
49
|
-
name: step
|
50
|
-
steps:
|
51
|
-
- to:
|
52
|
-
id: to-fa9e
|
53
|
-
uri: kafka
|
54
|
-
parameters:
|
55
|
-
topic: audit
|
56
|
-
- route:
|
57
|
-
id: hello
|
58
|
-
from:
|
59
|
-
id: from-3f49
|
60
|
-
uri: direct
|
61
|
-
parameters:
|
62
|
-
name: hello
|
63
|
-
steps:
|
64
|
-
- to:
|
65
|
-
id: to-428d
|
66
|
-
uri: activemq
|
67
|
-
- to:
|
68
|
-
id: to-fed7
|
69
|
-
uri: kafka
|
70
|
-
- routeConfiguration:
|
71
|
-
id: auditedRoute
|
72
|
-
intercept:
|
73
|
-
- intercept:
|
74
|
-
id: intercept-0deb
|
75
|
-
steps:
|
76
|
-
- to:
|
77
|
-
id: to-b470
|
78
|
-
uri: direct
|
79
|
-
parameters:
|
80
|
-
name: step
|
81
|
-
interceptFrom:
|
82
|
-
- interceptFrom:
|
83
|
-
id: interceptFrom-4041
|
84
|
-
steps:
|
85
|
-
- to:
|
86
|
-
id: to-6861
|
87
|
-
uri: direct
|
88
|
-
parameters:
|
89
|
-
name: start
|
90
|
-
onCompletion:
|
91
|
-
- onCompletion:
|
92
|
-
id: onCompletion-3dab
|
93
|
-
steps:
|
94
|
-
- to:
|
95
|
-
id: to-dd4e
|
96
|
-
uri: direct
|
97
|
-
parameters:
|
98
|
-
name: finish
|
package/test/integration.spec.ts
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
* contributor license agreements. See the NOTICE file distributed with
|
4
|
-
* this work for additional information regarding copyright ownership.
|
5
|
-
* The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
* (the "License"); you may not use this file except in compliance with
|
7
|
-
* the License. You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import {expect} from 'chai';
|
18
|
-
import * as fs from 'fs';
|
19
|
-
import 'mocha';
|
20
|
-
import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
|
21
|
-
import {FilterDefinition, ToDefinition} from "../src/core/model/CamelDefinition";
|
22
|
-
import { RouteDefinition} from "../src/core/model/CamelDefinition";
|
23
|
-
|
24
|
-
describe('CRD YAML to Integration', () => {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
it('YAML <-> Object 1', () => {
|
29
|
-
const yaml = fs.readFileSync('test/integration1.yaml',{encoding:'utf8', flag:'r'});
|
30
|
-
const i = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml);
|
31
|
-
expect(i.metadata.name).to.equal('test1.yaml');
|
32
|
-
expect(i.kind).to.equal('Integration');
|
33
|
-
expect(i.spec.flows?.length).to.equal(1);
|
34
|
-
expect(i.type).to.equal('crd');
|
35
|
-
if (i.spec.flows){
|
36
|
-
const f:FilterDefinition = (i.spec.flows[0] as RouteDefinition).from.steps[1];
|
37
|
-
const t:ToDefinition = <ToDefinition> (f.steps ? f.steps[0] : undefined);
|
38
|
-
expect(t.uri).to.equal("log");
|
39
|
-
expect(t.parameters.level).to.equal("OFF");
|
40
|
-
}
|
41
|
-
console.log(CamelDefinitionYaml.integrationToYaml(i))
|
42
|
-
});
|
43
|
-
|
44
|
-
it('YAML <-> Object 2', () => {
|
45
|
-
const yaml = fs.readFileSync('test/integration2.yaml',{encoding:'utf8', flag:'r'});
|
46
|
-
const i = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml);
|
47
|
-
expect(i.metadata.name).to.equal('test1.yaml');
|
48
|
-
expect(i.kind).to.equal('Integration');
|
49
|
-
expect(i.spec.flows?.length).to.equal(1);
|
50
|
-
expect(i.type).to.equal('crd');
|
51
|
-
|
52
|
-
if (i.spec.flows){
|
53
|
-
const f:FilterDefinition = (i.spec.flows[0] as RouteDefinition).from.steps[1];
|
54
|
-
const t:ToDefinition = <ToDefinition> (f.steps ? f.steps[0] : undefined);
|
55
|
-
expect(t.uri).to.equal("log");
|
56
|
-
expect(t.parameters.level).to.equal("OFF");
|
57
|
-
}
|
58
|
-
});
|
59
|
-
|
60
|
-
});
|
package/test/integration1.yaml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
apiVersion: camel.apache.org/v1
|
2
|
-
kind: Integration
|
3
|
-
metadata:
|
4
|
-
name: test1.yaml
|
5
|
-
spec:
|
6
|
-
flows:
|
7
|
-
- from:
|
8
|
-
uri: kamelet:timer-source
|
9
|
-
steps:
|
10
|
-
- log:
|
11
|
-
message: wwwww
|
12
|
-
- filter:
|
13
|
-
expression:
|
14
|
-
constant:
|
15
|
-
expression: Hello Yaml !!!
|
16
|
-
steps:
|
17
|
-
- to:
|
18
|
-
uri: log
|
19
|
-
parameters:
|
20
|
-
level: 'OFF'
|
21
|
-
logMask: true
|
22
|
-
parameters:
|
23
|
-
period: 1000
|
24
|
-
message: qqq
|
package/test/integration2.yaml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
apiVersion: camel.apache.org/v1
|
2
|
-
kind: Integration
|
3
|
-
metadata:
|
4
|
-
name: test1.yaml
|
5
|
-
spec:
|
6
|
-
flows:
|
7
|
-
- from:
|
8
|
-
uri: kamelet:timer-source
|
9
|
-
steps:
|
10
|
-
- log:
|
11
|
-
message: wwwww
|
12
|
-
- filter:
|
13
|
-
expression:
|
14
|
-
constant: Hello Yaml !!!
|
15
|
-
steps:
|
16
|
-
- to:
|
17
|
-
uri: log
|
18
|
-
parameters:
|
19
|
-
level: 'OFF'
|
20
|
-
logMask: true
|
21
|
-
parameters:
|
22
|
-
period: 1000
|
23
|
-
message: qqq
|
@@ -1,51 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
* contributor license agreements. See the NOTICE file distributed with
|
4
|
-
* this work for additional information regarding copyright ownership.
|
5
|
-
* The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
* (the "License"); you may not use this file except in compliance with
|
7
|
-
* the License. You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import {expect} from 'chai';
|
18
|
-
import * as fs from 'fs';
|
19
|
-
import 'mocha';
|
20
|
-
import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
|
21
|
-
import { BeanFactoryDefinition } from '../src/core/model/CamelDefinition';
|
22
|
-
|
23
|
-
describe('Integration to YAML', () => {
|
24
|
-
|
25
|
-
it('YAML <-> Object', () => {
|
26
|
-
const yaml = fs.readFileSync('test/avro-serialize-action.kamelet.yaml',{encoding:'utf8', flag:'r'});
|
27
|
-
const i = CamelDefinitionYaml.yamlToIntegration("avro-serialize-action.kamelet.yaml", yaml);
|
28
|
-
expect(i.metadata.name).to.equal('avro-serialize-action');
|
29
|
-
expect(i.kind).to.equal('Kamelet');
|
30
|
-
if (i.spec.flows?.[1]){
|
31
|
-
const b:BeanFactoryDefinition = (i.spec.flows?.[1].beans[0] as BeanFactoryDefinition);
|
32
|
-
expect(b.properties.validate).to.equal("{{validate}}");
|
33
|
-
expect(b.properties.schema).to.equal("{{schema:}}");
|
34
|
-
}
|
35
|
-
});
|
36
|
-
|
37
|
-
it('YAML <-> Object', () => {
|
38
|
-
const yaml = fs.readFileSync('test/postgresql-source.kamelet.yaml',{encoding:'utf8', flag:'r'});
|
39
|
-
const i = CamelDefinitionYaml.yamlToIntegration("postgresql-source.kamelet.yaml", yaml);
|
40
|
-
expect(i.metadata.name).to.equal('postgresql-source');
|
41
|
-
expect(i.kind).to.equal('Kamelet');
|
42
|
-
if (i.spec.flows?.[1]){
|
43
|
-
const b:BeanFactoryDefinition = (i.spec.flows?.[1].beans[0] as BeanFactoryDefinition);
|
44
|
-
expect(b.properties.username).to.equal("{{username}}");
|
45
|
-
expect(b.properties.password).to.equal("{{password}}");
|
46
|
-
expect(b.properties.url).to.equal("jdbc:postgresql://{{serverName}}:{{serverPort}}/{{databaseName}}");
|
47
|
-
expect(b.properties.driverClassName).to.equal("org.postgresql.Driver");
|
48
|
-
}
|
49
|
-
});
|
50
|
-
|
51
|
-
});
|
package/test/intercept.spec.ts
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
* contributor license agreements. See the NOTICE file distributed with
|
4
|
-
* this work for additional information regarding copyright ownership.
|
5
|
-
* The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
* (the "License"); you may not use this file except in compliance with
|
7
|
-
* the License. You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*/
|
17
|
-
import * as fs from 'fs';
|
18
|
-
import 'mocha';
|
19
|
-
import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
|
20
|
-
import {CamelUtil} from "../src/core/api/CamelUtil";
|
21
|
-
import {CamelDefinitionApiExt} from "../src/core/api/CamelDefinitionApiExt";
|
22
|
-
import {
|
23
|
-
CatchDefinition,
|
24
|
-
ExpressionDefinition,
|
25
|
-
FromDefinition, LogDefinition,
|
26
|
-
PropertyExpressionDefinition
|
27
|
-
} from "../src/core/model/CamelDefinition";
|
28
|
-
import {expect} from "chai";
|
29
|
-
import {
|
30
|
-
InterceptDefinition,
|
31
|
-
RouteConfigurationDefinition,
|
32
|
-
RouteDefinition,
|
33
|
-
SagaDefinition,
|
34
|
-
ToDefinition,
|
35
|
-
TryDefinition
|
36
|
-
} from "../src/core/model/CamelDefinition";
|
37
|
-
import {Integration} from "../src/core/model/IntegrationDefinition";
|
38
|
-
|
39
|
-
describe('Intercept', () => {
|
40
|
-
|
41
|
-
it('Intercept YAML', () => {
|
42
|
-
// const yaml = fs.readFileSync('test/demo.yaml',{encoding:'utf8', flag:'r'});
|
43
|
-
// const i = CamelDefinitionYaml.yamlToIntegration("demo.yaml", yaml);
|
44
|
-
const i = Integration.createNew("intercept.camel", 'plain');
|
45
|
-
|
46
|
-
const intercept1 = new InterceptDefinition({
|
47
|
-
steps: [new LogDefinition({logName: 'log1', message: "intercept1"})]
|
48
|
-
})
|
49
|
-
const intercept2 = new InterceptDefinition({
|
50
|
-
steps: [new LogDefinition({logName: 'log2', message: "intercept2"})]
|
51
|
-
})
|
52
|
-
const routeConfiguration = new RouteConfigurationDefinition({
|
53
|
-
intercept: [intercept1, intercept2]
|
54
|
-
});
|
55
|
-
i.spec.flows?.push(routeConfiguration);
|
56
|
-
|
57
|
-
const yaml = CamelDefinitionYaml.integrationToYaml(i);
|
58
|
-
|
59
|
-
const i2 = CamelDefinitionYaml.yamlToIntegration("demo.yaml", yaml);
|
60
|
-
});
|
61
|
-
|
62
|
-
});
|
package/test/intercept.yaml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
- routeConfiguration:
|
2
|
-
intercept:
|
3
|
-
- intercept:
|
4
|
-
id: intercept-9b31
|
5
|
-
steps:
|
6
|
-
- log:
|
7
|
-
message: Interceptor ${body}
|
8
|
-
id: log-c2f5
|
9
|
-
- route:
|
10
|
-
id: route-ddaa
|
11
|
-
from:
|
12
|
-
uri: kamelet:timer-source
|
13
|
-
id: from-847d
|
14
|
-
parameters:
|
15
|
-
message: Hello
|
16
|
-
steps:
|
17
|
-
- log:
|
18
|
-
message: Main ${body}
|
19
|
-
id: log-7972
|