From e3aab0689165298244e919e28827f57b4ccd7c29 Mon Sep 17 00:00:00 2001 From: Emmanuel GALLOIS Date: Thu, 28 May 2026 19:31:46 +0200 Subject: [PATCH 1/8] chore(QTDI-2895): S6126 Text blocks initial raw commit - used intellij inspection as it is... --- .../configuration/ui/layout/GridLayout.java | 10 +- .../asyncvalidation/AsyncValidation.java | 7 +- .../component/api/service/schema/Schema.java | 10 +- .../server/api/BulkReadResource.java | 29 +- .../ComponentServerConfiguration.java | 17 +- .../server/front/ActionResourceImplTest.java | 40 ++- .../front/DocumentationResourceImplTest.java | 224 +++++++++++---- .../beam/BeamActionSerializationTest.java | 41 ++- ...tualDependenciesServiceTemplatingTest.java | 10 +- .../component/server/test/InitTestInfra.java | 16 +- .../service/facet/codenvy/CodenvyFacet.java | 11 +- .../service/facet/travis/TravisFacet.java | 30 +- .../server/service/facet/wadl/WADLFacet.java | 36 ++- .../service/openapi/OpenAPIGenerator.java | 6 +- .../server/front/ProjectResourceTest.java | 15 +- .../ComponentGeneratorConfigurationTest.java | 134 ++++++--- .../di/schema/TaCoKitGuessSchemaTest.java | 22 +- .../tools/AsciidocDocumentationGenerator.java | 7 +- .../InternationalizationValidator.java | 9 +- .../AsciidocDocumentationGeneratorTest.java | 261 ++++++++++++------ .../tools/ComponentValidatorTest.java | 57 ++-- .../documentation/StaticRedirector.java | 19 +- 22 files changed, 696 insertions(+), 315 deletions(-) diff --git a/component-api/src/main/java/org/talend/sdk/component/api/configuration/ui/layout/GridLayout.java b/component-api/src/main/java/org/talend/sdk/component/api/configuration/ui/layout/GridLayout.java index e726ea64fff53..2944f367a29c6 100644 --- a/component-api/src/main/java/org/talend/sdk/component/api/configuration/ui/layout/GridLayout.java +++ b/component-api/src/main/java/org/talend/sdk/component/api/configuration/ui/layout/GridLayout.java @@ -27,10 +27,12 @@ import org.talend.sdk.component.api.meta.Documentation; @Ui -@Documentation("Advanced layout to place properties by row, this is exclusive with `@OptionsOrder`.\n" - + "\nNOTE: the logic to handle forms (gridlayout names) is to use the only layout if there is only one defined, " - + "else to check if there are `Main` and `Advanced` and if at least `Main` exists, use them, else " - + "use all available layouts.") +@Documentation(""" + Advanced layout to place properties by row, this is exclusive with `@OptionsOrder`. + + NOTE: the logic to handle forms (gridlayout names) is to use the only layout if there is only one defined, \ + else to check if there are `Main` and `Advanced` and if at least `Main` exists, use them, else \ + use all available layouts.""") @Target(TYPE) @Retention(RUNTIME) @Repeatable(GridLayouts.class) diff --git a/component-api/src/main/java/org/talend/sdk/component/api/service/asyncvalidation/AsyncValidation.java b/component-api/src/main/java/org/talend/sdk/component/api/service/asyncvalidation/AsyncValidation.java index 437e37eda9e6b..98e6a7a52741e 100644 --- a/component-api/src/main/java/org/talend/sdk/component/api/service/asyncvalidation/AsyncValidation.java +++ b/component-api/src/main/java/org/talend/sdk/component/api/service/asyncvalidation/AsyncValidation.java @@ -27,8 +27,11 @@ @ActionType(value = "validation", expectedReturnedType = ValidationResult.class) @Target(METHOD) @Retention(RUNTIME) -@Documentation("Mark a method as being used to validate a configuration.\n\nIMPORTANT: this is a server validation " - + "so only use it if you can't use other client side validation to implement it.") +@Documentation(""" + Mark a method as being used to validate a configuration. + + IMPORTANT: this is a server validation \ + so only use it if you can't use other client side validation to implement it.""") public @interface AsyncValidation { /** diff --git a/component-api/src/main/java/org/talend/sdk/component/api/service/schema/Schema.java b/component-api/src/main/java/org/talend/sdk/component/api/service/schema/Schema.java index 3722653369ce0..1cbce33514449 100644 --- a/component-api/src/main/java/org/talend/sdk/component/api/service/schema/Schema.java +++ b/component-api/src/main/java/org/talend/sdk/component/api/service/schema/Schema.java @@ -31,9 +31,13 @@ import lombok.Data; import lombok.NoArgsConstructor; -@Partial("This API should support nested schema but the Studio is not yet ready.\n\n" - + "The cloud platform also doesn't use it yet.\n\nAlso prefer to use " - + "`org.talend.sdk.component.api.record.Schema` over this partial default implementation.") +@Partial(""" + This API should support nested schema but the Studio is not yet ready. + + The cloud platform also doesn't use it yet. + + Also prefer to use \ + `org.talend.sdk.component.api.record.Schema` over this partial default implementation.""") @Data @NoArgsConstructor @AllArgsConstructor diff --git a/component-server-parent/component-server-api/src/main/java/org/talend/sdk/component/server/api/BulkReadResource.java b/component-server-parent/component-server-api/src/main/java/org/talend/sdk/component/server/api/BulkReadResource.java index ff00a5129d741..df6dd6591a2be 100644 --- a/component-server-parent/component-server-api/src/main/java/org/talend/sdk/component/server/api/BulkReadResource.java +++ b/component-server-parent/component-server-api/src/main/java/org/talend/sdk/component/server/api/BulkReadResource.java @@ -45,20 +45,21 @@ public interface BulkReadResource { description = "The request payloads.", content = @Content(mediaType = APPLICATION_JSON)) CompletionStage bulk(@RequestBody( - description = "The requests list as json objects containing a list of request objects. \n" + - "If your request contains multiple identifiers, you must use a list of string. \n" + - "Example : \n" + - "`{ \n" + - "\"requests\" : [ \n" + - "{ \n" + - " \"path\" : \"/api/v1/component/index\", \n" + - " \"queryParameters\" : {\"identifiers\" : [\"12345\", \"6789A\"]}, \n" + - " \"verb\" : \"GET\", \n" + - " \"headers\" : {...}, \n" + - "}, \n" + - "{ [...]} \n" + - "] \n" + - "}`", + description = """ + The requests list as json objects containing a list of request objects. \s + If your request contains multiple identifiers, you must use a list of string. \s + Example : \s + `{ \s + "requests" : [ \s + { \s + "path" : "/api/v1/component/index", \s + "queryParameters" : {"identifiers" : ["12345", "6789A"]}, \s + "verb" : "GET", \s + "headers" : {...}, \s + }, \s + { [...]} \s + ] \s + }`""", required = true, content = @Content(mediaType = APPLICATION_JSON)) final BulkRequests requests); } diff --git a/component-server-parent/component-server/src/main/java/org/talend/sdk/component/server/configuration/ComponentServerConfiguration.java b/component-server-parent/component-server/src/main/java/org/talend/sdk/component/server/configuration/ComponentServerConfiguration.java index 847360ece24c9..8db7d19881d3f 100644 --- a/component-server-parent/component-server/src/main/java/org/talend/sdk/component/server/configuration/ComponentServerConfiguration.java +++ b/component-server-parent/component-server/src/main/java/org/talend/sdk/component/server/configuration/ComponentServerConfiguration.java @@ -96,13 +96,16 @@ public class ComponentServerConfiguration { private Boolean supportsEnvironment; @Inject - @Documentation("A folder available for the server - don't forget to mount it in docker if you are using the " - + "image - which accepts subfolders named as component plugin id " - + "(generally the artifactId or jar name without the version, ex: jdbc). Each family folder can contain:\n\n" - + "- a `user-configuration.properties` file which will be merged with component configuration system " - + "(see services). This properties file enables the function `userJar(xxxx)` to replace the jar named `xxxx` " - + "by its virtual gav (`groupId:artifactId:version`),\n" - + "- a list of jars which will be merged with component family classpath\n") + @Documentation(""" + A folder available for the server - don't forget to mount it in docker if you are using the \ + image - which accepts subfolders named as component plugin id \ + (generally the artifactId or jar name without the version, ex: jdbc). Each family folder can contain: + + - a `user-configuration.properties` file which will be merged with component configuration system \ + (see services). This properties file enables the function `userJar(xxxx)` to replace the jar named `xxxx` \ + by its virtual gav (`groupId:artifactId:version`), + - a list of jars which will be merged with component family classpath + """) @ConfigProperty(name = "talend.component.server.user.extensions.location") private Optional userExtensions; diff --git a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/ActionResourceImplTest.java b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/ActionResourceImplTest.java index c1b6724a612fb..e9245e2244049 100644 --- a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/ActionResourceImplTest.java +++ b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/ActionResourceImplTest.java @@ -195,14 +195,38 @@ void checkSchemaSerialization() { .request(APPLICATION_JSON_TYPE) .post(Entity.entity(emptyMap(), APPLICATION_JSON_TYPE), String.class); final String expected = - "{\n \"entries\":[\n {\n \"elementSchema\":{\n \"entries\":[\n ],\n" + - " \"metadata\":[\n ],\n \"props\":{\n\n },\n \"type\":\"STRING\"\n" - + - " },\n \"errorCapable\":false," + - "\n \"metadata\":false,\n \"name\":\"array\",\n \"nullable\":false,\n" + - " \"props\":{\n\n },\n \"type\":\"ARRAY\",\n" + - " \"valid\":true\n }\n ],\n \"metadata\":[\n" + - " ],\n \"props\":{\n \"talend.fields.order\":\"array\"\n },\n \"type\":\"RECORD\"\n}"; + """ + { + "entries":[ + { + "elementSchema":{ + "entries":[ + ], + "metadata":[ + ], + "props":{ + + }, + "type":"STRING" + }, + "errorCapable":false, + "metadata":false, + "name":"array", + "nullable":false, + "props":{ + + }, + "type":"ARRAY", + "valid":true + } + ], + "metadata":[ + ], + "props":{ + "talend.fields.order":"array" + }, + "type":"RECORD" + }"""; assertEquals(expected, schema); } diff --git a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/DocumentationResourceImplTest.java b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/DocumentationResourceImplTest.java index 15987a29a4eb9..058a6f6ed0742 100644 --- a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/DocumentationResourceImplTest.java +++ b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/DocumentationResourceImplTest.java @@ -48,87 +48,195 @@ class DocumentationResourceImplTest { void selectById() { final String foo = new DocumentationResourceImpl() .selectById("Foo1", - "== Foo0\n\n00000\n\n" + "=== Configuration\n\nWhatever0\n\n== Foo1\n\nThe description\n\n" - + "=== Configuration\n\nWhatever1\n\n" - + "== Foo2\n\n2222\n\n=== Configuration\n\nWhatever2", + """ + == Foo0 + + 00000 + + === Configuration + + Whatever0 + + == Foo1 + + The description + + === Configuration + + Whatever1 + + == Foo2 + + 2222 + + === Configuration + + Whatever2""", DocumentationResourceImpl.DocumentationSegment.DESCRIPTION); assertEquals("The description", foo.trim()); } @RepeatedTest(2) void selectByIdUsingComments() { - final String content = "//component_start:my\n" + "\n" + "== my\n" + "\n" + "super my component\n" + "\n" - + "//configuration_start\n" + "\n" + "=== Configuration\n" + "\n" - + "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|configuration|configuration configuration|-|Always enabled|configuration|-\n" - + "|input|the input value|-|Always enabled|configuration.input|-\n" - + "|nested|it is nested|-|Always enabled|configuration.nested|dataset\n" - + "|datastore|the datastore|-|Always enabled|configuration.nested.datastore|datastore\n" - + "|user|the user to log in|unknown|Always enabled|configuration.nested.user|dataset\n" + "|===\n" - + "\n" + "//configuration_end\n" + "\n" + "//component_end:my\n" + "\n" + "//component_start:my2\n" - + "\n" + "== my2\n" + "\n" + "super my component2\n" + "\n" + "//configuration_start\n" + "\n" - + "=== Configuration\n" + "\n" + "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|ds|ds configuration|-|Always enabled|ds|dataset\n" - + "|datastore|the datastore|-|Always enabled|ds.datastore|datastore\n" + "|===\n" + "\n" - + "//configuration_end\n" + "\n" + "//component_end:my2\n" + "\n" + "//component_start:my3\n" + "\n" - + "== my2\n" + "\n" + "super my componentv3\n" + "\n" + "//configuration_start\n" + "\n" - + "=== Configuration\n" + "\n" + "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|datastore|the datastore|-|Always enabled|ds.datastore|datastore\n" + "|===\n" + "\n" - + "//configuration_end\n" + "\n" + "//component_end:my3\n"; + final String content = """ + //component_start:my + + == my + + super my component + + //configuration_start + + === Configuration + + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |configuration|configuration configuration|-|Always enabled|configuration|- + |input|the input value|-|Always enabled|configuration.input|- + |nested|it is nested|-|Always enabled|configuration.nested|dataset + |datastore|the datastore|-|Always enabled|configuration.nested.datastore|datastore + |user|the user to log in|unknown|Always enabled|configuration.nested.user|dataset + |=== + + //configuration_end + + //component_end:my + + //component_start:my2 + + == my2 + + super my component2 + + //configuration_start + + === Configuration + + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |ds|ds configuration|-|Always enabled|ds|dataset + |datastore|the datastore|-|Always enabled|ds.datastore|datastore + |=== + + //configuration_end + + //component_end:my2 + + //component_start:my3 + + == my2 + + super my componentv3 + + //configuration_start + + === Configuration + + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |datastore|the datastore|-|Always enabled|ds.datastore|datastore + |=== + + //configuration_end + + //component_end:my3 + """; final DocumentationResourceImpl impl = new DocumentationResourceImpl(); assertEquals("super my component", impl.selectById("my", content, DocumentationResourceImpl.DocumentationSegment.DESCRIPTION).trim()); - assertEquals("[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|configuration|configuration configuration|-|Always enabled|configuration|-\n" - + "|input|the input value|-|Always enabled|configuration.input|-\n" - + "|nested|it is nested|-|Always enabled|configuration.nested|dataset\n" - + "|datastore|the datastore|-|Always enabled|configuration.nested.datastore|datastore\n" - + "|user|the user to log in|unknown|Always enabled|configuration.nested.user|dataset\n" + "|===", + assertEquals(""" + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |configuration|configuration configuration|-|Always enabled|configuration|- + |input|the input value|-|Always enabled|configuration.input|- + |nested|it is nested|-|Always enabled|configuration.nested|dataset + |datastore|the datastore|-|Always enabled|configuration.nested.datastore|datastore + |user|the user to log in|unknown|Always enabled|configuration.nested.user|dataset + |===""", impl.selectById("my", content, DocumentationResourceImpl.DocumentationSegment.CONFIGURATION).trim()); assertEquals( - "== my\n" + "\n" + "super my component\n" + "\n" + "//configuration_start\n" + "\n" - + "=== Configuration\n" + "\n" + "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|configuration|configuration configuration|-|Always enabled|configuration|-\n" - + "|input|the input value|-|Always enabled|configuration.input|-\n" - + "|nested|it is nested|-|Always enabled|configuration.nested|dataset\n" - + "|datastore|the datastore|-|Always enabled|configuration.nested.datastore|datastore\n" - + "|user|the user to log in|unknown|Always enabled|configuration.nested.user|dataset\n" - + "|===\n" + "\n" + "//configuration_end", + """ + == my + + super my component + + //configuration_start + + === Configuration + + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |configuration|configuration configuration|-|Always enabled|configuration|- + |input|the input value|-|Always enabled|configuration.input|- + |nested|it is nested|-|Always enabled|configuration.nested|dataset + |datastore|the datastore|-|Always enabled|configuration.nested.datastore|datastore + |user|the user to log in|unknown|Always enabled|configuration.nested.user|dataset + |=== + + //configuration_end""", impl.selectById("my", content, DocumentationResourceImpl.DocumentationSegment.ALL).trim()); assertEquals("super my component2", impl.selectById("my2", content, DocumentationResourceImpl.DocumentationSegment.DESCRIPTION).trim()); assertEquals( - "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|ds|ds configuration|-|Always enabled|ds|dataset\n" - + "|datastore|the datastore|-|Always enabled|ds.datastore|datastore\n" + "|===", + """ + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |ds|ds configuration|-|Always enabled|ds|dataset + |datastore|the datastore|-|Always enabled|ds.datastore|datastore + |===""", impl.selectById("my2", content, DocumentationResourceImpl.DocumentationSegment.CONFIGURATION).trim()); assertEquals( - "== my2\n" + "\n" + "super my component2\n" + "\n" + "//configuration_start\n" + "\n" - + "=== Configuration\n" + "\n" + "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|ds|ds configuration|-|Always enabled|ds|dataset\n" - + "|datastore|the datastore|-|Always enabled|ds.datastore|datastore\n" + "|===\n" + "\n" - + "//configuration_end", + """ + == my2 + + super my component2 + + //configuration_start + + === Configuration + + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |ds|ds configuration|-|Always enabled|ds|dataset + |datastore|the datastore|-|Always enabled|ds.datastore|datastore + |=== + + //configuration_end""", impl.selectById("my2", content, DocumentationResourceImpl.DocumentationSegment.ALL).trim()); assertEquals("super my componentv3", impl.selectById("my3", content, DocumentationResourceImpl.DocumentationSegment.DESCRIPTION).trim()); assertEquals( - "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|datastore|the datastore|-|Always enabled|ds.datastore|datastore\n" + "|===", + """ + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |datastore|the datastore|-|Always enabled|ds.datastore|datastore + |===""", impl.selectById("my3", content, DocumentationResourceImpl.DocumentationSegment.CONFIGURATION).trim()); assertEquals( - "== my2\n" + "\n" + "super my componentv3\n" + "\n" + "//configuration_start\n" + "\n" - + "=== Configuration\n" + "\n" + "[cols=\"d,d,m,a,e,d\",options=\"header\"]\n" + "|===\n" - + "|Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type\n" - + "|datastore|the datastore|-|Always enabled|ds.datastore|datastore\n" + "|===\n" + "\n" - + "//configuration_end", + """ + == my2 + + super my componentv3 + + //configuration_start + + === Configuration + + [cols="d,d,m,a,e,d",options="header"] + |=== + |Display Name|Description|Default Value|Enabled If|Configuration Path|Configuration Type + |datastore|the datastore|-|Always enabled|ds.datastore|datastore + |=== + + //configuration_end""", impl.selectById("my3", content, DocumentationResourceImpl.DocumentationSegment.ALL).trim()); } diff --git a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/beam/BeamActionSerializationTest.java b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/beam/BeamActionSerializationTest.java index 6bd4f20eb9c44..a49e467b81019 100644 --- a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/beam/BeamActionSerializationTest.java +++ b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/front/beam/BeamActionSerializationTest.java @@ -42,15 +42,38 @@ void checkSchemaSerialization() { .queryParam("lang", "it") .request(APPLICATION_JSON_TYPE) .post(Entity.entity(emptyMap(), APPLICATION_JSON_TYPE), String.class); - final String attended = "{\n" + " \"entries\":[\n" + " {\n" + " \"elementSchema\":{\n" - + " \"entries\":[\n" + " ],\n" + " \"metadata\":[\n" + " ],\n" - + " \"props\":{\n" + "\n" + " },\n" + " \"type\":\"STRING\"\n" + " },\n" - + " \"errorCapable\":false,\n \"metadata\":false,\n" - + " \"name\":\"array\",\n" + " \"nullable\":false,\n" - + " \"props\":{\n" + "\n" + " },\n" + " \"type\":\"ARRAY\",\n" + - " \"valid\":true\n }\n" + " ],\n" - + " \"metadata\":[\n" + " ],\n" + " \"props\":{\n" + " \"talend.fields.order\":\"array\"\n" - + " },\n" + " \"type\":\"RECORD\"\n" + "}"; + final String attended = """ + { + "entries":[ + { + "elementSchema":{ + "entries":[ + ], + "metadata":[ + ], + "props":{ + + }, + "type":"STRING" + }, + "errorCapable":false, + "metadata":false, + "name":"array", + "nullable":false, + "props":{ + + }, + "type":"ARRAY", + "valid":true + } + ], + "metadata":[ + ], + "props":{ + "talend.fields.order":"array" + }, + "type":"RECORD" + }"""; assertEquals(attended, schema); } } diff --git a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/service/VirtualDependenciesServiceTemplatingTest.java b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/service/VirtualDependenciesServiceTemplatingTest.java index 3e9bd13d60867..f52697aef9f2b 100644 --- a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/service/VirtualDependenciesServiceTemplatingTest.java +++ b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/service/VirtualDependenciesServiceTemplatingTest.java @@ -50,9 +50,13 @@ private static Stream replaceGavConfigurationSource() { "a=virtual.talend.component.server.generated.foo_plugin:dummy:jar:unknown\nc=d"), new Pair("a=b\nc=userJar(dummy)", "a=b\nc=virtual.talend.component.server.generated.foo_plugin:dummy:jar:unknown"), - new Pair("a=b\n" + "c=userJar(dummy)\n" + "another[0]=userJar(other)", "a=b\n" - + "c=virtual.talend.component.server.generated.foo_plugin:dummy:jar:unknown\n" - + "another[0]=virtual.talend.component.server.generated.foo_plugin:other:jar:unknown")); + new Pair(""" + a=b + c=userJar(dummy) + another[0]=userJar(other)""", """ + a=b + c=virtual.talend.component.server.generated.foo_plugin:dummy:jar:unknown + another[0]=virtual.talend.component.server.generated.foo_plugin:other:jar:unknown""")); } @ToString diff --git a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/test/InitTestInfra.java b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/test/InitTestInfra.java index 97549a5974636..6546667a4ba9a 100644 --- a/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/test/InitTestInfra.java +++ b/component-server-parent/component-server/src/test/java/org/talend/sdk/component/server/test/InitTestInfra.java @@ -350,8 +350,20 @@ private File createJdbcPlugin(final File target) { out.putNextEntry(new JarEntry("TALEND-INF/documentation.adoc")); out - .write(("== input\n\ndesc\n\n=== Configuration\n\nSomething1\n\n" - + "== output\n\n=== Configuration\n\nSomething else") + .write((""" + == input + + desc + + === Configuration + + Something1 + + == output + + === Configuration + + Something else""") .getBytes(StandardCharsets.UTF_8)); out.closeEntry(); } catch (final IOException e) { diff --git a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/codenvy/CodenvyFacet.java b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/codenvy/CodenvyFacet.java index e609c90ec791c..7455c5df93af5 100644 --- a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/codenvy/CodenvyFacet.java +++ b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/codenvy/CodenvyFacet.java @@ -57,10 +57,13 @@ public Category category() { @Override public String readme() { - return "Codenvy allows you to code on this project from any web browser if you host your sources in a Github repository.\n\n" - + "Click on this link and the project " + "will be opened on your account, ready to develop:\n\n" - + "image:http://beta.codenvy.com/factory/resources/codenvy-contribute.svg[" - + "Codenvy,link=http://codenvy.io/f?url=https://github.com/@organization@/@repository@,window=\"_blank\"]"; + return """ + Codenvy allows you to code on this project from any web browser if you host your sources in a Github repository. + + Click on this link and the project will be opened on your account, ready to develop: + + image:http://beta.codenvy.com/factory/resources/codenvy-contribute.svg[\ + Codenvy,link=http://codenvy.io/f?url=https://github.com/@organization@/@repository@,window="_blank"]"""; } @Override diff --git a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/travis/TravisFacet.java b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/travis/TravisFacet.java index adcdae8c25db4..3e5683e821a9e 100644 --- a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/travis/TravisFacet.java +++ b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/travis/TravisFacet.java @@ -34,11 +34,19 @@ public class TravisFacet implements FacetGenerator { public void register(@Observes final GeneratorRegistration init) { init.registerFacetType(this); - travisYml = new InMemoryFile(".travis.yml", "language: java\njdk:\n- oraclejdk8\nenv:\n" + " global:\n" - + " - MAVEN_OPTS=\"-Dmaven.artifact.threads=64 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn\"\n" - + "cache:\n" + " directories:\n - \"$HOME/.m2\"\n" - + "install: mvn clean install -DskipTests -Dinvoker.skip=true --batch-mode\n" - + "script: mvn clean install -e --batch-mode\n"); + travisYml = new InMemoryFile(".travis.yml", """ + language: java + jdk: + - oraclejdk8 + env: + global: + - MAVEN_OPTS="-Dmaven.artifact.threads=64 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" + cache: + directories: + - "$HOME/.m2" + install: mvn clean install -DskipTests -Dinvoker.skip=true --batch-mode + script: mvn clean install -e --batch-mode + """); } @Override @@ -50,11 +58,13 @@ public Stream create(final String packageBase, final Build build, @Override public String readme() { - return "The .travis.yml file created at the root of the project is preconfigured to be able to build " - + "a common component. It caches the maven repository to speed up builds and decrease the maven " - + "log level to avoid to reach Travis CI output limit too fast for no reason.\n\n" - + "More information can be found at " - + "link:https://docs.travis-ci.com/user/getting-started/#To-get-started-with-Travis-CI[Get Started with Travis CI]."; + return """ + The .travis.yml file created at the root of the project is preconfigured to be able to build \ + a common component. It caches the maven repository to speed up builds and decrease the maven \ + log level to avoid to reach Travis CI output limit too fast for no reason. + + More information can be found at \ + link:https://docs.travis-ci.com/user/getting-started/#To-get-started-with-Travis-CI[Get Started with Travis CI]."""; } @Override diff --git a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/wadl/WADLFacet.java b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/wadl/WADLFacet.java index 9beffe2eca03c..b5a28509210b1 100644 --- a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/wadl/WADLFacet.java +++ b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/facet/wadl/WADLFacet.java @@ -53,18 +53,30 @@ public void register(@Observes final GeneratorRegistration init) { @Override public String readme() { - return "Generates the needed classes to call HTTP endpoints defined by a WADL located at `src/main/resources/wadl/client.xml`.\n" - + "The `wadl2java` CXF plugin generates interfaces representing the endpoints and you can create a client using CXF `JAXRSClientFactoryBean` " - + "class:\n\n" + "[source,java]\n" + "----\n" - + "import org.talend.sdk.component.api.service.Service;\n\n" - + "import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;\n\n" + "@Service\n" - + "public class MyService {\n" + " public MyGeneratedEndpointApi newClient(final String url) {\n" - + " return JAXRSClientFactoryBean.create(url, MyGeneratedEndpointApi.class);\n" + " }\n" + "}\n" - + "----\n\n" - + "Don't forget you need to build once the project to have the generated interfaces and be able to write your client from the " - + "using the sources created in `generated-sources` folder.\n\n" - + "TIP: you can customize the way the client is created from the interface - including the providers/serializers used,\n" - + "more details available at http://cxf.apache.org/docs/jax-rs-client-api.html."; + return """ + Generates the needed classes to call HTTP endpoints defined by a WADL located at `src/main/resources/wadl/client.xml`. + The `wadl2java` CXF plugin generates interfaces representing the endpoints and you can create a client using CXF `JAXRSClientFactoryBean` \ + class: + + [source,java] + ---- + import org.talend.sdk.component.api.service.Service; + + import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean; + + @Service + public class MyService { + public MyGeneratedEndpointApi newClient(final String url) { + return JAXRSClientFactoryBean.create(url, MyGeneratedEndpointApi.class); + } + } + ---- + + Don't forget you need to build once the project to have the generated interfaces and be able to write your client from the \ + using the sources created in `generated-sources` folder. + + TIP: you can customize the way the client is created from the interface - including the providers/serializers used, + more details available at http://cxf.apache.org/docs/jax-rs-client-api.html."""; } @Override diff --git a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/openapi/OpenAPIGenerator.java b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/openapi/OpenAPIGenerator.java index fc4e634b24a0e..7d4d22706bd19 100644 --- a/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/openapi/OpenAPIGenerator.java +++ b/component-starter-server/src/main/java/org/talend/sdk/component/starter/server/service/openapi/OpenAPIGenerator.java @@ -141,8 +141,10 @@ private Collection toFiles(final String basePackage renderer.render("generator/openapi/connection.mustache", new ConnectionModel(basePackage)))); payloads .add(new FacetGenerator.InMemoryFile(resourcesBaseFolder + "connection/Messages.properties", - "APIConnection.baseUrl._displayName = Base URL\n" - + "APIConnection.baseUrl._placeholder = Base URL...\n")); + """ + APIConnection.baseUrl._displayName = Base URL + APIConnection.baseUrl._placeholder = Base URL... + """)); final Collection