Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: demand and capacity notification improvements #576

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

eschrewe
Copy link
Contributor

@eschrewe eschrewe commented Sep 4, 2024

Description

  • fixed/improved DemandAndCapacitySammMapper:
  • now properly distinguishes between Samms that came from a supplier or a customer, when identifying the affected materials
  • now using customermaterialnumber / suppliermaterialnumber fields in the samm/json payload
  • added unit tests for samm mapper
  • solves Add tests for serialization of SAMM models #465

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

  • DEPENDENCIES are up-to-date. Dash license tool. Committers can open IP issues for restricted libs.
  • Copyright and license header are present on all affected files
  • If helm chart has been changed, the chart version has been bumped to either next major, minor or patch level (compared to released chart).

Copy link
Contributor

@tom-rm-meyer-ISST tom-rm-meyer-ISST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test correct mapping of all fields. Beside that you solved #486 ! Thanks a lot :)

Copy link
Contributor

@tom-rm-meyer-ISST tom-rm-meyer-ISST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently only serialization has been checked with regard to material mapping. Please also add mapping assertions for deserialization.

Assertions.assertEquals(StatusEnumeration.OPEN, reportedDemandAndCapacityNotification.getStatus());
Assertions.assertEquals(LeadingRootCauseEnumeration.LOGISTICS_DISRUPTION, reportedDemandAndCapacityNotification.getLeadingRootCause());
Assertions.assertEquals(EffectEnumeration.CAPACITY_REDUCTION, reportedDemandAndCapacityNotification.getEffect());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add assertions for material numbers. Currently we have checks only for serialization but not for deserialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test asserts, that the ReportedDemandAndCapacityNotification entity, we receive from the Samm Mapper contains the expected material entity (and no other material). see lines 205, 206.

The ReportedDemandAndCapacityNotification in itself does not contain any material numbers, so there is nothing to assert here. The material numbers only exist as members of the material entities / mpr entities.

Perhaps some more explanation, what this test method is actually meant to do, might be helpful:

The "testSammDeSerializationAsCustomer" is focused on showing, whether the material identification logic in the DemandAndCapacityNotificationSammMapper (lines 97 - 121) works as expected.

The SAMM's usually contain redundat information on the affected materials, since they (usually) not only contain a the CX-id but also the customer-/supplier materialnumbers.

This test is repeated three times with different samm inputs. While the first input "regularSammFromSupplier" contains fully redundant information, the other two tests cases have partially missing information ("sammWithoutCXIdFromSupplier", "sammWithoutCXIdAndSupplierMnrFromSupplier")

for (var field: jsonNode.get("materialNumberCustomer")) {
Assertions.assertEquals(CUSTOMER_MAT_NUMBER, field.asText());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add check for cx material number as it has been set to partnerMaterialNumberCx previously

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Assertions.assertEquals(StatusEnumeration.OPEN, reportedDemandAndCapacityNotification.getStatus());
Assertions.assertEquals(LeadingRootCauseEnumeration.LOGISTICS_DISRUPTION, reportedDemandAndCapacityNotification.getLeadingRootCause());
Assertions.assertEquals(EffectEnumeration.CAPACITY_REDUCTION, reportedDemandAndCapacityNotification.getEffect());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Please add material number checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Demand And Capacity Notification Endpoint does not accept materials
2 participants