Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions step-ap-ide/src/main/resources/step.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ plugins.EncryptionManagerDependencyPlugin.enabled=false
plugins.EntityLockingPlugin.enabled=false
plugins.ExportManagerPlugin.enabled=false
plugins.FunctionPackagePlugin.enabled=false
plugins.GeneralScriptFunctionControllerPlugin.enabled=false
plugins.GeneralScriptFunctionControllerPlugin.enabled=true
plugins.InteractivePlugin.enabled=false
plugins.JMeterPlugin.enabled=false
plugins.JMeterPlugin.enabled=true
plugins.LiveReportingControllerPlugin.enabled=false
plugins.MeasurementControllerPlugin.enabled=false
plugins.MigrationManagerTasksPlugin.enabled=false
plugins.MigrationTasksRegistrationPlugin.enabled=false
plugins.NodePlugin.enabled=false
plugins.NodePlugin.enabled=true
plugins.QuotaManagerControllerPlugin.enabled=false
plugins.RawMeasurementsControllerPlugin.enabled=false
plugins.ReferenceFinderPlugin.enabled=false
plugins.RemoteCollectionPlugin.enabled=false
plugins.ResourceManagerControllerPlugin.enabled=false
plugins.ReportLayoutPlugin.enabled=false
plugins.ScriptEditorPlugin.enabled=false
plugins.ScriptEditorPlugin.enabled=true
plugins.StagingRepositoryPlugin.enabled=false
plugins.StreamingResourcesControllerPlugin.enabled=false
plugins.ThreadManagerControllerPlugin.enabled=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,41 @@
package step.core.collections;

import step.automation.packages.yaml.AutomationPackageYamlFragmentManager;
import step.core.accessors.AbstractOrganizableObject;
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> {
public class AutomationPackageCollection<BO extends AbstractOrganizableObject, T> extends InMemoryCollection<BO> implements Collection<BO> {


private final AutomationPackageYamlFragmentManager fragmentManager;

public AutomationPackagePlanCollection(AutomationPackageYamlFragmentManager fragmentManager) {
super(false, YamlPlan.PLANS_ENTITY_NAME);
public AutomationPackageCollection(AutomationPackageYamlFragmentManager fragmentManager, Class<T> boClass) {
super(false);
this.fragmentManager = fragmentManager;
initialzeRecordsFromFragments(fragmentManager);
initializeRecordsFromFragments(boClass, fragmentManager);
}

private void initialzeRecordsFromFragments(AutomationPackageYamlFragmentManager fragmentManager) {
private void initializeRecordsFromFragments(Class<T> boClass, AutomationPackageYamlFragmentManager fragmentManager) {
// initialization into the collection memory. Calls super save to avoid calling fragmentManager.savePlan
fragmentManager.getBusinessObjects(Plan.class).forEach(super::save);
Iterable<BO> list = fragmentManager.getBusinessObjects(boClass);
list.forEach(super::save);
}

@Override
public Plan save(Plan p) {
return fragmentManager.savePlan(super.save(p));
public BO save(BO p) {
return fragmentManager.save(super.save(p));
}

@Override
public void save(Iterable<Plan> iterable) {
for (Plan p : iterable) {
save(p);
public void save(Iterable<BO> iterable) {
for (BO object : iterable) {
save(object);
}
}

@Override
public void remove(Filter filter) {
find(filter, null, null, null, 0).forEach(fragmentManager::removePlan);
find(filter, null, null, null, 0).forEach(fragmentManager::remove);
super.remove(filter);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@
******************************************************************************/
package step.core.collections;

import step.automation.packages.mappers.interfaces.BusinessObjectToYamlMapper;
import step.automation.packages.model.YamlAutomationPackageKeyword;
import step.automation.packages.yaml.AutomationPackageYamlFragmentManager;
import step.core.accessors.AbstractOrganizableObject;
import step.core.collections.inmemory.InMemoryCollectionFactory;
import step.core.plans.Plan;
import step.functions.Function;
import step.parameter.Parameter;
import step.parameter.automation.AutomationPackageParameter;
import step.plans.parser.yaml.YamlPlan;

import java.io.IOException;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

Expand All @@ -44,14 +50,12 @@ public AutomationPackageCollectionFactory(Properties properties, AutomationPacka
@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);

if (!AbstractOrganizableObject.class.isAssignableFrom(entityClass)) {
return baseFactory.getCollection(name, entityClass);
}
return baseFactory.getCollection(name, entityClass);

return new AutomationPackageCollection<>(fragmentManager, entityClass);
});
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public void testAddPlanToNewFragmentAndRenameAndRemove() throws IOException {

@Test
public void testAddTwoPlansToNewFragmentAndRemoveOne() throws IOException {

Sequence sequence = new Sequence();
Echo echo = new Echo();
echo.setText(new DynamicValue<>("Hello World"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ protected void fillStaging(AutomationPackage newPackage, AutomationPackageStagin
try {
boolean hooked = automationPackageHookRegistry.onPrepareStaging(
hookEntry.fieldName,
new StagingAutomationPackageContext(newPackage, operationMode, staging.getResourceManager(), automationPackageArchive, packageContent, actorUser, enricherForIncludedEntities, extensions),
new StagingAutomationPackageContext(new AutomationPackageResourceUploader(), newPackage, operationMode, staging.getResourceManager(), automationPackageArchive, packageContent, actorUser, enricherForIncludedEntities, extensions),
packageContent,
hookEntry.values,
oldPackage, staging, objectPredicate);
Expand Down Expand Up @@ -993,7 +993,7 @@ private static void propagatePackageMetadataToPlans(AutomationPackage newPackage

protected List<Function> prepareFunctionsStaging(AutomationPackage newPackage, AutomationPackageArchive automationPackageArchive, AutomationPackageContent packageContent, ObjectEnricher enricher,
AutomationPackage oldPackage, ResourceManager stagingResourceManager, String actorUser) {
StagingAutomationPackageContext apContext = new StagingAutomationPackageContext(newPackage, operationMode, stagingResourceManager, automationPackageArchive, packageContent, actorUser, enricher, extensions);
StagingAutomationPackageContext apContext = new StagingAutomationPackageContext(new AutomationPackageResourceUploader(), newPackage, operationMode, stagingResourceManager, automationPackageArchive, packageContent, actorUser, enricher, extensions);
List<Function> completeFunctions = packageContent.getKeywords().stream().map(keyword -> keyword.prepareKeyword(apContext)).collect(Collectors.toList());

// get old functions with same name and reuse their ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void applySpecialAttributesToPlans(AutomationPackage newPackage,

protected StagingAutomationPackageContext prepareContext(AutomationPackage automationPackage, AutomationPackageOperationMode operationMode, AutomationPackageArchive automationPackageArchive, AutomationPackageContent packageContent,
String actorUser, ObjectEnricher enricher, Map<String, Object> extensions) {
return new StagingAutomationPackageContext(automationPackage, operationMode, resourceManager, automationPackageArchive, packageContent, actorUser, enricher, extensions);
return new StagingAutomationPackageContext(new AutomationPackageResourceUploader(), automationPackage, operationMode, resourceManager, automationPackageArchive, packageContent, actorUser, enricher, extensions);
}

private void applySpecialValuesForArtifact(AbstractArtefact artifact, StagingAutomationPackageContext apContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public AutomationPackageYamlFragmentManager getAutomationPackageYamlFragmentMana
AutomationPackageContent content = newContentInstance();
Set<AutomationPackageFragmentYaml> fragments = new HashSet<>();
fillAutomationPackageWithImportedFragments(content, descriptor, archive, fragments);
StagingAutomationPackageContext stagingContext = new StagingAutomationPackageContext(null, AutomationPackageOperationMode.LOCAL, new LocalResourceManagerImpl(descriptorPath.getParent().toFile()), archive, content, null, null, new HashMap<>());
AutomationPackage automationPackage = new AutomationPackage();
automationPackage.setStatus(AutomationPackageStatus.EDIT);
StagingAutomationPackageContext stagingContext = new StagingAutomationPackageContext(new AutomationPackageLocalResourceMapper(descriptorPath.getParent()), automationPackage, AutomationPackageOperationMode.LOCAL, null, archive, content, null, null, new HashMap<>());
return new AutomationPackageYamlFragmentManager(archive.getResourcePathMatchingResolver(), descriptor, fragments, getOrCreateDescriptorReader(), stagingContext);
} catch (FileSystemNotFoundException | URISyntaxException e) {
throw new AutomationPackageReadingException("Failed to read automation package for editing. The most likely cause is that you were trying to load " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@

public class AutomationPackageDescriptorReader {

protected static final Logger log = LoggerFactory.getLogger(AutomationPackageDescriptorReader.class);
private static final Logger log = LoggerFactory.getLogger(AutomationPackageDescriptorReader.class);

protected final ObjectMapper yamlObjectMapper;
private final ObjectMapper yamlObjectMapper;

protected final YamlPlanReader planReader;
private final YamlPlanReader planReader;

private final AutomationPackageSerializationRegistry serializationRegistry;

protected String jsonSchema;
private String jsonSchema;

public AutomationPackageDescriptorReader(String jsonSchemaPath, AutomationPackageSerializationRegistry serializationRegistry) {
this.serializationRegistry = serializationRegistry;
Expand Down
Loading