Compare commits

..

No commits in common. "6d4ba9b094ef63e602f443c117a8cd9d396c17de" and "5d298a498f773d51fbdedfce160f08375add15ba" have entirely different histories.

11 changed files with 18 additions and 40 deletions

View File

@ -58,7 +58,7 @@ function importOfficeData() {
./gradlew importOfficeData ./gradlew importOfficeData
} }
alias gw-importOfficeData=importOfficeData alias import-office-data=importOfficeData
alias podman-start='systemctl --user enable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock' alias podman-start='systemctl --user enable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock'
alias podman-stop='systemctl --user disable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock' alias podman-stop='systemctl --user disable --now podman.socket && systemctl --user status podman.socket && ls -la /run/user/$UID/podman/podman.sock'

View File

@ -309,6 +309,7 @@ tasks.register('importOfficeData', Test) {
group 'verification' group 'verification'
description 'run the import jobs as tests' description 'run the import jobs as tests'
} }
test.dependsOn tasks.importOfficeData
// pitest mutation testing // pitest mutation testing

View File

@ -59,8 +59,8 @@ public class HsOfficeMembershipEntity implements HasUuid, Stringifyable {
@Type(PostgreSQLRangeType.class) @Type(PostgreSQLRangeType.class)
private Range<LocalDate> validity; private Range<LocalDate> validity;
@Column(name = "membershipfeebillable", nullable = false) @Column(name = "membership_fee_billable")
private Boolean membershipFeeBillable; // not primitive to force setting the value private boolean membershipFeeBillable;
@Column(name = "reasonfortermination") @Column(name = "reasonfortermination")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)

View File

@ -37,8 +37,6 @@ public class HsOfficeMembershipEntityPatcher implements EntityPatcher<HsOfficeMe
Optional.ofNullable(resource.getReasonForTermination()) Optional.ofNullable(resource.getReasonForTermination())
.map(v -> mapper.map(v, HsOfficeReasonForTermination.class)) .map(v -> mapper.map(v, HsOfficeReasonForTermination.class))
.ifPresent(entity::setReasonForTermination); .ifPresent(entity::setReasonForTermination);
OptionalFromJson.of(resource.getMembershipFeeBillable()).ifPresent(
entity::setMembershipFeeBillable);
} }
private void verifyNotNull(final UUID newValue, final String propertyName) { private void verifyNotNull(final UUID newValue, final String propertyName) {

View File

@ -33,8 +33,6 @@ components:
format: date format: date
reasonForTermination: reasonForTermination:
$ref: '#/components/schemas/HsOfficeReasonForTermination' $ref: '#/components/schemas/HsOfficeReasonForTermination'
membershipFeeBillable:
type: boolean
HsOfficeMembershipPatch: HsOfficeMembershipPatch:
type: object type: object
@ -50,9 +48,6 @@ components:
reasonForTermination: reasonForTermination:
nullable: true nullable: true
$ref: '#/components/schemas/HsOfficeReasonForTermination' $ref: '#/components/schemas/HsOfficeReasonForTermination'
membershipFeeBillable:
nullable: true
type: boolean
additionalProperties: false additionalProperties: false
HsOfficeMembershipInsert: HsOfficeMembershipInsert:
@ -79,12 +74,8 @@ components:
nullable: true nullable: true
reasonForTermination: reasonForTermination:
$ref: '#/components/schemas/HsOfficeReasonForTermination' $ref: '#/components/schemas/HsOfficeReasonForTermination'
membershipFeeBillable:
nullable: false
type: boolean
required: required:
- partnerUuid - partnerUuid
- mainDebitorUuid - mainDebitorUuid
- validFrom - validFrom
- membershipFeeBillable
additionalProperties: false additionalProperties: false

View File

@ -16,7 +16,7 @@ create table if not exists hs_office_membership
memberNumber numeric(5) not null unique, memberNumber numeric(5) not null unique,
validity daterange not null, validity daterange not null,
reasonForTermination HsOfficeReasonForTermination not null default 'NONE', reasonForTermination HsOfficeReasonForTermination not null default 'NONE',
membershipFeeBillable boolean not null default true membership_fee_billable boolean not null default true
); );
--// --//

View File

@ -106,7 +106,7 @@ call generateRbacRestrictedView('hs_office_membership',
columnUpdates => $updates$ columnUpdates => $updates$
validity = new.validity, validity = new.validity,
reasonForTermination = new.reasonForTermination, reasonForTermination = new.reasonForTermination,
membershipFeeBillable = new.membershipFeeBillable membership_fee_billable = new.membership_fee_billable
$updates$); $updates$);
--// --//

View File

@ -131,8 +131,7 @@ class HsOfficeMembershipControllerAcceptanceTest {
"partnerUuid": "%s", "partnerUuid": "%s",
"mainDebitorUuid": "%s", "mainDebitorUuid": "%s",
"memberNumber": 20001, "memberNumber": 20001,
"validFrom": "2022-10-13", "validFrom": "2022-10-13"
"membershipFeeBillable": "true"
} }
""".formatted(givenPartner.getUuid(), givenDebitor.getUuid())) """.formatted(givenPartner.getUuid(), givenDebitor.getUuid()))
.port(port) .port(port)
@ -447,7 +446,6 @@ class HsOfficeMembershipControllerAcceptanceTest {
.memberNumber(++tempMemberNumber) .memberNumber(++tempMemberNumber)
.validity(Range.closedInfinite(LocalDate.parse("2022-11-01"))) .validity(Range.closedInfinite(LocalDate.parse("2022-11-01")))
.reasonForTermination(NONE) .reasonForTermination(NONE)
.membershipFeeBillable(true)
.build(); .build();
return membershipRepo.save(newMembership); return membershipRepo.save(newMembership);

View File

@ -72,8 +72,7 @@ public class HsOfficeMembershipControllerRestTest {
"partnerUuid": null, "partnerUuid": null,
"mainDebitorUuid": "%s", "mainDebitorUuid": "%s",
"memberNumber": 20001, "memberNumber": 20001,
"validFrom": "2022-10-13", "validFrom": "2022-10-13"
"membershipFeeBillable": "true"
} }
""".formatted(UUID.randomUUID())) """.formatted(UUID.randomUUID()))
.accept(MediaType.APPLICATION_JSON)) .accept(MediaType.APPLICATION_JSON))
@ -98,8 +97,7 @@ public class HsOfficeMembershipControllerRestTest {
"partnerUuid": "%s", "partnerUuid": "%s",
"mainDebitorUuid": null, "mainDebitorUuid": null,
"memberNumber": 20001, "memberNumber": 20001,
"validFrom": "2022-10-13", "validFrom": "2022-10-13"
"membershipFeeBillable": "true"
} }
""".formatted(UUID.randomUUID())) """.formatted(UUID.randomUUID()))
.accept(MediaType.APPLICATION_JSON)) .accept(MediaType.APPLICATION_JSON))
@ -130,8 +128,7 @@ public class HsOfficeMembershipControllerRestTest {
"partnerUuid": "%s", "partnerUuid": "%s",
"mainDebitorUuid": "%s", "mainDebitorUuid": "%s",
"memberNumber": 20001, "memberNumber": 20001,
"validFrom": "2022-10-13", "validFrom": "2022-10-13"
"membershipFeeBillable": "true"
} }
""".formatted(givenPartnerUuid, givenMainDebitorUuid)) """.formatted(givenPartnerUuid, givenMainDebitorUuid))
.accept(MediaType.APPLICATION_JSON)) .accept(MediaType.APPLICATION_JSON))
@ -162,8 +159,7 @@ public class HsOfficeMembershipControllerRestTest {
"partnerUuid": "%s", "partnerUuid": "%s",
"mainDebitorUuid": "%s", "mainDebitorUuid": "%s",
"memberNumber": 20001, "memberNumber": 20001,
"validFrom": "2022-10-13", "validFrom": "2022-10-13"
"membershipFeeBillable": "true"
} }
""".formatted(givenPartnerUuid, givenMainDebitorUuid)) """.formatted(givenPartnerUuid, givenMainDebitorUuid))
.accept(MediaType.APPLICATION_JSON)) .accept(MediaType.APPLICATION_JSON))

View File

@ -36,9 +36,6 @@ class HsOfficeMembershipEntityPatcherUnitTest extends PatchUnitTestBase<
private static final LocalDate GIVEN_VALID_FROM = LocalDate.parse("2020-04-15"); private static final LocalDate GIVEN_VALID_FROM = LocalDate.parse("2020-04-15");
private static final LocalDate PATCHED_VALID_TO = LocalDate.parse("2022-12-31"); private static final LocalDate PATCHED_VALID_TO = LocalDate.parse("2022-12-31");
private static final Boolean GIVEN_MEMBERSHIP_FEE_BILLABLE = true;
private static final Boolean PATCHED_MEMBERSHIP_FEE_BILLABLE = false;
@Mock @Mock
private EntityManager em; private EntityManager em;
@ -59,7 +56,6 @@ class HsOfficeMembershipEntityPatcherUnitTest extends PatchUnitTestBase<
entity.setMainDebitor(TEST_DEBITOR); entity.setMainDebitor(TEST_DEBITOR);
entity.setPartner(TEST_PARTNER); entity.setPartner(TEST_PARTNER);
entity.setValidity(Range.closedInfinite(GIVEN_VALID_FROM)); entity.setValidity(Range.closedInfinite(GIVEN_VALID_FROM));
entity.setMembershipFeeBillable(GIVEN_MEMBERSHIP_FEE_BILLABLE);
return entity; return entity;
} }
@ -94,12 +90,7 @@ class HsOfficeMembershipEntityPatcherUnitTest extends PatchUnitTestBase<
HsOfficeReasonForTerminationResource.CANCELLATION, HsOfficeReasonForTerminationResource.CANCELLATION,
HsOfficeMembershipEntity::setReasonForTermination, HsOfficeMembershipEntity::setReasonForTermination,
HsOfficeReasonForTermination.CANCELLATION) HsOfficeReasonForTermination.CANCELLATION)
.notNullable(), .notNullable()
new JsonNullableProperty<>(
"membershipFeeBillable",
HsOfficeMembershipPatchResource::setMembershipFeeBillable,
PATCHED_MEMBERSHIP_FEE_BILLABLE,
HsOfficeMembershipEntity::setMembershipFeeBillable)
); );
} }
@ -108,4 +99,10 @@ class HsOfficeMembershipEntityPatcherUnitTest extends PatchUnitTestBase<
newDebitor.setUuid(uuid); newDebitor.setUuid(uuid);
return newDebitor; return newDebitor;
} }
private HsOfficeMembershipEntity newMembership(final UUID uuid) {
final var newMembership = new HsOfficeMembershipEntity();
newMembership.setUuid(uuid);
return newMembership;
}
} }

View File

@ -81,7 +81,6 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
.partner(givenPartner) .partner(givenPartner)
.mainDebitor(givenDebitor) .mainDebitor(givenDebitor)
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01"))) .validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
.membershipFeeBillable(true)
.build()); .build());
return membershipRepo.save(newMembership); return membershipRepo.save(newMembership);
}); });
@ -112,7 +111,6 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
.partner(givenPartner) .partner(givenPartner)
.mainDebitor(givenDebitor) .mainDebitor(givenDebitor)
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01"))) .validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
.membershipFeeBillable(true)
.build()); .build());
return membershipRepo.save(newMembership); return membershipRepo.save(newMembership);
}); });
@ -418,7 +416,6 @@ class HsOfficeMembershipRepositoryIntegrationTest extends ContextBasedTest {
.partner(givenPartner) .partner(givenPartner)
.mainDebitor(givenDebitor) .mainDebitor(givenDebitor)
.validity(Range.closedInfinite(LocalDate.parse("2020-01-01"))) .validity(Range.closedInfinite(LocalDate.parse("2020-01-01")))
.membershipFeeBillable(true)
.build(); .build();
toCleanup(newMembership); toCleanup(newMembership);