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,34 +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 {ComponentApi} from "../src/core/api/ComponentApi";
|
22
|
-
import {SupportedComponent} from "../src/core/model/ComponentModels";
|
23
|
-
|
24
|
-
|
25
|
-
describe('Supported Components List', () => {
|
26
|
-
|
27
|
-
it('Read Supported Components', () => {
|
28
|
-
const json = fs.readFileSync('test/supported-components.json',{encoding:'utf8', flag:'r'});
|
29
|
-
ComponentApi.saveSupportedComponents(json);
|
30
|
-
const sc = ComponentApi.getSupportedComponents();
|
31
|
-
expect(sc.length).to.equal(305);
|
32
|
-
});
|
33
|
-
|
34
|
-
});
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import org.apache.camel.AggregationStrategy;
|
2
|
-
import org.apache.camel.Configuration;
|
3
|
-
import org.apache.camel.BindToRegistry;
|
4
|
-
import org.apache.camel.Exchange;
|
5
|
-
|
6
|
-
@Configuration
|
7
|
-
@BindToRegistry("${NAME}")
|
8
|
-
public class ${NAME} implements AggregationStrategy {
|
9
|
-
@Override
|
10
|
-
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
|
11
|
-
|
12
|
-
if (oldExchange == null) {
|
13
|
-
return newExchange;
|
14
|
-
}
|
15
|
-
|
16
|
-
String oldBody = oldExchange.getIn().getBody(String.class);
|
17
|
-
String newBody = newExchange.getIn().getBody(String.class);
|
18
|
-
oldExchange.getIn().setBody(oldBody + "+" + newBody);
|
19
|
-
return oldExchange;
|
20
|
-
}
|
21
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import org.apache.camel.BindToRegistry;
|
2
|
-
import org.apache.camel.Configuration;
|
3
|
-
import org.apache.camel.Exchange;
|
4
|
-
import org.apache.camel.Processor;
|
5
|
-
|
6
|
-
@Configuration
|
7
|
-
@BindToRegistry("${NAME}")
|
8
|
-
public class ${NAME} implements Processor {
|
9
|
-
|
10
|
-
public void process(Exchange exchange) throws Exception {
|
11
|
-
exchange.getIn().setBody("Hello World");
|
12
|
-
}
|
13
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import org.apache.camel.AggregationStrategy;
|
2
|
-
import org.apache.camel.Configuration;
|
3
|
-
import org.apache.camel.BindToRegistry;
|
4
|
-
import org.apache.camel.Exchange;
|
5
|
-
|
6
|
-
@Configuration
|
7
|
-
@BindToRegistry("CustomAggregationStrategy")
|
8
|
-
public class CustomAggregationStrategy implements AggregationStrategy {
|
9
|
-
@Override
|
10
|
-
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
|
11
|
-
|
12
|
-
if (oldExchange == null) {
|
13
|
-
return newExchange;
|
14
|
-
}
|
15
|
-
|
16
|
-
String oldBody = oldExchange.getIn().getBody(String.class);
|
17
|
-
String newBody = newExchange.getIn().getBody(String.class);
|
18
|
-
oldExchange.getIn().setBody(oldBody + "+" + newBody);
|
19
|
-
return oldExchange;
|
20
|
-
}
|
21
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import org.apache.camel.BindToRegistry;
|
2
|
-
import org.apache.camel.Configuration;
|
3
|
-
import org.apache.camel.Exchange;
|
4
|
-
import org.apache.camel.Processor;
|
5
|
-
|
6
|
-
@Configuration
|
7
|
-
@BindToRegistry("CustomProcessor")
|
8
|
-
public class CustomProcessor implements Processor {
|
9
|
-
|
10
|
-
public void process(Exchange exchange) throws Exception {
|
11
|
-
exchange.getIn().setBody("Hello World");
|
12
|
-
}
|
13
|
-
}
|
package/test/templateApi.spec.ts
DELETED
@@ -1,45 +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 * as fs from 'fs';
|
20
|
-
import { TemplateApi } from '../src/core/api/TemplateApi';
|
21
|
-
|
22
|
-
describe('TemplateAPI', () => {
|
23
|
-
|
24
|
-
it('Generate Aggregation Strategy', () => {
|
25
|
-
|
26
|
-
const aggregator = fs.readFileSync('test/template1.AggregationStrategy.java',{encoding:'utf8', flag:'r'});
|
27
|
-
const code2 = fs.readFileSync('test/template2.AggregationStrategy.java',{encoding:'utf8', flag:'r'});
|
28
|
-
|
29
|
-
TemplateApi.saveTemplate("aggregator", aggregator)
|
30
|
-
|
31
|
-
const code = TemplateApi.generateCode("aggregator", "CustomAggregationStrategy")
|
32
|
-
expect(code2).to.equal(code);
|
33
|
-
});
|
34
|
-
|
35
|
-
it('Generate Processor', () => {
|
36
|
-
|
37
|
-
const processor = fs.readFileSync('test/template1.Processor.java',{encoding:'utf8', flag:'r'});
|
38
|
-
const code2 = fs.readFileSync('test/template2.Processor.java',{encoding:'utf8', flag:'r'});
|
39
|
-
|
40
|
-
TemplateApi.saveTemplate("processor", processor)
|
41
|
-
|
42
|
-
const code = TemplateApi.generateCode("processor", "CustomProcessor")
|
43
|
-
expect(code2).to.equal(code);
|
44
|
-
});
|
45
|
-
});
|
@@ -1,75 +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
|
-
|
18
|
-
apiVersion: camel.apache.org/v1
|
19
|
-
kind: Kamelet
|
20
|
-
metadata:
|
21
|
-
name: timer-source
|
22
|
-
annotations:
|
23
|
-
camel.apache.org/kamelet.support.level: "Stable"
|
24
|
-
camel.apache.org/catalog.version: "4.2.0-SNAPSHOT"
|
25
|
-
camel.apache.org/kamelet.icon: data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gU3ZnIFZlY3RvciBJY29ucyA6IGh0dHA6Ly93d3cub25saW5ld2ViZm9udHMuY29tL2ljb24gLS0+DQo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPG1ldGFkYXRhPiBTdmcgVmVjdG9yIEljb25zIDogaHR0cDovL3d3dy5vbmxpbmV3ZWJmb250cy5jb20vaWNvbiA8L21ldGFkYXRhPg0KPGc+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsNTExLjAwMDAwMCkgc2NhbGUoMC4xMDAwMDAsLTAuMTAwMDAwKSI+PHBhdGggZD0iTTM4ODguMSw0Nzc0Ljl2LTIzNS4xaDQxMS40aDQxNC4zbC04LjgtMzI5LjFsLTguOC0zMzJsLTExNy41LTguOGMtMjI5LjItMTQuNy02MjAtOTkuOS05MjUuNi0xOTYuOUMyMjU3LjQsMzIyMC42LDExNjcuMiwyMDY1LjgsODAyLjksNjQ5LjZjLTUxMS4zLTE5ODYuMywzODQuOS00MDAyLDIyMDYuNy00OTY1LjhjMzAyLjYtMTYxLjYsNzU4LjEtMzIwLjIsMTE1NC44LTQwNS41YzQyNi4xLTkxLjEsMTI1MS43LTkxLjEsMTY4MC43LDBjMTc2OC45LDM4MiwzMDQ0LjEsMTY1Ny4yLDM0MjYuMSwzNDI2LjFjOTEuMSw0MjYuMSw5MS4xLDEyNTQuNiwwLDE2NzcuOGMtNDIwLjIsMTk0Mi4yLTE5MzYuNCwzMzAyLjYtMzg5MC4zLDM0OTYuNmwtMTk5LjgsMjAuNnYzMjAuM3YzMjAuM2g0MTEuNGg0MTEuNHYyMzUuMVY1MDEwSDQ5NDUuOUgzODg4LjFWNDc3NC45eiBNNTc1My45LDMzNDkuOWM3NzguNy0xNjEuNiwxNDE5LjItNTA4LjMsMTk4My40LTEwNzIuNWM1NjQuMi01NjEuMiw4ODcuNC0xMTU3LjcsMTA2MC43LTE5NDIuMmM5OS45LTQzNy44LDk5LjktMTE0MywzLTE1ODAuOEM4NTYzLTIzMDYuNCw3OTY2LjUtMzE1OC41LDcwNDMuOS0zNzUyYy0zMzUtMjE0LjUtNzg3LjUtMzk2LjctMTI0OC44LTQ5OS41Yy00MzcuOC05Ny0xMTQzLTk3LTE1ODAuOCwyLjljLTc4NC41LDE3My4zLTEzODEsNDk2LjYtMTk0Mi4yLDEwNjAuN2MtNTcwLDU2Ny4xLTkwNy45LDExOTguOC0xMDc4LjQsMTk5OC4xYy03My41LDM0Ni43LTczLjUsMTEyMi40LDAsMTQ2OS4yYzE3MC40LDc5OS4yLDUwOC4zLDE0MzEsMTA3OC40LDE5OThDMjg5NSwyOTAwLjMsMzYzOC40LDMyNzMuNSw0NDkzLjQsMzM5MUM0Nzc4LjQsMzQzMi4xLDU0NzQuOCwzNDA4LjYsNTc1My45LDMzNDkuOXoiLz48cGF0aCBkPSJNNDcxMC44LDEzNzUuM1YyMDUuOUw0NTUyLjIsNjcuOGMtMzE3LjMtMjc5LjEtMzQwLjgtNjc4LjctNTUuOC05OTMuMWMyODcuOS0zMjAuMyw2OTMuNC0zMTcuMywxMDEzLjcsNS45bDE3MC40LDE3MC40aDEwNDMuMWgxMDQzLjFWLTUxNFYtMjc5SDY3MjkuNUg1NjkyLjJsLTQ5LjksMTE0LjZjLTU4LjgsMTMyLjItMjUyLjcsMzE3LjMtMzc2LjEsMzYxLjRsLTg1LjIsMjkuNHYxMTU3Ljd2MTE1Ny43aC0yMzUuMWgtMjM1LjFWMTM3NS4zeiBNNTE2Ni4zLTI5My42YzE0Ni45LTE0NCw0NC4xLTM5Ni43LTE2MS42LTM5Ni43Yy01NS44LDAtMTE3LjUsMjYuNC0xNjEuNiw3My40Yy00Nyw0NC4xLTczLjUsMTA1LjgtNzMuNSwxNjEuNnMyNi40LDExNy41LDczLjUsMTYxLjZjNDQuMSw0NywxMDUuOCw3My41LDE2MS42LDczLjVDNTA2MC41LTIyMC4yLDUxMjIuMi0yNDYuNyw1MTY2LjMtMjkzLjZ6Ii8+PC9nPjwvZz4NCjwvc3ZnPg==
|
26
|
-
camel.apache.org/provider: "Apache Software Foundation"
|
27
|
-
camel.apache.org/kamelet.group: "Timer"
|
28
|
-
camel.apache.org/kamelet.namespace: "Scheduling"
|
29
|
-
labels:
|
30
|
-
camel.apache.org/kamelet.type: source
|
31
|
-
camel.apache.org/kamelet.verified: "true"
|
32
|
-
spec:
|
33
|
-
definition:
|
34
|
-
title: Timer Source
|
35
|
-
description: Produces periodic messages with a custom payload.
|
36
|
-
required:
|
37
|
-
- message
|
38
|
-
type: object
|
39
|
-
properties:
|
40
|
-
period:
|
41
|
-
title: Period
|
42
|
-
description: "The interval (in milliseconds) to wait between producing the next message."
|
43
|
-
type: integer
|
44
|
-
default: 1000
|
45
|
-
message:
|
46
|
-
title: Message
|
47
|
-
description: The message to generate.
|
48
|
-
type: string
|
49
|
-
example: hello world
|
50
|
-
contentType:
|
51
|
-
title: Content Type
|
52
|
-
description: The content type of the generated message.
|
53
|
-
type: string
|
54
|
-
default: text/plain
|
55
|
-
repeatCount:
|
56
|
-
title: Repeat Count
|
57
|
-
description: Specifies a maximum limit of number of fires
|
58
|
-
type: integer
|
59
|
-
dependencies:
|
60
|
-
- "camel:core"
|
61
|
-
- "camel:timer"
|
62
|
-
- "camel:kamelet"
|
63
|
-
template:
|
64
|
-
from:
|
65
|
-
uri: timer:tick
|
66
|
-
parameters:
|
67
|
-
period: "{{period}}"
|
68
|
-
repeatCount: "{{?repeatCount}}"
|
69
|
-
steps:
|
70
|
-
- set-body:
|
71
|
-
constant: "{{message}}"
|
72
|
-
- set-header:
|
73
|
-
name: "Content-Type"
|
74
|
-
constant: "{{contentType}}"
|
75
|
-
- to: kamelet:sink
|
package/test/tod.spec.ts
DELETED
@@ -1,31 +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
|
-
|
23
|
-
describe('ToDynamicDefinition', () => {
|
24
|
-
|
25
|
-
it('ToDynamicDefinition URI', () => {
|
26
|
-
const yaml = fs.readFileSync('test/tod.yaml',{encoding:'utf8', flag:'r'});
|
27
|
-
const i = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml);
|
28
|
-
expect(i.spec.flows?.[0].from.steps[0].uri, 'kafka:${header.foo}')
|
29
|
-
});
|
30
|
-
|
31
|
-
});
|
package/test/tod.yaml
DELETED
package/test/topology.spec.ts
DELETED
@@ -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 * as fs from 'fs';
|
18
|
-
import 'mocha';
|
19
|
-
import {CamelDefinitionYaml} from "../src/core/api/CamelDefinitionYaml";
|
20
|
-
import { TopologyUtils } from '../src/core/api/TopologyUtils';
|
21
|
-
import { KameletApi } from '../src/core/api/KameletApi';
|
22
|
-
|
23
|
-
|
24
|
-
describe('Topology functions', () => {
|
25
|
-
|
26
|
-
it('Topology find', () => {
|
27
|
-
loadKamelets();
|
28
|
-
const yaml1 = fs.readFileSync('test/topology1.camel.yaml',{encoding:'utf8', flag:'r'});
|
29
|
-
const yaml2 = fs.readFileSync('test/topology2.camel.yaml',{encoding:'utf8', flag:'r'});
|
30
|
-
const i1 = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml1);
|
31
|
-
const i2 = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml2);
|
32
|
-
const tin = TopologyUtils.findTopologyIncomingNodes([i1, i2]);
|
33
|
-
const trn = TopologyUtils.findTopologyRestNodes([i1, i2]);
|
34
|
-
const ton = TopologyUtils.findTopologyRouteOutgoingNodes([i1, i2]);
|
35
|
-
});
|
36
|
-
|
37
|
-
it('Topology getUniqueUri', () => {
|
38
|
-
loadKamelets();
|
39
|
-
const yaml1 = fs.readFileSync('test/topology3.camel.yaml',{encoding:'utf8', flag:'r'});
|
40
|
-
const i1 = CamelDefinitionYaml.yamlToIntegration("test1.yaml", yaml1);
|
41
|
-
const tin = TopologyUtils.findTopologyRouteOutgoingNodes([i1]);
|
42
|
-
});
|
43
|
-
|
44
|
-
function loadKamelets() {
|
45
|
-
const yamls = fs.readFileSync('test/metadata/kamelets.yaml',{encoding:'utf8', flag:'r'});
|
46
|
-
const kamelets: string[] = [];
|
47
|
-
yamls.split(/\n?---\n?/).map(c => c.trim()).forEach(z => kamelets.push(z));
|
48
|
-
KameletApi.saveKamelets(kamelets, true);
|
49
|
-
}
|
50
|
-
|
51
|
-
});
|
@@ -1,56 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-c67f1
|
3
|
-
description: Timer Scheduler
|
4
|
-
from:
|
5
|
-
uri: kamelet:timer-source
|
6
|
-
id: from-b4181
|
7
|
-
parameters:
|
8
|
-
message: Hello
|
9
|
-
steps:
|
10
|
-
- log:
|
11
|
-
message: ${body}
|
12
|
-
id: log-a68a1
|
13
|
-
- route:
|
14
|
-
id: route-2cbd1
|
15
|
-
from:
|
16
|
-
uri: kamelet:aws-cloudtrail-source
|
17
|
-
id: from-a3f61
|
18
|
-
parameters:
|
19
|
-
region: fff
|
20
|
-
steps:
|
21
|
-
- to:
|
22
|
-
uri: kamelet:google-pubsub-sink
|
23
|
-
id: to-c27f1
|
24
|
-
- route:
|
25
|
-
id: route-de2b1
|
26
|
-
from:
|
27
|
-
uri: amqp
|
28
|
-
id: from-1e661
|
29
|
-
steps:
|
30
|
-
- to:
|
31
|
-
uri: direct
|
32
|
-
id: to-6a041
|
33
|
-
parameters:
|
34
|
-
name: xxxx
|
35
|
-
- route:
|
36
|
-
id: route-ec4e1
|
37
|
-
from:
|
38
|
-
uri: direct
|
39
|
-
id: from-e9181
|
40
|
-
parameters:
|
41
|
-
name: xxx
|
42
|
-
steps:
|
43
|
-
- to:
|
44
|
-
uri: kamelet:kafka-not-secured-sink
|
45
|
-
id: to-a47b1
|
46
|
-
- rest:
|
47
|
-
id: rest-b499
|
48
|
-
get:
|
49
|
-
- to: direct:xxx
|
50
|
-
id: get-cb63
|
51
|
-
post:
|
52
|
-
- to: direct:xxx
|
53
|
-
id: post-07e4
|
54
|
-
put:
|
55
|
-
- to: direct:xxx
|
56
|
-
id: put-8271
|
@@ -1,44 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-c67f
|
3
|
-
from:
|
4
|
-
uri: kamelet:timer-source
|
5
|
-
id: from-b418
|
6
|
-
parameters:
|
7
|
-
message: Hello
|
8
|
-
steps:
|
9
|
-
- log:
|
10
|
-
message: ${body}
|
11
|
-
id: log-a68a
|
12
|
-
- route:
|
13
|
-
id: route-2cbd
|
14
|
-
from:
|
15
|
-
uri: kamelet:aws-cloudtrail-source
|
16
|
-
id: from-a3f6
|
17
|
-
parameters:
|
18
|
-
region: fff
|
19
|
-
steps:
|
20
|
-
- to:
|
21
|
-
uri: kamelet:google-pubsub-sink
|
22
|
-
id: to-c27f
|
23
|
-
- route:
|
24
|
-
id: route-de2b
|
25
|
-
from:
|
26
|
-
uri: amqp
|
27
|
-
id: from-1e66
|
28
|
-
steps:
|
29
|
-
- to:
|
30
|
-
uri: direct
|
31
|
-
id: to-6a04
|
32
|
-
parameters:
|
33
|
-
name: xxxx
|
34
|
-
- route:
|
35
|
-
id: route-ec4e
|
36
|
-
from:
|
37
|
-
uri: direct
|
38
|
-
id: from-e918
|
39
|
-
parameters:
|
40
|
-
name: xxx
|
41
|
-
steps:
|
42
|
-
- to:
|
43
|
-
uri: kamelet:kafka-not-secured-sink
|
44
|
-
id: to-a47b
|
@@ -1,27 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-6312
|
3
|
-
description: File Send
|
4
|
-
nodePrefixId: route-b7f
|
5
|
-
autoStartup: true
|
6
|
-
from:
|
7
|
-
id: file-send-direct
|
8
|
-
uri: direct
|
9
|
-
parameters:
|
10
|
-
name: send-roster-files
|
11
|
-
synchronous: false
|
12
|
-
steps:
|
13
|
-
- log:
|
14
|
-
id: log-894b
|
15
|
-
message: "DEBUG: Transfer Starting ${date:now:yyyyMMdd hh:mm:ss}"
|
16
|
-
- routeConfiguration:
|
17
|
-
errorHandler:
|
18
|
-
id: errorHandler-1b09
|
19
|
-
deadLetterChannel:
|
20
|
-
id: deadLetterChannel-2cf3
|
21
|
-
deadLetterUri: direct:dlq
|
22
|
-
redeliveryPolicy:
|
23
|
-
id: redeliveryPolicy-58fe
|
24
|
-
maximumRedeliveries: 5
|
25
|
-
redeliveryDelay: "60000"
|
26
|
-
useOriginalMessage: false
|
27
|
-
useOriginalBody: false
|
package/test/updateStep.spec.ts
DELETED
@@ -1,72 +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 {FromDefinition, LogDefinition, WhenDefinition, ChoiceDefinition, ExpressionDefinition} from "../src/core/model/CamelDefinition";
|
20
|
-
import {CamelUtil} from "../src/core/api/CamelUtil";
|
21
|
-
import {CamelDefinitionApiExt} from "../src/core/api/CamelDefinitionApiExt";
|
22
|
-
import {FilterDefinition, SimpleExpression} from "../src/core/model/CamelDefinition";
|
23
|
-
import {Integration} from "../src/core/model/IntegrationDefinition";
|
24
|
-
import {RouteDefinition} from "../src/core/model/CamelDefinition";
|
25
|
-
|
26
|
-
describe('Update Step', () => {
|
27
|
-
|
28
|
-
it('Update Expression in When clause', () => {
|
29
|
-
const i = Integration.createNew("test")
|
30
|
-
const when1 = new WhenDefinition({
|
31
|
-
expression:new ExpressionDefinition({simple: new SimpleExpression({expression: '$[body} != null'})}),
|
32
|
-
steps:[new LogDefinition({logName: 'log11', message: "hello11"})]
|
33
|
-
})
|
34
|
-
const choice = new ChoiceDefinition({when:[when1]})
|
35
|
-
const flow1 = new FromDefinition({uri: "direct1"});
|
36
|
-
flow1.steps?.push(choice);
|
37
|
-
i.spec.flows?.push(new RouteDefinition({from: flow1}));
|
38
|
-
const when2:WhenDefinition = CamelUtil.cloneStep(when1);
|
39
|
-
if (when2 && when2.expression){
|
40
|
-
when2.expression.simple = new SimpleExpression({expression: '$[body} == "hello world"'});
|
41
|
-
}
|
42
|
-
const i2 = CamelDefinitionApiExt.updateIntegrationRouteElement(i, when2);
|
43
|
-
if (i2.spec.flows && i2.spec.flows.length > 0){
|
44
|
-
const f:FromDefinition = i2.spec.flows[0].from;
|
45
|
-
const c:ChoiceDefinition = f.steps ? f.steps[0] : new ChoiceDefinition();
|
46
|
-
const w = c.when ? c.when[0] : undefined;
|
47
|
-
expect((w?.expression?.simple as SimpleExpression).expression).to.equal('$[body} == "hello world"');
|
48
|
-
}
|
49
|
-
});
|
50
|
-
|
51
|
-
it('Update Expression in Filter clause', () => {
|
52
|
-
const i = Integration.createNew("test")
|
53
|
-
const filter = new FilterDefinition({
|
54
|
-
expression:new ExpressionDefinition({simple: new SimpleExpression({expression: '$[body} != null'})}),
|
55
|
-
steps:[new LogDefinition({logName: 'log11', message: "hello11"})]
|
56
|
-
})
|
57
|
-
const flow1 = new FromDefinition({uri: "direct1"});
|
58
|
-
flow1.steps?.push(filter);
|
59
|
-
i.spec.flows?.push(new RouteDefinition({from: flow1}));
|
60
|
-
|
61
|
-
const filter1:FilterDefinition = CamelUtil.cloneStep(filter);
|
62
|
-
if (filter1 && filter1.expression){
|
63
|
-
filter1.expression.simple = new SimpleExpression({expression: '$[body} == "hello world"'});
|
64
|
-
}
|
65
|
-
const i2 = CamelDefinitionApiExt.updateIntegrationRouteElement(i, filter1);
|
66
|
-
if (i2.spec.flows && i2.spec.flows.length > 0){
|
67
|
-
const from:FromDefinition = i2.spec.flows[0].from;
|
68
|
-
const f:FilterDefinition = from.steps ? from.steps[0] : new FilterDefinition();
|
69
|
-
expect((f?.expression?.simple as SimpleExpression).expression).to.equal('$[body} == "hello world"');
|
70
|
-
}
|
71
|
-
});
|
72
|
-
});
|
@@ -1,42 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-18e5
|
3
|
-
nodePrefixId: route-656
|
4
|
-
from:
|
5
|
-
id: from-9468
|
6
|
-
uri: amqp
|
7
|
-
variableReceive: global:variable1
|
8
|
-
steps:
|
9
|
-
- doTry:
|
10
|
-
id: doTry-8bb0
|
11
|
-
doCatch:
|
12
|
-
- id: doCatch-19a9
|
13
|
-
steps:
|
14
|
-
- convertVariableTo:
|
15
|
-
id: convertVariableTo-b0e5
|
16
|
-
name: xxx
|
17
|
-
toName: yyy
|
18
|
-
steps:
|
19
|
-
- multicast:
|
20
|
-
id: multicast-ad44
|
21
|
-
steps:
|
22
|
-
- to:
|
23
|
-
id: to-0c20
|
24
|
-
variableSend: send1
|
25
|
-
variableReceive: receive1
|
26
|
-
uri: activemq
|
27
|
-
- to:
|
28
|
-
id: to-e79a
|
29
|
-
variableSend: route:aran1
|
30
|
-
variableReceive: route:aran1
|
31
|
-
uri: arangodb
|
32
|
-
- setVariable:
|
33
|
-
id: setVariable-957d
|
34
|
-
name: varrr
|
35
|
-
expression:
|
36
|
-
simple:
|
37
|
-
id: simple-cd4b
|
38
|
-
- to:
|
39
|
-
id: to-60f8
|
40
|
-
variableSend: hello
|
41
|
-
variableReceive: world
|
42
|
-
uri: amqp
|
@@ -1,42 +0,0 @@
|
|
1
|
-
- route:
|
2
|
-
id: route-18e5
|
3
|
-
nodePrefixId: route-656
|
4
|
-
from:
|
5
|
-
id: from-9468
|
6
|
-
uri: amqp
|
7
|
-
variableReceive: variable2
|
8
|
-
steps:
|
9
|
-
- doTry:
|
10
|
-
id: doTry-8bb0
|
11
|
-
doCatch:
|
12
|
-
- id: doCatch-19a9
|
13
|
-
steps:
|
14
|
-
- convertVariableTo:
|
15
|
-
id: convertVariableTo-b0e5
|
16
|
-
name: xxx2
|
17
|
-
toName: yyy2
|
18
|
-
steps:
|
19
|
-
- multicast:
|
20
|
-
id: multicast-ad44
|
21
|
-
steps:
|
22
|
-
- to:
|
23
|
-
id: to-0c20
|
24
|
-
variableSend: asend2
|
25
|
-
variableReceive: breceive2
|
26
|
-
uri: activemq
|
27
|
-
- to:
|
28
|
-
id: to-e79a
|
29
|
-
variableSend: route:aran2
|
30
|
-
variableReceive: global:aran2
|
31
|
-
uri: arangodb
|
32
|
-
- setVariable:
|
33
|
-
id: setVariable-957d
|
34
|
-
name: varrr2
|
35
|
-
expression:
|
36
|
-
simple:
|
37
|
-
id: simple-cd4b
|
38
|
-
- to:
|
39
|
-
id: to-60f8
|
40
|
-
variableSend: hello2
|
41
|
-
variableReceive: world2
|
42
|
-
uri: amqp
|
package/test/variables.spec.ts
DELETED
@@ -1,34 +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 { VariableUtil } from '../src/core/api/VariableUtil';
|
21
|
-
import { IntegrationFile } from '../src/core/model/IntegrationDefinition';
|
22
|
-
|
23
|
-
describe('Variables', () => {
|
24
|
-
|
25
|
-
it('Find Variables', () => {
|
26
|
-
const yaml1 = fs.readFileSync('test/variable1.camel.yaml',{encoding:'utf8', flag:'r'});
|
27
|
-
const yaml2 = fs.readFileSync('test/variable2.camel.yaml',{encoding:'utf8', flag:'r'});
|
28
|
-
const variables = VariableUtil.findVariables([
|
29
|
-
new IntegrationFile('variable1.camel.yaml', yaml1)
|
30
|
-
, new IntegrationFile('variable2.camel.yaml', yaml2)
|
31
|
-
]);
|
32
|
-
expect(variables.length).to.equal(19);
|
33
|
-
});
|
34
|
-
});
|