Skip to content

Commit

Permalink
Refactor: Remove common values in Pool test data
Browse files Browse the repository at this point in the history
  • Loading branch information
SujitMBRDI committed Sep 25, 2023
1 parent 31aa493 commit 34f12b1
Show file tree
Hide file tree
Showing 17 changed files with 867 additions and 1,050 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,25 +220,25 @@ object ResponseValues {
)

val legalEntityResponseGate1 = LegalEntityVerboseDto(
bpnl = CommonValues.bpn1,
legalShortName = CommonValues.shortName1,
legalForm = legalForm1,
states = listOf(leBusinessStatus1),
classifications = listOf(classification1, classification2),
currentness = CommonValues.now,
createdAt = CommonValues.now,
updatedAt = CommonValues.now,
bpnl = CommonValues.bpn1,
legalShortName = CommonValues.shortName1,
legalForm = legalForm1,
states = listOf(leBusinessStatus1),
classifications = listOf(classification1, classification2),
currentness = CommonValues.now,
createdAt = CommonValues.now,
updatedAt = CommonValues.now,
)

val legalEntityResponseGate2 = LegalEntityVerboseDto(
bpnl = CommonValues.bpn2,
legalShortName = CommonValues.shortName3,
legalForm = legalForm2,
states = listOf(leBusinessStatus2),
classifications = listOf(classification3, classification4),
currentness = CommonValues.now,
createdAt = CommonValues.now,
updatedAt = CommonValues.now,
bpnl = CommonValues.bpn2,
legalShortName = CommonValues.shortName3,
legalForm = legalForm2,
states = listOf(leBusinessStatus2),
classifications = listOf(classification3, classification4),
currentness = CommonValues.now,
createdAt = CommonValues.now,
updatedAt = CommonValues.now,
)

//Response values for Site and LegalEntity created Addresses (Input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class InvalidIndexStartupIT @Autowired constructor(
testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class ValidIndexStartupIT @Autowired constructor(
testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
),
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate2,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2,
),
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate3,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3,
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class OpenSearchControllerIT @Autowired constructor(

// We import 3 legal entities which result in 6 OpenSearch records: 3 for the LEs itself and 3 for the corresponding legal addresses.
val partnerDocs = listOf(
RequestValues.legalEntityCreate1,
RequestValues.legalEntityCreate2,
RequestValues.legalEntityCreate3
BusinessPartnerNonVerboseValues.legalEntityCreate1,
BusinessPartnerNonVerboseValues.legalEntityCreate2,
BusinessPartnerNonVerboseValues.legalEntityCreate3
)

@BeforeEach
Expand All @@ -81,13 +81,13 @@ class OpenSearchControllerIT @Autowired constructor(
testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
),
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate2,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2,
),
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate3,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3,
)
)
)
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,24 @@ class AddressControllerSearchIT @Autowired constructor(
// the expected result, ideally with minimal effort utilizing helper functions or probably Kotlin's powerful builders.

val partnerStructure1 = LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
addresses = listOf(RequestValues.addressPartnerCreate1, RequestValues.addressPartnerCreate3)
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1, BusinessPartnerNonVerboseValues.addressPartnerCreate3)
)


val partnerStructure2 = LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate2,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2,
siteStructures = listOf(
SiteStructureRequest(
site = RequestValues.siteCreate1,
addresses = listOf(RequestValues.addressPartnerCreate2)
site = BusinessPartnerNonVerboseValues.siteCreate1,
addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate2)
)
)
)

val partnerStructure3 = LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
addresses = listOf(RequestValues.addressPartnerCreate4)
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate4)
)

private lateinit var givenAddress1: LogisticAddressVerboseDto
Expand Down Expand Up @@ -109,7 +109,7 @@ class AddressControllerSearchIT @Autowired constructor(


val addressSearchRequest = AddressPartnerSearchRequest()
addressSearchRequest.name = RequestValues.addressPartnerCreate4.address.name
addressSearchRequest.name = BusinessPartnerNonVerboseValues.addressPartnerCreate4.address.name

val pageResponse = poolClient.addresses.getAddresses(addressSearchRequest, PaginationRequest())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ class BpnControllerIT @Autowired constructor(
val poolClient: PoolClientImpl
) {

val identifierType = RequestValues.legalEntityCreate1.legalEntity.identifiers.first().type
val identifierValue1 = RequestValues.legalEntityCreate1.legalEntity.identifiers.first().value
val identifierValue2 = RequestValues.legalEntityCreate2.legalEntity.identifiers.first().value
val identifierValue3 = RequestValues.legalEntityCreate3.legalEntity.identifiers.first().value
val identifierType = BusinessPartnerNonVerboseValues.legalEntityCreate1.legalEntity.identifiers.first().type
val identifierValue1 = BusinessPartnerNonVerboseValues.legalEntityCreate1.legalEntity.identifiers.first().value
val identifierValue2 = BusinessPartnerNonVerboseValues.legalEntityCreate2.legalEntity.identifiers.first().value
val identifierValue3 = BusinessPartnerNonVerboseValues.legalEntityCreate3.legalEntity.identifiers.first().value

@BeforeEach
fun beforeEach() {
// ensure LE1 and 2 have same identifierType
val legalEntityCreate1 = with(RequestValues.legalEntityCreate1) { copy(
val legalEntityCreate1 = with(BusinessPartnerNonVerboseValues.legalEntityCreate1) { copy(
legalEntity = legalEntity.copy(
identifiers = listOf(LegalEntityIdentifierDto(identifierValue1, identifierType, null))
)
) }
val legalEntityCreate2 = with(RequestValues.legalEntityCreate2) { copy(
val legalEntityCreate2 = with(BusinessPartnerNonVerboseValues.legalEntityCreate2) { copy(
legalEntity = legalEntity.copy(
identifiers = listOf(LegalEntityIdentifierDto(identifierValue2, identifierType, null))
)
) }
val legalEntityCreate3 = RequestValues.legalEntityCreate3
val legalEntityCreate3 = BusinessPartnerNonVerboseValues.legalEntityCreate3

testHelpers.truncateDbTables()
testHelpers.createTestMetadata()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class ChangelogControllerIT @Autowired constructor(

val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1),
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2)
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2)
)
)
val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl
Expand All @@ -80,8 +80,8 @@ class ChangelogControllerIT @Autowired constructor(

poolClient.legalEntities.updateBusinessPartners(
listOf(
RequestValues.legalEntityUpdate1.copy(bpnl = bpnL1),
RequestValues.legalEntityUpdate2.copy(bpnl = bpnL2)
BusinessPartnerNonVerboseValues.legalEntityUpdate1.copy(bpnl = bpnL1),
BusinessPartnerNonVerboseValues.legalEntityUpdate2.copy(bpnl = bpnL2)
)
)

Expand Down Expand Up @@ -122,10 +122,10 @@ class ChangelogControllerIT @Autowired constructor(
val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
siteStructures = listOf(
SiteStructureRequest(site = RequestValues.siteCreate1),
SiteStructureRequest(site = RequestValues.siteCreate2),
SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1),
SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate2),
)
)
)
Expand All @@ -139,8 +139,8 @@ class ChangelogControllerIT @Autowired constructor(

poolClient.sites.updateSite(
listOf(
RequestValues.siteUpdate1.copy(bpns = bpnS1),
RequestValues.siteUpdate2.copy(bpns = bpnS2)
BusinessPartnerNonVerboseValues.siteUpdate1.copy(bpns = bpnS1),
BusinessPartnerNonVerboseValues.siteUpdate2.copy(bpns = bpnS2)
)
)

Expand Down Expand Up @@ -183,9 +183,9 @@ class ChangelogControllerIT @Autowired constructor(
val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
addresses = listOf(RequestValues.addressPartnerCreate1),
siteStructures = listOf(SiteStructureRequest(site = RequestValues.siteCreate1, addresses = listOf(RequestValues.addressPartnerCreate2)))
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate1),
siteStructures = listOf(SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1, addresses = listOf(BusinessPartnerNonVerboseValues.addressPartnerCreate2)))
)
)
)
Expand All @@ -198,8 +198,8 @@ class ChangelogControllerIT @Autowired constructor(

poolClient.addresses.updateAddresses(
listOf(
RequestValues.addressPartnerUpdate1.copy(bpna = bpnA1),
RequestValues.addressPartnerUpdate2.copy(bpna = bpnA2)
BusinessPartnerNonVerboseValues.addressPartnerUpdate1.copy(bpna = bpnA1),
BusinessPartnerNonVerboseValues.addressPartnerUpdate2.copy(bpna = bpnA2)
)
)

Expand Down Expand Up @@ -241,9 +241,9 @@ class ChangelogControllerIT @Autowired constructor(

val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1),
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2),
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate3),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3),
)
)
val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl
Expand Down Expand Up @@ -293,8 +293,8 @@ class ChangelogControllerIT @Autowired constructor(
val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(
legalEntity = RequestValues.legalEntityCreate1,
siteStructures = listOf(SiteStructureRequest(site = RequestValues.siteCreate1))
legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1,
siteStructures = listOf(SiteStructureRequest(site = BusinessPartnerNonVerboseValues.siteCreate1))
)
)
)
Expand Down Expand Up @@ -355,9 +355,9 @@ class ChangelogControllerIT @Autowired constructor(

val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1),
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2),
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate3)
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3)
)
)
val bpnL1 = createdStructures[0].legalEntity.legalEntity.bpnl
Expand Down Expand Up @@ -392,7 +392,7 @@ class ChangelogControllerIT @Autowired constructor(

testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate1)
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate1)
)
)

Expand All @@ -401,8 +401,8 @@ class ChangelogControllerIT @Autowired constructor(

val createdStructures = testHelpers.createBusinessPartnerStructure(
listOf(
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate2),
LegalEntityStructureRequest(legalEntity = RequestValues.legalEntityCreate3)
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate2),
LegalEntityStructureRequest(legalEntity = BusinessPartnerNonVerboseValues.legalEntityCreate3)
)
)

Expand Down
Loading

0 comments on commit 34f12b1

Please sign in to comment.