Skip to content

Commit

Permalink
Merge branch 'release-9.0.0' into 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
bonita-ci committed Oct 24, 2023
2 parents cb1f85e + d4f9a93 commit a91ac0d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void autoDeployDetectedCustomApplication(PlatformStartedEvent event)
log.info("Bonita now tries to install it automatically...");
applicationInstaller.install(applicationArchive);
} else {
var currentVersion = platformService.getPlatform().getApplicationVersion();
var currentVersion = getInstalledApplicationVersion();
log.info("Detected application version: '{}'; Current deployed version: '{}'",
applicationArchive.getVersion(),
currentVersion);
Expand All @@ -113,6 +113,11 @@ public void autoDeployDetectedCustomApplication(PlatformStartedEvent event)
}
}

String getInstalledApplicationVersion() throws Exception {
return applicationInstaller.inSession(
() -> applicationInstaller.inTransaction(() -> platformService.getPlatform().getApplicationVersion()));
}

boolean isPlatformFirstInitialization() {
return mandatoryLivingApplicationImporter.isFirstRun();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

import org.bonitasoft.engine.business.application.importer.DefaultLivingApplicationImporter;
import org.bonitasoft.engine.exception.ApplicationInstallationException;
import org.bonitasoft.engine.platform.PlatformService;
import org.bonitasoft.engine.platform.model.SPlatform;
import org.bonitasoft.engine.tenant.TenantServicesManager;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -60,10 +58,6 @@ class CustomOrDefaultApplicationInstallerTest {
DefaultLivingApplicationImporter defaultLivingApplicationImporter;
@Mock
TenantServicesManager tenantServicesManager;
@Mock
PlatformService platformService;
@Mock
SPlatform platform;

@Mock
private ApplicationArchiveReader applicationArchiveReader;
Expand All @@ -75,7 +69,6 @@ class CustomOrDefaultApplicationInstallerTest {
void before() throws Exception {
doAnswer(inv -> callableCaptor.getValue().call()).when(tenantServicesManager)
.inTenantSessionTransaction(callableCaptor.capture());
doReturn(platform).when(platformService).getPlatform();
}

@Test
Expand Down Expand Up @@ -170,7 +163,7 @@ void should_update_custom_application_if_detected_version_superior_to_deployed_v
applicationArchive.setVersion("1.0.1");
doReturn(applicationArchive).when(applicationArchiveReader).read(resourceStream1);
doReturn(false).when(listener).isPlatformFirstInitialization();
doReturn("1.0.0").when(platform).getApplicationVersion();
doReturn("1.0.0").when(listener).getInstalledApplicationVersion();
//when
listener.autoDeployDetectedCustomApplication(any());

Expand All @@ -190,7 +183,7 @@ void should_update_conf_if_detected_version_equal_to_deployed_version()
applicationArchive.setVersion("1.0.0");
doReturn(applicationArchive).when(listener).createApplicationArchive(resource1);
doReturn(false).when(listener).isPlatformFirstInitialization();
doReturn("1.0.0").when(platform).getApplicationVersion();
doReturn("1.0.0").when(listener).getInstalledApplicationVersion();
//when
listener.autoDeployDetectedCustomApplication(any());

Expand All @@ -212,7 +205,7 @@ void should_throw_an_exception_if_detected_version_inferior_to_deployed_version(
applicationArchive.setVersion("0.0.9-SNAPSHOT");
doReturn(applicationArchive).when(listener).createApplicationArchive(resource1);
doReturn(false).when(listener).isPlatformFirstInitialization();
doReturn("1.0.0").when(platform).getApplicationVersion();
doReturn("1.0.0").when(listener).getInstalledApplicationVersion();
//when
String exceptionMessage = Assertions.assertThrows(ApplicationInstallationException.class,
() -> listener.autoDeployDetectedCustomApplication(any())).getMessage();
Expand Down
2 changes: 1 addition & 1 deletion bpm/bonita-web-server/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<filter-class>org.bonitasoft.console.common.server.filter.CacheFilter</filter-class>
<init-param>
<param-name>duration</param-name>
<param-value>15768000</param-value>
<param-value>36000</param-value>
</init-param>
<init-param>
<param-name>alwaysCaching</param-name>
Expand Down

0 comments on commit a91ac0d

Please sign in to comment.