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
package/test/restDsl.spec.ts
DELETED
@@ -1,83 +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 {Integration} from "../src/core/model/IntegrationDefinition";
|
22
|
-
import {GetDefinition, PostDefinition, RestDefinition, RouteDefinition} from "../src/core/model/CamelDefinition";
|
23
|
-
import {FromDefinition} from "../src/core/model/CamelDefinition";
|
24
|
-
import {CamelDefinitionApiExt} from "../src/core/api/CamelDefinitionApiExt";
|
25
|
-
import {RestConfigurationDefinition} from "../src/core/model/CamelDefinition";
|
26
|
-
|
27
|
-
describe('REST DSL', () => {
|
28
|
-
|
29
|
-
it('YAML <-> Object 1', () => {
|
30
|
-
const yaml = fs.readFileSync('test/restDsl.yaml', {encoding: 'utf8', flag: 'r'});
|
31
|
-
const i = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml);
|
32
|
-
expect(i.metadata.name).to.equal('RestDsl');
|
33
|
-
expect(i.kind).to.equal('Integration');
|
34
|
-
expect(i.spec.flows?.length).to.equal(3);
|
35
|
-
expect(i.type).to.equal('crd');
|
36
|
-
|
37
|
-
i.spec.flows?.filter(f => f.dslName === 'RestDefinition').forEach(f => {
|
38
|
-
const rest = f as RestDefinition;
|
39
|
-
expect(rest.path).to.equal("/demo");
|
40
|
-
expect(rest.post?.length).to.equal(2);
|
41
|
-
expect(rest.get?.length).to.equal(2);
|
42
|
-
})
|
43
|
-
});
|
44
|
-
|
45
|
-
it('Add REST', () => {
|
46
|
-
const flow1 = new FromDefinition({uri: "direct1"});
|
47
|
-
let i = Integration.createNew("test")
|
48
|
-
i.spec.flows?.push(new RouteDefinition({from: flow1}));
|
49
|
-
|
50
|
-
const rest = new RestDefinition({path: "/demo", description: "Hello World"});
|
51
|
-
i = CamelDefinitionApiExt.addRestToIntegration(i, rest);
|
52
|
-
i = CamelDefinitionApiExt.addRestMethodToIntegration(i, new GetDefinition(), rest.uuid);
|
53
|
-
i = CamelDefinitionApiExt.addRestMethodToIntegration(i, new GetDefinition(), rest.uuid);
|
54
|
-
|
55
|
-
const yaml = CamelDefinitionYaml.integrationToYaml(i);
|
56
|
-
|
57
|
-
i.spec.flows?.filter(f => f.dslName === 'RestDefinition').forEach(f => {
|
58
|
-
const rest = f as RestDefinition;
|
59
|
-
expect(rest.path).to.equal("/demo");
|
60
|
-
expect(rest.get?.length).to.equal(2);
|
61
|
-
})
|
62
|
-
});
|
63
|
-
|
64
|
-
it('Add REST Configuration', () => {
|
65
|
-
let i = Integration.createNew("test")
|
66
|
-
i.spec.flows?.push(new RestDefinition({path:"path1", post:[new PostDefinition({to:"direct:direct1"})]}));
|
67
|
-
i.spec.flows?.push(new RestDefinition({path:"path2", post:[new PostDefinition({to:"direct:direct2"})]}));
|
68
|
-
i.spec.flows?.push(new RestConfigurationDefinition({port: "8080", host:"localhost"}));
|
69
|
-
|
70
|
-
const yaml = CamelDefinitionYaml.integrationToYaml(i);
|
71
|
-
const i2 = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml);
|
72
|
-
const x: RestConfigurationDefinition = i2.spec.flows?.[0] as RestConfigurationDefinition;
|
73
|
-
expect(x?.port).to.equal('8080');
|
74
|
-
expect(x?.host).to.equal('localhost');
|
75
|
-
|
76
|
-
const yaml2 = fs.readFileSync('test/restConfigDsl.yaml', {encoding: 'utf8', flag: 'r'});
|
77
|
-
const i3 = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml2);
|
78
|
-
const x3: RestConfigurationDefinition = i3.spec.flows?.[0] as RestConfigurationDefinition;
|
79
|
-
expect(x3?.port).to.equal('8080');
|
80
|
-
expect(x3?.host).to.equal('localhost');
|
81
|
-
});
|
82
|
-
|
83
|
-
});
|
package/test/restDsl.yaml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
apiVersion: camel.apache.org/v1
|
2
|
-
kind: Integration
|
3
|
-
metadata:
|
4
|
-
name: RestDsl
|
5
|
-
spec:
|
6
|
-
flows:
|
7
|
-
- rest-configuration:
|
8
|
-
component: "platform-http"
|
9
|
-
context-path: "/base"
|
10
|
-
port: 8081
|
11
|
-
- rest:
|
12
|
-
path: "/demo"
|
13
|
-
post:
|
14
|
-
- path: "/foo"
|
15
|
-
to: "direct:foo"
|
16
|
-
- path: "/bar"
|
17
|
-
to: "direct:bar"
|
18
|
-
get:
|
19
|
-
- path: "/getFoo"
|
20
|
-
to: "direct:foo"
|
21
|
-
- path: "/getBar"
|
22
|
-
to: "direct:foo"
|
23
|
-
- from:
|
24
|
-
uri: 'direct:foo'
|
25
|
-
steps:
|
26
|
-
- log: '${body}'
|
27
|
-
- log: '${headers}'
|
28
|
-
- setBody:
|
29
|
-
constant: "Hello world"
|
package/test/routes.spec.ts
DELETED
@@ -1,37 +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
|
-
|
22
|
-
describe('Plain YAML with route to integration', () => {
|
23
|
-
|
24
|
-
it('YAML <-> Object', () => {
|
25
|
-
const yaml = fs.readFileSync('test/routes1.yaml',{encoding:'utf8', flag:'r'});
|
26
|
-
const i = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml);
|
27
|
-
expect(i.metadata.name).to.equal('test1.yaml');
|
28
|
-
expect(i.kind).to.equal('Integration');
|
29
|
-
expect(i.spec.flows?.length).to.equal(1);
|
30
|
-
expect(i.type).to.equal('plain');
|
31
|
-
if (i.spec.flows) expect(i.spec.flows[0].from.uri).to.equal('timer');
|
32
|
-
if (i.spec.flows) expect(i.spec.flows[0].from.parameters.name).to.equal('info');
|
33
|
-
const yaml2 = CamelDefinitionYaml.integrationToYaml(i);
|
34
|
-
expect(yaml.replaceAll("\r\n", "\n")).to.equal(yaml2); // replace for Windows compatibility
|
35
|
-
});
|
36
|
-
|
37
|
-
});
|
package/test/routes1.yaml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-ea82
|
3
|
-
from:
|
4
|
-
id: from-1
|
5
|
-
uri: timer
|
6
|
-
parameters:
|
7
|
-
name: info
|
8
|
-
steps:
|
9
|
-
- choice:
|
10
|
-
id: choice-1
|
11
|
-
when:
|
12
|
-
- id: when-1
|
13
|
-
expression:
|
14
|
-
simple:
|
15
|
-
id: simple-1
|
16
|
-
expression: ${headers} != null
|
17
|
-
steps:
|
18
|
-
- log:
|
19
|
-
id: log-1
|
20
|
-
message: hello11
|
21
|
-
logName: log11
|
22
|
-
- id: when-2
|
23
|
-
expression:
|
24
|
-
simple:
|
25
|
-
id: simple-2
|
26
|
-
expression: ${headers} == null
|
27
|
-
steps:
|
28
|
-
- log:
|
29
|
-
id: log-2
|
30
|
-
message: hello22s
|
31
|
-
logName: log22
|