Skip to content

Conversation

@cescoffier
Copy link

@mkouba there are test failures (that's expected). I will add more tests soon.

void testConnectionNotAccessibleOutsideOfWsMethods() {
assertThat(CDI.current().getBeanContainer().isScope(SessionScoped.class)).isFalse();
assertThat(CDI.current().getBeanContainer().isScope(RequestScoped.class)).isTrue();
assertThat(connection).isNull();
Copy link
Owner

Choose a reason for hiding this comment

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

It won't be null - a client proxy is injected. If you try to call a method you should get ContextNotActiveException.


@OnMessage
public String onMessage(String message) {
assertThat(CDI.current().getBeanContainer().isScope(SessionScoped.class)).isTrue();
Copy link
Owner

Choose a reason for hiding this comment

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

This does not test what you expect ;-). It merely tests if the class represents a scope annotation. Which it does. In order to test active context, you can try something like Arc.container().getActiveContext(SessionScoped.class) != null.

@mkouba
Copy link
Owner

mkouba commented Feb 21, 2024

I've cherry-picked the commit, fixed the assertions (DeploymentException -> WebSocketServerException). There were actually no validation failures ;-). Thanks!

@mkouba mkouba closed this Feb 21, 2024
mkouba added a commit that referenced this pull request Jan 31, 2025
mkouba added a commit that referenced this pull request Feb 12, 2025
Qute: fix template global class generation in the dev mode #2
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.

2 participants