fixes from Code-Review
This commit is contained in:
parent
b2fd593098
commit
336948ba1c
@ -34,6 +34,7 @@ public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUu
|
|||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getAssetValue)
|
||||||
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getReference)
|
||||||
|
.withProp(HsOfficeCoopAssetsTransactionEntity::getComment)
|
||||||
.withSeparator(", ")
|
.withSeparator(", ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUu
|
|||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getTransactionType)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getShareCount)
|
||||||
.withProp(HsOfficeCoopSharesTransactionEntity::getReference)
|
.withProp(HsOfficeCoopSharesTransactionEntity::getReference)
|
||||||
|
.withProp(HsOfficeCoopSharesTransactionEntity::getComment)
|
||||||
.withSeparator(", ")
|
.withSeparator(", ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
|
@ -185,16 +185,16 @@ call generateRbacIdentityView('hs_office_debitor', $idName$
|
|||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
call generateRbacRestrictedView('hs_office_debitor', 'target.debitorNumberSuffix',
|
call generateRbacRestrictedView('hs_office_debitor', 'target.debitorNumberSuffix',
|
||||||
$updates$
|
$updates$
|
||||||
partnerUuid = new.partnerUuid, // TODO: remove? should never do anything
|
partnerUuid = new.partnerUuid, -- TODO: remove? should never do anything
|
||||||
billable = new.billable,
|
billable = new.billable,
|
||||||
billingContactUuid = new.billingContactUuid,
|
billingContactUuid = new.billingContactUuid,
|
||||||
debitorNumberSuffix = new.debitorNumberSuffix, // TODO: Should it be allowed to updated this value?
|
debitorNumberSuffix = new.debitorNumberSuffix, -- TODO: Should it be allowed to updated this value?
|
||||||
refundBankAccountUuid = new.refundBankAccountUuid,
|
refundBankAccountUuid = new.refundBankAccountUuid,
|
||||||
vatId = new.vatId,
|
vatId = new.vatId,
|
||||||
vatCountryCode = new.vatCountryCode,
|
vatCountryCode = new.vatCountryCode,
|
||||||
vatBusiness = new.vatBusiness,
|
vatBusiness = new.vatBusiness,
|
||||||
vatreversecharge = new.vatreversecharge,
|
vatreversecharge = new.vatreversecharge,
|
||||||
defaultPrefix = new.defaultPrefix // TODO: Should it be allowed to updated this value?
|
defaultPrefix = new.defaultPrefix -- TODO: Should it be allowed to updated this value?
|
||||||
$updates$);
|
$updates$);
|
||||||
--//
|
--//
|
||||||
|
|
||||||
|
@ -144,17 +144,17 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopAssetsTransactionsAreReturned(
|
allTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1)",
|
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2)",
|
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3)",
|
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3, some adjustment)",
|
||||||
|
|
||||||
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1)",
|
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2)",
|
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3)",
|
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3, some adjustment)",
|
||||||
|
|
||||||
"CoopAssetsTransaction(10003, 2010-03-15, DEPOSIT, 320.00, ref 10003-1)",
|
"CoopAssetsTransaction(10003, 2010-03-15, DEPOSIT, 320.00, ref 10003-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10003, 2021-09-01, DISBURSAL, -128.00, ref 10003-2)",
|
"CoopAssetsTransaction(10003, 2021-09-01, DISBURSAL, -128.00, ref 10003-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10003, 2022-10-20, ADJUSTMENT, 128.00, ref 10003-3)");
|
"CoopAssetsTransaction(10003, 2022-10-20, ADJUSTMENT, 128.00, ref 10003-3, some adjustment)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -173,9 +173,9 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopAssetsTransactionsAreReturned(
|
allTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1)",
|
"CoopAssetsTransaction(10002, 2010-03-15, DEPOSIT, 320.00, ref 10002-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2)",
|
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3)");
|
"CoopAssetsTransaction(10002, 2022-10-20, ADJUSTMENT, 128.00, ref 10002-3, some adjustment)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -194,7 +194,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then
|
// then
|
||||||
allTheseCoopAssetsTransactionsAreReturned(
|
allTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2)");
|
"CoopAssetsTransaction(10002, 2021-09-01, DISBURSAL, -128.00, ref 10002-2, partial disbursal)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -211,9 +211,9 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase
|
|||||||
// then:
|
// then:
|
||||||
exactlyTheseCoopAssetsTransactionsAreReturned(
|
exactlyTheseCoopAssetsTransactionsAreReturned(
|
||||||
result,
|
result,
|
||||||
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1)",
|
"CoopAssetsTransaction(10001, 2010-03-15, DEPOSIT, 320.00, ref 10001-1, initial deposit)",
|
||||||
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2)",
|
"CoopAssetsTransaction(10001, 2021-09-01, DISBURSAL, -128.00, ref 10001-2, partial disbursal)",
|
||||||
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3)");
|
"CoopAssetsTransaction(10001, 2022-10-20, ADJUSTMENT, 128.00, ref 10001-3, some adjustment)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
newBillingContact(PATCHED_CONTACT_UUID))
|
newBillingContact(PATCHED_CONTACT_UUID))
|
||||||
.notNullable(),
|
.notNullable(),
|
||||||
new SimpleProperty<>(
|
new SimpleProperty<>(
|
||||||
"personType",
|
"billable",
|
||||||
HsOfficeDebitorPatchResource::setBillable,
|
HsOfficeDebitorPatchResource::setBillable,
|
||||||
PATCHED_BILLABLE,
|
PATCHED_BILLABLE,
|
||||||
HsOfficeDebitorEntity::setBillable)
|
HsOfficeDebitorEntity::setBillable)
|
||||||
@ -121,19 +121,13 @@ class HsOfficeDebitorEntityPatcherUnitTest extends PatchUnitTestBase<
|
|||||||
PATCHED_VAT_COUNTRY_CODE,
|
PATCHED_VAT_COUNTRY_CODE,
|
||||||
HsOfficeDebitorEntity::setVatCountryCode),
|
HsOfficeDebitorEntity::setVatCountryCode),
|
||||||
new SimpleProperty<>(
|
new SimpleProperty<>(
|
||||||
"vatReverseCharge",
|
"vatBusiness",
|
||||||
HsOfficeDebitorPatchResource::setVatReverseCharge,
|
|
||||||
PATCHED_VAT_REVERSE_CHARGE,
|
|
||||||
HsOfficeDebitorEntity::setVatReverseCharge)
|
|
||||||
.notNullable(),
|
|
||||||
new SimpleProperty<>(
|
|
||||||
"personType",
|
|
||||||
HsOfficeDebitorPatchResource::setVatBusiness,
|
HsOfficeDebitorPatchResource::setVatBusiness,
|
||||||
PATCHED_VAT_BUSINESS,
|
PATCHED_VAT_BUSINESS,
|
||||||
HsOfficeDebitorEntity::setVatBusiness)
|
HsOfficeDebitorEntity::setVatBusiness)
|
||||||
.notNullable(),
|
.notNullable(),
|
||||||
new SimpleProperty<>(
|
new SimpleProperty<>(
|
||||||
"personType",
|
"vatReverseCharge",
|
||||||
HsOfficeDebitorPatchResource::setVatReverseCharge,
|
HsOfficeDebitorPatchResource::setVatReverseCharge,
|
||||||
PATCHED_BILLABLE,
|
PATCHED_BILLABLE,
|
||||||
HsOfficeDebitorEntity::setVatReverseCharge)
|
HsOfficeDebitorEntity::setVatReverseCharge)
|
||||||
|
@ -297,8 +297,6 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Test
|
@Test
|
||||||
@Order(1040)
|
@Order(1040)
|
||||||
void importCoopShares() {
|
void importCoopShares() {
|
||||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
|
||||||
|
|
||||||
try (Reader reader = resourceReader("migration/share-transactions.csv")) {
|
try (Reader reader = resourceReader("migration/share-transactions.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importCoopShares(justHeader(lines), withoutHeader(lines));
|
importCoopShares(justHeader(lines), withoutHeader(lines));
|
||||||
@ -312,7 +310,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
void verifyCoopShares() {
|
void verifyCoopShares() {
|
||||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||||
|
|
||||||
assertThat(coopShares.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(coopShares)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
33443=CoopShareTransaction(10017, 2000-12-06, SUBSCRIPTION, 20, initial share subscription),
|
33443=CoopShareTransaction(10017, 2000-12-06, SUBSCRIPTION, 20, initial share subscription),
|
||||||
33451=CoopShareTransaction(10020, 2000-12-06, SUBSCRIPTION, 2, initial share subscription),
|
33451=CoopShareTransaction(10020, 2000-12-06, SUBSCRIPTION, 2, initial share subscription),
|
||||||
@ -339,7 +337,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
void verifyCoopAssets() {
|
void verifyCoopAssets() {
|
||||||
assumeThat(postgresAdminUser).isEqualTo("admin");
|
assumeThat(postgresAdminUser).isEqualTo("admin");
|
||||||
|
|
||||||
assertThat(coopAssets.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(toFormattedString(coopAssets)).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
30000=CoopAssetsTransaction(10017, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
|
30000=CoopAssetsTransaction(10017, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
|
||||||
31000=CoopAssetsTransaction(10020, 2000-12-06, DEPOSIT, 128.00, for subscription B),
|
31000=CoopAssetsTransaction(10020, 2000-12-06, DEPOSIT, 128.00, for subscription B),
|
||||||
|
@ -297,7 +297,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
|||||||
.contentType(ContentType.JSON)
|
.contentType(ContentType.JSON)
|
||||||
.body("""
|
.body("""
|
||||||
{
|
{
|
||||||
"debitorNumerPrefix": "12345",
|
"debitorNumberPrefix": "12345",
|
||||||
"contactUuid": "%s",
|
"contactUuid": "%s",
|
||||||
"personUuid": "%s",
|
"personUuid": "%s",
|
||||||
"details": {
|
"details": {
|
||||||
|
@ -7,14 +7,9 @@ import net.hostsharing.hsadminng.rbac.rbacuser.RbacUserRepository;
|
|||||||
import net.hostsharing.test.Accepts;
|
import net.hostsharing.test.Accepts;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
|
|
||||||
import jakarta.persistence.EntityManager;
|
|
||||||
import jakarta.persistence.PersistenceContext;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
|
|
||||||
@SpringBootTest(
|
@SpringBootTest(
|
||||||
@ -27,9 +22,6 @@ class RbacRoleControllerAcceptanceTest {
|
|||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
@PersistenceContext
|
|
||||||
EntityManager em;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
Context context;
|
Context context;
|
||||||
|
|
||||||
@ -39,14 +31,6 @@ class RbacRoleControllerAcceptanceTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
RbacRoleRepository rbacRoleRepository;
|
RbacRoleRepository rbacRoleRepository;
|
||||||
|
|
||||||
@Value("${HSADMINNG_POSTGRES_RESTRICTED_USERNAME}")
|
|
||||||
String restrictedUser;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testEnv() {
|
|
||||||
assertThat(restrictedUser).isEqualTo("restricted");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Accepts({ "ROL:L(List)" })
|
@Accepts({ "ROL:L(List)" })
|
||||||
void globalAdmin_withoutAssumedRole_canViewAllRoles() {
|
void globalAdmin_withoutAssumedRole_canViewAllRoles() {
|
||||||
|
@ -9,7 +9,6 @@ import net.hostsharing.test.JpaAttempt;
|
|||||||
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.boot.test.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -43,14 +42,6 @@ class RbacUserControllerAcceptanceTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
RbacUserRepository rbacUserRepository;
|
RbacUserRepository rbacUserRepository;
|
||||||
|
|
||||||
@Value("${HSADMINNG_POSTGRES_RESTRICTED_USERNAME}")
|
|
||||||
String restrictedUser;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testEnv() {
|
|
||||||
assertThat(restrictedUser).isEqualTo("restricted");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class CreateRbacUser {
|
class CreateRbacUser {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user