From f692cadf02ace8808ccaa4a61e09da5b24191ae1 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Thu, 23 Oct 2025 00:32:01 +0200 Subject: [PATCH 01/20] chore(QTDI-1914): Sample dynamic schema connector. --- sample-parent/pom.xml | 3 +- .../dynamic-dependencies/pom.xml | 97 ++++++++++++ .../dynamicdependencies/config/Config.java | 43 ++++++ .../dynamicdependencies/config/Dataset.java | 69 +++++++++ .../dynamicdependencies/config/Datastore.java | 36 +++++ .../input/DynamicDependenciesInput.java | 81 ++++++++++ .../dynamicdependencies/package-info.java | 23 +++ .../service/DynamicDependenciesService.java | 144 ++++++++++++++++++ .../src/main/resources/icons/dark/icon.svg | 60 ++++++++ .../src/main/resources/icons/light/icon.svg | 60 ++++++++ .../dynamicdependencies/Messages.properties | 19 +++ .../config/Messages.properties | 30 ++++ .../input/Messages.properties | 17 +++ 13 files changed, 681 insertions(+), 1 deletion(-) create mode 100644 sample-parent/sample-features/dynamic-dependencies/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties diff --git a/sample-parent/pom.xml b/sample-parent/pom.xml index 605c9b9796ede..21820ccab9d8a 100644 --- a/sample-parent/pom.xml +++ b/sample-parent/pom.xml @@ -33,6 +33,7 @@ documentation-sample sample-connector sample-features + sample-features/dynamic-dependencies @@ -97,4 +98,4 @@ - + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml new file mode 100644 index 0000000000000..236c1fc3797f1 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + org.talend.sdk.component + sample-features + 1.86.0-SNAPSHOT + + + dynamicdependencies + jar + + Component Runtime :: Sample Feature @DynamicDependency + + + + + org.talend.sdk.component + talend-component-maven-plugin + ${project.version} + + + + + talend-dependencies + + dependencies + + process-classes + + + talend-component-bundle + + car + + package + + + talend-scan-descriptor + + scan-descriptor + + + + talend-component-validate + + validate + + process-classes + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java new file mode 100644 index 0000000000000..7dbbbd6cb8b7d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java @@ -0,0 +1,43 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }) +}) +public class Config implements Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java new file mode 100644 index 0000000000000..c0accd24d8d49 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java @@ -0,0 +1,69 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }), + @GridLayout.Row({ "dependencies" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + + @Data + @GridLayout(value = { + @GridLayout.Row({ "groupId", "artifactId", "version", "clazz" }) + }) + public static class Dependency implements Serializable { + + @Option + @Documentation("The groupId of the dependency.") + private String groupId; + + @Option + @Documentation("The artifactId of the dependency.") + private String artifactId; + + @Option + @Documentation("The version of the dependency.") + private String version; + + @Option + @Documentation("The class to try to load from this dependency.") + private String clazz; + + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java new file mode 100644 index 0000000000000..d2056190a6bb5 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@GridLayout(value = { @GridLayout.Row({ "input" }) }) +public class Datastore implements Serializable { + + @Option + @Documentation("An input string that is not used.") + private String input; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java new file mode 100644 index 0000000000000..870a07a5208ef --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java @@ -0,0 +1,81 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.service.schema.FixedSchema; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService; + +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@FixedSchema(DynamicDependenciesService.FIXEDSCHEMA_ACTION) +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesInput implements Serializable { + + private final Config config; + + private final DynamicDependenciesService service; + + private Iterator recordIterator; + + public DynamicDependenciesInput(final Config config, final DynamicDependenciesService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java new file mode 100644 index 0000000000000..d7b5b6f6dbc76 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "dynamicDependencies", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java new file mode 100644 index 0000000000000..b5bfcb76db562 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java @@ -0,0 +1,144 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.service; + +import java.io.Serializable; +import java.security.CodeSource; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.exception.ComponentException; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.record.Record.Builder; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.record.Schema.Type; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.record.RecordBuilderFactory; +import org.talend.sdk.component.api.service.schema.DiscoverSchema; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset.Dependency; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesService implements Serializable { + + public static final String DEPENDENCY_ACTION = "DEPENDENCY_ACTION"; + + public static final String FIXEDSCHEMA_ACTION = "FIXEDSCHEMA_ACTION"; + + public static final String ENTRY_MAVEN = "maven"; + + public static final String ENTRY_CLASS = "clazz"; + + public static final String ENTRY_IS_LOADED = "is_loaded"; + + public static final String ENTRY_CLASSLOADER = "classloader"; + + public static final String ENTRY_FROM_LOCATION = "from_location"; + + public static final String ENTRY_IS_TCK_CONTAINER = "is_tck_container"; + + public static final String ENTRY_IS_LOADED_IN_TCK = "is_loaded_in_tck_manager"; + + @Service + private RecordBuilderFactory factory; + + public Iterator loadIterator(final Config config) { + Schema schema = buildSchema(); + + List records = new ArrayList<>(); + for (Dependency dependency : config.getDse().getDependencies()) { + Builder builder = factory.newRecordBuilder(schema); + + String maven = String.format("%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(), + dependency.getVersion()); + + boolean isLoaded = false; + String classLoaderId = "N/A"; + String fromLocation = "N/A"; + try { + Class clazz = Class.forName(dependency.getClazz()); + isLoaded = true; + classLoaderId = clazz.getClassLoader().toString(); + + CodeSource codeSource = clazz.getProtectionDomain().getCodeSource(); + if (codeSource != null) { + fromLocation = codeSource.getLocation().getPath(); + } else { + fromLocation = "CodeSource is null for this class."; + } + } catch (ClassNotFoundException e) { + manageException(config.isDieOnError(), + "Cannot load class %s from system classloader".formatted(dependency.getClazz()), e); + } + + boolean isTckContainer = false; // to improve + boolean isLoadedInTck = false; // to improve + + Record record = builder + .withString(ENTRY_MAVEN, maven) + .withString(ENTRY_CLASS, dependency.getClazz()) + .withBoolean(ENTRY_IS_LOADED, isLoaded) + .withString(ENTRY_CLASSLOADER, classLoaderId) + .withString(ENTRY_FROM_LOCATION, fromLocation) + .withBoolean(ENTRY_IS_TCK_CONTAINER, isTckContainer) + .withBoolean(ENTRY_IS_LOADED_IN_TCK, isLoadedInTck) + .build(); + records.add(record); + } + + return records.iterator(); + } + + private Schema buildSchema() { + return factory.newSchemaBuilder(Type.RECORD) + .withEntry(factory.newEntryBuilder().withName(ENTRY_MAVEN).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASS).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED).withType(Type.BOOLEAN).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASSLOADER).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_FROM_LOCATION).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_TCK_CONTAINER).withType(Type.BOOLEAN).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED_IN_TCK).withType(Type.BOOLEAN).build()) + .build(); + } + + private void manageException(final boolean dieOnError, final String message, final Exception e) { + String msg = "Dynamic dependencies connector raised an exception: %s : %s".formatted(message, e.getMessage()); + log.error(msg, e); + if (dieOnError) { + throw new ComponentException(msg, e); + } + } + + @DynamicDependencies(DEPENDENCY_ACTION) + public List getDynamicDependencies(@Option("configuration") final Dataset dataset) { + return dataset.getDependencies() + .stream() + .map(d -> String.format("%s:%s:%s", d.getGroupId(), d.getArtifactId(), d.getVersion())) + .toList(); + } + + @DiscoverSchema(FIXEDSCHEMA_ACTION) + public Schema guessSchema4Input(final Dataset dse) { + return buildSchema(); + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..6e254d5c33ec9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,60 @@ + + + + + + DynamicDependencies + diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..6e254d5c33ec9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/light/icon.svg @@ -0,0 +1,60 @@ + + + + + + DynamicDependencies + diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties new file mode 100644 index 0000000000000..570dc7802755e --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties @@ -0,0 +1,19 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependencies.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies +dynamicDependencies.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependencies.actions.schema.FIXEDSCHEMA_ACTION._displayName = Fixed Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties new file mode 100644 index 0000000000000..5a8b582a1eed3 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties @@ -0,0 +1,30 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Dataset.dso._displayName = +Dataset.dependencies._displayName = +Dependency.groupId._displayName = +Dependency.artifactId._displayName = +Dependency.version._displayName = +Dependency.clazz._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = +Dependency.groupId._placeholder = +Dependency.artifactId._placeholder = +Dependency.version._placeholder = +Dependency.clazz._placeholder = +Datastore.input._displayName = +Datastore.input._placeholder = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties new file mode 100644 index 0000000000000..601aeca6c086c --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependencies.Input._displayName = Dynamic Dependencies Input \ No newline at end of file From e53256c5f4ccf8f402694bd38cb498e643385306 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Thu, 23 Oct 2025 15:31:23 +0800 Subject: [PATCH 02/20] Add 2 params --- .../feature/dynamicdependencies/config/Config.java | 8 ++++++++ .../service/DynamicDependenciesService.java | 10 ++++++++++ .../dynamicdependencies/config/Messages.properties | 2 ++ 3 files changed, 20 insertions(+) diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java index 7dbbbd6cb8b7d..0bdb8be6994ab 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java @@ -40,4 +40,12 @@ public class Config implements Serializable { @Documentation("If enable throw an exception for any error, if not just log the error.") private boolean dieOnError = false; + @Option + @Documentation("The info about root repository.") + private boolean rootRepository = false; + + @Option + @Documentation("The info about Runtime classpath.") + private boolean runtimeClassPath = false; + } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java index b5bfcb76db562..44d85f89864db 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java @@ -59,6 +59,10 @@ public class DynamicDependenciesService implements Serializable { public static final String ENTRY_IS_LOADED_IN_TCK = "is_loaded_in_tck_manager"; + public static final String ENTRY_ROOT_REPOSITORY = "root_repository"; + + public static final String ENTRY_RUNTIME_CLASSPATH = "runtime_classpath"; + @Service private RecordBuilderFactory factory; @@ -93,6 +97,8 @@ public Iterator loadIterator(final Config config) { boolean isTckContainer = false; // to improve boolean isLoadedInTck = false; // to improve + String rootRepository = config.isRootRepository() ? System.getProperty("talend.component.manager.m2.repository") : ""; + String runtimeClasspath = ""; Record record = builder .withString(ENTRY_MAVEN, maven) @@ -102,6 +108,8 @@ public Iterator loadIterator(final Config config) { .withString(ENTRY_FROM_LOCATION, fromLocation) .withBoolean(ENTRY_IS_TCK_CONTAINER, isTckContainer) .withBoolean(ENTRY_IS_LOADED_IN_TCK, isLoadedInTck) + .withString(ENTRY_ROOT_REPOSITORY, rootRepository) + .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath) .build(); records.add(record); } @@ -118,6 +126,8 @@ private Schema buildSchema() { .withEntry(factory.newEntryBuilder().withName(ENTRY_FROM_LOCATION).withType(Type.STRING).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_TCK_CONTAINER).withType(Type.BOOLEAN).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED_IN_TCK).withType(Type.BOOLEAN).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) .build(); } diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties index 5a8b582a1eed3..7b8e871ca2b55 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties @@ -22,6 +22,8 @@ Dependency.version._displayName = Dependency.clazz._displayName = Config.dse._displayName = Config.dieOnError._displayName = +Config.rootRepository._displayName = +Config.runtimeClassPath._displayName = Dependency.groupId._placeholder = Dependency.artifactId._placeholder = Dependency.version._placeholder = From b4705a0366e88353b2cf9a6bd67b4329302e0078 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Thu, 23 Oct 2025 23:11:28 +0200 Subject: [PATCH 03/20] chore(QTDI-1914): remove unused option in dso, environment info management, better clazz location. --- .../dynamicdependencies/config/Config.java | 11 +-- .../dynamicdependencies/config/Datastore.java | 10 +- .../input/DynamicDependenciesInput.java | 2 - .../service/DynamicDependenciesService.java | 96 ++++++++++++------- .../dynamicdependencies/Messages.properties | 2 +- .../config/Messages.properties | 3 +- 6 files changed, 72 insertions(+), 52 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java index 0bdb8be6994ab..5bb218e825826 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java @@ -28,7 +28,8 @@ */ @Data @GridLayout({ - @GridLayout.Row({ "dse" }) + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "environmentInformation" }) }) public class Config implements Serializable { @@ -41,11 +42,7 @@ public class Config implements Serializable { private boolean dieOnError = false; @Option - @Documentation("The info about root repository.") - private boolean rootRepository = false; - - @Option - @Documentation("The info about Runtime classpath.") - private boolean runtimeClassPath = false; + @Documentation("More environment information.") + private boolean environmentInformation = false; } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java index d2056190a6bb5..21f23b347e87a 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java @@ -17,20 +17,14 @@ import java.io.Serializable; -import org.talend.sdk.component.api.configuration.Option; import org.talend.sdk.component.api.configuration.type.DataStore; -import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; -import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; import lombok.Data; @Data @DataStore("dyndepsdso") -@GridLayout(value = { @GridLayout.Row({ "input" }) }) +@AutoLayout public class Datastore implements Serializable { - @Option - @Documentation("An input string that is not used.") - private String input; - } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java index 870a07a5208ef..4a70da9d5d4a0 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java @@ -26,7 +26,6 @@ import org.talend.sdk.component.api.input.Producer; import org.talend.sdk.component.api.meta.Documentation; import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.api.service.schema.FixedSchema; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; import org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService; @@ -49,7 +48,6 @@ @Version @Icon(value = Icon.IconType.CUSTOM, custom = "icon") @Emitter(name = "Input") -@FixedSchema(DynamicDependenciesService.FIXEDSCHEMA_ACTION) @Documentation("Dynamic dependencies sample input connector.") public class DynamicDependenciesInput implements Serializable { diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java index 44d85f89864db..2072975a058f7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java @@ -16,7 +16,7 @@ package org.talend.sdk.component.sample.feature.dynamicdependencies.service; import java.io.Serializable; -import java.security.CodeSource; +import java.net.URL; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -30,7 +30,7 @@ import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.api.service.dependency.DynamicDependencies; import org.talend.sdk.component.api.service.record.RecordBuilderFactory; -import org.talend.sdk.component.api.service.schema.DiscoverSchema; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset.Dependency; @@ -43,7 +43,7 @@ public class DynamicDependenciesService implements Serializable { public static final String DEPENDENCY_ACTION = "DEPENDENCY_ACTION"; - public static final String FIXEDSCHEMA_ACTION = "FIXEDSCHEMA_ACTION"; + public static final String DISCOVERSCHEMA_ACTION = "DISCOVERSCHEMA_ACTION"; public static final String ENTRY_MAVEN = "maven"; @@ -51,7 +51,9 @@ public class DynamicDependenciesService implements Serializable { public static final String ENTRY_IS_LOADED = "is_loaded"; - public static final String ENTRY_CLASSLOADER = "classloader"; + public static final String ENTRY_CONNECTOR_CLASSLOADER = "connector_classloader"; + + public static final String ENTRY_CLAZZ_CLASSLOADER = "clazz_classloader"; public static final String ENTRY_FROM_LOCATION = "from_location"; @@ -67,7 +69,7 @@ public class DynamicDependenciesService implements Serializable { private RecordBuilderFactory factory; public Iterator loadIterator(final Config config) { - Schema schema = buildSchema(); + Schema schema = buildSchema(config); List records = new ArrayList<>(); for (Dependency dependency : config.getDse().getDependencies()) { @@ -77,58 +79,74 @@ public Iterator loadIterator(final Config config) { dependency.getVersion()); boolean isLoaded = false; - String classLoaderId = "N/A"; + String connectorClassLoaderId = this.getClass().getClassLoader().toString(); + String clazzClassLoaderId = "N/A"; String fromLocation = "N/A"; try { Class clazz = Class.forName(dependency.getClazz()); isLoaded = true; - classLoaderId = clazz.getClassLoader().toString(); - - CodeSource codeSource = clazz.getProtectionDomain().getCodeSource(); - if (codeSource != null) { - fromLocation = codeSource.getLocation().getPath(); - } else { - fromLocation = "CodeSource is null for this class."; - } + clazzClassLoaderId = clazz.getClassLoader().toString(); + + // This way to retrieve the location works even if the jar from where clazz comes from + // is nested into another jar (uber jar scenario) + String classPath = clazz.getName().replace('.', '/') + ".class"; + URL url = clazz.getClassLoader().getResource(classPath); + fromLocation = String.valueOf(url); } catch (ClassNotFoundException e) { manageException(config.isDieOnError(), "Cannot load class %s from system classloader".formatted(dependency.getClazz()), e); } - boolean isTckContainer = false; // to improve + boolean isTckContainer = isTCKContainer(fromLocation); + // package-info@Components boolean isLoadedInTck = false; // to improve - String rootRepository = config.isRootRepository() ? System.getProperty("talend.component.manager.m2.repository") : ""; - String runtimeClasspath = ""; - Record record = builder + Builder recordBuilder = builder .withString(ENTRY_MAVEN, maven) .withString(ENTRY_CLASS, dependency.getClazz()) .withBoolean(ENTRY_IS_LOADED, isLoaded) - .withString(ENTRY_CLASSLOADER, classLoaderId) + .withString(ENTRY_CONNECTOR_CLASSLOADER, connectorClassLoaderId) + .withString(ENTRY_CLAZZ_CLASSLOADER, clazzClassLoaderId) .withString(ENTRY_FROM_LOCATION, fromLocation) .withBoolean(ENTRY_IS_TCK_CONTAINER, isTckContainer) - .withBoolean(ENTRY_IS_LOADED_IN_TCK, isLoadedInTck) - .withString(ENTRY_ROOT_REPOSITORY, rootRepository) - .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath) - .build(); + .withBoolean(ENTRY_IS_LOADED_IN_TCK, isLoadedInTck); + + if (config.isEnvironmentInformation()) { + String rootRepository = System.getProperty("talend.component.manager.m2.repository"); + String runtimeClasspath = System.getProperty("java.class.path"); + + recordBuilder = recordBuilder + .withString(ENTRY_ROOT_REPOSITORY, rootRepository) + .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath); + } + + Record record = recordBuilder.build(); records.add(record); } return records.iterator(); } - private Schema buildSchema() { - return factory.newSchemaBuilder(Type.RECORD) + private Schema buildSchema(final Config config) { + Schema.Builder builder = factory.newSchemaBuilder(Type.RECORD) .withEntry(factory.newEntryBuilder().withName(ENTRY_MAVEN).withType(Type.STRING).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASS).withType(Type.STRING).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED).withType(Type.BOOLEAN).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASSLOADER).withType(Type.STRING).build()) + .withEntry( + factory.newEntryBuilder().withName(ENTRY_CONNECTOR_CLASSLOADER).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_CLAZZ_CLASSLOADER).withType(Type.STRING).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_FROM_LOCATION).withType(Type.STRING).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_TCK_CONTAINER).withType(Type.BOOLEAN).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED_IN_TCK).withType(Type.BOOLEAN).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) - .build(); + .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED_IN_TCK).withType(Type.BOOLEAN).build()); + + if (config.isEnvironmentInformation()) { + builder = builder + .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) + .withEntry( + factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()); + } + + return builder.build(); } private void manageException(final boolean dieOnError, final String message, final Exception e) { @@ -147,8 +165,20 @@ public List getDynamicDependencies(@Option("configuration") final Datase .toList(); } - @DiscoverSchema(FIXEDSCHEMA_ACTION) - public Schema guessSchema4Input(final Dataset dse) { - return buildSchema(); + @DiscoverSchemaExtended(DISCOVERSCHEMA_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return buildSchema(config); + } + + /** + * Return true if the given path correspond to a class that has been loaded from a jar that contains + * a TALEND-INF/dependencies.txt file. + * + * @param path The clazz location + * @return true if the given path correspond to a TCK container + */ + private boolean isTCKContainer(final String path) { + // TO DO + return false; } } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties index 570dc7802755e..80342c6c8f436 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties @@ -16,4 +16,4 @@ dynamicDependencies.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies dynamicDependencies.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies -dynamicDependencies.actions.schema.FIXEDSCHEMA_ACTION._displayName = Fixed Schema for dynamic dependencies \ No newline at end of file +dynamicDependencies.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties index 7b8e871ca2b55..aa1d1d58b4ea8 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties @@ -29,4 +29,5 @@ Dependency.artifactId._placeholder = Dependency.version._placeholder = Dependency.clazz._placeholder = Datastore.input._displayName = -Datastore.input._placeholder = \ No newline at end of file +Datastore.input._placeholder = +Config.environmentInformation._displayName = \ No newline at end of file From 1a76af5be86b6b701f5cde0c1e344fa651f33ee4 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Mon, 27 Oct 2025 15:03:01 +0800 Subject: [PATCH 04/20] Add 2 connectors: dataset, datastore with tests --- sample-parent/pom.xml | 1 - .../dynamic-dependencies-common/pom.xml | 63 ++++++++++++++ .../dynamicdependencies/config/Config.java | 0 .../dynamicdependencies/config/Dataset.java | 0 .../dynamicdependencies/config/Datastore.java | 0 .../src/main/resources/icons/dark/icon.svg | 0 .../src/main/resources/icons/light/icon.svg | 0 .../dynamicdependencies/Messages.properties | 0 .../config/Messages.properties | 0 .../dynamic-dependencies-with-dataset/pom.xml | 73 +++++++++++++++++ .../input/DynamicDependenciesInput.java | 16 ---- .../dynamicdependencies/package-info.java | 0 .../service/DynamicDependenciesService.java | 2 +- .../src/main/resources/icons/dark/icon.svg | 60 ++++++++++++++ .../src/main/resources/icons/light/icon.svg | 60 ++++++++++++++ .../input/Messages.properties | 0 .../DynamicDependenciesServiceTest.java | 82 +++++++++++++++++++ .../pom.xml | 44 ++++++++++ .../src/main/resources/icons/dark/icon.svg | 60 ++++++++++++++ .../src/main/resources/icons/light/icon.svg | 60 ++++++++++++++ .../dynamic-dependencies/pom.xml | 73 ++--------------- sample-parent/sample-features/pom.xml | 1 + 22 files changed, 510 insertions(+), 85 deletions(-) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/resources/icons/dark/icon.svg (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/resources/icons/light/icon.svg (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-common}/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties (100%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-with-dataset}/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java (77%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-with-dataset}/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java (100%) rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-with-dataset}/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java (99%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg rename sample-parent/sample-features/dynamic-dependencies/{ => dynamic-dependencies-with-dataset}/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties (100%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg diff --git a/sample-parent/pom.xml b/sample-parent/pom.xml index 21820ccab9d8a..2e8a1d3813096 100644 --- a/sample-parent/pom.xml +++ b/sample-parent/pom.xml @@ -33,7 +33,6 @@ documentation-sample sample-connector sample-features - sample-features/dynamic-dependencies diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml new file mode 100644 index 0000000000000..84ed1e94c5cc5 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + org.talend.sdk.component + dynamicdependencies + 1.86.0-SNAPSHOT + + + dynamic-dependencies-common + jar + Component Runtime :: Sample Feature @DynamicDependency Common + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.common + + + + + + org.talend.sdk.component + talend-component-maven-plugin + ${project.version} + + + + + talend-component-validate + + false + + false + + false + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/dark/icon.svg similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/dark/icon.svg rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/dark/icon.svg diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/light/icon.svg similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/resources/icons/light/icon.svg rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/light/icon.svg diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml new file mode 100644 index 0000000000000..10aa69e38ed9b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.talend.sdk.component + dynamicdependencies + 1.86.0-SNAPSHOT + + + dynamic-dependencies-with-dataset + jar + Component Runtime :: Sample Feature @DynamicDependency with Dataset + + + + org.talend.sdk.component + dynamic-dependencies-common + 1.86.0-SNAPSHOT + + + org.talend.sdk.component + component-runtime-junit + 1.86.0-SNAPSHOT + test + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.dataset + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java similarity index 77% rename from sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java index 4a70da9d5d4a0..6bdbd5a1506cc 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java @@ -29,22 +29,6 @@ import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; import org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService; -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - @Version @Icon(value = Icon.IconType.CUSTOM, custom = "icon") @Emitter(name = "Input") diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java similarity index 99% rename from sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java index 2072975a058f7..a10e01ee9833d 100644 --- a/sample-parent/sample-features/dynamic-dependencies/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java @@ -173,7 +173,7 @@ public Schema guessSchema4Input(final @Option("configuration") Config config) { /** * Return true if the given path correspond to a class that has been loaded from a jar that contains * a TALEND-INF/dependencies.txt file. - * + * * @param path The clazz location * @return true if the given path correspond to a TCK container */ diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..6e254d5c33ec9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,60 @@ + + + + + + DynamicDependencies + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..6e254d5c33ec9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg @@ -0,0 +1,60 @@ + + + + + + DynamicDependencies + diff --git a/sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java new file mode 100644 index 0000000000000..79b45edb7e992 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java @@ -0,0 +1,82 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Datastore; + +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_ROOT_REPOSITORY; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies") +public class DynamicDependenciesServiceTest { + + @Service + DynamicDependenciesService dynamicDependenciesServiceService; + + private Config config; + + @BeforeEach + void setUp() { + // Any setup required before each test can be done here + config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = new ArrayList<>(); + Dataset.Dependency depend = new Dataset.Dependency(); + depend.setArtifactId("commons-numbers-primes"); + depend.setVersion("1.2"); + depend.setGroupId("org.apache.commons"); + depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); + depends.add(depend); + + dse.setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + } + + @Test + void testloadIterator(){ + final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + final Record record = result.next(); + Assertions.assertNotNull(record); + Assertions.assertEquals(" ", record.getString(ENTRY_CLASSLOADER)); + Assertions.assertEquals(" ", record.getString(ENTRY_MAVEN)); + Assertions.assertEquals(" ", record.getString(ENTRY_CLASS)); + Assertions.assertEquals(" ", record.getString(ENTRY_FROM_LOCATION)); + Assertions.assertEquals(" ", record.getString(ENTRY_ROOT_REPOSITORY)); + Assertions.assertEquals(" ", record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertFalse(result.hasNext()); + } +} diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml new file mode 100644 index 0000000000000..9d5d9524c22fa --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + org.talend.sdk.component + dynamicdependencies + 1.86.0-SNAPSHOT + + + dynamic-dependencies-with-datastore + jar + Component Runtime :: Sample Feature @DynamicDependency with Datastore + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.datastore + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..6e254d5c33ec9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,60 @@ + + + + + + DynamicDependencies + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..6e254d5c33ec9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg @@ -0,0 +1,60 @@ + + + + + + DynamicDependencies + diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml index 236c1fc3797f1..0abbd2b1d5ca6 100644 --- a/sample-parent/sample-features/dynamic-dependencies/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -24,74 +24,13 @@ dynamicdependencies - jar + pom Component Runtime :: Sample Feature @DynamicDependency - - - - - org.talend.sdk.component - talend-component-maven-plugin - ${project.version} - - - - - talend-dependencies - - dependencies - - process-classes - - - talend-component-bundle - - car - - package - - - talend-scan-descriptor - - scan-descriptor - - - - talend-component-validate - - validate - - process-classes - - true - true - false - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - true - - - - - - + + dynamic-dependencies-common + dynamic-dependencies-with-dataset + dynamic-dependencies-with-datastore + \ No newline at end of file diff --git a/sample-parent/sample-features/pom.xml b/sample-parent/sample-features/pom.xml index 7121838d50b26..972f99859d146 100644 --- a/sample-parent/sample-features/pom.xml +++ b/sample-parent/sample-features/pom.xml @@ -35,6 +35,7 @@ checkpoint-runner configuration-form entry-with-error + dynamic-dependencies From 8c10ae1dde2eab36f62751515aac60d8cdb664e5 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Mon, 27 Oct 2025 15:08:48 +0800 Subject: [PATCH 05/20] Add 2 connectors: dataset, datastore with tests --- .../service/DynamicDependenciesServiceTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java index 79b45edb7e992..c70b45d2945db 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java @@ -30,7 +30,6 @@ import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Datastore; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASSLOADER; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_MAVEN; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; @@ -71,7 +70,7 @@ void testloadIterator(){ Assertions.assertTrue(result.hasNext()); final Record record = result.next(); Assertions.assertNotNull(record); - Assertions.assertEquals(" ", record.getString(ENTRY_CLASSLOADER)); + // Assertions.assertEquals(" ", record.getString(ENTRY_CLASSLOADER)); Assertions.assertEquals(" ", record.getString(ENTRY_MAVEN)); Assertions.assertEquals(" ", record.getString(ENTRY_CLASS)); Assertions.assertEquals(" ", record.getString(ENTRY_FROM_LOCATION)); From 189ac9e83ee64589e445b998f2a3e93d0fd6566d Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Mon, 27 Oct 2025 13:12:34 +0100 Subject: [PATCH 06/20] chore(QTDI-1914): Some adjustments. --- .../dynamic-dependencies-common/pom.xml | 5 +--- .../dynamic-dependencies-with-dataset/pom.xml | 25 ++----------------- .../DynamicDependenciesServiceTest.java | 18 +++++++------ .../dynamic-dependencies/pom.xml | 13 ++++++++-- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml index 84ed1e94c5cc5..adb359f7664c7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml @@ -17,7 +17,7 @@ 4.0.0 org.talend.sdk.component - dynamicdependencies + dynamic-dependencies 1.86.0-SNAPSHOT @@ -49,11 +49,8 @@ talend-component-validate false - false - false - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml index 10aa69e38ed9b..544180efc7747 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -17,7 +17,7 @@ 4.0.0 org.talend.sdk.component - dynamicdependencies + dynamic-dependencies 1.86.0-SNAPSHOT @@ -31,27 +31,6 @@ dynamic-dependencies-common 1.86.0-SNAPSHOT - - org.talend.sdk.component - component-runtime-junit - 1.86.0-SNAPSHOT - test - - @@ -63,7 +42,7 @@ - dynamic.dependencies.dataset + org.talend.sdk.component.dynamic.dependencies.withdataset diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java index c70b45d2945db..f3fad870ec787 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java @@ -15,10 +15,16 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.service; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import lombok.extern.slf4j.Slf4j; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,11 +35,7 @@ import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Datastore; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_ROOT_REPOSITORY; +import lombok.extern.slf4j.Slf4j; @Slf4j @WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies") @@ -64,13 +66,13 @@ void setUp() { } @Test - void testloadIterator(){ + void testloadIterator() { final Iterator result = dynamicDependenciesServiceService.loadIterator(config); Assertions.assertTrue(result.hasNext()); final Record record = result.next(); Assertions.assertNotNull(record); - // Assertions.assertEquals(" ", record.getString(ENTRY_CLASSLOADER)); + // Assertions.assertEquals(" ", record.getString(ENTRY_CLASSLOADER)); Assertions.assertEquals(" ", record.getString(ENTRY_MAVEN)); Assertions.assertEquals(" ", record.getString(ENTRY_CLASS)); Assertions.assertEquals(" ", record.getString(ENTRY_FROM_LOCATION)); diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml index 0abbd2b1d5ca6..c25c4f634f7e8 100644 --- a/sample-parent/sample-features/dynamic-dependencies/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -23,14 +23,23 @@ 1.86.0-SNAPSHOT - dynamicdependencies + dynamic-dependencies pom Component Runtime :: Sample Feature @DynamicDependency dynamic-dependencies-common dynamic-dependencies-with-dataset - dynamic-dependencies-with-datastore + + + + org.talend.sdk.component + component-runtime-junit + ${project.version} + test + + + \ No newline at end of file From 51c283867f1375cea650c6b124eb960e5465c2f6 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Mon, 27 Oct 2025 18:35:32 +0100 Subject: [PATCH 07/20] chore(QTDI-1914): Working unit test. --- .../dynamic-dependencies-with-dataset/pom.xml | 10 +++- .../input/DynamicDependenciesInput.java | 4 +- .../{ => withdataset}/package-info.java | 2 +- .../service/DynamicDependenciesService.java | 2 +- .../input/Messages.properties | 0 .../DynamicDependenciesServiceTest.java | 46 ++++++++++++------- 6 files changed, 42 insertions(+), 22 deletions(-) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/{ => withdataset}/input/DynamicDependenciesInput.java (96%) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/{ => withdataset}/package-info.java (98%) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/{ => withdataset}/service/DynamicDependenciesService.java (99%) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/{ => withdataset}/input/Messages.properties (100%) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/{ => withdataset}/service/DynamicDependenciesServiceTest.java (54%) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml index 544180efc7747..efe520d57f7b0 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -29,9 +29,15 @@ org.talend.sdk.component dynamic-dependencies-common - 1.86.0-SNAPSHOT + ${project.version} + + + + org.apache.commons + commons-numbers-primes + 1.2 + test - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesInput.java similarity index 96% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesInput.java index 6bdbd5a1506cc..15847e1caf448 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/input/DynamicDependenciesInput.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesInput.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.input; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.input; import java.io.Serializable; import java.util.Iterator; @@ -27,7 +27,7 @@ import org.talend.sdk.component.api.meta.Documentation; import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService; @Version @Icon(value = Icon.IconType.CUSTOM, custom = "icon") diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java similarity index 98% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java index d7b5b6f6dbc76..3610f69bb331a 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/package-info.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java @@ -17,7 +17,7 @@ family = "dynamicDependencies", categories = "sample") @Icon(value = Icon.IconType.CUSTOM, custom = "icon") -package org.talend.sdk.component.sample.feature.dynamicdependencies; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset; import org.talend.sdk.component.api.component.Components; import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java similarity index 99% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java index a10e01ee9833d..5b775e7000361 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.service; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; import java.io.Serializable; import java.net.URL; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties similarity index 100% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/input/Messages.properties rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesServiceTest.java similarity index 54% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesServiceTest.java index f3fad870ec787..10cb16c47b8b8 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/DynamicDependenciesServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesServiceTest.java @@ -13,13 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.service; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_ROOT_REPOSITORY; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_CLAZZ_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_CONNECTOR_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_IS_LOADED; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; import java.util.ArrayList; import java.util.Iterator; @@ -38,7 +41,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j -@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies") +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") public class DynamicDependenciesServiceTest { @Service @@ -48,7 +51,6 @@ public class DynamicDependenciesServiceTest { @BeforeEach void setUp() { - // Any setup required before each test can be done here config = new Config(); Dataset dse = new Dataset(); Datastore dso = new Datastore(); @@ -59,25 +61,37 @@ void setUp() { depend.setGroupId("org.apache.commons"); depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); depends.add(depend); - dse.setDependencies(depends); dse.setDso(dso); config.setDse(dse); + config.setEnvironmentInformation(true); } @Test void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + final Iterator result = dynamicDependenciesServiceService.loadIterator(config); Assertions.assertTrue(result.hasNext()); final Record record = result.next(); Assertions.assertNotNull(record); - // Assertions.assertEquals(" ", record.getString(ENTRY_CLASSLOADER)); - Assertions.assertEquals(" ", record.getString(ENTRY_MAVEN)); - Assertions.assertEquals(" ", record.getString(ENTRY_CLASS)); - Assertions.assertEquals(" ", record.getString(ENTRY_FROM_LOCATION)); - Assertions.assertEquals(" ", record.getString(ENTRY_ROOT_REPOSITORY)); - Assertions.assertEquals(" ", record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); + Assertions.assertEquals( + "org.apache.commons.numbers.primes.SmallPrimes", + record.getString(ENTRY_CLASS)); + Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); + Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER).startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER).startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); + Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) + .endsWith( + "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); + Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); + Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); Assertions.assertFalse(result.hasNext()); } -} +} \ No newline at end of file From a921b04ff3dbbab0718966e56ec5f2e0460cb2c0 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Mon, 27 Oct 2025 23:03:35 +0100 Subject: [PATCH 08/20] chore(QTDI-1914): working dynamic dependencies connectors. --- .../DynamicDependenciesConfiguration.java | 34 ++++++ .../config/Dependency.java | 48 +++++++++ .../config/DynamicDependencyConfig.java | 28 +++++ .../AbstractDynamicDependenciesService.java} | 37 +++---- .../withdataset}/config/Config.java | 13 ++- .../withdataset}/config/Dataset.java | 27 +---- .../withdataset}/config/Datastore.java | 2 +- ... DynamicDependenciesWithDatasetInput.java} | 11 +- .../withdataset/package-info.java | 2 +- ...DynamicDependenciesWithDatasetService.java | 48 +++++++++ .../src/main/resources/icons/dark/icon.svg | 36 ++++--- .../src/main/resources/icons/light/icon.svg | 36 ++++--- .../withdataset/Messages.properties | 19 ++++ .../withdataset/config}/Messages.properties | 8 +- .../withdataset/input/Messages.properties | 2 +- ...icDependenciesWithDatasetServiceTest.java} | 37 ++++--- .../pom.xml | 20 +++- .../withdatastore/config/Config.java | 57 ++++++++++ .../withdatastore/config/Dataset.java | 38 +++++++ .../withdatastore/config/Datastore.java | 41 +++++++ ...DynamicDependenciesWithDatastoreInput.java | 64 +++++++++++ .../withdatastore/package-info.java | 23 ++++ ...namicDependenciesWithDatastoreService.java | 49 +++++++++ .../src/main/resources/icons/dark/icon.svg | 36 ++++--- .../src/main/resources/icons/light/icon.svg | 36 ++++--- .../withdatastore/Messages.properties | 19 ++++ .../withdatastore}/config/Messages.properties | 14 +-- .../withdatastore/input/Messages.properties | 17 +++ ...cDependenciesWithDatastoreServiceTest.java | 100 +++++++++++++++++ .../pom.xml | 58 ++++++++++ .../config/Config.java | 62 +++++++++++ .../config/Dataset.java | 38 +++++++ .../config/Datastore.java | 30 ++++++ .../config/SubConfig.java | 41 +++++++ ...DynamicDependenciesconfigurationInput.java | 64 +++++++++++ .../package-info.java | 23 ++++ ...namicDependenciesConfigurationService.java | 49 +++++++++ .../src/main/resources/icons/dark}/icon.svg | 36 ++++--- .../src/main/resources/icons/light}/icon.svg | 36 ++++--- .../Messages.properties | 19 ++++ .../config/Messages.properties | 22 ++++ .../input/Messages.properties | 17 +++ ...cDependenciesConfigurationServiceTest.java | 102 ++++++++++++++++++ .../dynamic-dependencies/pom.xml | 3 +- 44 files changed, 1316 insertions(+), 186 deletions(-) create mode 100644 component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java => dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java} (85%) rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies => dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset}/config/Config.java (76%) rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies => dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset}/config/Dataset.java (69%) rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies => dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset}/config/Datastore.java (97%) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/{DynamicDependenciesInput.java => DynamicDependenciesWithDatasetInput.java} (83%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies => dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config}/Messages.properties (73%) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/{DynamicDependenciesServiceTest.java => DynamicDependenciesWithDatasetServiceTest.java} (75%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies => dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore}/config/Messages.properties (64%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/resources/icons/light => dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark}/icon.svg (53%) rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-common/src/main/resources/icons/dark => dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light}/icon.svg (53%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java diff --git a/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java b/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java new file mode 100644 index 0000000000000..f7f01ec74d5b3 --- /dev/null +++ b/component-api/src/main/java/org/talend/sdk/component/api/configuration/type/DynamicDependenciesConfiguration.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.api.configuration.type; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.talend.sdk.component.api.configuration.type.meta.ConfigurationType; +import org.talend.sdk.component.api.meta.Documentation; + +@Target(TYPE) +@Retention(RUNTIME) +@ConfigurationType("dynamicDependenciesConfiguration") +@Documentation("Mark a model (complex object) as being the configuration expected to compute dynamic dependencies.") +public @interface DynamicDependenciesConfiguration { + + String value() default "default"; +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java new file mode 100644 index 0000000000000..a4c67f8826dbd --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@GridLayout(value = { + @GridLayout.Row({ "groupId", "artifactId", "version", "clazz" }) +}) +public class Dependency implements Serializable { + + @Option + @Documentation("The groupId of the dependency.") + private String groupId; + + @Option + @Documentation("The artifactId of the dependency.") + private String artifactId; + + @Option + @Documentation("The version of the dependency.") + private String version; + + @Option + @Documentation("The class to try to load from this dependency.") + private String clazz; + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java new file mode 100644 index 0000000000000..b40f4d3faa9c8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/DynamicDependencyConfig.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.config; + +import java.util.List; + +public interface DynamicDependencyConfig { + + List getDependencies(); + + boolean isEnvironmentInformation(); + + boolean isDieOnError(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java similarity index 85% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java index 5b775e7000361..8ba1375183cda 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; +package org.talend.sdk.component.sample.feature.dynamicdependencies.service; import java.io.Serializable; import java.net.URL; @@ -21,25 +21,20 @@ import java.util.Iterator; import java.util.List; -import org.talend.sdk.component.api.configuration.Option; import org.talend.sdk.component.api.exception.ComponentException; import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.api.record.Record.Builder; import org.talend.sdk.component.api.record.Schema; import org.talend.sdk.component.api.record.Schema.Type; import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.api.service.dependency.DynamicDependencies; import org.talend.sdk.component.api.service.record.RecordBuilderFactory; -import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; import lombok.extern.slf4j.Slf4j; @Slf4j -@Service -public class DynamicDependenciesService implements Serializable { +public abstract class AbstractDynamicDependenciesService implements Serializable { public static final String DEPENDENCY_ACTION = "DEPENDENCY_ACTION"; @@ -68,11 +63,11 @@ public class DynamicDependenciesService implements Serializable { @Service private RecordBuilderFactory factory; - public Iterator loadIterator(final Config config) { - Schema schema = buildSchema(config); + public Iterator loadIterator(final DynamicDependencyConfig dynamicDependencyConfig) { + Schema schema = buildSchema(dynamicDependencyConfig); List records = new ArrayList<>(); - for (Dependency dependency : config.getDse().getDependencies()) { + for (Dependency dependency : dynamicDependencyConfig.getDependencies()) { Builder builder = factory.newRecordBuilder(schema); String maven = String.format("%s:%s:%s", dependency.getGroupId(), dependency.getArtifactId(), @@ -93,7 +88,7 @@ public Iterator loadIterator(final Config config) { URL url = clazz.getClassLoader().getResource(classPath); fromLocation = String.valueOf(url); } catch (ClassNotFoundException e) { - manageException(config.isDieOnError(), + manageException(dynamicDependencyConfig.isDieOnError(), "Cannot load class %s from system classloader".formatted(dependency.getClazz()), e); } @@ -111,7 +106,7 @@ public Iterator loadIterator(final Config config) { .withBoolean(ENTRY_IS_TCK_CONTAINER, isTckContainer) .withBoolean(ENTRY_IS_LOADED_IN_TCK, isLoadedInTck); - if (config.isEnvironmentInformation()) { + if (dynamicDependencyConfig.isEnvironmentInformation()) { String rootRepository = System.getProperty("talend.component.manager.m2.repository"); String runtimeClasspath = System.getProperty("java.class.path"); @@ -127,7 +122,7 @@ public Iterator loadIterator(final Config config) { return records.iterator(); } - private Schema buildSchema(final Config config) { + protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConfig) { Schema.Builder builder = factory.newSchemaBuilder(Type.RECORD) .withEntry(factory.newEntryBuilder().withName(ENTRY_MAVEN).withType(Type.STRING).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_CLASS).withType(Type.STRING).build()) @@ -139,7 +134,7 @@ private Schema buildSchema(final Config config) { .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_TCK_CONTAINER).withType(Type.BOOLEAN).build()) .withEntry(factory.newEntryBuilder().withName(ENTRY_IS_LOADED_IN_TCK).withType(Type.BOOLEAN).build()); - if (config.isEnvironmentInformation()) { + if (dynamicDependencyConfig.isEnvironmentInformation()) { builder = builder .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) .withEntry( @@ -157,19 +152,13 @@ private void manageException(final boolean dieOnError, final String message, fin } } - @DynamicDependencies(DEPENDENCY_ACTION) - public List getDynamicDependencies(@Option("configuration") final Dataset dataset) { - return dataset.getDependencies() + protected List getDynamicDependencies(final List dependencies) { + return dependencies .stream() .map(d -> String.format("%s:%s:%s", d.getGroupId(), d.getArtifactId(), d.getVersion())) .toList(); } - @DiscoverSchemaExtended(DISCOVERSCHEMA_ACTION) - public Schema guessSchema4Input(final @Option("configuration") Config config) { - return buildSchema(config); - } - /** * Return true if the given path correspond to a class that has been loaded from a jar that contains * a TALEND-INF/dependencies.txt file. diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java similarity index 76% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java index 5bb218e825826..e9070eae41898 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java @@ -13,13 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.config; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; import org.talend.sdk.component.api.configuration.Option; import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; import lombok.Data; @@ -31,7 +35,7 @@ @GridLayout.Row({ "dse" }), @GridLayout.Row({ "environmentInformation" }) }) -public class Config implements Serializable { +public class Config implements DynamicDependencyConfig, Serializable { @Option @Documentation("The dataset configuration.") @@ -45,4 +49,9 @@ public class Config implements Serializable { @Documentation("More environment information.") private boolean environmentInformation = false; + @Override + public List getDependencies() { + return new ArrayList<>(this.getDse().getDependencies()); + } + } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java similarity index 69% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java index c0accd24d8d49..dda5e9d89446c 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dataset.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.config; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; import java.io.Serializable; import java.util.ArrayList; @@ -23,6 +23,7 @@ import org.talend.sdk.component.api.configuration.type.DataSet; import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import lombok.Data; @@ -42,28 +43,4 @@ public class Dataset implements Serializable { @Documentation("The dependencies to load dynamically.") private List dependencies = new ArrayList<>(); - @Data - @GridLayout(value = { - @GridLayout.Row({ "groupId", "artifactId", "version", "clazz" }) - }) - public static class Dependency implements Serializable { - - @Option - @Documentation("The groupId of the dependency.") - private String groupId; - - @Option - @Documentation("The artifactId of the dependency.") - private String artifactId; - - @Option - @Documentation("The version of the dependency.") - private String version; - - @Option - @Documentation("The class to try to load from this dependency.") - private String clazz; - - } - } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java similarity index 97% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java index 21f23b347e87a..de540902c68ff 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Datastore.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Datastore.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.config; +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config; import java.io.Serializable; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java similarity index 83% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesInput.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java index 15847e1caf448..30e4e53d5d897 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesInput.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/DynamicDependenciesWithDatasetInput.java @@ -26,22 +26,23 @@ import org.talend.sdk.component.api.input.Producer; import org.talend.sdk.component.api.meta.Documentation; import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService; @Version @Icon(value = Icon.IconType.CUSTOM, custom = "icon") @Emitter(name = "Input") @Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesInput implements Serializable { +public class DynamicDependenciesWithDatasetInput implements Serializable { private final Config config; - private final DynamicDependenciesService service; + private final DynamicDependenciesWithDatasetService service; private Iterator recordIterator; - public DynamicDependenciesInput(final Config config, final DynamicDependenciesService service) { + public DynamicDependenciesWithDatasetInput(final Config config, + final DynamicDependenciesWithDatasetService service) { this.config = config; this.service = service; } diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java index 3610f69bb331a..5d16d15697f92 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ @Components( - family = "dynamicDependencies", + family = "dynamicDependenciesWithDataset", categories = "sample") @Icon(value = Icon.IconType.CUSTOM, custom = "icon") package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java new file mode 100644 index 0000000000000..aadf3fcfeb374 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetService.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithDatasetService extends AbstractDynamicDependenciesService implements Serializable { + + public final static String DEPENDENCY_WITHDATASET_ACTION = "DEPENDENCY_WITHDATASET_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theDataset") final Dataset dataset) { + return super.getDynamicDependencies(dataset.getDependencies()); + } + + @DiscoverSchemaExtended(DEPENDENCY_WITHDATASET_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg index 6e254d5c33ec9..3e6ba66a42db8 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/dark/icon.svg @@ -21,8 +21,8 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" - inkscape:cx="13.998706" - inkscape:cy="-1.4687167" + inkscape:cx="30.820103" + inkscape:cy="-1.445768" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -37,24 +37,30 @@ style="fill: rgb(255, 255, 255);" id="rect1" /> DynamicDynamicDependencies + style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597">DependenciesDataset diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg index 6e254d5c33ec9..3e6ba66a42db8 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/icons/light/icon.svg @@ -21,8 +21,8 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" - inkscape:cx="13.998706" - inkscape:cy="-1.4687167" + inkscape:cx="30.820103" + inkscape:cy="-1.445768" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -37,24 +37,30 @@ style="fill: rgb(255, 255, 255);" id="rect1" /> DynamicDynamicDependencies + style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597">DependenciesDataset diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties new file mode 100644 index 0000000000000..f1e4d16856f4d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties @@ -0,0 +1,19 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies +dynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependenciesWithDataset.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties similarity index 73% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties index 80342c6c8f436..bd147d336d2a1 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties @@ -14,6 +14,8 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependencies.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies -dynamicDependencies.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies -dynamicDependencies.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file +Dataset.dso._displayName = +Dataset.dependencies._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = +Config.environmentInformation._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties index 601aeca6c086c..bb6d78ae9d32f 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependencies.Input._displayName = Dynamic Dependencies Input \ No newline at end of file +dynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java similarity index 75% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesServiceTest.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java index 10cb16c47b8b8..7149cf1f65ced 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java @@ -15,14 +15,14 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_CLAZZ_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_CONNECTOR_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_IS_LOADED; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_ROOT_REPOSITORY; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_CLAZZ_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_CONNECTOR_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_IS_LOADED; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_RUNTIME_CLASSPATH; import java.util.ArrayList; import java.util.Iterator; @@ -34,18 +34,19 @@ import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Datastore; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Datastore; import lombok.extern.slf4j.Slf4j; @Slf4j @WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") -public class DynamicDependenciesServiceTest { +public class DynamicDependenciesWithDatasetServiceTest { @Service - DynamicDependenciesService dynamicDependenciesServiceService; + DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; private Config config; @@ -54,8 +55,8 @@ void setUp() { config = new Config(); Dataset dse = new Dataset(); Datastore dso = new Datastore(); - List depends = new ArrayList<>(); - Dataset.Dependency depend = new Dataset.Dependency(); + List depends = new ArrayList<>(); + Dependency depend = new Dependency(); depend.setArtifactId("commons-numbers-primes"); depend.setVersion("1.2"); depend.setGroupId("org.apache.commons"); @@ -82,9 +83,11 @@ void testloadIterator() { record.getString(ENTRY_CLASS)); Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER).startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER).startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) .endsWith( diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml index 9d5d9524c22fa..cffba101241aa 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml @@ -17,7 +17,7 @@ 4.0.0 org.talend.sdk.component - dynamicdependencies + dynamic-dependencies 1.86.0-SNAPSHOT @@ -25,6 +25,21 @@ jar Component Runtime :: Sample Feature @DynamicDependency with Datastore + + + org.talend.sdk.component + dynamic-dependencies-common + ${project.version} + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + @@ -33,12 +48,11 @@ - dynamic.dependencies.datastore + org.talend.sdk.component.dynamic.dependencies.withdatastore - \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java new file mode 100644 index 0000000000000..fc376ed311e35 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "environmentInformation" }) +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getDse().getDso().getDependencies()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java new file mode 100644 index 0000000000000..0faac7aef808c --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java new file mode 100644 index 0000000000000..dc789196d89d3 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Datastore.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@GridLayout({ + @GridLayout.Row({ "dependencies" }) +}) +public class Datastore implements Serializable { + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java new file mode 100644 index 0000000000000..09159bfbc339d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/DynamicDependenciesWithDatastoreInput.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDatastoreInput implements Serializable { + + private final Config config; + + private final DynamicDependenciesWithDatastoreService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDatastoreInput(final Config config, + final DynamicDependenciesWithDatastoreService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java new file mode 100644 index 0000000000000..acd6d1e4fe4d8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "dynamicDependenciesWithDatastore", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java new file mode 100644 index 0000000000000..df1c2e6ab564a --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithDatastoreService extends AbstractDynamicDependenciesService + implements Serializable { + + public final static String DEPENDENCY_WITHDATASTORE_ACTION = "DEPENDENCY_WITHDATASTORE_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theDatastore") final Datastore datastore) { + return super.getDynamicDependencies(datastore.getDependencies()); + } + + @DiscoverSchemaExtended(DISCOVERSCHEMA_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg index 6e254d5c33ec9..750d837d60cec 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/dark/icon.svg @@ -21,8 +21,8 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" - inkscape:cx="13.998706" - inkscape:cy="-1.4687167" + inkscape:cx="30.820103" + inkscape:cy="-1.4228193" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -37,24 +37,30 @@ style="fill: rgb(255, 255, 255);" id="rect1" /> DynamicDynamicDependencies + style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597">DependenciesDatastore diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg index 6e254d5c33ec9..750d837d60cec 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/icons/light/icon.svg @@ -21,8 +21,8 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" - inkscape:cx="13.998706" - inkscape:cy="-1.4687167" + inkscape:cx="30.820103" + inkscape:cy="-1.4228193" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -37,24 +37,30 @@ style="fill: rgb(255, 255, 255);" id="rect1" /> DynamicDynamicDependencies + style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597">DependenciesDatastore diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties new file mode 100644 index 0000000000000..f5f3fecda82c6 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties @@ -0,0 +1,19 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies +dynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependenciesWithDatastore.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties similarity index 64% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties index aa1d1d58b4ea8..d6aafaad395f8 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties @@ -14,20 +14,8 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example +Datastore.dependencies._displayName = Dataset.dso._displayName = -Dataset.dependencies._displayName = -Dependency.groupId._displayName = -Dependency.artifactId._displayName = -Dependency.version._displayName = -Dependency.clazz._displayName = Config.dse._displayName = Config.dieOnError._displayName = -Config.rootRepository._displayName = -Config.runtimeClassPath._displayName = -Dependency.groupId._placeholder = -Dependency.artifactId._placeholder = -Dependency.version._placeholder = -Dependency.clazz._placeholder = -Datastore.input._displayName = -Datastore.input._placeholder = Config.environmentInformation._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties new file mode 100644 index 0000000000000..2f50774da5a3b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java new file mode 100644 index 0000000000000..ccd72e6353b06 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java @@ -0,0 +1,100 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; + +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_CLAZZ_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_CONNECTOR_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_IS_LOADED; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_RUNTIME_CLASSPATH; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore") +public class DynamicDependenciesWithDatastoreServiceTest { + + @Service + DynamicDependenciesWithDatastoreService dynamicDependenciesServiceService; + + private Config config; + + @BeforeEach + void setUp() { + config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = new ArrayList<>(); + Dependency depend = new Dependency(); + depend.setArtifactId("commons-numbers-primes"); + depend.setVersion("1.2"); + depend.setGroupId("org.apache.commons"); + depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); + depends.add(depend); + dso.setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + } + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + final Record record = result.next(); + Assertions.assertNotNull(record); + Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); + Assertions.assertEquals( + "org.apache.commons.numbers.primes.SmallPrimes", + record.getString(ENTRY_CLASS)); + Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); + Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); + Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) + .endsWith( + "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); + Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); + Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); + Assertions.assertFalse(result.hasNext()); + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml new file mode 100644 index 0000000000000..06bc0e5bbe3c3 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.talend.sdk.component + dynamic-dependencies + 1.86.0-SNAPSHOT + + + dynamic-dependencies-with-dynamicDependenciesConfiguration + jar + Component Runtime :: Sample Feature @DynamicDependency with DynamicDependenciesConfiguration + + + + org.talend.sdk.component + dynamic-dependencies-common + ${project.version} + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.talend.sdk.component.dynamic.dependencies.withDynamicDependenciesConfiguration + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java new file mode 100644 index 0000000000000..d9ab2e7b5f3f6 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java @@ -0,0 +1,62 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "subConfig" }), + @GridLayout.Row({ "environmentInformation" }) +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("Sub-configuration that contains the DynamidDependenciesConfiguration.") + private SubConfig subConfig = new SubConfig(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getSubConfig().getDependencies()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java new file mode 100644 index 0000000000000..3fe30c3f77fbf --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java new file mode 100644 index 0000000000000..3c3dbdc92160e --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Datastore.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@AutoLayout +public class Datastore implements Serializable { + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java new file mode 100644 index 0000000000000..2693e8678b6eb --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/SubConfig.java @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DynamicDependenciesConfiguration; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@DynamicDependenciesConfiguration +@GridLayout({ + @GridLayout.Row({ "dependencies" }) +}) +public class SubConfig implements Serializable { + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java new file mode 100644 index 0000000000000..7e2adbf79509b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDynamicDependenciesconfigurationInput implements Serializable { + + private final Config config; + + private final DynamicDependenciesWithDynamicDependenciesConfigurationService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDynamicDependenciesconfigurationInput(final Config config, + final DynamicDependenciesWithDynamicDependenciesConfigurationService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java new file mode 100644 index 0000000000000..c484957886382 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "dynamicDependenciesWithDynamicDependenciesConfiguration", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java new file mode 100644 index 0000000000000..a20ea5e99987a --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.SubConfig; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesWithDynamicDependenciesConfigurationService extends AbstractDynamicDependenciesService + implements Serializable { + + public final static String DEPENDENCY_WITHDATASET_ACTION = "DEPENDENCY_WITHDATASET_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theSubConfig") final SubConfig subConfig) { + return super.getDynamicDependencies(subConfig.getDependencies()); + } + + @DiscoverSchemaExtended(DISCOVERSCHEMA_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg similarity index 53% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/light/icon.svg rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg index 6e254d5c33ec9..75edf24718ba0 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/light/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/dark/icon.svg @@ -21,8 +21,8 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" - inkscape:cx="13.998706" - inkscape:cy="-1.4687167" + inkscape:cx="30.820103" + inkscape:cy="-1.4228193" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -37,24 +37,30 @@ style="fill: rgb(255, 255, 255);" id="rect1" /> DynamicDynamicDependencies + style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597">DependenciesDynDepConf diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg similarity index 53% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/dark/icon.svg rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg index 6e254d5c33ec9..75edf24718ba0 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/resources/icons/dark/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/icons/light/icon.svg @@ -21,8 +21,8 @@ inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" - inkscape:cx="13.998706" - inkscape:cy="-1.4687167" + inkscape:cx="30.820103" + inkscape:cy="-1.4228193" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -37,24 +37,30 @@ style="fill: rgb(255, 255, 255);" id="rect1" /> DynamicDynamicDependencies + style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597">DependenciesDynDepConf diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties new file mode 100644 index 0000000000000..8be235fe23afa --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties @@ -0,0 +1,19 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies +dynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependenciesWithDynamicDependenciesConfiguration.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties new file mode 100644 index 0000000000000..725f8dab189c0 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties @@ -0,0 +1,22 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Dataset.dso._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = +Config.environmentInformation._displayName = +Config.subConfig._displayName = +SubConfig.dependencies._displayName = \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties new file mode 100644 index 0000000000000..52816b8cb1df6 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDynamicDependenciesConfiguration.Input._displayName = Dynamic Dependencies With DynamicDependenciesConfiguration Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java new file mode 100644 index 0000000000000..019870330e62b --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java @@ -0,0 +1,102 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; + +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_CLAZZ_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_CONNECTOR_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_IS_LOADED; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_RUNTIME_CLASSPATH; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Datastore; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents( + value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration") +public class DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest { + + @Service + DynamicDependenciesWithDynamicDependenciesConfigurationService dynamicDependenciesServiceService; + + private Config config; + + @BeforeEach + void setUp() { + config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = new ArrayList<>(); + Dependency depend = new Dependency(); + depend.setArtifactId("commons-numbers-primes"); + depend.setVersion("1.2"); + depend.setGroupId("org.apache.commons"); + depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); + depends.add(depend); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + config.getSubConfig().setDependencies(depends); + } + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + final Record record = result.next(); + Assertions.assertNotNull(record); + Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); + Assertions.assertEquals( + "org.apache.commons.numbers.primes.SmallPrimes", + record.getString(ENTRY_CLASS)); + Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); + Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); + Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) + .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); + Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); + Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) + .endsWith( + "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); + Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); + Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); + Assertions.assertFalse(result.hasNext()); + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml index c25c4f634f7e8..1b2db4b3ca819 100644 --- a/sample-parent/sample-features/dynamic-dependencies/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -30,7 +30,8 @@ dynamic-dependencies-common dynamic-dependencies-with-dataset - + dynamic-dependencies-with-datastore + dynamic-dependencies-with-dynamicDependenciesConfiguration From 54714b77e57fc91ab5755c0608e14ea8962151b0 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Tue, 28 Oct 2025 16:03:40 +0800 Subject: [PATCH 09/20] fix labels --- .../dynamicdependencies/withdataset/Messages.properties | 4 ++-- .../dynamicdependencies/withdatastore/Messages.properties | 4 ++-- .../withdatastore/input/Messages.properties | 2 +- .../withDynamicDependenciesConfiguration/Messages.properties | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties index f1e4d16856f4d..ec724be2ad89d 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties @@ -14,6 +14,6 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies -dynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset +dynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset dynamicDependenciesWithDataset.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties index f5f3fecda82c6..845043aa04e82 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties @@ -14,6 +14,6 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies -dynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datastore +dynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore dynamicDependenciesWithDatastore.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties index 2f50774da5a3b..5a92305e1efb7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file +dynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties index 8be235fe23afa..8c2575448881a 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties @@ -14,6 +14,6 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies -dynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies +dynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With DynamicDependenciesConfiguration +dynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With DynamicDependenciesConfiguration dynamicDependenciesWithDynamicDependenciesConfiguration.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file From d52d6eb6abf018d958174aafe03dd07bca896a51 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Tue, 28 Oct 2025 18:26:00 +0100 Subject: [PATCH 10/20] chore(QTDI-1914): fix artifact group id for dependency. --- .../dynamic-dependencies-common/pom.xml | 8 +++++--- .../dynamic-dependencies-with-dataset/pom.xml | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml index adb359f7664c7..daf4a3b6dab30 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml @@ -13,7 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.talend.sdk.component @@ -21,6 +22,9 @@ 1.86.0-SNAPSHOT + + + org.talend.sdk.sample dynamic-dependencies-common jar Component Runtime :: Sample Feature @DynamicDependency Common @@ -44,8 +48,6 @@ ${project.version} - - talend-component-validate false diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml index efe520d57f7b0..3518900d1f278 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -25,9 +25,14 @@ jar Component Runtime :: Sample Feature @DynamicDependency with Dataset + + org.talend.sdk.component:dynamic-dependencies-common + include-exclude + + - org.talend.sdk.component + org.talend.sdk.sample dynamic-dependencies-common ${project.version} From e55a7a4dee1c5616babd721539d571d3084a7df2 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Wed, 29 Oct 2025 15:25:09 +0800 Subject: [PATCH 11/20] refactor junits --- .../dynamic-dependencies-common/pom.xml | 41 +++++++ .../dynamicdependencies/TestUtils.java} | 63 +++-------- .../dynamic-dependencies-with-dataset/pom.xml | 9 ++ .../service/DatasetServiceTest.java | 67 ++++++++++++ .../pom.xml | 15 +++ .../service/DatastoreServiceTest.java | 67 ++++++++++++ ...cDependenciesWithDatastoreServiceTest.java | 100 ----------------- .../pom.xml | 15 +++ ...DynamicDependenciesconfigurationInput.java | 6 +- ...amicDependenciesConfigurationService.java} | 2 +- ...cDependenciesConfigurationServiceTest.java | 102 ------------------ 11 files changed, 232 insertions(+), 255 deletions(-) rename sample-parent/sample-features/dynamic-dependencies/{dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java => dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java} (59%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/{DynamicDependenciesWithDynamicDependenciesConfigurationService.java => DynamicDependenciesConfigurationService.java} (94%) delete mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml index daf4a3b6dab30..08b4e41b60f44 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml @@ -29,6 +29,33 @@ jar Component Runtime :: Sample Feature @DynamicDependency Common + + + org.testcontainers + junit-jupiter + 1.21.3 + test + + + org.junit.jupiter + junit-jupiter + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.platform + junit-platform-commons + + + junit + junit + + + + + @@ -57,6 +84,20 @@ + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + + test-jar + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java similarity index 59% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java index 7149cf1f65ced..4e75fe5270480 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDatasetServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java @@ -13,48 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; - -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_CLAZZ_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_CONNECTOR_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_IS_LOADED; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_ROOT_REPOSITORY; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service.DynamicDependenciesWithDatasetService.ENTRY_RUNTIME_CLASSPATH; +package org.talend.sdk.component.sample.feature.dynamicdependencies; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; - import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") -public class DynamicDependenciesWithDatasetServiceTest { +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLASS; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLAZZ_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CONNECTOR_CLASSLOADER; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_FROM_LOCATION; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_IS_LOADED; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_MAVEN; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_ROOT_REPOSITORY; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; - @Service - DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; - - private Config config; - - @BeforeEach - void setUp() { - config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); +public class TestUtils { + public static List getDependList() { List depends = new ArrayList<>(); Dependency depend = new Dependency(); depend.setArtifactId("commons-numbers-primes"); @@ -62,20 +38,10 @@ void setUp() { depend.setGroupId("org.apache.commons"); depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); depends.add(depend); - dse.setDependencies(depends); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); + return depends; } - @Test - void testloadIterator() { - System.setProperty("talend.component.manager.m2.repository", "./lib/"); - - final Iterator result = dynamicDependenciesServiceService.loadIterator(config); - - Assertions.assertTrue(result.hasNext()); - final Record record = result.next(); + public static void assertRecord(Record record) { Assertions.assertNotNull(record); Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); Assertions.assertEquals( @@ -95,6 +61,5 @@ void testloadIterator() { Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); - Assertions.assertFalse(result.hasNext()); } -} \ No newline at end of file +} diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml index 3518900d1f278..da809ae3460dd 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -36,6 +36,15 @@ dynamic-dependencies-common ${project.version} + + + org.talend.sdk.sample + dynamic-dependencies-common + ${project.version} + tests + test-jar + test + org.apache.commons diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java new file mode 100644 index 0000000000000..5b7d5329ec524 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; + +import org.talend.sdk.component.sample.feature.dynamicdependencies.TestUtils; + +import java.util.Iterator; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") +public class DatasetServiceTest { + + @Service + DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; + + private Config config; + + @BeforeEach + void setUp() { + config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = TestUtils.getDependList(); + dse.setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + } + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + TestUtils.assertRecord(result.next()); + Assertions.assertFalse(result.hasNext()); + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml index cffba101241aa..71fbf18f3f7ca 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml @@ -31,6 +31,15 @@ dynamic-dependencies-common ${project.version} + + + org.talend.sdk.sample + dynamic-dependencies-common + ${project.version} + tests + test-jar + test + org.apache.commons @@ -38,6 +47,12 @@ 1.2 test + + org.talend.sdk.sample + dynamic-dependencies-common + 1.86.0-SNAPSHOT + test + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java new file mode 100644 index 0000000000000..0ef5583a370a6 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; + +import org.talend.sdk.component.sample.feature.dynamicdependencies.TestUtils; + +import java.util.Iterator; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore") +public class DatastoreServiceTest { + + @Service + DynamicDependenciesWithDatastoreService dynamicDependenciesServiceService; + + private Config config; + + @BeforeEach + void setUp() { + config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = TestUtils.getDependList(); + dso.setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + } + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + TestUtils.assertRecord(result.next()); + Assertions.assertFalse(result.hasNext()); + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java deleted file mode 100644 index ccd72e6353b06..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreServiceTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; - -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_CLAZZ_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_CONNECTOR_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_IS_LOADED; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_ROOT_REPOSITORY; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service.DynamicDependenciesWithDatastoreService.ENTRY_RUNTIME_CLASSPATH; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Datastore; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore") -public class DynamicDependenciesWithDatastoreServiceTest { - - @Service - DynamicDependenciesWithDatastoreService dynamicDependenciesServiceService; - - private Config config; - - @BeforeEach - void setUp() { - config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); - List depends = new ArrayList<>(); - Dependency depend = new Dependency(); - depend.setArtifactId("commons-numbers-primes"); - depend.setVersion("1.2"); - depend.setGroupId("org.apache.commons"); - depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); - depends.add(depend); - dso.setDependencies(depends); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); - } - - @Test - void testloadIterator() { - System.setProperty("talend.component.manager.m2.repository", "./lib/"); - - final Iterator result = dynamicDependenciesServiceService.loadIterator(config); - - Assertions.assertTrue(result.hasNext()); - final Record record = result.next(); - Assertions.assertNotNull(record); - Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); - Assertions.assertEquals( - "org.apache.commons.numbers.primes.SmallPrimes", - record.getString(ENTRY_CLASS)); - Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); - Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) - .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); - Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) - .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); - Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); - Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) - .endsWith( - "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); - Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); - Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); - Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); - Assertions.assertFalse(result.hasNext()); - } -} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml index 06bc0e5bbe3c3..24ae599094379 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml @@ -31,6 +31,15 @@ dynamic-dependencies-common ${project.version} + + + org.talend.sdk.sample + dynamic-dependencies-common + ${project.version} + tests + test-jar + test + org.apache.commons @@ -38,6 +47,12 @@ 1.2 test + + org.talend.sdk.sample + dynamic-dependencies-common + 1.86.0-SNAPSHOT + test + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java index 7e2adbf79509b..c4c0afade7f00 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java @@ -27,7 +27,7 @@ import org.talend.sdk.component.api.meta.Documentation; import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesConfigurationService; @Version @Icon(value = Icon.IconType.CUSTOM, custom = "icon") @@ -37,12 +37,12 @@ public class DynamicDependenciesWithDynamicDependenciesconfigurationInput implem private final Config config; - private final DynamicDependenciesWithDynamicDependenciesConfigurationService service; + private final DynamicDependenciesConfigurationService service; private Iterator recordIterator; public DynamicDependenciesWithDynamicDependenciesconfigurationInput(final Config config, - final DynamicDependenciesWithDynamicDependenciesConfigurationService service) { + final DynamicDependenciesConfigurationService service) { this.config = config; this.service = service; } diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java similarity index 94% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java index a20ea5e99987a..c584b7eb124a5 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesWithDynamicDependenciesConfigurationService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java @@ -31,7 +31,7 @@ @Slf4j @Service -public class DynamicDependenciesWithDynamicDependenciesConfigurationService extends AbstractDynamicDependenciesService +public class DynamicDependenciesConfigurationService extends AbstractDynamicDependenciesService implements Serializable { public final static String DEPENDENCY_WITHDATASET_ACTION = "DEPENDENCY_WITHDATASET_ACTION"; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java deleted file mode 100644 index 019870330e62b..0000000000000 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; - -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_CLASS; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_CLAZZ_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_CONNECTOR_CLASSLOADER; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_FROM_LOCATION; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_IS_LOADED; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_MAVEN; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_ROOT_REPOSITORY; -import static org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService.ENTRY_RUNTIME_CLASSPATH; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.api.service.Service; -import org.talend.sdk.component.junit5.WithComponents; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Dataset; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Datastore; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesWithDynamicDependenciesConfigurationService; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@WithComponents( - value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration") -public class DynamicDependenciesWithDynamicDependenciesConfigurationServiceTest { - - @Service - DynamicDependenciesWithDynamicDependenciesConfigurationService dynamicDependenciesServiceService; - - private Config config; - - @BeforeEach - void setUp() { - config = new Config(); - Dataset dse = new Dataset(); - Datastore dso = new Datastore(); - List depends = new ArrayList<>(); - Dependency depend = new Dependency(); - depend.setArtifactId("commons-numbers-primes"); - depend.setVersion("1.2"); - depend.setGroupId("org.apache.commons"); - depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); - depends.add(depend); - dse.setDso(dso); - config.setDse(dse); - config.setEnvironmentInformation(true); - config.getSubConfig().setDependencies(depends); - } - - @Test - void testloadIterator() { - System.setProperty("talend.component.manager.m2.repository", "./lib/"); - - final Iterator result = dynamicDependenciesServiceService.loadIterator(config); - - Assertions.assertTrue(result.hasNext()); - final Record record = result.next(); - Assertions.assertNotNull(record); - Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); - Assertions.assertEquals( - "org.apache.commons.numbers.primes.SmallPrimes", - record.getString(ENTRY_CLASS)); - Assertions.assertTrue(record.getBoolean(ENTRY_IS_LOADED)); - Assertions.assertNotNull(record.getString(ENTRY_CONNECTOR_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CONNECTOR_CLASSLOADER) - .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); - Assertions.assertNotNull(record.getString(ENTRY_CLAZZ_CLASSLOADER)); - Assertions.assertTrue(record.getString(ENTRY_CLAZZ_CLASSLOADER) - .startsWith("jdk.internal.loader.ClassLoaders$AppClassLoader")); - Assertions.assertNotNull(record.getString(ENTRY_FROM_LOCATION)); - Assertions.assertTrue(record.getString(ENTRY_FROM_LOCATION) - .endsWith( - "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); - Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); - Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); - Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); - Assertions.assertFalse(result.hasNext()); - } -} \ No newline at end of file From 0c8e974da7205274eb5f07e8bc2a06a43a41300b Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Wed, 29 Oct 2025 16:22:07 +0800 Subject: [PATCH 12/20] add working directory in output --- .../service/AbstractDynamicDependenciesService.java | 10 +++++++--- .../sample/feature/dynamicdependencies/TestUtils.java | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java index 8ba1375183cda..28d492ae60ac4 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java @@ -60,6 +60,8 @@ public abstract class AbstractDynamicDependenciesService implements Serializable public static final String ENTRY_RUNTIME_CLASSPATH = "runtime_classpath"; + public static final String ENTRY_WORKING_DIRECTORY = "Working_directory"; + @Service private RecordBuilderFactory factory; @@ -109,10 +111,12 @@ public Iterator loadIterator(final DynamicDependencyConfig dynamicDepend if (dynamicDependencyConfig.isEnvironmentInformation()) { String rootRepository = System.getProperty("talend.component.manager.m2.repository"); String runtimeClasspath = System.getProperty("java.class.path"); + String workDirectory = System.getProperty("user.dir"); recordBuilder = recordBuilder .withString(ENTRY_ROOT_REPOSITORY, rootRepository) - .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath); + .withString(ENTRY_RUNTIME_CLASSPATH, runtimeClasspath) + .withString(ENTRY_WORKING_DIRECTORY, workDirectory); } Record record = recordBuilder.build(); @@ -137,8 +141,8 @@ protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConf if (dynamicDependencyConfig.isEnvironmentInformation()) { builder = builder .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) - .withEntry( - factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()); + .withEntry(factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) + .withEntry(factory.newEntryBuilder().withName(ENTRY_WORKING_DIRECTORY).withType(Type.STRING).build()); } return builder.build(); diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java index 4e75fe5270480..51981dde355d3 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java @@ -28,6 +28,7 @@ import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_MAVEN; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_ROOT_REPOSITORY; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; +import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_WORKING_DIRECTORY; public class TestUtils { public static List getDependList() { @@ -60,6 +61,7 @@ public static void assertRecord(Record record) { "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); + Assertions.assertNotNull(record.getString(ENTRY_WORKING_DIRECTORY)); Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); } } From 3b18693c83730e31104cf14a53a496c262d6f814 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Wed, 29 Oct 2025 18:12:03 +0100 Subject: [PATCH 13/20] chore(QTDI-1914): Improve and unit test and fix labels. --- .../dynamic-dependencies-common/pom.xml | 7 +++ .../AbstractDynamicDependenciesService.java | 8 +-- ...stractDynamicDependenciesServiceTest.java} | 50 ++++++++++++---- .../dynamic-dependencies-with-dataset/pom.xml | 1 - .../withdataset/Messages.properties | 3 +- .../withdataset/config/Messages.properties | 10 ++-- .../withdataset/input/Messages.properties | 2 +- .../service/DatasetServiceTest.java | 37 +++++------- .../pom.xml | 15 ++--- ...namicDependenciesWithDatastoreService.java | 2 +- .../withdatastore/Messages.properties | 3 +- .../withdatastore/config/Messages.properties | 10 ++-- .../withdatastore/input/Messages.properties | 2 +- .../service/DatastoreServiceTest.java | 35 ++++------- .../pom.xml | 14 ++--- ...DynamicDependenciesconfigurationInput.java | 4 +- ...namicDependenciesConfigurationService.java | 2 +- .../config/Messages.properties | 10 ++-- ...cDependenciesConfigurationServiceTest.java | 58 +++++++++++++++++++ .../dynamic-dependencies/pom.xml | 6 ++ 20 files changed, 175 insertions(+), 104 deletions(-) rename sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/{TestUtils.java => AbstractDynamicDependenciesServiceTest.java} (76%) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationServiceTest.java diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml index 08b4e41b60f44..4ce71b766be23 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/pom.xml @@ -68,6 +68,13 @@ + + + + test-jar + + + org.talend.sdk.component diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java index 28d492ae60ac4..0d8e73213a669 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java @@ -36,8 +36,6 @@ @Slf4j public abstract class AbstractDynamicDependenciesService implements Serializable { - public static final String DEPENDENCY_ACTION = "DEPENDENCY_ACTION"; - public static final String DISCOVERSCHEMA_ACTION = "DISCOVERSCHEMA_ACTION"; public static final String ENTRY_MAVEN = "maven"; @@ -141,8 +139,10 @@ protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConf if (dynamicDependencyConfig.isEnvironmentInformation()) { builder = builder .withEntry(factory.newEntryBuilder().withName(ENTRY_ROOT_REPOSITORY).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) - .withEntry(factory.newEntryBuilder().withName(ENTRY_WORKING_DIRECTORY).withType(Type.STRING).build()); + .withEntry( + factory.newEntryBuilder().withName(ENTRY_RUNTIME_CLASSPATH).withType(Type.STRING).build()) + .withEntry( + factory.newEntryBuilder().withName(ENTRY_WORKING_DIRECTORY).withType(Type.STRING).build()); } return builder.build(); diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java similarity index 76% rename from sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java rename to sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java index 51981dde355d3..272184c99e6e7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/TestUtils.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java @@ -15,11 +15,6 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies; -import java.util.ArrayList; -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.talend.sdk.component.api.record.Record; -import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLASS; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CLAZZ_CLASSLOADER; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_CONNECTOR_CLASSLOADER; @@ -30,8 +25,43 @@ import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_RUNTIME_CLASSPATH; import static org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService.ENTRY_WORKING_DIRECTORY; -public class TestUtils { - public static List getDependList() { +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; + +public abstract class AbstractDynamicDependenciesServiceTest { + + private C config; + + protected abstract C buildConfig(); + + protected abstract S getService(); + + @BeforeEach + void setUp() { + this.config = this.buildConfig(); + } + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = getService().loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + this.assertRecord(result.next()); + Assertions.assertFalse(result.hasNext()); + } + + protected List getDependList() { List depends = new ArrayList<>(); Dependency depend = new Dependency(); depend.setArtifactId("commons-numbers-primes"); @@ -42,7 +72,7 @@ public static List getDependList() { return depends; } - public static void assertRecord(Record record) { + private void assertRecord(Record record) { Assertions.assertNotNull(record); Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); Assertions.assertEquals( @@ -61,7 +91,7 @@ public static void assertRecord(Record record) { "org/apache/commons/commons-numbers-primes/1.2/commons-numbers-primes-1.2.jar!/org/apache/commons/numbers/primes/SmallPrimes.class")); Assertions.assertEquals("./lib/", record.getString(ENTRY_ROOT_REPOSITORY)); Assertions.assertNotNull(record.getString(ENTRY_RUNTIME_CLASSPATH)); - Assertions.assertNotNull(record.getString(ENTRY_WORKING_DIRECTORY)); + Assertions.assertEquals(System.getProperty("user.dir"), record.getString(ENTRY_WORKING_DIRECTORY)); Assertions.assertTrue(record.getString(ENTRY_RUNTIME_CLASSPATH).contains("commons-numbers-primes-1.2.jar")); } -} +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml index da809ae3460dd..8e1614778e7c3 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -41,7 +41,6 @@ org.talend.sdk.sample dynamic-dependencies-common ${project.version} - tests test-jar test diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties index ec724be2ad89d..75f06aebbc117 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties @@ -15,5 +15,4 @@ # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example dynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset -dynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset -dynamicDependenciesWithDataset.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file +dynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties index bd147d336d2a1..37b3370e63193 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Messages.properties @@ -14,8 +14,8 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -Dataset.dso._displayName = -Dataset.dependencies._displayName = -Config.dse._displayName = -Config.dieOnError._displayName = -Config.environmentInformation._displayName = \ No newline at end of file +Dataset.dso._displayName = +Dataset.dependencies._displayName = Dependencies +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties index bb6d78ae9d32f..e283372e8c37c 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file +dynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java index 5b7d5329ec524..f4683eec8c6b2 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/service/DatasetServiceTest.java @@ -15,17 +15,11 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.service; -import org.talend.sdk.component.sample.feature.dynamicdependencies.TestUtils; - -import java.util.Iterator; import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Config; import org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset.config.Dataset; @@ -35,33 +29,28 @@ @Slf4j @WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset") -public class DatasetServiceTest { +public class DatasetServiceTest + extends AbstractDynamicDependenciesServiceTest { @Service - DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; - - private Config config; + private DynamicDependenciesWithDatasetService dynamicDependenciesServiceService; - @BeforeEach - void setUp() { - config = new Config(); + @Override + protected Config buildConfig() { + Config config = new Config(); Dataset dse = new Dataset(); Datastore dso = new Datastore(); - List depends = TestUtils.getDependList(); + List depends = this.getDependList(); dse.setDependencies(depends); dse.setDso(dso); config.setDse(dse); config.setEnvironmentInformation(true); - } - @Test - void testloadIterator() { - System.setProperty("talend.component.manager.m2.repository", "./lib/"); - - final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + return config; + } - Assertions.assertTrue(result.hasNext()); - TestUtils.assertRecord(result.next()); - Assertions.assertFalse(result.hasNext()); + @Override + protected DynamicDependenciesWithDatasetService getService() { + return dynamicDependenciesServiceService; } } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml index 71fbf18f3f7ca..d54c52653b059 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/pom.xml @@ -13,7 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 org.talend.sdk.component @@ -27,7 +28,7 @@ - org.talend.sdk.component + org.talend.sdk.sample dynamic-dependencies-common ${project.version} @@ -36,7 +37,6 @@ org.talend.sdk.sample dynamic-dependencies-common ${project.version} - tests test-jar test @@ -47,12 +47,6 @@ 1.2 test - - org.talend.sdk.sample - dynamic-dependencies-common - 1.86.0-SNAPSHOT - test - @@ -63,7 +57,8 @@ - org.talend.sdk.component.dynamic.dependencies.withdatastore + org.talend.sdk.component.dynamic.dependencies.withdatastore + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java index df1c2e6ab564a..ff0247f3a7cee 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DynamicDependenciesWithDatastoreService.java @@ -41,7 +41,7 @@ public List getDynamicDependencies(@Option("theDatastore") final Datasto return super.getDynamicDependencies(datastore.getDependencies()); } - @DiscoverSchemaExtended(DISCOVERSCHEMA_ACTION) + @DiscoverSchemaExtended(DEPENDENCY_WITHDATASTORE_ACTION) public Schema guessSchema4Input(final @Option("configuration") Config config) { return super.buildSchema(config); } diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties index 845043aa04e82..c1441fd5b6447 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties @@ -15,5 +15,4 @@ # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example dynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datastore -dynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore -dynamicDependenciesWithDatastore.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file +dynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties index d6aafaad395f8..3e79ffdba2002 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Messages.properties @@ -14,8 +14,8 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -Datastore.dependencies._displayName = -Dataset.dso._displayName = -Config.dse._displayName = -Config.dieOnError._displayName = -Config.environmentInformation._displayName = \ No newline at end of file +Datastore.dependencies._displayName = Dependences +Dataset.dso._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties index 5a92305e1efb7..0a253fa924171 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file +dynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java index 0ef5583a370a6..af9ae9265de25 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/service/DatastoreServiceTest.java @@ -15,17 +15,11 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.service; -import org.talend.sdk.component.sample.feature.dynamicdependencies.TestUtils; - -import java.util.Iterator; import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Config; import org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore.config.Dataset; @@ -35,33 +29,28 @@ @Slf4j @WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore") -public class DatastoreServiceTest { +public class DatastoreServiceTest + extends AbstractDynamicDependenciesServiceTest { @Service DynamicDependenciesWithDatastoreService dynamicDependenciesServiceService; - private Config config; - - @BeforeEach - void setUp() { - config = new Config(); + @Override + protected Config buildConfig() { + Config config = new Config(); Dataset dse = new Dataset(); Datastore dso = new Datastore(); - List depends = TestUtils.getDependList(); + List depends = this.getDependList(); dso.setDependencies(depends); dse.setDso(dso); config.setDse(dse); config.setEnvironmentInformation(true); - } - @Test - void testloadIterator() { - System.setProperty("talend.component.manager.m2.repository", "./lib/"); - - final Iterator result = dynamicDependenciesServiceService.loadIterator(config); + return config; + } - Assertions.assertTrue(result.hasNext()); - TestUtils.assertRecord(result.next()); - Assertions.assertFalse(result.hasNext()); + @Override + protected DynamicDependenciesWithDatastoreService getService() { + return dynamicDependenciesServiceService; } } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml index 24ae599094379..a97a22bbaa086 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/pom.xml @@ -25,9 +25,14 @@ jar Component Runtime :: Sample Feature @DynamicDependency with DynamicDependenciesConfiguration + + org.talend.sdk.component:dynamic-dependencies-common + include-exclude + + - org.talend.sdk.component + org.talend.sdk.sample dynamic-dependencies-common ${project.version} @@ -36,7 +41,6 @@ org.talend.sdk.sample dynamic-dependencies-common ${project.version} - tests test-jar test @@ -47,12 +51,6 @@ 1.2 test - - org.talend.sdk.sample - dynamic-dependencies-common - 1.86.0-SNAPSHOT - test - diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java index c4c0afade7f00..921ed21d30f70 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java @@ -26,6 +26,7 @@ import org.talend.sdk.component.api.input.Producer; import org.talend.sdk.component.api.meta.Documentation; import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service.DynamicDependenciesConfigurationService; @@ -33,7 +34,8 @@ @Icon(value = Icon.IconType.CUSTOM, custom = "icon") @Emitter(name = "Input") @Documentation("Dynamic dependencies sample input connector.") -public class DynamicDependenciesWithDynamicDependenciesconfigurationInput implements Serializable { +public class DynamicDependenciesWithDynamicDependenciesconfigurationInput extends AbstractDynamicDependenciesService + implements Serializable { private final Config config; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java index c584b7eb124a5..9fa0876465c46 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java @@ -41,7 +41,7 @@ public List getDynamicDependencies(@Option("theSubConfig") final SubConf return super.getDynamicDependencies(subConfig.getDependencies()); } - @DiscoverSchemaExtended(DISCOVERSCHEMA_ACTION) + @DiscoverSchemaExtended(DEPENDENCY_WITHDATASET_ACTION) public Schema guessSchema4Input(final @Option("configuration") Config config) { return super.buildSchema(config); } diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties index 725f8dab189c0..7e328113b48b1 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Messages.properties @@ -14,9 +14,9 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -Dataset.dso._displayName = -Config.dse._displayName = -Config.dieOnError._displayName = -Config.environmentInformation._displayName = +Dataset.dso._displayName = +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information Config.subConfig._displayName = -SubConfig.dependencies._displayName = \ No newline at end of file +SubConfig.dependencies._displayName = Dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationServiceTest.java new file mode 100644 index 0000000000000..69a385aee45e0 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationServiceTest.java @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.service; + +import java.util.List; + +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents( + value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration") +public class DynamicDependenciesConfigurationServiceTest + extends + AbstractDynamicDependenciesServiceTest { + + @Service + DynamicDependenciesConfigurationService dynamicDependenciesServiceService; + + @Override + protected Config buildConfig() { + Config config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = this.getDependList(); + config.getSubConfig().setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + + return config; + } + + @Override + protected DynamicDependenciesConfigurationService getService() { + return dynamicDependenciesServiceService; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml index 1b2db4b3ca819..756dc532da339 100644 --- a/sample-parent/sample-features/dynamic-dependencies/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -41,6 +41,12 @@ ${project.version} test + \ No newline at end of file From 360f13dc702505e8a51d828fb7dc8a571202f32e Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Thu, 30 Oct 2025 18:17:55 +0100 Subject: [PATCH 14/20] chore(QTDI-1914): Add a connector with same behavior as datapreprun. --- .../pom.xml | 60 +++++++++++++++++ .../DynamicDependencySupported.java | 18 +++++ .../config/Config.java | 64 ++++++++++++++++++ .../config/Dataset.java | 38 +++++++++++ .../config/Datastore.java | 30 +++++++++ .../config/SubConfig.java | 40 +++++++++++ ...DynamicDependenciesconfigurationInput.java | 66 +++++++++++++++++++ .../package-info.java | 23 +++++++ ...endenciesDataprepRunAnnotationService.java | 50 ++++++++++++++ .../service/DataprepRunServiceTest.java | 55 ++++++++++++++++ .../dynamic-dependencies/pom.xml | 1 + 11 files changed, 445 insertions(+) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml new file mode 100644 index 0000000000000..ec4f6bf616d8d --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.talend.sdk.component + sample-features + 1.86.0-SNAPSHOT + + + dynamic-dependencies-with-dataprepRunAnnotation + jar + Component Runtime :: Sample Feature @DynamicDependency with DataprepRun annotation + + + org.talend.sdk.component:dynamic-dependencies-common + include-exclude + + + + + org.talend.sdk.sample + dynamic-dependencies-common + ${project.version} + + + + org.talend.sdk.sample + dynamic-dependencies-common + ${project.version} + test-jar + test + + + + org.apache.commons + commons-numbers-primes + 1.2 + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + dynamic.dependencies.withDataprepRunAnnotation + + + + + + + + \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java new file mode 100644 index 0000000000000..8b20d0077a261 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java @@ -0,0 +1,18 @@ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.talend.sdk.component.api.configuration.type.meta.ConfigurationType; +import org.talend.sdk.component.api.meta.Documentation; + +@Target(TYPE) +@Retention(RUNTIME) +@ConfigurationType("configuration") +@Documentation("Copy/past of the annotation from tDataprepRun.") +public @interface DynamicDependencySupported { + String value() default "default"; +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java new file mode 100644 index 0000000000000..9d138331f36ba --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java @@ -0,0 +1,64 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation.DynamicDependencySupported; + +import lombok.Data; + +/** + * For this sample, the same configuration is used for all connectors input/processor/output. + */ +@Data +@DynamicDependencySupported +@GridLayout({ + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "subConfig" }), + @GridLayout.Row({ "environmentInformation" }) +}) +public class Config implements DynamicDependencyConfig, Serializable { + + @Option + @Documentation("The dataset configuration.") + private Dataset dse = new Dataset(); + + @Option + @Documentation("Sub-configuration that contains the DynamidDependenciesConfiguration.") + private SubConfig subConfig = new SubConfig(); + + @Option + @Documentation("If enable throw an exception for any error, if not just log the error.") + private boolean dieOnError = false; + + @Option + @Documentation("More environment information.") + private boolean environmentInformation = false; + + @Override + public List getDependencies() { + return new ArrayList<>(this.getSubConfig().getDependencies()); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java new file mode 100644 index 0000000000000..e5b6da5daba63 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DataSet; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; + +import lombok.Data; + +@Data +@DataSet("dyndepsdse") +@GridLayout(value = { + @GridLayout.Row({ "dso" }) +}) +public class Dataset implements Serializable { + + @Option + @Documentation("A datastore.") + private Datastore dso = new Datastore(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java new file mode 100644 index 0000000000000..1749603106828 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Datastore.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; + +import org.talend.sdk.component.api.configuration.type.DataStore; +import org.talend.sdk.component.api.configuration.ui.layout.AutoLayout; + +import lombok.Data; + +@Data +@DataStore("dyndepsdso") +@AutoLayout +public class Datastore implements Serializable { + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java new file mode 100644 index 0000000000000..2617e7f559f32 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.configuration.type.DynamicDependenciesConfiguration; +import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; + +import lombok.Data; + +@Data +@GridLayout({ + @GridLayout.Row({ "dependencies" }) +}) +public class SubConfig implements Serializable { + + @Option + @Documentation("The dependencies to load dynamically.") + private List dependencies = new ArrayList<>(); + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java new file mode 100644 index 0000000000000..fe0c9d93077c1 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/DynamicDependenciesWithDynamicDependenciesconfigurationInput.java @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.input; + +import java.io.Serializable; +import java.util.Iterator; + +import javax.annotation.PostConstruct; + +import org.talend.sdk.component.api.component.Icon; +import org.talend.sdk.component.api.component.Version; +import org.talend.sdk.component.api.input.Emitter; +import org.talend.sdk.component.api.input.Producer; +import org.talend.sdk.component.api.meta.Documentation; +import org.talend.sdk.component.api.record.Record; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service.DynamicDependenciesDataprepRunAnnotationService; + +@Version +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +@Emitter(name = "Input") +@Documentation("Dynamic dependencies sample input connector.") +public class DynamicDependenciesWithDynamicDependenciesconfigurationInput extends AbstractDynamicDependenciesService + implements Serializable { + + private final Config config; + + private final DynamicDependenciesDataprepRunAnnotationService service; + + private Iterator recordIterator; + + public DynamicDependenciesWithDynamicDependenciesconfigurationInput(final Config config, + final DynamicDependenciesDataprepRunAnnotationService service) { + this.config = config; + this.service = service; + } + + @PostConstruct + public void init() { + this.recordIterator = this.service.loadIterator(this.config); + } + + @Producer + public Record next() { + if (recordIterator == null || !recordIterator.hasNext()) { + return null; + } + + return recordIterator.next(); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java new file mode 100644 index 0000000000000..2ab45388df734 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Components( + family = "dynamicDependenciesWithDataprepAnnotation", + categories = "sample") +@Icon(value = Icon.IconType.CUSTOM, custom = "icon") +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation; + +import org.talend.sdk.component.api.component.Components; +import org.talend.sdk.component.api.component.Icon; \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java new file mode 100644 index 0000000000000..428a4278349c9 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; + +import java.io.Serializable; +import java.util.List; + +import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Schema; +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.api.service.dependency.DynamicDependencies; +import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.SubConfig; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class DynamicDependenciesDataprepRunAnnotationService extends AbstractDynamicDependenciesService + implements Serializable { + + public final static String DEPENDENCY_WITHDATAPREPRUN_ACTION = "DEPENDENCY_WITHDATAPREPRUN_ACTION"; + + @DynamicDependencies() + public List getDynamicDependencies(@Option("theConfig") final Config config) { + return super.getDynamicDependencies(config.getDependencies()); + } + + @DiscoverSchemaExtended(DEPENDENCY_WITHDATAPREPRUN_ACTION) + public Schema guessSchema4Input(final @Option("configuration") Config config) { + return super.buildSchema(config); + } + +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java new file mode 100644 index 0000000000000..334d62e808a4a --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java @@ -0,0 +1,55 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; + +import java.util.List; + +import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Dataset; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Datastore; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@WithComponents(value = "org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation") +public class DataprepRunServiceTest + extends AbstractDynamicDependenciesServiceTest { + + @Service + DynamicDependenciesDataprepRunAnnotationService dynamicDependenciesServiceService; + + @Override + protected Config buildConfig() { + Config config = new Config(); + Dataset dse = new Dataset(); + Datastore dso = new Datastore(); + List depends = this.getDependList(); + config.getSubConfig().setDependencies(depends); + dse.setDso(dso); + config.setDse(dse); + config.setEnvironmentInformation(true); + + return config; + } + + @Override + protected DynamicDependenciesDataprepRunAnnotationService getService() { + return dynamicDependenciesServiceService; + } +} \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/pom.xml b/sample-parent/sample-features/dynamic-dependencies/pom.xml index 756dc532da339..e354afee25ac0 100644 --- a/sample-parent/sample-features/dynamic-dependencies/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/pom.xml @@ -32,6 +32,7 @@ dynamic-dependencies-with-dataset dynamic-dependencies-with-datastore dynamic-dependencies-with-dynamicDependenciesConfiguration + dynamic-dependencies-with-dataprepRunAnnotation From 136b654ce63f538e99e39ec7f0a391716de8a5a3 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Fri, 31 Oct 2025 09:37:44 +0800 Subject: [PATCH 15/20] fix layout for dieOnError --- .../feature/dynamicdependencies/withdataset/config/Config.java | 1 + .../feature/dynamicdependencies/withdatastore/config/Config.java | 1 + .../withDynamicDependenciesConfiguration/config/Config.java | 1 + 3 files changed, 3 insertions(+) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java index e9070eae41898..4d24151753a22 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java @@ -33,6 +33,7 @@ @Data @GridLayout({ @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) public class Config implements DynamicDependencyConfig, Serializable { diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java index fc376ed311e35..1e7af215441fb 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java @@ -33,6 +33,7 @@ @Data @GridLayout({ @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) public class Config implements DynamicDependencyConfig, Serializable { diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java index d9ab2e7b5f3f6..5e5949dfa7075 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java @@ -34,6 +34,7 @@ @GridLayout({ @GridLayout.Row({ "dse" }), @GridLayout.Row({ "subConfig" }), + @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) public class Config implements DynamicDependencyConfig, Serializable { From c3e7ad07bdd8a3994858a8ccc5890d0b4ba6b39e Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Fri, 31 Oct 2025 16:32:18 +0800 Subject: [PATCH 16/20] Fix dataprepRunAnnotation connector --- .../pom.xml | 21 ++++-- .../DynamicDependencySupported.java | 15 +++++ .../config/Config.java | 1 + .../config/SubConfig.java | 1 - ...endenciesDataprepRunAnnotationService.java | 6 +- .../src/main/resources/icons/dark/icon.svg | 66 +++++++++++++++++++ .../src/main/resources/icons/light/icon.svg | 66 +++++++++++++++++++ .../Messages.properties | 18 +++++ .../config/Messages.properties | 23 +++++++ .../input/Messages.properties | 17 +++++ .../service/DataprepRunServiceTest.java | 1 + 11 files changed, 227 insertions(+), 8 deletions(-) create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties create mode 100644 sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml index ec4f6bf616d8d..cce69a50dd39b 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml @@ -1,11 +1,24 @@ - + + 4.0.0 + org.talend.sdk.component - sample-features + dynamic-dependencies 1.86.0-SNAPSHOT diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java index 8b20d0077a261..1731e25856250 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java @@ -1,3 +1,18 @@ +/** + * Copyright (C) 2006-2025 Talend Inc. - www.talend.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.annotation; import static java.lang.annotation.ElementType.TYPE; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java index 9d138331f36ba..16bdd11b38e5b 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java @@ -36,6 +36,7 @@ @GridLayout({ @GridLayout.Row({ "dse" }), @GridLayout.Row({ "subConfig" }), + @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) public class Config implements DynamicDependencyConfig, Serializable { diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java index 2617e7f559f32..46f239e54a2d7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/SubConfig.java @@ -20,7 +20,6 @@ import java.util.List; import org.talend.sdk.component.api.configuration.Option; -import org.talend.sdk.component.api.configuration.type.DynamicDependenciesConfiguration; import org.talend.sdk.component.api.configuration.ui.layout.GridLayout; import org.talend.sdk.component.api.meta.Documentation; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java index 428a4278349c9..97b62a6980edb 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java @@ -25,8 +25,6 @@ import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.Config; -import org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration.config.SubConfig; import lombok.extern.slf4j.Slf4j; @@ -37,7 +35,9 @@ public class DynamicDependenciesDataprepRunAnnotationService extends AbstractDyn public final static String DEPENDENCY_WITHDATAPREPRUN_ACTION = "DEPENDENCY_WITHDATAPREPRUN_ACTION"; - @DynamicDependencies() + public static final String DEPENDENCY_ACTION = "dataprep-dependencies"; + + @DynamicDependencies(DEPENDENCY_ACTION) public List getDynamicDependencies(@Option("theConfig") final Config config) { return super.getDynamicDependencies(config.getDependencies()); } diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg new file mode 100644 index 0000000000000..3e6ba66a42db8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataset + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg new file mode 100644 index 0000000000000..3e6ba66a42db8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg @@ -0,0 +1,66 @@ + + + + + + DynamicDependenciesDataset + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties new file mode 100644 index 0000000000000..0757f022f7615 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties @@ -0,0 +1,18 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDataprepAnnotation.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset +dynamicDependenciesWithDataprepAnnotation.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties new file mode 100644 index 0000000000000..17cd41bce48d8 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties @@ -0,0 +1,23 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +Dataset.dso._displayName = +Dataset.dependencies._displayName = Dependencies +Config.dse._displayName = +Config.dieOnError._displayName = Die on error +Config.environmentInformation._displayName = Environment information +Config.subConfig._displayName = SubConfig +SubConfig.dependencies._displayName = Dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties new file mode 100644 index 0000000000000..8ece7b6117a49 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties @@ -0,0 +1,17 @@ +# Copyright (C) 2006-2025 Talend Inc. - www.talend.com +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Here you can change all your configuration display names to use more explicit labels +# You can also translate your configuration by adding one file by local Messages_fr.properties for french for example + +dynamicDependenciesWithDataprepAnnotation.Input._displayName = Dynamic Dependencies With Dynamic Dependencies Configuration Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java index 334d62e808a4a..654cdd2895dca 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java @@ -18,6 +18,7 @@ import java.util.List; import org.talend.sdk.component.api.service.Service; +import org.talend.sdk.component.junit5.WithComponents; import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; From 2417f804f45992b3b13045e1ebf723b0cad60617 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Tue, 4 Nov 2025 18:34:27 +0100 Subject: [PATCH 17/20] feat(QTDI-1914): Cleanings. --- .../dynamic-dependencies-with-dataprepRunAnnotation/pom.xml | 5 ----- .../annotation/DynamicDependencySupported.java | 1 + .../withDataprepRunAnnotation/config/Config.java | 5 ++++- .../withDataprepRunAnnotation/config/Dataset.java | 3 +++ .../withDataprepRunAnnotation/package-info.java | 2 +- .../src/main/resources/icons/dark/icon.svg | 4 ++-- .../src/main/resources/icons/light/icon.svg | 4 ++-- .../withDataprepRunAnnotation/Messages.properties | 4 ++-- .../withDataprepRunAnnotation/config/Messages.properties | 2 +- .../withDataprepRunAnnotation/input/Messages.properties | 2 +- .../dynamic-dependencies-with-dataset/pom.xml | 5 ----- .../dynamicdependencies/withdataset/config/Config.java | 5 ++++- .../dynamicdependencies/withdataset/config/Dataset.java | 3 +++ .../dynamicdependencies/withdataset/package-info.java | 2 +- .../dynamicdependencies/withdataset/Messages.properties | 4 ++-- .../withdataset/input/Messages.properties | 2 +- .../dynamicdependencies/withdatastore/config/Config.java | 5 ++++- .../dynamicdependencies/withdatastore/config/Dataset.java | 3 +++ .../dynamicdependencies/withdatastore/package-info.java | 2 +- .../dynamicdependencies/withdatastore/Messages.properties | 4 ++-- .../withdatastore/input/Messages.properties | 2 +- .../withDynamicDependenciesConfiguration/config/Config.java | 5 ++++- .../withDynamicDependenciesConfiguration/config/Dataset.java | 3 +++ .../withDynamicDependenciesConfiguration/package-info.java | 2 +- .../service/DynamicDependenciesConfigurationService.java | 4 ++-- .../withDynamicDependenciesConfiguration/Messages.properties | 5 ++--- .../input/Messages.properties | 2 +- 27 files changed, 52 insertions(+), 38 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml index cce69a50dd39b..0f346b2da2be0 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml @@ -26,11 +26,6 @@ jar Component Runtime :: Sample Feature @DynamicDependency with DataprepRun annotation - - org.talend.sdk.component:dynamic-dependencies-common - include-exclude - - org.talend.sdk.sample diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java index 1731e25856250..7c81044cfbce7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/annotation/DynamicDependencySupported.java @@ -29,5 +29,6 @@ @ConfigurationType("configuration") @Documentation("Copy/past of the annotation from tDataprepRun.") public @interface DynamicDependencySupported { + String value() default "default"; } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java index 16bdd11b38e5b..9b91a834e53ce 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Config.java @@ -36,9 +36,12 @@ @GridLayout({ @GridLayout.Row({ "dse" }), @GridLayout.Row({ "subConfig" }), - @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }) +}) public class Config implements DynamicDependencyConfig, Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java index e5b6da5daba63..ea45a9daba395 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Dataset.java @@ -29,6 +29,9 @@ @GridLayout(value = { @GridLayout.Row({ "dso" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) public class Dataset implements Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java index 2ab45388df734..f671561c7be2c 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ @Components( - family = "dynamicDependenciesWithDataprepAnnotation", + family = "DynamicDependenciesWithDataprepAnnotation", categories = "sample") @Icon(value = Icon.IconType.CUSTOM, custom = "icon") package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg index 3e6ba66a42db8..85e6a3e1e8eda 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/dark/icon.svg @@ -22,7 +22,7 @@ inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" inkscape:cx="30.820103" - inkscape:cy="-1.445768" + inkscape:cy="-1.4228193" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -62,5 +62,5 @@ x="13.80696" y="8.6892385" style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597" - id="tspan2">Dataset + id="tspan2">DataprepRun diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg index 3e6ba66a42db8..85e6a3e1e8eda 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/icons/light/icon.svg @@ -22,7 +22,7 @@ inkscape:deskcolor="#d1d1d1" inkscape:zoom="43.575455" inkscape:cx="30.820103" - inkscape:cy="-1.445768" + inkscape:cy="-1.4228193" inkscape:window-width="3840" inkscape:window-height="2276" inkscape:window-x="-12" @@ -62,5 +62,5 @@ x="13.80696" y="8.6892385" style="line-height:2.94px;letter-spacing:0px;stroke-width:1.1597" - id="tspan2">Dataset + id="tspan2">DataprepRun diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties index 0757f022f7615..6a100dc952c46 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/Messages.properties @@ -14,5 +14,5 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDataprepAnnotation.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset -dynamicDependenciesWithDataprepAnnotation.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file +DynamicDependenciesWithDataprepAnnotation.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datapreprun +DynamicDependenciesWithDataprepAnnotation.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datapreprun \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties index 17cd41bce48d8..7705ca13b09f7 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/config/Messages.properties @@ -19,5 +19,5 @@ Dataset.dependencies._displayName = Dependencies Config.dse._displayName = Config.dieOnError._displayName = Die on error Config.environmentInformation._displayName = Environment information -Config.subConfig._displayName = SubConfig +Config.subConfig._displayName = SubConfig.dependencies._displayName = Dependencies \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties index 8ece7b6117a49..a0c8970bddfa2 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDataprepAnnotation.Input._displayName = Dynamic Dependencies With Dynamic Dependencies Configuration Input \ No newline at end of file +DynamicDependenciesWithDataprepAnnotation.Input._displayName = Dynamic Dependencies With DataprepRun annotation Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml index 8e1614778e7c3..0bd12a55f3bfa 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/pom.xml @@ -25,11 +25,6 @@ jar Component Runtime :: Sample Feature @DynamicDependency with Dataset - - org.talend.sdk.component:dynamic-dependencies-common - include-exclude - - org.talend.sdk.sample diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java index 4d24151753a22..3ef03c7172e60 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Config.java @@ -33,9 +33,12 @@ @Data @GridLayout({ @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) public class Config implements DynamicDependencyConfig, Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java index dda5e9d89446c..59541a501f0f9 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/config/Dataset.java @@ -33,6 +33,9 @@ @GridLayout.Row({ "dso" }), @GridLayout.Row({ "dependencies" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) public class Dataset implements Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java index 5d16d15697f92..525faeb12ae02 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ @Components( - family = "dynamicDependenciesWithDataset", + family = "DynamicDependenciesWithDataset", categories = "sample") @Icon(value = Icon.IconType.CUSTOM, custom = "icon") package org.talend.sdk.component.sample.feature.dynamicdependencies.withdataset; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties index 75f06aebbc117..e2466c2844474 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/Messages.properties @@ -14,5 +14,5 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset -dynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file +DynamicDependenciesWithDataset.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with dataset +DynamicDependenciesWithDataset.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with dataset \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties index e283372e8c37c..43d63aaae3a02 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataset/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdataset/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file +DynamicDependenciesWithDataset.Input._displayName = Dynamic Dependencies With Dataset Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java index 1e7af215441fb..13f6203f15f38 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Config.java @@ -33,9 +33,12 @@ @Data @GridLayout({ @GridLayout.Row({ "dse" }), - @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) public class Config implements DynamicDependencyConfig, Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java index 0faac7aef808c..abc52e5ec91c4 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/config/Dataset.java @@ -29,6 +29,9 @@ @GridLayout(value = { @GridLayout.Row({ "dso" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) public class Dataset implements Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java index acd6d1e4fe4d8..84c17f8fc511b 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ @Components( - family = "dynamicDependenciesWithDatastore", + family = "DynamicDependenciesWithDatastore", categories = "sample") @Icon(value = Icon.IconType.CUSTOM, custom = "icon") package org.talend.sdk.component.sample.feature.dynamicdependencies.withdatastore; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties index c1441fd5b6447..54e6e670c24ff 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/Messages.properties @@ -14,5 +14,5 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datastore -dynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore \ No newline at end of file +DynamicDependenciesWithDatastore.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies with datastore +DynamicDependenciesWithDatastore.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies with datastore \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties index 0a253fa924171..686de01008376 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-datastore/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withdatastore/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file +DynamicDependenciesWithDatastore.Input._displayName = Dynamic Dependencies With Datastore Input \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java index 5e5949dfa7075..5081fe4ced75a 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Config.java @@ -34,9 +34,12 @@ @GridLayout({ @GridLayout.Row({ "dse" }), @GridLayout.Row({ "subConfig" }), - @GridLayout.Row({ "dieOnError" }), @GridLayout.Row({ "environmentInformation" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dse" }), + @GridLayout.Row({ "dieOnError" }), +}) public class Config implements DynamicDependencyConfig, Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java index 3fe30c3f77fbf..8bd5960324df2 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/config/Dataset.java @@ -29,6 +29,9 @@ @GridLayout(value = { @GridLayout.Row({ "dso" }) }) +@GridLayout(names = GridLayout.FormType.ADVANCED, value = { + @GridLayout.Row({ "dso" }) +}) public class Dataset implements Serializable { @Option diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java index c484957886382..fcc2ed3c55c47 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/package-info.java @@ -14,7 +14,7 @@ * limitations under the License. */ @Components( - family = "dynamicDependenciesWithDynamicDependenciesConfiguration", + family = "DynamicDependenciesWithDynamicDependenciesConfiguration", categories = "sample") @Icon(value = Icon.IconType.CUSTOM, custom = "icon") package org.talend.sdk.component.sample.feature.dynamicdependencies.withDynamicDependenciesConfiguration; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java index 9fa0876465c46..9e7188b9a073f 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/service/DynamicDependenciesConfigurationService.java @@ -34,14 +34,14 @@ public class DynamicDependenciesConfigurationService extends AbstractDynamicDependenciesService implements Serializable { - public final static String DEPENDENCY_WITHDATASET_ACTION = "DEPENDENCY_WITHDATASET_ACTION"; + public final static String DEPENDENCY_WITHDYNDEPSCONFIG_ACTION = "DEPENDENCY_WITHDYNDEPSCONFIG_ACTION"; @DynamicDependencies() public List getDynamicDependencies(@Option("theSubConfig") final SubConfig subConfig) { return super.getDynamicDependencies(subConfig.getDependencies()); } - @DiscoverSchemaExtended(DEPENDENCY_WITHDATASET_ACTION) + @DiscoverSchemaExtended(DEPENDENCY_WITHDYNDEPSCONFIG_ACTION) public Schema guessSchema4Input(final @Option("configuration") Config config) { return super.buildSchema(config); } diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties index 8c2575448881a..c86de8883106d 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/Messages.properties @@ -14,6 +14,5 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With DynamicDependenciesConfiguration -dynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With DynamicDependenciesConfiguration -dynamicDependenciesWithDynamicDependenciesConfiguration.actions.schema.DISCOVERSCHEMA_ACTION._displayName = Discover Schema for dynamic dependencies \ No newline at end of file +DynamicDependenciesWithDynamicDependenciesConfiguration.datastore.dyndepsdso._displayName = Datastore for dynamic dependencies With DynamicDependenciesConfiguration +DynamicDependenciesWithDynamicDependenciesConfiguration.dataset.dyndepsdse._displayName = Dataset for dynamic dependencies With DynamicDependenciesConfiguration \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties index 52816b8cb1df6..b252d46a5697c 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dynamicDependenciesConfiguration/src/main/resources/org/talend/sdk/component/sample/feature/dynamicdependencies/withDynamicDependenciesConfiguration/input/Messages.properties @@ -14,4 +14,4 @@ # Here you can change all your configuration display names to use more explicit labels # You can also translate your configuration by adding one file by local Messages_fr.properties for french for example -dynamicDependenciesWithDynamicDependenciesConfiguration.Input._displayName = Dynamic Dependencies With DynamicDependenciesConfiguration Input \ No newline at end of file +DynamicDependenciesWithDynamicDependenciesConfiguration.Input._displayName = Dynamic Dependencies With DynamicDependenciesConfiguration Input \ No newline at end of file From fdde448607ce377ee641f1e96fd4920b438a2c92 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Wed, 5 Nov 2025 18:09:23 +0800 Subject: [PATCH 18/20] Add Readme --- .../dynamic-dependencies/README.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sample-parent/sample-features/dynamic-dependencies/README.md diff --git a/sample-parent/sample-features/dynamic-dependencies/README.md b/sample-parent/sample-features/dynamic-dependencies/README.md new file mode 100644 index 0000000000000..aff3dac7f1be4 --- /dev/null +++ b/sample-parent/sample-features/dynamic-dependencies/README.md @@ -0,0 +1,38 @@ +# Component Runtime :: Sample Feature :: DynamicDependency + +## Table of Contents +- [Overview](#overview) +- [Usage](#usage) + - [How to build the connector plugin](#how-to-build-the-sample-connector-plugin) + - [How to use](#how-to-use) + + +## Overview +This is a test TCK connector plugin to test and validate the DynamicDependency input feature. + +This project contains 4 test connectors: +### DynamicDependency with Dataset +The service of this connector use a dataset as parameter. + +### DynamicDependency with Datastore +The service of this connector use a datastore as parameter. + +### DynamicDependency with Dataprep run annotation +The service of this connector use a new annotation @DynamicDependencySupported. + +### DynamicDependency with @DynamicDependenciesConfiguration +The service of this connector use a config which using @DynamicDependenciesConfiguration. + +## Usage +### How to build the sample connector plugin +Checkout the code from the repository and build the project using `mvn clean install` +Alternatively build the feature module using `mvn install -am -pl :dynamicdependencies` + +### How to use +- Deploy the connector into Studio: +java -jar dynamic-dependencies-with-dataset-1.86.0-SNAPSHOT.car studio-deploy --location c:\Talend-Studio-20251010_0827-V8.0.2SNAPSHOT + +- Use the connector in the job. +- Click "Guess schema" of the connector. +- Add others you want to use in the job, then run the job. + From 0572b53563fc1f630365bac407ab10bdb6a14270 Mon Sep 17 00:00:00 2001 From: Yves Piel Date: Mon, 10 Nov 2025 10:53:56 +0100 Subject: [PATCH 19/20] feat(QTDI-1914): try to execute a TCK connector to check if it is well loaded... to continue... --- .../config/Dependency.java | 13 +++++++ .../AbstractDynamicDependenciesService.java | 36 +++++++++++++++---- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java index a4c67f8826dbd..d3ddba7727ea4 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java @@ -45,4 +45,17 @@ public class Dependency implements Serializable { @Documentation("The class to try to load from this dependency.") private String clazz; + @Option + private String connectorFamily; + + @Option + private String connectorName; + + @Option + private int connectorVersion; + + @Option + private String connectorConfiguration; + + } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java index 0d8e73213a669..65f9877246bd6 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java @@ -1,12 +1,12 @@ /** * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -18,8 +18,10 @@ import java.io.Serializable; import java.net.URL; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.talend.sdk.component.api.exception.ComponentException; import org.talend.sdk.component.api.record.Record; @@ -28,6 +30,7 @@ import org.talend.sdk.component.api.record.Schema.Type; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.api.service.record.RecordBuilderFactory; +import org.talend.sdk.component.api.service.source.ProducerFinder; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; @@ -63,6 +66,9 @@ public abstract class AbstractDynamicDependenciesService implements Serializable @Service private RecordBuilderFactory factory; + @Service + private ProducerFinder finder; + public Iterator loadIterator(final DynamicDependencyConfig dynamicDependencyConfig) { Schema schema = buildSchema(dynamicDependencyConfig); @@ -92,9 +98,13 @@ public Iterator loadIterator(final DynamicDependencyConfig dynamicDepend "Cannot load class %s from system classloader".formatted(dependency.getClazz()), e); } - boolean isTckContainer = isTCKContainer(fromLocation); - // package-info@Components - boolean isLoadedInTck = false; // to improve + boolean isTckContainer = false; + boolean isLoadedInTck = false; + if (dependency.getConnectorFamily() != null && !dependency.getConnectorFamily().isEmpty()) { + isTckContainer = isTCKContainer(fromLocation); // not now + // package-info@Components + isLoadedInTck = testLoadingData(dependency); // to improve + } Builder recordBuilder = builder .withString(ENTRY_MAVEN, maven) @@ -124,6 +134,16 @@ public Iterator loadIterator(final DynamicDependencyConfig dynamicDepend return records.iterator(); } + private boolean testLoadingData(final Dependency dependency) { + Iterator recordIterator = this.loadData(dependency.getConnectorFamily(), dependency.getConnectorName(), dependency.getConnectorVersion(), json2Map(dependency.getConnectorConfiguration())); + return recordIterator.hasNext(); + } + + private Map json2Map(final String json) { + // Transform the given json to map + return Collections.emptyMap(); + } + protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConfig) { Schema.Builder builder = factory.newSchemaBuilder(Type.RECORD) .withEntry(factory.newEntryBuilder().withName(ENTRY_MAVEN).withType(Type.STRING).build()) @@ -148,6 +168,10 @@ protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConf return builder.build(); } + protected Iterator loadData(String family, String name, int version, Map parameters) { + return finder.find(family, name, version, parameters); + } + private void manageException(final boolean dieOnError, final String message, final Exception e) { String msg = "Dynamic dependencies connector raised an exception: %s : %s".formatted(message, e.getMessage()); log.error(msg, e); From 06da2862856e5faa1552cfcd1e8fbc6dd0f85977 Mon Sep 17 00:00:00 2001 From: yyin-talend Date: Wed, 12 Nov 2025 16:24:04 +0800 Subject: [PATCH 20/20] Add function to load depended component's depends --- .../config/Dependency.java | 4 ++ .../AbstractDynamicDependenciesService.java | 42 ++++++++++---- ...bstractDynamicDependenciesServiceTest.java | 5 +- .../pom.xml | 6 ++ ...endenciesDataprepRunAnnotationService.java | 57 +++++++++++++++++++ .../service/DataprepRunServiceTest.java | 53 +++++++++++++++++ 6 files changed, 155 insertions(+), 12 deletions(-) diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java index d3ddba7727ea4..633ac24e0ad8c 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/config/Dependency.java @@ -46,15 +46,19 @@ public class Dependency implements Serializable { private String clazz; @Option + @Documentation("The family for depended connector.") private String connectorFamily; @Option + @Documentation("The name for depended connector.") private String connectorName; @Option + @Documentation("The version for depended connector.") private int connectorVersion; @Option + @Documentation("The configuration for depended connector.") private String connectorConfiguration; diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java index 65f9877246bd6..09442be77520f 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/service/AbstractDynamicDependenciesService.java @@ -1,12 +1,12 @@ /** * Copyright (C) 2006-2025 Talend Inc. - www.talend.com - *

+ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *

+ * * http://www.apache.org/licenses/LICENSE-2.0 - *

+ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,13 +15,20 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.service; +import java.io.IOException; +import java.io.InputStream; import java.io.Serializable; import java.net.URL; +import java.nio.file.FileSystems; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; +import java.util.jar.JarFile; import org.talend.sdk.component.api.exception.ComponentException; import org.talend.sdk.component.api.record.Record; @@ -67,7 +74,7 @@ public abstract class AbstractDynamicDependenciesService implements Serializable private RecordBuilderFactory factory; @Service - private ProducerFinder finder; + protected ProducerFinder finder; public Iterator loadIterator(final DynamicDependencyConfig dynamicDependencyConfig) { Schema schema = buildSchema(dynamicDependencyConfig); @@ -103,7 +110,7 @@ public Iterator loadIterator(final DynamicDependencyConfig dynamicDepend if (dependency.getConnectorFamily() != null && !dependency.getConnectorFamily().isEmpty()) { isTckContainer = isTCKContainer(fromLocation); // not now // package-info@Components - isLoadedInTck = testLoadingData(dependency); // to improve + isLoadedInTck = testLoadingData(dynamicDependencyConfig, dependency); // to improve } Builder recordBuilder = builder @@ -134,11 +141,29 @@ public Iterator loadIterator(final DynamicDependencyConfig dynamicDepend return records.iterator(); } - private boolean testLoadingData(final Dependency dependency) { - Iterator recordIterator = this.loadData(dependency.getConnectorFamily(), dependency.getConnectorName(), dependency.getConnectorVersion(), json2Map(dependency.getConnectorConfiguration())); + protected boolean testLoadingData(final DynamicDependencyConfig dynamicDependencyConfig, final Dependency dependency) { + Iterator recordIterator = finder.find(dependency.getConnectorFamily(), dependency.getConnectorName(), + dependency.getConnectorVersion(), Collections.emptyMap()); return recordIterator.hasNext(); } + //If the dependency is a TCK connector, get its dependencies list + protected Map loadComponentDepends(final DynamicDependencyConfig dynamicDependencyConfig, final String jarPath) { + Map configMap = new HashMap<>(); + final Path archive = FileSystems.getDefault().getPath(jarPath); + try (final JarFile file = new JarFile(archive.toFile()); + final InputStream stream = file.getInputStream(file.getEntry("TALEND-INF/dependencies.txt"))) { + final Properties properties = new Properties(); + properties.load(stream); + properties.stringPropertyNames().forEach(name -> { + configMap.put(name, properties.getProperty(name)); + }); + return configMap;//empty if no dependencies + } catch (final IOException e) { + throw new IllegalStateException(e); + } + } + private Map json2Map(final String json) { // Transform the given json to map return Collections.emptyMap(); @@ -168,9 +193,6 @@ protected Schema buildSchema(final DynamicDependencyConfig dynamicDependencyConf return builder.build(); } - protected Iterator loadData(String family, String name, int version, Map parameters) { - return finder.find(family, name, version, parameters); - } private void manageException(final boolean dieOnError, final String message, final Exception e) { String msg = "Dynamic dependencies connector raised an exception: %s : %s".formatted(message, e.getMessage()); diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java index 272184c99e6e7..1056a5c81ccfd 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-common/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/AbstractDynamicDependenciesServiceTest.java @@ -32,6 +32,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; + import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; @@ -39,7 +40,7 @@ public abstract class AbstractDynamicDependenciesServiceTest { - private C config; + protected C config; protected abstract C buildConfig(); @@ -72,7 +73,7 @@ protected List getDependList() { return depends; } - private void assertRecord(Record record) { + protected void assertRecord(Record record) { Assertions.assertNotNull(record); Assertions.assertEquals("org.apache.commons:commons-numbers-primes:1.2", record.getString(ENTRY_MAVEN)); Assertions.assertEquals( diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml index 0f346b2da2be0..75aeb389c1946 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/pom.xml @@ -47,6 +47,12 @@ 1.2 test + + org.talend.sdk.component + container-core + 1.86.0-SNAPSHOT + compile + diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java index 97b62a6980edb..4c7bca6b14018 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/main/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DynamicDependenciesDataprepRunAnnotationService.java @@ -15,16 +15,31 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; +import java.io.IOException; +import java.io.InputStream; import java.io.Serializable; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.jar.JarFile; import org.talend.sdk.component.api.configuration.Option; +import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.api.record.Schema; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.api.service.dependency.DynamicDependencies; import org.talend.sdk.component.api.service.schema.DiscoverSchemaExtended; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.Dependency; +import org.talend.sdk.component.sample.feature.dynamicdependencies.config.DynamicDependencyConfig; import org.talend.sdk.component.sample.feature.dynamicdependencies.service.AbstractDynamicDependenciesService; import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.Config; +import org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.config.SubConfig; import lombok.extern.slf4j.Slf4j; @@ -47,4 +62,46 @@ public Schema guessSchema4Input(final @Option("configuration") Config config) { return super.buildSchema(config); } + protected boolean testLoadingData(final DynamicDependencyConfig dynamicDependencyConfig, final Dependency dependency) { + //if depend on tck connector, load this connector's depends in its dependencies.txt into subconfig. + //loadComponentDepends(dynamicDependencyConfig, dependency.getConnectorFamily() + ":" + dependency.getConnectorName()); + + //In junit, can only find one : test. + Iterator recordIterator = finder.find(dependency.getConnectorFamily(), dependency.getConnectorName(), + dependency.getConnectorVersion(), Collections.emptyMap()); + return recordIterator.hasNext(); + } + + protected Map loadComponentDepends(final DynamicDependencyConfig dynamicDependencyConfig, final String jarPath) { + Map configMap = new HashMap<>(); + SubConfig subConfig = ((Config)dynamicDependencyConfig).getSubConfig(); + final Path archive = FileSystems.getDefault().getPath(jarPath); + + if (!Files.exists(archive)) { + throw new IllegalArgumentException("--Dependency does not exist: '" + archive + "'"); + } + try (final JarFile file = new JarFile(archive.toFile()); + final InputStream stream = file.getInputStream(file.getEntry("TALEND-INF/dependencies.txt"))) { + final Properties properties = new Properties(); + properties.load(stream); + properties.stringPropertyNames().forEach(name -> { + configMap.put(name, properties.getProperty(name)); + addToDependList(subConfig, name, properties.getProperty(name)); + }); + return configMap; + } catch (final IOException e) { + throw new IllegalStateException(e); + } + } + + private static void addToDependList(final SubConfig subConfig, final String name, final String property) { + Dependency depend = new Dependency(); + depend.setArtifactId(name); + depend.setVersion("1.2"); + depend.setGroupId(property); + depend.setClazz("FromDependency"); + + subConfig.getDependencies().add(depend); + } + } \ No newline at end of file diff --git a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java index 654cdd2895dca..0274477b61927 100644 --- a/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java +++ b/sample-parent/sample-features/dynamic-dependencies/dynamic-dependencies-with-dataprepRunAnnotation/src/test/java/org/talend/sdk/component/sample/feature/dynamicdependencies/withDataprepRunAnnotation/service/DataprepRunServiceTest.java @@ -15,8 +15,14 @@ */ package org.talend.sdk.component.sample.feature.dynamicdependencies.withDataprepRunAnnotation.service; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.talend.sdk.component.api.record.Record; import org.talend.sdk.component.api.service.Service; import org.talend.sdk.component.junit5.WithComponents; import org.talend.sdk.component.sample.feature.dynamicdependencies.AbstractDynamicDependenciesServiceTest; @@ -35,6 +41,27 @@ public class DataprepRunServiceTest @Service DynamicDependenciesDataprepRunAnnotationService dynamicDependenciesServiceService; + + @Test + void testloadIterator() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + final Iterator result = getService().loadIterator(config); + + Assertions.assertTrue(result.hasNext()); + this.assertRecord(result.next()); + Assertions.assertFalse(result.hasNext()); + } + + @Test + void testLoadDependency() { + System.setProperty("talend.component.manager.m2.repository", "./lib/"); + + Map depends = getService().loadComponentDepends(config, "C:\\Users\\ODG\\.m2\\repository\\org\\talend\\components\\record-provider\\1.71.0-SNAPSHOT\\record-provider-1.71.0-SNAPSHOT.jar"); + Assertions.assertEquals(2, depends.size()); + + } + @Override protected Config buildConfig() { Config config = new Config(); @@ -49,6 +76,32 @@ protected Config buildConfig() { return config; } + //use tck cnnector as dependency + protected List getDependList() { + List depends = new ArrayList<>(); + Dependency depend = new Dependency(); + depend.setArtifactId("commons-numbers-primes"); + depend.setVersion("1.2"); + depend.setGroupId("org.apache.commons"); + depend.setClazz("org.apache.commons.numbers.primes.SmallPrimes"); + depends.add(depend); + + //for connector depend + Dependency depend2 = new Dependency(); + depend.setArtifactId("record-provider"); + depend.setVersion("1.71.0-SNAPSHOT"); + depend.setGroupId("org.talend.components"); + depend.setClazz("org.talend.components.recordprovider.source.GenericMapper"); + //set a TCK connector as one dependency for depend2. + depend.setConnectorFamily("JDBC"); + depend.setConnectorName("newjdbc"); + depend.setConnectorVersion(1); + depend.setConnectorConfiguration(""); + + depends.add(depend2); + return depends; + } + @Override protected DynamicDependenciesDataprepRunAnnotationService getService() { return dynamicDependenciesServiceService;