Compare commits
No commits in common. "678d503be5ddb62a5f731be8ee0bc176cf2f76b6" and "0f729503369e43eb8dffb383a74c560675cc277b" have entirely different histories.
678d503be5
...
0f72950336
@ -41,8 +41,6 @@ create table if not exists hs_hosting.asset
|
|||||||
config jsonb not null,
|
config jsonb not null,
|
||||||
alarmContactUuid uuid null references hs_office.contact(uuid) initially deferred,
|
alarmContactUuid uuid null references hs_office.contact(uuid) initially deferred,
|
||||||
|
|
||||||
unique (type, identifier), -- at least as long as we need to be compatible to the legacy system
|
|
||||||
|
|
||||||
constraint hosting_asset_has_booking_item_or_parent_asset
|
constraint hosting_asset_has_booking_item_or_parent_asset
|
||||||
check (bookingItemUuid is not null or parentAssetUuid is not null or type in ('DOMAIN_SETUP', 'IPV4_NUMBER', 'IPV6_NUMBER'))
|
check (bookingItemUuid is not null or parentAssetUuid is not null or type in ('DOMAIN_SETUP', 'IPV4_NUMBER', 'IPV6_NUMBER'))
|
||||||
);
|
);
|
||||||
|
@ -10,7 +10,6 @@ import net.hostsharing.hsadminng.rbac.role.RawRbacRoleRepository;
|
|||||||
import net.hostsharing.hsadminng.mapper.Array;
|
import net.hostsharing.hsadminng.mapper.Array;
|
||||||
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
|
||||||
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
|
||||||
import org.hibernate.exception.ConstraintViolationException;
|
|
||||||
import org.junit.jupiter.api.Nested;
|
import org.junit.jupiter.api.Nested;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
@ -164,31 +163,6 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu
|
|||||||
assertThat(realAssetRepo.count()).isEqualTo(count + 1);
|
assertThat(realAssetRepo.count()).isEqualTo(count + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void identifiersForTheSameTypeAreUnique() {
|
|
||||||
// given
|
|
||||||
context("superuser-alex@hostsharing.net"); // TODO.test: remove context(...) once all entities have real entities
|
|
||||||
final var count = realAssetRepo.count();
|
|
||||||
final var givenManagedServer = givenHostingAsset("D-1000111 default project", MANAGED_SERVER);
|
|
||||||
final var newWebspaceBookingItem = newBookingItem(givenManagedServer.getBookingItem(), HsBookingItemType.MANAGED_WEBSPACE, "fir01");
|
|
||||||
|
|
||||||
// when
|
|
||||||
final var result = attempt(em, () -> {
|
|
||||||
final var newAsset = HsHostingAssetRbacEntity.builder()
|
|
||||||
.bookingItem(newWebspaceBookingItem)
|
|
||||||
.parentAsset(givenManagedServer)
|
|
||||||
.caption("some managed webspace with existing identifier")
|
|
||||||
.type(MANAGED_WEBSPACE)
|
|
||||||
.identifier("fir01")
|
|
||||||
.build();
|
|
||||||
return toCleanup(rbacAssetRepo.save(newAsset));
|
|
||||||
});
|
|
||||||
|
|
||||||
// then
|
|
||||||
result.assertExceptionWithRootCauseMessage(ConstraintViolationException.class,
|
|
||||||
"duplicate key value violates unique constraint \"asset_type_identifier_key\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createsAndGrantsRoles() {
|
public void createsAndGrantsRoles() {
|
||||||
// given
|
// given
|
||||||
|
Loading…
Reference in New Issue
Block a user