Fix Microsoft Graph filter rendering for Boolean and null values, improves guest invitation creation logic, updates the Maven build for Java 17 and the current connector parent, fix the TestNG/Surefire setup so unit and integration tests run reliably.#45
Open
lubomarton wants to merge 1 commit into
Conversation
improves guest invitation creation logic, updates the Maven build for Java 17 and the current connector parent, fix the TestNG/Surefire setup so unit and integration tests run reliably.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes Microsoft Graph filter rendering for Boolean and null values, improves guest invitation creation logic, updates the Maven build for Java 17 and the current connector parent, and fixes the TestNG/Surefire setup so unit and integration tests run reliably.
Filter
The connector now renders OData Boolean and null literals instead of wrapping them as strings.
Examples:
accountEnabled = true->accountEnabled eq trueonPremisesSyncEnabled = false->onPremisesSyncEnabled eq falseonPremisesSyncEnabled = null->onPremisesSyncEnabled eq nullNull equality also enables
$count=true, which is required for Microsoft Graph advanced directory queries.Guest invitation
Guest invitation creation is now selected explicitly by:
inviteGuests = truemailis presentuserType = GuestThe connector no longer relies on comparing the mail domain with
tenantId.The invitation path now rejects invalid guest-create input:
userPrincipalNamemust not be provided for invitation-based guest creation.This avoids accidentally creating a normal user or sending invalid invitation payloads.
Invitation message payload
UserProcessing.buildInvitation()now createsinvitedUserMessageInfoaccording to the Microsoft Graph schema.Previously, the configured invitation message was sent directly as a string:
{ "invitedUserMessageInfo": "Welcome message" }Microsoft Graph requires invitedUserMessageInfo to be an object. The connector now sends:
{ "invitedUserMessageInfo": { "customizedMessageBody": "Welcome message" } }The invitedUserMessageInfo property is omitted when the configured invitation message is empty or blank. This allows Microsoft Graph to use its default invitation message.
The invitation payload continues to include:
invitedUserEmailAddress
invitedUserDisplayName when available
invitedUserType
inviteRedirectUrl
sendInvitationMessage
Reference: Microsoft Graph invitedUserMessageInfo resource documentation:
https://learn.microsoft.com/en-us/graph/api/resources/invitedusermessageinfo?view=graph-rest-1.0
Test infrastructure
This PR also fixes and improves tests:
unitas the default test group.MockGraphEndpointinitialization so unit tests do not fail on null configuration.SchemaTranslatorFilterTestto use a mock endpoint-backed schema translator.ListAllTestwith TestNG Assert.Added test coverage
Unit tests:
Integration tests:
accountEnabled = trueaccountEnabled = falseonPremisesSyncEnabled = null"null"mapped to OData null literalNotes
Integration tests require a real Microsoft Entra test tenant and valid application credentials in local test properties. They create and delete test users, so they should not be run against a production tenant.
Testing
Unit tests:
Integration tests:
mvn -Dtest=FilteringTest -Dgroups=integration testTargeted invitation unit tests:
mvn -Dtest=UserProcessingTest#testCreateGuestUsesInvitationWhenUpnAndPasswordAreMissing+testCreateGuestInvitationRejectsUserPrincipalName+testCreateGuestInvitationRejectsPassword -Dgroups=unit testBuild and dependency updates
This PR also updates the Maven build configuration to align the connector with the current connector parent and Java baseline.
POM changes include:
connector-parentto1.5.2.0.Keeps unit as the default TestNG group via:
Adds an explicit Surefire version property:
Forces Maven Surefire to use the TestNG provider by adding surefire-testng as a plugin dependency.
This prevents Surefire from auto-detecting the JUnit Platform provider and silently running zero TestNG tests.
Dependency updates include:
Dependency management updates include: