-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Changes from 20 commits
58e52f0
d14ca08
fbad6b5
0a7306a
12349f4
7911b28
99c2105
364d3b4
9ee49db
b9ace31
6b3ad60
289beaa
177b99d
9caa1f5
12b840a
3b47d4c
a0507b4
5a19c9b
3169fc0
9db55ab
c07d009
26ca44e
e3200c3
1d0de2c
fbaf665
d007114
1a591b3
dc93ae4
62b6f6e
6fda7fe
7fcd655
2893c14
e6e9c0a
210507a
7949029
5449983
0562593
76aefd7
f2f8efc
75751c4
9b25e37
72affeb
dc2884b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| <?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-ide</artifactId> | ||
|
|
||
| <properties> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It it intentional that you are overriding these properties instead of inheriting them from the parent project? Also, Step is planning to move to Java 21, but at this time everything still needs to be compatible with Java 11 - these definitions break that convention and would not work on older Java versions. |
||
| <groupId>ch.exense.step</groupId> | ||
| <maven.compiler.source>21</maven.compiler.source> | ||
| <maven.compiler.target>21</maven.compiler.target> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
|
|
||
| <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> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /******************************************************************************* | ||
| * 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 java.io.IOException; | ||
| import java.util.Properties; | ||
|
|
||
| import step.automation.packages.yaml.AutomationPackageYamlFragmentManager; | ||
| import step.core.collections.inmemory.InMemoryCollectionFactory; | ||
| import step.core.plans.Plan; | ||
|
|
||
| public class AutomationPackageCollectionFactory implements CollectionFactory { | ||
|
|
||
| private final InMemoryCollectionFactory baseFactory; | ||
| private final AutomationPackageYamlFragmentManager fragmentManager; | ||
|
|
||
| public AutomationPackageCollectionFactory(Properties properties, AutomationPackageYamlFragmentManager fragmentManager) { | ||
| this.fragmentManager = fragmentManager; | ||
| this.baseFactory = new InMemoryCollectionFactory(properties); | ||
| } | ||
|
|
||
| @Override | ||
| public <T> Collection<T> getCollection(String name, Class<T> entityClass) { | ||
|
|
||
| if (entityClass == Plan.class) { | ||
| return (Collection<T>) new AutomationPackagePlanCollection(fragmentManager); | ||
| } | ||
|
|
||
| return baseFactory.getCollection(name, entityClass); | ||
| } | ||
|
|
||
| @Override | ||
| public Collection<EntityVersion> getVersionedCollection(String name) { | ||
| Collection<EntityVersion> baseCollection = baseFactory.getCollection(name, EntityVersion.class); | ||
| return baseCollection; | ||
| } | ||
|
|
||
| @Override | ||
| public void close() throws IOException { | ||
| baseFactory.close(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /******************************************************************************* | ||
| * 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; | ||
|
|
||
| public class AutomationPackagePlanCollection extends InMemoryCollection<Plan> implements Collection<Plan> { | ||
|
|
||
|
|
||
| private final AutomationPackageYamlFragmentManager fragmentManager; | ||
|
|
||
| public AutomationPackagePlanCollection(AutomationPackageYamlFragmentManager fragmentManager) { | ||
| super(true, "plans"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These kinds of names should always be declared as |
||
| this.fragmentManager = fragmentManager; | ||
| fragmentManager.getPlans().forEach(super::save); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is some unexpected logic here. Add a comment on why it is needed. |
||
| } | ||
|
|
||
| @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, Integer.MAX_VALUE).forEach(fragmentManager::removePlan); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if the maxTime isn't actually used in the InMemoryCollection implementation - use 0 to indicate no limit as in all other invocations across the codebase. |
||
| super.remove(filter); | ||
| } | ||
| } | ||
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.
This pom file will not be publishable to maven central. Add at least
as is present in all other pom.xml files.