diff --git a/README.md b/README.md index f370a014f..516a5da47 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,18 @@ For more information and all configuration properties, see [Quarkus OpenTelemetr For proper functionality with the Kaoto-ui, it is necessary to set `quarkus.http.cors.origins` configuration property with Kaoto-ui URL(s). For more information and all configuration properties, see [Quarkus HTTP Reference](https://quarkus.io/guides/http-reference#quarkus-vertx-http-config-group-cors-cors-config_configuration) > **_NOTE:_** When you run Kaoto-backend in the dev mode, all origins are accepted. (`origins: /.*/`) - + +### Steps catalog resources + +**Actual versions of resources:** +* Kaoto camel components: **94ef243f574ad42b85dafe59b3d36858c47fcd38** +* Kaoto view definitions: **94aae37dee4356d51ac34bfb757eb43a85ad2c0a** +* Camel-connectors: **3.21.0** +* Camel-connectors: **3.21.0** + +#### Updating step resources +The repository contains steps repositories zip files which are bundled with Kaoto-backend during building. +For upgrading those resources, run `update-resources.sh` script. ## Developing Kaoto @@ -65,8 +76,8 @@ The API static swagger documentation is on https://kaotoio.github.io/kaoto-back You have to install in your machine -* Maven >= 3.6 -* JDK >= 17 +* Maven >= 3.6 +* JDK >= 17 ### Building diff --git a/api/src/main/resources/camel-kamelets-3.21.0.jar b/api/src/main/resources/camel-kamelets-3.21.0.jar index 97fc4ddda..5770d89e3 100644 Binary files a/api/src/main/resources/camel-kamelets-3.21.0.jar and b/api/src/main/resources/camel-kamelets-3.21.0.jar differ diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index d76062309..99d96deb9 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -2,17 +2,13 @@ repository: step: jar: - - url: "https://repo1.maven.org/maven2/org/apache/camel/kamelets/camel-kamelets/3.21.0/camel-kamelets-3.21.0.jar" + url: "resource://camel-kamelets-3.21.0.jar" if-no-cluster: false - url: "resource://camel-connectors-3.21.0.zip" - git: - - - url: "https://github.com/KaotoIO/camel-component-metadata.git" + - url: "resource://camel-component-metadata.zip" viewdefinition: - git: - - - url: "https://github.com/KaotoIO/kaoto-viewdefinition-catalog.git" - tag: "main" + jar: + - url: "resource://view-definition.zip" crd: default: "KameletBinding" diff --git a/camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json b/camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json index 3b99e95f2..7f8aeca90 100644 --- a/camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json +++ b/camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json @@ -313,14 +313,20 @@ "dead-letter-channel" : { "$ref" : "#/items/definitions/org.apache.camel.model.errorhandler.DeadLetterChannelDefinition" }, - "log" : { + "default-error-handler" : { "$ref" : "#/items/definitions/org.apache.camel.model.errorhandler.DefaultErrorHandlerDefinition" }, - "none" : { + "jta-transaction-error-handler" : { + "$ref" : "#/items/definitions/org.apache.camel.model.errorhandler.JtaTransactionErrorHandlerDefinition" + }, + "no-error-handler" : { "$ref" : "#/items/definitions/org.apache.camel.model.errorhandler.NoErrorHandlerDefinition" }, - "ref" : { - "type" : "string" + "ref-error-handler" : { + "$ref" : "#/items/definitions/org.apache.camel.model.errorhandler.RefErrorHandlerDefinition" + }, + "spring-transaction-error-handler" : { + "$ref" : "#/items/definitions/org.apache.camel.model.errorhandler.SpringTransactionErrorHandlerDefinition" } } }, @@ -447,6 +453,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "discard-on-aggregation-failure" : { "type" : "boolean" }, @@ -504,6 +513,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -529,6 +541,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "exception" : { "type" : "array", "items" : { @@ -558,6 +573,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -593,6 +611,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "fault-tolerance-configuration" : { "$ref" : "#/items/definitions/org.apache.camel.model.FaultToleranceConfigurationDefinition" }, @@ -628,6 +649,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "filter" : { "type" : "string" }, @@ -679,6 +703,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -718,6 +745,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -759,6 +789,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -803,6 +836,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -876,6 +912,9 @@ "jq" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.JqExpression" }, + "js" : { + "$ref" : "#/items/definitions/org.apache.camel.model.language.JavaScriptExpression" + }, "jsonpath" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.JsonPathExpression" }, @@ -973,6 +1012,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -999,6 +1041,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1072,6 +1117,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "eager" : { "type" : "boolean" }, @@ -1111,6 +1159,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1136,6 +1187,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1176,6 +1230,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1199,6 +1256,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1229,6 +1289,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1285,6 +1348,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "failover" : { "$ref" : "#/items/definitions/org.apache.camel.model.loadbalancer.FailoverLoadBalancerDefinition" }, @@ -1326,6 +1392,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1367,6 +1436,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "do-while" : { "type" : "boolean" }, @@ -1423,6 +1495,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "fhir-json" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.FhirJsonDataFormat" }, @@ -1480,6 +1555,12 @@ "soap" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SoapDataFormat" }, + "swift-mt" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMtDataFormat" + }, + "swift-mx" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMxDataFormat" + }, "syslog" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SyslogDataFormat" }, @@ -1533,6 +1614,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -1566,6 +1650,9 @@ "streaming" : { "type" : "boolean" }, + "synchronous" : { + "type" : "boolean" + }, "timeout" : { "type" : "string" } @@ -1577,6 +1664,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -1622,6 +1712,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "exception" : { "type" : "array", "items" : { @@ -1675,6 +1768,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "fallback-via-network" : { "type" : "boolean" }, @@ -1718,6 +1814,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1738,6 +1837,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1802,6 +1904,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1820,6 +1925,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1840,6 +1948,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1882,6 +1993,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -1905,6 +2019,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -1965,6 +2082,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -1998,6 +2118,9 @@ "streaming" : { "type" : "boolean" }, + "synchronous" : { + "type" : "boolean" + }, "timeout" : { "type" : "string" } @@ -2092,6 +2215,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2114,6 +2240,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "exclude-pattern" : { "type" : "string" }, @@ -2139,6 +2268,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "exclude-pattern" : { "type" : "string" }, @@ -2164,6 +2296,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2189,6 +2324,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2277,6 +2415,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2301,6 +2442,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2349,52 +2493,48 @@ "required" : [ "ref" ] }, "org.apache.camel.model.RouteConfigurationDefinition" : { - "oneOf" : [ { - "type" : "string" - }, { - "type" : "object", - "properties" : { - "error-handler" : { - "$ref" : "#/items/definitions/org.apache.camel.model.ErrorHandlerDefinition" - }, - "id" : { - "type" : "string" - }, - "intercept" : { - "type" : "array", - "items" : { - "$ref" : "#/items/definitions/org.apache.camel.model.InterceptDefinition" - } - }, - "intercept-from" : { - "type" : "array", - "items" : { - "$ref" : "#/items/definitions/org.apache.camel.model.InterceptFromDefinition" - } - }, - "intercept-send-to-endpoint" : { - "type" : "array", - "items" : { - "$ref" : "#/items/definitions/org.apache.camel.model.InterceptSendToEndpointDefinition" - } - }, - "on-completion" : { - "type" : "array", - "items" : { - "$ref" : "#/items/definitions/org.apache.camel.model.OnCompletionDefinition" - } - }, - "on-exception" : { - "type" : "array", - "items" : { - "$ref" : "#/items/definitions/org.apache.camel.model.OnExceptionDefinition" - } - }, - "precondition" : { - "type" : "string" + "type" : "object", + "properties" : { + "error-handler" : { + "$ref" : "#/items/definitions/org.apache.camel.model.ErrorHandlerDefinition" + }, + "id" : { + "type" : "string" + }, + "intercept" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.InterceptDefinition" + } + }, + "intercept-from" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.InterceptFromDefinition" + } + }, + "intercept-send-to-endpoint" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.InterceptSendToEndpointDefinition" } + }, + "on-completion" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.OnCompletionDefinition" + } + }, + "on-exception" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.OnExceptionDefinition" + } + }, + "precondition" : { + "type" : "string" } - } ] + } }, "org.apache.camel.model.RouteContextRefDefinition" : { "oneOf" : [ { @@ -2433,6 +2573,9 @@ "message-history" : { "type" : "boolean" }, + "node-prefix-id" : { + "type" : "string" + }, "precondition" : { "type" : "string" }, @@ -2487,7 +2630,7 @@ "beans" : { "type" : "array", "items" : { - "$ref" : "#/items/definitions/org.apache.camel.dsl.yaml.deserializers.NamedBeanDefinition" + "$ref" : "#/items/definitions/org.apache.camel.model.RouteTemplateBeanDefinition" } }, "from" : { @@ -2538,6 +2681,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2568,6 +2714,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2600,6 +2749,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2639,6 +2791,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2663,6 +2818,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2683,6 +2841,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2703,6 +2864,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2726,6 +2890,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2750,6 +2917,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2777,6 +2947,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -2809,6 +2982,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -2845,6 +3021,9 @@ "streaming" : { "type" : "boolean" }, + "synchronous" : { + "type" : "boolean" + }, "timeout" : { "type" : "string" } @@ -2856,6 +3035,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2876,6 +3058,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -2917,7 +3102,7 @@ "beans" : { "type" : "array", "items" : { - "$ref" : "#/items/definitions/org.apache.camel.dsl.yaml.deserializers.NamedBeanDefinition" + "$ref" : "#/items/definitions/org.apache.camel.model.TemplatedRouteBeanDefinition" } }, "parameters" : { @@ -2926,6 +3111,9 @@ "$ref" : "#/items/definitions/org.apache.camel.model.TemplatedRouteParameterDefinition" } }, + "prefix-id" : { + "type" : "string" + }, "route-id" : { "type" : "string" }, @@ -2996,6 +3184,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -3048,6 +3239,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "executor-service" : { "type" : "string" }, @@ -3074,6 +3268,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "exception-type" : { "type" : "string" }, @@ -3100,6 +3297,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -3138,6 +3338,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -3167,6 +3370,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "id" : { "type" : "string" }, @@ -3193,6 +3399,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -3210,6 +3419,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "do-catch" : { "type" : "array", "items" : { @@ -3272,6 +3484,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "fhir-json" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.FhirJsonDataFormat" }, @@ -3329,6 +3544,12 @@ "soap" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SoapDataFormat" }, + "swift-mt" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMtDataFormat" + }, + "swift-mx" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMxDataFormat" + }, "syslog" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SyslogDataFormat" }, @@ -3376,6 +3597,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -3390,6 +3614,18 @@ } } }, + "org.apache.camel.model.ValueDefinition" : { + "oneOf" : [ { + "type" : "string" + }, { + "type" : "object", + "properties" : { + "value" : { + "type" : "string" + } + } + } ] + }, "org.apache.camel.model.WhenDefinition" : { "type" : "object", "anyOf" : [ { @@ -3399,6 +3635,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -3425,6 +3664,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "expression" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.ExpressionDefinition" }, @@ -3460,6 +3702,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "dynamic-uri" : { "type" : "boolean" }, @@ -3905,6 +4150,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "dns-service-discovery" : { "$ref" : "#/items/definitions/org.apache.camel.model.cloud.DnsServiceCallServiceDiscoveryConfiguration" }, @@ -4603,6 +4851,12 @@ "soap" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SoapDataFormat" }, + "swift-mt" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMtDataFormat" + }, + "swift-mx" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMxDataFormat" + }, "syslog" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SyslogDataFormat" }, @@ -4648,30 +4902,27 @@ "type" : "boolean" }, "dont-encode-elements" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string" }, "dont-strip-versions-from-references-at-paths" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string" }, "encode-elements" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string" }, "encode-elements-applies-to-child-resources-only" : { "type" : "boolean" }, + "fhir-context" : { + "type" : "string" + }, "fhir-version" : { "type" : "string", "enum" : [ "DSTU2", "DSTU2_HL7ORG", "DSTU2_1", "DSTU3", "R4", "R5" ] }, + "force-resource-id" : { + "type" : "string" + }, "id" : { "type" : "string" }, @@ -4681,6 +4932,15 @@ "override-resource-id-with-bundle-entry-full-url" : { "type" : "boolean" }, + "parser-error-handler" : { + "type" : "string" + }, + "parser-options" : { + "type" : "string" + }, + "prefer-types" : { + "type" : "string" + }, "pretty-print" : { "type" : "boolean" }, @@ -4705,30 +4965,27 @@ "type" : "boolean" }, "dont-encode-elements" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string" }, "dont-strip-versions-from-references-at-paths" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string" }, "encode-elements" : { - "type" : "array", - "items" : { - "type" : "string" - } + "type" : "string" }, "encode-elements-applies-to-child-resources-only" : { "type" : "boolean" }, + "fhir-context" : { + "type" : "string" + }, "fhir-version" : { "type" : "string", "enum" : [ "DSTU2", "DSTU2_HL7ORG", "DSTU2_1", "DSTU3", "R4", "R5" ] }, + "force-resource-id" : { + "type" : "string" + }, "id" : { "type" : "string" }, @@ -4738,6 +4995,15 @@ "override-resource-id-with-bundle-entry-full-url" : { "type" : "boolean" }, + "parser-error-handler" : { + "type" : "string" + }, + "parser-options" : { + "type" : "string" + }, + "prefer-types" : { + "type" : "string" + }, "pretty-print" : { "type" : "boolean" }, @@ -4897,6 +5163,9 @@ "org.apache.camel.model.dataformat.JaxbDataFormat" : { "type" : "object", "properties" : { + "access-external-schema-protocols" : { + "type" : "string" + }, "content-type-header" : { "type" : "boolean" }, @@ -4964,6 +5233,9 @@ "org.apache.camel.model.dataformat.JsonApiDataFormat" : { "type" : "object", "properties" : { + "data-format-types" : { + "type" : "string" + }, "id" : { "type" : "string" }, @@ -4993,6 +5265,9 @@ "content-type-header" : { "type" : "boolean" }, + "date-format-pattern" : { + "type" : "string" + }, "disable-features" : { "type" : "string" }, @@ -5251,6 +5526,41 @@ } ], "required" : [ "context-path" ] }, + "org.apache.camel.model.dataformat.SwiftMtDataFormat" : { + "oneOf" : [ { + "type" : "string" + }, { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" + }, + "write-in-json" : { + "type" : "boolean" + } + } + } ] + }, + "org.apache.camel.model.dataformat.SwiftMxDataFormat" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" + }, + "read-config-ref" : { + "type" : "string" + }, + "read-message-id" : { + "type" : "string" + }, + "write-config-ref" : { + "type" : "string" + }, + "write-in-json" : { + "type" : "boolean" + } + } + }, "org.apache.camel.model.dataformat.SyslogDataFormat" : { "type" : "object", "properties" : { @@ -5801,18 +6111,6 @@ } } }, - "org.apache.camel.model.errorhandler.ErrorHandlerRefDefinition" : { - "type" : "object", - "properties" : { - "id" : { - "type" : "string" - }, - "ref" : { - "type" : "string" - } - }, - "required" : [ "ref" ] - }, "org.apache.camel.model.errorhandler.JtaTransactionErrorHandlerDefinition" : { "type" : "object", "properties" : { @@ -5873,6 +6171,22 @@ } } }, + "org.apache.camel.model.errorhandler.RefErrorHandlerDefinition" : { + "oneOf" : [ { + "type" : "string" + }, { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" + }, + "ref" : { + "type" : "string" + } + } + } ], + "required" : [ "ref" ] + }, "org.apache.camel.model.errorhandler.SpringTransactionErrorHandlerDefinition" : { "type" : "object", "properties" : { @@ -6049,6 +6363,9 @@ "jq" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.JqExpression" }, + "js" : { + "$ref" : "#/items/definitions/org.apache.camel.model.language.JavaScriptExpression" + }, "jsonpath" : { "$ref" : "#/items/definitions/org.apache.camel.model.language.JsonPathExpression" }, @@ -6102,6 +6419,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6129,6 +6449,34 @@ "required" : [ "expression" ] }, "org.apache.camel.model.language.Hl7TerserExpression" : { + "oneOf" : [ { + "type" : "string" + }, { + "type" : "object", + "properties" : { + "expression" : { + "type" : "string" + }, + "header-name" : { + "type" : "string" + }, + "id" : { + "type" : "string" + }, + "property-name" : { + "type" : "string" + }, + "result-type" : { + "type" : "string" + }, + "trim" : { + "type" : "boolean" + } + } + } ], + "required" : [ "expression" ] + }, + "org.apache.camel.model.language.JavaScriptExpression" : { "oneOf" : [ { "type" : "string" }, { @@ -6140,6 +6488,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6190,6 +6541,9 @@ "id" : { "type" : "string" }, + "property-name" : { + "type" : "string" + }, "result-type" : { "type" : "string" }, @@ -6225,6 +6579,9 @@ "type" : "string", "enum" : [ "DEFAULT_PATH_LEAF_TO_NULL", "ALWAYS_RETURN_LIST", "AS_PATH_LIST", "SUPPRESS_EXCEPTIONS", "REQUIRE_PROPERTIES" ] }, + "property-name" : { + "type" : "string" + }, "result-type" : { "type" : "string" }, @@ -6234,6 +6591,9 @@ "trim" : { "type" : "boolean" }, + "unpack-array" : { + "type" : "boolean" + }, "write-as-string" : { "type" : "boolean" } @@ -6277,6 +6637,9 @@ "ref" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "scope" : { "type" : "string", "enum" : [ "Singleton", "Request", "Prototype" ] @@ -6299,6 +6662,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6318,6 +6684,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6337,6 +6706,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6356,6 +6728,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6397,6 +6772,9 @@ "id" : { "type" : "string" }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } @@ -6431,6 +6809,9 @@ "inherit-namespace-tag-name" : { "type" : "string" }, + "property-name" : { + "type" : "string" + }, "regex" : { "type" : "boolean" }, @@ -6456,6 +6837,9 @@ }, { "type" : "object", "properties" : { + "expression" : { + "type" : "string" + }, "group" : { "type" : "number" }, @@ -6475,11 +6859,15 @@ "$ref" : "#/items/definitions/org.apache.camel.model.PropertyDefinition" } }, + "property-name" : { + "type" : "string" + }, "trim" : { "type" : "boolean" } } - } ] + } ], + "required" : [ "expression" ] }, "org.apache.camel.model.language.XPathExpression" : { "oneOf" : [ { @@ -6517,6 +6905,9 @@ "pre-compile" : { "type" : "boolean" }, + "property-name" : { + "type" : "string" + }, "result-type" : { "type" : "string", "enum" : [ "NUMBER", "STRING", "BOOLEAN", "NODESET", "NODE" ] @@ -6558,6 +6949,12 @@ "$ref" : "#/items/definitions/org.apache.camel.model.PropertyDefinition" } }, + "property-name" : { + "type" : "string" + }, + "result-type" : { + "type" : "string" + }, "trim" : { "type" : "boolean" }, @@ -6733,6 +7130,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -6802,6 +7202,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -6871,6 +7274,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -6979,6 +7385,12 @@ "org.apache.camel.model.rest.ParamDefinition" : { "type" : "object", "properties" : { + "allowable-values" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.ValueDefinition" + } + }, "array-type" : { "type" : "string" }, @@ -7013,12 +7425,6 @@ "type" : { "type" : "string", "enum" : [ "body", "formData", "header", "path", "query" ] - }, - "value" : { - "type" : "array", - "items" : { - "type" : "string" - } } }, "required" : [ "name", "type" ] @@ -7045,6 +7451,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -7114,6 +7523,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -7183,6 +7595,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -7233,6 +7648,12 @@ "org.apache.camel.model.rest.ResponseHeaderDefinition" : { "type" : "object", "properties" : { + "allowable-values" : { + "type" : "array", + "items" : { + "$ref" : "#/items/definitions/org.apache.camel.model.ValueDefinition" + } + }, "array-type" : { "type" : "string" }, @@ -7254,12 +7675,6 @@ }, "name" : { "type" : "string" - }, - "value" : { - "type" : "array", - "items" : { - "type" : "string" - } } }, "required" : [ "name" ] @@ -7340,6 +7755,9 @@ "api-context-path" : { "type" : "string" }, + "api-context-route-id" : { + "type" : "string" + }, "api-host" : { "type" : "string" }, @@ -7461,6 +7879,9 @@ "description" : { "type" : "string" }, + "disabled" : { + "type" : "boolean" + }, "enable-cors" : { "type" : "boolean" }, @@ -7694,6 +8115,12 @@ "soap" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SoapDataFormat" }, + "swift-mt" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMtDataFormat" + }, + "swift-mx" : { + "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SwiftMxDataFormat" + }, "syslog" : { "$ref" : "#/items/definitions/org.apache.camel.model.dataformat.SyslogDataFormat" }, @@ -7842,6 +8269,12 @@ "onException" : { "$ref" : "#/items/definitions/org.apache.camel.model.OnExceptionDefinition" }, + "route-configuration" : { + "$ref" : "#/items/definitions/org.apache.camel.model.RouteConfigurationDefinition" + }, + "routeConfiguration" : { + "$ref" : "#/items/definitions/org.apache.camel.model.RouteConfigurationDefinition" + }, "route" : { "$ref" : "#/items/definitions/org.apache.camel.model.RouteDefinition" }, diff --git a/camel-support/src/test/java/io/kaoto/backend/api/metadata/catalog/StepCatalogTest.java b/camel-support/src/test/java/io/kaoto/backend/api/metadata/catalog/StepCatalogTest.java new file mode 100644 index 000000000..4f61c4088 --- /dev/null +++ b/camel-support/src/test/java/io/kaoto/backend/api/metadata/catalog/StepCatalogTest.java @@ -0,0 +1,87 @@ +package io.kaoto.backend.api.metadata.catalog; + +import io.fabric8.kubernetes.client.KubernetesClient; +import io.kaoto.backend.model.configuration.Repository; +import io.kaoto.backend.model.step.Step; +import io.quarkus.test.junit.QuarkusTest; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.ValueSource; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +import static org.assertj.core.api.Assertions.assertThat; + +@QuarkusTest +public class StepCatalogTest { + @Inject + private Instance stepCatalogParsers; + @Inject + private KubernetesClient kclient; + @Inject + private StepCatalog mainStepCatalog; + + @ParameterizedTest + @CsvSource({"https://github.com/KaotoIO/camel-component-metadata.git,test-202308", + "https://github.com/apache/camel-kamelets.git,v3.21.0"}) + void testParseFromGit(String repo, String tag) { + StepRepository stepRepository = new StepRepository( + Optional.empty(), + Optional.of(List.of( + new GitRepository(repo, tag, true, "all"))), + Optional.empty()); + tryLoadSteps(stepRepository, repo + ":" + tag); + } + + @ParameterizedTest + @ValueSource(strings = { + "https://github.com/KaotoIO/camel-component-metadata/archive/refs/tags/test-202308.zip", + "https://repo1.maven.org/maven2/org/apache/camel/kamelets/camel-kamelets/3.21.0/camel-kamelets-3.21.0.jar", + "resource://camel-component-metadata.zip", + "resource://camel-kamelets-3.21.0.jar", + "resource://camel-connectors-3.21.0.zip" + }) + void testParseFromFile(String resource) { + StepRepository stepRepository = new StepRepository( + Optional.of(List.of( + new LocationRepository(resource, true, "all"))), + Optional.empty(), + Optional.empty()); + tryLoadSteps(stepRepository, resource); + } + + private void tryLoadSteps(StepRepository stepRepository, String resource) { + StepCatalog anotherStepCatalog = new StepCatalog(); + anotherStepCatalog.setStepCatalogParsers(stepCatalogParsers); + anotherStepCatalog.setKclient(kclient); + anotherStepCatalog.setRepository(stepRepository); + anotherStepCatalog.loadParsers(); + anotherStepCatalog.warmUpCatalog(); + Collection steps = anotherStepCatalog.getReadOnlyCatalog().getAll(); + assertThat(steps) + .isNotEmpty() + .as("Test that more than 50 steps was loaded from resource: " + resource) + .hasSizeGreaterThan(50) + .as("Test that catalog contains steps only from resource '" + resource + + "' and not from different resources.") + .hasSizeLessThan(mainStepCatalog.getReadOnlyCatalog().getAll().size()); + } + + + // GitRepository implementation used for testing + private record GitRepository(String url, String tag, boolean ifNoCluster, String kind) implements Repository.Git { + } + + // LocationRepository implementation used for testing + private record LocationRepository(String url, boolean ifNoCluster, String kind) implements Repository.Location { + } + + // StepRepository implementation used for testing + private record StepRepository(Optional> jar, Optional> git, + Optional> localFolder) implements StepCatalog.StepRepository { + } +} diff --git a/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/camelroute/CamelRouteParseCatalogTest.java b/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/camelroute/CamelRouteParseCatalogTest.java index 52be1f5f3..a6a306740 100644 --- a/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/camelroute/CamelRouteParseCatalogTest.java +++ b/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/camelroute/CamelRouteParseCatalogTest.java @@ -29,7 +29,7 @@ @QuarkusTest class CamelRouteParseCatalogTest { - public static final String CAMEL_ZIP = "resource://camel-3.19.0.zip"; + public static final String CAMEL_ZIP = "resource://camel-connectors-3.21.0.zip"; @Inject public void setParseCatalog(final CamelRouteParseCatalog parseCatalog) { diff --git a/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/kamelet/KameletParseCatalogTest.java b/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/kamelet/KameletParseCatalogTest.java index 14169b8e9..06f9ac15a 100644 --- a/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/kamelet/KameletParseCatalogTest.java +++ b/camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/kamelet/KameletParseCatalogTest.java @@ -18,6 +18,7 @@ import org.jboss.logging.Logger; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import io.fabric8.kubernetes.client.KubernetesClient; @@ -38,7 +39,9 @@ @WithKubernetesTestServer class KameletParseCatalogTest { - private static final String FILE_NAME = "camel-kamelets-3.21.0.jar"; + private static final String FILE_NAME = "camel-kamelets-%s.jar"; + + private static final String VERSION = "3.21.0"; private static final Logger LOG = Logger.getLogger(KameletParseCatalogTest.class); @@ -69,7 +72,7 @@ void cleanUp() { @Test void getSteps() { ParseCatalog kameletParser = - parseCatalog.getParser("https://github.com/apache/camel-kamelets.git", "v3.21.0"); + parseCatalog.getParser("https://github.com/apache/camel-kamelets.git", "v" + VERSION); InMemoryCatalog catalog = new InMemoryCatalog<>(); List steps = kameletParser.parse().join(); @@ -192,11 +195,11 @@ void testClusterWithWholeKamelets() { void compareJarAndGit() { ParseCatalog kameletParserGit = - parseCatalog.getParser("https://github.com/apache/camel-kamelets.git", "v3.21.0"); + parseCatalog.getParser("https://github.com/apache/camel-kamelets.git", "v" + VERSION); List stepsGit = kameletParserGit.parse().join(); String jarUrl = "https://repo1.maven.org/maven2/org/apache/camel/" - + "kamelets/camel-kamelets/3.21.0/" + FILE_NAME; + + "kamelets/camel-kamelets/" + VERSION + "/" + getFileName(); ParseCatalog kameletParserJar = parseCatalog.getParser( @@ -213,7 +216,7 @@ void compareJarAndGit() { @Test void loadFromLocalZip() { - String camelZip = "resource://" + FILE_NAME; + String camelZip = "resource://" + getFileName(); InMemoryCatalog catalog = new InMemoryCatalog<>(); ParseCatalog camelParser = parseCatalog.getParser(camelZip); @@ -233,7 +236,7 @@ void loadFromLocalZip() { @Test // @Timeout(value = 200, unit = TimeUnit.MILLISECONDS) void testSpeed() { - String camelZip = "resource://" + FILE_NAME; + String camelZip = "resource://" + getFileName(); InMemoryCatalog catalog = new InMemoryCatalog<>(); ParseCatalog camelParser = parseCatalog.getParser(camelZip); List steps = camelParser.parse().join(); @@ -243,7 +246,7 @@ void testSpeed() { public int loadAllKameletsFromResourcesIntoCluster() { int loadedResources = 0; try (ZipInputStream zis = new ZipInputStream( - Objects.requireNonNull(this.getClass().getResourceAsStream("/" + FILE_NAME)))) { + Objects.requireNonNull(this.getClass().getResourceAsStream("/" + getFileName())))) { ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { if (zipEntry.getName().contains("kamelets/") && zipEntry.getName().contains(".yaml")) { @@ -263,4 +266,8 @@ public int loadAllKameletsFromResourcesIntoCluster() { } return loadedResources; } + + private static String getFileName() { + return String.format(FILE_NAME, VERSION); + } } diff --git a/camel-support/src/test/java/io/kaoto/backend/camel/service/step/parser/kamelet/KameletStepParserServiceTest.java b/camel-support/src/test/java/io/kaoto/backend/camel/service/step/parser/kamelet/KameletStepParserServiceTest.java index 5d1b3735f..3d88b46b3 100644 --- a/camel-support/src/test/java/io/kaoto/backend/camel/service/step/parser/kamelet/KameletStepParserServiceTest.java +++ b/camel-support/src/test/java/io/kaoto/backend/camel/service/step/parser/kamelet/KameletStepParserServiceTest.java @@ -39,6 +39,8 @@ @QuarkusTest class KameletStepParserServiceTest { + private static final String VERSION = "3.21.0"; + private static String kamelet; private static String incomplete; private static String beansKamelet; @@ -76,7 +78,7 @@ void ensureCatalog() { if (catalog.getReadOnlyCatalog().searchByID("log-producer") == null) { String camelGit = "https://github.com/apache/camel/" - + "archive/refs/tags/camel-3.18.2.zip"; + + "archive/refs/tags/camel-" + VERSION + ".zip"; ParseCatalog camelParser = parseCatalog.getParser(camelGit); List steps = camelParser.parse().join(); diff --git a/camel-support/src/test/resources/application.yaml b/camel-support/src/test/resources/application.yaml index bf80a6cb6..92168497e 100644 --- a/camel-support/src/test/resources/application.yaml +++ b/camel-support/src/test/resources/application.yaml @@ -1,12 +1,9 @@ repository: step: jar: - - url: "https://repo1.maven.org/maven2/org/apache/camel/kamelets/camel-kamelets/3.21.0/camel-kamelets-3.21.0.jar" - - url: "resource://camel-3.19.0.zip" - git: - - - url: "https://github.com/KaotoIO/camel-component-metadata.git" - tag: "main" + - url: "resource://camel-kamelets-3.21.0.jar" + - url: "resource://camel-connectors-3.21.0.zip" + - url: "resource://camel-component-metadata.zip" viewdefinition: jar: - - url: "https://github.com/KaotoIO/kaoto-viewdefinition-catalog/archive/refs/tags/test.zip" + - url: "resource://view-definition.zip" diff --git a/camel-support/src/test/resources/camel-3.19.0.zip b/camel-support/src/test/resources/camel-3.19.0.zip deleted file mode 100644 index 0964692b3..000000000 Binary files a/camel-support/src/test/resources/camel-3.19.0.zip and /dev/null differ diff --git a/camel-support/src/test/resources/camel-component-metadata.zip b/camel-support/src/test/resources/camel-component-metadata.zip new file mode 100644 index 000000000..4df229dc1 Binary files /dev/null and b/camel-support/src/test/resources/camel-component-metadata.zip differ diff --git a/camel-support/src/test/resources/camel-connectors-3.21.0.zip b/camel-support/src/test/resources/camel-connectors-3.21.0.zip new file mode 100644 index 000000000..d13a6c3cf Binary files /dev/null and b/camel-support/src/test/resources/camel-connectors-3.21.0.zip differ diff --git a/camel-support/src/test/resources/camel-kamelets-3.21.0.jar b/camel-support/src/test/resources/camel-kamelets-3.21.0.jar index 97fc4ddda..5770d89e3 100644 Binary files a/camel-support/src/test/resources/camel-kamelets-3.21.0.jar and b/camel-support/src/test/resources/camel-kamelets-3.21.0.jar differ diff --git a/camel-support/src/test/resources/view-definition.zip b/camel-support/src/test/resources/view-definition.zip new file mode 100644 index 000000000..b76a29e78 Binary files /dev/null and b/camel-support/src/test/resources/view-definition.zip differ diff --git a/catalog/pom.xml b/catalog/pom.xml index cdad365f2..d31d255a9 100644 --- a/catalog/pom.xml +++ b/catalog/pom.xml @@ -24,5 +24,11 @@ quarkus-junit5 test + + org.assertj + assertj-core + test + + diff --git a/catalog/src/test/java/io/kaoto/backend/api/metadata/catalog/ViewDefinitionCatalogTest.java b/catalog/src/test/java/io/kaoto/backend/api/metadata/catalog/ViewDefinitionCatalogTest.java new file mode 100644 index 000000000..c4c90c664 --- /dev/null +++ b/catalog/src/test/java/io/kaoto/backend/api/metadata/catalog/ViewDefinitionCatalogTest.java @@ -0,0 +1,65 @@ +package io.kaoto.backend.api.metadata.catalog; + +import io.kaoto.backend.model.configuration.Repository; +import io.kaoto.backend.model.view.ViewDefinition; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +@QuarkusTest +public class ViewDefinitionCatalogTest { + + private static final String REPO = "https://github.com/KaotoIO/kaoto-viewdefinition-catalog"; + private static final String TAG = "test-202308"; + private static final int EXPECTED_VIEW_DEFINITIONS = 13; + + + @Test + void testParseFromGit() { + ViewDefinitionRepository stepRepository = new ViewDefinitionRepository( + Optional.empty(), + Optional.of(List.of( + new GitRepository(REPO + ".git", TAG, true, "all"))), + Optional.empty()); + tryLoadViewDefinitions(stepRepository); + } + + @Test + void testParseFromFile() { + ViewDefinitionRepository stepRepository = new ViewDefinitionRepository( + Optional.of(List.of(new LocationRepository(REPO + "/archive/refs/tags/" + TAG + ".zip", true, "all"))), + Optional.empty(), Optional.empty()); + tryLoadViewDefinitions(stepRepository); + } + + private void tryLoadViewDefinitions(ViewDefinitionRepository viewDefinitionRepository) { + ViewDefinitionCatalog viewDefinitionCatalog = new ViewDefinitionCatalog(); + viewDefinitionCatalog.setRepository(viewDefinitionRepository); + viewDefinitionCatalog.loadParsers(); + viewDefinitionCatalog.warmUpCatalog(); + Collection allViews = viewDefinitionCatalog.getReadOnlyCatalog().getAll(); + assertThat(allViews) + .isNotEmpty() + .hasSize(EXPECTED_VIEW_DEFINITIONS); + } + + // GitRepository implementation used for testing + private record GitRepository(String url, String tag, boolean ifNoCluster, String kind) implements Repository.Git { + } + + // LocationRepository implementation used for testing + private record LocationRepository(String url, boolean ifNoCluster, String kind) implements Repository.Location { + } + + // StepRepository implementation used for testing + private record ViewDefinitionRepository(Optional> jar, Optional> git, + Optional> localFolder) + implements ViewDefinitionCatalog.ViewDefinitionRepository { + } + +} diff --git a/catalog/src/test/resources/application.properties b/catalog/src/test/resources/application.properties new file mode 100644 index 000000000..bce034af1 --- /dev/null +++ b/catalog/src/test/resources/application.properties @@ -0,0 +1,7 @@ +quarkus.http.test-port=8085 +quarkus.http.test-ssl-port=8445 +quarkus.log.level=INFO +quarkus.log.min-level=TRACE +quarkus.log.category."io.kaoto.backend".level=TRACE +quarkus.jacoco.title=Kaoto Backend Catalog Coverage +quarkus.kubernetes-client.devservices.enabled=false diff --git a/update-resources.sh b/update-resources.sh new file mode 100644 index 000000000..a91798097 --- /dev/null +++ b/update-resources.sh @@ -0,0 +1,163 @@ +#!/bin/bash + +echo "MAKE SURE YOU ARE ON LATEST MAIN" + +echo "Do you want to download the latest zip of Kaoto bridged camel components(main of camel-component-metadata)? (y/n)" +read -r download +path=$(pwd) +if [ "$download" = "y" ]; +then + echo "Removing old zip files" + git rm api/src/main/resources/camel-component-metadata.zip + git rm camel-support/src/test/resources/camel-component-metadata.zip + + echo "Downloading Kaoto bridged Camel components (EIP)." + wget https://github.com/KaotoIO/camel-component-metadata/archive/refs/heads/main.zip + cp "main.zip" "${path}/api/src/main/resources/camel-component-metadata.zip" + mv "main.zip" "${path}/camel-support/src/test/resources/camel-component-metadata.zip" + + git add -f api/src/main/resources/camel-component-metadata.zip + git add -f camel-support/src/test/resources/camel-component-metadata.zip + + echo "Updating version info in Readme" + commitHash=$(git ls-remote https://github.com/KaotoIO/camel-component-metadata HEAD | head -n1 | awk '{print $1;}') + sed -i 's/camel components: \*\*.*/camel components: \*\*'"$commitHash"'\*\*/g' README.md + git add README.md +fi + +echo "Do you want to download the latest Kaoto view definitions (main of kaoto-viewdefinition-catalog)? (y/n)" +read -r download +if [ "$download" = "y" ]; +then + path=$(pwd) + echo "Removing old zip files" + git rm api/src/main/resources/view-definition.zip + git rm camel-support/src/test/resources/view-definition.zip + + echo "Downloading Kaoto view definitions." + wget https://github.com/KaotoIO/kaoto-viewdefinition-catalog/archive/refs/heads/main.zip + cp "main.zip" "${path}/api/src/main/resources/view-definition.zip" + mv "main.zip" "${path}/camel-support/src/test/resources/view-definition.zip" + + git add -f api/src/main/resources/view-definition.zip + git add -f camel-support/src/test/resources/view-definition.zip + + echo "Updating version info in Readme" + commitHash=$(git ls-remote https://github.com/KaotoIO/kaoto-viewdefinition-catalog HEAD | head -n1 | awk '{print $1;}') + sed -i 's/view definitions: \*\*.*/view definitions: \*\*'"$commitHash"'\*\*/g' README.md + git add README.md +fi + +echo "Do you want to update the Apache Camel components? (y/n)" +read -r download +if [ "$download" = "y" ]; +then + echo "Downloading camel connectors." + echo "Enter camel version to use (tag in apache/camel repo):" + echo "Example: 3.21.0" + read -r versionCamel + + echo "Removing old zip files" + git rm api/src/main/resources/camel-connectors-*.jar + git rm camel-support/src/test/resources/camel-connectors-*.jar + + echo "Preparing zip file with camel component metadata" + cd /tmp || exit 1 + mkdir camel-connectors + cd camel-connectors || exit 1 + wget "https://github.com/apache/camel/archive/refs/tags/camel-${versionCamel}.zip" + unzip ./camel-"${versionCamel}".zip + cp "camel-camel-${versionCamel}/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json" "${path}/camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json" + cd "camel-camel-${versionCamel}/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/" || exit 1 + zip "camel-connectors-${versionCamel}.zip" ./*.json + + echo "Copy new zip to Kaoto-backend" + cp "camel-connectors-${versionCamel}.zip" "${path}/api/src/main/resources/" + mv "camel-connectors-${versionCamel}.zip" "${path}/camel-support/src/test/resources/" + cd "${path}" || exit 1 + + echo "Updating configurations" + git add -f "${path}/api/src/main/resources/camel-connectors-${versionCamel}.zip" + git add -f "${path}/camel-support/src/test/resources/camel-connectors-${versionCamel}.zip" + + sed -i 's/camel-connectors-.*/camel-connectors-'"$versionCamel"'.zip$"/g' api/src/main/resources/resources-config.json + sed -i 's/camel-connectors-.*/camel-connectors-'"$versionCamel"'.zip"/g' api/src/main/resources/application.yaml + sed -i 's/camel-connectors-.*/camel-connectors-'"$versionCamel"'.zip"/g' api/src/test/resources/application.yaml + sed -i 's/camel-connectors-.*/camel-connectors-'"$versionCamel"'.zip"/g' camel-support/src/test/resources/application.yaml + sed -i 's/camel-connectors-.*/camel-connectors-'"$versionCamel"'.zip";/g' camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/camelroute/CamelRouteParseCatalogTest.java + sed -i 's/VERSION = ".*/VERSION = "'"$versionCamel"'";/g' camel-support/src/test/java/io/kaoto/backend/camel/service/step/parser/kamelet/KameletStepParserServiceTest.java + + git add api/src/main/resources/resources-config.json api/src/main/resources/application.yaml \ + api/src/test/resources/application.yaml camel-support/src/test/resources/application.yaml \ + camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/camelroute/CamelRouteParseCatalogTest.java \ + camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json \ + camel-support/src/test/java/io/kaoto/backend/camel/service/step/parser/kamelet/KameletStepParserServiceTest.java + + echo "Updating version info in Readme" + sed -i 's/Camel-connectors: \*\*.*/Camel-connectors: \*\*'"$versionCamel"'\*\*/g' README.md + git add README.md + + rm -rf /tmp/camel-connectors +fi + +echo "Do you want to update the Apache Camel Kamelets? (y/n)" +read -r download +if [ "$download" = "y" ]; +then + echo "Downloading kamelets." + echo "Enter kamelets version to use (tag in apache/camel-kamelets repo):" + echo "Example: 3.21.0" + read -r versionKamelets + + echo "Removing old zip files" + git rm api/src/main/resources/camel-kamelets-*.jar + git rm camel-support/src/test/resources/camel-kamelets-*.jar + + echo "Preparing zip file with camel component metadata" + cd /tmp || exit 1 + mkdir kamelets + cd kamelets || exit 1 + wget "https://github.com/apache/camel-kamelets/archive/refs/tags/v${versionKamelets}.zip" + unzip ./v"${versionKamelets}".zip + cd "camel-kamelets-${versionKamelets}/kamelets/" || exit 1 + zip "camel-kamelets-${versionKamelets}.jar" ./* + + echo "Copy new zip to Kaoto-backend" + cp "camel-kamelets-${versionKamelets}.jar" "${path}/api/src/main/resources/" + mv "camel-kamelets-${versionKamelets}.jar" "${path}/camel-support/src/test/resources/" + cd "${path}" || exit 1 + + echo "Updating configurations" + git add -f "${path}/api/src/main/resources/camel-kamelets-${versionKamelets}.jar" + git add -f "${path}/camel-support/src/test/resources/camel-kamelets-${versionKamelets}.jar" + + sed -i 's/camel-kamelets-.*/camel-kamelets-'"$versionKamelets"'.jar$"/g' api/src/main/resources/resources-config.json + sed -i 's/camel-kamelets-.*/camel-kamelets-'"$versionKamelets"'.jar"/g' api/src/main/resources/application.yaml + sed -i 's/camel-kamelets-.*/camel-kamelets-'"$versionKamelets"'.jar"/g' api/src/test/resources/application.yaml + sed -i 's/camel-kamelets-.*/camel-kamelets-'"$versionKamelets"'.jar"/g' camel-support/src/test/resources/application.yaml + sed -i 's/VERSION = ".*/VERSION = "'"$versionKamelets"'";/g' camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/kamelet/KameletParseCatalogTest.java + + git add api/src/main/resources/resources-config.json api/src/main/resources/application.yaml \ + api/src/test/resources/application.yaml camel-support/src/test/resources/application.yaml \ + camel-support/src/test/java/io/kaoto/backend/camel/metadata/parser/step/kamelet/KameletParseCatalogTest.java + + echo "Updating version info in Readme" + sed -i 's/Camel-kamelets: \*\*.*/Camel-connectors: \*\*'"$versionKamelets"'\*\*/g' README.md + git add README.md + + rm -rf /tmp/kamelets +fi + +echo "All resources were updated successfully! Do you want to create commit? (y/n)" +read -r download +if [ "$download" = "y" ]; +then + git commit -m "chore(resources): Updating zip files with step catalog components." +fi + +echo "Do you want to run tests? (y/n)" +read -r download +if [ "$download" = "y" ]; +then + ./mvnw clean test +fi \ No newline at end of file diff --git a/update-version.sh b/update-version.sh index 9d71bb5d5..dcbdb3896 100755 --- a/update-version.sh +++ b/update-version.sh @@ -30,60 +30,7 @@ read -r download if [ "$download" = "y" ]; then path=$(pwd) - git rm $path"/api/src/main/resources/camel-*.zip" - - echo "Downloading Kaoto bridged Camel components (EIP)." - wget https://github.com/KaotoIO/camel-component-metadata/archive/refs/heads/main.zip - mv "main.zip" "api/src/main/resources/camel-component-metadata.zip" - git add -f "api/src/main/resources/camel-component-metadata.zip" - - echo "Downloading Kaoto view definitions." - wget https://github.com/KaotoIO/kaoto-viewdefinition-catalog/archive/refs/heads/main.zip - mv "main.zip" "api/src/main/resources/view-definition.zip" - git add -f "api/src/main/resources/view-definition.zip" - - echo "Downloading camel connectors." - echo "Enter camel version to use:" - echo "Example: 3.18.4" - read -r versionCamel - cd /tmp - mkdir camel-connectors - cd camel-connectors - wget "https://github.com/apache/camel/archive/refs/tags/camel-"$versionCamel".zip" - unzip *zip - cp "camel-camel-"$versionCamel"/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json "$path"/camel-support/src/main/resources/io/kaoto/backend/camel/service/deployment/generator/camelroute/camel-yaml-dsl.json" - cd "camel-camel-"$versionCamel"/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/" - zip "camel-connectors-"$versionCamel".zip" *.json - mv "camel-connectors-"$versionCamel".zip" $path"/api/src/main/resources/" - cd $path - git add -f "api/src/main/resources/camel-connectors-"$versionCamel".zip" - sed -i 's/camel-connectors-.*/camel-connectors-'$versionCamel'.zip$"/g' api/src/main/resources/resources-config.json - sed -i 's/camel-connectors-.*/camel-connectors-'$versionCamel'.zip"/g' api/src/main/resources/application.yaml - sed -i 's/camel-connectors-.*/camel-connectors-'$versionCamel'.zip"/g' api/src/test/resources/application.yaml - - echo "Downloading kamelets." - echo "Enter kamelets version to use:" - echo "Example: 3.21.0" - read -r versionKamelets - - path=$(pwd) - git rm $path"/api/src/main/resources/camel-kamelets-*.jar" - cd /tmp - mkdir kamelets - cd kamelets - wget "https://github.com/apache/camel-kamelets/archive/refs/tags/v"$versionKamelets".zip" - unzip *zip - cd "camel-kamelets-"$versionKamelets"/kamelets/" - zip "camel-kamelets-"$versionKamelets".jar" * - mv "camel-kamelets-"$versionKamelets".jar" $path"/api/src/main/resources/" - cd $path - git add -f "api/src/main/resources/camel-kamelets-"$versionKamelets".jar" - sed -i 's/kamelets-.*/kamelets-'$versionKamelets'.jar$"/g' api/src/main/resources/resources-config.json - sed -i 's/kamelets-.*/kamelets-'$versionKamelets'.jar"/g' api/src/main/resources/application.yaml - git add api/src/main/resources/resources-config.json - git add api/src/main/resources/application.yaml - - git commit -m "chore(resources): Updating zip files with step catalog components." + /bin/bash ./update-resources.sh fi mvn versions:set -DnewVersion=$version