Skip to content

GLSP-1829: Add unit tests for the editor bundle and fix the bugs they expose - #154

Open
tortmayr wants to merge 2 commits into
masterfrom
improve-unit-tests
Open

tortmayr wants to merge 2 commits into
masterfrom
improve-unit-tests

Conversation

@tortmayr

Copy link
Copy Markdown
Contributor

What it does

Follow-up of #153 that adds unit tests for the pure logic classes of org.eclipse.glsp.ide.editor and fixes the bugs they surfaced.

  • Cover IdeGLSPClient, IdeMessageConsumer, DefaultModelInitializationConstraint, the marker severity mapping, the key binding forwarding and UrlUtils
  • Fix MessageAction details showing up as Optional[...] in the error log and error dialog
  • Map FATAL messages to IStatus.ERROR instead of CANCEL, and treat a missing or unknown severity as OK instead of throwing
  • Return an empty Optional from GLSPEditorRegistry.getGLSPServerManager for an unknown editor id instead of throwing a NullPointerException
  • Encode query parameter keys in UrlUtils and drop a leading slash from the base URL, which produced // in the editor URL

Fixes eclipse-glsp/glsp#1829

How to test

mvn -f server clean verify
  • All 30 tests pass and checkstyle is clean (verified locally)
  • Without the fixes in org.eclipse.glsp.ide.editor, 6 of the new tests fail

Follow-ups

  • Key events like ArrowUp are not forwarded to Eclipse key bindings, as ARROWUP is no valid Eclipse key name
  • Tests that need a workspace: marker creation and deletion sync, IdeClientOptions, ResourceUtil

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

… expose

- Cover IdeGLSPClient, IdeMessageConsumer, the model initialization
  constraint, the marker severity mapping, the key binding forwarding
  and UrlUtils
- Fix MessageAction details showing up as "Optional[...]" in the
  error log and dialog
- Parse message and status severities with a shared helper that
  treats missing or unknown values as NONE instead of throwing, and
  map FATAL messages to IStatus.ERROR instead of CANCEL
- Return an empty Optional from GLSPEditorRegistry for an unknown
  editor id instead of throwing a NullPointerException
- Encode query parameter keys in UrlUtils and drop a leading slash
  from the base URL, which produced "//" in the editor URL

Fixes eclipse-glsp/glsp#1829
@tortmayr
tortmayr requested a review from fismif November 18, 2026 14:31

@fismif fismif left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM!

I verified this locally:

  • mvn -f server clean verify passes: 31 tests, Checkstyle clean.
  • With the old plugin code put back, the new tests fail as described.
  • The workflow example works in a runtime Eclipse: the diagram opens, Ctrl+Z and Ctrl+S are forwarded, and the status bar shows the right icon.

Minor, non-blocking:

  • GLSPDiagramComposite.encodeParameter still uses the old "UTF-8" / UnsupportedEncodingException pattern removed from UrlUtils. It could use StandardCharsets.UTF_8 too.
  • The error dialog still shows the message twice: once as the dialog text and again as the first line of the "Reason" section, because the status text includes the message as well as the details. Not introduced here, but this PR touches that output, so it may be worth fixing.

- Pass only the details as the dialog status when a message has both
  message and details, since ErrorDialog repeats the status text as
  "Reason" below the dialog message
- Encode parameters in GLSPDiagramComposite with StandardCharsets.UTF_8,
  dropping the unreachable UnsupportedEncodingException

Part of: eclipse-glsp/glsp#1829
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.

[Eclipse] Add unit tests for the editor bundle and fix the bugs they expose

2 participants