fix lastUnixUserId - 3rd try

This commit is contained in:
Michael Hoennig 2024-10-07 17:22:44 +02:00
parent 03b720251a
commit 05ffbac882

View File

@ -157,7 +157,7 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
) )
); );
final var givenParentAsset = givenParentAsset(MANAGED_SERVER, "vm1011"); final var givenParentAsset = givenParentAsset(MANAGED_SERVER, "vm1011");
final var expectedUnixUserId = lastUnixUserId(); final var expectedUnixUserId = nextUnixUserId();
final var location = RestAssured // @formatter:off final var location = RestAssured // @formatter:off
.given() .given()
@ -208,9 +208,11 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
.isEqualTo(""" .isEqualTo("""
HsHostingAsset(UNIX_USER, fir10, fir10 webspace user, MANAGED_WEBSPACE:fir10, { HsHostingAsset(UNIX_USER, fir10, fir10 webspace user, MANAGED_WEBSPACE:fir10, {
"password" : null, "password" : null,
"userid" : 1000000 "userid" : {lastUnixUserId}
}) })
""".trim()); """
.replace("{lastUnixUserId}", expectedUnixUserId.toString())
.trim());
} }
@Test @Test
@ -781,10 +783,10 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
} }
private Integer lastUnixUserId() { private Integer nextUnixUserId() {
final Object result = em.createNativeQuery("SELECT last_value from hs_hosting.asset_unixuser_system_id_seq", Integer.class) final Object result = em.createNativeQuery("SELECT nextval('hs_hosting.asset_unixuser_system_id_seq')", Integer.class)
.getSingleResult(); .getSingleResult();
return (Integer) result; return (Integer) result + 1;
} }
} }