Skip to content

Commit

Permalink
Core Tests passed for Camel YAML DSL 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mgubaidullin committed Oct 20, 2023
1 parent bfea1a8 commit 86beea5
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 50 deletions.
2 changes: 1 addition & 1 deletion karavan-core/src/core/model/CamelDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ export class BeanConstructorsDefinition extends CamelElement {
}

export class BeanPropertiesDefinition extends CamelElement {
stepName?: string = 'beanProperties';
stepName?: string = 'properties';
property?: BeanPropertyDefinition[] = [];
public constructor(init?: Partial<BeanPropertiesDefinition>) {
super('BeanPropertiesDefinition');
Expand Down
300 changes: 257 additions & 43 deletions karavan-core/src/core/model/CamelMetadata.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions karavan-core/test/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ spec:
from:
uri: kamelet:http-secured-source
steps:
- do-try:
- doTry:
steps:
- to: "log:when-a"
- to: "log:when-b"
do-catch:
doCatch:
- exception:
- "java.io.FileNotFoundException"
- "java.io.IOException"
on-when:
onWhen:
expression:
simple: "${body.size()} == 1"
steps:
Expand Down
2 changes: 1 addition & 1 deletion karavan-core/test/errorHandler1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
id: errorHandler-1
deadLetterChannel:
deadLetterUri: log:dlq
level: TRACE
useOriginalMessage: true
level: TRACE
id: deadLetterChannel-1
id: routeConfiguration-1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ protected String getStepNameForClass (String className) {
className = "toD";
} else if (className.equals("SamplingDefinition")) {
className = "sample";
} else if (className.equals("BeanPropertiesDefinition")) {
className = "properties";
} else if (className.endsWith("Definition")) {
className = className.substring(0, className.length() - 10);
} else if (className.endsWith("DataFormat")){
Expand Down Expand Up @@ -373,7 +375,6 @@ protected Map<String, String> getProcessorStepNameMapForArray(JsonArray jsonArra
protected Map<String, String> getProcessorStepNameMap() {
String camelYamlDSL = getCamelYamlDSL();
JsonObject definitions = new JsonObject(camelYamlDSL);

return new LinkedHashMap<>(getProcessorStepNameMapForObject(null, definitions));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ private String getMetadataCode(String className, Map<String, JsonObject> classPr
code.append(String.format("export const %s: ElementMeta[] = [\n", className));
classProps.entrySet().stream().filter(entry -> {
if (entry.getValue() == null) {
// System.out.println(entry.getKey());
return false;
} else {
return true;
}
}).forEach(entry -> {
String name = entry.getKey();
JsonObject properties = entry.getValue();
String stepName = stepNames.get(name);
String stepName = getStepNameForClass(name);
String json = folder.equals("model") ? getMetaModel(stepName) : (folder.equals("language") ? getMetaLanguage(stepName) : getMetaDataFormat(stepName));
if (json != null) {
JsonObject model = new JsonObject(json).getJsonObject("model");
Expand Down

0 comments on commit 86beea5

Please sign in to comment.