Skip to content

Conversation

@vkalapov
Copy link
Contributor

@vkalapov vkalapov commented Jan 9, 2026

No description provided.

@vkalapov vkalapov force-pushed the bg-stop-reorder branch 6 times, most recently from ea825d7 to dd016cb Compare January 14, 2026 09:26
LMCROSSITXSADEPLOY-3367
@sonarqubecloud
Copy link

Copy link
Contributor

@Yavor16 Yavor16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add also unit test for PrepareToStopDependentModulesStep

package org.cloudfoundry.multiapps.controller.process.steps;

import jakarta.inject.Named;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this from the PR

Comment on lines +45 to +50
modifiedApp = ImmutableCloudApplicationExtended.builder()
.from(modifiedApp)
.staging(modifiedApp.getStaging())
.routes(getApplicationRoutes(context, modifiedApp))
.env(calculatedAppEnv)
.build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you exctract this this creatin logic in a new method

Comment on lines +41 to +52
Module applicationModule = findModuleInDeploymentDescriptor(context, getCurrentModuleToStop(context).getName());
context.setVariable(Variables.MODULE_TO_DEPLOY, applicationModule);
CloudApplicationExtended modifiedApp = getApplicationCloudModelBuilder(context).build(applicationModule, moduleToDeployHelper);
Map<String, String> calculatedAppEnv = applicationEnvironmentCalculator.calculateNewApplicationEnv(context, modifiedApp);
modifiedApp = ImmutableCloudApplicationExtended.builder()
.from(modifiedApp)
.staging(modifiedApp.getStaging())
.routes(getApplicationRoutes(context, modifiedApp))
.env(calculatedAppEnv)
.build();
context.setVariable(Variables.APP_TO_PROCESS, modifiedApp);
return StepPhase.DONE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you creating here new APP_TO_PROCESS here and what is the difference from the old one?

Comment on lines 5 to 18
import jakarta.inject.Inject;
import org.cloudfoundry.multiapps.controller.core.cf.metadata.processor.MtaMetadataParser;
import org.cloudfoundry.multiapps.controller.process.util.HooksCalculator;
import org.cloudfoundry.multiapps.controller.process.util.HooksExecutor;
import org.cloudfoundry.multiapps.controller.process.util.HooksPhaseBuilder;
import org.cloudfoundry.multiapps.controller.process.util.HooksPhaseGetter;
import org.cloudfoundry.multiapps.controller.process.util.ImmutableHooksCalculator;
import org.cloudfoundry.multiapps.controller.process.util.ImmutableModuleDeterminer;
import org.cloudfoundry.multiapps.controller.process.util.ModuleDeterminer;
import org.cloudfoundry.multiapps.controller.process.variables.Variables;
import org.cloudfoundry.multiapps.mta.model.Hook;
import org.cloudfoundry.multiapps.mta.model.Module;

import jakarta.inject.Inject;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class can be removed

Comment on lines +75 to +77
private boolean supportsDeployedAfter(Module module) {
return module.getMajorSchemaVersion() >= 3;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we print a error message if the user is using verions older than 3 and want to use the parameter

completeDeploymentDescriptor.setModules(List.of(module));
context.setVariable(Variables.DEPENDENT_MODULES_TO_STOP, List.of(module));
context.setVariable(Variables.APPS_TO_STOP_INDEX, 0);
context.setVariable(Variables.MTA_MAJOR_SCHEMA_VERSION, 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add unit test for schema version 2. So you can test the validation of the version

Comment on lines +71 to +78
ImmutableCloudApplicationExtended applicationExtended = ImmutableCloudApplicationExtended.builder()
.name("test-module")
.metadata(ImmutableCloudMetadata.of(
UUID.randomUUID()
))
.staging(createStaging(
true))
.build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test with normal and idle route so we can conver this condition also

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

class StopDependentModuleStepTest extends SyncFlowableStepTest<StopDependentModuleStep> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add test if client.getApplication(idleName); returns null

Comment on lines -120 to -121
<sequenceFlow id="sid-0F200B9A-6462-48CD-BA2D-6E6F1CE15D96" sourceRef="deleteIdleRoutesTask" targetRef="shouldManageServiceBroker"></sequenceFlow>
<sequenceFlow id="skipDeleteIdleRoutesFlow" sourceRef="shouldDeleteIdleRoutes" targetRef="shouldManageServiceBroker"></sequenceFlow>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the location of sequence flows?

import org.cloudfoundry.multiapps.controller.process.variables.Variables;
import org.cloudfoundry.multiapps.mta.model.Hook;
import org.cloudfoundry.multiapps.mta.model.Module;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may revert the changes as they are not part of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants