diff --git a/app/common/src/test/java/stirling/software/common/util/JarPathUtilTest.java b/app/common/src/test/java/stirling/software/common/util/JarPathUtilTest.java index bc4a58958b..aae73644c9 100644 --- a/app/common/src/test/java/stirling/software/common/util/JarPathUtilTest.java +++ b/app/common/src/test/java/stirling/software/common/util/JarPathUtilTest.java @@ -2,6 +2,7 @@ package stirling.software.common.util; import static org.junit.jupiter.api.Assertions.*; +import java.nio.file.Files; import java.nio.file.Path; import org.junit.jupiter.api.Test; @@ -16,10 +17,12 @@ class JarPathUtilTest { } @Test - void restartHelperJar_notFound_returnsNull() { - // Since we're not running from JAR and restart-helper.jar likely doesn't exist + void restartHelperJar_returnsNullOrExistingFile() { Path result = JarPathUtil.restartHelperJar(); - assertNull(result, "Should return null when restart-helper.jar is not found"); + if (result != null) { + assertTrue( + Files.isRegularFile(result), "Found restart helper should be a regular file"); + } } @Test diff --git a/app/proprietary/src/test/java/stirling/software/proprietary/policy/ledger/FolderIdentitiesTest.java b/app/proprietary/src/test/java/stirling/software/proprietary/policy/ledger/FolderIdentitiesTest.java index 9f56411d9b..d9ad6835fc 100644 --- a/app/proprietary/src/test/java/stirling/software/proprietary/policy/ledger/FolderIdentitiesTest.java +++ b/app/proprietary/src/test/java/stirling/software/proprietary/policy/ledger/FolderIdentitiesTest.java @@ -3,6 +3,7 @@ package stirling.software.proprietary.policy.ledger; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.IOException; import java.nio.file.Files; @@ -24,7 +25,13 @@ class FolderIdentitiesTest { @Test void identityAgreesAcrossASymlinkedAliasOfTheDirectory() throws IOException { Path real = Files.createDirectories(tempDir.resolve("real")); - Path alias = Files.createSymbolicLink(tempDir.resolve("alias"), real); + Path alias; + try { + alias = Files.createSymbolicLink(tempDir.resolve("alias"), real); + } catch (IOException | UnsupportedOperationException e) { + assumeTrue(false, "Symbolic links are not supported in this test environment: " + e); + return; + } Files.writeString(real.resolve("doc.pdf"), "data"); String viaReal = diff --git a/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AdminSettingsControllerTest.java b/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AdminSettingsControllerTest.java index 124dd661fd..1cfed80437 100644 --- a/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AdminSettingsControllerTest.java +++ b/app/proprietary/src/test/java/stirling/software/proprietary/security/controller/api/AdminSettingsControllerTest.java @@ -603,22 +603,25 @@ class AdminSettingsControllerTest { class RestartApplication { @Test - @DisplayName("restarts in-process when not running from a JAR (dev mode)") - void devModeRestartsInProcess() { + @DisplayName("restarts through the helper when not running from a JAR (dev mode)") + void devModeRestartsThroughHelper() throws IOException { controller = spy(controller); doNothing().when(controller).restartInDevelopmentMode(any(), anyList()); + java.nio.file.Path helper = + java.nio.file.Files.createTempFile("restart-helper-", ".jar"); try (MockedStatic jar = mockStatic(stirling.software.common.util.JarPathUtil.class)) { jar.when(stirling.software.common.util.JarPathUtil::currentJar).thenReturn(null); jar.when(stirling.software.common.util.JarPathUtil::restartHelperJar) - .thenReturn(java.nio.file.Path.of("build/libs/restart-helper.jar")); + .thenReturn(helper); ResponseEntity> response = controller.restartApplication(); assertThat(response.getStatusCode().is2xxSuccessful()).isTrue(); verify(controller).restartInDevelopmentMode(any(), anyList()); } + java.nio.file.Files.deleteIfExists(helper); } @Test diff --git a/app/saas/src/main/java/stirling/software/saas/payg/bundle/PrepaidBundle.java b/app/saas/src/main/java/stirling/software/saas/payg/bundle/PrepaidBundle.java index e2dff403a7..f864bf4d98 100644 --- a/app/saas/src/main/java/stirling/software/saas/payg/bundle/PrepaidBundle.java +++ b/app/saas/src/main/java/stirling/software/saas/payg/bundle/PrepaidBundle.java @@ -34,17 +34,22 @@ import lombok.Setter; @Entity @Table( name = "payg_prepaid_bundle", - // Declared here for ddl-auto (fresh schemas) and to document intent. The authoritative creator - // in production is the Supabase CLI migration 20260720000000_payg_prepaid_bundle, which builds + // Declared here for ddl-auto (fresh schemas) and to document intent. The authoritative + // creator + // in production is the Supabase CLI migration 20260720000000_payg_prepaid_bundle, which + // builds // the partial forms (WHERE units_remaining > 0 / WHERE stripe_ref IS NOT NULL). Flyway was // retired for SaaS (#7100), so there is no migration twin — names match the CLI migration. indexes = { - // Hot-path FIFO draw lookup — findDrawableForUpdate runs a locked read on every billable - // charge past the free grant; without it that degrades to a locked scan as the table grows. + // Hot-path FIFO draw lookup — findDrawableForUpdate runs a locked read on every + // billable + // charge past the free grant; without it that degrades to a locked scan as the table + // grows. @Index( name = "idx_payg_prepaid_bundle_team_expiry", columnList = "team_id, expires_at"), - // One pool per Stripe payment — the idempotency guard so a redelivered invoice.paid can't + // One pool per Stripe payment — the idempotency guard so a redelivered invoice.paid + // can't // credit the same purchase twice. @Index( name = "uq_payg_prepaid_bundle_stripe_ref",