introduce-partner-business-role #16
@ -110,6 +110,7 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (partnerRepo.deleteByUuid(partnerUuid) != 1 ||
|
if (partnerRepo.deleteByUuid(partnerUuid) != 1 ||
|
||||||
|
// TODO: move to after delete trigger in partner
|
||||||
relationshipRepo.deleteByUuid(partnerToDelete.get().getPartnerRole().getUuid()) != 1 ) {
|
relationshipRepo.deleteByUuid(partnerToDelete.get().getPartnerRole().getUuid()) != 1 ) {
|
||||||
ResponseEntity.internalServerError().build();
|
ResponseEntity.internalServerError().build();
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
|||||||
private <E extends HasUuid> E ref(final Class<E> entityClass, final UUID uuid) {
|
private <E extends HasUuid> E ref(final Class<E> entityClass, final UUID uuid) {
|
||||||
try {
|
try {
|
||||||
final var e = em.getReference(entityClass, uuid);
|
final var e = em.getReference(entityClass, uuid);
|
||||||
em.contains(e);
|
em.contains(e); // TODO: check if this is really needed to force an exception if not existing
|
||||||
return e;
|
return e;
|
||||||
} catch (final Throwable exc) {
|
} catch (final Throwable exc) {
|
||||||
throw new ReferenceNotFoundException(entityClass, uuid, exc);
|
throw new ReferenceNotFoundException(entityClass, uuid, exc);
|
||||||
|
@ -10,10 +10,10 @@ public interface RbacRoleRepository extends Repository<RbacRoleEntity, UUID> {
|
|||||||
/**
|
/**
|
||||||
* @return the number of persistent RbacRoleEntity instances, mostly for testing purposes.
|
* @return the number of persistent RbacRoleEntity instances, mostly for testing purposes.
|
||||||
*/
|
*/
|
||||||
long count();
|
long count(); // TODO: move to test sources
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return all persistent RbacRoleEntity instances, mostly for testing purposes.
|
* @return all persistent RbacRoleEntity instances, assigned to the current subject (user or assumed roles)
|
||||||
*/
|
*/
|
||||||
List<RbacRoleEntity> findAll();
|
List<RbacRoleEntity> findAll();
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ $$;
|
|||||||
create table RbacObject
|
create table RbacObject
|
||||||
(
|
(
|
||||||
uuid uuid primary key default uuid_generate_v4(),
|
uuid uuid primary key default uuid_generate_v4(),
|
||||||
serialId serial,
|
serialId serial, -- TODO: we might want to remove this once test data deletion works properly
|
||||||
objectTable varchar(64) not null,
|
objectTable varchar(64) not null,
|
||||||
unique (objectTable, uuid)
|
unique (objectTable, uuid)
|
||||||
);
|
);
|
||||||
|
@ -524,6 +524,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
try {
|
try {
|
||||||
//System.out.println("persisting #" + entity.hashCode() + ": " + entity);
|
//System.out.println("persisting #" + entity.hashCode() + ": " + entity);
|
||||||
em.persist(entity);
|
em.persist(entity);
|
||||||
|
// uncomment for debugging purposes
|
||||||
// em.flush();
|
// em.flush();
|
||||||
// System.out.println("persisted #" + entity.hashCode() + " as " + entity.getUuid());
|
// System.out.println("persisted #" + entity.hashCode() + " as " + entity.getUuid());
|
||||||
} catch (Exception exc) {
|
} catch (Exception exc) {
|
||||||
@ -896,7 +897,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
contractualMissing.add(partner.getPartnerNumber());
|
contractualMissing.add(partner.getPartnerNumber());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// assertThat(contractualMissing).isEmpty();
|
// assertThat(contractualMissing).isEmpty(); uncomment if we don't want allow missing contractual contact
|
||||||
}
|
}
|
||||||
private static boolean containsRole(final Record rec, final String role) {
|
private static boolean containsRole(final Record rec, final String role) {
|
||||||
final var roles = rec.getString("roles");
|
final var roles = rec.getString("roles");
|
||||||
|
@ -491,8 +491,9 @@ class HsOfficePartnerControllerAcceptanceTest extends ContextBasedTestWithCleanu
|
|||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
cleanupAllNew(HsOfficePartnerDetailsEntity.class); // TODO: should not be necessary
|
|
||||||
cleanupAllNew(HsOfficePartnerEntity.class);
|
cleanupAllNew(HsOfficePartnerEntity.class);
|
||||||
|
|
||||||
|
// TODO: should not be necessary anymore, once it's deleted via after delete trigger
|
||||||
cleanupAllNew(HsOfficeRelationshipEntity.class);
|
cleanupAllNew(HsOfficeRelationshipEntity.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import static java.util.stream.Collectors.toSet;
|
|||||||
import static org.apache.commons.collections4.SetUtils.difference;
|
import static org.apache.commons.collections4.SetUtils.difference;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
//@DirtiesContext
|
// TODO: cleanup the whole class
|
||||||
public abstract class ContextBasedTestWithCleanup extends ContextBasedTest {
|
public abstract class ContextBasedTestWithCleanup extends ContextBasedTest {
|
||||||
|
|
||||||
private static final boolean DETAILED_BUT_SLOW_CHECK = true;
|
private static final boolean DETAILED_BUT_SLOW_CHECK = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user