-
Notifications
You must be signed in to change notification settings - Fork 3
SED-4539 automation package collection and accessor #615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cmisev
wants to merge
43
commits into
master
Choose a base branch
from
SED-4539-automation-package-collection-and-accessor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
58e52f0
SED-4429 initial draft of mapping fragments to plans
cmisev d14ca08
Merge branch 'master' into SED-4429-step-ap-ide
cmisev fbad6b5
SED-4429 fix: remove unused dependencies, gemini code review inputs
cmisev 0a7306a
SED-4429 fix: dependencies
cmisev 12349f4
Merge branch 'master' into SED-4429-step-ap-ide
cmisev 7911b28
SED-4539 basic plan add, remove, modify
cmisev 99c2105
SED-4539 refactor additional field handling
cmisev 364d3b4
SED-4539 simplify Fragment structure
cmisev 9ee49db
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev b9ace31
SED-4539 cleaner string manipulations
cmisev 6b3ad60
SED-4539 generic PatchableYamlArtefactDeserializer
cmisev 289beaa
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev 177b99d
SED-4539 fix trivial review issues
cmisev 9caa1f5
SED-4539 fix trivial review issues
cmisev 12b840a
SED-4539 remove unnecessary serializationregistryaware
cmisev 3b47d4c
SED-4539 Exception handling
cmisev a0507b4
SED-4539 Exception handling
cmisev 5a19c9b
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev 3169fc0
SED-4539 Define Collections as Patchable
cmisev 9db55ab
SED-4539 Define Collections as Patchable
cmisev c07d009
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev 26ca44e
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev e3200c3
SED-4539 WIP Refactor
cmisev 1d0de2c
SED-4539 refactor: introduce PatchingContext
cmisev fbaf665
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev d007114
SED-4539 fix: unit tests
cmisev 1a591b3
SED-4539 feat: extend patchable to additionalFields
cmisev dc93ae4
SED-4539 remove superfluous location aware tree parser
cmisev 62b6f6e
SED-4539 fix review comments
cmisev 6fda7fe
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev 7fcd655
SED-4539 modify parameters
cmisev 2893c14
Merge branch 'master' into SED-4539-automation-package-collection-and…
cmisev e6e9c0a
SED-4539 plan format fixes, re-read ap in test, function reading
cmisev 210507a
Merge remote-tracking branch 'origin/SED-4539-automation-package-coll…
cmisev 7949029
SED-4539 consistency check for added parameters
cmisev 5449983
SED-4539 improved error message
cmisev 0562593
SED-4539 keyword loading and WIP on composite keyword loading
cmisev 76aefd7
SED-4539 Fix getCollection idempotence
cl-exense f2f8efc
SED-4539 fix parameter editing
cmisev 75751c4
Merge remote-tracking branch 'origin/SED-4539-automation-package-coll…
cmisev 9b25e37
SED-4539 improve parameter editing unit test
cmisev 72affeb
SED-4678 refactor test classes/resources layout, rename module (#640)
cl-exense dc2884b
Merge remote-tracking branch 'origin/master' into SED-4539-automation…
cl-exense File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
step-automation-packages/step-automation-packages-collections/pom.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <parent> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-automation-packages</artifactId> | ||
| <version>0.0.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>step-automation-packages-collections</artifactId> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-plans-base-artefacts</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-automation-packages-yaml</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
|
|
||
| <!-- Test dependencies --> | ||
| <dependency> | ||
| <groupId>org.mockito</groupId> | ||
| <artifactId>mockito-core</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-plans-core</artifactId> | ||
| <version>${project.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-functions-plugins-jmeter-def</artifactId> | ||
| <version>${project.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-functions-plugins-node-def</artifactId> | ||
| <version>${project.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>ch.exense.step</groupId> | ||
| <artifactId>step-automation-packages-controller</artifactId> | ||
| <version>${project.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> | ||
70 changes: 70 additions & 0 deletions
70
...s-collections/src/main/java/step/core/collections/AutomationPackageCollectionFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2026, exense GmbH | ||
| * | ||
| * This file is part of STEP | ||
| * | ||
| * STEP is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * STEP is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with STEP. If not, see <http://www.gnu.org/licenses/>. | ||
| ******************************************************************************/ | ||
| package step.core.collections; | ||
|
|
||
| import step.automation.packages.yaml.AutomationPackageYamlFragmentManager; | ||
| import step.core.collections.inmemory.InMemoryCollectionFactory; | ||
| import step.core.plans.Plan; | ||
| import step.functions.Function; | ||
| import step.parameter.Parameter; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
|
|
||
| public class AutomationPackageCollectionFactory implements CollectionFactory { | ||
|
|
||
| private final InMemoryCollectionFactory baseFactory; | ||
| private final AutomationPackageYamlFragmentManager fragmentManager; | ||
| private final Map<String, Collection<?>> collectionsByName = new ConcurrentHashMap<>(); | ||
|
|
||
| public AutomationPackageCollectionFactory(Properties properties, AutomationPackageYamlFragmentManager fragmentManager) { | ||
| this.fragmentManager = fragmentManager; | ||
| this.baseFactory = new InMemoryCollectionFactory(properties); | ||
| } | ||
|
|
||
| @Override | ||
| @SuppressWarnings("unchecked") | ||
| public <T> Collection<T> getCollection(String name, Class<T> entityClass) { | ||
| return (Collection<T>) collectionsByName.computeIfAbsent(name, (_name) -> { | ||
| if (Plan.class.isAssignableFrom(entityClass)) { | ||
| return new AutomationPackagePlanCollection(fragmentManager); | ||
| } else if (Parameter.class.isAssignableFrom(entityClass)) { | ||
| return new AutomationPackageParameterCollection(fragmentManager); | ||
| } else if (Function.class.isAssignableFrom(entityClass)) { | ||
| return new AutomationPackageFunctionCollection(fragmentManager); | ||
| } | ||
| return baseFactory.getCollection(name, entityClass); | ||
| }); | ||
| } | ||
|
|
||
| @SuppressWarnings("rawtypes") | ||
| @Override | ||
| public Collection<EntityVersion> getVersionedCollection(String name) { | ||
| // TODO: I'm pretty sure the previous implementation was incorrect. | ||
| // Fix this once we need it and know what the correct implementation is. | ||
| throw new UnsupportedOperationException(); | ||
| } | ||
|
|
||
| @Override | ||
| public void close() throws IOException { | ||
| baseFactory.close(); | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
...-collections/src/main/java/step/core/collections/AutomationPackageFunctionCollection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2026, exense GmbH | ||
| * | ||
| * This file is part of STEP | ||
| * | ||
| * STEP is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * STEP is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with STEP. If not, see <http://www.gnu.org/licenses/>. | ||
| ******************************************************************************/ | ||
| package step.core.collections; | ||
|
|
||
| import step.automation.packages.model.YamlAutomationPackageKeyword; | ||
| import step.automation.packages.yaml.AutomationPackageYamlFragmentManager; | ||
| import step.core.collections.inmemory.InMemoryCollection; | ||
| import step.functions.Function; | ||
|
|
||
| public class AutomationPackageFunctionCollection extends InMemoryCollection<Function> implements Collection<Function> { | ||
|
|
||
|
|
||
| private final AutomationPackageYamlFragmentManager fragmentManager; | ||
|
|
||
| public AutomationPackageFunctionCollection(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| super(true, YamlAutomationPackageKeyword.KEYWORDS_ENTITY_NAME); | ||
| this.fragmentManager = fragmentManager; | ||
| initialzeRecordsFromFragments(fragmentManager); | ||
| } | ||
|
|
||
| private void initialzeRecordsFromFragments(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| // initialization into the collection memory. Calls super save to avoid calling fragmentManager.savePlan | ||
| fragmentManager.getBusinessObjects(Function.class).forEach(super::save); | ||
| } | ||
|
|
||
| @Override | ||
| public Function save(Function p){ | ||
| return super.save(fragmentManager.saveFunction(p)); | ||
| } | ||
|
|
||
| @Override | ||
| public void save(Iterable<Function> iterable) { | ||
| for (Function p : iterable) { | ||
| save(p); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void remove(Filter filter) { | ||
| find(filter, null, null, null, 0).forEach(fragmentManager::removeFunction); | ||
| super.remove(filter); | ||
| } | ||
| } |
61 changes: 61 additions & 0 deletions
61
...collections/src/main/java/step/core/collections/AutomationPackageParameterCollection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2026, exense GmbH | ||
| * | ||
| * This file is part of STEP | ||
| * | ||
| * STEP is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * STEP is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with STEP. If not, see <http://www.gnu.org/licenses/>. | ||
| ******************************************************************************/ | ||
| package step.core.collections; | ||
|
|
||
| import step.automation.packages.yaml.AutomationPackageYamlFragmentManager; | ||
| import step.core.collections.inmemory.InMemoryCollection; | ||
| import step.parameter.Parameter; | ||
| import step.parameter.automation.AutomationPackageParameter; | ||
|
|
||
| public class AutomationPackageParameterCollection extends InMemoryCollection<Parameter> implements Collection<Parameter> { | ||
|
|
||
|
|
||
| private final AutomationPackageYamlFragmentManager fragmentManager; | ||
|
|
||
| public AutomationPackageParameterCollection(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| super(true, Parameter.ENTITY_NAME); | ||
| this.fragmentManager = fragmentManager; | ||
| initialzeRecordsFromFragments(fragmentManager); | ||
| } | ||
|
|
||
| private void initialzeRecordsFromFragments(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| // initialization into the collection memory. Calls super save to avoid calling fragmentManager.savePlan | ||
| fragmentManager.getBusinessObjects(Parameter.class).forEach(super::save); | ||
| } | ||
|
|
||
| @Override | ||
| public Parameter save(Parameter parameter){ | ||
| return super.save(fragmentManager.saveAdditionalFieldObject(parameter, context -> AutomationPackageParameter.forContext(context, parameter), Parameter.ENTITY_NAME)); | ||
| } | ||
|
|
||
| @Override | ||
| public void save(Iterable<Parameter> iterable) { | ||
| for (Parameter p : iterable) { | ||
| save(p); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void remove(Filter filter) { | ||
| find(filter, null, null, null, 0).forEach(parameter -> | ||
| fragmentManager.removeAdditionalFieldObject(parameter, Parameter.ENTITY_NAME) | ||
| ); | ||
| super.remove(filter); | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
...ages-collections/src/main/java/step/core/collections/AutomationPackagePlanCollection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2026, exense GmbH | ||
| * | ||
| * This file is part of STEP | ||
| * | ||
| * STEP is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * STEP is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with STEP. If not, see <http://www.gnu.org/licenses/>. | ||
| ******************************************************************************/ | ||
| package step.core.collections; | ||
|
|
||
| import step.automation.packages.yaml.AutomationPackageYamlFragmentManager; | ||
| import step.core.collections.inmemory.InMemoryCollection; | ||
| import step.core.plans.Plan; | ||
| import step.plans.parser.yaml.YamlPlan; | ||
|
|
||
| public class AutomationPackagePlanCollection extends InMemoryCollection<Plan> implements Collection<Plan> { | ||
|
|
||
|
|
||
| private final AutomationPackageYamlFragmentManager fragmentManager; | ||
|
|
||
| public AutomationPackagePlanCollection(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| super(true, YamlPlan.PLANS_ENTITY_NAME); | ||
| this.fragmentManager = fragmentManager; | ||
| initialzeRecordsFromFragments(fragmentManager); | ||
| } | ||
|
|
||
| private void initialzeRecordsFromFragments(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| // initialization into the collection memory. Calls super save to avoid calling fragmentManager.savePlan | ||
| fragmentManager.getBusinessObjects(Plan.class).forEach(super::save); | ||
| } | ||
|
|
||
| @Override | ||
| public Plan save(Plan p){ | ||
| return super.save(fragmentManager.savePlan(p)); | ||
| } | ||
|
|
||
| @Override | ||
| public void save(Iterable<Plan> iterable) { | ||
| for (Plan p : iterable) { | ||
| save(p); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public void remove(Filter filter) { | ||
| find(filter, null, null, null, 0).forEach(fragmentManager::removePlan); | ||
| super.remove(filter); | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
...llections/src/test/java/step/core/collections/AutomationPackageCollectionFactoryTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package step.core.collections; | ||
|
|
||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
| import step.core.plans.Plan; | ||
| import step.plans.parser.yaml.YamlPlan; | ||
|
|
||
| import java.util.Properties; | ||
|
|
||
| public class AutomationPackageCollectionFactoryTest extends AutomationPackageCollectionTestBase { | ||
|
|
||
| @Test | ||
| public void testCollectionIdempotence() { | ||
| AutomationPackageCollectionFactory cf = new AutomationPackageCollectionFactory(new Properties(), fragmentManager); | ||
| Collection<Plan> c1 = cf.getCollection(YamlPlan.PLANS_ENTITY_NAME, Plan.class); | ||
| Assert.assertTrue(c1.estimatedCount() > 0); // just for good measure | ||
| Collection<Plan> c2 = cf.getCollection(YamlPlan.PLANS_ENTITY_NAME, Plan.class); | ||
| Assert.assertSame(c1, c2); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked it, but is this one actually required?